@greensecurity/javascript-sdk 0.48.0-beta.2 → 0.48.0-beta.4

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 (206) hide show
  1. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  2. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  3. package/dist/commonjs/__tests__/webhooks.test.js +5 -6
  4. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  5. package/dist/commonjs/__tests__/zoneDevicesCreate.test.js +2 -0
  6. package/dist/commonjs/__tests__/zoneDevicesCreate.test.js.map +1 -1
  7. package/dist/commonjs/__tests__/zoneDevicesList.test.js +9 -1
  8. package/dist/commonjs/__tests__/zoneDevicesList.test.js.map +1 -1
  9. package/dist/commonjs/__tests__/zones.test.js +10 -10
  10. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  11. package/dist/commonjs/admin-funcs/doAdmin.d.ts +4 -3
  12. package/dist/commonjs/admin-funcs/doAdmin.d.ts.map +1 -1
  13. package/dist/commonjs/admin-funcs/doAdmin.js +12 -8
  14. package/dist/commonjs/admin-funcs/doAdmin.js.map +1 -1
  15. package/dist/commonjs/admin-funcs/networksCreate.d.ts +3 -0
  16. package/dist/commonjs/admin-funcs/networksCreate.d.ts.map +1 -1
  17. package/dist/commonjs/admin-funcs/networksCreate.js +10 -3
  18. package/dist/commonjs/admin-funcs/networksCreate.js.map +1 -1
  19. package/dist/commonjs/admin-funcs/networksEmailGatewayUpdates.d.ts +3 -0
  20. package/dist/commonjs/admin-funcs/networksEmailGatewayUpdates.d.ts.map +1 -0
  21. package/dist/commonjs/admin-funcs/networksEmailGatewayUpdates.js +9 -0
  22. package/dist/commonjs/admin-funcs/networksEmailGatewayUpdates.js.map +1 -0
  23. package/dist/commonjs/admin-funcs/networksUpdate.d.ts +10 -0
  24. package/dist/commonjs/admin-funcs/networksUpdate.d.ts.map +1 -0
  25. package/dist/commonjs/admin-funcs/networksUpdate.js +14 -0
  26. package/dist/commonjs/admin-funcs/networksUpdate.js.map +1 -0
  27. package/dist/commonjs/funcs/alertsListAlerts.js +1 -0
  28. package/dist/commonjs/funcs/alertsListAlerts.js.map +1 -1
  29. package/dist/commonjs/funcs/invoicesListInvoices.d.ts +1 -0
  30. package/dist/commonjs/funcs/invoicesListInvoices.d.ts.map +1 -1
  31. package/dist/commonjs/funcs/invoicesListInvoices.js +1 -0
  32. package/dist/commonjs/funcs/invoicesListInvoices.js.map +1 -1
  33. package/dist/commonjs/funcs/vendorsGetVendorInvoiceReceipt.js +4 -0
  34. package/dist/commonjs/funcs/vendorsGetVendorInvoiceReceipt.js.map +1 -1
  35. package/dist/commonjs/index.extras.d.ts +4 -0
  36. package/dist/commonjs/index.extras.d.ts.map +1 -1
  37. package/dist/commonjs/index.extras.js +5 -1
  38. package/dist/commonjs/index.extras.js.map +1 -1
  39. package/dist/commonjs/lib/config.d.ts +2 -2
  40. package/dist/commonjs/lib/config.js +2 -2
  41. package/dist/commonjs/models/components/alert.d.ts +36 -2
  42. package/dist/commonjs/models/components/alert.d.ts.map +1 -1
  43. package/dist/commonjs/models/components/alert.js +20 -1
  44. package/dist/commonjs/models/components/alert.js.map +1 -1
  45. package/dist/commonjs/models/components/invoice.d.ts +5 -0
  46. package/dist/commonjs/models/components/invoice.d.ts.map +1 -1
  47. package/dist/commonjs/models/components/invoice.js +4 -0
  48. package/dist/commonjs/models/components/invoice.js.map +1 -1
  49. package/dist/commonjs/models/components/invoicefinancialstatus.d.ts +1 -0
  50. package/dist/commonjs/models/components/invoicefinancialstatus.d.ts.map +1 -1
  51. package/dist/commonjs/models/components/invoicefinancialstatus.js +1 -0
  52. package/dist/commonjs/models/components/invoicefinancialstatus.js.map +1 -1
  53. package/dist/commonjs/models/operations/getvendorinvoicereceipt.d.ts +19 -0
  54. package/dist/commonjs/models/operations/getvendorinvoicereceipt.d.ts.map +1 -1
  55. package/dist/commonjs/models/operations/getvendorinvoicereceipt.js +16 -1
  56. package/dist/commonjs/models/operations/getvendorinvoicereceipt.js.map +1 -1
  57. package/dist/commonjs/models/operations/invoicesexport.d.ts +4 -3
  58. package/dist/commonjs/models/operations/invoicesexport.d.ts.map +1 -1
  59. package/dist/commonjs/models/operations/invoicesexport.js +2 -1
  60. package/dist/commonjs/models/operations/invoicesexport.js.map +1 -1
  61. package/dist/commonjs/models/operations/listalerts.d.ts +5 -0
  62. package/dist/commonjs/models/operations/listalerts.d.ts.map +1 -1
  63. package/dist/commonjs/models/operations/listalerts.js +2 -0
  64. package/dist/commonjs/models/operations/listalerts.js.map +1 -1
  65. package/dist/commonjs/models/operations/listinvoices.d.ts +1 -1
  66. package/dist/commonjs/models/operations/listvendorinvoices.d.ts +1 -1
  67. package/dist/commonjs/react-query/alertsListAlerts.core.d.ts +2 -0
  68. package/dist/commonjs/react-query/alertsListAlerts.core.d.ts.map +1 -1
  69. package/dist/commonjs/react-query/alertsListAlerts.core.js +2 -0
  70. package/dist/commonjs/react-query/alertsListAlerts.core.js.map +1 -1
  71. package/dist/commonjs/react-query/alertsListAlerts.d.ts +2 -0
  72. package/dist/commonjs/react-query/alertsListAlerts.d.ts.map +1 -1
  73. package/dist/commonjs/react-query/alertsListAlerts.js.map +1 -1
  74. package/dist/commonjs/react-query/invoicesListInvoices.d.ts +4 -0
  75. package/dist/commonjs/react-query/invoicesListInvoices.d.ts.map +1 -1
  76. package/dist/commonjs/react-query/invoicesListInvoices.js +4 -0
  77. package/dist/commonjs/react-query/invoicesListInvoices.js.map +1 -1
  78. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.core.d.ts +3 -1
  79. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.core.d.ts.map +1 -1
  80. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.core.js +5 -2
  81. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.core.js.map +1 -1
  82. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.d.ts +12 -2
  83. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -1
  84. package/dist/commonjs/react-query/vendorsGetVendorInvoiceReceipt.js.map +1 -1
  85. package/dist/commonjs/sdk/invoices.d.ts +1 -0
  86. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  87. package/dist/commonjs/sdk/invoices.js +1 -0
  88. package/dist/commonjs/sdk/invoices.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 +5 -6
  92. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  93. package/dist/esm/__tests__/zoneDevicesCreate.test.js +2 -0
  94. package/dist/esm/__tests__/zoneDevicesCreate.test.js.map +1 -1
  95. package/dist/esm/__tests__/zoneDevicesList.test.js +9 -1
  96. package/dist/esm/__tests__/zoneDevicesList.test.js.map +1 -1
  97. package/dist/esm/__tests__/zones.test.js +10 -10
  98. package/dist/esm/__tests__/zones.test.js.map +1 -1
  99. package/dist/esm/admin-funcs/doAdmin.d.ts +4 -3
  100. package/dist/esm/admin-funcs/doAdmin.d.ts.map +1 -1
  101. package/dist/esm/admin-funcs/doAdmin.js +11 -8
  102. package/dist/esm/admin-funcs/doAdmin.js.map +1 -1
  103. package/dist/esm/admin-funcs/networksCreate.d.ts +3 -0
  104. package/dist/esm/admin-funcs/networksCreate.d.ts.map +1 -1
  105. package/dist/esm/admin-funcs/networksCreate.js +9 -3
  106. package/dist/esm/admin-funcs/networksCreate.js.map +1 -1
  107. package/dist/esm/admin-funcs/networksEmailGatewayUpdates.d.ts +3 -0
  108. package/dist/esm/admin-funcs/networksEmailGatewayUpdates.d.ts.map +1 -0
  109. package/dist/esm/admin-funcs/networksEmailGatewayUpdates.js +6 -0
  110. package/dist/esm/admin-funcs/networksEmailGatewayUpdates.js.map +1 -0
  111. package/dist/esm/admin-funcs/networksUpdate.d.ts +10 -0
  112. package/dist/esm/admin-funcs/networksUpdate.d.ts.map +1 -0
  113. package/dist/esm/admin-funcs/networksUpdate.js +11 -0
  114. package/dist/esm/admin-funcs/networksUpdate.js.map +1 -0
  115. package/dist/esm/funcs/alertsListAlerts.js +1 -0
  116. package/dist/esm/funcs/alertsListAlerts.js.map +1 -1
  117. package/dist/esm/funcs/invoicesListInvoices.d.ts +1 -0
  118. package/dist/esm/funcs/invoicesListInvoices.d.ts.map +1 -1
  119. package/dist/esm/funcs/invoicesListInvoices.js +1 -0
  120. package/dist/esm/funcs/invoicesListInvoices.js.map +1 -1
  121. package/dist/esm/funcs/vendorsGetVendorInvoiceReceipt.js +5 -1
  122. package/dist/esm/funcs/vendorsGetVendorInvoiceReceipt.js.map +1 -1
  123. package/dist/esm/index.extras.d.ts +4 -0
  124. package/dist/esm/index.extras.d.ts.map +1 -1
  125. package/dist/esm/index.extras.js +5 -1
  126. package/dist/esm/index.extras.js.map +1 -1
  127. package/dist/esm/lib/config.d.ts +2 -2
  128. package/dist/esm/lib/config.js +2 -2
  129. package/dist/esm/models/components/alert.d.ts +36 -2
  130. package/dist/esm/models/components/alert.d.ts.map +1 -1
  131. package/dist/esm/models/components/alert.js +19 -0
  132. package/dist/esm/models/components/alert.js.map +1 -1
  133. package/dist/esm/models/components/invoice.d.ts +5 -0
  134. package/dist/esm/models/components/invoice.d.ts.map +1 -1
  135. package/dist/esm/models/components/invoice.js +4 -0
  136. package/dist/esm/models/components/invoice.js.map +1 -1
  137. package/dist/esm/models/components/invoicefinancialstatus.d.ts +1 -0
  138. package/dist/esm/models/components/invoicefinancialstatus.d.ts.map +1 -1
  139. package/dist/esm/models/components/invoicefinancialstatus.js +1 -0
  140. package/dist/esm/models/components/invoicefinancialstatus.js.map +1 -1
  141. package/dist/esm/models/operations/getvendorinvoicereceipt.d.ts +19 -0
  142. package/dist/esm/models/operations/getvendorinvoicereceipt.d.ts.map +1 -1
  143. package/dist/esm/models/operations/getvendorinvoicereceipt.js +15 -0
  144. package/dist/esm/models/operations/getvendorinvoicereceipt.js.map +1 -1
  145. package/dist/esm/models/operations/invoicesexport.d.ts +4 -3
  146. package/dist/esm/models/operations/invoicesexport.d.ts.map +1 -1
  147. package/dist/esm/models/operations/invoicesexport.js +2 -1
  148. package/dist/esm/models/operations/invoicesexport.js.map +1 -1
  149. package/dist/esm/models/operations/listalerts.d.ts +5 -0
  150. package/dist/esm/models/operations/listalerts.d.ts.map +1 -1
  151. package/dist/esm/models/operations/listalerts.js +2 -0
  152. package/dist/esm/models/operations/listalerts.js.map +1 -1
  153. package/dist/esm/models/operations/listinvoices.d.ts +1 -1
  154. package/dist/esm/models/operations/listvendorinvoices.d.ts +1 -1
  155. package/dist/esm/react-query/alertsListAlerts.core.d.ts +2 -0
  156. package/dist/esm/react-query/alertsListAlerts.core.d.ts.map +1 -1
  157. package/dist/esm/react-query/alertsListAlerts.core.js +2 -0
  158. package/dist/esm/react-query/alertsListAlerts.core.js.map +1 -1
  159. package/dist/esm/react-query/alertsListAlerts.d.ts +2 -0
  160. package/dist/esm/react-query/alertsListAlerts.d.ts.map +1 -1
  161. package/dist/esm/react-query/alertsListAlerts.js.map +1 -1
  162. package/dist/esm/react-query/invoicesListInvoices.d.ts +4 -0
  163. package/dist/esm/react-query/invoicesListInvoices.d.ts.map +1 -1
  164. package/dist/esm/react-query/invoicesListInvoices.js +4 -0
  165. package/dist/esm/react-query/invoicesListInvoices.js.map +1 -1
  166. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.core.d.ts +3 -1
  167. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.core.d.ts.map +1 -1
  168. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.core.js +5 -2
  169. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.core.js.map +1 -1
  170. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.d.ts +12 -2
  171. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.d.ts.map +1 -1
  172. package/dist/esm/react-query/vendorsGetVendorInvoiceReceipt.js.map +1 -1
  173. package/dist/esm/sdk/invoices.d.ts +1 -0
  174. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  175. package/dist/esm/sdk/invoices.js +1 -0
  176. package/dist/esm/sdk/invoices.js.map +1 -1
  177. package/jsr.json +1 -1
  178. package/package.json +1 -1
  179. package/src/__tests__/vendors.test.ts +1 -1
  180. package/src/__tests__/webhooks.test.ts +5 -6
  181. package/src/__tests__/zoneDevicesCreate.test.ts +2 -0
  182. package/src/__tests__/zoneDevicesList.test.ts +9 -1
  183. package/src/__tests__/zones.test.ts +10 -10
  184. package/src/admin-funcs/doAdmin.ts +22 -12
  185. package/src/admin-funcs/networksCreate.ts +13 -3
  186. package/src/admin-funcs/networksEmailGatewayUpdates.ts +6 -0
  187. package/src/admin-funcs/networksUpdate.ts +28 -0
  188. package/src/funcs/alertsListAlerts.ts +1 -0
  189. package/src/funcs/invoicesListInvoices.ts +1 -0
  190. package/src/funcs/vendorsGetVendorInvoiceReceipt.ts +6 -1
  191. package/src/index.extras.ts +5 -1
  192. package/src/lib/config.ts +2 -2
  193. package/src/models/components/alert.ts +51 -2
  194. package/src/models/components/invoice.ts +9 -0
  195. package/src/models/components/invoicefinancialstatus.ts +1 -0
  196. package/src/models/operations/getvendorinvoicereceipt.ts +27 -0
  197. package/src/models/operations/invoicesexport.ts +4 -3
  198. package/src/models/operations/listalerts.ts +7 -0
  199. package/src/models/operations/listinvoices.ts +1 -1
  200. package/src/models/operations/listvendorinvoices.ts +1 -1
  201. package/src/react-query/alertsListAlerts.core.ts +4 -0
  202. package/src/react-query/alertsListAlerts.ts +2 -0
  203. package/src/react-query/invoicesListInvoices.ts +4 -0
  204. package/src/react-query/vendorsGetVendorInvoiceReceipt.core.ts +8 -2
  205. package/src/react-query/vendorsGetVendorInvoiceReceipt.ts +7 -2
  206. package/src/sdk/invoices.ts +1 -0
@@ -11,8 +11,10 @@ vi.mock("../admin-funcs/doAdmin.js", () => ({
11
11
  }));
12
12
 
13
13
  import { networksCreate } from "../admin-funcs/networksCreate.js";
14
+ import { networksEmailGatewayUpdates } from "../admin-funcs/networksEmailGatewayUpdates.js";
14
15
  import { networksGet } from "../admin-funcs/networksGet.js";
15
16
  import { networksList } from "../admin-funcs/networksList.js";
17
+ import { networksUpdate } from "../admin-funcs/networksUpdate.js";
16
18
  import { zoneDevicesGet } from "../admin-funcs/zoneDevicesGet.js";
17
19
  import { zoneDevicesList } from "../admin-funcs/zoneDevicesList.js";
18
20
  import { __internal } from "../index.extras.js";
@@ -46,6 +48,12 @@ describe("zoneDevicesList", () => {
46
48
  provisioning: expect.any(Function),
47
49
  delete: expect.any(Function),
48
50
  });
49
- expect(__internal.networks).toEqual({ list: networksList, get: networksGet, create: networksCreate });
51
+ expect(__internal.networks).toEqual({
52
+ list: networksList,
53
+ get: networksGet,
54
+ create: networksCreate,
55
+ update: networksUpdate,
56
+ emailGatewayUpdates: networksEmailGatewayUpdates,
57
+ });
50
58
  });
51
59
  });
@@ -39,30 +39,30 @@ test("Zones List Or Search Security Zones", async () => {
39
39
  facility: {
40
40
  contacts: {
41
41
  contact: {
42
- status: "Active",
43
- department: null,
42
+ status: "Deleted",
43
+ department: 123,
44
44
  },
45
45
  adminContact: {
46
46
  status: "Deleted",
47
- department: null,
47
+ department: 123,
48
48
  },
49
49
  techContact: {
50
- status: "Inactive",
50
+ status: "Deleted",
51
51
  department: 123,
52
52
  },
53
53
  greenSecurityCsm: {
54
- status: "Inactive",
55
- department: 123,
54
+ status: "Active",
55
+ department: null,
56
56
  },
57
57
  accountManager: {
58
- status: "Active",
58
+ status: "Deleted",
59
59
  department: 123,
60
60
  },
61
61
  },
62
62
  vendorGuestPolicy: {
63
- enabled: false,
63
+ enabled: true,
64
64
  vendorGuestLimitAndOr: "and",
65
- vendorGuestRequireEmail: false,
65
+ vendorGuestRequireEmail: true,
66
66
  },
67
67
  },
68
68
  },
@@ -86,7 +86,7 @@ test("Zones Security Zone Checkin", async () => {
86
86
 
87
87
  const result = await greenSecurity.zones.securityZoneCheckin({
88
88
  qrCode: "<value>",
89
- zoneId: 130889,
89
+ zoneId: 554451,
90
90
  });
91
91
  expect(result).toBeDefined();
92
92
  expect(result).toEqual({});
@@ -201,7 +201,7 @@ export async function $doGetSingle<T extends object>(
201
201
  return [result, { status: "complete", request: req, response }];
202
202
  }
203
203
 
204
- type PostResult = Promise<
204
+ type BodyResult = Promise<
205
205
  [
206
206
  Result<
207
207
  Json,
@@ -219,15 +219,16 @@ type PostResult = Promise<
219
219
  ]
220
220
  >;
221
221
 
222
- // Shared by the JSON and multipart posts below: everything except how the body is built and
223
- // whether we name a Content-Type. A multipart body must NOT carry one, because only fetch can
224
- // append the boundary it generates.
225
- async function $doPostBody(
222
+ // Shared by the JSON and multipart requests below: everything except the method, how the body
223
+ // is built and whether we name a Content-Type. A multipart body must NOT carry one, because only
224
+ // fetch can append the boundary it generates.
225
+ async function $doBodyRequest(
226
+ method: "POST" | "PUT",
226
227
  route: string,
227
228
  body: BodyInit | undefined,
228
229
  contentTypeHeader: Record<string, string>,
229
230
  options?: RequestOptions,
230
- ): PostResult {
231
+ ): BodyResult {
231
232
  const client = getInternalCore();
232
233
  if (!client) {
233
234
  throw new Error("GreenSecurityCore client is not initialized.");
@@ -263,7 +264,7 @@ async function $doPostBody(
263
264
 
264
265
  const requestRes = client._createRequest(context, {
265
266
  security: requestSecurity,
266
- method: "POST",
267
+ method,
267
268
  baseURL: options?.serverURL,
268
269
  path: path,
269
270
  headers: headers,
@@ -322,8 +323,9 @@ export async function $doPost<T extends object>(
322
323
  route: string,
323
324
  postData: T,
324
325
  options?: RequestOptions,
325
- ): PostResult {
326
- return $doPostBody(
326
+ ): BodyResult {
327
+ return $doBodyRequest(
328
+ "POST",
327
329
  route,
328
330
  encodeJSON("body", postData, { explode: true }),
329
331
  { "Content-Type": "application/json" },
@@ -337,8 +339,16 @@ export async function $doPostForm(
337
339
  route: string,
338
340
  form: FormData,
339
341
  options?: RequestOptions,
340
- ): PostResult {
341
- return $doPostBody(route, form, {}, options);
342
+ ): BodyResult {
343
+ return $doBodyRequest("POST", route, form, {}, options);
344
+ }
345
+
346
+ export async function $doPutForm(
347
+ route: string,
348
+ form: FormData,
349
+ options?: RequestOptions,
350
+ ): BodyResult {
351
+ return $doBodyRequest("PUT", route, form, {}, options);
342
352
  }
343
353
 
344
354
  export function $doPut<T extends object>(
@@ -454,7 +464,7 @@ async function $doJsonRequest(
454
464
  | ConnectionError
455
465
  >(
456
466
  M.json(200, jsonSchema),
457
- M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
467
+ M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
458
468
  M.fail("4XX"),
459
469
  M.fail("5XX"),
460
470
  )(response, req, { extraFields: responseFields });
@@ -68,9 +68,19 @@ export function networksCreate(
68
68
  return new APIPromise($doPost("/networks", request));
69
69
  }
70
70
 
71
+ return new APIPromise($doPostForm("/networks", networkForm(request, certificate)));
72
+ }
73
+
74
+ // The multipart body for a network create or update; only the fields present are sent.
75
+ export function networkForm(
76
+ request: { [K in keyof networksCreateRequest]?: networksCreateRequest[K] | undefined },
77
+ certificate: networksCreateCertificate,
78
+ ): FormData {
71
79
  const form = new FormData();
72
- appendField(form, "name", request.name);
73
- request.facility_ids.forEach((id) => form.append("facility_ids[]", String(id)));
80
+ if (request.name !== undefined) {
81
+ appendField(form, "name", request.name);
82
+ }
83
+ request.facility_ids?.forEach((id) => form.append("facility_ids[]", String(id)));
74
84
  if (request.setup_complete !== undefined) {
75
85
  appendField(form, "setup_complete", request.setup_complete);
76
86
  }
@@ -79,7 +89,7 @@ export function networksCreate(
79
89
  // RN's FormData accepts {uri,name,type} where the DOM expects a Blob, hence the cast.
80
90
  form.append("certificate", certificate as unknown as Blob);
81
91
 
82
- return new APIPromise($doPostForm("/networks", form));
92
+ return form;
83
93
  }
84
94
 
85
95
  function appendField(form: FormData, key: string, value: string | number | boolean): void {
@@ -0,0 +1,6 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doPost, internalApiResult } from "./doAdmin.js";
3
+
4
+ export function networksEmailGatewayUpdates(networkId: number): internalApiResult {
5
+ return new APIPromise($doPost(`/networks/${networkId}/gateway-update-email`, {}));
6
+ }
@@ -0,0 +1,28 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doPut, $doPutForm, internalApiResult } from "./doAdmin.js";
3
+ import {
4
+ networkEthernetSettings,
5
+ networkForm,
6
+ networksCreateCertificate,
7
+ networkWifiSettings,
8
+ } from "./networksCreate.js";
9
+
10
+ export type networksUpdateRequest = {
11
+ name?: string;
12
+ facility_ids?: number[];
13
+ ethernet: networkEthernetSettings | undefined;
14
+ wifi: networkWifiSettings | undefined;
15
+ };
16
+
17
+ export function networksUpdate(
18
+ networkId: number,
19
+ request: networksUpdateRequest,
20
+ certificate?: networksCreateCertificate,
21
+ ): internalApiResult {
22
+ const route = `/networks/${networkId}`;
23
+ if (!certificate) {
24
+ return new APIPromise($doPut(route, request));
25
+ }
26
+
27
+ return new APIPromise($doPutForm(route, networkForm(request, certificate)));
28
+ }
@@ -114,6 +114,7 @@ async function $do(
114
114
  encodeFormQuery({
115
115
  "alert_type": payload.alert_type,
116
116
  "desc": payload.desc,
117
+ "include_dismissed_reminders": payload.include_dismissed_reminders,
117
118
  "items_per_page": payload.items_per_page,
118
119
  "page": payload.page,
119
120
  "sort": payload.sort,
@@ -62,6 +62,7 @@ import {
62
62
  * - invoice_number
63
63
  * - date (processed date)
64
64
  * - date_paid
65
+ * - date_created
65
66
  * - financial_status
66
67
  * - amount
67
68
  *
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { GreenSecurityCore } from "../core.js";
6
- import { encodeSimple } from "../lib/encodings.js";
6
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
7
7
  import { matchStatusCode } from "../lib/http.js";
8
8
  import * as M from "../lib/matchers.js";
9
9
  import { compactMap } from "../lib/primitives.js";
@@ -102,6 +102,10 @@ async function $do(
102
102
  };
103
103
  const path = pathToFunc("/vendors/invoices/{id}/receipt")(pathParams);
104
104
 
105
+ const query = encodeFormQuery({
106
+ "pdf_type": payload.pdf_type,
107
+ });
108
+
105
109
  const headers = new Headers(compactMap({
106
110
  Accept: "application/json",
107
111
  }));
@@ -130,6 +134,7 @@ async function $do(
130
134
  baseURL: options?.serverURL,
131
135
  path: path,
132
136
  headers: headers,
137
+ query: query,
133
138
  body: body,
134
139
  userAgent: client._options.userAgent,
135
140
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
@@ -71,6 +71,8 @@ import { appsApproveDevice } from "./admin-funcs/appsApproveDevice.js";
71
71
  import { networksList } from "./admin-funcs/networksList.js";
72
72
  import { networksGet } from "./admin-funcs/networksGet.js";
73
73
  import { networksCreate } from "./admin-funcs/networksCreate.js";
74
+ import { networksUpdate } from "./admin-funcs/networksUpdate.js";
75
+ import { networksEmailGatewayUpdates } from "./admin-funcs/networksEmailGatewayUpdates.js";
74
76
  import { zoneDevicesList } from "./admin-funcs/zoneDevicesList.js";
75
77
  import { zoneDevicesGet } from "./admin-funcs/zoneDevicesGet.js";
76
78
  import { zoneDevicesCreate } from "./admin-funcs/zoneDevicesCreate.js";
@@ -205,7 +207,9 @@ export const __internal = {
205
207
  networks: {
206
208
  list: networksList,
207
209
  get: networksGet,
208
- create: networksCreate
210
+ create: networksCreate,
211
+ update: networksUpdate,
212
+ emailGatewayUpdates: networksEmailGatewayUpdates
209
213
  },
210
214
 
211
215
  zoneDevices: {
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.48.0-beta.2",
83
+ sdkVersion: "0.48.0-beta.4",
84
84
  genVersion: "2.950.2",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.48.0-beta.2 2.950.2 0.47.0 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.48.0-beta.4 2.950.2 0.47.0 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -39,7 +39,20 @@ export const FollowUpType = {
39
39
  export type FollowUpType = OpenEnum<typeof FollowUpType>;
40
40
 
41
41
  /**
42
- * Context data for the alert. Smart badge follow-ups carry the check-in fields, and credential paid alerts carry `vendor_credential_id`.
42
+ * Which checkout reminder this is. `null` if not applicable.
43
+ */
44
+ export const ReminderStage = {
45
+ ThirtyMinutes: "thirty_minutes",
46
+ FiveMinutes: "five_minutes",
47
+ Ended: "ended",
48
+ } as const;
49
+ /**
50
+ * Which checkout reminder this is. `null` if not applicable.
51
+ */
52
+ export type ReminderStage = OpenEnum<typeof ReminderStage>;
53
+
54
+ /**
55
+ * Context data for the alert. Smart badge follow-ups carry the check-in fields, credential paid alerts carry `vendor_credential_id`, and visit checkout reminders carry the visit and reminder fields.
43
56
  */
44
57
  export type AlertContext = {
45
58
  /**
@@ -74,6 +87,26 @@ export type AlertContext = {
74
87
  * The ID of the vendor credential the alert relates to. `null` if not applicable.
75
88
  */
76
89
  vendorCredentialId?: number | null | undefined;
90
+ /**
91
+ * The name of the facility a visit checkout reminder is for. `null` if not applicable.
92
+ */
93
+ facilityName?: string | null | undefined;
94
+ /**
95
+ * The visit's scheduled checkout time when a checkout reminder was sent, in UTC. `null` if not applicable.
96
+ */
97
+ scheduledCheckoutTime?: string | null | undefined;
98
+ /**
99
+ * Which checkout reminder this is. `null` if not applicable.
100
+ */
101
+ reminderStage?: ReminderStage | null | undefined;
102
+ /**
103
+ * The extensions, in minutes, the vendor could still take when a checkout reminder was sent. `null` if not applicable.
104
+ */
105
+ extensionOptionsMinutes?: Array<number> | null | undefined;
106
+ /**
107
+ * Whether a checkout reminder was dismissed because the vendor checked out, extended, or got a later reminder. `null` if not applicable.
108
+ */
109
+ dismissed?: boolean | null | undefined;
77
110
  };
78
111
 
79
112
  /**
@@ -117,7 +150,7 @@ export type Alert = {
117
150
  */
118
151
  plainText?: string | null | undefined;
119
152
  /**
120
- * Context data for the alert. Smart badge follow-ups carry the check-in fields, and credential paid alerts carry `vendor_credential_id`.
153
+ * Context data for the alert. Smart badge follow-ups carry the check-in fields, credential paid alerts carry `vendor_credential_id`, and visit checkout reminders carry the visit and reminder fields.
121
154
  */
122
155
  alertContext?: AlertContext | null | undefined;
123
156
  /**
@@ -141,6 +174,13 @@ export const FollowUpType$inboundSchema: z.ZodType<
141
174
  unknown
142
175
  > = openEnums.inboundSchema(FollowUpType);
143
176
 
177
+ /** @internal */
178
+ export const ReminderStage$inboundSchema: z.ZodType<
179
+ ReminderStage,
180
+ z.ZodTypeDef,
181
+ unknown
182
+ > = openEnums.inboundSchema(ReminderStage);
183
+
144
184
  /** @internal */
145
185
  export const AlertContext$inboundSchema: z.ZodType<
146
186
  AlertContext,
@@ -155,6 +195,11 @@ export const AlertContext$inboundSchema: z.ZodType<
155
195
  recheck_vendor_scan_id: z.nullable(types.number()).optional(),
156
196
  follow_up_type: z.nullable(FollowUpType$inboundSchema).optional(),
157
197
  vendor_credential_id: z.nullable(types.number()).optional(),
198
+ facility_name: z.nullable(types.string()).optional(),
199
+ scheduled_checkout_time: z.nullable(types.string()).optional(),
200
+ reminder_stage: z.nullable(ReminderStage$inboundSchema).optional(),
201
+ extension_options_minutes: z.nullable(z.array(types.number())).optional(),
202
+ dismissed: z.nullable(types.boolean()).optional(),
158
203
  }).transform((v) => {
159
204
  return remap$(v, {
160
205
  "facility_id": "facilityId",
@@ -165,6 +210,10 @@ export const AlertContext$inboundSchema: z.ZodType<
165
210
  "recheck_vendor_scan_id": "recheckVendorScanId",
166
211
  "follow_up_type": "followUpType",
167
212
  "vendor_credential_id": "vendorCredentialId",
213
+ "facility_name": "facilityName",
214
+ "scheduled_checkout_time": "scheduledCheckoutTime",
215
+ "reminder_stage": "reminderStage",
216
+ "extension_options_minutes": "extensionOptionsMinutes",
168
217
  });
169
218
  });
170
219
 
@@ -137,6 +137,10 @@ export type Invoice = {
137
137
  * Date of the invoice payment. Backfilled automatically by a daily background job for every paid invoice, from the last successful payment transaction or, failing that, the invoice's line item start date or creation date. Unlike `date_processed`, this is reliably populated for real (non-test) payments—allow up to 24 hours for it to appear after payment.
138
138
  */
139
139
  datePaid?: string | null | undefined;
140
+ /**
141
+ * When the invoice was created.
142
+ */
143
+ dateCreated?: string | null | undefined;
140
144
  /**
141
145
  * The date the invoice payment is due. `null` if no due date is set.
142
146
  */
@@ -388,6 +392,7 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
388
392
  tracking_number: z.nullable(types.string()).optional(),
389
393
  date_processed: z.nullable(types.string()).optional(),
390
394
  date_paid: z.nullable(types.string()).optional(),
395
+ date_created: z.nullable(types.string()).optional(),
391
396
  date_due: z.nullable(types.string()).optional(),
392
397
  amount: z.nullable(types.number()).optional(),
393
398
  status: z.nullable(types.string()).optional(),
@@ -415,6 +420,7 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
415
420
  "tracking_number": "trackingNumber",
416
421
  "date_processed": "dateProcessed",
417
422
  "date_paid": "datePaid",
423
+ "date_created": "dateCreated",
418
424
  "date_due": "dateDue",
419
425
  "financial_status": "financialStatus",
420
426
  "amount_not_paid": "amountNotPaid",
@@ -432,6 +438,7 @@ export type Invoice$Outbound = {
432
438
  tracking_number?: string | null | undefined;
433
439
  date_processed?: string | null | undefined;
434
440
  date_paid?: string | null | undefined;
441
+ date_created?: string | null | undefined;
435
442
  date_due?: string | null | undefined;
436
443
  amount?: number | null | undefined;
437
444
  status?: string | null | undefined;
@@ -463,6 +470,7 @@ export const Invoice$outboundSchema: z.ZodType<
463
470
  trackingNumber: z.nullable(z.string()).optional(),
464
471
  dateProcessed: z.nullable(z.string()).optional(),
465
472
  datePaid: z.nullable(z.string()).optional(),
473
+ dateCreated: z.nullable(z.string()).optional(),
466
474
  dateDue: z.nullable(z.string()).optional(),
467
475
  amount: z.nullable(z.number().int()).optional(),
468
476
  status: z.nullable(z.string()).optional(),
@@ -489,6 +497,7 @@ export const Invoice$outboundSchema: z.ZodType<
489
497
  trackingNumber: "tracking_number",
490
498
  dateProcessed: "date_processed",
491
499
  datePaid: "date_paid",
500
+ dateCreated: "date_created",
492
501
  dateDue: "date_due",
493
502
  financialStatus: "financial_status",
494
503
  amountNotPaid: "amount_not_paid",
@@ -8,6 +8,7 @@ import { ClosedEnum } from "../../types/enums.js";
8
8
  export const InvoiceFinancialStatus = {
9
9
  Paid: "paid",
10
10
  Unpaid: "unpaid",
11
+ AwaitingPayment: "awaiting_payment",
11
12
  } as const;
12
13
  export type InvoiceFinancialStatus = ClosedEnum<typeof InvoiceFinancialStatus>;
13
14
 
@@ -5,15 +5,32 @@
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
8
9
  import { Result as SafeParseResult } from "../../types/fp.js";
9
10
  import * as types from "../../types/primitives.js";
10
11
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
12
 
13
+ /**
14
+ * `receipt` (default) includes the payment transactions. `invoice` leaves them out and adds the created and due dates.
15
+ */
16
+ export const PdfType = {
17
+ Receipt: "receipt",
18
+ Invoice: "invoice",
19
+ } as const;
20
+ /**
21
+ * `receipt` (default) includes the payment transactions. `invoice` leaves them out and adds the created and due dates.
22
+ */
23
+ export type PdfType = ClosedEnum<typeof PdfType>;
24
+
12
25
  export type GetVendorInvoiceReceiptRequest = {
13
26
  /**
14
27
  * The identifier of the object.
15
28
  */
16
29
  id: number;
30
+ /**
31
+ * `receipt` (default) includes the payment transactions. `invoice` leaves them out and adds the created and due dates.
32
+ */
33
+ pdfType?: PdfType | undefined;
17
34
  };
18
35
 
19
36
  /**
@@ -34,9 +51,14 @@ export type GetVendorInvoiceReceiptGetVendorInvoiceReceiptOk = {
34
51
  contentType?: string | undefined;
35
52
  };
36
53
 
54
+ /** @internal */
55
+ export const PdfType$outboundSchema: z.ZodNativeEnum<typeof PdfType> = z
56
+ .nativeEnum(PdfType);
57
+
37
58
  /** @internal */
38
59
  export type GetVendorInvoiceReceiptRequest$Outbound = {
39
60
  id: number;
61
+ pdf_type?: string | undefined;
40
62
  };
41
63
 
42
64
  /** @internal */
@@ -46,6 +68,11 @@ export const GetVendorInvoiceReceiptRequest$outboundSchema: z.ZodType<
46
68
  GetVendorInvoiceReceiptRequest
47
69
  > = z.object({
48
70
  id: z.number().int(),
71
+ pdfType: PdfType$outboundSchema.optional(),
72
+ }).transform((v) => {
73
+ return remap$(v, {
74
+ pdfType: "pdf_type",
75
+ });
49
76
  });
50
77
 
51
78
  export function getVendorInvoiceReceiptRequestToJSON(
@@ -8,14 +8,15 @@ import { ClosedEnum } from "../../types/enums.js";
8
8
  import * as components from "../components/index.js";
9
9
 
10
10
  /**
11
- * Filter by financial status (`paid` or `unpaid`).
11
+ * Filter by financial status (`paid`, `unpaid`, or `awaiting_payment` for pending and overdue).
12
12
  */
13
13
  export const InvoiceFinancialStatus = {
14
14
  Paid: "paid",
15
15
  Unpaid: "unpaid",
16
+ AwaitingPayment: "awaiting_payment",
16
17
  } as const;
17
18
  /**
18
- * Filter by financial status (`paid` or `unpaid`).
19
+ * Filter by financial status (`paid`, `unpaid`, or `awaiting_payment` for pending and overdue).
19
20
  */
20
21
  export type InvoiceFinancialStatus = ClosedEnum<typeof InvoiceFinancialStatus>;
21
22
 
@@ -25,7 +26,7 @@ export type InvoicesExportRequest = {
25
26
  */
26
27
  invoiceNumber?: string | undefined;
27
28
  /**
28
- * Filter by financial status (`paid` or `unpaid`).
29
+ * Filter by financial status (`paid`, `unpaid`, or `awaiting_payment` for pending and overdue).
29
30
  */
30
31
  invoiceFinancialStatus?: InvoiceFinancialStatus | undefined;
31
32
  /**
@@ -47,6 +47,10 @@ export type ListAlertsRequest = {
47
47
  * Filter alerts by client type. Use `all` to return every alert, or `mobile` to exclude web-only alerts.
48
48
  */
49
49
  alertType?: AlertType | undefined;
50
+ /**
51
+ * Also return visit checkout reminders that were dismissed because the vendor checked out, extended, or got a later reminder. Their `alert_context.dismissed` is `true`.
52
+ */
53
+ includeDismissedReminders?: boolean | undefined;
50
54
  };
51
55
 
52
56
  /**
@@ -76,6 +80,7 @@ export type ListAlertsRequest$Outbound = {
76
80
  items_per_page?: number | undefined;
77
81
  user_id_or_me?: string | undefined;
78
82
  alert_type?: string | undefined;
83
+ include_dismissed_reminders?: boolean | undefined;
79
84
  };
80
85
 
81
86
  /** @internal */
@@ -90,11 +95,13 @@ export const ListAlertsRequest$outboundSchema: z.ZodType<
90
95
  itemsPerPage: z.number().int().optional(),
91
96
  userIdOrMe: z.string().optional(),
92
97
  alertType: AlertType$outboundSchema.optional(),
98
+ includeDismissedReminders: z.boolean().optional(),
93
99
  }).transform((v) => {
94
100
  return remap$(v, {
95
101
  itemsPerPage: "items_per_page",
96
102
  userIdOrMe: "user_id_or_me",
97
103
  alertType: "alert_type",
104
+ includeDismissedReminders: "include_dismissed_reminders",
98
105
  });
99
106
  });
100
107
 
@@ -36,7 +36,7 @@ export type ListInvoicesRequest = {
36
36
  */
37
37
  invoiceNumber?: string | undefined;
38
38
  /**
39
- * Filter invoices by financial status.
39
+ * Filter invoices by financial status. `awaiting_payment` matches pending and overdue invoices.
40
40
  */
41
41
  invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
42
42
  /**
@@ -46,7 +46,7 @@ export type ListVendorInvoicesRequest = {
46
46
  */
47
47
  invoiceNumber?: string | undefined;
48
48
  /**
49
- * Filter invoices by financial status.
49
+ * Filter invoices by financial status. `awaiting_payment` matches pending and overdue invoices.
50
50
  */
51
51
  invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
52
52
  };
@@ -79,6 +79,7 @@ export function buildAlertsListAlertsQuery(
79
79
  itemsPerPage: request.itemsPerPage,
80
80
  userIdOrMe: request.userIdOrMe,
81
81
  alertType: request.alertType,
82
+ includeDismissedReminders: request.includeDismissedReminders,
82
83
  }),
83
84
  queryFn: async function alertsListAlertsQueryFn(
84
85
  ctx,
@@ -121,6 +122,7 @@ export function buildAlertsListAlertsInfiniteQuery(
121
122
  itemsPerPage: request.itemsPerPage,
122
123
  userIdOrMe: request.userIdOrMe,
123
124
  alertType: request.alertType,
125
+ includeDismissedReminders: request.includeDismissedReminders,
124
126
  }),
125
127
  queryFn: async function alertsListAlertsQuery(
126
128
  ctx,
@@ -160,6 +162,7 @@ export function queryKeyAlertsListAlerts(
160
162
  itemsPerPage?: number | undefined;
161
163
  userIdOrMe?: string | undefined;
162
164
  alertType?: operations.AlertType | undefined;
165
+ includeDismissedReminders?: boolean | undefined;
163
166
  },
164
167
  ): QueryKey {
165
168
  return ["@greensecurity/javascript-sdk", "alerts", "listAlerts", parameters];
@@ -173,6 +176,7 @@ export function queryKeyAlertsListAlertsInfinite(
173
176
  itemsPerPage?: number | undefined;
174
177
  userIdOrMe?: string | undefined;
175
178
  alertType?: operations.AlertType | undefined;
179
+ includeDismissedReminders?: boolean | undefined;
176
180
  },
177
181
  ): QueryKey {
178
182
  return [
@@ -210,6 +210,7 @@ export function setAlertsListAlertsData(
210
210
  itemsPerPage?: number | undefined;
211
211
  userIdOrMe?: string | undefined;
212
212
  alertType?: operations.AlertType | undefined;
213
+ includeDismissedReminders?: boolean | undefined;
213
214
  },
214
215
  ],
215
216
  data: AlertsListAlertsQueryData,
@@ -229,6 +230,7 @@ export function invalidateAlertsListAlerts(
229
230
  itemsPerPage?: number | undefined;
230
231
  userIdOrMe?: string | undefined;
231
232
  alertType?: operations.AlertType | undefined;
233
+ includeDismissedReminders?: boolean | undefined;
232
234
  }]
233
235
  >,
234
236
  filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,