@greensecurity/javascript-sdk 0.43.1-beta.135 → 0.43.1-beta.137

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 (153) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/vendors.test.js +24 -0
  3. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/zones.test.js +2 -24
  5. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  6. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.d.ts +3 -0
  7. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.d.ts.map +1 -0
  8. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.js +9 -0
  9. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.js.map +1 -0
  10. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts +26 -0
  11. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.js +135 -0
  13. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  14. package/dist/commonjs/funcs/vendorsGetVendorsDetails.d.ts +2 -1
  15. package/dist/commonjs/funcs/vendorsGetVendorsDetails.d.ts.map +1 -1
  16. package/dist/commonjs/funcs/vendorsGetVendorsDetails.js +2 -1
  17. package/dist/commonjs/funcs/vendorsGetVendorsDetails.js.map +1 -1
  18. package/dist/commonjs/index.extras.d.ts +4 -0
  19. package/dist/commonjs/index.extras.d.ts.map +1 -1
  20. package/dist/commonjs/index.extras.js +4 -0
  21. package/dist/commonjs/index.extras.js.map +1 -1
  22. package/dist/commonjs/lib/config.d.ts +2 -2
  23. package/dist/commonjs/lib/config.js +2 -2
  24. package/dist/commonjs/models/components/expand.d.ts +1 -0
  25. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/expand.js +1 -0
  27. package/dist/commonjs/models/components/expand.js.map +1 -1
  28. package/dist/commonjs/models/components/index.d.ts +2 -0
  29. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/index.js +2 -0
  31. package/dist/commonjs/models/components/index.js.map +1 -1
  32. package/dist/commonjs/models/components/vendor.d.ts +1 -0
  33. package/dist/commonjs/models/components/vendor.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/vendor.js +2 -0
  35. package/dist/commonjs/models/components/vendor.js.map +1 -1
  36. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.d.ts +22 -0
  37. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.d.ts.map +1 -0
  38. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.js +62 -0
  39. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.js.map +1 -0
  40. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.d.ts +20 -0
  41. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.d.ts.map +1 -0
  42. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.js +56 -0
  43. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.js.map +1 -0
  44. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.d.ts +24 -0
  45. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.d.ts.map +1 -0
  46. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.js +59 -0
  47. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.js.map +1 -0
  48. package/dist/commonjs/models/operations/index.d.ts +1 -0
  49. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  50. package/dist/commonjs/models/operations/index.js +1 -0
  51. package/dist/commonjs/models/operations/index.js.map +1 -1
  52. package/dist/commonjs/react-query/index.d.ts +1 -0
  53. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  54. package/dist/commonjs/react-query/index.js +1 -0
  55. package/dist/commonjs/react-query/index.js.map +1 -1
  56. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts +35 -0
  57. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  58. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.js +57 -0
  59. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  60. package/dist/commonjs/react-query/vendorsGetVendorsDetails.d.ts +4 -2
  61. package/dist/commonjs/react-query/vendorsGetVendorsDetails.d.ts.map +1 -1
  62. package/dist/commonjs/react-query/vendorsGetVendorsDetails.js +4 -2
  63. package/dist/commonjs/react-query/vendorsGetVendorsDetails.js.map +1 -1
  64. package/dist/commonjs/sdk/vendors.d.ts +14 -1
  65. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  66. package/dist/commonjs/sdk/vendors.js +17 -1
  67. package/dist/commonjs/sdk/vendors.js.map +1 -1
  68. package/dist/esm/__tests__/vendors.test.js +24 -0
  69. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  70. package/dist/esm/__tests__/zones.test.js +2 -24
  71. package/dist/esm/__tests__/zones.test.js.map +1 -1
  72. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.d.ts +3 -0
  73. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.d.ts.map +1 -0
  74. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.js +6 -0
  75. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.js.map +1 -0
  76. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts +26 -0
  77. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  78. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.js +99 -0
  79. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  80. package/dist/esm/funcs/vendorsGetVendorsDetails.d.ts +2 -1
  81. package/dist/esm/funcs/vendorsGetVendorsDetails.d.ts.map +1 -1
  82. package/dist/esm/funcs/vendorsGetVendorsDetails.js +2 -1
  83. package/dist/esm/funcs/vendorsGetVendorsDetails.js.map +1 -1
  84. package/dist/esm/index.extras.d.ts +4 -0
  85. package/dist/esm/index.extras.d.ts.map +1 -1
  86. package/dist/esm/index.extras.js +4 -0
  87. package/dist/esm/index.extras.js.map +1 -1
  88. package/dist/esm/lib/config.d.ts +2 -2
  89. package/dist/esm/lib/config.js +2 -2
  90. package/dist/esm/models/components/expand.d.ts +1 -0
  91. package/dist/esm/models/components/expand.d.ts.map +1 -1
  92. package/dist/esm/models/components/expand.js +1 -0
  93. package/dist/esm/models/components/expand.js.map +1 -1
  94. package/dist/esm/models/components/index.d.ts +2 -0
  95. package/dist/esm/models/components/index.d.ts.map +1 -1
  96. package/dist/esm/models/components/index.js +2 -0
  97. package/dist/esm/models/components/index.js.map +1 -1
  98. package/dist/esm/models/components/vendor.d.ts +1 -0
  99. package/dist/esm/models/components/vendor.d.ts.map +1 -1
  100. package/dist/esm/models/components/vendor.js +2 -0
  101. package/dist/esm/models/components/vendor.js.map +1 -1
  102. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.d.ts +22 -0
  103. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.d.ts.map +1 -0
  104. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.js +25 -0
  105. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.js.map +1 -0
  106. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.d.ts +20 -0
  107. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.d.ts.map +1 -0
  108. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.js +19 -0
  109. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.js.map +1 -0
  110. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.d.ts +24 -0
  111. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.d.ts.map +1 -0
  112. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.js +22 -0
  113. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.js.map +1 -0
  114. package/dist/esm/models/operations/index.d.ts +1 -0
  115. package/dist/esm/models/operations/index.d.ts.map +1 -1
  116. package/dist/esm/models/operations/index.js +1 -0
  117. package/dist/esm/models/operations/index.js.map +1 -1
  118. package/dist/esm/react-query/index.d.ts +1 -0
  119. package/dist/esm/react-query/index.d.ts.map +1 -1
  120. package/dist/esm/react-query/index.js +1 -0
  121. package/dist/esm/react-query/index.js.map +1 -1
  122. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts +35 -0
  123. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  124. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.js +52 -0
  125. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  126. package/dist/esm/react-query/vendorsGetVendorsDetails.d.ts +4 -2
  127. package/dist/esm/react-query/vendorsGetVendorsDetails.d.ts.map +1 -1
  128. package/dist/esm/react-query/vendorsGetVendorsDetails.js +4 -2
  129. package/dist/esm/react-query/vendorsGetVendorsDetails.js.map +1 -1
  130. package/dist/esm/sdk/vendors.d.ts +14 -1
  131. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  132. package/dist/esm/sdk/vendors.js +17 -1
  133. package/dist/esm/sdk/vendors.js.map +1 -1
  134. package/jsr.json +1 -1
  135. package/package.json +1 -1
  136. package/src/__tests__/vendors.test.ts +29 -0
  137. package/src/__tests__/zones.test.ts +2 -24
  138. package/src/admin-funcs/notifyVendorCredentialFileUploaded.ts +11 -0
  139. package/src/funcs/vendorsAddVendorCredentialFileForAutoClassification.ts +197 -0
  140. package/src/funcs/vendorsGetVendorsDetails.ts +2 -1
  141. package/src/index.extras.ts +6 -0
  142. package/src/lib/config.ts +2 -2
  143. package/src/models/components/expand.ts +1 -0
  144. package/src/models/components/index.ts +2 -0
  145. package/src/models/components/vendor.ts +3 -0
  146. package/src/models/components/vendorcredentialfileforautoclassificationok.ts +62 -0
  147. package/src/models/components/vendorcredentialfileforautoclassificationrequest.ts +50 -0
  148. package/src/models/operations/addvendorcredentialfileforautoclassification.ts +60 -0
  149. package/src/models/operations/index.ts +1 -0
  150. package/src/react-query/index.ts +1 -0
  151. package/src/react-query/vendorsAddVendorCredentialFileForAutoClassification.ts +131 -0
  152. package/src/react-query/vendorsGetVendorsDetails.ts +4 -2
  153. package/src/sdk/vendors.ts +25 -1
@@ -0,0 +1,11 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doPost, internalApiResult } from "./doAdmin.js";
3
+
4
+ export function notifyVendorCredentialFileUploaded(
5
+ vendorCredentialFileId: number,
6
+ ): internalApiResult {
7
+ return new APIPromise($doPost(
8
+ "/internal/vendor-credentials/notify-uploaded",
9
+ { vendor_credential_file_id: vendorCredentialFileId },
10
+ ));
11
+ }
@@ -0,0 +1,197 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: d99fb25efd2a
4
+ */
5
+
6
+ import { GreenSecurityCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import * as components from "../models/components/index.js";
16
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/httpclienterrors.js";
24
+ import * as errors from "../models/errors/index.js";
25
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
26
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { APICall, APIPromise } from "../types/async.js";
29
+ import { Result } from "../types/fp.js";
30
+
31
+ /**
32
+ * Get a one-time URL for uploading a credential file for automatic classification (Emerald vendors only)
33
+ *
34
+ * @remarks
35
+ * This endpoint allows vendors on the Emerald plan to upload a series of
36
+ * documents and have them automatically ingested and routed to the proper
37
+ * credential. The endpoint will return a one-time-use URL where the file
38
+ * must be uploaded. Green Security will process the file asynchronously.
39
+ *
40
+ * Non-Emerald vendors must use `addVendorCredentialFile` instead.
41
+ *
42
+ * If set, this operation will use {@link Security.bearerJwt} from the global security.
43
+ */
44
+ export function vendorsAddVendorCredentialFileForAutoClassification(
45
+ client: GreenSecurityCore,
46
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest,
47
+ options?: RequestOptions,
48
+ ): APIPromise<
49
+ Result<
50
+ components.VendorCredentialFileForAutoClassificationOk,
51
+ | errors.ApiErrorResponse
52
+ | GreenSecurityError
53
+ | ResponseValidationError
54
+ | ConnectionError
55
+ | RequestAbortedError
56
+ | RequestTimeoutError
57
+ | InvalidRequestError
58
+ | UnexpectedClientError
59
+ | SDKValidationError
60
+ >
61
+ > {
62
+ return new APIPromise($do(
63
+ client,
64
+ request,
65
+ options,
66
+ ));
67
+ }
68
+
69
+ async function $do(
70
+ client: GreenSecurityCore,
71
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest,
72
+ options?: RequestOptions,
73
+ ): Promise<
74
+ [
75
+ Result<
76
+ components.VendorCredentialFileForAutoClassificationOk,
77
+ | errors.ApiErrorResponse
78
+ | GreenSecurityError
79
+ | ResponseValidationError
80
+ | ConnectionError
81
+ | RequestAbortedError
82
+ | RequestTimeoutError
83
+ | InvalidRequestError
84
+ | UnexpectedClientError
85
+ | SDKValidationError
86
+ >,
87
+ APICall,
88
+ ]
89
+ > {
90
+ const parsed = safeParse(
91
+ request,
92
+ (value) =>
93
+ operations
94
+ .AddVendorCredentialFileForAutoClassificationRequest$outboundSchema
95
+ .parse(value),
96
+ "Input validation failed",
97
+ );
98
+ if (!parsed.ok) {
99
+ return [parsed, { status: "invalid" }];
100
+ }
101
+ const payload = parsed.value;
102
+ const body = encodeJSON(
103
+ "body",
104
+ payload.VendorCredentialFileForAutoClassificationRequest,
105
+ { explode: true },
106
+ );
107
+
108
+ const pathParams = {
109
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
110
+ explode: false,
111
+ charEncoding: "percent",
112
+ }),
113
+ };
114
+ const path = pathToFunc("/vendors/{vendor_id_or_me}/credentials/files")(
115
+ pathParams,
116
+ );
117
+
118
+ const headers = new Headers(compactMap({
119
+ "Content-Type": "application/json",
120
+ Accept: "application/json",
121
+ }));
122
+
123
+ const securityInput = await extractSecurity(client._options.security);
124
+ const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
125
+
126
+ const context = {
127
+ options: client._options,
128
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
129
+ operationID: "addVendorCredentialFileForAutoClassification",
130
+ oAuth2Scopes: null,
131
+
132
+ resolvedSecurity: requestSecurity,
133
+
134
+ securitySource: client._options.security,
135
+ retryConfig: options?.retries
136
+ || client._options.retryConfig
137
+ || { strategy: "none" },
138
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
139
+ };
140
+
141
+ const requestRes = client._createRequest(context, {
142
+ security: requestSecurity,
143
+ method: "POST",
144
+ baseURL: options?.serverURL,
145
+ path: path,
146
+ headers: headers,
147
+ body: body,
148
+ userAgent: client._options.userAgent,
149
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
150
+ }, options);
151
+ if (!requestRes.ok) {
152
+ return [requestRes, { status: "invalid" }];
153
+ }
154
+ const req = requestRes.value;
155
+
156
+ const doResult = await client._do(req, {
157
+ context,
158
+ isErrorStatusCode: (statusCode: number) =>
159
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
160
+ retryConfig: context.retryConfig,
161
+ retryCodes: context.retryCodes,
162
+ });
163
+ if (!doResult.ok) {
164
+ return [doResult, { status: "request-error", request: req }];
165
+ }
166
+ const response = doResult.value;
167
+
168
+ const responseFields = {
169
+ HttpMeta: { Response: response, Request: req },
170
+ };
171
+
172
+ const [result] = await M.match<
173
+ components.VendorCredentialFileForAutoClassificationOk,
174
+ | errors.ApiErrorResponse
175
+ | GreenSecurityError
176
+ | ResponseValidationError
177
+ | ConnectionError
178
+ | RequestAbortedError
179
+ | RequestTimeoutError
180
+ | InvalidRequestError
181
+ | UnexpectedClientError
182
+ | SDKValidationError
183
+ >(
184
+ M.json(
185
+ 200,
186
+ components.VendorCredentialFileForAutoClassificationOk$inboundSchema,
187
+ ),
188
+ M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
189
+ M.fail("4XX"),
190
+ M.fail([500, "5XX"]),
191
+ )(response, req, { extraFields: responseFields });
192
+ if (!result.ok) {
193
+ return [result, { status: "complete", request: req, response }];
194
+ }
195
+
196
+ return [result, { status: "complete", request: req, response }];
197
+ }
@@ -32,7 +32,7 @@ import { Result } from "../types/fp.js";
32
32
  * Get vendors details
33
33
  *
34
34
  * @remarks
35
- * Retrieve an individual vendor detais.
35
+ * Retrieve an individual vendor details.
36
36
  *
37
37
  * Available `expand` scopes are:
38
38
  *
@@ -57,6 +57,7 @@ import { Result } from "../types/fp.js";
57
57
  * vendor.vendor_groups
58
58
  * vendor.has_credentialed_facilities
59
59
  * vendor.has_emerald_status
60
+ * vendor.has_target_facility_questions
60
61
  * vendor.custom_fields
61
62
  *
62
63
  * If set, this operation will use {@link Security.bearerJwt} from the global security.
@@ -32,6 +32,8 @@ import { submitCompany } from "./admin-funcs/registerCompanies.js";
32
32
  import {smartBadgePairBadge} from "./admin-funcs/smartBadgePairBadge.js";
33
33
  import {smartBadgeUnpairBadge} from "./admin-funcs/smartBadgeUnpairBadge.js";
34
34
 
35
+ import { notifyVendorCredentialFileUploaded } from "./admin-funcs/notifyVendorCredentialFileUploaded.js";
36
+
35
37
  export const __internal = {
36
38
  getInternalCore,
37
39
  initializeInternalCore,
@@ -76,5 +78,9 @@ export const __internal = {
76
78
  smartBadge: {
77
79
  pairBadge: smartBadgePairBadge,
78
80
  unpairBadge: smartBadgeUnpairBadge
81
+ },
82
+
83
+ vendorCredentialFile: {
84
+ notifyUploaded: notifyVendorCredentialFileUploaded
79
85
  }
80
86
  };
package/src/lib/config.ts CHANGED
@@ -81,8 +81,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
81
81
  export const SDK_METADATA = {
82
82
  language: "typescript",
83
83
  openapiDocVersion: "0.0.11",
84
- sdkVersion: "0.43.1-beta.135",
84
+ sdkVersion: "0.43.1-beta.137",
85
85
  genVersion: "2.882.0",
86
86
  userAgent:
87
- "speakeasy-sdk/typescript 0.43.1-beta.135 2.882.0 0.0.11 @greensecurity/javascript-sdk",
87
+ "speakeasy-sdk/typescript 0.43.1-beta.137 2.882.0 0.0.11 @greensecurity/javascript-sdk",
88
88
  } as const;
@@ -36,6 +36,7 @@ export const Expand = {
36
36
  VendorCreditBalance: "vendor.credit_balance",
37
37
  VendorHasCredentialedFacilities: "vendor.has_credentialed_facilities",
38
38
  VendorHasEmeraldStatus: "vendor.has_emerald_status",
39
+ VendorHasTargetFacilityQuestions: "vendor.has_target_facility_questions",
39
40
  VendorCustomFields: "vendor.custom_fields",
40
41
  VendorLastScanned: "vendor.last_scanned",
41
42
  VendorImageUrls: "vendor.image_urls",
@@ -73,6 +73,8 @@ export * from "./usersummary.js";
73
73
  export * from "./vendor.js";
74
74
  export * from "./vendorcredentialdatarequest.js";
75
75
  export * from "./vendorcredentialfile.js";
76
+ export * from "./vendorcredentialfileforautoclassificationok.js";
77
+ export * from "./vendorcredentialfileforautoclassificationrequest.js";
76
78
  export * from "./vendorcredentialscontainer.js";
77
79
  export * from "./vendorcredentialsummary.js";
78
80
  export * from "./vendorcustomfields.js";
@@ -220,6 +220,7 @@ export type Vendor = {
220
220
  * Date and time of the vendor's most recent scan. Returned when expand includes vendor.last_scanned.
221
221
  */
222
222
  lastScanned?: string | null | undefined;
223
+ hasTargetFacilityQuestions?: boolean | null | undefined;
223
224
  };
224
225
 
225
226
  /** @internal */
@@ -620,6 +621,7 @@ export const Vendor$inboundSchema: z.ZodType<Vendor, z.ZodTypeDef, unknown> = z
620
621
  custom_fields: z.nullable(z.array(VendorCustomFields$inboundSchema))
621
622
  .optional(),
622
623
  last_scanned: z.nullable(types.string()).optional(),
624
+ has_target_facility_questions: z.nullable(types.boolean()).optional(),
623
625
  }).transform((v) => {
624
626
  return remap$(v, {
625
627
  "email_recepient": "emailRecepient",
@@ -649,6 +651,7 @@ export const Vendor$inboundSchema: z.ZodType<Vendor, z.ZodTypeDef, unknown> = z
649
651
  "target_facilities_updated": "targetFacilitiesUpdated",
650
652
  "custom_fields": "customFields",
651
653
  "last_scanned": "lastScanned",
654
+ "has_target_facility_questions": "hasTargetFacilityQuestions",
652
655
  });
653
656
  });
654
657
 
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: f91cc5a07bf0
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+ import { safeParse } from "../../lib/schemas.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as types from "../../types/primitives.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type VendorCredentialFileForAutoClassificationOk = {
14
+ success: boolean;
15
+ /**
16
+ * ID of the placeholder VendorCredential row.
17
+ */
18
+ vendorCredentialId: number;
19
+ /**
20
+ * ID of the paired VendorCredentialFile row.
21
+ */
22
+ vendorCredentialFileId: number;
23
+ /**
24
+ * Short-lived presigned PUT URL. Client uploads file body here.
25
+ */
26
+ presignedUrl: string;
27
+ };
28
+
29
+ /** @internal */
30
+ export const VendorCredentialFileForAutoClassificationOk$inboundSchema:
31
+ z.ZodType<
32
+ VendorCredentialFileForAutoClassificationOk,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = z.object({
36
+ success: types.boolean(),
37
+ vendor_credential_id: types.number(),
38
+ vendor_credential_file_id: types.number(),
39
+ presigned_url: types.string(),
40
+ }).transform((v) => {
41
+ return remap$(v, {
42
+ "vendor_credential_id": "vendorCredentialId",
43
+ "vendor_credential_file_id": "vendorCredentialFileId",
44
+ "presigned_url": "presignedUrl",
45
+ });
46
+ });
47
+
48
+ export function vendorCredentialFileForAutoClassificationOkFromJSON(
49
+ jsonString: string,
50
+ ): SafeParseResult<
51
+ VendorCredentialFileForAutoClassificationOk,
52
+ SDKValidationError
53
+ > {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) =>
57
+ VendorCredentialFileForAutoClassificationOk$inboundSchema.parse(
58
+ JSON.parse(x),
59
+ ),
60
+ `Failed to parse 'VendorCredentialFileForAutoClassificationOk' from JSON`,
61
+ );
62
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 6d6bc55fb921
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+
9
+ export type VendorCredentialFileForAutoClassificationRequest = {
10
+ /**
11
+ * Original filename of the file the user is uploading.
12
+ */
13
+ filename: string;
14
+ /**
15
+ * MIME type. Defaults server-side to application/octet-stream.
16
+ */
17
+ contentType?: string | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export type VendorCredentialFileForAutoClassificationRequest$Outbound = {
22
+ filename: string;
23
+ content_type?: string | undefined;
24
+ };
25
+
26
+ /** @internal */
27
+ export const VendorCredentialFileForAutoClassificationRequest$outboundSchema:
28
+ z.ZodType<
29
+ VendorCredentialFileForAutoClassificationRequest$Outbound,
30
+ z.ZodTypeDef,
31
+ VendorCredentialFileForAutoClassificationRequest
32
+ > = z.object({
33
+ filename: z.string(),
34
+ contentType: z.string().optional(),
35
+ }).transform((v) => {
36
+ return remap$(v, {
37
+ contentType: "content_type",
38
+ });
39
+ });
40
+
41
+ export function vendorCredentialFileForAutoClassificationRequestToJSON(
42
+ vendorCredentialFileForAutoClassificationRequest:
43
+ VendorCredentialFileForAutoClassificationRequest,
44
+ ): string {
45
+ return JSON.stringify(
46
+ VendorCredentialFileForAutoClassificationRequest$outboundSchema.parse(
47
+ vendorCredentialFileForAutoClassificationRequest,
48
+ ),
49
+ );
50
+ }
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 56f8c3748c86
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+ import * as components from "../components/index.js";
9
+
10
+ export type AddVendorCredentialFileForAutoClassificationRequest = {
11
+ /**
12
+ * Vendor identifier. Depending on the endpoint, accepts one or more of:
13
+ *
14
+ * @remarks
15
+ * - A numeric vendor ID (positive integer, e.g. `42`)
16
+ * - The keyword `me` to represent the authenticated vendor
17
+ * - An active QR code (alphanumeric, hyphen-separated, e.g. `ABC-123-DEF`) —
18
+ * supported only on endpoints that explicitly document QR-code lookup
19
+ */
20
+ vendorIdOrMe: string;
21
+ vendorCredentialFileForAutoClassificationRequest:
22
+ components.VendorCredentialFileForAutoClassificationRequest;
23
+ };
24
+
25
+ /** @internal */
26
+ export type AddVendorCredentialFileForAutoClassificationRequest$Outbound = {
27
+ vendor_id_or_me: string;
28
+ VendorCredentialFileForAutoClassificationRequest:
29
+ components.VendorCredentialFileForAutoClassificationRequest$Outbound;
30
+ };
31
+
32
+ /** @internal */
33
+ export const AddVendorCredentialFileForAutoClassificationRequest$outboundSchema:
34
+ z.ZodType<
35
+ AddVendorCredentialFileForAutoClassificationRequest$Outbound,
36
+ z.ZodTypeDef,
37
+ AddVendorCredentialFileForAutoClassificationRequest
38
+ > = z.object({
39
+ vendorIdOrMe: z.string(),
40
+ vendorCredentialFileForAutoClassificationRequest:
41
+ components
42
+ .VendorCredentialFileForAutoClassificationRequest$outboundSchema,
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ vendorIdOrMe: "vendor_id_or_me",
46
+ vendorCredentialFileForAutoClassificationRequest:
47
+ "VendorCredentialFileForAutoClassificationRequest",
48
+ });
49
+ });
50
+
51
+ export function addVendorCredentialFileForAutoClassificationRequestToJSON(
52
+ addVendorCredentialFileForAutoClassificationRequest:
53
+ AddVendorCredentialFileForAutoClassificationRequest,
54
+ ): string {
55
+ return JSON.stringify(
56
+ AddVendorCredentialFileForAutoClassificationRequest$outboundSchema.parse(
57
+ addVendorCredentialFileForAutoClassificationRequest,
58
+ ),
59
+ );
60
+ }
@@ -9,6 +9,7 @@ export * from "./addcompanymanager.js";
9
9
  export * from "./adddatarequestfile.js";
10
10
  export * from "./addmobiledevice.js";
11
11
  export * from "./addvendorcredentialfile.js";
12
+ export * from "./addvendorcredentialfileforautoclassification.js";
12
13
  export * from "./addvendormanagedbycompany.js";
13
14
  export * from "./calculatesubscriptionprice.js";
14
15
  export * from "./cancelhandoff.js";
@@ -67,6 +67,7 @@ export * from "./vendorFieldsCreateVendorField.js";
67
67
  export * from "./vendorFieldsUpdateVendorField.js";
68
68
  export * from "./vendorsAcceptVendorCredential.js";
69
69
  export * from "./vendorsAddVendorCredentialFile.js";
70
+ export * from "./vendorsAddVendorCredentialFileForAutoClassification.js";
70
71
  export * from "./vendorsAddVendorManagedByCompany.js";
71
72
  export * from "./vendorsCalculateSubscriptionPrice.js";
72
73
  export * from "./vendorsCancelHandoff.js";
@@ -0,0 +1,131 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: d4372147bc16
4
+ */
5
+
6
+ import {
7
+ MutationKey,
8
+ useMutation,
9
+ UseMutationResult,
10
+ } from "@tanstack/react-query";
11
+ import { GreenSecurityCore } from "../core.js";
12
+ import { vendorsAddVendorCredentialFileForAutoClassification } from "../funcs/vendorsAddVendorCredentialFileForAutoClassification.js";
13
+ import { combineSignals } from "../lib/primitives.js";
14
+ import { RequestOptions } from "../lib/sdks.js";
15
+ import * as components from "../models/components/index.js";
16
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/httpclienterrors.js";
24
+ import * as errors from "../models/errors/index.js";
25
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
26
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { unwrapAsync } from "../types/fp.js";
29
+ import { useGreenSecurityContext } from "./_context.js";
30
+ import { MutationHookOptions } from "./_types.js";
31
+
32
+ export type VendorsAddVendorCredentialFileForAutoClassificationMutationVariables =
33
+ {
34
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest;
35
+ options?: RequestOptions;
36
+ };
37
+
38
+ export type VendorsAddVendorCredentialFileForAutoClassificationMutationData =
39
+ components.VendorCredentialFileForAutoClassificationOk;
40
+
41
+ export type VendorsAddVendorCredentialFileForAutoClassificationMutationError =
42
+ | errors.ApiErrorResponse
43
+ | GreenSecurityError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError;
51
+
52
+ /**
53
+ * Get a one-time URL for uploading a credential file for automatic classification (Emerald vendors only)
54
+ *
55
+ * @remarks
56
+ * This endpoint allows vendors on the Emerald plan to upload a series of
57
+ * documents and have them automatically ingested and routed to the proper
58
+ * credential. The endpoint will return a one-time-use URL where the file
59
+ * must be uploaded. Green Security will process the file asynchronously.
60
+ *
61
+ * Non-Emerald vendors must use `addVendorCredentialFile` instead.
62
+ */
63
+ export function useVendorsAddVendorCredentialFileForAutoClassificationMutation(
64
+ options?: MutationHookOptions<
65
+ VendorsAddVendorCredentialFileForAutoClassificationMutationData,
66
+ VendorsAddVendorCredentialFileForAutoClassificationMutationError,
67
+ VendorsAddVendorCredentialFileForAutoClassificationMutationVariables
68
+ >,
69
+ ): UseMutationResult<
70
+ VendorsAddVendorCredentialFileForAutoClassificationMutationData,
71
+ VendorsAddVendorCredentialFileForAutoClassificationMutationError,
72
+ VendorsAddVendorCredentialFileForAutoClassificationMutationVariables
73
+ > {
74
+ const client = useGreenSecurityContext();
75
+ return useMutation({
76
+ ...buildVendorsAddVendorCredentialFileForAutoClassificationMutation(
77
+ client,
78
+ options,
79
+ ),
80
+ ...options,
81
+ });
82
+ }
83
+
84
+ export function mutationKeyVendorsAddVendorCredentialFileForAutoClassification(): MutationKey {
85
+ return [
86
+ "@greensecurity/javascript-sdk",
87
+ "vendors",
88
+ "addVendorCredentialFileForAutoClassification",
89
+ ];
90
+ }
91
+
92
+ export function buildVendorsAddVendorCredentialFileForAutoClassificationMutation(
93
+ client$: GreenSecurityCore,
94
+ hookOptions?: RequestOptions,
95
+ ): {
96
+ mutationKey: MutationKey;
97
+ mutationFn: (
98
+ variables:
99
+ VendorsAddVendorCredentialFileForAutoClassificationMutationVariables,
100
+ ) => Promise<VendorsAddVendorCredentialFileForAutoClassificationMutationData>;
101
+ } {
102
+ return {
103
+ mutationKey:
104
+ mutationKeyVendorsAddVendorCredentialFileForAutoClassification(),
105
+ mutationFn:
106
+ function vendorsAddVendorCredentialFileForAutoClassificationMutationFn({
107
+ request,
108
+ options,
109
+ }): Promise<
110
+ VendorsAddVendorCredentialFileForAutoClassificationMutationData
111
+ > {
112
+ const mergedOptions = {
113
+ ...hookOptions,
114
+ ...options,
115
+ fetchOptions: {
116
+ ...hookOptions?.fetchOptions,
117
+ ...options?.fetchOptions,
118
+ signal: combineSignals(
119
+ hookOptions?.fetchOptions?.signal,
120
+ options?.fetchOptions?.signal,
121
+ ),
122
+ },
123
+ };
124
+ return unwrapAsync(vendorsAddVendorCredentialFileForAutoClassification(
125
+ client$,
126
+ request,
127
+ mergedOptions,
128
+ ));
129
+ },
130
+ };
131
+ }
@@ -58,7 +58,7 @@ export type VendorsGetVendorsDetailsQueryError =
58
58
  * Get vendors details
59
59
  *
60
60
  * @remarks
61
- * Retrieve an individual vendor detais.
61
+ * Retrieve an individual vendor details.
62
62
  *
63
63
  * Available `expand` scopes are:
64
64
  *
@@ -83,6 +83,7 @@ export type VendorsGetVendorsDetailsQueryError =
83
83
  * vendor.vendor_groups
84
84
  * vendor.has_credentialed_facilities
85
85
  * vendor.has_emerald_status
86
+ * vendor.has_target_facility_questions
86
87
  * vendor.custom_fields
87
88
  */
88
89
  export function useVendorsGetVendorsDetails(
@@ -110,7 +111,7 @@ export function useVendorsGetVendorsDetails(
110
111
  * Get vendors details
111
112
  *
112
113
  * @remarks
113
- * Retrieve an individual vendor detais.
114
+ * Retrieve an individual vendor details.
114
115
  *
115
116
  * Available `expand` scopes are:
116
117
  *
@@ -135,6 +136,7 @@ export function useVendorsGetVendorsDetails(
135
136
  * vendor.vendor_groups
136
137
  * vendor.has_credentialed_facilities
137
138
  * vendor.has_emerald_status
139
+ * vendor.has_target_facility_questions
138
140
  * vendor.custom_fields
139
141
  */
140
142
  export function useVendorsGetVendorsDetailsSuspense(