@greensecurity/javascript-sdk 0.45.0-beta.10 → 0.45.0-beta.11

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 (197) hide show
  1. package/README.md +4 -1
  2. package/dist/commonjs/__tests__/lookups.test.js +21 -0
  3. package/dist/commonjs/__tests__/lookups.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  5. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  7. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  8. package/dist/commonjs/__tests__/zones.test.js +12 -9
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/admin-funcs/dismissCommunication.d.ts +3 -0
  11. package/dist/commonjs/admin-funcs/dismissCommunication.d.ts.map +1 -0
  12. package/dist/commonjs/admin-funcs/dismissCommunication.js +20 -0
  13. package/dist/commonjs/admin-funcs/dismissCommunication.js.map +1 -0
  14. package/dist/commonjs/admin-funcs/listCommunications.d.ts +3 -0
  15. package/dist/commonjs/admin-funcs/listCommunications.d.ts.map +1 -0
  16. package/dist/commonjs/admin-funcs/listCommunications.js +25 -0
  17. package/dist/commonjs/admin-funcs/listCommunications.js.map +1 -0
  18. package/dist/commonjs/funcs/lookupsLookupPostalCode.d.ts +35 -0
  19. package/dist/commonjs/funcs/lookupsLookupPostalCode.d.ts.map +1 -0
  20. package/dist/commonjs/funcs/lookupsLookupPostalCode.js +140 -0
  21. package/dist/commonjs/funcs/lookupsLookupPostalCode.js.map +1 -0
  22. package/dist/commonjs/funcs/usersUpdateUser.d.ts +6 -0
  23. package/dist/commonjs/funcs/usersUpdateUser.d.ts.map +1 -1
  24. package/dist/commonjs/funcs/usersUpdateUser.js +6 -0
  25. package/dist/commonjs/funcs/usersUpdateUser.js.map +1 -1
  26. package/dist/commonjs/funcs/vendorsCreateVendor.d.ts +4 -0
  27. package/dist/commonjs/funcs/vendorsCreateVendor.d.ts.map +1 -1
  28. package/dist/commonjs/funcs/vendorsCreateVendor.js +4 -0
  29. package/dist/commonjs/funcs/vendorsCreateVendor.js.map +1 -1
  30. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts +9 -1
  31. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
  32. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js +9 -1
  33. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js.map +1 -1
  34. package/dist/commonjs/index.extras.d.ts +6 -0
  35. package/dist/commonjs/index.extras.d.ts.map +1 -1
  36. package/dist/commonjs/index.extras.js +6 -0
  37. package/dist/commonjs/index.extras.js.map +1 -1
  38. package/dist/commonjs/lib/config.d.ts +2 -2
  39. package/dist/commonjs/lib/config.js +2 -2
  40. package/dist/commonjs/models/operations/createvendorcompany.d.ts +7 -1
  41. package/dist/commonjs/models/operations/createvendorcompany.d.ts.map +1 -1
  42. package/dist/commonjs/models/operations/createvendorcompany.js.map +1 -1
  43. package/dist/commonjs/models/operations/index.d.ts +1 -0
  44. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  45. package/dist/commonjs/models/operations/index.js +1 -0
  46. package/dist/commonjs/models/operations/index.js.map +1 -1
  47. package/dist/commonjs/models/operations/lookuppostalcode.d.ts +59 -0
  48. package/dist/commonjs/models/operations/lookuppostalcode.d.ts.map +1 -0
  49. package/dist/commonjs/models/operations/lookuppostalcode.js +81 -0
  50. package/dist/commonjs/models/operations/lookuppostalcode.js.map +1 -0
  51. package/dist/commonjs/react-query/index.d.ts +1 -0
  52. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  53. package/dist/commonjs/react-query/index.js +1 -0
  54. package/dist/commonjs/react-query/index.js.map +1 -1
  55. package/dist/commonjs/react-query/lookupsLookupPostalCode.core.d.ts +16 -0
  56. package/dist/commonjs/react-query/lookupsLookupPostalCode.core.d.ts.map +1 -0
  57. package/dist/commonjs/react-query/lookupsLookupPostalCode.core.js +43 -0
  58. package/dist/commonjs/react-query/lookupsLookupPostalCode.core.js.map +1 -0
  59. package/dist/commonjs/react-query/lookupsLookupPostalCode.d.ts +71 -0
  60. package/dist/commonjs/react-query/lookupsLookupPostalCode.d.ts.map +1 -0
  61. package/dist/commonjs/react-query/lookupsLookupPostalCode.js +95 -0
  62. package/dist/commonjs/react-query/lookupsLookupPostalCode.js.map +1 -0
  63. package/dist/commonjs/react-query/usersUpdateUser.d.ts +6 -0
  64. package/dist/commonjs/react-query/usersUpdateUser.d.ts.map +1 -1
  65. package/dist/commonjs/react-query/usersUpdateUser.js +6 -0
  66. package/dist/commonjs/react-query/usersUpdateUser.js.map +1 -1
  67. package/dist/commonjs/react-query/vendorsCreateVendor.d.ts +4 -0
  68. package/dist/commonjs/react-query/vendorsCreateVendor.d.ts.map +1 -1
  69. package/dist/commonjs/react-query/vendorsCreateVendor.js +4 -0
  70. package/dist/commonjs/react-query/vendorsCreateVendor.js.map +1 -1
  71. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts +9 -1
  72. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
  73. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js +9 -1
  74. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js.map +1 -1
  75. package/dist/commonjs/sdk/lookups.d.ts +22 -0
  76. package/dist/commonjs/sdk/lookups.d.ts.map +1 -1
  77. package/dist/commonjs/sdk/lookups.js +25 -0
  78. package/dist/commonjs/sdk/lookups.js.map +1 -1
  79. package/dist/commonjs/sdk/users.d.ts +6 -0
  80. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  81. package/dist/commonjs/sdk/users.js +6 -0
  82. package/dist/commonjs/sdk/users.js.map +1 -1
  83. package/dist/commonjs/sdk/vendors.d.ts +13 -1
  84. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  85. package/dist/commonjs/sdk/vendors.js +13 -1
  86. package/dist/commonjs/sdk/vendors.js.map +1 -1
  87. package/dist/esm/__tests__/lookups.test.js +21 -0
  88. package/dist/esm/__tests__/lookups.test.js.map +1 -1
  89. package/dist/esm/__tests__/vendors.test.js +1 -1
  90. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  91. package/dist/esm/__tests__/webhooks.test.js +1 -1
  92. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  93. package/dist/esm/__tests__/zones.test.js +12 -9
  94. package/dist/esm/__tests__/zones.test.js.map +1 -1
  95. package/dist/esm/admin-funcs/dismissCommunication.d.ts +3 -0
  96. package/dist/esm/admin-funcs/dismissCommunication.d.ts.map +1 -0
  97. package/dist/esm/admin-funcs/dismissCommunication.js +17 -0
  98. package/dist/esm/admin-funcs/dismissCommunication.js.map +1 -0
  99. package/dist/esm/admin-funcs/listCommunications.d.ts +3 -0
  100. package/dist/esm/admin-funcs/listCommunications.d.ts.map +1 -0
  101. package/dist/esm/admin-funcs/listCommunications.js +22 -0
  102. package/dist/esm/admin-funcs/listCommunications.js.map +1 -0
  103. package/dist/esm/funcs/lookupsLookupPostalCode.d.ts +35 -0
  104. package/dist/esm/funcs/lookupsLookupPostalCode.d.ts.map +1 -0
  105. package/dist/esm/funcs/lookupsLookupPostalCode.js +104 -0
  106. package/dist/esm/funcs/lookupsLookupPostalCode.js.map +1 -0
  107. package/dist/esm/funcs/usersUpdateUser.d.ts +6 -0
  108. package/dist/esm/funcs/usersUpdateUser.d.ts.map +1 -1
  109. package/dist/esm/funcs/usersUpdateUser.js +6 -0
  110. package/dist/esm/funcs/usersUpdateUser.js.map +1 -1
  111. package/dist/esm/funcs/vendorsCreateVendor.d.ts +4 -0
  112. package/dist/esm/funcs/vendorsCreateVendor.d.ts.map +1 -1
  113. package/dist/esm/funcs/vendorsCreateVendor.js +4 -0
  114. package/dist/esm/funcs/vendorsCreateVendor.js.map +1 -1
  115. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts +9 -1
  116. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
  117. package/dist/esm/funcs/vendorsUpdateVendorDetails.js +9 -1
  118. package/dist/esm/funcs/vendorsUpdateVendorDetails.js.map +1 -1
  119. package/dist/esm/index.extras.d.ts +6 -0
  120. package/dist/esm/index.extras.d.ts.map +1 -1
  121. package/dist/esm/index.extras.js +6 -0
  122. package/dist/esm/index.extras.js.map +1 -1
  123. package/dist/esm/lib/config.d.ts +2 -2
  124. package/dist/esm/lib/config.js +2 -2
  125. package/dist/esm/models/operations/createvendorcompany.d.ts +7 -1
  126. package/dist/esm/models/operations/createvendorcompany.d.ts.map +1 -1
  127. package/dist/esm/models/operations/createvendorcompany.js.map +1 -1
  128. package/dist/esm/models/operations/index.d.ts +1 -0
  129. package/dist/esm/models/operations/index.d.ts.map +1 -1
  130. package/dist/esm/models/operations/index.js +1 -0
  131. package/dist/esm/models/operations/index.js.map +1 -1
  132. package/dist/esm/models/operations/lookuppostalcode.d.ts +59 -0
  133. package/dist/esm/models/operations/lookuppostalcode.d.ts.map +1 -0
  134. package/dist/esm/models/operations/lookuppostalcode.js +43 -0
  135. package/dist/esm/models/operations/lookuppostalcode.js.map +1 -0
  136. package/dist/esm/react-query/index.d.ts +1 -0
  137. package/dist/esm/react-query/index.d.ts.map +1 -1
  138. package/dist/esm/react-query/index.js +1 -0
  139. package/dist/esm/react-query/index.js.map +1 -1
  140. package/dist/esm/react-query/lookupsLookupPostalCode.core.d.ts +16 -0
  141. package/dist/esm/react-query/lookupsLookupPostalCode.core.d.ts.map +1 -0
  142. package/dist/esm/react-query/lookupsLookupPostalCode.core.js +38 -0
  143. package/dist/esm/react-query/lookupsLookupPostalCode.core.js.map +1 -0
  144. package/dist/esm/react-query/lookupsLookupPostalCode.d.ts +71 -0
  145. package/dist/esm/react-query/lookupsLookupPostalCode.d.ts.map +1 -0
  146. package/dist/esm/react-query/lookupsLookupPostalCode.js +85 -0
  147. package/dist/esm/react-query/lookupsLookupPostalCode.js.map +1 -0
  148. package/dist/esm/react-query/usersUpdateUser.d.ts +6 -0
  149. package/dist/esm/react-query/usersUpdateUser.d.ts.map +1 -1
  150. package/dist/esm/react-query/usersUpdateUser.js +6 -0
  151. package/dist/esm/react-query/usersUpdateUser.js.map +1 -1
  152. package/dist/esm/react-query/vendorsCreateVendor.d.ts +4 -0
  153. package/dist/esm/react-query/vendorsCreateVendor.d.ts.map +1 -1
  154. package/dist/esm/react-query/vendorsCreateVendor.js +4 -0
  155. package/dist/esm/react-query/vendorsCreateVendor.js.map +1 -1
  156. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts +9 -1
  157. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
  158. package/dist/esm/react-query/vendorsUpdateVendorDetails.js +9 -1
  159. package/dist/esm/react-query/vendorsUpdateVendorDetails.js.map +1 -1
  160. package/dist/esm/sdk/lookups.d.ts +22 -0
  161. package/dist/esm/sdk/lookups.d.ts.map +1 -1
  162. package/dist/esm/sdk/lookups.js +25 -0
  163. package/dist/esm/sdk/lookups.js.map +1 -1
  164. package/dist/esm/sdk/users.d.ts +6 -0
  165. package/dist/esm/sdk/users.d.ts.map +1 -1
  166. package/dist/esm/sdk/users.js +6 -0
  167. package/dist/esm/sdk/users.js.map +1 -1
  168. package/dist/esm/sdk/vendors.d.ts +13 -1
  169. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  170. package/dist/esm/sdk/vendors.js +13 -1
  171. package/dist/esm/sdk/vendors.js.map +1 -1
  172. package/jsr.json +1 -1
  173. package/package.json +1 -1
  174. package/src/__tests__/lookups.test.ts +24 -0
  175. package/src/__tests__/vendors.test.ts +1 -1
  176. package/src/__tests__/webhooks.test.ts +1 -1
  177. package/src/__tests__/zones.test.ts +12 -9
  178. package/src/admin-funcs/dismissCommunication.ts +20 -0
  179. package/src/admin-funcs/listCommunications.ts +29 -0
  180. package/src/funcs/lookupsLookupPostalCode.ts +193 -0
  181. package/src/funcs/usersUpdateUser.ts +6 -0
  182. package/src/funcs/vendorsCreateVendor.ts +4 -0
  183. package/src/funcs/vendorsUpdateVendorDetails.ts +9 -1
  184. package/src/index.extras.ts +8 -0
  185. package/src/lib/config.ts +2 -2
  186. package/src/models/operations/createvendorcompany.ts +7 -1
  187. package/src/models/operations/index.ts +1 -0
  188. package/src/models/operations/lookuppostalcode.ts +118 -0
  189. package/src/react-query/index.ts +1 -0
  190. package/src/react-query/lookupsLookupPostalCode.core.ts +82 -0
  191. package/src/react-query/lookupsLookupPostalCode.ts +177 -0
  192. package/src/react-query/usersUpdateUser.ts +6 -0
  193. package/src/react-query/vendorsCreateVendor.ts +4 -0
  194. package/src/react-query/vendorsUpdateVendorDetails.ts +9 -1
  195. package/src/sdk/lookups.ts +33 -0
  196. package/src/sdk/users.ts +6 -0
  197. package/src/sdk/vendors.ts +13 -1
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@greensecurity/javascript-sdk",
5
- "version": "0.45.0-beta.10",
5
+ "version": "0.45.0-beta.11",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greensecurity/javascript-sdk",
3
- "version": "0.45.0-beta.10",
3
+ "version": "0.45.0-beta.11",
4
4
  "author": "Green Security LLC",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -27,3 +27,27 @@ test("Lookups List Lookup Systems", async () => {
27
27
  systems: [],
28
28
  });
29
29
  });
30
+
31
+ test("Lookups Lookup Postal Code", async () => {
32
+ const testHttpClient = createTestHTTPClient("lookupPostalCode");
33
+
34
+ const greenSecurity = new GreenSecurity({
35
+ serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
36
+ httpClient: testHttpClient,
37
+ security: {
38
+ token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
39
+ },
40
+ });
41
+
42
+ const result = await greenSecurity.lookups.lookupPostalCode({
43
+ postalCode: "12383-0520",
44
+ state: "Rhode Island",
45
+ country: "Belgium",
46
+ });
47
+ expect(result).toBeDefined();
48
+ expect(result).toEqual({
49
+ status: "mismatch",
50
+ expectedStates: [],
51
+ error: "<value>",
52
+ });
53
+ });
@@ -121,7 +121,7 @@ test("Vendors List Vendor Credits", async () => {
121
121
  page: 1,
122
122
  useUrlParams: false,
123
123
  },
124
- creditBalance: 6121.86,
124
+ creditBalance: 7634.4,
125
125
  });
126
126
  });
127
127
 
@@ -20,7 +20,7 @@ test("Webhooks List All Webhook Endpoints", async () => {
20
20
  const testWebhookListForVendorUserResult = await greenSecurity.webhooks
21
21
  .listAllWebhookEndpoints({
22
22
  itemsPerPage: 25,
23
- desc: true,
23
+ desc: 0,
24
24
  sort: "",
25
25
  });
26
26
  expect(testWebhookListForVendorUserResult).toBeDefined();
@@ -39,27 +39,31 @@ test("Zones List Or Search Security Zones", async () => {
39
39
  facility: {
40
40
  contacts: {
41
41
  contact: {
42
- status: "Active",
42
+ status: "Inactive",
43
43
  department: 123,
44
44
  },
45
45
  adminContact: {
46
- status: "Deleted",
46
+ status: "Active",
47
47
  department: 123,
48
48
  },
49
49
  techContact: {
50
- status: "Deleted",
50
+ status: "Inactive",
51
51
  department: 123,
52
52
  },
53
53
  greenSecurityCsm: {
54
- status: "Active",
54
+ status: "Deleted",
55
55
  department: 123,
56
56
  },
57
57
  accountManager: {
58
- status: "Active",
58
+ status: "Deleted",
59
59
  department: 123,
60
60
  },
61
61
  },
62
- vendorGuestPolicy: null,
62
+ vendorGuestPolicy: {
63
+ enabled: true,
64
+ vendorGuestLimitAndOr: "and",
65
+ vendorGuestRequireEmail: true,
66
+ },
63
67
  },
64
68
  },
65
69
  {
@@ -81,9 +85,8 @@ test("Zones Security Zone Checkin", async () => {
81
85
  });
82
86
 
83
87
  const result = await greenSecurity.zones.securityZoneCheckin({
84
- longitude: 8727.22,
85
- latitude: 2068.79,
86
- zoneId: 536569,
88
+ qrCode: "<value>",
89
+ zoneId: 118821,
87
90
  });
88
91
  expect(result).toBeDefined();
89
92
  expect(result).toEqual({});
@@ -0,0 +1,20 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doPost, internalApiResult } from "./doAdmin.js";
3
+
4
+ // Records that the caller dismissed a communication (GSSD-7336).
5
+ //
6
+ // Internal for the same reason as listCommunications: it only means anything to our own portal.
7
+ //
8
+ // The durable half of a two-layer dismissal — the client suppresses locally straight away so a
9
+ // banner does not flash back while this is in flight, and this row is what makes the timed
10
+ // rules ("after a week", "after a month") hold on a second device. Whether a past dismissal
11
+ // still suppresses anything is decided server-side on the next list call.
12
+ //
13
+ // The server re-checks the caller's audience before writing, so dismissing a communication that
14
+ // was never aimed at you answers 404 rather than creating a row.
15
+ export function dismissCommunication(communicationId: number): internalApiResult {
16
+ return new APIPromise($doPost(
17
+ `/communications/${communicationId}/dismiss`,
18
+ {},
19
+ ));
20
+ }
@@ -0,0 +1,29 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doGetSingle, hashToQueryString, internalApiResult } from "./doAdmin.js";
3
+
4
+ // The banners, pop-ups and in-app notifications aimed at the signed-in user (GSSD-7336).
5
+ //
6
+ // Internal rather than part of the public spec: "the adverts for whoever is holding this token"
7
+ // is only meaningful to our own portal, and a third-party SDK consumer has no use for it. See
8
+ // the public/app-only split in AGENTS.md.
9
+ //
10
+ // The response is already filtered and ordered by the server — audience matched per caller,
11
+ // page matched, anything still suppressed by a dismissal removed, and sorted by priority — so a
12
+ // caller renders the list as it arrives.
13
+ //
14
+ // pageKey narrows to the communications configured for one page. Omitting it returns every
15
+ // communication for the user, which is what a caller that does its own page matching wants.
16
+ export function listCommunications(
17
+ pageKey?: string | null,
18
+ itemsPerPage: number = 100,
19
+ ): internalApiResult {
20
+ const query: Record<string, string | number> = { items_per_page: itemsPerPage };
21
+ if (pageKey) {
22
+ query["page_key"] = pageKey;
23
+ }
24
+
25
+ return new APIPromise($doGetSingle(
26
+ `/communications?${hashToQueryString(query)}`,
27
+ {},
28
+ ));
29
+ }
@@ -0,0 +1,193 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Check a postal code against a state and country
31
+ *
32
+ * @remarks
33
+ * Cross-checks a postal code against a state/province and country, the same check
34
+ * every write path that stores a US or Canadian address enforces server-side (e.g.
35
+ * `PUT /users/{id}`, `PUT /vendors/{vendor_id_or_me}`). Useful for validating an
36
+ * address before submitting it elsewhere.
37
+ *
38
+ * `status` is one of:
39
+ * - `ok` — the postal code belongs to the given state/province.
40
+ * - `invalid` — the postal code is not shaped like a real one for the given country.
41
+ * - `mismatch` — the postal code is well-formed but belongs to a different state or
42
+ * province. `expected_states` names the state(s) it actually maps to.
43
+ * - `unknown` — nothing to check against (an unsupported country, or a postal code
44
+ * absent from the US ZIP dataset). Treated as acceptable by every write path that
45
+ * uses this check.
46
+ *
47
+ * Only the US and Canada have a real code-to-subdivision map; every other country
48
+ * always returns `unknown`.
49
+ *
50
+ * If set, this operation will use {@link Security.bearerJwt} from the global security.
51
+ */
52
+ export function lookupsLookupPostalCode(
53
+ client: GreenSecurityCore,
54
+ request: operations.LookupPostalCodeRequest,
55
+ options?: RequestOptions,
56
+ ): APIPromise<
57
+ Result<
58
+ operations.LookupPostalCodeLookupPostalCodeOk,
59
+ | errors.ApiErrorResponse
60
+ | GreenSecurityError
61
+ | ResponseValidationError
62
+ | ConnectionError
63
+ | RequestAbortedError
64
+ | RequestTimeoutError
65
+ | InvalidRequestError
66
+ | UnexpectedClientError
67
+ | SDKValidationError
68
+ >
69
+ > {
70
+ return new APIPromise($do(
71
+ client,
72
+ request,
73
+ options,
74
+ ));
75
+ }
76
+
77
+ async function $do(
78
+ client: GreenSecurityCore,
79
+ request: operations.LookupPostalCodeRequest,
80
+ options?: RequestOptions,
81
+ ): Promise<
82
+ [
83
+ Result<
84
+ operations.LookupPostalCodeLookupPostalCodeOk,
85
+ | errors.ApiErrorResponse
86
+ | GreenSecurityError
87
+ | ResponseValidationError
88
+ | ConnectionError
89
+ | RequestAbortedError
90
+ | RequestTimeoutError
91
+ | InvalidRequestError
92
+ | UnexpectedClientError
93
+ | SDKValidationError
94
+ >,
95
+ APICall,
96
+ ]
97
+ > {
98
+ const parsed = safeParse(
99
+ request,
100
+ (value) => operations.LookupPostalCodeRequest$outboundSchema.parse(value),
101
+ "Input validation failed",
102
+ );
103
+ if (!parsed.ok) {
104
+ return [parsed, { status: "invalid" }];
105
+ }
106
+ const payload = parsed.value;
107
+ const body = null;
108
+
109
+ const path = pathToFunc("/lookups/postal-code")();
110
+
111
+ const query = encodeFormQuery({
112
+ "country": payload.country,
113
+ "postal_code": payload.postal_code,
114
+ "state": payload.state,
115
+ });
116
+
117
+ const headers = new Headers(compactMap({
118
+ Accept: "application/json",
119
+ }));
120
+
121
+ const securityInput = await extractSecurity(client._options.security);
122
+ const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
123
+
124
+ const context = {
125
+ options: client._options,
126
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
127
+ operationID: "lookupPostalCode",
128
+ oAuth2Scopes: null,
129
+
130
+ resolvedSecurity: requestSecurity,
131
+
132
+ securitySource: client._options.security,
133
+ retryConfig: options?.retries
134
+ || client._options.retryConfig
135
+ || { strategy: "none" },
136
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
137
+ };
138
+
139
+ const requestRes = client._createRequest(context, {
140
+ security: requestSecurity,
141
+ method: "GET",
142
+ baseURL: options?.serverURL,
143
+ path: path,
144
+ headers: headers,
145
+ query: query,
146
+ body: body,
147
+ userAgent: client._options.userAgent,
148
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
149
+ }, options);
150
+ if (!requestRes.ok) {
151
+ return [requestRes, { status: "invalid" }];
152
+ }
153
+ const req = requestRes.value;
154
+
155
+ const doResult = await client._do(req, {
156
+ context,
157
+ isErrorStatusCode: (statusCode: number) =>
158
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
159
+ retryConfig: context.retryConfig,
160
+ retryCodes: context.retryCodes,
161
+ });
162
+ if (!doResult.ok) {
163
+ return [doResult, { status: "request-error", request: req }];
164
+ }
165
+ const response = doResult.value;
166
+
167
+ const responseFields = {
168
+ HttpMeta: { Response: response, Request: req },
169
+ };
170
+
171
+ const [result] = await M.match<
172
+ operations.LookupPostalCodeLookupPostalCodeOk,
173
+ | errors.ApiErrorResponse
174
+ | GreenSecurityError
175
+ | ResponseValidationError
176
+ | ConnectionError
177
+ | RequestAbortedError
178
+ | RequestTimeoutError
179
+ | InvalidRequestError
180
+ | UnexpectedClientError
181
+ | SDKValidationError
182
+ >(
183
+ M.json(200, operations.LookupPostalCodeLookupPostalCodeOk$inboundSchema),
184
+ M.jsonErr([400, 401, 422], errors.ApiErrorResponse$inboundSchema),
185
+ M.fail("4XX"),
186
+ M.fail([500, "5XX"]),
187
+ )(response, req, { extraFields: responseFields });
188
+ if (!result.ok) {
189
+ return [result, { status: "complete", request: req, response }];
190
+ }
191
+
192
+ return [result, { status: "complete", request: req, response }];
193
+ }
@@ -37,6 +37,12 @@ import { Result } from "../types/fp.js";
37
37
  * Only submitted fields are applied — unrecognised fields are silently ignored.
38
38
  * Changing `email` automatically resets `bounced_email` to `false`.
39
39
  *
40
+ * Submitting `zip`, `state`, or `country` cross-checks the postal code against the
41
+ * resulting state/country (using the existing value for any of the three left out
42
+ * of the request). A code that is not shaped like a real postal code, or that
43
+ * provably belongs to a different state, is rejected with `422` naming the correct
44
+ * state.
45
+ *
40
46
  * Each subkey of `email_preferences` is independently optional; sending
41
47
  * `{ "email_preferences": { "send_weekly_summary_email": true } }` flips
42
48
  * only that flag and leaves the others unchanged.
@@ -36,6 +36,10 @@ import { Result } from "../types/fp.js";
36
36
  * All other callers must provide `company_id`. The caller must have access to the
37
37
  * specified company (verified via scoped access policy) and the `vendors:add` permission.
38
38
  *
39
+ * `zip` is cross-checked against `state`: a code that is not shaped like a real postal
40
+ * code, or that provably belongs to a different state, is rejected with `422` naming
41
+ * the correct state.
42
+ *
39
43
  * If set, this operation will use {@link Security.bearerJwt} from the global security.
40
44
  */
41
45
  export function vendorsCreateVendor(
@@ -38,7 +38,15 @@ import * as types$ from "../types/primitives.js";
38
38
  * From `location` this endpoint reads only `timezone`, `address1`, `address2`,
39
39
  * `city`, `state`, `zip`, `phone`, `mobile_phone` and `fax`. The `address` and
40
40
  * `country` properties of the shared `UserLocation` schema are ignored here and
41
- * updating them is not supported.
41
+ * updating them is not supported. `state` accepts a US state or a Canadian
42
+ * province — the vendor's country, set only at registration, is not editable
43
+ * through this endpoint.
44
+ *
45
+ * Submitting `location.zip` or `location.state` cross-checks the postal code
46
+ * against the resulting state (using the vendor's existing value for whichever
47
+ * of the two is left out of the request). A code that is not shaped like a real
48
+ * postal code, or that provably belongs to a different state, is rejected with
49
+ * `422` naming the correct state.
42
50
  *
43
51
  * For `title`, the `supervisor` fields, and every `location` field except
44
52
  * `timezone`, the value sent is the value stored: omit a field to leave it
@@ -44,6 +44,9 @@ import { vendorGetPaymentForm } from "./admin-funcs/vendorGetPaymentForm.js";
44
44
  import { vendorGetSystemsRequiringSmartBadge } from "./admin-funcs/vendorGetSystemsRequiringSmartBadge.js";
45
45
  import { vendorGetCompanyCredentialsSummary } from "./admin-funcs/vendorGetCompanyCredentialsSummary.js";
46
46
 
47
+ import { listCommunications } from "./admin-funcs/listCommunications.js";
48
+ import { dismissCommunication } from "./admin-funcs/dismissCommunication.js";
49
+
47
50
  export const __internal = {
48
51
  getInternalCore,
49
52
  initializeInternalCore,
@@ -102,6 +105,11 @@ export const __internal = {
102
105
  notifyUploaded: notifyVendorCredentialFileUploaded
103
106
  },
104
107
 
108
+ communications: {
109
+ list: listCommunications,
110
+ dismiss: dismissCommunication
111
+ },
112
+
105
113
  companyManager: {
106
114
  getPaymentForm: companyManagerGetPaymentForm,
107
115
  },
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.44.0",
82
+ openapiDocVersion: "0.45.0",
83
83
  sdkVersion: "0.45.0-beta.10",
84
84
  genVersion: "2.934.1",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.45.0-beta.10 2.934.1 0.44.0 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.45.0-beta.10 2.934.1 0.45.0 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -28,7 +28,13 @@ export type CreateVendorCompanyRequestBody = {
28
28
  */
29
29
  state: components.State | null;
30
30
  /**
31
- * The vendor company zip
31
+ * The vendor company zip. Cross-checked against `state` (always
32
+ *
33
+ * @remarks
34
+ * treated as a US address on this endpoint) — a code that is not
35
+ * shaped like a real US ZIP, or that provably belongs to a
36
+ * different state, is rejected with `400` naming the correct
37
+ * state.
32
38
  */
33
39
  zip: string;
34
40
  /**
@@ -131,6 +131,7 @@ export * from "./listvendorscrubpackages.js";
131
131
  export * from "./listvendorscrubpurchases.js";
132
132
  export * from "./listvendortypes.js";
133
133
  export * from "./lookupcompanies.js";
134
+ export * from "./lookuppostalcode.js";
134
135
  export * from "./magiclink.js";
135
136
  export * from "./makepayment.js";
136
137
  export * from "./password.js";
@@ -0,0 +1,118 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import * as openEnums from "../../types/enums.js";
9
+ import { OpenEnum } from "../../types/enums.js";
10
+ import { Result as SafeParseResult } from "../../types/fp.js";
11
+ import * as types from "../../types/primitives.js";
12
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
+
14
+ export type LookupPostalCodeRequest = {
15
+ /**
16
+ * The zip / postal code to check.
17
+ */
18
+ postalCode: string;
19
+ /**
20
+ * The state or province, as a code or full name, entered alongside the postal code.
21
+ */
22
+ state: string;
23
+ /**
24
+ * The country entered alongside the postal code (e.g. US, CA).
25
+ */
26
+ country: string;
27
+ };
28
+
29
+ export const LookupPostalCodeStatus = {
30
+ Ok: "ok",
31
+ Invalid: "invalid",
32
+ Mismatch: "mismatch",
33
+ Unknown: "unknown",
34
+ } as const;
35
+ export type LookupPostalCodeStatus = OpenEnum<typeof LookupPostalCodeStatus>;
36
+
37
+ /**
38
+ * The request was successful, and the server has returned the check result in the response body.
39
+ */
40
+ export type LookupPostalCodeLookupPostalCodeOk = {
41
+ status: LookupPostalCodeStatus;
42
+ /**
43
+ * The state(s)/province(s) the postal code actually belongs to. Populated whenever the
44
+ *
45
+ * @remarks
46
+ * postal code is well-formed and a state/province was checked against it — so this is
47
+ * non-empty for `ok` (it names the state that matched) as well as for `mismatch`, and
48
+ * empty for `invalid` and `unknown`.
49
+ */
50
+ expectedStates: Array<string>;
51
+ /**
52
+ * A human-readable explanation of the problem. `null` unless `status` is `invalid` or `mismatch`.
53
+ */
54
+ error: string | null;
55
+ };
56
+
57
+ /** @internal */
58
+ export type LookupPostalCodeRequest$Outbound = {
59
+ postal_code: string;
60
+ state: string;
61
+ country: string;
62
+ };
63
+
64
+ /** @internal */
65
+ export const LookupPostalCodeRequest$outboundSchema: z.ZodType<
66
+ LookupPostalCodeRequest$Outbound,
67
+ z.ZodTypeDef,
68
+ LookupPostalCodeRequest
69
+ > = z.object({
70
+ postalCode: z.string(),
71
+ state: z.string(),
72
+ country: z.string(),
73
+ }).transform((v) => {
74
+ return remap$(v, {
75
+ postalCode: "postal_code",
76
+ });
77
+ });
78
+
79
+ export function lookupPostalCodeRequestToJSON(
80
+ lookupPostalCodeRequest: LookupPostalCodeRequest,
81
+ ): string {
82
+ return JSON.stringify(
83
+ LookupPostalCodeRequest$outboundSchema.parse(lookupPostalCodeRequest),
84
+ );
85
+ }
86
+
87
+ /** @internal */
88
+ export const LookupPostalCodeStatus$inboundSchema: z.ZodType<
89
+ LookupPostalCodeStatus,
90
+ z.ZodTypeDef,
91
+ unknown
92
+ > = openEnums.inboundSchema(LookupPostalCodeStatus);
93
+
94
+ /** @internal */
95
+ export const LookupPostalCodeLookupPostalCodeOk$inboundSchema: z.ZodType<
96
+ LookupPostalCodeLookupPostalCodeOk,
97
+ z.ZodTypeDef,
98
+ unknown
99
+ > = z.object({
100
+ status: LookupPostalCodeStatus$inboundSchema,
101
+ expected_states: z.array(types.string()),
102
+ error: types.nullable(types.string()),
103
+ }).transform((v) => {
104
+ return remap$(v, {
105
+ "expected_states": "expectedStates",
106
+ });
107
+ });
108
+
109
+ export function lookupPostalCodeLookupPostalCodeOkFromJSON(
110
+ jsonString: string,
111
+ ): SafeParseResult<LookupPostalCodeLookupPostalCodeOk, SDKValidationError> {
112
+ return safeParse(
113
+ jsonString,
114
+ (x) =>
115
+ LookupPostalCodeLookupPostalCodeOk$inboundSchema.parse(JSON.parse(x)),
116
+ `Failed to parse 'LookupPostalCodeLookupPostalCodeOk' from JSON`,
117
+ );
118
+ }
@@ -43,6 +43,7 @@ export * from "./invoicesListInvoices.js";
43
43
  export * from "./invoicesMakePayment.js";
44
44
  export * from "./invoicesUpdateInvoice.js";
45
45
  export * from "./lookupsListLookupSystems.js";
46
+ export * from "./lookupsLookupPostalCode.js";
46
47
  export * from "./medicalProductsCreateDistributor.js";
47
48
  export * from "./medicalProductsCreateManufacturer.js";
48
49
  export * from "./medicalProductsCreateMedicalProduct.js";
@@ -0,0 +1,82 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ QueryClient,
7
+ QueryFunctionContext,
8
+ QueryKey,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { lookupsLookupPostalCode } from "../funcs/lookupsLookupPostalCode.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { unwrapAsync } from "../types/fp.js";
16
+ export type LookupsLookupPostalCodeQueryData =
17
+ operations.LookupPostalCodeLookupPostalCodeOk;
18
+
19
+ export function prefetchLookupsLookupPostalCode(
20
+ queryClient: QueryClient,
21
+ client$: GreenSecurityCore,
22
+ request: operations.LookupPostalCodeRequest,
23
+ options?: RequestOptions,
24
+ ): Promise<void> {
25
+ return queryClient.prefetchQuery({
26
+ ...buildLookupsLookupPostalCodeQuery(
27
+ client$,
28
+ request,
29
+ options,
30
+ ),
31
+ });
32
+ }
33
+
34
+ export function buildLookupsLookupPostalCodeQuery(
35
+ client$: GreenSecurityCore,
36
+ request: operations.LookupPostalCodeRequest,
37
+ options?: RequestOptions,
38
+ ): {
39
+ queryKey: QueryKey;
40
+ queryFn: (
41
+ context: QueryFunctionContext,
42
+ ) => Promise<LookupsLookupPostalCodeQueryData>;
43
+ } {
44
+ return {
45
+ queryKey: queryKeyLookupsLookupPostalCode({
46
+ postalCode: request.postalCode,
47
+ state: request.state,
48
+ country: request.country,
49
+ }),
50
+ queryFn: async function lookupsLookupPostalCodeQueryFn(
51
+ ctx,
52
+ ): Promise<LookupsLookupPostalCodeQueryData> {
53
+ const sig = combineSignals(
54
+ ctx.signal,
55
+ options?.signal,
56
+ options?.fetchOptions?.signal,
57
+ );
58
+ const mergedOptions = {
59
+ ...options?.fetchOptions,
60
+ ...options,
61
+ signal: sig,
62
+ };
63
+
64
+ return unwrapAsync(lookupsLookupPostalCode(
65
+ client$,
66
+ request,
67
+ mergedOptions,
68
+ ));
69
+ },
70
+ };
71
+ }
72
+
73
+ export function queryKeyLookupsLookupPostalCode(
74
+ parameters: { postalCode: string; state: string; country: string },
75
+ ): QueryKey {
76
+ return [
77
+ "@greensecurity/javascript-sdk",
78
+ "lookups",
79
+ "lookupPostalCode",
80
+ parameters,
81
+ ];
82
+ }