@flexprice/mcp-server 2.1.1 → 2.1.2
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 +800 -390
- package/bin/mcp-server.js.map +38 -24
- package/bun.lock +32 -32
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.d.ts +16 -0
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.d.ts.map +1 -0
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.js +82 -0
- package/esm/funcs/invoicesGetMeterUsagePreviewInvoice.js.map +1 -0
- package/esm/funcs/subscriptionsExecuteSubscriptionModify.d.ts +4 -4
- package/esm/funcs/subscriptionsExecuteSubscriptionModify.d.ts.map +1 -1
- package/esm/funcs/subscriptionsExecuteSubscriptionModify.js +4 -4
- package/esm/funcs/subscriptionsExecuteSubscriptionModify.js.map +1 -1
- package/esm/funcs/subscriptionsPreviewSubscriptionModify.d.ts +16 -0
- package/esm/funcs/subscriptionsPreviewSubscriptionModify.d.ts.map +1 -0
- package/esm/funcs/subscriptionsPreviewSubscriptionModify.js +88 -0
- package/esm/funcs/subscriptionsPreviewSubscriptionModify.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/config.js.map +1 -1
- package/esm/lib/encodings.d.ts +1 -0
- package/esm/lib/encodings.d.ts.map +1 -1
- package/esm/lib/encodings.js +6 -0
- package/esm/lib/encodings.js.map +1 -1
- 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 +5 -1
- package/esm/mcp-server/server.js.map +1 -1
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.d.ts +7 -0
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.d.ts.map +1 -0
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.js +35 -0
- package/esm/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.js.map +1 -0
- package/esm/mcp-server/tools/subscriptionsExecuteSubscriptionModify.d.ts +1 -1
- package/esm/mcp-server/tools/subscriptionsExecuteSubscriptionModify.js +4 -4
- package/esm/mcp-server/tools/subscriptionsExecuteSubscriptionModify.js.map +1 -1
- package/esm/mcp-server/tools/subscriptionsPreviewSubscriptionModify.d.ts +7 -0
- package/esm/mcp-server/tools/subscriptionsPreviewSubscriptionModify.d.ts.map +1 -0
- package/esm/mcp-server/tools/subscriptionsPreviewSubscriptionModify.js +35 -0
- package/esm/mcp-server/tools/subscriptionsPreviewSubscriptionModify.js.map +1 -0
- package/esm/models/billingcadence.d.ts +0 -2
- package/esm/models/billingcadence.d.ts.map +1 -1
- package/esm/models/billingcadence.js +0 -2
- package/esm/models/billingcadence.js.map +1 -1
- package/esm/models/billingperiod.d.ts +2 -0
- package/esm/models/billingperiod.d.ts.map +1 -1
- package/esm/models/billingperiod.js +2 -0
- package/esm/models/billingperiod.js.map +1 -1
- package/esm/models/changedinvoice.d.ts +8 -0
- package/esm/models/changedinvoice.d.ts.map +1 -0
- package/esm/models/changedinvoice.js +10 -0
- package/esm/models/changedinvoice.js.map +1 -0
- package/esm/models/changedlineitem.d.ts +11 -0
- package/esm/models/changedlineitem.d.ts.map +1 -0
- package/esm/models/changedlineitem.js +13 -0
- package/esm/models/changedlineitem.js.map +1 -0
- package/esm/models/changedresources.d.ts +11 -0
- package/esm/models/changedresources.d.ts.map +1 -0
- package/esm/models/changedresources.js +13 -0
- package/esm/models/changedresources.js.map +1 -0
- package/esm/models/changedsubscription.d.ts +9 -0
- package/esm/models/changedsubscription.d.ts.map +1 -0
- package/esm/models/changedsubscription.js +12 -0
- package/esm/models/changedsubscription.js.map +1 -0
- package/esm/models/createpricerequest.d.ts +0 -2
- package/esm/models/createpricerequest.d.ts.map +1 -1
- package/esm/models/createpricerequest.js +0 -2
- package/esm/models/createpricerequest.js.map +1 -1
- package/esm/models/createsubscriptionrequest.d.ts +0 -2
- package/esm/models/createsubscriptionrequest.d.ts.map +1 -1
- package/esm/models/createsubscriptionrequest.js +0 -2
- package/esm/models/createsubscriptionrequest.js.map +1 -1
- package/esm/models/creditgrantcadence.d.ts +1 -1
- package/esm/models/creditgrantexpirydurationunit.d.ts +1 -1
- package/esm/models/executesubscriptionmodifyop.d.ts +6 -6
- package/esm/models/executesubscriptionmodifyop.d.ts.map +1 -1
- package/esm/models/executesubscriptionmodifyop.js +5 -5
- package/esm/models/executesubscriptionmodifyop.js.map +1 -1
- package/esm/models/executesubscriptionmodifyrequest.d.ts +11 -0
- package/esm/models/executesubscriptionmodifyrequest.d.ts.map +1 -0
- package/esm/models/executesubscriptionmodifyrequest.js +13 -0
- package/esm/models/executesubscriptionmodifyrequest.js.map +1 -0
- package/esm/models/getmeterusagepreviewinvoiceop.d.ts +6 -0
- package/esm/models/getmeterusagepreviewinvoiceop.d.ts.map +1 -0
- package/esm/models/getmeterusagepreviewinvoiceop.js +11 -0
- package/esm/models/getmeterusagepreviewinvoiceop.js.map +1 -0
- package/esm/models/invoicefilter.d.ts +1 -0
- package/esm/models/invoicefilter.d.ts.map +1 -1
- package/esm/models/invoicefilter.js +1 -0
- package/esm/models/invoicefilter.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/lineitemquantitychange.d.ts +8 -0
- package/esm/models/lineitemquantitychange.d.ts.map +1 -0
- package/esm/models/lineitemquantitychange.js +10 -0
- package/esm/models/lineitemquantitychange.js.map +1 -0
- package/esm/models/previewsubscriptionmodifyop.d.ts +12 -0
- package/esm/models/previewsubscriptionmodifyop.d.ts.map +1 -0
- package/esm/models/previewsubscriptionmodifyop.js +16 -0
- package/esm/models/previewsubscriptionmodifyop.js.map +1 -0
- package/esm/models/submodifyinheritancerequest.d.ts +6 -0
- package/esm/models/submodifyinheritancerequest.d.ts.map +1 -0
- package/esm/models/{executesubscriptioninheritancerequest.js → submodifyinheritancerequest.js} +2 -2
- package/esm/models/submodifyinheritancerequest.js.map +1 -0
- package/esm/models/submodifyquantitychangerequest.d.ts +7 -0
- package/esm/models/submodifyquantitychangerequest.d.ts.map +1 -0
- package/esm/models/submodifyquantitychangerequest.js +9 -0
- package/esm/models/submodifyquantitychangerequest.js.map +1 -0
- package/esm/models/subscriptionmodifyresponse.d.ts +9 -0
- package/esm/models/subscriptionmodifyresponse.d.ts.map +1 -0
- package/esm/models/subscriptionmodifyresponse.js +11 -0
- package/esm/models/subscriptionmodifyresponse.js.map +1 -0
- package/esm/models/subscriptionmodifytype.d.ts +12 -0
- package/esm/models/subscriptionmodifytype.d.ts.map +1 -0
- package/esm/models/subscriptionmodifytype.js +13 -0
- package/esm/models/subscriptionmodifytype.js.map +1 -0
- package/esm/models/subscriptionphasecreaterequest.d.ts +2 -0
- package/esm/models/subscriptionphasecreaterequest.d.ts.map +1 -1
- package/esm/models/subscriptionphasecreaterequest.js +3 -0
- package/esm/models/subscriptionphasecreaterequest.js.map +1 -1
- package/esm/models/subscriptionpricecreaterequest.d.ts +0 -2
- package/esm/models/subscriptionpricecreaterequest.d.ts.map +1 -1
- package/esm/models/subscriptionpricecreaterequest.js +0 -2
- package/esm/models/subscriptionpricecreaterequest.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 +9 -1
- package/esm/tool-names.js.map +1 -1
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/manifest.json +10 -2
- package/package.json +1 -1
- package/src/funcs/invoicesGetMeterUsagePreviewInvoice.ts +144 -0
- package/src/funcs/subscriptionsExecuteSubscriptionModify.ts +7 -7
- package/src/funcs/subscriptionsPreviewSubscriptionModify.ts +153 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/encodings.ts +9 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/invoicesGetMeterUsagePreviewInvoice.ts +47 -0
- package/src/mcp-server/tools/subscriptionsExecuteSubscriptionModify.ts +4 -4
- package/src/mcp-server/tools/subscriptionsPreviewSubscriptionModify.ts +45 -0
- package/src/models/billingcadence.ts +0 -2
- package/src/models/billingperiod.ts +2 -0
- package/src/models/changedinvoice.ts +17 -0
- package/src/models/changedlineitem.ts +25 -0
- package/src/models/changedresources.ts +28 -0
- package/src/models/changedsubscription.ts +22 -0
- package/src/models/createpricerequest.ts +0 -3
- package/src/models/createsubscriptionrequest.ts +0 -3
- package/src/models/executesubscriptionmodifyop.ts +14 -14
- package/src/models/executesubscriptionmodifyrequest.ts +31 -0
- package/src/models/getmeterusagepreviewinvoiceop.ts +21 -0
- package/src/models/invoicefilter.ts +4 -0
- package/src/models/invoiceresponse.ts +4 -0
- package/src/models/lineitemquantitychange.ts +21 -0
- package/src/models/previewsubscriptionmodifyop.ts +39 -0
- package/src/models/{executesubscriptioninheritancerequest.ts → submodifyinheritancerequest.ts} +3 -3
- package/src/models/submodifyquantitychangerequest.ts +19 -0
- package/src/models/subscriptionmodifyresponse.ts +25 -0
- package/src/models/subscriptionmodifytype.ts +17 -0
- package/src/models/subscriptionphasecreaterequest.ts +9 -0
- package/src/models/subscriptionpricecreaterequest.ts +0 -3
- package/src/models/windowsize.ts +2 -2
- package/src/tool-names.ts +9 -1
- package/esm/models/executesubscriptioninheritancerequest.d.ts +0 -6
- package/esm/models/executesubscriptioninheritancerequest.d.ts.map +0 -1
- package/esm/models/executesubscriptioninheritancerequest.js.map +0 -1
package/manifest.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"sensitive": true
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
-
"version": "2.1.
|
|
51
|
+
"version": "2.1.2",
|
|
52
52
|
"tools": [
|
|
53
53
|
{
|
|
54
54
|
"name": "update-customer",
|
|
@@ -94,6 +94,10 @@
|
|
|
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
|
+
},
|
|
97
101
|
{
|
|
98
102
|
"name": "get-invoice-preview",
|
|
99
103
|
"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."
|
|
@@ -300,7 +304,11 @@
|
|
|
300
304
|
},
|
|
301
305
|
{
|
|
302
306
|
"name": "execute-subscription-modify",
|
|
303
|
-
"description": "
|
|
307
|
+
"description": "Execute subscription modification\n\nExecute a mid-cycle subscription modification (inheritance or quantity change)."
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "preview-subscription-modify",
|
|
311
|
+
"description": "Preview subscription modification\n\nPreview the impact of a mid-cycle subscription modification without committing changes."
|
|
304
312
|
},
|
|
305
313
|
{
|
|
306
314
|
"name": "pause-subscription",
|
package/package.json
CHANGED
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
}
|
|
@@ -19,21 +19,21 @@ import {
|
|
|
19
19
|
} from "../models/errors/httpclienterrors.js";
|
|
20
20
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
ExecuteSubscriptionModifyRequestRequest,
|
|
23
|
+
ExecuteSubscriptionModifyRequestRequest$zodSchema,
|
|
24
24
|
} from "../models/executesubscriptionmodifyop.js";
|
|
25
25
|
import { APICall, APIPromise } from "../types/async.js";
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Execute subscription modification
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
*
|
|
32
|
+
* Execute a mid-cycle subscription modification (inheritance or quantity change).
|
|
33
33
|
*/
|
|
34
34
|
export function subscriptionsExecuteSubscriptionModify(
|
|
35
35
|
client$: FlexpriceCore,
|
|
36
|
-
request:
|
|
36
|
+
request: ExecuteSubscriptionModifyRequestRequest,
|
|
37
37
|
options?: RequestOptions,
|
|
38
38
|
): APIPromise<
|
|
39
39
|
Result<
|
|
@@ -56,7 +56,7 @@ export function subscriptionsExecuteSubscriptionModify(
|
|
|
56
56
|
|
|
57
57
|
async function $do(
|
|
58
58
|
client$: FlexpriceCore,
|
|
59
|
-
request:
|
|
59
|
+
request: ExecuteSubscriptionModifyRequestRequest,
|
|
60
60
|
options?: RequestOptions,
|
|
61
61
|
): Promise<
|
|
62
62
|
[
|
|
@@ -75,7 +75,7 @@ async function $do(
|
|
|
75
75
|
> {
|
|
76
76
|
const parsed$ = safeParse(
|
|
77
77
|
request,
|
|
78
|
-
(value$) =>
|
|
78
|
+
(value$) => ExecuteSubscriptionModifyRequestRequest$zodSchema.parse(value$),
|
|
79
79
|
"Input validation failed",
|
|
80
80
|
);
|
|
81
81
|
if (!parsed$.ok) {
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { FlexpriceCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } 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
|
+
PreviewSubscriptionModifyRequest,
|
|
23
|
+
PreviewSubscriptionModifyRequest$zodSchema,
|
|
24
|
+
} from "../models/previewsubscriptionmodifyop.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Preview subscription modification
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Preview the impact of a mid-cycle subscription modification without committing changes.
|
|
33
|
+
*/
|
|
34
|
+
export function subscriptionsPreviewSubscriptionModify(
|
|
35
|
+
client$: FlexpriceCore,
|
|
36
|
+
request: PreviewSubscriptionModifyRequest,
|
|
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: PreviewSubscriptionModifyRequest,
|
|
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$) => PreviewSubscriptionModifyRequest$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$.body, { explode: true });
|
|
86
|
+
|
|
87
|
+
const pathParams$ = {
|
|
88
|
+
id: encodeSimple("id", payload$.id, {
|
|
89
|
+
explode: false,
|
|
90
|
+
charEncoding: "percent",
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
const path$ = pathToFunc("/subscriptions/{id}/modify/preview")(
|
|
94
|
+
pathParams$,
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const headers$ = new Headers(compactMap({
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
}));
|
|
101
|
+
const securityInput = await extractSecurity(client$._options.security);
|
|
102
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
103
|
+
|
|
104
|
+
const context = {
|
|
105
|
+
options: client$._options,
|
|
106
|
+
baseURL: options?.serverURL ?? client$._baseURL ?? "",
|
|
107
|
+
operationID: "previewSubscriptionModify",
|
|
108
|
+
oAuth2Scopes: null,
|
|
109
|
+
resolvedSecurity: requestSecurity,
|
|
110
|
+
securitySource: client$._options.security,
|
|
111
|
+
retryConfig: options?.retries
|
|
112
|
+
|| client$._options.retryConfig
|
|
113
|
+
|| { strategy: "none" },
|
|
114
|
+
retryCodes: options?.retryCodes || [
|
|
115
|
+
"429",
|
|
116
|
+
"500",
|
|
117
|
+
"502",
|
|
118
|
+
"503",
|
|
119
|
+
"504",
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const requestRes = client$._createRequest(context, {
|
|
124
|
+
security: requestSecurity,
|
|
125
|
+
method: "POST",
|
|
126
|
+
baseURL: options?.serverURL,
|
|
127
|
+
path: path$,
|
|
128
|
+
headers: headers$,
|
|
129
|
+
body: body$,
|
|
130
|
+
userAgent: client$._options.userAgent,
|
|
131
|
+
timeoutMs: options?.timeoutMs || client$._options.timeoutMs
|
|
132
|
+
|| -1,
|
|
133
|
+
}, options);
|
|
134
|
+
if (!requestRes.ok) {
|
|
135
|
+
return [requestRes, { status: "invalid" }];
|
|
136
|
+
}
|
|
137
|
+
const req$ = requestRes.value;
|
|
138
|
+
|
|
139
|
+
const doResult = await client$._do(req$, {
|
|
140
|
+
context,
|
|
141
|
+
errorCodes: [],
|
|
142
|
+
retryConfig: context.retryConfig,
|
|
143
|
+
retryCodes: context.retryCodes,
|
|
144
|
+
});
|
|
145
|
+
if (!doResult.ok) {
|
|
146
|
+
return [doResult, { status: "request-error", request: req$ }];
|
|
147
|
+
}
|
|
148
|
+
return [doResult, {
|
|
149
|
+
status: "complete",
|
|
150
|
+
"request": req$,
|
|
151
|
+
response: doResult.value,
|
|
152
|
+
}];
|
|
153
|
+
}
|
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.879.
|
|
72
|
+
sdkVersion: "2.1.2",
|
|
73
|
+
genVersion: "2.879.11",
|
|
74
74
|
userAgent:
|
|
75
|
-
"speakeasy-sdk/mcp-typescript 2.1.
|
|
75
|
+
"speakeasy-sdk/mcp-typescript 2.1.2 2.879.11 1.0 @flexprice/mcp-server",
|
|
76
76
|
} as const;
|
package/src/lib/encodings.ts
CHANGED
|
@@ -513,3 +513,12 @@ export function appendForm(
|
|
|
513
513
|
fd.append(key, String(value));
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
+
|
|
517
|
+
export async function normalizeBlob(
|
|
518
|
+
value: Pick<Blob, "arrayBuffer" | "type">,
|
|
519
|
+
): Promise<Blob> {
|
|
520
|
+
if (value instanceof Blob) {
|
|
521
|
+
return value;
|
|
522
|
+
}
|
|
523
|
+
return new Blob([await value.arrayBuffer()], { type: value.type });
|
|
524
|
+
}
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -41,6 +41,7 @@ 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";
|
|
44
45
|
import { tool$invoicesQueryInvoice } from "./tools/invoicesQueryInvoice.js";
|
|
45
46
|
import { tool$invoicesRecalculateInvoice } from "./tools/invoicesRecalculateInvoice.js";
|
|
46
47
|
import { tool$invoicesRecalculateInvoiceV2 } from "./tools/invoicesRecalculateInvoiceV2.js";
|
|
@@ -83,6 +84,7 @@ import { tool$subscriptionsListSubscriptionPauses } from "./tools/subscriptionsL
|
|
|
83
84
|
import { tool$subscriptionsListSubscriptionSchedules } from "./tools/subscriptionsListSubscriptionSchedules.js";
|
|
84
85
|
import { tool$subscriptionsPauseSubscription } from "./tools/subscriptionsPauseSubscription.js";
|
|
85
86
|
import { tool$subscriptionsPreviewSubscriptionChange } from "./tools/subscriptionsPreviewSubscriptionChange.js";
|
|
87
|
+
import { tool$subscriptionsPreviewSubscriptionModify } from "./tools/subscriptionsPreviewSubscriptionModify.js";
|
|
86
88
|
import { tool$subscriptionsQuerySubscription } from "./tools/subscriptionsQuerySubscription.js";
|
|
87
89
|
import { tool$subscriptionsRemoveSubscriptionAddon } from "./tools/subscriptionsRemoveSubscriptionAddon.js";
|
|
88
90
|
import { tool$subscriptionsResumeSubscription } from "./tools/subscriptionsResumeSubscription.js";
|
|
@@ -102,7 +104,7 @@ export function createMCPServer(deps: {
|
|
|
102
104
|
}) {
|
|
103
105
|
const server = new McpServer({
|
|
104
106
|
name: "Flexprice",
|
|
105
|
-
version: "2.1.
|
|
107
|
+
version: "2.1.2",
|
|
106
108
|
});
|
|
107
109
|
|
|
108
110
|
const getClient = deps.getSDK || (() =>
|
|
@@ -158,6 +160,7 @@ export function createMCPServer(deps: {
|
|
|
158
160
|
tool(tool$customersGetCustomerUpcomingGrants);
|
|
159
161
|
tool(tool$invoicesGetCustomerInvoiceSummary);
|
|
160
162
|
tool(tool$invoicesCreateInvoice);
|
|
163
|
+
tool(tool$invoicesGetMeterUsagePreviewInvoice);
|
|
161
164
|
tool(tool$invoicesGetInvoicePreview);
|
|
162
165
|
tool(tool$invoicesQueryInvoice);
|
|
163
166
|
tool(tool$invoicesGetInvoice);
|
|
@@ -210,6 +213,7 @@ export function createMCPServer(deps: {
|
|
|
210
213
|
tool(tool$subscriptionsGetSubscriptionUpcomingGrants);
|
|
211
214
|
tool(tool$subscriptionsCreateSubscriptionLineItem);
|
|
212
215
|
tool(tool$subscriptionsExecuteSubscriptionModify);
|
|
216
|
+
tool(tool$subscriptionsPreviewSubscriptionModify);
|
|
213
217
|
tool(tool$subscriptionsPauseSubscription);
|
|
214
218
|
tool(tool$subscriptionsListSubscriptionPauses);
|
|
215
219
|
tool(tool$subscriptionsResumeSubscription);
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
};
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { subscriptionsExecuteSubscriptionModify } from "../../funcs/subscriptionsExecuteSubscriptionModify.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ExecuteSubscriptionModifyRequestRequest$zodSchema } from "../../models/executesubscriptionmodifyop.js";
|
|
7
7
|
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
8
|
|
|
9
9
|
const args = {
|
|
10
|
-
request:
|
|
10
|
+
request: ExecuteSubscriptionModifyRequestRequest$zodSchema,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export const tool$subscriptionsExecuteSubscriptionModify: ToolDefinition<
|
|
14
14
|
typeof args
|
|
15
15
|
> = {
|
|
16
16
|
name: "execute-subscription-modify",
|
|
17
|
-
description: `
|
|
17
|
+
description: `Execute subscription modification
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Execute a mid-cycle subscription modification (inheritance or quantity change).`,
|
|
20
20
|
scopes: ["write"],
|
|
21
21
|
annotations: {
|
|
22
22
|
"title": "",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { subscriptionsPreviewSubscriptionModify } from "../../funcs/subscriptionsPreviewSubscriptionModify.js";
|
|
6
|
+
import { PreviewSubscriptionModifyRequest$zodSchema } from "../../models/previewsubscriptionmodifyop.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: PreviewSubscriptionModifyRequest$zodSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$subscriptionsPreviewSubscriptionModify: ToolDefinition<
|
|
14
|
+
typeof args
|
|
15
|
+
> = {
|
|
16
|
+
name: "preview-subscription-modify",
|
|
17
|
+
description: `Preview subscription modification
|
|
18
|
+
|
|
19
|
+
Preview the impact of a mid-cycle subscription modification without committing changes.`,
|
|
20
|
+
scopes: ["read"],
|
|
21
|
+
annotations: {
|
|
22
|
+
"title": "",
|
|
23
|
+
"destructiveHint": false,
|
|
24
|
+
"idempotentHint": false,
|
|
25
|
+
"openWorldHint": false,
|
|
26
|
+
"readOnlyHint": true,
|
|
27
|
+
},
|
|
28
|
+
args,
|
|
29
|
+
tool: async (client, args, ctx) => {
|
|
30
|
+
const [result] = await subscriptionsPreviewSubscriptionModify(
|
|
31
|
+
client,
|
|
32
|
+
args.request,
|
|
33
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
34
|
+
).$inspect();
|
|
35
|
+
|
|
36
|
+
if (!result.ok) {
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: result.error.message }],
|
|
39
|
+
isError: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return formatResult(result.value);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -7,11 +7,9 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
7
7
|
|
|
8
8
|
export const BillingCadence = {
|
|
9
9
|
Recurring: "RECURRING",
|
|
10
|
-
Onetime: "ONETIME",
|
|
11
10
|
} as const;
|
|
12
11
|
export type BillingCadence = ClosedEnum<typeof BillingCadence>;
|
|
13
12
|
|
|
14
13
|
export const BillingCadence$zodSchema = z.enum([
|
|
15
14
|
"RECURRING",
|
|
16
|
-
"ONETIME",
|
|
17
15
|
]);
|
|
@@ -12,6 +12,7 @@ export const BillingPeriod = {
|
|
|
12
12
|
Daily: "DAILY",
|
|
13
13
|
Quarterly: "QUARTERLY",
|
|
14
14
|
HalfYearly: "HALF_YEARLY",
|
|
15
|
+
Onetime: "ONETIME",
|
|
15
16
|
} as const;
|
|
16
17
|
export type BillingPeriod = ClosedEnum<typeof BillingPeriod>;
|
|
17
18
|
|
|
@@ -22,4 +23,5 @@ export const BillingPeriod$zodSchema = z.enum([
|
|
|
22
23
|
"DAILY",
|
|
23
24
|
"QUARTERLY",
|
|
24
25
|
"HALF_YEARLY",
|
|
26
|
+
"ONETIME",
|
|
25
27
|
]);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
export type ChangedInvoice = {
|
|
8
|
+
action?: string | undefined;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
status?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ChangedInvoice$zodSchema: z.ZodType<ChangedInvoice> = z.object({
|
|
14
|
+
action: z.string().optional().describe("\"created\" | \"wallet_credit\""),
|
|
15
|
+
id: z.string().optional(),
|
|
16
|
+
status: z.string().optional(),
|
|
17
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
export type ChangedLineItem = {
|
|
8
|
+
change_action?: string | undefined;
|
|
9
|
+
end_date?: string | undefined;
|
|
10
|
+
id?: string | undefined;
|
|
11
|
+
price_id?: string | undefined;
|
|
12
|
+
quantity?: string | undefined;
|
|
13
|
+
start_date?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ChangedLineItem$zodSchema: z.ZodType<ChangedLineItem> = z.object({
|
|
17
|
+
change_action: z.string().optional().describe(
|
|
18
|
+
"\"created\" | \"updated\" | \"ended\"",
|
|
19
|
+
),
|
|
20
|
+
end_date: z.iso.datetime({ offset: true }).optional(),
|
|
21
|
+
id: z.string().optional(),
|
|
22
|
+
price_id: z.string().optional(),
|
|
23
|
+
quantity: z.string().optional(),
|
|
24
|
+
start_date: z.iso.datetime({ offset: true }).optional(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { ChangedInvoice, ChangedInvoice$zodSchema } from "./changedinvoice.js";
|
|
7
|
+
import {
|
|
8
|
+
ChangedLineItem,
|
|
9
|
+
ChangedLineItem$zodSchema,
|
|
10
|
+
} from "./changedlineitem.js";
|
|
11
|
+
import {
|
|
12
|
+
ChangedSubscription,
|
|
13
|
+
ChangedSubscription$zodSchema,
|
|
14
|
+
} from "./changedsubscription.js";
|
|
15
|
+
|
|
16
|
+
export type ChangedResources = {
|
|
17
|
+
invoices?: Array<ChangedInvoice> | undefined;
|
|
18
|
+
line_items?: Array<ChangedLineItem> | undefined;
|
|
19
|
+
subscriptions?: Array<ChangedSubscription> | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ChangedResources$zodSchema: z.ZodType<ChangedResources> = z.object(
|
|
23
|
+
{
|
|
24
|
+
invoices: z.array(ChangedInvoice$zodSchema).optional(),
|
|
25
|
+
line_items: z.array(ChangedLineItem$zodSchema).optional(),
|
|
26
|
+
subscriptions: z.array(ChangedSubscription$zodSchema).optional(),
|
|
27
|
+
},
|
|
28
|
+
);
|