@flexprice/mcp-server 2.1.9 → 2.1.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 (76) hide show
  1. package/bin/mcp-server.js +670 -605
  2. package/bin/mcp-server.js.map +21 -21
  3. package/bun.lock +8 -6
  4. package/esm/lib/config.d.ts +3 -3
  5. package/esm/lib/config.js +3 -3
  6. package/esm/lib/config.js.map +1 -1
  7. package/esm/mcp-server/mcp-server.js +1 -1
  8. package/esm/mcp-server/mcp-server.js.map +1 -1
  9. package/esm/mcp-server/server.d.ts.map +1 -1
  10. package/esm/mcp-server/server.js +1 -3
  11. package/esm/mcp-server/server.js.map +1 -1
  12. package/esm/models/createinvoicerequest.d.ts +1 -0
  13. package/esm/models/createinvoicerequest.d.ts.map +1 -1
  14. package/esm/models/createinvoicerequest.js +1 -0
  15. package/esm/models/createinvoicerequest.js.map +1 -1
  16. package/esm/models/createsubscriptionrequest.d.ts +1 -0
  17. package/esm/models/createsubscriptionrequest.d.ts.map +1 -1
  18. package/esm/models/createsubscriptionrequest.js +1 -0
  19. package/esm/models/createsubscriptionrequest.js.map +1 -1
  20. package/esm/models/errorcode.d.ts +32 -0
  21. package/esm/models/errorcode.d.ts.map +1 -0
  22. package/esm/models/errorcode.js +33 -0
  23. package/esm/models/errorcode.js.map +1 -0
  24. package/esm/models/errorresponse.d.ts +2 -34
  25. package/esm/models/errorresponse.d.ts.map +1 -1
  26. package/esm/models/errorresponse.js +2 -29
  27. package/esm/models/errorresponse.js.map +1 -1
  28. package/esm/models/invoicebillingreason.d.ts +2 -0
  29. package/esm/models/invoicebillingreason.d.ts.map +1 -1
  30. package/esm/models/invoicebillingreason.js +2 -0
  31. package/esm/models/invoicebillingreason.js.map +1 -1
  32. package/esm/models/invoiceresponse.d.ts +1 -0
  33. package/esm/models/invoiceresponse.d.ts.map +1 -1
  34. package/esm/models/invoiceresponse.js +1 -0
  35. package/esm/models/invoiceresponse.js.map +1 -1
  36. package/esm/models/subscriptionresponse.d.ts +1 -0
  37. package/esm/models/subscriptionresponse.d.ts.map +1 -1
  38. package/esm/models/subscriptionresponse.js +1 -0
  39. package/esm/models/subscriptionresponse.js.map +1 -1
  40. package/esm/models/subscriptionresponsev2.d.ts +1 -0
  41. package/esm/models/subscriptionresponsev2.d.ts.map +1 -1
  42. package/esm/models/subscriptionresponsev2.js +1 -0
  43. package/esm/models/subscriptionresponsev2.js.map +1 -1
  44. package/esm/tool-names.d.ts.map +1 -1
  45. package/esm/tool-names.js +0 -4
  46. package/esm/tool-names.js.map +1 -1
  47. package/esm/tsconfig.tsbuildinfo +1 -1
  48. package/manifest.json +1 -5
  49. package/package.json +1 -1
  50. package/src/lib/config.ts +3 -3
  51. package/src/mcp-server/mcp-server.ts +1 -1
  52. package/src/mcp-server/server.ts +1 -3
  53. package/src/models/createinvoicerequest.ts +4 -0
  54. package/src/models/createsubscriptionrequest.ts +4 -0
  55. package/src/models/errorcode.ts +37 -0
  56. package/src/models/errorresponse.ts +3 -38
  57. package/src/models/invoicebillingreason.ts +2 -0
  58. package/src/models/invoiceresponse.ts +4 -0
  59. package/src/models/subscriptionresponse.ts +4 -0
  60. package/src/models/subscriptionresponsev2.ts +4 -0
  61. package/src/tool-names.ts +0 -4
  62. package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.d.ts +0 -16
  63. package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.d.ts.map +0 -1
  64. package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.js +0 -82
  65. package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.js.map +0 -1
  66. package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.d.ts +0 -7
  67. package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.d.ts.map +0 -1
  68. package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.js +0 -35
  69. package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.js.map +0 -1
  70. package/esm/models/getmeterusagepreviewinvoiceop.d.ts +0 -6
  71. package/esm/models/getmeterusagepreviewinvoiceop.d.ts.map +0 -1
  72. package/esm/models/getmeterusagepreviewinvoiceop.js +0 -11
  73. package/esm/models/getmeterusagepreviewinvoiceop.js.map +0 -1
  74. package/src/funcs/invoicesGetMeterUsagePreviewInvoice.ts +0 -144
  75. package/src/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.ts +0 -47
  76. package/src/models/getmeterusagepreviewinvoiceop.ts +0 -21
package/manifest.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "sensitive": true
49
49
  }
50
50
  },
51
- "version": "2.1.9",
51
+ "version": "2.1.11",
52
52
  "tools": [
53
53
  {
54
54
  "name": "update-customer",
@@ -94,10 +94,6 @@
94
94
  "name": "create-invoice",
95
95
  "description": "Create one-off invoice\n\nUse when creating a manual or one-off invoice (e.g. custom charge or non-recurring billing). Invoice is created in draft; finalize when ready."
96
96
  },
97
- {
98
- "name": "get-meter-usage-preview-invoice",
99
- "description": "Get invoice preview using meter_usage data\n\nPreview invoice using the meter_usage table for usage data instead of feature_usage."
100
- },
101
97
  {
102
98
  "name": "get-invoice-preview",
103
99
  "description": "Get invoice preview\n\nUse when showing a customer what they will be charged (e.g. preview before checkout or plan change). No invoice is created."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexprice/mcp-server",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "author": "flexprice",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/src/lib/config.ts CHANGED
@@ -69,8 +69,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
69
69
  export const SDK_METADATA = {
70
70
  language: "typescript",
71
71
  openapiDocVersion: "1.0",
72
- sdkVersion: "2.1.9",
73
- genVersion: "2.882.0",
72
+ sdkVersion: "2.1.11",
73
+ genVersion: "2.884.4",
74
74
  userAgent:
75
- "speakeasy-sdk/mcp-typescript 2.1.9 2.882.0 1.0 @flexprice/mcp-server",
75
+ "speakeasy-sdk/mcp-typescript 2.1.11 2.884.4 1.0 @flexprice/mcp-server",
76
76
  } as const;
@@ -21,7 +21,7 @@ const routes = buildRouteMap({
21
21
  export const app = buildApplication(routes, {
22
22
  name: "mcp",
23
23
  versionInfo: {
24
- currentVersion: "2.1.9",
24
+ currentVersion: "2.1.11",
25
25
  },
26
26
  });
27
27
 
@@ -41,7 +41,6 @@ import { tool$invoicesGetCustomerInvoiceSummary } from "./tools/invoicesGetCusto
41
41
  import { tool$invoicesGetInvoice } from "./tools/invoicesGetInvoice.js";
42
42
  import { tool$invoicesGetInvoicePdf } from "./tools/invoicesGetInvoicePdf.js";
43
43
  import { tool$invoicesGetInvoicePreview } from "./tools/invoicesGetInvoicePreview.js";
44
- import { tool$invoicesGetMeterUsagePreviewInvoice } from "./tools/invoicesGetMeterUsagePreviewInvoice.js";
45
44
  import { tool$invoicesQueryInvoice } from "./tools/invoicesQueryInvoice.js";
46
45
  import { tool$invoicesRecalculateInvoice } from "./tools/invoicesRecalculateInvoice.js";
47
46
  import { tool$invoicesRecalculateInvoiceV2 } from "./tools/invoicesRecalculateInvoiceV2.js";
@@ -102,7 +101,7 @@ export function createMCPServer(deps: {
102
101
  }) {
103
102
  const server = new McpServer({
104
103
  name: "Flexprice",
105
- version: "2.1.9",
104
+ version: "2.1.11",
106
105
  });
107
106
 
108
107
  const getClient = deps.getSDK || (() =>
@@ -158,7 +157,6 @@ export function createMCPServer(deps: {
158
157
  tool(tool$customersGetCustomerUpcomingGrants);
159
158
  tool(tool$invoicesGetCustomerInvoiceSummary);
160
159
  tool(tool$invoicesCreateInvoice);
161
- tool(tool$invoicesGetMeterUsagePreviewInvoice);
162
160
  tool(tool$invoicesGetInvoicePreview);
163
161
  tool(tool$invoicesQueryInvoice);
164
162
  tool(tool$invoicesGetInvoice);
@@ -44,6 +44,7 @@ export type CreateInvoiceRequest = {
44
44
  invoice_pdf_url?: string | undefined;
45
45
  invoice_status?: InvoiceStatus | undefined;
46
46
  invoice_type?: InvoiceType | undefined;
47
+ issue_date?: string | undefined;
47
48
  line_item_coupons?: Array<InvoiceLineItemCoupon> | undefined;
48
49
  line_items?: Array<CreateInvoiceLineItemRequest> | undefined;
49
50
  metadata?: { [k: string]: string } | undefined;
@@ -98,6 +99,9 @@ export const CreateInvoiceRequest$zodSchema: z.ZodType<CreateInvoiceRequest> = z
98
99
  ),
99
100
  invoice_status: InvoiceStatus$zodSchema.optional(),
100
101
  invoice_type: InvoiceType$zodSchema.optional(),
102
+ issue_date: z.iso.datetime({ offset: true }).optional().describe(
103
+ "issue_date overrides the user-facing date of the invoice.\nDefaults to created_at if not provided.",
104
+ ),
101
105
  line_item_coupons: z.array(InvoiceLineItemCoupon$zodSchema).optional()
102
106
  .describe("Invoice Line Item Coupons"),
103
107
  line_items: z.array(CreateInvoiceLineItemRequest$zodSchema).optional()
@@ -61,6 +61,7 @@ import {
61
61
 
62
62
  export type CreateSubscriptionRequest = {
63
63
  addons?: Array<AddAddonToSubscriptionRequest> | undefined;
64
+ auto_invoice_threshold?: string | undefined;
64
65
  billing_anchor?: string | undefined;
65
66
  billing_cycle?: BillingCycle | undefined;
66
67
  billing_period: BillingPeriod;
@@ -103,6 +104,9 @@ export const CreateSubscriptionRequest$zodSchema: z.ZodType<
103
104
  addons: z.array(AddAddonToSubscriptionRequest$zodSchema).optional().describe(
104
105
  "Addons represents addons to be added to the subscription during creation",
105
106
  ),
107
+ auto_invoice_threshold: z.string().optional().describe(
108
+ "AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers\nan intermediate invoice mid-period. Set once at creation; cannot be changed later.\nAllowed only when the subscription resolves to type standalone (no parent hierarchy rows).\nPlan line items must be usage-based only (no fixed or other non-usage plan prices).\nNil means auto invoice threshold billing is disabled for this subscription.",
109
+ ),
106
110
  billing_anchor: z.iso.datetime({ offset: true }).optional().describe(
107
111
  "BillingAnchor overrides the derived billing anchor when billing_cycle is anniversary.\nFor monthly billing, the day-of-month (and time-of-day) define cycle boundaries: if start_date\nis before that day in the month, the first billing period ends on the next occurrence of that\nday in the same month (a shorter first period); subsequent periods follow the usual interval.",
108
112
  ),
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { ClosedEnum } from "../types/enums.js";
7
+
8
+ export const ErrorCode = {
9
+ HttpClientError: "http_client_error",
10
+ SystemError: "system_error",
11
+ InternalError: "internal_error",
12
+ NotFound: "not_found",
13
+ AlreadyExists: "already_exists",
14
+ VersionConflict: "version_conflict",
15
+ ValidationError: "validation_error",
16
+ InvalidOperation: "invalid_operation",
17
+ PermissionDenied: "permission_denied",
18
+ DatabaseError: "database_error",
19
+ ServiceUnavailable: "service_unavailable",
20
+ TooManyRequests: "too_many_requests",
21
+ } as const;
22
+ export type ErrorCode = ClosedEnum<typeof ErrorCode>;
23
+
24
+ export const ErrorCode$zodSchema = z.enum([
25
+ "http_client_error",
26
+ "system_error",
27
+ "internal_error",
28
+ "not_found",
29
+ "already_exists",
30
+ "version_conflict",
31
+ "validation_error",
32
+ "invalid_operation",
33
+ "permission_denied",
34
+ "database_error",
35
+ "service_unavailable",
36
+ "too_many_requests",
37
+ ]);
@@ -3,51 +3,16 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
- import { ClosedEnum } from "../types/enums.js";
7
-
8
- export const Code = {
9
- NotFound: "not_found",
10
- AlreadyExists: "already_exists",
11
- VersionConflict: "version_conflict",
12
- ValidationError: "validation_error",
13
- InvalidOperation: "invalid_operation",
14
- PermissionDenied: "permission_denied",
15
- HttpClientError: "http_client_error",
16
- DatabaseError: "database_error",
17
- SystemError: "system_error",
18
- InternalError: "internal_error",
19
- ServiceUnavailable: "service_unavailable",
20
- } as const;
21
- export type Code = ClosedEnum<typeof Code>;
22
-
23
- export const Code$zodSchema = z.enum([
24
- "not_found",
25
- "already_exists",
26
- "version_conflict",
27
- "validation_error",
28
- "invalid_operation",
29
- "permission_denied",
30
- "http_client_error",
31
- "database_error",
32
- "system_error",
33
- "internal_error",
34
- "service_unavailable",
35
- ]);
36
-
37
- export type Details = {};
38
-
39
- export const Details$zodSchema: z.ZodType<Details> = z.object({});
6
+ import { ErrorCode, ErrorCode$zodSchema } from "./errorcode.js";
40
7
 
41
8
  export type ErrorResponse = {
42
- code?: Code | undefined;
43
- details?: { [k: string]: Details } | undefined;
9
+ code?: ErrorCode | undefined;
44
10
  http_status_code?: number | undefined;
45
11
  message?: string | undefined;
46
12
  };
47
13
 
48
14
  export const ErrorResponse$zodSchema: z.ZodType<ErrorResponse> = z.object({
49
- code: Code$zodSchema.optional(),
50
- details: z.record(z.string(), z.lazy(() => Details$zodSchema)).optional(),
15
+ code: ErrorCode$zodSchema.optional(),
51
16
  http_status_code: z.int().optional(),
52
17
  message: z.string().optional(),
53
18
  });
@@ -13,6 +13,7 @@ export const InvoiceBillingReason = {
13
13
  SubscriptionTrialStart: "SUBSCRIPTION_TRIAL_START",
14
14
  Proration: "PRORATION",
15
15
  Manual: "MANUAL",
16
+ AutoInvoiceThreshold: "AUTO_INVOICE_THRESHOLD",
16
17
  } as const;
17
18
  export type InvoiceBillingReason = ClosedEnum<typeof InvoiceBillingReason>;
18
19
 
@@ -24,4 +25,5 @@ export const InvoiceBillingReason$zodSchema = z.enum([
24
25
  "SUBSCRIPTION_TRIAL_START",
25
26
  "PRORATION",
26
27
  "MANUAL",
28
+ "AUTO_INVOICE_THRESHOLD",
27
29
  ]);
@@ -52,6 +52,7 @@ export type InvoiceResponse = {
52
52
  invoice_pdf_url?: string | undefined;
53
53
  invoice_status?: InvoiceStatus | undefined;
54
54
  invoice_type?: InvoiceType | undefined;
55
+ issue_date?: string | undefined;
55
56
  last_computed_at?: string | undefined;
56
57
  line_items?: Array<InvoiceLineItemResponse> | undefined;
57
58
  metadata?: { [k: string]: string } | undefined;
@@ -142,6 +143,9 @@ export const InvoiceResponse$zodSchema: z.ZodType<InvoiceResponse> = z.object({
142
143
  ),
143
144
  invoice_status: InvoiceStatus$zodSchema.optional(),
144
145
  invoice_type: InvoiceType$zodSchema.optional(),
146
+ issue_date: z.iso.datetime({ offset: true }).optional().describe(
147
+ "issue_date is the user-facing date of the invoice. Defaults to created_at if not set.",
148
+ ),
145
149
  last_computed_at: z.iso.datetime({ offset: true }).optional().describe(
146
150
  "last_computed_at is the timestamp when this invoice was last computed by ComputeInvoice",
147
151
  ),
@@ -53,6 +53,7 @@ import {
53
53
 
54
54
  export type SubscriptionResponse = {
55
55
  active_pause_id?: string | undefined;
56
+ auto_invoice_threshold?: string | undefined;
56
57
  billing_anchor?: string | undefined;
57
58
  billing_cadence?: BillingCadence | undefined;
58
59
  billing_cycle?: BillingCycle | undefined;
@@ -111,6 +112,9 @@ export const SubscriptionResponse$zodSchema: z.ZodType<SubscriptionResponse> = z
111
112
  active_pause_id: z.string().optional().describe(
112
113
  "ActivePauseID references the current active pause configuration\nThis will be null if no pause is active or scheduled",
113
114
  ),
115
+ auto_invoice_threshold: z.string().optional().describe(
116
+ "AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers\nan intermediate invoice. Overrides the plan-level threshold when set.\nNil means: inherit from the plan's threshold (which may also be nil = disabled).",
117
+ ),
114
118
  billing_anchor: z.iso.datetime({ offset: true }).optional().describe(
115
119
  "BillingAnchor is the reference point that aligns future billing cycle dates.\nIt sets the day of week for week intervals, the day of month for month and year intervals,\nand the month of year for year intervals. The timestamp is in UTC format.",
116
120
  ),
@@ -49,6 +49,7 @@ import {
49
49
 
50
50
  export type SubscriptionResponseV2 = {
51
51
  active_pause_id?: string | undefined;
52
+ auto_invoice_threshold?: string | undefined;
52
53
  billing_anchor?: string | undefined;
53
54
  billing_cadence?: BillingCadence | undefined;
54
55
  billing_cycle?: BillingCycle | undefined;
@@ -107,6 +108,9 @@ export const SubscriptionResponseV2$zodSchema: z.ZodType<
107
108
  active_pause_id: z.string().optional().describe(
108
109
  "ActivePauseID references the current active pause configuration\nThis will be null if no pause is active or scheduled",
109
110
  ),
111
+ auto_invoice_threshold: z.string().optional().describe(
112
+ "AutoInvoiceThreshold is the usage amount (in subscription currency) that triggers\nan intermediate invoice. Overrides the plan-level threshold when set.\nNil means: inherit from the plan's threshold (which may also be nil = disabled).",
113
+ ),
110
114
  billing_anchor: z.iso.datetime({ offset: true }).optional().describe(
111
115
  "BillingAnchor is the reference point that aligns future billing cycle dates.\nIt sets the day of week for week intervals, the day of month for month and year intervals,\nand the month of year for year intervals. The timestamp is in UTC format.",
112
116
  ),
package/src/tool-names.ts CHANGED
@@ -44,10 +44,6 @@ export const toolNames: Array<{ name: string; description: string }>= [
44
44
  "name": "create-invoice",
45
45
  "description": "Create one-off invoice\n\nUse when creating a manual or one-off invoice (e.g. custom charge or non-recurring billing). Invoice is created in draft; finalize when ready."
46
46
  },
47
- {
48
- "name": "get-meter-usage-preview-invoice",
49
- "description": "Get invoice preview using meter_usage data\n\nPreview invoice using the meter_usage table for usage data instead of feature_usage."
50
- },
51
47
  {
52
48
  "name": "get-invoice-preview",
53
49
  "description": "Get invoice preview\n\nUse when showing a customer what they will be charged (e.g. preview before checkout or plan change). No invoice is created."
@@ -1,16 +0,0 @@
1
- import { FlexpriceCore } from "../core.js";
2
- import { RequestOptions } from "../lib/sdks.js";
3
- import { APIError } from "../models/errors/apierror.js";
4
- import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
6
- import { GetPreviewInvoiceRequest } from "../models/getpreviewinvoicerequest.js";
7
- import { APIPromise } from "../types/async.js";
8
- import { Result } from "../types/fp.js";
9
- /**
10
- * Get invoice preview using meter_usage data
11
- *
12
- * @remarks
13
- * Preview invoice using the meter_usage table for usage data instead of feature_usage.
14
- */
15
- export declare function invoicesGetMeterUsagePreviewInvoice(client$: FlexpriceCore, request: GetPreviewInvoiceRequest, options?: RequestOptions): APIPromise<Result<Response, APIError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
16
- //# sourceMappingURL=invoicesGetMeterUsagePreviewInvoice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoicesGetMeterUsagePreviewInvoice.d.ts","sourceRoot":"","sources":["../../src/funcs/invoicesGetMeterUsagePreviewInvoice.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EACL,wBAAwB,EAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAW,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,wBAAwB,EACjC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CACX,MAAM,CACJ,QAAQ,EACN,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAMA"}
@@ -1,82 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { encodeJSON } from "../lib/encodings.js";
5
- import { compactMap } from "../lib/primitives.js";
6
- import { safeParse } from "../lib/schemas.js";
7
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
8
- import { pathToFunc } from "../lib/url.js";
9
- import { GetPreviewInvoiceRequest$zodSchema, } from "../models/getpreviewinvoicerequest.js";
10
- import { APIPromise } from "../types/async.js";
11
- /**
12
- * Get invoice preview using meter_usage data
13
- *
14
- * @remarks
15
- * Preview invoice using the meter_usage table for usage data instead of feature_usage.
16
- */
17
- export function invoicesGetMeterUsagePreviewInvoice(client$, request, options) {
18
- return new APIPromise($do(client$, request, options));
19
- }
20
- async function $do(client$, request, options) {
21
- const parsed$ = safeParse(request, (value$) => GetPreviewInvoiceRequest$zodSchema.parse(value$), "Input validation failed");
22
- if (!parsed$.ok) {
23
- return [parsed$, { status: "invalid" }];
24
- }
25
- const payload$ = parsed$.value;
26
- const body$ = encodeJSON("body", payload$, { explode: true });
27
- const path$ = pathToFunc("/invoices/meter-usage-preview")();
28
- const headers$ = new Headers(compactMap({
29
- "Content-Type": "application/json",
30
- Accept: "application/json",
31
- }));
32
- const securityInput = await extractSecurity(client$._options.security);
33
- const requestSecurity = resolveGlobalSecurity(securityInput);
34
- const context = {
35
- options: client$._options,
36
- baseURL: options?.serverURL ?? client$._baseURL ?? "",
37
- operationID: "getMeterUsagePreviewInvoice",
38
- oAuth2Scopes: null,
39
- resolvedSecurity: requestSecurity,
40
- securitySource: client$._options.security,
41
- retryConfig: options?.retries
42
- || client$._options.retryConfig
43
- || { strategy: "none" },
44
- retryCodes: options?.retryCodes || [
45
- "429",
46
- "500",
47
- "502",
48
- "503",
49
- "504",
50
- ],
51
- };
52
- const requestRes = client$._createRequest(context, {
53
- security: requestSecurity,
54
- method: "POST",
55
- baseURL: options?.serverURL,
56
- path: path$,
57
- headers: headers$,
58
- body: body$,
59
- userAgent: client$._options.userAgent,
60
- timeoutMs: options?.timeoutMs || client$._options.timeoutMs
61
- || -1,
62
- }, options);
63
- if (!requestRes.ok) {
64
- return [requestRes, { status: "invalid" }];
65
- }
66
- const req$ = requestRes.value;
67
- const doResult = await client$._do(req$, {
68
- context,
69
- errorCodes: [],
70
- retryConfig: context.retryConfig,
71
- retryCodes: context.retryCodes,
72
- });
73
- if (!doResult.ok) {
74
- return [doResult, { status: "request-error", request: req$ }];
75
- }
76
- return [doResult, {
77
- status: "complete",
78
- "request": req$,
79
- response: doResult.value,
80
- }];
81
- }
82
- //# sourceMappingURL=invoicesGetMeterUsagePreviewInvoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoicesGetMeterUsagePreviewInvoice.js","sourceRoot":"","sources":["../../src/funcs/invoicesGetMeterUsagePreviewInvoice.ts"],"names":[],"mappings":"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"}
@@ -1,7 +0,0 @@
1
- import { ToolDefinition } from "../tools.js";
2
- declare const args: {
3
- request: import("zod").ZodType<import("../../models/getpreviewinvoicerequest.js").GetPreviewInvoiceRequest, unknown, import("zod/v4/core").$ZodTypeInternals<import("../../models/getpreviewinvoicerequest.js").GetPreviewInvoiceRequest, unknown>>;
4
- };
5
- export declare const tool$invoicesGetMeterUsagePreviewInvoice: ToolDefinition<typeof args>;
6
- export {};
7
- //# sourceMappingURL=invoicesGetMeterUsagePreviewInvoice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoicesGetMeterUsagePreviewInvoice.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3D,QAAA,MAAM,IAAI;;CAIT,CAAC;AAEF,eAAO,MAAM,wCAAwC,EAAE,cAAc,CACnE,OAAO,IAAI,CA+BZ,CAAC"}
@@ -1,35 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { invoicesGetMeterUsagePreviewInvoice } from "../../funcs/invoicesGetMeterUsagePreviewInvoice.js";
5
- import { GetPreviewInvoiceRequest$zodSchema } from "../../models/getpreviewinvoicerequest.js";
6
- import { formatResult } from "../tools.js";
7
- const args = {
8
- request: GetPreviewInvoiceRequest$zodSchema.describe(`Preview Invoice Request`),
9
- };
10
- export const tool$invoicesGetMeterUsagePreviewInvoice = {
11
- name: "get-meter-usage-preview-invoice",
12
- description: `Get invoice preview using meter_usage data
13
-
14
- Preview invoice using the meter_usage table for usage data instead of feature_usage.`,
15
- scopes: ["write"],
16
- annotations: {
17
- "title": "",
18
- "destructiveHint": false,
19
- "idempotentHint": false,
20
- "openWorldHint": false,
21
- "readOnlyHint": false,
22
- },
23
- args,
24
- tool: async (client, args, ctx) => {
25
- const [result] = await invoicesGetMeterUsagePreviewInvoice(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
26
- if (!result.ok) {
27
- return {
28
- content: [{ type: "text", text: result.error.message }],
29
- isError: true,
30
- };
31
- }
32
- return formatResult(result.value);
33
- },
34
- };
35
- //# sourceMappingURL=invoicesGetMeterUsagePreviewInvoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoicesGetMeterUsagePreviewInvoice.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mCAAmC,EAAE,MAAM,oDAAoD,CAAC;AACzG,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAE3D,MAAM,IAAI,GAAG;IACX,OAAO,EAAE,kCAAkC,CAAC,QAAQ,CAClD,yBAAyB,CAC1B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAEjD;IACF,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE;;qFAEsE;IACnF,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,WAAW,EAAE;QACX,OAAO,EAAE,EAAE;QACX,iBAAiB,EAAE,KAAK;QACxB,gBAAgB,EAAE,KAAK;QACvB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,KAAK;KACtB;IACD,IAAI;IACJ,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAChC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,mCAAmC,CACxD,MAAM,EACN,IAAI,CAAC,OAAO,EACZ,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CACzC,CAAC,QAAQ,EAAE,CAAC;QAEb,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACvD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,OAAO,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;CACF,CAAC"}
@@ -1,6 +0,0 @@
1
- import * as z from "zod";
2
- import { ErrorResponse } from "./errorresponse.js";
3
- import { InvoiceResponse } from "./invoiceresponse.js";
4
- export type GetMeterUsagePreviewInvoiceResponse = InvoiceResponse | ErrorResponse;
5
- export declare const GetMeterUsagePreviewInvoiceResponse$zodSchema: z.ZodType<GetMeterUsagePreviewInvoiceResponse>;
6
- //# sourceMappingURL=getmeterusagepreviewinvoiceop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getmeterusagepreviewinvoiceop.d.ts","sourceRoot":"","sources":["../../src/models/getmeterusagepreviewinvoiceop.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACL,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,mCAAmC,GAC3C,eAAe,GACf,aAAa,CAAC;AAElB,eAAO,MAAM,6CAA6C,EAAE,CAAC,CAAC,OAAO,CACnE,mCAAmC,CAInC,CAAC"}
@@ -1,11 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import * as z from "zod";
5
- import { ErrorResponse$zodSchema } from "./errorresponse.js";
6
- import { InvoiceResponse$zodSchema, } from "./invoiceresponse.js";
7
- export const GetMeterUsagePreviewInvoiceResponse$zodSchema = z.union([
8
- InvoiceResponse$zodSchema,
9
- ErrorResponse$zodSchema,
10
- ]);
11
- //# sourceMappingURL=getmeterusagepreviewinvoiceop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getmeterusagepreviewinvoiceop.js","sourceRoot":"","sources":["../../src/models/getmeterusagepreviewinvoiceop.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAiB,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAEL,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAM9B,MAAM,CAAC,MAAM,6CAA6C,GAEtD,CAAC,CAAC,KAAK,CAAC;IACV,yBAAyB;IACzB,uBAAuB;CACxB,CAAC,CAAC"}
@@ -1,144 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { FlexpriceCore } from "../core.js";
6
- import { encodeJSON } from "../lib/encodings.js";
7
- import { compactMap } from "../lib/primitives.js";
8
- import { safeParse } from "../lib/schemas.js";
9
- import { RequestOptions } from "../lib/sdks.js";
10
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
- import { pathToFunc } from "../lib/url.js";
12
- import { APIError } from "../models/errors/apierror.js";
13
- import {
14
- ConnectionError,
15
- InvalidRequestError,
16
- RequestAbortedError,
17
- RequestTimeoutError,
18
- UnexpectedClientError,
19
- } from "../models/errors/httpclienterrors.js";
20
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
21
- import {
22
- GetPreviewInvoiceRequest,
23
- GetPreviewInvoiceRequest$zodSchema,
24
- } from "../models/getpreviewinvoicerequest.js";
25
- import { APICall, APIPromise } from "../types/async.js";
26
- import { Result } from "../types/fp.js";
27
-
28
- /**
29
- * Get invoice preview using meter_usage data
30
- *
31
- * @remarks
32
- * Preview invoice using the meter_usage table for usage data instead of feature_usage.
33
- */
34
- export function invoicesGetMeterUsagePreviewInvoice(
35
- client$: FlexpriceCore,
36
- request: GetPreviewInvoiceRequest,
37
- options?: RequestOptions,
38
- ): APIPromise<
39
- Result<
40
- Response,
41
- | APIError
42
- | SDKValidationError
43
- | UnexpectedClientError
44
- | InvalidRequestError
45
- | RequestAbortedError
46
- | RequestTimeoutError
47
- | ConnectionError
48
- >
49
- > {
50
- return new APIPromise($do(
51
- client$,
52
- request,
53
- options,
54
- ));
55
- }
56
-
57
- async function $do(
58
- client$: FlexpriceCore,
59
- request: GetPreviewInvoiceRequest,
60
- options?: RequestOptions,
61
- ): Promise<
62
- [
63
- Result<
64
- Response,
65
- | APIError
66
- | SDKValidationError
67
- | UnexpectedClientError
68
- | InvalidRequestError
69
- | RequestAbortedError
70
- | RequestTimeoutError
71
- | ConnectionError
72
- >,
73
- APICall,
74
- ]
75
- > {
76
- const parsed$ = safeParse(
77
- request,
78
- (value$) => GetPreviewInvoiceRequest$zodSchema.parse(value$),
79
- "Input validation failed",
80
- );
81
- if (!parsed$.ok) {
82
- return [parsed$, { status: "invalid" }];
83
- }
84
- const payload$ = parsed$.value;
85
- const body$ = encodeJSON("body", payload$, { explode: true });
86
- const path$ = pathToFunc("/invoices/meter-usage-preview")();
87
-
88
- const headers$ = new Headers(compactMap({
89
- "Content-Type": "application/json",
90
- Accept: "application/json",
91
- }));
92
- const securityInput = await extractSecurity(client$._options.security);
93
- const requestSecurity = resolveGlobalSecurity(securityInput);
94
-
95
- const context = {
96
- options: client$._options,
97
- baseURL: options?.serverURL ?? client$._baseURL ?? "",
98
- operationID: "getMeterUsagePreviewInvoice",
99
- oAuth2Scopes: null,
100
- resolvedSecurity: requestSecurity,
101
- securitySource: client$._options.security,
102
- retryConfig: options?.retries
103
- || client$._options.retryConfig
104
- || { strategy: "none" },
105
- retryCodes: options?.retryCodes || [
106
- "429",
107
- "500",
108
- "502",
109
- "503",
110
- "504",
111
- ],
112
- };
113
-
114
- const requestRes = client$._createRequest(context, {
115
- security: requestSecurity,
116
- method: "POST",
117
- baseURL: options?.serverURL,
118
- path: path$,
119
- headers: headers$,
120
- body: body$,
121
- userAgent: client$._options.userAgent,
122
- timeoutMs: options?.timeoutMs || client$._options.timeoutMs
123
- || -1,
124
- }, options);
125
- if (!requestRes.ok) {
126
- return [requestRes, { status: "invalid" }];
127
- }
128
- const req$ = requestRes.value;
129
-
130
- const doResult = await client$._do(req$, {
131
- context,
132
- errorCodes: [],
133
- retryConfig: context.retryConfig,
134
- retryCodes: context.retryCodes,
135
- });
136
- if (!doResult.ok) {
137
- return [doResult, { status: "request-error", request: req$ }];
138
- }
139
- return [doResult, {
140
- status: "complete",
141
- "request": req$,
142
- response: doResult.value,
143
- }];
144
- }