@greensecurity/javascript-sdk 0.35.23 → 0.35.33

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 (98) hide show
  1. package/README.md +3 -0
  2. package/bin/mcp-server.js +869 -378
  3. package/bin/mcp-server.js.map +10 -7
  4. package/dist/commonjs/__tests__/invoices.test.js +18 -0
  5. package/dist/commonjs/__tests__/invoices.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 +7 -48
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/invoicesUpdateInvoice.d.ts +26 -0
  11. package/dist/commonjs/funcs/invoicesUpdateInvoice.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/invoicesUpdateInvoice.js +133 -0
  13. package/dist/commonjs/funcs/invoicesUpdateInvoice.js.map +1 -0
  14. package/dist/commonjs/lib/config.d.ts +2 -2
  15. package/dist/commonjs/lib/config.js +2 -2
  16. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  17. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  18. package/dist/commonjs/mcp-server/server.js +3 -1
  19. package/dist/commonjs/mcp-server/server.js.map +1 -1
  20. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.d.ts +8 -0
  21. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.d.ts.map +1 -0
  22. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.js +73 -0
  23. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.js.map +1 -0
  24. package/dist/commonjs/models/operations/index.d.ts +1 -0
  25. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  26. package/dist/commonjs/models/operations/index.js +1 -0
  27. package/dist/commonjs/models/operations/index.js.map +1 -1
  28. package/dist/commonjs/models/operations/updateinvoice.d.ts +441 -0
  29. package/dist/commonjs/models/operations/updateinvoice.d.ts.map +1 -0
  30. package/dist/commonjs/models/operations/updateinvoice.js +622 -0
  31. package/dist/commonjs/models/operations/updateinvoice.js.map +1 -0
  32. package/dist/commonjs/react-query/index.d.ts +1 -0
  33. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  34. package/dist/commonjs/react-query/index.js +1 -0
  35. package/dist/commonjs/react-query/index.js.map +1 -1
  36. package/dist/commonjs/react-query/invoicesUpdateInvoice.d.ts +32 -0
  37. package/dist/commonjs/react-query/invoicesUpdateInvoice.d.ts.map +1 -0
  38. package/dist/commonjs/react-query/invoicesUpdateInvoice.js +56 -0
  39. package/dist/commonjs/react-query/invoicesUpdateInvoice.js.map +1 -0
  40. package/dist/commonjs/sdk/invoices.d.ts +16 -0
  41. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  42. package/dist/commonjs/sdk/invoices.js +19 -0
  43. package/dist/commonjs/sdk/invoices.js.map +1 -1
  44. package/dist/esm/__tests__/invoices.test.js +18 -0
  45. package/dist/esm/__tests__/invoices.test.js.map +1 -1
  46. package/dist/esm/__tests__/webhooks.test.js +1 -1
  47. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  48. package/dist/esm/__tests__/zones.test.js +7 -48
  49. package/dist/esm/__tests__/zones.test.js.map +1 -1
  50. package/dist/esm/funcs/invoicesUpdateInvoice.d.ts +26 -0
  51. package/dist/esm/funcs/invoicesUpdateInvoice.d.ts.map +1 -0
  52. package/dist/esm/funcs/invoicesUpdateInvoice.js +97 -0
  53. package/dist/esm/funcs/invoicesUpdateInvoice.js.map +1 -0
  54. package/dist/esm/lib/config.d.ts +2 -2
  55. package/dist/esm/lib/config.js +2 -2
  56. package/dist/esm/mcp-server/mcp-server.js +1 -1
  57. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  58. package/dist/esm/mcp-server/server.js +3 -1
  59. package/dist/esm/mcp-server/server.js.map +1 -1
  60. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.d.ts +8 -0
  61. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.d.ts.map +1 -0
  62. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.js +37 -0
  63. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.js.map +1 -0
  64. package/dist/esm/models/operations/index.d.ts +1 -0
  65. package/dist/esm/models/operations/index.d.ts.map +1 -1
  66. package/dist/esm/models/operations/index.js +1 -0
  67. package/dist/esm/models/operations/index.js.map +1 -1
  68. package/dist/esm/models/operations/updateinvoice.d.ts +441 -0
  69. package/dist/esm/models/operations/updateinvoice.d.ts.map +1 -0
  70. package/dist/esm/models/operations/updateinvoice.js +566 -0
  71. package/dist/esm/models/operations/updateinvoice.js.map +1 -0
  72. package/dist/esm/react-query/index.d.ts +1 -0
  73. package/dist/esm/react-query/index.d.ts.map +1 -1
  74. package/dist/esm/react-query/index.js +1 -0
  75. package/dist/esm/react-query/index.js.map +1 -1
  76. package/dist/esm/react-query/invoicesUpdateInvoice.d.ts +32 -0
  77. package/dist/esm/react-query/invoicesUpdateInvoice.d.ts.map +1 -0
  78. package/dist/esm/react-query/invoicesUpdateInvoice.js +51 -0
  79. package/dist/esm/react-query/invoicesUpdateInvoice.js.map +1 -0
  80. package/dist/esm/sdk/invoices.d.ts +16 -0
  81. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  82. package/dist/esm/sdk/invoices.js +19 -0
  83. package/dist/esm/sdk/invoices.js.map +1 -1
  84. package/jsr.json +1 -1
  85. package/package.json +1 -1
  86. package/src/__tests__/invoices.test.ts +21 -0
  87. package/src/__tests__/webhooks.test.ts +1 -1
  88. package/src/__tests__/zones.test.ts +7 -48
  89. package/src/funcs/invoicesUpdateInvoice.ts +182 -0
  90. package/src/lib/config.ts +2 -2
  91. package/src/mcp-server/mcp-server.ts +1 -1
  92. package/src/mcp-server/server.ts +3 -1
  93. package/src/mcp-server/tools/invoicesUpdateInvoice.ts +46 -0
  94. package/src/models/operations/index.ts +1 -0
  95. package/src/models/operations/updateinvoice.ts +1002 -0
  96. package/src/react-query/index.ts +1 -0
  97. package/src/react-query/invoicesUpdateInvoice.ts +97 -0
  98. package/src/sdk/invoices.ts +27 -0
@@ -10,6 +10,7 @@ export * from "./dataRequestsAddDataRequestFile.js";
10
10
  export * from "./dataRequestsDeleteDataRequestFile.js";
11
11
  export * from "./dataRequestsUpdateDataRequest.js";
12
12
  export * from "./invoicesMakePayment.js";
13
+ export * from "./invoicesUpdateInvoice.js";
13
14
  export * from "./organizationsGetFacility.js";
14
15
  export * from "./organizationsListOrSearchFacilities.js";
15
16
  export * from "./supportArticlesGetSupportArticle.js";
@@ -0,0 +1,97 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ MutationKey,
7
+ useMutation,
8
+ UseMutationResult,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { invoicesUpdateInvoice } from "../funcs/invoicesUpdateInvoice.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
+ import { useGreenSecurityContext } from "./_context.js";
17
+ import { MutationHookOptions } from "./_types.js";
18
+
19
+ export type InvoicesUpdateInvoiceMutationVariables = {
20
+ request: operations.UpdateInvoiceRequest;
21
+ options?: RequestOptions;
22
+ };
23
+
24
+ export type InvoicesUpdateInvoiceMutationData = boolean;
25
+
26
+ /**
27
+ * Update invoice
28
+ *
29
+ * @remarks
30
+ * It will replace all the lines with the lines passed as parameter
31
+ * - Exactly one of vendor_id, company_id, facility_id, or system_id must be provided. - variant_id is required for the line - payment_handler_data must be set in the following format:
32
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
33
+ * with a key 'vendor_credential_id' and value as integer
34
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
35
+ * with the following keys and values:
36
+ * - old_vendor_type_id: required, must be nil or integer
37
+ * - new_vendor_type_id: required, must be integer
38
+ * - old_facility_ids: required, must be an array of integers (can be empty)
39
+ * - new_facility_ids: required, must be array of integers
40
+ */
41
+ export function useInvoicesUpdateInvoiceMutation(
42
+ options?: MutationHookOptions<
43
+ InvoicesUpdateInvoiceMutationData,
44
+ Error,
45
+ InvoicesUpdateInvoiceMutationVariables
46
+ >,
47
+ ): UseMutationResult<
48
+ InvoicesUpdateInvoiceMutationData,
49
+ Error,
50
+ InvoicesUpdateInvoiceMutationVariables
51
+ > {
52
+ const client = useGreenSecurityContext();
53
+ return useMutation({
54
+ ...buildInvoicesUpdateInvoiceMutation(client, options),
55
+ ...options,
56
+ });
57
+ }
58
+
59
+ export function mutationKeyInvoicesUpdateInvoice(): MutationKey {
60
+ return ["@greensecurity/javascript-sdk", "invoices", "updateInvoice"];
61
+ }
62
+
63
+ export function buildInvoicesUpdateInvoiceMutation(
64
+ client$: GreenSecurityCore,
65
+ hookOptions?: RequestOptions,
66
+ ): {
67
+ mutationKey: MutationKey;
68
+ mutationFn: (
69
+ variables: InvoicesUpdateInvoiceMutationVariables,
70
+ ) => Promise<InvoicesUpdateInvoiceMutationData>;
71
+ } {
72
+ return {
73
+ mutationKey: mutationKeyInvoicesUpdateInvoice(),
74
+ mutationFn: function invoicesUpdateInvoiceMutationFn({
75
+ request,
76
+ options,
77
+ }): Promise<InvoicesUpdateInvoiceMutationData> {
78
+ const mergedOptions = {
79
+ ...hookOptions,
80
+ ...options,
81
+ fetchOptions: {
82
+ ...hookOptions?.fetchOptions,
83
+ ...options?.fetchOptions,
84
+ signal: combineSignals(
85
+ hookOptions?.fetchOptions?.signal,
86
+ options?.fetchOptions?.signal,
87
+ ),
88
+ },
89
+ };
90
+ return unwrapAsync(invoicesUpdateInvoice(
91
+ client$,
92
+ request,
93
+ mergedOptions,
94
+ ));
95
+ },
96
+ };
97
+ }
@@ -3,11 +3,38 @@
3
3
  */
4
4
 
5
5
  import { invoicesMakePayment } from "../funcs/invoicesMakePayment.js";
6
+ import { invoicesUpdateInvoice } from "../funcs/invoicesUpdateInvoice.js";
6
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
8
  import * as operations from "../models/operations/index.js";
8
9
  import { unwrapAsync } from "../types/fp.js";
9
10
 
10
11
  export class Invoices extends ClientSDK {
12
+ /**
13
+ * Update invoice
14
+ *
15
+ * @remarks
16
+ * It will replace all the lines with the lines passed as parameter
17
+ * - Exactly one of vendor_id, company_id, facility_id, or system_id must be provided. - variant_id is required for the line - payment_handler_data must be set in the following format:
18
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
19
+ * with a key 'vendor_credential_id' and value as integer
20
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
21
+ * with the following keys and values:
22
+ * - old_vendor_type_id: required, must be nil or integer
23
+ * - new_vendor_type_id: required, must be integer
24
+ * - old_facility_ids: required, must be an array of integers (can be empty)
25
+ * - new_facility_ids: required, must be array of integers
26
+ */
27
+ async updateInvoice(
28
+ request: operations.UpdateInvoiceRequest,
29
+ options?: RequestOptions,
30
+ ): Promise<boolean> {
31
+ return unwrapAsync(invoicesUpdateInvoice(
32
+ this,
33
+ request,
34
+ options,
35
+ ));
36
+ }
37
+
11
38
  /**
12
39
  * Make payment for the invoice
13
40
  *