@greensecurity/javascript-sdk 0.44.0-beta.12 → 0.44.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/commonjs/__tests__/organizations.test.js +29 -0
- package/dist/commonjs/__tests__/organizations.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +30 -2
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.d.ts +3 -0
- package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.d.ts.map +1 -0
- package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.js +9 -0
- package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.js.map +1 -0
- package/dist/commonjs/admin-funcs/vendorGetPaymentForm.d.ts +3 -0
- package/dist/commonjs/admin-funcs/vendorGetPaymentForm.d.ts.map +1 -0
- package/dist/commonjs/admin-funcs/vendorGetPaymentForm.js +9 -0
- package/dist/commonjs/admin-funcs/vendorGetPaymentForm.js.map +1 -0
- package/dist/commonjs/funcs/organizationsListFacilityVendors.d.ts +42 -0
- package/dist/commonjs/funcs/organizationsListFacilityVendors.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsListFacilityVendors.js +187 -0
- package/dist/commonjs/funcs/organizationsListFacilityVendors.js.map +1 -0
- package/dist/commonjs/hooks/types.d.ts +1 -0
- package/dist/commonjs/hooks/types.d.ts.map +1 -1
- package/dist/commonjs/index.extras.d.ts +8 -0
- package/dist/commonjs/index.extras.d.ts.map +1 -1
- package/dist/commonjs/index.extras.js +8 -0
- package/dist/commonjs/index.extras.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +4 -4
- package/dist/commonjs/lib/config.js +4 -4
- package/dist/commonjs/lib/sdks.d.ts.map +1 -1
- package/dist/commonjs/lib/sdks.js +13 -4
- package/dist/commonjs/lib/sdks.js.map +1 -1
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.d.ts +4 -4
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.d.ts.map +1 -1
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.js +6 -4
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.js.map +1 -1
- 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/listfacilityvendors.d.ts +162 -0
- package/dist/commonjs/models/operations/listfacilityvendors.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listfacilityvendors.js +150 -0
- package/dist/commonjs/models/operations/listfacilityvendors.js.map +1 -0
- package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.d.ts +4 -4
- package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.js +6 -7
- package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.js.map +1 -1
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.d.ts +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.d.ts.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.js.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.d.ts +2 -2
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.d.ts.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.js.map +1 -1
- package/dist/commonjs/react-query/organizationsListFacilityVendors.core.d.ts +42 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.core.js +99 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.core.js.map +1 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.d.ts +142 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.js +180 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.js.map +1 -0
- package/dist/commonjs/sdk/organizations.d.ts +28 -0
- package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
- package/dist/commonjs/sdk/organizations.js +29 -0
- package/dist/commonjs/sdk/organizations.js.map +1 -1
- package/dist/esm/__tests__/organizations.test.js +29 -0
- package/dist/esm/__tests__/organizations.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +30 -2
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/admin-funcs/companyManagerGetPaymentForm.d.ts +3 -0
- package/dist/esm/admin-funcs/companyManagerGetPaymentForm.d.ts.map +1 -0
- package/dist/esm/admin-funcs/companyManagerGetPaymentForm.js +6 -0
- package/dist/esm/admin-funcs/companyManagerGetPaymentForm.js.map +1 -0
- package/dist/esm/admin-funcs/vendorGetPaymentForm.d.ts +3 -0
- package/dist/esm/admin-funcs/vendorGetPaymentForm.d.ts.map +1 -0
- package/dist/esm/admin-funcs/vendorGetPaymentForm.js +6 -0
- package/dist/esm/admin-funcs/vendorGetPaymentForm.js.map +1 -0
- package/dist/esm/funcs/organizationsListFacilityVendors.d.ts +42 -0
- package/dist/esm/funcs/organizationsListFacilityVendors.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsListFacilityVendors.js +151 -0
- package/dist/esm/funcs/organizationsListFacilityVendors.js.map +1 -0
- package/dist/esm/hooks/types.d.ts +1 -0
- package/dist/esm/hooks/types.d.ts.map +1 -1
- package/dist/esm/index.extras.d.ts +8 -0
- package/dist/esm/index.extras.d.ts.map +1 -1
- package/dist/esm/index.extras.js +8 -0
- package/dist/esm/index.extras.js.map +1 -1
- package/dist/esm/lib/config.d.ts +4 -4
- package/dist/esm/lib/config.js +4 -4
- package/dist/esm/lib/sdks.d.ts.map +1 -1
- package/dist/esm/lib/sdks.js +13 -4
- package/dist/esm/lib/sdks.js.map +1 -1
- package/dist/esm/models/operations/exportcompanytargetfacilities.d.ts +4 -4
- package/dist/esm/models/operations/exportcompanytargetfacilities.d.ts.map +1 -1
- package/dist/esm/models/operations/exportcompanytargetfacilities.js +5 -3
- package/dist/esm/models/operations/exportcompanytargetfacilities.js.map +1 -1
- 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/listfacilityvendors.d.ts +162 -0
- package/dist/esm/models/operations/listfacilityvendors.d.ts.map +1 -0
- package/dist/esm/models/operations/listfacilityvendors.js +109 -0
- package/dist/esm/models/operations/listfacilityvendors.js.map +1 -0
- package/dist/esm/models/operations/listvendoradditionalfacilityfields.d.ts +4 -4
- package/dist/esm/models/operations/listvendoradditionalfacilityfields.d.ts.map +1 -1
- package/dist/esm/models/operations/listvendoradditionalfacilityfields.js +4 -5
- package/dist/esm/models/operations/listvendoradditionalfacilityfields.js.map +1 -1
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.d.ts +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.d.ts.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.js.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.d.ts +2 -2
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.d.ts.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.js.map +1 -1
- package/dist/esm/react-query/organizationsListFacilityVendors.core.d.ts +42 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.core.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.core.js +91 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.core.js.map +1 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.d.ts +142 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.js +165 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.js.map +1 -0
- package/dist/esm/sdk/organizations.d.ts +28 -0
- package/dist/esm/sdk/organizations.d.ts.map +1 -1
- package/dist/esm/sdk/organizations.js +29 -0
- package/dist/esm/sdk/organizations.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/organizations.test.ts +32 -0
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +30 -2
- package/src/admin-funcs/companyManagerGetPaymentForm.ts +6 -0
- package/src/admin-funcs/vendorGetPaymentForm.ts +6 -0
- package/src/funcs/organizationsListFacilityVendors.ts +279 -0
- package/src/hooks/types.ts +1 -0
- package/src/index.extras.ts +13 -3
- package/src/lib/config.ts +4 -4
- package/src/lib/sdks.ts +13 -4
- package/src/models/operations/exportcompanytargetfacilities.ts +10 -7
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listfacilityvendors.ts +307 -0
- package/src/models/operations/listvendoradditionalfacilityfields.ts +26 -15
- package/src/react-query/index.ts +1 -0
- package/src/react-query/organizationsExportCompanyTargetFacilities.core.ts +3 -1
- package/src/react-query/organizationsExportCompanyTargetFacilities.ts +6 -2
- package/src/react-query/organizationsListFacilityVendors.core.ts +207 -0
- package/src/react-query/organizationsListFacilityVendors.ts +351 -0
- package/src/sdk/organizations.ts +39 -0
|
@@ -0,0 +1,279 @@
|
|
|
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 } 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 { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
import {
|
|
30
|
+
createPageIterator,
|
|
31
|
+
haltIterator,
|
|
32
|
+
PageIterator,
|
|
33
|
+
Paginator,
|
|
34
|
+
} from "../types/operations.js";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* List vendors targeting a facility
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Powers the Company Portal → Facility Details page. Returns the
|
|
41
|
+
* paginated list of company-scoped vendor reps that are targeting the
|
|
42
|
+
* given facility, with each row carrying the rep's name + email, their
|
|
43
|
+
* last visit to this facility, their facility access status, and any
|
|
44
|
+
* company custom fields the company has flagged `show_to_vendor` (which
|
|
45
|
+
* is where the "Employee ID" column on the UI lives).
|
|
46
|
+
*
|
|
47
|
+
* Filtering: pass `status=approved|pending|denied` to scope the rows to a
|
|
48
|
+
* single status tab. Pass `search=<term>` for a single search box that
|
|
49
|
+
* matches first name, last name, full name, email, OR any visible custom
|
|
50
|
+
* field value (covering the "search by name / email / Employee ID"
|
|
51
|
+
* requirement).
|
|
52
|
+
*
|
|
53
|
+
* Access control:
|
|
54
|
+
* * Regular users: the URL's `:id` must be in the caller's read scope for
|
|
55
|
+
* Facility (resolved via `has_facility_access_policy`). Out-of-scope or
|
|
56
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
57
|
+
* * API users: must pass `company_id`. Both the company and the facility
|
|
58
|
+
* must be activated for the caller's marketplace app
|
|
59
|
+
* (`MarketplaceAppActivation`).
|
|
60
|
+
*
|
|
61
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
62
|
+
*/
|
|
63
|
+
export function organizationsListFacilityVendors(
|
|
64
|
+
client: GreenSecurityCore,
|
|
65
|
+
request: operations.ListFacilityVendorsRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): APIPromise<
|
|
68
|
+
PageIterator<
|
|
69
|
+
Result<
|
|
70
|
+
operations.ListFacilityVendorsResponse,
|
|
71
|
+
| errors.ApiErrorResponse
|
|
72
|
+
| GreenSecurityError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
{ page: number }
|
|
82
|
+
>
|
|
83
|
+
> {
|
|
84
|
+
return new APIPromise($do(
|
|
85
|
+
client,
|
|
86
|
+
request,
|
|
87
|
+
options,
|
|
88
|
+
));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function $do(
|
|
92
|
+
client: GreenSecurityCore,
|
|
93
|
+
request: operations.ListFacilityVendorsRequest,
|
|
94
|
+
options?: RequestOptions,
|
|
95
|
+
): Promise<
|
|
96
|
+
[
|
|
97
|
+
PageIterator<
|
|
98
|
+
Result<
|
|
99
|
+
operations.ListFacilityVendorsResponse,
|
|
100
|
+
| errors.ApiErrorResponse
|
|
101
|
+
| GreenSecurityError
|
|
102
|
+
| ResponseValidationError
|
|
103
|
+
| ConnectionError
|
|
104
|
+
| RequestAbortedError
|
|
105
|
+
| RequestTimeoutError
|
|
106
|
+
| InvalidRequestError
|
|
107
|
+
| UnexpectedClientError
|
|
108
|
+
| SDKValidationError
|
|
109
|
+
>,
|
|
110
|
+
{ page: number }
|
|
111
|
+
>,
|
|
112
|
+
APICall,
|
|
113
|
+
]
|
|
114
|
+
> {
|
|
115
|
+
const parsed = safeParse(
|
|
116
|
+
request,
|
|
117
|
+
(value) =>
|
|
118
|
+
operations.ListFacilityVendorsRequest$outboundSchema.parse(value),
|
|
119
|
+
"Input validation failed",
|
|
120
|
+
);
|
|
121
|
+
if (!parsed.ok) {
|
|
122
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
123
|
+
}
|
|
124
|
+
const payload = parsed.value;
|
|
125
|
+
const body = null;
|
|
126
|
+
|
|
127
|
+
const pathParams = {
|
|
128
|
+
id: encodeSimple("id", payload.id, {
|
|
129
|
+
explode: false,
|
|
130
|
+
charEncoding: "percent",
|
|
131
|
+
}),
|
|
132
|
+
};
|
|
133
|
+
const path = pathToFunc("/facilities/{id}/vendors")(pathParams);
|
|
134
|
+
|
|
135
|
+
const query = encodeFormQuery({
|
|
136
|
+
"company_id": payload.company_id,
|
|
137
|
+
"desc": payload.desc,
|
|
138
|
+
"items_per_page": payload.items_per_page,
|
|
139
|
+
"page": payload.page,
|
|
140
|
+
"search": payload.search,
|
|
141
|
+
"sort": payload.sort,
|
|
142
|
+
"status": payload.status,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const headers = new Headers(compactMap({
|
|
146
|
+
Accept: "application/json",
|
|
147
|
+
}));
|
|
148
|
+
|
|
149
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
150
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
151
|
+
|
|
152
|
+
const context = {
|
|
153
|
+
options: client._options,
|
|
154
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
155
|
+
operationID: "listFacilityVendors",
|
|
156
|
+
oAuth2Scopes: null,
|
|
157
|
+
|
|
158
|
+
resolvedSecurity: requestSecurity,
|
|
159
|
+
|
|
160
|
+
securitySource: client._options.security,
|
|
161
|
+
retryConfig: options?.retries
|
|
162
|
+
|| client._options.retryConfig
|
|
163
|
+
|| { strategy: "none" },
|
|
164
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const requestRes = client._createRequest(context, {
|
|
168
|
+
security: requestSecurity,
|
|
169
|
+
method: "GET",
|
|
170
|
+
baseURL: options?.serverURL,
|
|
171
|
+
path: path,
|
|
172
|
+
headers: headers,
|
|
173
|
+
query: query,
|
|
174
|
+
body: body,
|
|
175
|
+
userAgent: client._options.userAgent,
|
|
176
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
177
|
+
}, options);
|
|
178
|
+
if (!requestRes.ok) {
|
|
179
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
180
|
+
}
|
|
181
|
+
const req = requestRes.value;
|
|
182
|
+
|
|
183
|
+
const doResult = await client._do(req, {
|
|
184
|
+
context,
|
|
185
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
186
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
187
|
+
retryConfig: context.retryConfig,
|
|
188
|
+
retryCodes: context.retryCodes,
|
|
189
|
+
});
|
|
190
|
+
if (!doResult.ok) {
|
|
191
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
192
|
+
}
|
|
193
|
+
const response = doResult.value;
|
|
194
|
+
|
|
195
|
+
const responseFields = {
|
|
196
|
+
HttpMeta: { Response: response, Request: req },
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const [result, raw] = await M.match<
|
|
200
|
+
operations.ListFacilityVendorsResponse,
|
|
201
|
+
| errors.ApiErrorResponse
|
|
202
|
+
| GreenSecurityError
|
|
203
|
+
| ResponseValidationError
|
|
204
|
+
| ConnectionError
|
|
205
|
+
| RequestAbortedError
|
|
206
|
+
| RequestTimeoutError
|
|
207
|
+
| InvalidRequestError
|
|
208
|
+
| UnexpectedClientError
|
|
209
|
+
| SDKValidationError
|
|
210
|
+
>(
|
|
211
|
+
M.json(200, operations.ListFacilityVendorsResponse$inboundSchema, {
|
|
212
|
+
key: "Result",
|
|
213
|
+
}),
|
|
214
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
215
|
+
M.fail("4XX"),
|
|
216
|
+
M.fail([500, "5XX"]),
|
|
217
|
+
)(response, req, { extraFields: responseFields });
|
|
218
|
+
if (!result.ok) {
|
|
219
|
+
return [haltIterator(result), {
|
|
220
|
+
status: "complete",
|
|
221
|
+
request: req,
|
|
222
|
+
response,
|
|
223
|
+
}];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const nextFunc = (
|
|
227
|
+
responseData: unknown,
|
|
228
|
+
): {
|
|
229
|
+
next: Paginator<
|
|
230
|
+
Result<
|
|
231
|
+
operations.ListFacilityVendorsResponse,
|
|
232
|
+
| errors.ApiErrorResponse
|
|
233
|
+
| GreenSecurityError
|
|
234
|
+
| ResponseValidationError
|
|
235
|
+
| ConnectionError
|
|
236
|
+
| RequestAbortedError
|
|
237
|
+
| RequestTimeoutError
|
|
238
|
+
| InvalidRequestError
|
|
239
|
+
| UnexpectedClientError
|
|
240
|
+
| SDKValidationError
|
|
241
|
+
>
|
|
242
|
+
>;
|
|
243
|
+
"~next"?: { page: number };
|
|
244
|
+
} => {
|
|
245
|
+
const page = request?.page ?? 1;
|
|
246
|
+
const nextPage = page + 1;
|
|
247
|
+
|
|
248
|
+
if (!responseData) {
|
|
249
|
+
return { next: () => null };
|
|
250
|
+
}
|
|
251
|
+
const results = dlv(responseData, "items");
|
|
252
|
+
if (!Array.isArray(results) || !results.length) {
|
|
253
|
+
return { next: () => null };
|
|
254
|
+
}
|
|
255
|
+
const limit = request?.itemsPerPage ?? 0;
|
|
256
|
+
if (results.length < limit) {
|
|
257
|
+
return { next: () => null };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const nextVal = () =>
|
|
261
|
+
organizationsListFacilityVendors(
|
|
262
|
+
client,
|
|
263
|
+
{
|
|
264
|
+
...request,
|
|
265
|
+
page: nextPage,
|
|
266
|
+
},
|
|
267
|
+
options,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
274
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
275
|
+
status: "complete",
|
|
276
|
+
request: req,
|
|
277
|
+
response,
|
|
278
|
+
}];
|
|
279
|
+
}
|
package/src/hooks/types.ts
CHANGED
package/src/index.extras.ts
CHANGED
|
@@ -29,10 +29,12 @@ import { submitPassword } from "./admin-funcs/registerPassword.js";
|
|
|
29
29
|
import { submitGeneralInfo } from "./admin-funcs/registerGeneralInfo.js";
|
|
30
30
|
import { submitCompany } from "./admin-funcs/registerCompanies.js";
|
|
31
31
|
|
|
32
|
-
import {smartBadgePairBadge} from "./admin-funcs/smartBadgePairBadge.js";
|
|
33
|
-
import {smartBadgeUnpairBadge} from "./admin-funcs/smartBadgeUnpairBadge.js";
|
|
32
|
+
import { smartBadgePairBadge } from "./admin-funcs/smartBadgePairBadge.js";
|
|
33
|
+
import { smartBadgeUnpairBadge } from "./admin-funcs/smartBadgeUnpairBadge.js";
|
|
34
34
|
|
|
35
35
|
import { notifyVendorCredentialFileUploaded } from "./admin-funcs/notifyVendorCredentialFileUploaded.js";
|
|
36
|
+
import { companyManagerGetPaymentForm } from "./admin-funcs/companyManagerGetPaymentForm.js";
|
|
37
|
+
import { vendorGetPaymentForm } from "./admin-funcs/vendorGetPaymentForm.js";
|
|
36
38
|
|
|
37
39
|
export const __internal = {
|
|
38
40
|
getInternalCore,
|
|
@@ -74,7 +76,7 @@ export const __internal = {
|
|
|
74
76
|
submitGeneralInfo,
|
|
75
77
|
submitCompany
|
|
76
78
|
},
|
|
77
|
-
|
|
79
|
+
|
|
78
80
|
smartBadge: {
|
|
79
81
|
pairBadge: smartBadgePairBadge,
|
|
80
82
|
unpairBadge: smartBadgeUnpairBadge
|
|
@@ -82,5 +84,13 @@ export const __internal = {
|
|
|
82
84
|
|
|
83
85
|
vendorCredentialFile: {
|
|
84
86
|
notifyUploaded: notifyVendorCredentialFileUploaded
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
companyManager: {
|
|
90
|
+
getPaymentForm: companyManagerGetPaymentForm,
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
vendor: {
|
|
94
|
+
getPaymentForm: vendorGetPaymentForm,
|
|
85
95
|
}
|
|
86
96
|
};
|
package/src/lib/config.ts
CHANGED
|
@@ -79,9 +79,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
79
79
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
|
-
openapiDocVersion: "0.43.
|
|
83
|
-
sdkVersion: "0.44.0-beta.
|
|
84
|
-
genVersion: "2.
|
|
82
|
+
openapiDocVersion: "0.43.5",
|
|
83
|
+
sdkVersion: "0.44.0-beta.14",
|
|
84
|
+
genVersion: "2.897.1",
|
|
85
85
|
userAgent:
|
|
86
|
-
"speakeasy-sdk/typescript 0.44.0-beta.
|
|
86
|
+
"speakeasy-sdk/typescript 0.44.0-beta.14 2.897.1 0.43.5 @greensecurity/javascript-sdk",
|
|
87
87
|
} as const;
|
package/src/lib/sdks.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
matchContentType,
|
|
25
25
|
} from "./http.js";
|
|
26
26
|
import { Logger } from "./logger.js";
|
|
27
|
+
import { combineSignals } from "./primitives.js";
|
|
27
28
|
import { retry, RetryConfig } from "./retries.js";
|
|
28
29
|
import { SecurityState } from "./security.js";
|
|
29
30
|
|
|
@@ -198,9 +199,8 @@ export class ClientSDK {
|
|
|
198
199
|
...options?.fetchOptions,
|
|
199
200
|
...options,
|
|
200
201
|
};
|
|
201
|
-
if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) {
|
|
202
|
-
|
|
203
|
-
fetchOptions.signal = timeoutSignal;
|
|
202
|
+
if (!fetchOptions?.signal && conf.timeoutMs != null && conf.timeoutMs > 0) {
|
|
203
|
+
context.timeoutMs = conf.timeoutMs;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
if (conf.body instanceof ReadableStream) {
|
|
@@ -247,10 +247,19 @@ export class ClientSDK {
|
|
|
247
247
|
>
|
|
248
248
|
> {
|
|
249
249
|
const { context, isErrorStatusCode } = options;
|
|
250
|
+
const timeoutMs = context.timeoutMs;
|
|
250
251
|
|
|
251
252
|
return retry(
|
|
252
253
|
async () => {
|
|
253
|
-
const
|
|
254
|
+
const cloned = request.clone();
|
|
255
|
+
let attempt = cloned;
|
|
256
|
+
if (timeoutMs != null && timeoutMs > 0) {
|
|
257
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
258
|
+
const combined = combineSignals(cloned.signal, timeoutSignal)
|
|
259
|
+
?? timeoutSignal;
|
|
260
|
+
attempt = new Request(cloned, { signal: combined });
|
|
261
|
+
}
|
|
262
|
+
const req = await this.#hooks.beforeRequest(context, attempt);
|
|
254
263
|
await logRequest(this.#logger, req).catch((e) =>
|
|
255
264
|
this.#logger?.log("Failed to log request:", e)
|
|
256
265
|
);
|
|
@@ -14,7 +14,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
14
14
|
/**
|
|
15
15
|
* Filter by link status.
|
|
16
16
|
*/
|
|
17
|
-
export const
|
|
17
|
+
export const ExportCompanyTargetFacilitiesQueryParamStatus = {
|
|
18
18
|
Pending: "pending",
|
|
19
19
|
Approved: "approved",
|
|
20
20
|
Denied: "denied",
|
|
@@ -22,7 +22,9 @@ export const QueryParamStatus = {
|
|
|
22
22
|
/**
|
|
23
23
|
* Filter by link status.
|
|
24
24
|
*/
|
|
25
|
-
export type
|
|
25
|
+
export type ExportCompanyTargetFacilitiesQueryParamStatus = ClosedEnum<
|
|
26
|
+
typeof ExportCompanyTargetFacilitiesQueryParamStatus
|
|
27
|
+
>;
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* `true` returns only facilities the company has at least one individual targeting; `false` returns only those with none.
|
|
@@ -81,7 +83,7 @@ export type ExportCompanyTargetFacilitiesRequest = {
|
|
|
81
83
|
/**
|
|
82
84
|
* Filter by link status.
|
|
83
85
|
*/
|
|
84
|
-
status?:
|
|
86
|
+
status?: ExportCompanyTargetFacilitiesQueryParamStatus | undefined;
|
|
85
87
|
/**
|
|
86
88
|
* `true` returns only facilities the company has at least one individual targeting; `false` returns only those with none.
|
|
87
89
|
*/
|
|
@@ -127,9 +129,9 @@ export type ExportCompanyTargetFacilitiesResponseBody = {
|
|
|
127
129
|
};
|
|
128
130
|
|
|
129
131
|
/** @internal */
|
|
130
|
-
export const
|
|
131
|
-
typeof
|
|
132
|
-
|
|
132
|
+
export const ExportCompanyTargetFacilitiesQueryParamStatus$outboundSchema:
|
|
133
|
+
z.ZodNativeEnum<typeof ExportCompanyTargetFacilitiesQueryParamStatus> = z
|
|
134
|
+
.nativeEnum(ExportCompanyTargetFacilitiesQueryParamStatus);
|
|
133
135
|
|
|
134
136
|
/** @internal */
|
|
135
137
|
export const HasIndividual$outboundSchema: z.ZodNativeEnum<
|
|
@@ -181,7 +183,8 @@ export const ExportCompanyTargetFacilitiesRequest$outboundSchema: z.ZodType<
|
|
|
181
183
|
ExportCompanyTargetFacilitiesRequest
|
|
182
184
|
> = z.object({
|
|
183
185
|
companyId: z.number().int(),
|
|
184
|
-
status:
|
|
186
|
+
status: ExportCompanyTargetFacilitiesQueryParamStatus$outboundSchema
|
|
187
|
+
.optional(),
|
|
185
188
|
hasIndividual: HasIndividual$outboundSchema.optional(),
|
|
186
189
|
hasActiveIndividual: HasActiveIndividual$outboundSchema.optional(),
|
|
187
190
|
facilityNameLike: z.string().optional(),
|
|
@@ -70,6 +70,7 @@ export * from "./listallwebhookendpoints.js";
|
|
|
70
70
|
export * from "./listcompanycredentials.js";
|
|
71
71
|
export * from "./listcompanycredits.js";
|
|
72
72
|
export * from "./listcompanymanagers.js";
|
|
73
|
+
export * from "./listfacilityvendors.js";
|
|
73
74
|
export * from "./listfeed.js";
|
|
74
75
|
export * from "./listinvoices.js";
|
|
75
76
|
export * from "./listlocations.js";
|