@flexprice/mcp-server 2.1.10 → 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.
- package/bin/mcp-server.js +659 -606
- package/bin/mcp-server.js.map +18 -18
- package/bun.lock +8 -6
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/mcp-server/mcp-server.js +1 -1
- package/esm/mcp-server/server.d.ts.map +1 -1
- package/esm/mcp-server/server.js +1 -3
- package/esm/mcp-server/server.js.map +1 -1
- package/esm/models/createinvoicerequest.d.ts +1 -0
- package/esm/models/createinvoicerequest.d.ts.map +1 -1
- package/esm/models/createinvoicerequest.js +1 -0
- package/esm/models/createinvoicerequest.js.map +1 -1
- package/esm/models/creditgrantexpirydurationunit.d.ts +1 -1
- package/esm/models/errorcode.d.ts +32 -0
- package/esm/models/errorcode.d.ts.map +1 -0
- package/esm/models/errorcode.js +33 -0
- package/esm/models/errorcode.js.map +1 -0
- package/esm/models/errorresponse.d.ts +2 -34
- package/esm/models/errorresponse.d.ts.map +1 -1
- package/esm/models/errorresponse.js +2 -29
- package/esm/models/errorresponse.js.map +1 -1
- package/esm/models/invoiceresponse.d.ts +1 -0
- package/esm/models/invoiceresponse.d.ts.map +1 -1
- package/esm/models/invoiceresponse.js +1 -0
- package/esm/models/invoiceresponse.js.map +1 -1
- package/esm/models/windowsize.d.ts +2 -2
- package/esm/models/windowsize.js +2 -2
- package/esm/models/windowsize.js.map +1 -1
- package/esm/tool-names.d.ts.map +1 -1
- package/esm/tool-names.js +0 -4
- package/esm/tool-names.js.map +1 -1
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/manifest.json +1 -5
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -3
- package/src/models/createinvoicerequest.ts +4 -0
- package/src/models/errorcode.ts +37 -0
- package/src/models/errorresponse.ts +3 -38
- package/src/models/invoiceresponse.ts +4 -0
- package/src/models/windowsize.ts +2 -2
- package/src/tool-names.ts +0 -4
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.d.ts +0 -16
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.d.ts.map +0 -1
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.js +0 -82
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.js.map +0 -1
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.d.ts +0 -7
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.d.ts.map +0 -1
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.js +0 -35
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.js.map +0 -1
- package/esm/models/getmeterusagepreviewinvoiceop.d.ts +0 -6
- package/esm/models/getmeterusagepreviewinvoiceop.d.ts.map +0 -1
- package/esm/models/getmeterusagepreviewinvoiceop.js +0 -11
- package/esm/models/getmeterusagepreviewinvoiceop.js.map +0 -1
- package/src/funcs/invoicesGetMeterUsagePreviewInvoice.ts +0 -144
- package/src/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.ts +0 -47
- 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.
|
|
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
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.
|
|
73
|
-
genVersion: "2.
|
|
72
|
+
sdkVersion: "2.1.11",
|
|
73
|
+
genVersion: "2.884.4",
|
|
74
74
|
userAgent:
|
|
75
|
-
"speakeasy-sdk/mcp-typescript 2.1.
|
|
75
|
+
"speakeasy-sdk/mcp-typescript 2.1.11 2.884.4 1.0 @flexprice/mcp-server",
|
|
76
76
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -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.
|
|
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()
|
|
@@ -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 {
|
|
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?:
|
|
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:
|
|
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
|
});
|
|
@@ -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
|
),
|
package/src/models/windowsize.ts
CHANGED
|
@@ -6,6 +6,7 @@ import * as z from "zod";
|
|
|
6
6
|
import { ClosedEnum } from "../types/enums.js";
|
|
7
7
|
|
|
8
8
|
export const WindowSize = {
|
|
9
|
+
Month: "MONTH",
|
|
9
10
|
Minute: "MINUTE",
|
|
10
11
|
FifteenMIN: "15MIN",
|
|
11
12
|
ThirtyMIN: "30MIN",
|
|
@@ -15,11 +16,11 @@ export const WindowSize = {
|
|
|
15
16
|
TwelveHOUR: "12HOUR",
|
|
16
17
|
Day: "DAY",
|
|
17
18
|
Week: "WEEK",
|
|
18
|
-
Month: "MONTH",
|
|
19
19
|
} as const;
|
|
20
20
|
export type WindowSize = ClosedEnum<typeof WindowSize>;
|
|
21
21
|
|
|
22
22
|
export const WindowSize$zodSchema = z.enum([
|
|
23
|
+
"MONTH",
|
|
23
24
|
"MINUTE",
|
|
24
25
|
"15MIN",
|
|
25
26
|
"30MIN",
|
|
@@ -29,5 +30,4 @@ export const WindowSize$zodSchema = z.enum([
|
|
|
29
30
|
"12HOUR",
|
|
30
31
|
"DAY",
|
|
31
32
|
"WEEK",
|
|
32
|
-
"MONTH",
|
|
33
33
|
]);
|
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
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { invoicesGetMeterUsagePreviewInvoice } from "../../funcs/invoicesGetMeterUsagePreviewInvoice.js";
|
|
6
|
-
import { GetPreviewInvoiceRequest$zodSchema } from "../../models/getpreviewinvoicerequest.js";
|
|
7
|
-
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
-
|
|
9
|
-
const args = {
|
|
10
|
-
request: GetPreviewInvoiceRequest$zodSchema.describe(
|
|
11
|
-
`Preview Invoice Request`,
|
|
12
|
-
),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const tool$invoicesGetMeterUsagePreviewInvoice: ToolDefinition<
|
|
16
|
-
typeof args
|
|
17
|
-
> = {
|
|
18
|
-
name: "get-meter-usage-preview-invoice",
|
|
19
|
-
description: `Get invoice preview using meter_usage data
|
|
20
|
-
|
|
21
|
-
Preview invoice using the meter_usage table for usage data instead of feature_usage.`,
|
|
22
|
-
scopes: ["write"],
|
|
23
|
-
annotations: {
|
|
24
|
-
"title": "",
|
|
25
|
-
"destructiveHint": false,
|
|
26
|
-
"idempotentHint": false,
|
|
27
|
-
"openWorldHint": false,
|
|
28
|
-
"readOnlyHint": false,
|
|
29
|
-
},
|
|
30
|
-
args,
|
|
31
|
-
tool: async (client, args, ctx) => {
|
|
32
|
-
const [result] = await invoicesGetMeterUsagePreviewInvoice(
|
|
33
|
-
client,
|
|
34
|
-
args.request,
|
|
35
|
-
{ fetchOptions: { signal: ctx.signal } },
|
|
36
|
-
).$inspect();
|
|
37
|
-
|
|
38
|
-
if (!result.ok) {
|
|
39
|
-
return {
|
|
40
|
-
content: [{ type: "text", text: result.error.message }],
|
|
41
|
-
isError: true,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return formatResult(result.value);
|
|
46
|
-
},
|
|
47
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
import { ErrorResponse, ErrorResponse$zodSchema } from "./errorresponse.js";
|
|
7
|
-
import {
|
|
8
|
-
InvoiceResponse,
|
|
9
|
-
InvoiceResponse$zodSchema,
|
|
10
|
-
} from "./invoiceresponse.js";
|
|
11
|
-
|
|
12
|
-
export type GetMeterUsagePreviewInvoiceResponse =
|
|
13
|
-
| InvoiceResponse
|
|
14
|
-
| ErrorResponse;
|
|
15
|
-
|
|
16
|
-
export const GetMeterUsagePreviewInvoiceResponse$zodSchema: z.ZodType<
|
|
17
|
-
GetMeterUsagePreviewInvoiceResponse
|
|
18
|
-
> = z.union([
|
|
19
|
-
InvoiceResponse$zodSchema,
|
|
20
|
-
ErrorResponse$zodSchema,
|
|
21
|
-
]);
|