@greensecurity/javascript-sdk 0.37.12 → 0.38.2

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.
Files changed (194) hide show
  1. package/README.md +6 -0
  2. package/bin/mcp-server.js +858 -436
  3. package/bin/mcp-server.js.map +18 -10
  4. package/dist/commonjs/__tests__/organizations.test.js +42 -0
  5. package/dist/commonjs/__tests__/organizations.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/vendors.test.js +16 -0
  7. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  8. package/dist/commonjs/__tests__/zones.test.js +4 -19
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.d.ts +26 -0
  11. package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.js +168 -0
  13. package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.js.map +1 -0
  14. package/dist/commonjs/funcs/vendorsGetVendorInvoiceReceipt.d.ts +18 -0
  15. package/dist/commonjs/funcs/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/vendorsGetVendorInvoiceReceipt.js +125 -0
  17. package/dist/commonjs/funcs/vendorsGetVendorInvoiceReceipt.js.map +1 -0
  18. package/dist/commonjs/lib/config.d.ts +3 -3
  19. package/dist/commonjs/lib/config.js +3 -3
  20. package/dist/commonjs/lib/config.js.map +1 -1
  21. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  22. package/dist/commonjs/mcp-server/mcp-server.js.map +1 -1
  23. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  24. package/dist/commonjs/mcp-server/server.js +5 -1
  25. package/dist/commonjs/mcp-server/server.js.map +1 -1
  26. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts +8 -0
  27. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
  28. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js +69 -0
  29. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js.map +1 -0
  30. package/dist/commonjs/mcp-server/tools/vendorsGetVendorInvoiceReceipt.d.ts +8 -0
  31. package/dist/commonjs/mcp-server/tools/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -0
  32. package/dist/commonjs/mcp-server/tools/vendorsGetVendorInvoiceReceipt.js +64 -0
  33. package/dist/commonjs/mcp-server/tools/vendorsGetVendorInvoiceReceipt.js.map +1 -0
  34. package/dist/commonjs/models/components/contact.d.ts +30 -4
  35. package/dist/commonjs/models/components/contact.d.ts.map +1 -1
  36. package/dist/commonjs/models/components/contact.js +35 -5
  37. package/dist/commonjs/models/components/contact.js.map +1 -1
  38. package/dist/commonjs/models/components/departmentmembership.d.ts +80 -0
  39. package/dist/commonjs/models/components/departmentmembership.d.ts.map +1 -0
  40. package/dist/commonjs/models/components/departmentmembership.js +123 -0
  41. package/dist/commonjs/models/components/departmentmembership.js.map +1 -0
  42. package/dist/commonjs/models/components/expand.d.ts +6 -0
  43. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  44. package/dist/commonjs/models/components/expand.js +2 -0
  45. package/dist/commonjs/models/components/expand.js.map +1 -1
  46. package/dist/commonjs/models/components/index.d.ts +2 -0
  47. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  48. package/dist/commonjs/models/components/index.js +2 -0
  49. package/dist/commonjs/models/components/index.js.map +1 -1
  50. package/dist/commonjs/models/components/usersummary.d.ts +34 -0
  51. package/dist/commonjs/models/components/usersummary.d.ts.map +1 -0
  52. package/dist/commonjs/models/components/usersummary.js +71 -0
  53. package/dist/commonjs/models/components/usersummary.js.map +1 -0
  54. package/dist/commonjs/models/operations/getvendorinvoicereceipt.d.ts +32 -0
  55. package/dist/commonjs/models/operations/getvendorinvoicereceipt.d.ts.map +1 -0
  56. package/dist/commonjs/models/operations/getvendorinvoicereceipt.js +69 -0
  57. package/dist/commonjs/models/operations/getvendorinvoicereceipt.js.map +1 -0
  58. package/dist/commonjs/models/operations/index.d.ts +2 -0
  59. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  60. package/dist/commonjs/models/operations/index.js +2 -0
  61. package/dist/commonjs/models/operations/index.js.map +1 -1
  62. package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.d.ts +121 -0
  63. package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.d.ts.map +1 -0
  64. package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.js +155 -0
  65. package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.js.map +1 -0
  66. package/dist/commonjs/react-query/index.d.ts +2 -0
  67. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  68. package/dist/commonjs/react-query/index.js +2 -0
  69. package/dist/commonjs/react-query/index.js.map +1 -1
  70. package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.d.ts +103 -0
  71. package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
  72. package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.js +184 -0
  73. package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.js.map +1 -0
  74. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.d.ts +30 -0
  75. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -0
  76. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.js +96 -0
  77. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.js.map +1 -0
  78. package/dist/commonjs/sdk/organizations.d.ts +14 -0
  79. package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
  80. package/dist/commonjs/sdk/organizations.js +15 -0
  81. package/dist/commonjs/sdk/organizations.js.map +1 -1
  82. package/dist/commonjs/sdk/vendors.d.ts +7 -0
  83. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  84. package/dist/commonjs/sdk/vendors.js +10 -0
  85. package/dist/commonjs/sdk/vendors.js.map +1 -1
  86. package/dist/esm/__tests__/organizations.test.js +42 -0
  87. package/dist/esm/__tests__/organizations.test.js.map +1 -1
  88. package/dist/esm/__tests__/vendors.test.js +16 -0
  89. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  90. package/dist/esm/__tests__/zones.test.js +4 -19
  91. package/dist/esm/__tests__/zones.test.js.map +1 -1
  92. package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.d.ts +26 -0
  93. package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
  94. package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.js +132 -0
  95. package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.js.map +1 -0
  96. package/dist/esm/funcs/vendorsGetVendorInvoiceReceipt.d.ts +18 -0
  97. package/dist/esm/funcs/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -0
  98. package/dist/esm/funcs/vendorsGetVendorInvoiceReceipt.js +89 -0
  99. package/dist/esm/funcs/vendorsGetVendorInvoiceReceipt.js.map +1 -0
  100. package/dist/esm/lib/config.d.ts +3 -3
  101. package/dist/esm/lib/config.js +3 -3
  102. package/dist/esm/lib/config.js.map +1 -1
  103. package/dist/esm/mcp-server/mcp-server.js +1 -1
  104. package/dist/esm/mcp-server/mcp-server.js.map +1 -1
  105. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  106. package/dist/esm/mcp-server/server.js +5 -1
  107. package/dist/esm/mcp-server/server.js.map +1 -1
  108. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts +8 -0
  109. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
  110. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js +33 -0
  111. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js.map +1 -0
  112. package/dist/esm/mcp-server/tools/vendorsGetVendorInvoiceReceipt.d.ts +8 -0
  113. package/dist/esm/mcp-server/tools/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -0
  114. package/dist/esm/mcp-server/tools/vendorsGetVendorInvoiceReceipt.js +28 -0
  115. package/dist/esm/mcp-server/tools/vendorsGetVendorInvoiceReceipt.js.map +1 -0
  116. package/dist/esm/models/components/contact.d.ts +30 -4
  117. package/dist/esm/models/components/contact.d.ts.map +1 -1
  118. package/dist/esm/models/components/contact.js +32 -4
  119. package/dist/esm/models/components/contact.js.map +1 -1
  120. package/dist/esm/models/components/departmentmembership.d.ts +80 -0
  121. package/dist/esm/models/components/departmentmembership.d.ts.map +1 -0
  122. package/dist/esm/models/components/departmentmembership.js +81 -0
  123. package/dist/esm/models/components/departmentmembership.js.map +1 -0
  124. package/dist/esm/models/components/expand.d.ts +6 -0
  125. package/dist/esm/models/components/expand.d.ts.map +1 -1
  126. package/dist/esm/models/components/expand.js +2 -0
  127. package/dist/esm/models/components/expand.js.map +1 -1
  128. package/dist/esm/models/components/index.d.ts +2 -0
  129. package/dist/esm/models/components/index.d.ts.map +1 -1
  130. package/dist/esm/models/components/index.js +2 -0
  131. package/dist/esm/models/components/index.js.map +1 -1
  132. package/dist/esm/models/components/usersummary.d.ts +34 -0
  133. package/dist/esm/models/components/usersummary.d.ts.map +1 -0
  134. package/dist/esm/models/components/usersummary.js +33 -0
  135. package/dist/esm/models/components/usersummary.js.map +1 -0
  136. package/dist/esm/models/operations/getvendorinvoicereceipt.d.ts +32 -0
  137. package/dist/esm/models/operations/getvendorinvoicereceipt.d.ts.map +1 -0
  138. package/dist/esm/models/operations/getvendorinvoicereceipt.js +31 -0
  139. package/dist/esm/models/operations/getvendorinvoicereceipt.js.map +1 -0
  140. package/dist/esm/models/operations/index.d.ts +2 -0
  141. package/dist/esm/models/operations/index.d.ts.map +1 -1
  142. package/dist/esm/models/operations/index.js +2 -0
  143. package/dist/esm/models/operations/index.js.map +1 -1
  144. package/dist/esm/models/operations/listorsearchdepartmentcontacts.d.ts +121 -0
  145. package/dist/esm/models/operations/listorsearchdepartmentcontacts.d.ts.map +1 -0
  146. package/dist/esm/models/operations/listorsearchdepartmentcontacts.js +113 -0
  147. package/dist/esm/models/operations/listorsearchdepartmentcontacts.js.map +1 -0
  148. package/dist/esm/react-query/index.d.ts +2 -0
  149. package/dist/esm/react-query/index.d.ts.map +1 -1
  150. package/dist/esm/react-query/index.js +2 -0
  151. package/dist/esm/react-query/index.js.map +1 -1
  152. package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.d.ts +103 -0
  153. package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
  154. package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.js +171 -0
  155. package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.js.map +1 -0
  156. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.d.ts +30 -0
  157. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -0
  158. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.js +86 -0
  159. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.js.map +1 -0
  160. package/dist/esm/sdk/organizations.d.ts +14 -0
  161. package/dist/esm/sdk/organizations.d.ts.map +1 -1
  162. package/dist/esm/sdk/organizations.js +15 -0
  163. package/dist/esm/sdk/organizations.js.map +1 -1
  164. package/dist/esm/sdk/vendors.d.ts +7 -0
  165. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  166. package/dist/esm/sdk/vendors.js +10 -0
  167. package/dist/esm/sdk/vendors.js.map +1 -1
  168. package/examples/package-lock.json +1 -1
  169. package/examples/vendorsCreateVendorRegistration.example.ts +2 -0
  170. package/jsr.json +1 -1
  171. package/package.json +1 -1
  172. package/src/__tests__/organizations.test.ts +45 -0
  173. package/src/__tests__/vendors.test.ts +21 -0
  174. package/src/__tests__/zones.test.ts +4 -19
  175. package/src/funcs/organizationsListOrSearchDepartmentContacts.ts +270 -0
  176. package/src/funcs/vendorsGetVendorInvoiceReceipt.ts +179 -0
  177. package/src/lib/config.ts +3 -3
  178. package/src/mcp-server/mcp-server.ts +1 -1
  179. package/src/mcp-server/server.ts +5 -1
  180. package/src/mcp-server/tools/organizationsListOrSearchDepartmentContacts.ts +44 -0
  181. package/src/mcp-server/tools/vendorsGetVendorInvoiceReceipt.ts +38 -0
  182. package/src/models/components/contact.ts +74 -8
  183. package/src/models/components/departmentmembership.ts +201 -0
  184. package/src/models/components/expand.ts +2 -0
  185. package/src/models/components/index.ts +2 -0
  186. package/src/models/components/usersummary.ts +69 -0
  187. package/src/models/operations/getvendorinvoicereceipt.ts +71 -0
  188. package/src/models/operations/index.ts +2 -0
  189. package/src/models/operations/listorsearchdepartmentcontacts.ts +280 -0
  190. package/src/react-query/index.ts +2 -0
  191. package/src/react-query/organizationsListOrSearchDepartmentContacts.ts +386 -0
  192. package/src/react-query/vendorsGetVendorInvoiceReceipt.ts +167 -0
  193. package/src/sdk/organizations.ts +28 -0
  194. package/src/sdk/vendors.ts +18 -0
@@ -0,0 +1,270 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
7
+ import { encodeFormQuery, encodeSimple, queryJoin } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+ import {
29
+ createPageIterator,
30
+ haltIterator,
31
+ PageIterator,
32
+ Paginator,
33
+ } from "../types/operations.js";
34
+
35
+ /**
36
+ * List or search department contacts
37
+ *
38
+ * @remarks
39
+ * List or search department contacts.
40
+ *
41
+ * Available `expand` scopes are:
42
+ *
43
+ * - department_membership.contact
44
+ * - department_membership.department
45
+ */
46
+ export function organizationsListOrSearchDepartmentContacts(
47
+ client: GreenSecurityCore,
48
+ request: operations.ListOrSearchDepartmentContactsRequest,
49
+ options?: RequestOptions,
50
+ ): APIPromise<
51
+ PageIterator<
52
+ Result<
53
+ operations.ListOrSearchDepartmentContactsResponse,
54
+ | errors.ApiErrorResponse
55
+ | GreenSecurityError
56
+ | ResponseValidationError
57
+ | ConnectionError
58
+ | RequestAbortedError
59
+ | RequestTimeoutError
60
+ | InvalidRequestError
61
+ | UnexpectedClientError
62
+ | SDKValidationError
63
+ >,
64
+ { page: number }
65
+ >
66
+ > {
67
+ return new APIPromise($do(
68
+ client,
69
+ request,
70
+ options,
71
+ ));
72
+ }
73
+
74
+ async function $do(
75
+ client: GreenSecurityCore,
76
+ request: operations.ListOrSearchDepartmentContactsRequest,
77
+ options?: RequestOptions,
78
+ ): Promise<
79
+ [
80
+ PageIterator<
81
+ Result<
82
+ operations.ListOrSearchDepartmentContactsResponse,
83
+ | errors.ApiErrorResponse
84
+ | GreenSecurityError
85
+ | ResponseValidationError
86
+ | ConnectionError
87
+ | RequestAbortedError
88
+ | RequestTimeoutError
89
+ | InvalidRequestError
90
+ | UnexpectedClientError
91
+ | SDKValidationError
92
+ >,
93
+ { page: number }
94
+ >,
95
+ APICall,
96
+ ]
97
+ > {
98
+ const parsed = safeParse(
99
+ request,
100
+ (value) =>
101
+ operations.ListOrSearchDepartmentContactsRequest$outboundSchema.parse(
102
+ value,
103
+ ),
104
+ "Input validation failed",
105
+ );
106
+ if (!parsed.ok) {
107
+ return [haltIterator(parsed), { status: "invalid" }];
108
+ }
109
+ const payload = parsed.value;
110
+ const body = null;
111
+
112
+ const pathParams = {
113
+ id: encodeSimple("id", payload.id, {
114
+ explode: false,
115
+ charEncoding: "percent",
116
+ }),
117
+ };
118
+
119
+ const path = pathToFunc("/departments/{id}/contacts")(pathParams);
120
+
121
+ const query = queryJoin(
122
+ encodeFormQuery({
123
+ "expand": payload.expand,
124
+ }, { explode: false }),
125
+ encodeFormQuery({
126
+ "desc": payload.desc,
127
+ "items_per_page": payload.items_per_page,
128
+ "page": payload.page,
129
+ "search": payload.search,
130
+ "sort": payload.sort,
131
+ }),
132
+ );
133
+
134
+ const headers = new Headers(compactMap({
135
+ Accept: "application/json",
136
+ }));
137
+
138
+ const securityInput = await extractSecurity(client._options.security);
139
+ const requestSecurity = resolveGlobalSecurity(securityInput);
140
+
141
+ const context = {
142
+ options: client._options,
143
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
144
+ operationID: "listOrSearchDepartmentContacts",
145
+ oAuth2Scopes: [],
146
+
147
+ resolvedSecurity: requestSecurity,
148
+
149
+ securitySource: client._options.security,
150
+ retryConfig: options?.retries
151
+ || client._options.retryConfig
152
+ || { strategy: "none" },
153
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
154
+ };
155
+
156
+ const requestRes = client._createRequest(context, {
157
+ security: requestSecurity,
158
+ method: "GET",
159
+ baseURL: options?.serverURL,
160
+ path: path,
161
+ headers: headers,
162
+ query: query,
163
+ body: body,
164
+ userAgent: client._options.userAgent,
165
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
166
+ }, options);
167
+ if (!requestRes.ok) {
168
+ return [haltIterator(requestRes), { status: "invalid" }];
169
+ }
170
+ const req = requestRes.value;
171
+
172
+ const doResult = await client._do(req, {
173
+ context,
174
+ errorCodes: ["400", "401", "403", "4XX", "500", "5XX"],
175
+ retryConfig: context.retryConfig,
176
+ retryCodes: context.retryCodes,
177
+ });
178
+ if (!doResult.ok) {
179
+ return [haltIterator(doResult), { status: "request-error", request: req }];
180
+ }
181
+ const response = doResult.value;
182
+
183
+ const responseFields = {
184
+ HttpMeta: { Response: response, Request: req },
185
+ };
186
+
187
+ const [result, raw] = await M.match<
188
+ operations.ListOrSearchDepartmentContactsResponse,
189
+ | errors.ApiErrorResponse
190
+ | GreenSecurityError
191
+ | ResponseValidationError
192
+ | ConnectionError
193
+ | RequestAbortedError
194
+ | RequestTimeoutError
195
+ | InvalidRequestError
196
+ | UnexpectedClientError
197
+ | SDKValidationError
198
+ >(
199
+ M.json(
200
+ 200,
201
+ operations.ListOrSearchDepartmentContactsResponse$inboundSchema,
202
+ { key: "Result" },
203
+ ),
204
+ M.jsonErr([400, 401, 403], errors.ApiErrorResponse$inboundSchema),
205
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
206
+ M.fail("4XX"),
207
+ M.fail("5XX"),
208
+ )(response, req, { extraFields: responseFields });
209
+ if (!result.ok) {
210
+ return [haltIterator(result), {
211
+ status: "complete",
212
+ request: req,
213
+ response,
214
+ }];
215
+ }
216
+
217
+ const nextFunc = (
218
+ responseData: unknown,
219
+ ): {
220
+ next: Paginator<
221
+ Result<
222
+ operations.ListOrSearchDepartmentContactsResponse,
223
+ | errors.ApiErrorResponse
224
+ | GreenSecurityError
225
+ | ResponseValidationError
226
+ | ConnectionError
227
+ | RequestAbortedError
228
+ | RequestTimeoutError
229
+ | InvalidRequestError
230
+ | UnexpectedClientError
231
+ | SDKValidationError
232
+ >
233
+ >;
234
+ "~next"?: { page: number };
235
+ } => {
236
+ const page = request?.page ?? 1;
237
+ const nextPage = page + 1;
238
+
239
+ if (!responseData) {
240
+ return { next: () => null };
241
+ }
242
+ const results = dlv(responseData, "items");
243
+ if (!Array.isArray(results) || !results.length) {
244
+ return { next: () => null };
245
+ }
246
+ const limit = request?.itemsPerPage ?? 0;
247
+ if (results.length < limit) {
248
+ return { next: () => null };
249
+ }
250
+
251
+ const nextVal = () =>
252
+ organizationsListOrSearchDepartmentContacts(
253
+ client,
254
+ {
255
+ ...request,
256
+ page: nextPage,
257
+ },
258
+ options,
259
+ );
260
+
261
+ return { next: nextVal, "~next": { page: nextPage } };
262
+ };
263
+
264
+ const page = { ...result, ...nextFunc(raw) };
265
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
266
+ status: "complete",
267
+ request: req,
268
+ response,
269
+ }];
270
+ }
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { GreenSecurityCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get invoice receipt for vendor
31
+ *
32
+ * @remarks
33
+ * Get invoice receipt for vendor
34
+ */
35
+ export function vendorsGetVendorInvoiceReceipt(
36
+ client: GreenSecurityCore,
37
+ request: operations.GetVendorInvoiceReceiptRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ ReadableStream<Uint8Array>,
42
+ | errors.ApiErrorResponse
43
+ | GreenSecurityError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: GreenSecurityCore,
62
+ request: operations.GetVendorInvoiceReceiptRequest,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ ReadableStream<Uint8Array>,
68
+ | errors.ApiErrorResponse
69
+ | GreenSecurityError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) =>
84
+ operations.GetVendorInvoiceReceiptRequest$outboundSchema.parse(value),
85
+ "Input validation failed",
86
+ );
87
+ if (!parsed.ok) {
88
+ return [parsed, { status: "invalid" }];
89
+ }
90
+ const payload = parsed.value;
91
+ const body = null;
92
+
93
+ const pathParams = {
94
+ id: encodeSimple("id", payload.id, {
95
+ explode: false,
96
+ charEncoding: "percent",
97
+ }),
98
+ };
99
+
100
+ const path = pathToFunc("/vendors/invoices/{id}/receipt")(pathParams);
101
+
102
+ const headers = new Headers(compactMap({
103
+ Accept: "application/pdf",
104
+ }));
105
+
106
+ const securityInput = await extractSecurity(client._options.security);
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "getVendorInvoiceReceipt",
113
+ oAuth2Scopes: [],
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.security,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "GET",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const responseFields = {
151
+ HttpMeta: { Response: response, Request: req },
152
+ };
153
+
154
+ const [result] = await M.match<
155
+ ReadableStream<Uint8Array>,
156
+ | errors.ApiErrorResponse
157
+ | GreenSecurityError
158
+ | ResponseValidationError
159
+ | ConnectionError
160
+ | RequestAbortedError
161
+ | RequestTimeoutError
162
+ | InvalidRequestError
163
+ | UnexpectedClientError
164
+ | SDKValidationError
165
+ >(
166
+ M.stream(200, z.instanceof(ReadableStream<Uint8Array>), {
167
+ ctype: "application/pdf",
168
+ }),
169
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
170
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
171
+ M.fail("4XX"),
172
+ M.fail("5XX"),
173
+ )(response, req, { extraFields: responseFields });
174
+ if (!result.ok) {
175
+ return [result, { status: "complete", request: req, response }];
176
+ }
177
+
178
+ return [result, { status: "complete", request: req, response }];
179
+ }
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.0.3",
83
- sdkVersion: "0.37.12",
84
- genVersion: "2.656.5",
83
+ sdkVersion: "0.38.2",
84
+ genVersion: "2.658.3",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.37.12 2.656.5 0.0.3 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.38.2 2.658.3 0.0.3 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "0.37.12",
22
+ currentVersion: "0.38.2",
23
23
  },
24
24
  });
25
25
 
@@ -21,6 +21,7 @@ import { tool$invoicesCreateInvoice } from "./tools/invoicesCreateInvoice.js";
21
21
  import { tool$invoicesMakePayment } from "./tools/invoicesMakePayment.js";
22
22
  import { tool$invoicesUpdateInvoice } from "./tools/invoicesUpdateInvoice.js";
23
23
  import { tool$organizationsGetFacility } from "./tools/organizationsGetFacility.js";
24
+ import { tool$organizationsListOrSearchDepartmentContacts } from "./tools/organizationsListOrSearchDepartmentContacts.js";
24
25
  import { tool$organizationsListOrSearchDepartments } from "./tools/organizationsListOrSearchDepartments.js";
25
26
  import { tool$organizationsListOrSearchFacilities } from "./tools/organizationsListOrSearchFacilities.js";
26
27
  import { tool$supportArticlesGetSupportArticle } from "./tools/supportArticlesGetSupportArticle.js";
@@ -53,6 +54,7 @@ import { tool$vendorsGetSubscription } from "./tools/vendorsGetSubscription.js";
53
54
  import { tool$vendorsGetVendorCredentialDetails } from "./tools/vendorsGetVendorCredentialDetails.js";
54
55
  import { tool$vendorsGetVendorCredentialFile } from "./tools/vendorsGetVendorCredentialFile.js";
55
56
  import { tool$vendorsGetVendorInvoiceDetails } from "./tools/vendorsGetVendorInvoiceDetails.js";
57
+ import { tool$vendorsGetVendorInvoiceReceipt } from "./tools/vendorsGetVendorInvoiceReceipt.js";
56
58
  import { tool$vendorsGetVendorLegalName } from "./tools/vendorsGetVendorLegalName.js";
57
59
  import { tool$vendorsGetVendorsDetails } from "./tools/vendorsGetVendorsDetails.js";
58
60
  import { tool$vendorsListVendorAdditionalFacilityFields } from "./tools/vendorsListVendorAdditionalFacilityFields.js";
@@ -94,7 +96,7 @@ export function createMCPServer(deps: {
94
96
  }) {
95
97
  const server = new McpServer({
96
98
  name: "GreenSecurity",
97
- version: "0.37.12",
99
+ version: "0.38.2",
98
100
  });
99
101
 
100
102
  const client = new GreenSecurityCore({
@@ -149,6 +151,7 @@ export function createMCPServer(deps: {
149
151
  tool(tool$vendorsGetSubscription);
150
152
  tool(tool$vendorsChangeSubscription);
151
153
  tool(tool$vendorsListVendorInvoices);
154
+ tool(tool$vendorsGetVendorInvoiceReceipt);
152
155
  tool(tool$vendorsGetVendorInvoiceDetails);
153
156
  tool(tool$vendorsListVendorFacilityStatuses);
154
157
  tool(tool$vendorsListVendorScrubPurchases);
@@ -177,6 +180,7 @@ export function createMCPServer(deps: {
177
180
  tool(tool$organizationsListOrSearchFacilities);
178
181
  tool(tool$organizationsGetFacility);
179
182
  tool(tool$organizationsListOrSearchDepartments);
183
+ tool(tool$organizationsListOrSearchDepartmentContacts);
180
184
  tool(tool$supportArticlesListOrSearchSupportArticles);
181
185
  tool(tool$supportArticlesGetSupportArticle);
182
186
  tool(tool$webhooksListAllWebhookEndpoints);
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { organizationsListOrSearchDepartmentContacts } from "../../funcs/organizationsListOrSearchDepartmentContacts.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.ListOrSearchDepartmentContactsRequest$inboundSchema,
11
+ };
12
+
13
+ export const tool$organizationsListOrSearchDepartmentContacts: ToolDefinition<
14
+ typeof args
15
+ > = {
16
+ name: "organizations-list-or-search-department-contacts",
17
+ description: `List or search department contacts
18
+
19
+ List or search department contacts.
20
+
21
+ Available \`expand\` scopes are:
22
+
23
+ - department_membership.contact
24
+ - department_membership.department`,
25
+ args,
26
+ tool: async (client, args, ctx) => {
27
+ const [result, apiCall] = await organizationsListOrSearchDepartmentContacts(
28
+ client,
29
+ args.request,
30
+ { fetchOptions: { signal: ctx.signal } },
31
+ ).$inspect();
32
+
33
+ if (!result.ok) {
34
+ return {
35
+ content: [{ type: "text", text: result.error.message }],
36
+ isError: true,
37
+ };
38
+ }
39
+
40
+ const value = result.value.result;
41
+
42
+ return formatResult(value, apiCall);
43
+ },
44
+ };
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { vendorsGetVendorInvoiceReceipt } from "../../funcs/vendorsGetVendorInvoiceReceipt.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.GetVendorInvoiceReceiptRequest$inboundSchema,
11
+ };
12
+
13
+ export const tool$vendorsGetVendorInvoiceReceipt: ToolDefinition<typeof args> =
14
+ {
15
+ name: "vendors-get-vendor-invoice-receipt",
16
+ description: `Get invoice receipt for vendor
17
+
18
+ Get invoice receipt for vendor`,
19
+ args,
20
+ tool: async (client, args, ctx) => {
21
+ const [result, apiCall] = await vendorsGetVendorInvoiceReceipt(
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;
35
+
36
+ return formatResult(value, apiCall);
37
+ },
38
+ };