@greensecurity/javascript-sdk 0.47.0-beta.16 → 0.47.0-beta.17

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 (96) hide show
  1. package/README.md +1 -1
  2. package/dist/commonjs/__tests__/users.test.js +2 -0
  3. package/dist/commonjs/__tests__/users.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js +5 -4
  6. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  7. package/dist/commonjs/__tests__/zones.test.js +18 -8
  8. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  9. package/dist/commonjs/admin-funcs/clearVerifications.d.ts +24 -0
  10. package/dist/commonjs/admin-funcs/clearVerifications.d.ts.map +1 -0
  11. package/dist/commonjs/admin-funcs/clearVerifications.js +30 -0
  12. package/dist/commonjs/admin-funcs/clearVerifications.js.map +1 -0
  13. package/dist/commonjs/admin-funcs/registerGeneralInfo.d.ts +11 -6
  14. package/dist/commonjs/admin-funcs/registerGeneralInfo.d.ts.map +1 -1
  15. package/dist/commonjs/admin-funcs/registerGeneralInfo.js.map +1 -1
  16. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts +5 -2
  17. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
  18. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js +5 -2
  19. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js.map +1 -1
  20. package/dist/commonjs/index.extras.d.ts +8 -0
  21. package/dist/commonjs/index.extras.d.ts.map +1 -1
  22. package/dist/commonjs/index.extras.js +8 -0
  23. package/dist/commonjs/index.extras.js.map +1 -1
  24. package/dist/commonjs/lib/config.d.ts +2 -2
  25. package/dist/commonjs/lib/config.js +2 -2
  26. package/dist/commonjs/models/components/userdetails.d.ts +12 -0
  27. package/dist/commonjs/models/components/userdetails.d.ts.map +1 -1
  28. package/dist/commonjs/models/components/userdetails.js +4 -0
  29. package/dist/commonjs/models/components/userdetails.js.map +1 -1
  30. package/dist/commonjs/models/components/userlocation.d.ts +5 -0
  31. package/dist/commonjs/models/components/userlocation.d.ts.map +1 -1
  32. package/dist/commonjs/models/components/userlocation.js +4 -0
  33. package/dist/commonjs/models/components/userlocation.js.map +1 -1
  34. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts +5 -2
  35. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
  36. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js +4 -1
  37. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js.map +1 -1
  38. package/dist/commonjs/sdk/vendors.d.ts +4 -1
  39. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  40. package/dist/commonjs/sdk/vendors.js +4 -1
  41. package/dist/commonjs/sdk/vendors.js.map +1 -1
  42. package/dist/esm/__tests__/users.test.js +2 -0
  43. package/dist/esm/__tests__/users.test.js.map +1 -1
  44. package/dist/esm/__tests__/vendors.test.js +1 -1
  45. package/dist/esm/__tests__/webhooks.test.js +5 -4
  46. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  47. package/dist/esm/__tests__/zones.test.js +18 -8
  48. package/dist/esm/__tests__/zones.test.js.map +1 -1
  49. package/dist/esm/admin-funcs/clearVerifications.d.ts +24 -0
  50. package/dist/esm/admin-funcs/clearVerifications.d.ts.map +1 -0
  51. package/dist/esm/admin-funcs/clearVerifications.js +23 -0
  52. package/dist/esm/admin-funcs/clearVerifications.js.map +1 -0
  53. package/dist/esm/admin-funcs/registerGeneralInfo.d.ts +11 -6
  54. package/dist/esm/admin-funcs/registerGeneralInfo.d.ts.map +1 -1
  55. package/dist/esm/admin-funcs/registerGeneralInfo.js.map +1 -1
  56. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts +5 -2
  57. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
  58. package/dist/esm/funcs/vendorsUpdateVendorDetails.js +5 -2
  59. package/dist/esm/funcs/vendorsUpdateVendorDetails.js.map +1 -1
  60. package/dist/esm/index.extras.d.ts +8 -0
  61. package/dist/esm/index.extras.d.ts.map +1 -1
  62. package/dist/esm/index.extras.js +8 -0
  63. package/dist/esm/index.extras.js.map +1 -1
  64. package/dist/esm/lib/config.d.ts +2 -2
  65. package/dist/esm/lib/config.js +2 -2
  66. package/dist/esm/models/components/userdetails.d.ts +12 -0
  67. package/dist/esm/models/components/userdetails.d.ts.map +1 -1
  68. package/dist/esm/models/components/userdetails.js +4 -0
  69. package/dist/esm/models/components/userdetails.js.map +1 -1
  70. package/dist/esm/models/components/userlocation.d.ts +5 -0
  71. package/dist/esm/models/components/userlocation.d.ts.map +1 -1
  72. package/dist/esm/models/components/userlocation.js +4 -0
  73. package/dist/esm/models/components/userlocation.js.map +1 -1
  74. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts +5 -2
  75. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
  76. package/dist/esm/react-query/vendorsUpdateVendorDetails.js +4 -1
  77. package/dist/esm/react-query/vendorsUpdateVendorDetails.js.map +1 -1
  78. package/dist/esm/sdk/vendors.d.ts +4 -1
  79. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  80. package/dist/esm/sdk/vendors.js +4 -1
  81. package/dist/esm/sdk/vendors.js.map +1 -1
  82. package/jsr.json +1 -1
  83. package/package.json +1 -1
  84. package/src/__tests__/users.test.ts +2 -0
  85. package/src/__tests__/vendors.test.ts +1 -1
  86. package/src/__tests__/webhooks.test.ts +5 -4
  87. package/src/__tests__/zones.test.ts +18 -8
  88. package/src/admin-funcs/clearVerifications.ts +42 -0
  89. package/src/admin-funcs/registerGeneralInfo.ts +11 -6
  90. package/src/funcs/vendorsUpdateVendorDetails.ts +8 -1
  91. package/src/index.extras.ts +15 -0
  92. package/src/lib/config.ts +2 -2
  93. package/src/models/components/userdetails.ts +16 -0
  94. package/src/models/components/userlocation.ts +9 -0
  95. package/src/react-query/vendorsUpdateVendorDetails.ts +5 -1
  96. package/src/sdk/vendors.ts +4 -1
@@ -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
+ /** Becomes the login email when it differs from the one the vendor registered with. */
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 {
@@ -36,12 +36,15 @@ 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` 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.personal_email` is stored lowercased, and a value that is not a valid
46
+ * email address, or is longer than 255 characters, gets a `422` response.
47
+ *
45
48
  * Submitting `location.zip` or `location.state` cross-checks the postal code
46
49
  * against the resulting state (using the vendor's existing value for whichever
47
50
  * of the two you omit from the request). The server rejects a code that is not shaped like a real
@@ -66,6 +69,7 @@ export function vendorsUpdateVendorDetails(
66
69
  Result<
67
70
  boolean,
68
71
  | errors.ApiErrorResponse
72
+ | errors.UnprocessableEntityOrValidationError
69
73
  | GreenSecurityError
70
74
  | ResponseValidationError
71
75
  | ConnectionError
@@ -92,6 +96,7 @@ async function $do(
92
96
  Result<
93
97
  boolean,
94
98
  | errors.ApiErrorResponse
99
+ | errors.UnprocessableEntityOrValidationError
95
100
  | GreenSecurityError
96
101
  | ResponseValidationError
97
102
  | ConnectionError
@@ -181,6 +186,7 @@ async function $do(
181
186
  const [result] = await M.match<
182
187
  boolean,
183
188
  | errors.ApiErrorResponse
189
+ | errors.UnprocessableEntityOrValidationError
184
190
  | GreenSecurityError
185
191
  | ResponseValidationError
186
192
  | ConnectionError
@@ -192,6 +198,7 @@ async function $do(
192
198
  >(
193
199
  M.json(200, types$.boolean()),
194
200
  M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
201
+ M.jsonErr(422, errors.UnprocessableEntityOrValidationError$inboundSchema),
195
202
  M.fail("4XX"),
196
203
  M.fail([500, "5XX"]),
197
204
  )(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.46.0",
83
- sdkVersion: "0.47.0-beta.16",
83
+ sdkVersion: "0.47.0-beta.17",
84
84
  genVersion: "2.948.4",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.47.0-beta.16 2.948.4 0.46.0 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.47.0-beta.17 2.948.4 0.46.0 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -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,14 @@ export type UserDetails = {
93
97
  * Email address (not always valid)
94
98
  */
95
99
  email: string;
100
+ /**
101
+ * A vendor's personal email address, kept apart from `email`, which is
102
+ *
103
+ * @remarks
104
+ * the work email they sign in with. `null` if not set. Returned only in
105
+ * the full user record (`expand=user`).
106
+ */
107
+ personalEmail?: string | null | undefined;
96
108
  /**
97
109
  * The user's landline phone number, or `null` if not set.
98
110
  */
@@ -253,8 +265,10 @@ export const UserDetails$inboundSchema: z.ZodType<
253
265
  > = z.object({
254
266
  id: types.number(),
255
267
  first_name: z.nullable(types.string()).optional(),
268
+ middle_name: z.nullable(types.string()).optional(),
256
269
  last_name: z.nullable(types.string()).optional(),
257
270
  email: types.string(),
271
+ personal_email: z.nullable(types.string()).optional(),
258
272
  phone: z.nullable(types.string()).optional(),
259
273
  mobile_phone: z.nullable(types.string()).optional(),
260
274
  fax: z.nullable(types.string()).optional(),
@@ -274,7 +288,9 @@ export const UserDetails$inboundSchema: z.ZodType<
274
288
  }).transform((v) => {
275
289
  return remap$(v, {
276
290
  "first_name": "firstName",
291
+ "middle_name": "middleName",
277
292
  "last_name": "lastName",
293
+ "personal_email": "personalEmail",
278
294
  "mobile_phone": "mobilePhone",
279
295
  "phone_confirmed": "phoneConfirmed",
280
296
  "email_confirmed": "emailConfirmed",
@@ -212,6 +212,10 @@ 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 personal email address. Only `PUT /vendors/{vendor_id_or_me}` reads it. `null` if not set.
217
+ */
218
+ personalEmail?: string | null | undefined;
215
219
  /**
216
220
  * The country of the location. `null` if not set.
217
221
  */
@@ -250,11 +254,13 @@ export const UserLocation$inboundSchema: z.ZodType<
250
254
  phone: z.nullable(types.string()).optional(),
251
255
  mobile_phone: z.nullable(types.string()).optional(),
252
256
  fax: z.nullable(types.string()).optional(),
257
+ personal_email: z.nullable(types.string()).optional(),
253
258
  country: z.nullable(types.string()).optional(),
254
259
  timezone: z.nullable(Timezone$inboundSchema).optional(),
255
260
  }).transform((v) => {
256
261
  return remap$(v, {
257
262
  "mobile_phone": "mobilePhone",
263
+ "personal_email": "personalEmail",
258
264
  });
259
265
  });
260
266
  /** @internal */
@@ -268,6 +274,7 @@ export type UserLocation$Outbound = {
268
274
  phone?: string | null | undefined;
269
275
  mobile_phone?: string | null | undefined;
270
276
  fax?: string | null | undefined;
277
+ personal_email?: string | null | undefined;
271
278
  country?: string | null | undefined;
272
279
  timezone?: string | null | undefined;
273
280
  };
@@ -287,11 +294,13 @@ export const UserLocation$outboundSchema: z.ZodType<
287
294
  phone: z.nullable(z.string()).optional(),
288
295
  mobilePhone: z.nullable(z.string()).optional(),
289
296
  fax: z.nullable(z.string()).optional(),
297
+ personalEmail: z.nullable(z.string()).optional(),
290
298
  country: z.nullable(z.string()).optional(),
291
299
  timezone: z.nullable(Timezone$outboundSchema).optional(),
292
300
  }).transform((v) => {
293
301
  return remap$(v, {
294
302
  mobilePhone: "mobile_phone",
303
+ personalEmail: "personal_email",
295
304
  });
296
305
  });
297
306
 
@@ -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,15 @@ 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` 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.personal_email` is stored lowercased, and a value that is not a valid
65
+ * email address, or is longer than 255 characters, gets a `422` response.
66
+ *
63
67
  * Submitting `location.zip` or `location.state` cross-checks the postal code
64
68
  * against the resulting state (using the vendor's existing value for whichever
65
69
  * of the two you omit from the request). The server rejects a code that is not shaped like a real
@@ -1026,12 +1026,15 @@ 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` 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.personal_email` is stored lowercased, and a value that is not a valid
1036
+ * email address, or is longer than 255 characters, gets a `422` response.
1037
+ *
1035
1038
  * Submitting `location.zip` or `location.state` cross-checks the postal code
1036
1039
  * against the resulting state (using the vendor's existing value for whichever
1037
1040
  * of the two you omit from the request). The server rejects a code that is not shaped like a real