@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,351 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
InfiniteData,
|
|
7
|
+
InvalidateQueryFilters,
|
|
8
|
+
QueryClient,
|
|
9
|
+
QueryKey,
|
|
10
|
+
useInfiniteQuery,
|
|
11
|
+
UseInfiniteQueryResult,
|
|
12
|
+
useQuery,
|
|
13
|
+
UseQueryResult,
|
|
14
|
+
useSuspenseInfiniteQuery,
|
|
15
|
+
UseSuspenseInfiniteQueryResult,
|
|
16
|
+
useSuspenseQuery,
|
|
17
|
+
UseSuspenseQueryResult,
|
|
18
|
+
} from "@tanstack/react-query";
|
|
19
|
+
import * as components from "../models/components/index.js";
|
|
20
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
21
|
+
import {
|
|
22
|
+
ConnectionError,
|
|
23
|
+
InvalidRequestError,
|
|
24
|
+
RequestAbortedError,
|
|
25
|
+
RequestTimeoutError,
|
|
26
|
+
UnexpectedClientError,
|
|
27
|
+
} from "../models/errors/httpclienterrors.js";
|
|
28
|
+
import * as errors from "../models/errors/index.js";
|
|
29
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
30
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
31
|
+
import * as operations from "../models/operations/index.js";
|
|
32
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
33
|
+
import {
|
|
34
|
+
InfiniteQueryHookOptions,
|
|
35
|
+
QueryHookOptions,
|
|
36
|
+
SuspenseInfiniteQueryHookOptions,
|
|
37
|
+
SuspenseQueryHookOptions,
|
|
38
|
+
TupleToPrefixes,
|
|
39
|
+
} from "./_types.js";
|
|
40
|
+
import {
|
|
41
|
+
buildOrganizationsListFacilityVendorsInfiniteQuery,
|
|
42
|
+
buildOrganizationsListFacilityVendorsQuery,
|
|
43
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
44
|
+
OrganizationsListFacilityVendorsPageParams,
|
|
45
|
+
OrganizationsListFacilityVendorsQueryData,
|
|
46
|
+
prefetchOrganizationsListFacilityVendors,
|
|
47
|
+
prefetchOrganizationsListFacilityVendorsInfinite,
|
|
48
|
+
queryKeyOrganizationsListFacilityVendors,
|
|
49
|
+
queryKeyOrganizationsListFacilityVendorsInfinite,
|
|
50
|
+
} from "./organizationsListFacilityVendors.core.js";
|
|
51
|
+
export {
|
|
52
|
+
buildOrganizationsListFacilityVendorsInfiniteQuery,
|
|
53
|
+
buildOrganizationsListFacilityVendorsQuery,
|
|
54
|
+
type OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
55
|
+
type OrganizationsListFacilityVendorsPageParams,
|
|
56
|
+
type OrganizationsListFacilityVendorsQueryData,
|
|
57
|
+
prefetchOrganizationsListFacilityVendors,
|
|
58
|
+
prefetchOrganizationsListFacilityVendorsInfinite,
|
|
59
|
+
queryKeyOrganizationsListFacilityVendors,
|
|
60
|
+
queryKeyOrganizationsListFacilityVendorsInfinite,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type OrganizationsListFacilityVendorsQueryError =
|
|
64
|
+
| errors.ApiErrorResponse
|
|
65
|
+
| GreenSecurityError
|
|
66
|
+
| ResponseValidationError
|
|
67
|
+
| ConnectionError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| SDKValidationError;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* List vendors targeting a facility
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Powers the Company Portal → Facility Details page. Returns the
|
|
79
|
+
* paginated list of company-scoped vendor reps that are targeting the
|
|
80
|
+
* given facility, with each row carrying the rep's name + email, their
|
|
81
|
+
* last visit to this facility, their facility access status, and any
|
|
82
|
+
* company custom fields the company has flagged `show_to_vendor` (which
|
|
83
|
+
* is where the "Employee ID" column on the UI lives).
|
|
84
|
+
*
|
|
85
|
+
* Filtering: pass `status=approved|pending|denied` to scope the rows to a
|
|
86
|
+
* single status tab. Pass `search=<term>` for a single search box that
|
|
87
|
+
* matches first name, last name, full name, email, OR any visible custom
|
|
88
|
+
* field value (covering the "search by name / email / Employee ID"
|
|
89
|
+
* requirement).
|
|
90
|
+
*
|
|
91
|
+
* Access control:
|
|
92
|
+
* * Regular users: the URL's `:id` must be in the caller's read scope for
|
|
93
|
+
* Facility (resolved via `has_facility_access_policy`). Out-of-scope or
|
|
94
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
95
|
+
* * API users: must pass `company_id`. Both the company and the facility
|
|
96
|
+
* must be activated for the caller's marketplace app
|
|
97
|
+
* (`MarketplaceAppActivation`).
|
|
98
|
+
*/
|
|
99
|
+
export function useOrganizationsListFacilityVendors(
|
|
100
|
+
request: operations.ListFacilityVendorsRequest,
|
|
101
|
+
options?: QueryHookOptions<
|
|
102
|
+
OrganizationsListFacilityVendorsQueryData,
|
|
103
|
+
OrganizationsListFacilityVendorsQueryError
|
|
104
|
+
>,
|
|
105
|
+
): UseQueryResult<
|
|
106
|
+
OrganizationsListFacilityVendorsQueryData,
|
|
107
|
+
OrganizationsListFacilityVendorsQueryError
|
|
108
|
+
> {
|
|
109
|
+
const client = useGreenSecurityContext();
|
|
110
|
+
return useQuery({
|
|
111
|
+
...buildOrganizationsListFacilityVendorsQuery(
|
|
112
|
+
client,
|
|
113
|
+
request,
|
|
114
|
+
options,
|
|
115
|
+
),
|
|
116
|
+
...options,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* List vendors targeting a facility
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* Powers the Company Portal → Facility Details page. Returns the
|
|
125
|
+
* paginated list of company-scoped vendor reps that are targeting the
|
|
126
|
+
* given facility, with each row carrying the rep's name + email, their
|
|
127
|
+
* last visit to this facility, their facility access status, and any
|
|
128
|
+
* company custom fields the company has flagged `show_to_vendor` (which
|
|
129
|
+
* is where the "Employee ID" column on the UI lives).
|
|
130
|
+
*
|
|
131
|
+
* Filtering: pass `status=approved|pending|denied` to scope the rows to a
|
|
132
|
+
* single status tab. Pass `search=<term>` for a single search box that
|
|
133
|
+
* matches first name, last name, full name, email, OR any visible custom
|
|
134
|
+
* field value (covering the "search by name / email / Employee ID"
|
|
135
|
+
* requirement).
|
|
136
|
+
*
|
|
137
|
+
* Access control:
|
|
138
|
+
* * Regular users: the URL's `:id` must be in the caller's read scope for
|
|
139
|
+
* Facility (resolved via `has_facility_access_policy`). Out-of-scope or
|
|
140
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
141
|
+
* * API users: must pass `company_id`. Both the company and the facility
|
|
142
|
+
* must be activated for the caller's marketplace app
|
|
143
|
+
* (`MarketplaceAppActivation`).
|
|
144
|
+
*/
|
|
145
|
+
export function useOrganizationsListFacilityVendorsSuspense(
|
|
146
|
+
request: operations.ListFacilityVendorsRequest,
|
|
147
|
+
options?: SuspenseQueryHookOptions<
|
|
148
|
+
OrganizationsListFacilityVendorsQueryData,
|
|
149
|
+
OrganizationsListFacilityVendorsQueryError
|
|
150
|
+
>,
|
|
151
|
+
): UseSuspenseQueryResult<
|
|
152
|
+
OrganizationsListFacilityVendorsQueryData,
|
|
153
|
+
OrganizationsListFacilityVendorsQueryError
|
|
154
|
+
> {
|
|
155
|
+
const client = useGreenSecurityContext();
|
|
156
|
+
return useSuspenseQuery({
|
|
157
|
+
...buildOrganizationsListFacilityVendorsQuery(
|
|
158
|
+
client,
|
|
159
|
+
request,
|
|
160
|
+
options,
|
|
161
|
+
),
|
|
162
|
+
...options,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* List vendors targeting a facility
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* Powers the Company Portal → Facility Details page. Returns the
|
|
171
|
+
* paginated list of company-scoped vendor reps that are targeting the
|
|
172
|
+
* given facility, with each row carrying the rep's name + email, their
|
|
173
|
+
* last visit to this facility, their facility access status, and any
|
|
174
|
+
* company custom fields the company has flagged `show_to_vendor` (which
|
|
175
|
+
* is where the "Employee ID" column on the UI lives).
|
|
176
|
+
*
|
|
177
|
+
* Filtering: pass `status=approved|pending|denied` to scope the rows to a
|
|
178
|
+
* single status tab. Pass `search=<term>` for a single search box that
|
|
179
|
+
* matches first name, last name, full name, email, OR any visible custom
|
|
180
|
+
* field value (covering the "search by name / email / Employee ID"
|
|
181
|
+
* requirement).
|
|
182
|
+
*
|
|
183
|
+
* Access control:
|
|
184
|
+
* * Regular users: the URL's `:id` must be in the caller's read scope for
|
|
185
|
+
* Facility (resolved via `has_facility_access_policy`). Out-of-scope or
|
|
186
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
187
|
+
* * API users: must pass `company_id`. Both the company and the facility
|
|
188
|
+
* must be activated for the caller's marketplace app
|
|
189
|
+
* (`MarketplaceAppActivation`).
|
|
190
|
+
*/
|
|
191
|
+
export function useOrganizationsListFacilityVendorsInfinite(
|
|
192
|
+
request: operations.ListFacilityVendorsRequest,
|
|
193
|
+
options?: InfiniteQueryHookOptions<
|
|
194
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
195
|
+
OrganizationsListFacilityVendorsQueryError
|
|
196
|
+
>,
|
|
197
|
+
): UseInfiniteQueryResult<
|
|
198
|
+
InfiniteData<
|
|
199
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
200
|
+
OrganizationsListFacilityVendorsPageParams
|
|
201
|
+
>,
|
|
202
|
+
OrganizationsListFacilityVendorsQueryError
|
|
203
|
+
> {
|
|
204
|
+
const client = useGreenSecurityContext();
|
|
205
|
+
return useInfiniteQuery<
|
|
206
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
207
|
+
OrganizationsListFacilityVendorsQueryError,
|
|
208
|
+
InfiniteData<
|
|
209
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
210
|
+
OrganizationsListFacilityVendorsPageParams
|
|
211
|
+
>,
|
|
212
|
+
QueryKey,
|
|
213
|
+
OrganizationsListFacilityVendorsPageParams
|
|
214
|
+
>({
|
|
215
|
+
...buildOrganizationsListFacilityVendorsInfiniteQuery(
|
|
216
|
+
client,
|
|
217
|
+
request,
|
|
218
|
+
options,
|
|
219
|
+
),
|
|
220
|
+
initialPageParam: options?.initialPageParam,
|
|
221
|
+
getNextPageParam: (previousPage) => previousPage["~next"],
|
|
222
|
+
...options,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* List vendors targeting a facility
|
|
228
|
+
*
|
|
229
|
+
* @remarks
|
|
230
|
+
* Powers the Company Portal → Facility Details page. Returns the
|
|
231
|
+
* paginated list of company-scoped vendor reps that are targeting the
|
|
232
|
+
* given facility, with each row carrying the rep's name + email, their
|
|
233
|
+
* last visit to this facility, their facility access status, and any
|
|
234
|
+
* company custom fields the company has flagged `show_to_vendor` (which
|
|
235
|
+
* is where the "Employee ID" column on the UI lives).
|
|
236
|
+
*
|
|
237
|
+
* Filtering: pass `status=approved|pending|denied` to scope the rows to a
|
|
238
|
+
* single status tab. Pass `search=<term>` for a single search box that
|
|
239
|
+
* matches first name, last name, full name, email, OR any visible custom
|
|
240
|
+
* field value (covering the "search by name / email / Employee ID"
|
|
241
|
+
* requirement).
|
|
242
|
+
*
|
|
243
|
+
* Access control:
|
|
244
|
+
* * Regular users: the URL's `:id` must be in the caller's read scope for
|
|
245
|
+
* Facility (resolved via `has_facility_access_policy`). Out-of-scope or
|
|
246
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
247
|
+
* * API users: must pass `company_id`. Both the company and the facility
|
|
248
|
+
* must be activated for the caller's marketplace app
|
|
249
|
+
* (`MarketplaceAppActivation`).
|
|
250
|
+
*/
|
|
251
|
+
export function useOrganizationsListFacilityVendorsInfiniteSuspense(
|
|
252
|
+
request: operations.ListFacilityVendorsRequest,
|
|
253
|
+
options?: SuspenseInfiniteQueryHookOptions<
|
|
254
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
255
|
+
OrganizationsListFacilityVendorsQueryError
|
|
256
|
+
>,
|
|
257
|
+
): UseSuspenseInfiniteQueryResult<
|
|
258
|
+
InfiniteData<
|
|
259
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
260
|
+
OrganizationsListFacilityVendorsPageParams
|
|
261
|
+
>,
|
|
262
|
+
OrganizationsListFacilityVendorsQueryError
|
|
263
|
+
> {
|
|
264
|
+
const client = useGreenSecurityContext();
|
|
265
|
+
return useSuspenseInfiniteQuery<
|
|
266
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
267
|
+
OrganizationsListFacilityVendorsQueryError,
|
|
268
|
+
InfiniteData<
|
|
269
|
+
OrganizationsListFacilityVendorsInfiniteQueryData,
|
|
270
|
+
OrganizationsListFacilityVendorsPageParams
|
|
271
|
+
>,
|
|
272
|
+
QueryKey,
|
|
273
|
+
OrganizationsListFacilityVendorsPageParams
|
|
274
|
+
>({
|
|
275
|
+
...buildOrganizationsListFacilityVendorsInfiniteQuery(
|
|
276
|
+
client,
|
|
277
|
+
request,
|
|
278
|
+
options,
|
|
279
|
+
),
|
|
280
|
+
initialPageParam: options?.initialPageParam,
|
|
281
|
+
getNextPageParam: (previousPage) => previousPage["~next"],
|
|
282
|
+
...options,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export function setOrganizationsListFacilityVendorsData(
|
|
287
|
+
client: QueryClient,
|
|
288
|
+
queryKeyBase: [
|
|
289
|
+
id: number,
|
|
290
|
+
parameters: {
|
|
291
|
+
companyId?: number | undefined;
|
|
292
|
+
status?: operations.QueryParamStatus | undefined;
|
|
293
|
+
search?: string | undefined;
|
|
294
|
+
page?: number | undefined;
|
|
295
|
+
itemsPerPage?: number | undefined;
|
|
296
|
+
sort?: operations.ListFacilityVendorsQueryParamSort | undefined;
|
|
297
|
+
desc?: components.Desc | undefined;
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
data: OrganizationsListFacilityVendorsQueryData,
|
|
301
|
+
): OrganizationsListFacilityVendorsQueryData | undefined {
|
|
302
|
+
const key = queryKeyOrganizationsListFacilityVendors(...queryKeyBase);
|
|
303
|
+
|
|
304
|
+
return client.setQueryData<OrganizationsListFacilityVendorsQueryData>(
|
|
305
|
+
key,
|
|
306
|
+
data,
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function invalidateOrganizationsListFacilityVendors(
|
|
311
|
+
client: QueryClient,
|
|
312
|
+
queryKeyBase: TupleToPrefixes<
|
|
313
|
+
[
|
|
314
|
+
id: number,
|
|
315
|
+
parameters: {
|
|
316
|
+
companyId?: number | undefined;
|
|
317
|
+
status?: operations.QueryParamStatus | undefined;
|
|
318
|
+
search?: string | undefined;
|
|
319
|
+
page?: number | undefined;
|
|
320
|
+
itemsPerPage?: number | undefined;
|
|
321
|
+
sort?: operations.ListFacilityVendorsQueryParamSort | undefined;
|
|
322
|
+
desc?: components.Desc | undefined;
|
|
323
|
+
},
|
|
324
|
+
]
|
|
325
|
+
>,
|
|
326
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
327
|
+
): Promise<void> {
|
|
328
|
+
return client.invalidateQueries({
|
|
329
|
+
...filters,
|
|
330
|
+
queryKey: [
|
|
331
|
+
"@greensecurity/javascript-sdk",
|
|
332
|
+
"organizations",
|
|
333
|
+
"listFacilityVendors",
|
|
334
|
+
...queryKeyBase,
|
|
335
|
+
],
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export function invalidateAllOrganizationsListFacilityVendors(
|
|
340
|
+
client: QueryClient,
|
|
341
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
342
|
+
): Promise<void> {
|
|
343
|
+
return client.invalidateQueries({
|
|
344
|
+
...filters,
|
|
345
|
+
queryKey: [
|
|
346
|
+
"@greensecurity/javascript-sdk",
|
|
347
|
+
"organizations",
|
|
348
|
+
"listFacilityVendors",
|
|
349
|
+
],
|
|
350
|
+
});
|
|
351
|
+
}
|
package/src/sdk/organizations.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { organizationsDownloadCompanyTargetFacilitiesExport } from "../funcs/org
|
|
|
6
6
|
import { organizationsExportCompanyTargetFacilities } from "../funcs/organizationsExportCompanyTargetFacilities.js";
|
|
7
7
|
import { organizationsGetCompanyTargetFacilitiesExportStatus } from "../funcs/organizationsGetCompanyTargetFacilitiesExportStatus.js";
|
|
8
8
|
import { organizationsGetFacility } from "../funcs/organizationsGetFacility.js";
|
|
9
|
+
import { organizationsListFacilityVendors } from "../funcs/organizationsListFacilityVendors.js";
|
|
9
10
|
import { organizationsListOrSearchDepartmentContacts } from "../funcs/organizationsListOrSearchDepartmentContacts.js";
|
|
10
11
|
import { organizationsListOrSearchDepartments } from "../funcs/organizationsListOrSearchDepartments.js";
|
|
11
12
|
import { organizationsListOrSearchFacilities } from "../funcs/organizationsListOrSearchFacilities.js";
|
|
@@ -146,6 +147,44 @@ export class Organizations extends ClientSDK {
|
|
|
146
147
|
));
|
|
147
148
|
}
|
|
148
149
|
|
|
150
|
+
/**
|
|
151
|
+
* List vendors targeting a facility
|
|
152
|
+
*
|
|
153
|
+
* @remarks
|
|
154
|
+
* Powers the Company Portal → Facility Details page. Returns the
|
|
155
|
+
* paginated list of company-scoped vendor reps that are targeting the
|
|
156
|
+
* given facility, with each row carrying the rep's name + email, their
|
|
157
|
+
* last visit to this facility, their facility access status, and any
|
|
158
|
+
* company custom fields the company has flagged `show_to_vendor` (which
|
|
159
|
+
* is where the "Employee ID" column on the UI lives).
|
|
160
|
+
*
|
|
161
|
+
* Filtering: pass `status=approved|pending|denied` to scope the rows to a
|
|
162
|
+
* single status tab. Pass `search=<term>` for a single search box that
|
|
163
|
+
* matches first name, last name, full name, email, OR any visible custom
|
|
164
|
+
* field value (covering the "search by name / email / Employee ID"
|
|
165
|
+
* requirement).
|
|
166
|
+
*
|
|
167
|
+
* Access control:
|
|
168
|
+
* * Regular users: the URL's `:id` must be in the caller's read scope for
|
|
169
|
+
* Facility (resolved via `has_facility_access_policy`). Out-of-scope or
|
|
170
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
171
|
+
* * API users: must pass `company_id`. Both the company and the facility
|
|
172
|
+
* must be activated for the caller's marketplace app
|
|
173
|
+
* (`MarketplaceAppActivation`).
|
|
174
|
+
*/
|
|
175
|
+
async listFacilityVendors(
|
|
176
|
+
request: operations.ListFacilityVendorsRequest,
|
|
177
|
+
options?: RequestOptions,
|
|
178
|
+
): Promise<
|
|
179
|
+
PageIterator<operations.ListFacilityVendorsResponse, { page: number }>
|
|
180
|
+
> {
|
|
181
|
+
return unwrapResultIterator(organizationsListFacilityVendors(
|
|
182
|
+
this,
|
|
183
|
+
request,
|
|
184
|
+
options,
|
|
185
|
+
));
|
|
186
|
+
}
|
|
187
|
+
|
|
149
188
|
/**
|
|
150
189
|
* List or search department contacts
|
|
151
190
|
*
|