@greensecurity/javascript-sdk 0.47.0 → 0.48.0-beta.1

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 (174) hide show
  1. package/README.md +1 -1
  2. package/dist/commonjs/__tests__/users.test.js +3 -0
  3. package/dist/commonjs/__tests__/users.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/vendorGetCompanyCredentialsSummary.test.d.ts +2 -0
  5. package/dist/commonjs/__tests__/vendorGetCompanyCredentialsSummary.test.d.ts.map +1 -0
  6. package/dist/commonjs/__tests__/vendorGetCompanyCredentialsSummary.test.js +30 -0
  7. package/dist/commonjs/__tests__/vendorGetCompanyCredentialsSummary.test.js.map +1 -0
  8. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  9. package/dist/commonjs/__tests__/zones.test.js +4 -28
  10. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  11. package/dist/commonjs/admin-funcs/clearVerifications.d.ts +24 -0
  12. package/dist/commonjs/admin-funcs/clearVerifications.d.ts.map +1 -0
  13. package/dist/commonjs/admin-funcs/clearVerifications.js +30 -0
  14. package/dist/commonjs/admin-funcs/clearVerifications.js.map +1 -0
  15. package/dist/commonjs/admin-funcs/registerGeneralInfo.d.ts +11 -6
  16. package/dist/commonjs/admin-funcs/registerGeneralInfo.d.ts.map +1 -1
  17. package/dist/commonjs/admin-funcs/registerGeneralInfo.js.map +1 -1
  18. package/dist/commonjs/admin-funcs/vendorGetCompanyCredentialsSummary.d.ts +1 -1
  19. package/dist/commonjs/admin-funcs/vendorGetCompanyCredentialsSummary.d.ts.map +1 -1
  20. package/dist/commonjs/admin-funcs/vendorGetCompanyCredentialsSummary.js +9 -3
  21. package/dist/commonjs/admin-funcs/vendorGetCompanyCredentialsSummary.js.map +1 -1
  22. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.d.ts +1 -0
  23. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.d.ts.map +1 -1
  24. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.js +1 -0
  25. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.js.map +1 -1
  26. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts +8 -2
  27. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
  28. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js +8 -2
  29. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js.map +1 -1
  30. package/dist/commonjs/index.extras.d.ts +8 -0
  31. package/dist/commonjs/index.extras.d.ts.map +1 -1
  32. package/dist/commonjs/index.extras.js +8 -0
  33. package/dist/commonjs/index.extras.js.map +1 -1
  34. package/dist/commonjs/lib/config.d.ts +3 -3
  35. package/dist/commonjs/lib/config.js +3 -3
  36. package/dist/commonjs/lib/config.js.map +1 -1
  37. package/dist/commonjs/models/components/expand.d.ts +1 -0
  38. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  39. package/dist/commonjs/models/components/expand.js +1 -0
  40. package/dist/commonjs/models/components/expand.js.map +1 -1
  41. package/dist/commonjs/models/components/invoice.d.ts +5 -0
  42. package/dist/commonjs/models/components/invoice.d.ts.map +1 -1
  43. package/dist/commonjs/models/components/invoice.js +4 -0
  44. package/dist/commonjs/models/components/invoice.js.map +1 -1
  45. package/dist/commonjs/models/components/userdetails.d.ts +22 -0
  46. package/dist/commonjs/models/components/userdetails.d.ts.map +1 -1
  47. package/dist/commonjs/models/components/userdetails.js +6 -0
  48. package/dist/commonjs/models/components/userdetails.js.map +1 -1
  49. package/dist/commonjs/models/components/userlocation.d.ts +10 -0
  50. package/dist/commonjs/models/components/userlocation.d.ts.map +1 -1
  51. package/dist/commonjs/models/components/userlocation.js +8 -0
  52. package/dist/commonjs/models/components/userlocation.js.map +1 -1
  53. package/dist/commonjs/models/components/vendortargetfacility.d.ts +4 -0
  54. package/dist/commonjs/models/components/vendortargetfacility.d.ts.map +1 -1
  55. package/dist/commonjs/models/components/vendortargetfacility.js +2 -0
  56. package/dist/commonjs/models/components/vendortargetfacility.js.map +1 -1
  57. package/dist/commonjs/models/operations/getvendortargetfacilities.d.ts +4 -3
  58. package/dist/commonjs/models/operations/getvendortargetfacilities.d.ts.map +1 -1
  59. package/dist/commonjs/models/operations/getvendortargetfacilities.js +2 -1
  60. package/dist/commonjs/models/operations/getvendortargetfacilities.js.map +1 -1
  61. package/dist/commonjs/models/operations/updateuser.d.ts +0 -2
  62. package/dist/commonjs/models/operations/updateuser.d.ts.map +1 -1
  63. package/dist/commonjs/models/operations/updateuser.js +0 -1
  64. package/dist/commonjs/models/operations/updateuser.js.map +1 -1
  65. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.d.ts +4 -0
  66. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.d.ts.map +1 -1
  67. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.js +4 -0
  68. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.js.map +1 -1
  69. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts +8 -2
  70. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
  71. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js +7 -1
  72. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js.map +1 -1
  73. package/dist/commonjs/sdk/vendors.d.ts +8 -1
  74. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  75. package/dist/commonjs/sdk/vendors.js +8 -1
  76. package/dist/commonjs/sdk/vendors.js.map +1 -1
  77. package/dist/esm/__tests__/users.test.js +3 -0
  78. package/dist/esm/__tests__/users.test.js.map +1 -1
  79. package/dist/esm/__tests__/vendorGetCompanyCredentialsSummary.test.d.ts +2 -0
  80. package/dist/esm/__tests__/vendorGetCompanyCredentialsSummary.test.d.ts.map +1 -0
  81. package/dist/esm/__tests__/vendorGetCompanyCredentialsSummary.test.js +28 -0
  82. package/dist/esm/__tests__/vendorGetCompanyCredentialsSummary.test.js.map +1 -0
  83. package/dist/esm/__tests__/vendors.test.js +1 -1
  84. package/dist/esm/__tests__/zones.test.js +4 -28
  85. package/dist/esm/__tests__/zones.test.js.map +1 -1
  86. package/dist/esm/admin-funcs/clearVerifications.d.ts +24 -0
  87. package/dist/esm/admin-funcs/clearVerifications.d.ts.map +1 -0
  88. package/dist/esm/admin-funcs/clearVerifications.js +23 -0
  89. package/dist/esm/admin-funcs/clearVerifications.js.map +1 -0
  90. package/dist/esm/admin-funcs/registerGeneralInfo.d.ts +11 -6
  91. package/dist/esm/admin-funcs/registerGeneralInfo.d.ts.map +1 -1
  92. package/dist/esm/admin-funcs/registerGeneralInfo.js.map +1 -1
  93. package/dist/esm/admin-funcs/vendorGetCompanyCredentialsSummary.d.ts +1 -1
  94. package/dist/esm/admin-funcs/vendorGetCompanyCredentialsSummary.d.ts.map +1 -1
  95. package/dist/esm/admin-funcs/vendorGetCompanyCredentialsSummary.js +10 -4
  96. package/dist/esm/admin-funcs/vendorGetCompanyCredentialsSummary.js.map +1 -1
  97. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.d.ts +1 -0
  98. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.d.ts.map +1 -1
  99. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.js +1 -0
  100. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.js.map +1 -1
  101. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts +8 -2
  102. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
  103. package/dist/esm/funcs/vendorsUpdateVendorDetails.js +8 -2
  104. package/dist/esm/funcs/vendorsUpdateVendorDetails.js.map +1 -1
  105. package/dist/esm/index.extras.d.ts +8 -0
  106. package/dist/esm/index.extras.d.ts.map +1 -1
  107. package/dist/esm/index.extras.js +8 -0
  108. package/dist/esm/index.extras.js.map +1 -1
  109. package/dist/esm/lib/config.d.ts +3 -3
  110. package/dist/esm/lib/config.js +3 -3
  111. package/dist/esm/lib/config.js.map +1 -1
  112. package/dist/esm/models/components/expand.d.ts +1 -0
  113. package/dist/esm/models/components/expand.d.ts.map +1 -1
  114. package/dist/esm/models/components/expand.js +1 -0
  115. package/dist/esm/models/components/expand.js.map +1 -1
  116. package/dist/esm/models/components/invoice.d.ts +5 -0
  117. package/dist/esm/models/components/invoice.d.ts.map +1 -1
  118. package/dist/esm/models/components/invoice.js +4 -0
  119. package/dist/esm/models/components/invoice.js.map +1 -1
  120. package/dist/esm/models/components/userdetails.d.ts +22 -0
  121. package/dist/esm/models/components/userdetails.d.ts.map +1 -1
  122. package/dist/esm/models/components/userdetails.js +6 -0
  123. package/dist/esm/models/components/userdetails.js.map +1 -1
  124. package/dist/esm/models/components/userlocation.d.ts +10 -0
  125. package/dist/esm/models/components/userlocation.d.ts.map +1 -1
  126. package/dist/esm/models/components/userlocation.js +8 -0
  127. package/dist/esm/models/components/userlocation.js.map +1 -1
  128. package/dist/esm/models/components/vendortargetfacility.d.ts +4 -0
  129. package/dist/esm/models/components/vendortargetfacility.d.ts.map +1 -1
  130. package/dist/esm/models/components/vendortargetfacility.js +2 -0
  131. package/dist/esm/models/components/vendortargetfacility.js.map +1 -1
  132. package/dist/esm/models/operations/getvendortargetfacilities.d.ts +4 -3
  133. package/dist/esm/models/operations/getvendortargetfacilities.d.ts.map +1 -1
  134. package/dist/esm/models/operations/getvendortargetfacilities.js +2 -1
  135. package/dist/esm/models/operations/getvendortargetfacilities.js.map +1 -1
  136. package/dist/esm/models/operations/updateuser.d.ts +0 -2
  137. package/dist/esm/models/operations/updateuser.d.ts.map +1 -1
  138. package/dist/esm/models/operations/updateuser.js +0 -1
  139. package/dist/esm/models/operations/updateuser.js.map +1 -1
  140. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.d.ts +4 -0
  141. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.d.ts.map +1 -1
  142. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.js +4 -0
  143. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.js.map +1 -1
  144. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts +8 -2
  145. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
  146. package/dist/esm/react-query/vendorsUpdateVendorDetails.js +7 -1
  147. package/dist/esm/react-query/vendorsUpdateVendorDetails.js.map +1 -1
  148. package/dist/esm/sdk/vendors.d.ts +8 -1
  149. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  150. package/dist/esm/sdk/vendors.js +8 -1
  151. package/dist/esm/sdk/vendors.js.map +1 -1
  152. package/jsr.json +1 -1
  153. package/package.json +1 -1
  154. package/src/__tests__/users.test.ts +3 -0
  155. package/src/__tests__/vendorGetCompanyCredentialsSummary.test.ts +40 -0
  156. package/src/__tests__/vendors.test.ts +1 -1
  157. package/src/__tests__/zones.test.ts +4 -28
  158. package/src/admin-funcs/clearVerifications.ts +42 -0
  159. package/src/admin-funcs/registerGeneralInfo.ts +11 -6
  160. package/src/admin-funcs/vendorGetCompanyCredentialsSummary.ts +11 -7
  161. package/src/funcs/vendorsGetVendorTargetFacilities.ts +1 -0
  162. package/src/funcs/vendorsUpdateVendorDetails.ts +11 -1
  163. package/src/index.extras.ts +15 -0
  164. package/src/lib/config.ts +3 -3
  165. package/src/models/components/expand.ts +1 -0
  166. package/src/models/components/invoice.ts +9 -0
  167. package/src/models/components/userdetails.ts +28 -0
  168. package/src/models/components/userlocation.ts +18 -0
  169. package/src/models/components/vendortargetfacility.ts +6 -0
  170. package/src/models/operations/getvendortargetfacilities.ts +4 -3
  171. package/src/models/operations/updateuser.ts +0 -3
  172. package/src/react-query/vendorsGetVendorTargetFacilities.ts +4 -0
  173. package/src/react-query/vendorsUpdateVendorDetails.ts +8 -1
  174. package/src/sdk/vendors.ts +8 -1
@@ -0,0 +1,40 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ // The parameters are declared, rather than `vi.fn(() => ...)`, so that mock.calls is typed as the
4
+ // argument tuple rather than `[][]` — see smartBadgeGetPsks.test.ts for why that matters for tshy.
5
+ const { doGetSingleMock } = vi.hoisted(() => ({
6
+ doGetSingleMock: vi.fn((_route: string, _query: unknown, _options?: unknown) =>
7
+ Promise.resolve([{ ok: true }, { status: "complete" }])
8
+ ),
9
+ }));
10
+
11
+ // Only the transport is mocked: the real `hashToQueryString` has to run, because the route is what
12
+ // these tests are about.
13
+ vi.mock("../admin-funcs/doAdmin.js", async (importOriginal) => ({
14
+ ...(await importOriginal<typeof import("../admin-funcs/doAdmin.js")>()),
15
+ $doGetSingle: doGetSingleMock,
16
+ }));
17
+
18
+ import { vendorGetCompanyCredentialsSummary } from "../admin-funcs/vendorGetCompanyCredentialsSummary.js";
19
+
20
+ describe("vendorGetCompanyCredentialsSummary", () => {
21
+ beforeEach(() => {
22
+ doGetSingleMock.mockClear();
23
+ });
24
+
25
+ it("summarizes every targeted facility when no facility is given", () => {
26
+ const request = vendorGetCompanyCredentialsSummary();
27
+
28
+ expect(doGetSingleMock).toHaveBeenCalledWith("/vendors/me/company-credentials-summary", {});
29
+ expect(request).toBeDefined();
30
+ });
31
+
32
+ it("passes the facility as facility_id", () => {
33
+ vendorGetCompanyCredentialsSummary(10);
34
+
35
+ expect(doGetSingleMock).toHaveBeenLastCalledWith(
36
+ "/vendors/me/company-credentials-summary?facility_id=10",
37
+ {}
38
+ );
39
+ });
40
+ });
@@ -121,7 +121,7 @@ test("Vendors List Vendor Credits", async () => {
121
121
  page: 1,
122
122
  useUrlParams: false,
123
123
  },
124
- creditBalance: 2488.04,
124
+ creditBalance: 7787.66,
125
125
  });
126
126
  });
127
127
 
@@ -39,32 +39,7 @@ test("Zones List Or Search Security Zones", async () => {
39
39
  facility: {},
40
40
  },
41
41
  {
42
- facility: {
43
- contacts: {
44
- contact: {
45
- status: "Active",
46
- department: 123,
47
- },
48
- adminContact: {
49
- status: "Inactive",
50
- department: 123,
51
- },
52
- techContact: {
53
- status: "Active",
54
- department: 123,
55
- },
56
- greenSecurityCsm: {
57
- status: "Active",
58
- department: 123,
59
- },
60
- accountManager: null,
61
- },
62
- vendorGuestPolicy: {
63
- enabled: false,
64
- vendorGuestLimitAndOr: "and",
65
- vendorGuestRequireEmail: true,
66
- },
67
- },
42
+ facility: {},
68
43
  },
69
44
  ],
70
45
  });
@@ -82,8 +57,9 @@ test("Zones Security Zone Checkin", async () => {
82
57
  });
83
58
 
84
59
  const result = await greenSecurity.zones.securityZoneCheckin({
85
- qrCode: "<value>",
86
- zoneId: 776072,
60
+ longitude: 5032.22,
61
+ latitude: 327.09,
62
+ zoneId: 542452,
87
63
  });
88
64
  expect(result).toBeDefined();
89
65
  expect(result).toEqual({});
@@ -0,0 +1,42 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doGetSingle, $doPost, internalApiResult } from "./doAdmin.js";
3
+
4
+ export type ClearVerificationContext = "registration" | "account";
5
+ export type ClearVerificationPlatform = "web" | "native";
6
+
7
+ export type clearCreateSessionRequest = {
8
+ context: ClearVerificationContext;
9
+ platform: ClearVerificationPlatform;
10
+ /** Where CLEAR sends the vendor back; the server adds a `state` parameter. */
11
+ return_url: string;
12
+ };
13
+
14
+ export type clearCompleteRequest = {
15
+ /** The `state` CLEAR sent back on the return URL. */
16
+ state: string;
17
+ };
18
+
19
+ /** Starts a CLEAR verification for the calling vendor. Resolves to `{ verify_url }`. */
20
+ export function clearCreateSession(request: clearCreateSessionRequest): internalApiResult {
21
+ return new APIPromise($doPost("/clear-verifications", request));
22
+ }
23
+
24
+ /** Reads the outcome of the session `state` belongs to. Resolves to the vendor's CLEAR summary plus `outcome` and `context`. */
25
+ export function clearComplete(request: clearCompleteRequest): internalApiResult {
26
+ return new APIPromise($doPost("/clear-verifications/complete", request));
27
+ }
28
+
29
+ /** Records that the calling vendor continued without CLEAR. Resolves to the vendor's CLEAR summary. */
30
+ export function clearOptOut(): internalApiResult {
31
+ return new APIPromise($doPost("/clear-verifications/opt-out", {}));
32
+ }
33
+
34
+ /** The calling vendor's CLEAR summary: `{ status, prefilled_fields, personal_email }`. */
35
+ export function clearGetStatus(): internalApiResult {
36
+ return new APIPromise($doGetSingle("/clear-verifications/status", {}));
37
+ }
38
+
39
+ /** What the vendor's profile and CLEAR can fill on their background check, SSN included. */
40
+ export function clearGetBackgroundCheckPrefill(): internalApiResult {
41
+ return new APIPromise($doGetSingle("/clear-verifications/background-check-prefill", {}));
42
+ }
@@ -14,12 +14,17 @@ export type formInputs = {
14
14
  supervisor_name: string;
15
15
  supervisor_email: string;
16
16
  supervisor_phone: string;
17
- country: string;
18
- address1: string;
19
- address2: string;
20
- city: string;
21
- state: string;
22
- zip: string;
17
+ /** Contact emails; the login stays the email the vendor registered with, which must be one of the two. */
18
+ work_email?: string;
19
+ personal_email?: string;
20
+ work_phone?: string;
21
+ /** Registration no longer collects an address; these remain for older forms. */
22
+ country?: string;
23
+ address1?: string;
24
+ address2?: string;
25
+ city?: string;
26
+ state?: string;
27
+ zip?: string;
23
28
  };
24
29
 
25
30
  export function submitGeneralInfo(request: formInputs): internalApiResult {
@@ -1,10 +1,14 @@
1
1
  import { APIPromise } from "../types/async.js";
2
- import { $doGetSingle, internalApiResult } from "./doAdmin.js";
2
+ import { $doGetSingle, hashToQueryString, internalApiResult } from "./doAdmin.js";
3
3
 
4
- // Internal-only, not part of openapi.yaml. Vendor is resolved from the token, so no request shape.
5
- export function vendorGetCompanyCredentialsSummary(): internalApiResult {
6
- return new APIPromise($doGetSingle(
7
- "/vendors/me/company-credentials-summary",
8
- {}
9
- ));
4
+ // Internal-only, not part of openapi.yaml. Vendor is resolved from the token. Pass `facilityId` to
5
+ // summarize only the company credentials required at that facility instead of at every facility
6
+ // the vendor targets.
7
+ export function vendorGetCompanyCredentialsSummary(facilityId?: number): internalApiResult {
8
+ let route = "/vendors/me/company-credentials-summary";
9
+ if (facilityId !== undefined) {
10
+ route += `?${hashToQueryString({ facility_id: facilityId })}`;
11
+ }
12
+
13
+ return new APIPromise($doGetSingle(route, {}));
10
14
  }
@@ -45,6 +45,7 @@ import {
45
45
  * - `vendor_target_facility.facility`
46
46
  * - `vendor_target_facility.has_screening_responses`
47
47
  * - `vendor_target_facility.expiring_credential_count`
48
+ * - `vendor_target_facility.system_logo_url`
48
49
  *
49
50
  * The endpoint rejects any other value with `422 Unprocessable Entity`.
50
51
  *
@@ -36,12 +36,18 @@ import * as types$ from "../types/primitives.js";
36
36
  * can also remove the vendor from their company by sending `company_id: null`.
37
37
  *
38
38
  * From `location` this endpoint reads only `timezone`, `address1`, `address2`,
39
- * `city`, `state`, `zip`, `phone`, `mobile_phone` and `fax`. The `address` and
39
+ * `city`, `state`, `zip`, `phone`, `mobile_phone`, `fax`, `work_email` and `personal_email`. The `address` and
40
40
  * `country` properties of the shared `UserLocation` schema have no effect here, and
41
41
  * updating them is not supported. `state` accepts a US state or a Canadian
42
42
  * province—the vendor's country, set only at registration, is not editable
43
43
  * through this endpoint.
44
44
  *
45
+ * `location.work_email` and `location.personal_email` are stored lowercased, and a
46
+ * value that is not a valid email address, or is longer than 255 characters, gets a
47
+ * `422` response. They are contact fields: the login stays `email`, which this
48
+ * endpoint does not change. When an update sets either of them, one must be the
49
+ * vendor's `email` and the other a different address or empty, or it gets a `422`.
50
+ *
45
51
  * Submitting `location.zip` or `location.state` cross-checks the postal code
46
52
  * against the resulting state (using the vendor's existing value for whichever
47
53
  * of the two you omit from the request). The server rejects a code that is not shaped like a real
@@ -66,6 +72,7 @@ export function vendorsUpdateVendorDetails(
66
72
  Result<
67
73
  boolean,
68
74
  | errors.ApiErrorResponse
75
+ | errors.UnprocessableEntityOrValidationError
69
76
  | GreenSecurityError
70
77
  | ResponseValidationError
71
78
  | ConnectionError
@@ -92,6 +99,7 @@ async function $do(
92
99
  Result<
93
100
  boolean,
94
101
  | errors.ApiErrorResponse
102
+ | errors.UnprocessableEntityOrValidationError
95
103
  | GreenSecurityError
96
104
  | ResponseValidationError
97
105
  | ConnectionError
@@ -181,6 +189,7 @@ async function $do(
181
189
  const [result] = await M.match<
182
190
  boolean,
183
191
  | errors.ApiErrorResponse
192
+ | errors.UnprocessableEntityOrValidationError
184
193
  | GreenSecurityError
185
194
  | ResponseValidationError
186
195
  | ConnectionError
@@ -192,6 +201,7 @@ async function $do(
192
201
  >(
193
202
  M.json(200, types$.boolean()),
194
203
  M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
204
+ M.jsonErr(422, errors.UnprocessableEntityOrValidationError$inboundSchema),
195
205
  M.fail("4XX"),
196
206
  M.fail([500, "5XX"]),
197
207
  )(response, req, { extraFields: responseFields });
@@ -33,6 +33,13 @@ import { submitEmailStep } from "./admin-funcs/registerEmail.js";
33
33
  import { submitPassword } from "./admin-funcs/registerPassword.js";
34
34
  import { submitGeneralInfo } from "./admin-funcs/registerGeneralInfo.js";
35
35
  import { submitCompany } from "./admin-funcs/registerCompanies.js";
36
+ import {
37
+ clearComplete,
38
+ clearCreateSession,
39
+ clearGetBackgroundCheckPrefill,
40
+ clearGetStatus,
41
+ clearOptOut,
42
+ } from "./admin-funcs/clearVerifications.js";
36
43
 
37
44
  import { smartBadgePairBadge } from "./admin-funcs/smartBadgePairBadge.js";
38
45
  import { smartBadgeUnpairBadge } from "./admin-funcs/smartBadgeUnpairBadge.js";
@@ -126,6 +133,14 @@ export const __internal = {
126
133
  submitCompany
127
134
  },
128
135
 
136
+ clear: {
137
+ createSession: clearCreateSession,
138
+ complete: clearComplete,
139
+ optOut: clearOptOut,
140
+ getStatus: clearGetStatus,
141
+ getBackgroundCheckPrefill: clearGetBackgroundCheckPrefill
142
+ },
143
+
129
144
  smartBadge: {
130
145
  pairBadge: smartBadgePairBadge,
131
146
  unpairBadge: smartBadgeUnpairBadge,
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.47.0",
83
- sdkVersion: "0.47.0",
84
- genVersion: "2.948.4",
83
+ sdkVersion: "0.48.0-beta.1",
84
+ genVersion: "2.950.2",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.47.0 2.948.4 0.47.0 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.48.0-beta.1 2.950.2 0.47.0 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -21,6 +21,7 @@ export const Expand = {
21
21
  "vendor_target_facility.has_screening_responses",
22
22
  VendorTargetFacilityExpiringCredentialCount:
23
23
  "vendor_target_facility.expiring_credential_count",
24
+ VendorTargetFacilitySystemLogoUrl: "vendor_target_facility.system_logo_url",
24
25
  ContactFacility: "contact.facility",
25
26
  ContactSystem: "contact.system",
26
27
  ContactDepartment: "contact.department",
@@ -103,6 +103,10 @@ export type AssociatedCredentials = {
103
103
  * The ID of the company that requested the credential. `null` if the credential has no company.
104
104
  */
105
105
  companyId: number | null;
106
+ /**
107
+ * The ID of the invoice the credential was raised on. This can be a child of the requested invoice. `null` if the credential has no invoice.
108
+ */
109
+ invoiceId: number | null;
106
110
  /**
107
111
  * Whether the vendor has paid the credential's invoice but has not submitted the required information.
108
112
  */
@@ -320,11 +324,13 @@ export const AssociatedCredentials$inboundSchema: z.ZodType<
320
324
  id: types.number(),
321
325
  vendor_id: types.nullable(types.number()),
322
326
  company_id: types.nullable(types.number()),
327
+ invoice_id: types.nullable(types.number()),
323
328
  awaiting_submission: types.boolean(),
324
329
  }).transform((v) => {
325
330
  return remap$(v, {
326
331
  "vendor_id": "vendorId",
327
332
  "company_id": "companyId",
333
+ "invoice_id": "invoiceId",
328
334
  "awaiting_submission": "awaitingSubmission",
329
335
  });
330
336
  });
@@ -333,6 +339,7 @@ export type AssociatedCredentials$Outbound = {
333
339
  id: number;
334
340
  vendor_id: number | null;
335
341
  company_id: number | null;
342
+ invoice_id: number | null;
336
343
  awaiting_submission: boolean;
337
344
  };
338
345
 
@@ -345,11 +352,13 @@ export const AssociatedCredentials$outboundSchema: z.ZodType<
345
352
  id: z.number().int(),
346
353
  vendorId: z.nullable(z.number().int()),
347
354
  companyId: z.nullable(z.number().int()),
355
+ invoiceId: z.nullable(z.number().int()),
348
356
  awaitingSubmission: z.boolean(),
349
357
  }).transform((v) => {
350
358
  return remap$(v, {
351
359
  vendorId: "vendor_id",
352
360
  companyId: "company_id",
361
+ invoiceId: "invoice_id",
353
362
  awaitingSubmission: "awaiting_submission",
354
363
  });
355
364
  });
@@ -85,6 +85,10 @@ export type UserDetails = {
85
85
  * First name of the user.
86
86
  */
87
87
  firstName?: string | null | undefined;
88
+ /**
89
+ * Middle name of the user, or `null` if not set. Returned only in the full user record (`expand=user`).
90
+ */
91
+ middleName?: string | null | undefined;
88
92
  /**
89
93
  * Last name of the user.
90
94
  */
@@ -93,6 +97,24 @@ export type UserDetails = {
93
97
  * Email address (not always valid)
94
98
  */
95
99
  email: string;
100
+ /**
101
+ * A vendor's work email address, a contact field kept apart from `email`,
102
+ *
103
+ * @remarks
104
+ * which stays the login. When it is the same address as `email`, it follows
105
+ * any change to the login. `null` if not set. Returned only in the full user
106
+ * record (`expand=user`).
107
+ */
108
+ workEmail?: string | null | undefined;
109
+ /**
110
+ * A vendor's personal email address, a contact field kept apart from `email`,
111
+ *
112
+ * @remarks
113
+ * which stays the login. When it is the same address as `email`, it follows
114
+ * any change to the login. `null` if not set. Returned only in the full user
115
+ * record (`expand=user`).
116
+ */
117
+ personalEmail?: string | null | undefined;
96
118
  /**
97
119
  * The user's landline phone number, or `null` if not set.
98
120
  */
@@ -253,8 +275,11 @@ export const UserDetails$inboundSchema: z.ZodType<
253
275
  > = z.object({
254
276
  id: types.number(),
255
277
  first_name: z.nullable(types.string()).optional(),
278
+ middle_name: z.nullable(types.string()).optional(),
256
279
  last_name: z.nullable(types.string()).optional(),
257
280
  email: types.string(),
281
+ work_email: z.nullable(types.string()).optional(),
282
+ personal_email: z.nullable(types.string()).optional(),
258
283
  phone: z.nullable(types.string()).optional(),
259
284
  mobile_phone: z.nullable(types.string()).optional(),
260
285
  fax: z.nullable(types.string()).optional(),
@@ -274,7 +299,10 @@ export const UserDetails$inboundSchema: z.ZodType<
274
299
  }).transform((v) => {
275
300
  return remap$(v, {
276
301
  "first_name": "firstName",
302
+ "middle_name": "middleName",
277
303
  "last_name": "lastName",
304
+ "work_email": "workEmail",
305
+ "personal_email": "personalEmail",
278
306
  "mobile_phone": "mobilePhone",
279
307
  "phone_confirmed": "phoneConfirmed",
280
308
  "email_confirmed": "emailConfirmed",
@@ -212,6 +212,14 @@ export type UserLocation = {
212
212
  * The fax number of the location. `null` if not set.
213
213
  */
214
214
  fax?: string | null | undefined;
215
+ /**
216
+ * The vendor's work email address. Only `PUT /vendors/{vendor_id_or_me}` reads it. `null` if not set.
217
+ */
218
+ workEmail?: string | null | undefined;
219
+ /**
220
+ * The vendor's personal email address. Only `PUT /vendors/{vendor_id_or_me}` reads it. `null` if not set.
221
+ */
222
+ personalEmail?: string | null | undefined;
215
223
  /**
216
224
  * The country of the location. `null` if not set.
217
225
  */
@@ -250,11 +258,15 @@ export const UserLocation$inboundSchema: z.ZodType<
250
258
  phone: z.nullable(types.string()).optional(),
251
259
  mobile_phone: z.nullable(types.string()).optional(),
252
260
  fax: z.nullable(types.string()).optional(),
261
+ work_email: z.nullable(types.string()).optional(),
262
+ personal_email: z.nullable(types.string()).optional(),
253
263
  country: z.nullable(types.string()).optional(),
254
264
  timezone: z.nullable(Timezone$inboundSchema).optional(),
255
265
  }).transform((v) => {
256
266
  return remap$(v, {
257
267
  "mobile_phone": "mobilePhone",
268
+ "work_email": "workEmail",
269
+ "personal_email": "personalEmail",
258
270
  });
259
271
  });
260
272
  /** @internal */
@@ -268,6 +280,8 @@ export type UserLocation$Outbound = {
268
280
  phone?: string | null | undefined;
269
281
  mobile_phone?: string | null | undefined;
270
282
  fax?: string | null | undefined;
283
+ work_email?: string | null | undefined;
284
+ personal_email?: string | null | undefined;
271
285
  country?: string | null | undefined;
272
286
  timezone?: string | null | undefined;
273
287
  };
@@ -287,11 +301,15 @@ export const UserLocation$outboundSchema: z.ZodType<
287
301
  phone: z.nullable(z.string()).optional(),
288
302
  mobilePhone: z.nullable(z.string()).optional(),
289
303
  fax: z.nullable(z.string()).optional(),
304
+ workEmail: z.nullable(z.string()).optional(),
305
+ personalEmail: z.nullable(z.string()).optional(),
290
306
  country: z.nullable(z.string()).optional(),
291
307
  timezone: z.nullable(Timezone$outboundSchema).optional(),
292
308
  }).transform((v) => {
293
309
  return remap$(v, {
294
310
  mobilePhone: "mobile_phone",
311
+ workEmail: "work_email",
312
+ personalEmail: "personal_email",
295
313
  });
296
314
  });
297
315
 
@@ -44,6 +44,10 @@ export type VendorTargetFacility = {
44
44
  * How many credentials the facility requires from the vendor have an approved version that expires within 30 days, with no newer version approved or waiting for approval. Company-owned credentials are left out when the caller is a vendor whose company has company managers. Present only when you pass `vendor_target_facility.expiring_credential_count` to `expand`.
45
45
  */
46
46
  expiringCredentialCount?: number | undefined;
47
+ /**
48
+ * The URL of the logo of the facility's system, or `null` when the system has no logo or the facility has no system. Present only when you pass `vendor_target_facility.system_logo_url` to `expand`.
49
+ */
50
+ systemLogoUrl?: string | null | undefined;
47
51
  /**
48
52
  * The date and time the target facility was added to the vendor, in ISO 8601 format, or `null` if not available.
49
53
  */
@@ -81,12 +85,14 @@ export const VendorTargetFacility$inboundSchema: z.ZodType<
81
85
  questions_answered: types.nullable(types.boolean()),
82
86
  has_screening_responses: types.optional(types.boolean()),
83
87
  expiring_credential_count: types.optional(types.number()),
88
+ system_logo_url: z.nullable(types.string()).optional(),
84
89
  date_created: z.nullable(types.date()).optional(),
85
90
  }).transform((v) => {
86
91
  return remap$(v, {
87
92
  "questions_answered": "questionsAnswered",
88
93
  "has_screening_responses": "hasScreeningResponses",
89
94
  "expiring_credential_count": "expiringCredentialCount",
95
+ "system_logo_url": "systemLogoUrl",
90
96
  "date_created": "dateCreated",
91
97
  });
92
98
  });
@@ -52,7 +52,7 @@ export const IncludeStatusCounts = {
52
52
  export type IncludeStatusCounts = ClosedEnum<typeof IncludeStatusCounts>;
53
53
 
54
54
  /**
55
- * The field to sort results by. Defaults to `facility_name`. `not_approved_first` lists the systems with the most rows that are not approved first, then by system name; within a system it puts the rows that are not approved first, then sorts by facility name. `not_approved_first` ignores `desc`.
55
+ * The field to sort results by. Defaults to `facility_name`. `not_approved_first` lists the systems with the most rows that are not approved first, then by system name; within a system it puts the rows that are not approved first, then sorts by facility name. `system_and_facility_name` sorts by system name, then by facility name, and lists facilities without a system last. Both ignore `desc`.
56
56
  */
57
57
  export const GetVendorTargetFacilitiesQueryParamSort = {
58
58
  FacilityName: "facility_name",
@@ -61,9 +61,10 @@ export const GetVendorTargetFacilitiesQueryParamSort = {
61
61
  QuestionsAnswered: "questions_answered",
62
62
  DateCreated: "date_created",
63
63
  NotApprovedFirst: "not_approved_first",
64
+ SystemAndFacilityName: "system_and_facility_name",
64
65
  } as const;
65
66
  /**
66
- * The field to sort results by. Defaults to `facility_name`. `not_approved_first` lists the systems with the most rows that are not approved first, then by system name; within a system it puts the rows that are not approved first, then sorts by facility name. `not_approved_first` ignores `desc`.
67
+ * The field to sort results by. Defaults to `facility_name`. `not_approved_first` lists the systems with the most rows that are not approved first, then by system name; within a system it puts the rows that are not approved first, then sorts by facility name. `system_and_facility_name` sorts by system name, then by facility name, and lists facilities without a system last. Both ignore `desc`.
67
68
  */
68
69
  export type GetVendorTargetFacilitiesQueryParamSort = ClosedEnum<
69
70
  typeof GetVendorTargetFacilitiesQueryParamSort
@@ -117,7 +118,7 @@ export type GetVendorTargetFacilitiesRequest = {
117
118
  */
118
119
  itemsPerPage?: number | undefined;
119
120
  /**
120
- * The field to sort results by. Defaults to `facility_name`. `not_approved_first` lists the systems with the most rows that are not approved first, then by system name; within a system it puts the rows that are not approved first, then sorts by facility name. `not_approved_first` ignores `desc`.
121
+ * The field to sort results by. Defaults to `facility_name`. `not_approved_first` lists the systems with the most rows that are not approved first, then by system name; within a system it puts the rows that are not approved first, then sorts by facility name. `system_and_facility_name` sorts by system name, then by facility name, and lists facilities without a system last. Both ignore `desc`.
121
122
  */
122
123
  sort?: GetVendorTargetFacilitiesQueryParamSort | undefined;
123
124
  /**
@@ -17,7 +17,6 @@ export type UpdateUserRequestBody = {
17
17
  lastName?: string | undefined;
18
18
  username?: string | undefined;
19
19
  email?: string | undefined;
20
- email2?: string | undefined;
21
20
  phone?: string | undefined;
22
21
  mobilePhone?: string | undefined;
23
22
  fax?: string | undefined;
@@ -80,7 +79,6 @@ export type UpdateUserRequestBody$Outbound = {
80
79
  last_name?: string | undefined;
81
80
  username?: string | undefined;
82
81
  email?: string | undefined;
83
- email2?: string | undefined;
84
82
  phone?: string | undefined;
85
83
  mobile_phone?: string | undefined;
86
84
  fax?: string | undefined;
@@ -106,7 +104,6 @@ export const UpdateUserRequestBody$outboundSchema: z.ZodType<
106
104
  lastName: z.string().optional(),
107
105
  username: z.string().optional(),
108
106
  email: z.string().optional(),
109
- email2: z.string().optional(),
110
107
  phone: z.string().optional(),
111
108
  mobilePhone: z.string().optional(),
112
109
  fax: z.string().optional(),
@@ -84,6 +84,7 @@ export type VendorsGetVendorTargetFacilitiesQueryError =
84
84
  * - `vendor_target_facility.facility`
85
85
  * - `vendor_target_facility.has_screening_responses`
86
86
  * - `vendor_target_facility.expiring_credential_count`
87
+ * - `vendor_target_facility.system_logo_url`
87
88
  *
88
89
  * The endpoint rejects any other value with `422 Unprocessable Entity`.
89
90
  *
@@ -123,6 +124,7 @@ export function useVendorsGetVendorTargetFacilities(
123
124
  * - `vendor_target_facility.facility`
124
125
  * - `vendor_target_facility.has_screening_responses`
125
126
  * - `vendor_target_facility.expiring_credential_count`
127
+ * - `vendor_target_facility.system_logo_url`
126
128
  *
127
129
  * The endpoint rejects any other value with `422 Unprocessable Entity`.
128
130
  *
@@ -162,6 +164,7 @@ export function useVendorsGetVendorTargetFacilitiesSuspense(
162
164
  * - `vendor_target_facility.facility`
163
165
  * - `vendor_target_facility.has_screening_responses`
164
166
  * - `vendor_target_facility.expiring_credential_count`
167
+ * - `vendor_target_facility.system_logo_url`
165
168
  *
166
169
  * The endpoint rejects any other value with `422 Unprocessable Entity`.
167
170
  *
@@ -215,6 +218,7 @@ export function useVendorsGetVendorTargetFacilitiesInfinite(
215
218
  * - `vendor_target_facility.facility`
216
219
  * - `vendor_target_facility.has_screening_responses`
217
220
  * - `vendor_target_facility.expiring_credential_count`
221
+ * - `vendor_target_facility.system_logo_url`
218
222
  *
219
223
  * The endpoint rejects any other value with `422 Unprocessable Entity`.
220
224
  *
@@ -36,6 +36,7 @@ export type VendorsUpdateVendorDetailsMutationData = boolean;
36
36
 
37
37
  export type VendorsUpdateVendorDetailsMutationError =
38
38
  | errors.ApiErrorResponse
39
+ | errors.UnprocessableEntityOrValidationError
39
40
  | GreenSecurityError
40
41
  | ResponseValidationError
41
42
  | ConnectionError
@@ -54,12 +55,18 @@ export type VendorsUpdateVendorDetailsMutationError =
54
55
  * can also remove the vendor from their company by sending `company_id: null`.
55
56
  *
56
57
  * From `location` this endpoint reads only `timezone`, `address1`, `address2`,
57
- * `city`, `state`, `zip`, `phone`, `mobile_phone` and `fax`. The `address` and
58
+ * `city`, `state`, `zip`, `phone`, `mobile_phone`, `fax`, `work_email` and `personal_email`. The `address` and
58
59
  * `country` properties of the shared `UserLocation` schema have no effect here, and
59
60
  * updating them is not supported. `state` accepts a US state or a Canadian
60
61
  * province—the vendor's country, set only at registration, is not editable
61
62
  * through this endpoint.
62
63
  *
64
+ * `location.work_email` and `location.personal_email` are stored lowercased, and a
65
+ * value that is not a valid email address, or is longer than 255 characters, gets a
66
+ * `422` response. They are contact fields: the login stays `email`, which this
67
+ * endpoint does not change. When an update sets either of them, one must be the
68
+ * vendor's `email` and the other a different address or empty, or it gets a `422`.
69
+ *
63
70
  * Submitting `location.zip` or `location.state` cross-checks the postal code
64
71
  * against the resulting state (using the vendor's existing value for whichever
65
72
  * of the two you omit from the request). The server rejects a code that is not shaped like a real
@@ -1026,12 +1026,18 @@ export class Vendors extends ClientSDK {
1026
1026
  * can also remove the vendor from their company by sending `company_id: null`.
1027
1027
  *
1028
1028
  * From `location` this endpoint reads only `timezone`, `address1`, `address2`,
1029
- * `city`, `state`, `zip`, `phone`, `mobile_phone` and `fax`. The `address` and
1029
+ * `city`, `state`, `zip`, `phone`, `mobile_phone`, `fax`, `work_email` and `personal_email`. The `address` and
1030
1030
  * `country` properties of the shared `UserLocation` schema have no effect here, and
1031
1031
  * updating them is not supported. `state` accepts a US state or a Canadian
1032
1032
  * province—the vendor's country, set only at registration, is not editable
1033
1033
  * through this endpoint.
1034
1034
  *
1035
+ * `location.work_email` and `location.personal_email` are stored lowercased, and a
1036
+ * value that is not a valid email address, or is longer than 255 characters, gets a
1037
+ * `422` response. They are contact fields: the login stays `email`, which this
1038
+ * endpoint does not change. When an update sets either of them, one must be the
1039
+ * vendor's `email` and the other a different address or empty, or it gets a `422`.
1040
+ *
1035
1041
  * Submitting `location.zip` or `location.state` cross-checks the postal code
1036
1042
  * against the resulting state (using the vendor's existing value for whichever
1037
1043
  * of the two you omit from the request). The server rejects a code that is not shaped like a real
@@ -1504,6 +1510,7 @@ export class Vendors extends ClientSDK {
1504
1510
  * - `vendor_target_facility.facility`
1505
1511
  * - `vendor_target_facility.has_screening_responses`
1506
1512
  * - `vendor_target_facility.expiring_credential_count`
1513
+ * - `vendor_target_facility.system_logo_url`
1507
1514
  *
1508
1515
  * The endpoint rejects any other value with `422 Unprocessable Entity`.
1509
1516
  *