@greensecurity/javascript-sdk 0.30.25 → 0.30.27
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 +6 -0
- package/bin/mcp-server.js +3094 -2868
- package/bin/mcp-server.js.map +23 -20
- package/dist/commonjs/__tests__/companies.test.d.ts +2 -0
- package/dist/commonjs/__tests__/companies.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/companies.test.js +51 -0
- package/dist/commonjs/__tests__/companies.test.js.map +1 -0
- 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 +3 -3
- package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
- package/dist/commonjs/funcs/companiesListOrSearchCompanies.d.ts +20 -0
- package/dist/commonjs/funcs/companiesListOrSearchCompanies.d.ts.map +1 -0
- package/dist/commonjs/funcs/companiesListOrSearchCompanies.js +155 -0
- package/dist/commonjs/funcs/companiesListOrSearchCompanies.js.map +1 -0
- package/dist/commonjs/funcs/vendorsListVendorInvoices.js +1 -1
- package/dist/commonjs/funcs/vendorsListVendorInvoices.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/matchers.d.ts +3 -1
- package/dist/commonjs/lib/matchers.d.ts.map +1 -1
- package/dist/commonjs/lib/matchers.js +12 -0
- package/dist/commonjs/lib/matchers.js.map +1 -1
- package/dist/commonjs/lib/sdks.js +7 -2
- 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 +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/companiesListOrSearchCompanies.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/companiesListOrSearchCompanies.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/companiesListOrSearchCompanies.js +64 -0
- package/dist/commonjs/mcp-server/tools/companiesListOrSearchCompanies.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/listorsearchcompanies.d.ts +111 -0
- package/dist/commonjs/models/operations/listorsearchcompanies.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listorsearchcompanies.js +153 -0
- package/dist/commonjs/models/operations/listorsearchcompanies.js.map +1 -0
- package/dist/commonjs/models/operations/listvendorinvoices.d.ts +57 -27
- package/dist/commonjs/models/operations/listvendorinvoices.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listvendorinvoices.js +31 -21
- package/dist/commonjs/models/operations/listvendorinvoices.js.map +1 -1
- package/dist/commonjs/react-query/companiesListOrSearchCompanies.d.ts +78 -0
- package/dist/commonjs/react-query/companiesListOrSearchCompanies.d.ts.map +1 -0
- package/dist/commonjs/react-query/companiesListOrSearchCompanies.js +161 -0
- package/dist/commonjs/react-query/companiesListOrSearchCompanies.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/vendorsListVendorInvoices.d.ts +3 -3
- package/dist/commonjs/react-query/vendorsListVendorInvoices.d.ts.map +1 -1
- package/dist/commonjs/react-query/vendorsListVendorInvoices.js +2 -2
- package/dist/commonjs/react-query/vendorsListVendorInvoices.js.map +1 -1
- package/dist/commonjs/sdk/companies.d.ts +15 -0
- package/dist/commonjs/sdk/companies.d.ts.map +1 -0
- package/dist/commonjs/sdk/companies.js +22 -0
- package/dist/commonjs/sdk/companies.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/esm/__tests__/companies.test.d.ts +2 -0
- package/dist/esm/__tests__/companies.test.d.ts.map +1 -0
- package/dist/esm/__tests__/companies.test.js +49 -0
- package/dist/esm/__tests__/companies.test.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 +3 -3
- package/dist/esm/__tests__/vendors.test.js.map +1 -1
- package/dist/esm/funcs/companiesListOrSearchCompanies.d.ts +20 -0
- package/dist/esm/funcs/companiesListOrSearchCompanies.d.ts.map +1 -0
- package/dist/esm/funcs/companiesListOrSearchCompanies.js +119 -0
- package/dist/esm/funcs/companiesListOrSearchCompanies.js.map +1 -0
- package/dist/esm/funcs/vendorsListVendorInvoices.js +1 -1
- package/dist/esm/funcs/vendorsListVendorInvoices.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/matchers.d.ts +3 -1
- package/dist/esm/lib/matchers.d.ts.map +1 -1
- package/dist/esm/lib/matchers.js +10 -0
- package/dist/esm/lib/matchers.js.map +1 -1
- package/dist/esm/lib/sdks.js +7 -2
- 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 +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/companiesListOrSearchCompanies.d.ts +8 -0
- package/dist/esm/mcp-server/tools/companiesListOrSearchCompanies.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/companiesListOrSearchCompanies.js +28 -0
- package/dist/esm/mcp-server/tools/companiesListOrSearchCompanies.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/listorsearchcompanies.d.ts +111 -0
- package/dist/esm/models/operations/listorsearchcompanies.d.ts.map +1 -0
- package/dist/esm/models/operations/listorsearchcompanies.js +111 -0
- package/dist/esm/models/operations/listorsearchcompanies.js.map +1 -0
- package/dist/esm/models/operations/listvendorinvoices.d.ts +57 -27
- package/dist/esm/models/operations/listvendorinvoices.d.ts.map +1 -1
- package/dist/esm/models/operations/listvendorinvoices.js +30 -20
- package/dist/esm/models/operations/listvendorinvoices.js.map +1 -1
- package/dist/esm/react-query/companiesListOrSearchCompanies.d.ts +78 -0
- package/dist/esm/react-query/companiesListOrSearchCompanies.d.ts.map +1 -0
- package/dist/esm/react-query/companiesListOrSearchCompanies.js +148 -0
- package/dist/esm/react-query/companiesListOrSearchCompanies.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/vendorsListVendorInvoices.d.ts +3 -3
- package/dist/esm/react-query/vendorsListVendorInvoices.d.ts.map +1 -1
- package/dist/esm/react-query/vendorsListVendorInvoices.js +2 -2
- package/dist/esm/react-query/vendorsListVendorInvoices.js.map +1 -1
- package/dist/esm/sdk/companies.d.ts +15 -0
- package/dist/esm/sdk/companies.d.ts.map +1 -0
- package/dist/esm/sdk/companies.js +18 -0
- package/dist/esm/sdk/companies.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/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/companies.test.ts +52 -0
- package/src/__tests__/vendormanagedbycompanies.test.ts +1 -1
- package/src/__tests__/vendors.test.ts +3 -3
- package/src/funcs/companiesListOrSearchCompanies.ts +246 -0
- package/src/funcs/vendorsListVendorInvoices.ts +1 -1
- package/src/lib/config.ts +3 -3
- package/src/lib/matchers.ts +20 -0
- package/src/lib/sdks.ts +8 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/companiesListOrSearchCompanies.ts +38 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listorsearchcompanies.ts +264 -0
- package/src/models/operations/listvendorinvoices.ts +37 -27
- package/src/react-query/companiesListOrSearchCompanies.ts +345 -0
- package/src/react-query/index.ts +1 -0
- package/src/react-query/vendorsListVendorInvoices.ts +5 -5
- package/src/sdk/companies.ts +29 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,246 @@
|
|
|
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 } 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 { 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
|
+
import {
|
|
28
|
+
createPageIterator,
|
|
29
|
+
haltIterator,
|
|
30
|
+
PageIterator,
|
|
31
|
+
Paginator,
|
|
32
|
+
} from "../types/operations.js";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* List or search companies
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* List or search companies.
|
|
39
|
+
*/
|
|
40
|
+
export function companiesListOrSearchCompanies(
|
|
41
|
+
client: GreenSecurityCore,
|
|
42
|
+
request: operations.ListOrSearchCompaniesRequest,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
PageIterator<
|
|
46
|
+
Result<
|
|
47
|
+
operations.ListOrSearchCompaniesResponse,
|
|
48
|
+
| errors.ApiErrorResponse
|
|
49
|
+
| errors.ApiErrorResponse
|
|
50
|
+
| APIError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| InvalidRequestError
|
|
54
|
+
| RequestAbortedError
|
|
55
|
+
| RequestTimeoutError
|
|
56
|
+
| ConnectionError
|
|
57
|
+
>,
|
|
58
|
+
{ page: number }
|
|
59
|
+
>
|
|
60
|
+
> {
|
|
61
|
+
return new APIPromise($do(
|
|
62
|
+
client,
|
|
63
|
+
request,
|
|
64
|
+
options,
|
|
65
|
+
));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function $do(
|
|
69
|
+
client: GreenSecurityCore,
|
|
70
|
+
request: operations.ListOrSearchCompaniesRequest,
|
|
71
|
+
options?: RequestOptions,
|
|
72
|
+
): Promise<
|
|
73
|
+
[
|
|
74
|
+
PageIterator<
|
|
75
|
+
Result<
|
|
76
|
+
operations.ListOrSearchCompaniesResponse,
|
|
77
|
+
| errors.ApiErrorResponse
|
|
78
|
+
| errors.ApiErrorResponse
|
|
79
|
+
| APIError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
| UnexpectedClientError
|
|
82
|
+
| InvalidRequestError
|
|
83
|
+
| RequestAbortedError
|
|
84
|
+
| RequestTimeoutError
|
|
85
|
+
| ConnectionError
|
|
86
|
+
>,
|
|
87
|
+
{ page: number }
|
|
88
|
+
>,
|
|
89
|
+
APICall,
|
|
90
|
+
]
|
|
91
|
+
> {
|
|
92
|
+
const parsed = safeParse(
|
|
93
|
+
request,
|
|
94
|
+
(value) =>
|
|
95
|
+
operations.ListOrSearchCompaniesRequest$outboundSchema.parse(value),
|
|
96
|
+
"Input validation failed",
|
|
97
|
+
);
|
|
98
|
+
if (!parsed.ok) {
|
|
99
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
100
|
+
}
|
|
101
|
+
const payload = parsed.value;
|
|
102
|
+
const body = null;
|
|
103
|
+
|
|
104
|
+
const path = pathToFunc("/companies")();
|
|
105
|
+
|
|
106
|
+
const query = encodeFormQuery({
|
|
107
|
+
"desc": payload.desc,
|
|
108
|
+
"items_per_page": payload.items_per_page,
|
|
109
|
+
"name_like": payload.name_like,
|
|
110
|
+
"page": payload.page,
|
|
111
|
+
"sort": payload.sort,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const headers = new Headers(compactMap({
|
|
115
|
+
Accept: "application/json",
|
|
116
|
+
}));
|
|
117
|
+
|
|
118
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
119
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
120
|
+
|
|
121
|
+
const context = {
|
|
122
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
123
|
+
operationID: "listOrSearchCompanies",
|
|
124
|
+
oAuth2Scopes: [],
|
|
125
|
+
|
|
126
|
+
resolvedSecurity: requestSecurity,
|
|
127
|
+
|
|
128
|
+
securitySource: client._options.security,
|
|
129
|
+
retryConfig: options?.retries
|
|
130
|
+
|| client._options.retryConfig
|
|
131
|
+
|| { strategy: "none" },
|
|
132
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const requestRes = client._createRequest(context, {
|
|
136
|
+
security: requestSecurity,
|
|
137
|
+
method: "GET",
|
|
138
|
+
baseURL: options?.serverURL,
|
|
139
|
+
path: path,
|
|
140
|
+
headers: headers,
|
|
141
|
+
query: query,
|
|
142
|
+
body: body,
|
|
143
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
144
|
+
}, options);
|
|
145
|
+
if (!requestRes.ok) {
|
|
146
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
147
|
+
}
|
|
148
|
+
const req = requestRes.value;
|
|
149
|
+
|
|
150
|
+
const doResult = await client._do(req, {
|
|
151
|
+
context,
|
|
152
|
+
errorCodes: ["400", "403", "4XX", "500", "5XX"],
|
|
153
|
+
retryConfig: context.retryConfig,
|
|
154
|
+
retryCodes: context.retryCodes,
|
|
155
|
+
});
|
|
156
|
+
if (!doResult.ok) {
|
|
157
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
158
|
+
}
|
|
159
|
+
const response = doResult.value;
|
|
160
|
+
|
|
161
|
+
const responseFields = {
|
|
162
|
+
HttpMeta: { Response: response, Request: req },
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const [result, raw] = await M.match<
|
|
166
|
+
operations.ListOrSearchCompaniesResponse,
|
|
167
|
+
| errors.ApiErrorResponse
|
|
168
|
+
| errors.ApiErrorResponse
|
|
169
|
+
| APIError
|
|
170
|
+
| SDKValidationError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| InvalidRequestError
|
|
173
|
+
| RequestAbortedError
|
|
174
|
+
| RequestTimeoutError
|
|
175
|
+
| ConnectionError
|
|
176
|
+
>(
|
|
177
|
+
M.json(200, operations.ListOrSearchCompaniesResponse$inboundSchema, {
|
|
178
|
+
key: "Result",
|
|
179
|
+
}),
|
|
180
|
+
M.jsonErr([400, 403], errors.ApiErrorResponse$inboundSchema),
|
|
181
|
+
M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
|
|
182
|
+
M.fail("4XX"),
|
|
183
|
+
M.fail("5XX"),
|
|
184
|
+
)(response, { extraFields: responseFields });
|
|
185
|
+
if (!result.ok) {
|
|
186
|
+
return [haltIterator(result), {
|
|
187
|
+
status: "complete",
|
|
188
|
+
request: req,
|
|
189
|
+
response,
|
|
190
|
+
}];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const nextFunc = (
|
|
194
|
+
responseData: unknown,
|
|
195
|
+
): {
|
|
196
|
+
next: Paginator<
|
|
197
|
+
Result<
|
|
198
|
+
operations.ListOrSearchCompaniesResponse,
|
|
199
|
+
| errors.ApiErrorResponse
|
|
200
|
+
| errors.ApiErrorResponse
|
|
201
|
+
| APIError
|
|
202
|
+
| SDKValidationError
|
|
203
|
+
| UnexpectedClientError
|
|
204
|
+
| InvalidRequestError
|
|
205
|
+
| RequestAbortedError
|
|
206
|
+
| RequestTimeoutError
|
|
207
|
+
| ConnectionError
|
|
208
|
+
>
|
|
209
|
+
>;
|
|
210
|
+
"~next"?: { page: number };
|
|
211
|
+
} => {
|
|
212
|
+
const page = request?.page ?? 1;
|
|
213
|
+
const nextPage = page + 1;
|
|
214
|
+
|
|
215
|
+
if (!responseData) {
|
|
216
|
+
return { next: () => null };
|
|
217
|
+
}
|
|
218
|
+
const results = dlv(responseData, "items");
|
|
219
|
+
if (!Array.isArray(results) || !results.length) {
|
|
220
|
+
return { next: () => null };
|
|
221
|
+
}
|
|
222
|
+
const limit = request?.itemsPerPage ?? 0;
|
|
223
|
+
if (results.length < limit) {
|
|
224
|
+
return { next: () => null };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const nextVal = () =>
|
|
228
|
+
companiesListOrSearchCompanies(
|
|
229
|
+
client,
|
|
230
|
+
{
|
|
231
|
+
...request,
|
|
232
|
+
page: nextPage,
|
|
233
|
+
},
|
|
234
|
+
options,
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
241
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
242
|
+
status: "complete",
|
|
243
|
+
request: req,
|
|
244
|
+
response,
|
|
245
|
+
}];
|
|
246
|
+
}
|
|
@@ -117,8 +117,8 @@ async function $do(
|
|
|
117
117
|
}, { explode: false }),
|
|
118
118
|
encodeFormQuery({
|
|
119
119
|
"desc": payload.desc,
|
|
120
|
+
"invoice_financial_status": payload.invoice_financial_status,
|
|
120
121
|
"invoice_number": payload.invoice_number,
|
|
121
|
-
"invoice_status": payload.invoice_status,
|
|
122
122
|
"items_per_page": payload.items_per_page,
|
|
123
123
|
"page": payload.page,
|
|
124
124
|
"sort": payload.sort,
|
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.27",
|
|
76
|
+
genVersion: "2.578.0",
|
|
77
77
|
userAgent:
|
|
78
|
-
"speakeasy-sdk/typescript 0.30.
|
|
78
|
+
"speakeasy-sdk/typescript 0.30.27 2.578.0 0.0.3 @greensecurity/javascript-sdk",
|
|
79
79
|
} as const;
|
package/src/lib/matchers.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { isPlainObject } from "./is-plain-object.js";
|
|
|
10
10
|
import { safeParse } from "./schemas.js";
|
|
11
11
|
|
|
12
12
|
export type Encoding =
|
|
13
|
+
| "jsonl"
|
|
13
14
|
| "json"
|
|
14
15
|
| "text"
|
|
15
16
|
| "bytes"
|
|
@@ -19,6 +20,7 @@ export type Encoding =
|
|
|
19
20
|
| "fail";
|
|
20
21
|
|
|
21
22
|
const DEFAULT_CONTENT_TYPES: Record<Encoding, string> = {
|
|
23
|
+
jsonl: "application/jsonl",
|
|
22
24
|
json: "application/json",
|
|
23
25
|
text: "text/plain",
|
|
24
26
|
bytes: "application/octet-stream",
|
|
@@ -72,6 +74,21 @@ export function json<T>(
|
|
|
72
74
|
return { ...options, enc: "json", codes, schema };
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
export function jsonl<T>(
|
|
78
|
+
codes: StatusCodePredicate,
|
|
79
|
+
schema: Schema<T>,
|
|
80
|
+
options?: MatchOptions,
|
|
81
|
+
): ValueMatcher<T> {
|
|
82
|
+
return { ...options, enc: "jsonl", codes, schema };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function jsonlErr<E>(
|
|
86
|
+
codes: StatusCodePredicate,
|
|
87
|
+
schema: Schema<E>,
|
|
88
|
+
options?: MatchOptions,
|
|
89
|
+
): ErrorMatcher<E> {
|
|
90
|
+
return { ...options, err: true, enc: "jsonl", codes, schema };
|
|
91
|
+
}
|
|
75
92
|
export function textErr<E>(
|
|
76
93
|
codes: StatusCodePredicate,
|
|
77
94
|
schema: Schema<E>,
|
|
@@ -204,6 +221,9 @@ export function match<T, E>(
|
|
|
204
221
|
case "json":
|
|
205
222
|
raw = await response.json();
|
|
206
223
|
break;
|
|
224
|
+
case "jsonl":
|
|
225
|
+
raw = response.body;
|
|
226
|
+
break;
|
|
207
227
|
case "bytes":
|
|
208
228
|
raw = new Uint8Array(await response.arrayBuffer());
|
|
209
229
|
break;
|
package/src/lib/sdks.ts
CHANGED
|
@@ -302,7 +302,9 @@ export class ClientSDK {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
const jsonLikeContentTypeRE =
|
|
305
|
+
const jsonLikeContentTypeRE = /(application|text)\/.*?\+*json.*/;
|
|
306
|
+
const jsonlLikeContentTypeRE =
|
|
307
|
+
/(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;
|
|
306
308
|
async function logRequest(logger: Logger | undefined, req: Request) {
|
|
307
309
|
if (!logger) {
|
|
308
310
|
return;
|
|
@@ -368,9 +370,13 @@ async function logResponse(
|
|
|
368
370
|
logger.group("Body:");
|
|
369
371
|
switch (true) {
|
|
370
372
|
case matchContentType(res, "application/json")
|
|
371
|
-
|| jsonLikeContentTypeRE.test(ct):
|
|
373
|
+
|| jsonLikeContentTypeRE.test(ct) && !jsonlLikeContentTypeRE.test(ct):
|
|
372
374
|
logger.log(await res.clone().json());
|
|
373
375
|
break;
|
|
376
|
+
case matchContentType(res, "application/jsonl")
|
|
377
|
+
|| jsonlLikeContentTypeRE.test(ct):
|
|
378
|
+
logger.log(await res.clone().text());
|
|
379
|
+
break;
|
|
374
380
|
case matchContentType(res, "text/event-stream"):
|
|
375
381
|
logger.log(`<${contentType}>`);
|
|
376
382
|
break;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "./resources.js";
|
|
14
14
|
import { MCPScope } from "./scopes.js";
|
|
15
15
|
import { createRegisterTool } from "./tools.js";
|
|
16
|
+
import { tool$companiesListOrSearchCompanies } from "./tools/companiesListOrSearchCompanies.js";
|
|
16
17
|
import { tool$organizationsGetFacility } from "./tools/organizationsGetFacility.js";
|
|
17
18
|
import { tool$organizationsListOrSearchFacilities } from "./tools/organizationsListOrSearchFacilities.js";
|
|
18
19
|
import { tool$supportArticlesGetSupportArticle } from "./tools/supportArticlesGetSupportArticle.js";
|
|
@@ -57,7 +58,7 @@ export function createMCPServer(deps: {
|
|
|
57
58
|
}) {
|
|
58
59
|
const server = new McpServer({
|
|
59
60
|
name: "GreenSecurity",
|
|
60
|
-
version: "0.30.
|
|
61
|
+
version: "0.30.27",
|
|
61
62
|
});
|
|
62
63
|
|
|
63
64
|
const client = new GreenSecurityCore({
|
|
@@ -120,6 +121,7 @@ export function createMCPServer(deps: {
|
|
|
120
121
|
tool(tool$webhooksListAllWebhookEndpoints);
|
|
121
122
|
tool(tool$webhooksGetWebhookEndpoint);
|
|
122
123
|
tool(tool$vendorScansVendorScanOut);
|
|
124
|
+
tool(tool$companiesListOrSearchCompanies);
|
|
123
125
|
|
|
124
126
|
return server;
|
|
125
127
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { companiesListOrSearchCompanies } from "../../funcs/companiesListOrSearchCompanies.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.ListOrSearchCompaniesRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$companiesListOrSearchCompanies: ToolDefinition<typeof args> =
|
|
14
|
+
{
|
|
15
|
+
name: "companies-list-or-search-companies",
|
|
16
|
+
description: `List or search companies
|
|
17
|
+
|
|
18
|
+
List or search companies.`,
|
|
19
|
+
args,
|
|
20
|
+
tool: async (client, args, ctx) => {
|
|
21
|
+
const [result, apiCall] = await companiesListOrSearchCompanies(
|
|
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
|
+
};
|
|
@@ -14,6 +14,7 @@ export * from "./getvendorinvoicedetails.js";
|
|
|
14
14
|
export * from "./getvendorsdetails.js";
|
|
15
15
|
export * from "./getwebhookendpoint.js";
|
|
16
16
|
export * from "./listallwebhookendpoints.js";
|
|
17
|
+
export * from "./listorsearchcompanies.js";
|
|
17
18
|
export * from "./listorsearchfacilities.js";
|
|
18
19
|
export * from "./listorsearchsupportarticles.js";
|
|
19
20
|
export * from "./listvendoradditionalfacilityfields.js";
|
|
@@ -0,0 +1,264 @@
|
|
|
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 * as components from "../components/index.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type ListOrSearchCompaniesRequest = {
|
|
13
|
+
/**
|
|
14
|
+
* A comma-separated list of object attributes to sort on.
|
|
15
|
+
*/
|
|
16
|
+
sort?: string | null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Sort desc
|
|
19
|
+
*/
|
|
20
|
+
desc?: components.Desc | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* A 1-based offset for which page to request (defaults to 1)
|
|
23
|
+
*/
|
|
24
|
+
page?: number | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Number of items to show in a given page
|
|
27
|
+
*/
|
|
28
|
+
itemsPerPage?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* A partial string to search in the object name. Do not include any wildcard characters. Searches are not case-sensitive by default.
|
|
31
|
+
*/
|
|
32
|
+
nameLike?: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The request was successful, and the server has returned the requested resource in the response body.
|
|
37
|
+
*/
|
|
38
|
+
export type ListOrSearchCompaniesListOrSearchCompaniesOK = {
|
|
39
|
+
/**
|
|
40
|
+
* Pagination information for a pageable list
|
|
41
|
+
*/
|
|
42
|
+
pager: components.Pager;
|
|
43
|
+
items: Array<components.Company | null>;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type ListOrSearchCompaniesResponse = {
|
|
47
|
+
result: ListOrSearchCompaniesListOrSearchCompaniesOK;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const ListOrSearchCompaniesRequest$inboundSchema: z.ZodType<
|
|
52
|
+
ListOrSearchCompaniesRequest,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
unknown
|
|
55
|
+
> = z.object({
|
|
56
|
+
sort: z.nullable(z.string()).optional(),
|
|
57
|
+
desc: components.Desc$inboundSchema.optional(),
|
|
58
|
+
page: z.number().int().optional(),
|
|
59
|
+
items_per_page: z.number().int().optional(),
|
|
60
|
+
name_like: z.string().optional(),
|
|
61
|
+
}).transform((v) => {
|
|
62
|
+
return remap$(v, {
|
|
63
|
+
"items_per_page": "itemsPerPage",
|
|
64
|
+
"name_like": "nameLike",
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/** @internal */
|
|
69
|
+
export type ListOrSearchCompaniesRequest$Outbound = {
|
|
70
|
+
sort?: string | null | undefined;
|
|
71
|
+
desc?: components.Desc$Outbound | undefined;
|
|
72
|
+
page?: number | undefined;
|
|
73
|
+
items_per_page?: number | undefined;
|
|
74
|
+
name_like?: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const ListOrSearchCompaniesRequest$outboundSchema: z.ZodType<
|
|
79
|
+
ListOrSearchCompaniesRequest$Outbound,
|
|
80
|
+
z.ZodTypeDef,
|
|
81
|
+
ListOrSearchCompaniesRequest
|
|
82
|
+
> = z.object({
|
|
83
|
+
sort: z.nullable(z.string()).optional(),
|
|
84
|
+
desc: components.Desc$outboundSchema.optional(),
|
|
85
|
+
page: z.number().int().optional(),
|
|
86
|
+
itemsPerPage: z.number().int().optional(),
|
|
87
|
+
nameLike: z.string().optional(),
|
|
88
|
+
}).transform((v) => {
|
|
89
|
+
return remap$(v, {
|
|
90
|
+
itemsPerPage: "items_per_page",
|
|
91
|
+
nameLike: "name_like",
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
98
|
+
*/
|
|
99
|
+
export namespace ListOrSearchCompaniesRequest$ {
|
|
100
|
+
/** @deprecated use `ListOrSearchCompaniesRequest$inboundSchema` instead. */
|
|
101
|
+
export const inboundSchema = ListOrSearchCompaniesRequest$inboundSchema;
|
|
102
|
+
/** @deprecated use `ListOrSearchCompaniesRequest$outboundSchema` instead. */
|
|
103
|
+
export const outboundSchema = ListOrSearchCompaniesRequest$outboundSchema;
|
|
104
|
+
/** @deprecated use `ListOrSearchCompaniesRequest$Outbound` instead. */
|
|
105
|
+
export type Outbound = ListOrSearchCompaniesRequest$Outbound;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function listOrSearchCompaniesRequestToJSON(
|
|
109
|
+
listOrSearchCompaniesRequest: ListOrSearchCompaniesRequest,
|
|
110
|
+
): string {
|
|
111
|
+
return JSON.stringify(
|
|
112
|
+
ListOrSearchCompaniesRequest$outboundSchema.parse(
|
|
113
|
+
listOrSearchCompaniesRequest,
|
|
114
|
+
),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function listOrSearchCompaniesRequestFromJSON(
|
|
119
|
+
jsonString: string,
|
|
120
|
+
): SafeParseResult<ListOrSearchCompaniesRequest, SDKValidationError> {
|
|
121
|
+
return safeParse(
|
|
122
|
+
jsonString,
|
|
123
|
+
(x) => ListOrSearchCompaniesRequest$inboundSchema.parse(JSON.parse(x)),
|
|
124
|
+
`Failed to parse 'ListOrSearchCompaniesRequest' from JSON`,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** @internal */
|
|
129
|
+
export const ListOrSearchCompaniesListOrSearchCompaniesOK$inboundSchema:
|
|
130
|
+
z.ZodType<
|
|
131
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK,
|
|
132
|
+
z.ZodTypeDef,
|
|
133
|
+
unknown
|
|
134
|
+
> = z.object({
|
|
135
|
+
pager: components.Pager$inboundSchema,
|
|
136
|
+
items: z.array(z.nullable(components.Company$inboundSchema)),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
/** @internal */
|
|
140
|
+
export type ListOrSearchCompaniesListOrSearchCompaniesOK$Outbound = {
|
|
141
|
+
pager: components.Pager$Outbound;
|
|
142
|
+
items: Array<components.Company$Outbound | null>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/** @internal */
|
|
146
|
+
export const ListOrSearchCompaniesListOrSearchCompaniesOK$outboundSchema:
|
|
147
|
+
z.ZodType<
|
|
148
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$Outbound,
|
|
149
|
+
z.ZodTypeDef,
|
|
150
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK
|
|
151
|
+
> = z.object({
|
|
152
|
+
pager: components.Pager$outboundSchema,
|
|
153
|
+
items: z.array(z.nullable(components.Company$outboundSchema)),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @internal
|
|
158
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
159
|
+
*/
|
|
160
|
+
export namespace ListOrSearchCompaniesListOrSearchCompaniesOK$ {
|
|
161
|
+
/** @deprecated use `ListOrSearchCompaniesListOrSearchCompaniesOK$inboundSchema` instead. */
|
|
162
|
+
export const inboundSchema =
|
|
163
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$inboundSchema;
|
|
164
|
+
/** @deprecated use `ListOrSearchCompaniesListOrSearchCompaniesOK$outboundSchema` instead. */
|
|
165
|
+
export const outboundSchema =
|
|
166
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$outboundSchema;
|
|
167
|
+
/** @deprecated use `ListOrSearchCompaniesListOrSearchCompaniesOK$Outbound` instead. */
|
|
168
|
+
export type Outbound = ListOrSearchCompaniesListOrSearchCompaniesOK$Outbound;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function listOrSearchCompaniesListOrSearchCompaniesOKToJSON(
|
|
172
|
+
listOrSearchCompaniesListOrSearchCompaniesOK:
|
|
173
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK,
|
|
174
|
+
): string {
|
|
175
|
+
return JSON.stringify(
|
|
176
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$outboundSchema.parse(
|
|
177
|
+
listOrSearchCompaniesListOrSearchCompaniesOK,
|
|
178
|
+
),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function listOrSearchCompaniesListOrSearchCompaniesOKFromJSON(
|
|
183
|
+
jsonString: string,
|
|
184
|
+
): SafeParseResult<
|
|
185
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK,
|
|
186
|
+
SDKValidationError
|
|
187
|
+
> {
|
|
188
|
+
return safeParse(
|
|
189
|
+
jsonString,
|
|
190
|
+
(x) =>
|
|
191
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$inboundSchema.parse(
|
|
192
|
+
JSON.parse(x),
|
|
193
|
+
),
|
|
194
|
+
`Failed to parse 'ListOrSearchCompaniesListOrSearchCompaniesOK' from JSON`,
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** @internal */
|
|
199
|
+
export const ListOrSearchCompaniesResponse$inboundSchema: z.ZodType<
|
|
200
|
+
ListOrSearchCompaniesResponse,
|
|
201
|
+
z.ZodTypeDef,
|
|
202
|
+
unknown
|
|
203
|
+
> = z.object({
|
|
204
|
+
Result: z.lazy(() =>
|
|
205
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$inboundSchema
|
|
206
|
+
),
|
|
207
|
+
}).transform((v) => {
|
|
208
|
+
return remap$(v, {
|
|
209
|
+
"Result": "result",
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
/** @internal */
|
|
214
|
+
export type ListOrSearchCompaniesResponse$Outbound = {
|
|
215
|
+
Result: ListOrSearchCompaniesListOrSearchCompaniesOK$Outbound;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/** @internal */
|
|
219
|
+
export const ListOrSearchCompaniesResponse$outboundSchema: z.ZodType<
|
|
220
|
+
ListOrSearchCompaniesResponse$Outbound,
|
|
221
|
+
z.ZodTypeDef,
|
|
222
|
+
ListOrSearchCompaniesResponse
|
|
223
|
+
> = z.object({
|
|
224
|
+
result: z.lazy(() =>
|
|
225
|
+
ListOrSearchCompaniesListOrSearchCompaniesOK$outboundSchema
|
|
226
|
+
),
|
|
227
|
+
}).transform((v) => {
|
|
228
|
+
return remap$(v, {
|
|
229
|
+
result: "Result",
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @internal
|
|
235
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
236
|
+
*/
|
|
237
|
+
export namespace ListOrSearchCompaniesResponse$ {
|
|
238
|
+
/** @deprecated use `ListOrSearchCompaniesResponse$inboundSchema` instead. */
|
|
239
|
+
export const inboundSchema = ListOrSearchCompaniesResponse$inboundSchema;
|
|
240
|
+
/** @deprecated use `ListOrSearchCompaniesResponse$outboundSchema` instead. */
|
|
241
|
+
export const outboundSchema = ListOrSearchCompaniesResponse$outboundSchema;
|
|
242
|
+
/** @deprecated use `ListOrSearchCompaniesResponse$Outbound` instead. */
|
|
243
|
+
export type Outbound = ListOrSearchCompaniesResponse$Outbound;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function listOrSearchCompaniesResponseToJSON(
|
|
247
|
+
listOrSearchCompaniesResponse: ListOrSearchCompaniesResponse,
|
|
248
|
+
): string {
|
|
249
|
+
return JSON.stringify(
|
|
250
|
+
ListOrSearchCompaniesResponse$outboundSchema.parse(
|
|
251
|
+
listOrSearchCompaniesResponse,
|
|
252
|
+
),
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function listOrSearchCompaniesResponseFromJSON(
|
|
257
|
+
jsonString: string,
|
|
258
|
+
): SafeParseResult<ListOrSearchCompaniesResponse, SDKValidationError> {
|
|
259
|
+
return safeParse(
|
|
260
|
+
jsonString,
|
|
261
|
+
(x) => ListOrSearchCompaniesResponse$inboundSchema.parse(JSON.parse(x)),
|
|
262
|
+
`Failed to parse 'ListOrSearchCompaniesResponse' from JSON`,
|
|
263
|
+
);
|
|
264
|
+
}
|