@flexprice/mcp-server 2.1.24 → 2.1.26
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 +1299 -637
- package/bin/mcp-server.js.map +38 -27
- package/bun.lock +43 -49
- package/esm/funcs/subscriptionsExecuteSubscriptionPlanChangeV2.d.ts +8 -0
- package/esm/funcs/subscriptionsExecuteSubscriptionPlanChangeV2.d.ts.map +1 -1
- package/esm/funcs/subscriptionsExecuteSubscriptionPlanChangeV2.js +8 -0
- package/esm/funcs/subscriptionsExecuteSubscriptionPlanChangeV2.js.map +1 -1
- 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.js +1 -1
- package/esm/mcp-server/tools/subscriptionsExecuteSubscriptionPlanChangeV2.d.ts.map +1 -1
- package/esm/mcp-server/tools/subscriptionsExecuteSubscriptionPlanChangeV2.js +9 -1
- package/esm/mcp-server/tools/subscriptionsExecuteSubscriptionPlanChangeV2.js.map +1 -1
- package/esm/models/billingperiodbehaviour.d.ts +14 -0
- package/esm/models/billingperiodbehaviour.d.ts.map +1 -0
- package/esm/models/billingperiodbehaviour.js +15 -0
- package/esm/models/billingperiodbehaviour.js.map +1 -0
- package/esm/models/billingperiodconfig.d.ts +11 -0
- package/esm/models/billingperiodconfig.d.ts.map +1 -0
- package/esm/models/billingperiodconfig.js +14 -0
- package/esm/models/billingperiodconfig.js.map +1 -0
- package/esm/models/creditgrantapplicationresponse.d.ts +1 -1
- package/esm/models/creditgrantapplicationresponse.js +1 -1
- package/esm/models/entitlementgrantallocationbehavior.d.ts +12 -0
- package/esm/models/entitlementgrantallocationbehavior.d.ts.map +1 -0
- package/esm/models/entitlementgrantallocationbehavior.js +13 -0
- package/esm/models/entitlementgrantallocationbehavior.js.map +1 -0
- package/esm/models/entitlementgrantdurationunit.d.ts +2 -0
- package/esm/models/entitlementgrantdurationunit.d.ts.map +1 -1
- package/esm/models/entitlementgrantdurationunit.js +2 -0
- package/esm/models/entitlementgrantdurationunit.js.map +1 -1
- package/esm/models/entitlementresponse.d.ts +3 -1
- package/esm/models/entitlementresponse.d.ts.map +1 -1
- package/esm/models/entitlementresponse.js +4 -1
- package/esm/models/entitlementresponse.js.map +1 -1
- package/esm/models/entitychangebehaviour.d.ts +2 -0
- package/esm/models/entitychangebehaviour.d.ts.map +1 -1
- package/esm/models/entitychangebehaviour.js +2 -0
- package/esm/models/entitychangebehaviour.js.map +1 -1
- package/esm/models/entitychangepolicy.js +1 -1
- package/esm/models/entitychangepolicy.js.map +1 -1
- package/esm/models/entitychangeresult.d.ts +2 -2
- package/esm/models/entitychangeresult.d.ts.map +1 -1
- package/esm/models/entitychangeresult.js +2 -2
- package/esm/models/entitychangeresult.js.map +1 -1
- package/esm/models/integrationentitytype.d.ts +2 -0
- package/esm/models/integrationentitytype.d.ts.map +1 -1
- package/esm/models/integrationentitytype.js +2 -0
- package/esm/models/integrationentitytype.js.map +1 -1
- package/esm/models/onpendingschedulepolicy.d.ts +12 -0
- package/esm/models/onpendingschedulepolicy.d.ts.map +1 -0
- package/esm/models/onpendingschedulepolicy.js +13 -0
- package/esm/models/onpendingschedulepolicy.js.map +1 -0
- package/esm/models/planpricesyncstatusresponse.d.ts +8 -0
- package/esm/models/planpricesyncstatusresponse.d.ts.map +1 -0
- package/esm/models/planpricesyncstatusresponse.js +10 -0
- package/esm/models/planpricesyncstatusresponse.js.map +1 -0
- package/esm/models/planresponse.d.ts +2 -0
- package/esm/models/planresponse.d.ts.map +1 -1
- package/esm/models/planresponse.js +2 -0
- package/esm/models/planresponse.js.map +1 -1
- package/esm/models/pricefeatureresponse.d.ts +7 -0
- package/esm/models/pricefeatureresponse.d.ts.map +1 -0
- package/esm/models/pricefeatureresponse.js +10 -0
- package/esm/models/pricefeatureresponse.js.map +1 -0
- package/esm/models/priceresponse.d.ts +2 -0
- package/esm/models/priceresponse.d.ts.map +1 -1
- package/esm/models/priceresponse.js +2 -0
- package/esm/models/priceresponse.js.map +1 -1
- package/esm/models/subscriptionchangebillingperiodresult.d.ts +10 -0
- package/esm/models/subscriptionchangebillingperiodresult.d.ts.map +1 -0
- package/esm/models/subscriptionchangebillingperiodresult.js +12 -0
- package/esm/models/subscriptionchangebillingperiodresult.js.map +1 -0
- package/esm/models/subscriptionchangeconflictpolicies.d.ts +7 -0
- package/esm/models/subscriptionchangeconflictpolicies.d.ts.map +1 -0
- package/esm/models/subscriptionchangeconflictpolicies.js +9 -0
- package/esm/models/subscriptionchangeconflictpolicies.js.map +1 -0
- package/esm/models/subscriptionchangeentitytype.d.ts +18 -0
- package/esm/models/subscriptionchangeentitytype.d.ts.map +1 -0
- package/esm/models/subscriptionchangeentitytype.js +19 -0
- package/esm/models/subscriptionchangeentitytype.js.map +1 -0
- package/esm/models/subscriptionchangev2request.d.ts +8 -0
- package/esm/models/subscriptionchangev2request.d.ts.map +1 -1
- package/esm/models/subscriptionchangev2request.js +8 -0
- package/esm/models/subscriptionchangev2request.js.map +1 -1
- package/esm/models/subscriptionchangev2response.d.ts +6 -0
- package/esm/models/subscriptionchangev2response.d.ts.map +1 -1
- package/esm/models/subscriptionchangev2response.js +6 -0
- package/esm/models/subscriptionchangev2response.js.map +1 -1
- package/esm/tool-names.js +1 -1
- package/esm/tool-names.js.map +1 -1
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/src/funcs/subscriptionsExecuteSubscriptionPlanChangeV2.ts +8 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/subscriptionsExecuteSubscriptionPlanChangeV2.ts +9 -1
- package/src/models/billingperiodbehaviour.ts +19 -0
- package/src/models/billingperiodconfig.ts +22 -0
- package/src/models/creditgrantapplicationresponse.ts +2 -2
- package/src/models/entitlementgrantallocationbehavior.ts +19 -0
- package/src/models/entitlementgrantdurationunit.ts +2 -0
- package/src/models/entitlementresponse.ts +9 -2
- package/src/models/entitychangebehaviour.ts +2 -0
- package/src/models/entitychangepolicy.ts +1 -1
- package/src/models/entitychangeresult.ts +5 -5
- package/src/models/integrationentitytype.ts +2 -0
- package/src/models/onpendingschedulepolicy.ts +19 -0
- package/src/models/planpricesyncstatusresponse.ts +19 -0
- package/src/models/planresponse.ts +6 -0
- package/src/models/pricefeatureresponse.ts +15 -0
- package/src/models/priceresponse.ts +6 -0
- package/src/models/subscriptionchangebillingperiodresult.ts +25 -0
- package/src/models/subscriptionchangeconflictpolicies.ts +19 -0
- package/src/models/subscriptionchangeentitytype.ts +25 -0
- package/src/models/subscriptionchangev2request.ts +21 -0
- package/src/models/subscriptionchangev2response.ts +18 -0
- package/src/tool-names.ts +1 -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.26",
|
|
52
52
|
"tools": [
|
|
53
53
|
{
|
|
54
54
|
"name": "update-customer",
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
"name": "execute-subscription-plan-change-v2",
|
|
303
|
-
"description": "Execute a plan change (v2, swap in place)\n\nChange a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction."
|
|
303
|
+
"description": "Execute a plan change (v2, swap in place)\n\nChange a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction.\n\nchange_at controls timing. Omitted or 'immediate' applies the change now. 'end_of_period' records a pending schedule that executes at the subscription's current period end: the response returns is_scheduled, schedule_id and scheduled_at instead of a completed change, and nothing is swapped or billed until the boundary.\n\nscheduled_at is resolved from the subscription's current period end at request time. If that period end is already in the past (a backdated start date, a resumed pause, or worker downtime can all leave a subscription behind), the change is due immediately and fires on the next billing scan rather than a period away — inspect scheduled_at to see this.\n\nOnly one plan change may be pending per subscription. By default (on_conflict_policies.on_pending_schedule = 'reject') a second request returns 400; cancel the existing schedule via POST /subscriptions/schedules/{schedule_id}/cancel first. Pending schedules are listable via GET /subscriptions/{id}/schedules.\n\nSet on_conflict_policies.on_pending_schedule to 'supersede' to replace the queued change instead: the pending schedule is cancelled and this request applied in the same transaction, so both land or neither does. The cancelled schedule ids are returned in superseded_schedules, and preview reports the same list without writing."
|
|
304
304
|
},
|
|
305
305
|
{
|
|
306
306
|
"name": "preview-subscription-plan-change-v2",
|
package/package.json
CHANGED
|
@@ -30,6 +30,14 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* Change a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction.
|
|
33
|
+
*
|
|
34
|
+
* change_at controls timing. Omitted or 'immediate' applies the change now. 'end_of_period' records a pending schedule that executes at the subscription's current period end: the response returns is_scheduled, schedule_id and scheduled_at instead of a completed change, and nothing is swapped or billed until the boundary.
|
|
35
|
+
*
|
|
36
|
+
* scheduled_at is resolved from the subscription's current period end at request time. If that period end is already in the past (a backdated start date, a resumed pause, or worker downtime can all leave a subscription behind), the change is due immediately and fires on the next billing scan rather than a period away — inspect scheduled_at to see this.
|
|
37
|
+
*
|
|
38
|
+
* Only one plan change may be pending per subscription. By default (on_conflict_policies.on_pending_schedule = 'reject') a second request returns 400; cancel the existing schedule via POST /subscriptions/schedules/{schedule_id}/cancel first. Pending schedules are listable via GET /subscriptions/{id}/schedules.
|
|
39
|
+
*
|
|
40
|
+
* Set on_conflict_policies.on_pending_schedule to 'supersede' to replace the queued change instead: the pending schedule is cancelled and this request applied in the same transaction, so both land or neither does. The cancelled schedule ids are returned in superseded_schedules, and preview reports the same list without writing.
|
|
33
41
|
*/
|
|
34
42
|
export function subscriptionsExecuteSubscriptionPlanChangeV2(
|
|
35
43
|
client$: FlexpriceCore,
|
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.26",
|
|
73
|
+
genVersion: "2.932.9",
|
|
74
74
|
userAgent:
|
|
75
|
-
"speakeasy-sdk/mcp-typescript 2.1.
|
|
75
|
+
"speakeasy-sdk/mcp-typescript 2.1.26 2.932.9 1.0 @flexprice/mcp-server",
|
|
76
76
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -16,7 +16,15 @@ export const tool$subscriptionsExecuteSubscriptionPlanChangeV2: ToolDefinition<
|
|
|
16
16
|
name: "execute-subscription-plan-change-v2",
|
|
17
17
|
description: `Execute a plan change (v2, swap in place)
|
|
18
18
|
|
|
19
|
-
Change a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction
|
|
19
|
+
Change a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction.
|
|
20
|
+
|
|
21
|
+
change_at controls timing. Omitted or 'immediate' applies the change now. 'end_of_period' records a pending schedule that executes at the subscription's current period end: the response returns is_scheduled, schedule_id and scheduled_at instead of a completed change, and nothing is swapped or billed until the boundary.
|
|
22
|
+
|
|
23
|
+
scheduled_at is resolved from the subscription's current period end at request time. If that period end is already in the past (a backdated start date, a resumed pause, or worker downtime can all leave a subscription behind), the change is due immediately and fires on the next billing scan rather than a period away — inspect scheduled_at to see this.
|
|
24
|
+
|
|
25
|
+
Only one plan change may be pending per subscription. By default (on_conflict_policies.on_pending_schedule = 'reject') a second request returns 400; cancel the existing schedule via POST /subscriptions/schedules/{schedule_id}/cancel first. Pending schedules are listable via GET /subscriptions/{id}/schedules.
|
|
26
|
+
|
|
27
|
+
Set on_conflict_policies.on_pending_schedule to 'supersede' to replace the queued change instead: the pending schedule is cancelled and this request applied in the same transaction, so both land or neither does. The cancelled schedule ids are returned in superseded_schedules, and preview reports the same list without writing.`,
|
|
20
28
|
scopes: ["write"],
|
|
21
29
|
annotations: {
|
|
22
30
|
"title": "",
|
|
@@ -0,0 +1,19 @@
|
|
|
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 BillingPeriodBehaviour = {
|
|
9
|
+
Unchanged: "unchanged",
|
|
10
|
+
AnchorAtEffect: "anchor_at_effect",
|
|
11
|
+
AnchorAtConfig: "anchor_at_config",
|
|
12
|
+
} as const;
|
|
13
|
+
export type BillingPeriodBehaviour = ClosedEnum<typeof BillingPeriodBehaviour>;
|
|
14
|
+
|
|
15
|
+
export const BillingPeriodBehaviour$zodSchema = z.enum([
|
|
16
|
+
"unchanged",
|
|
17
|
+
"anchor_at_effect",
|
|
18
|
+
"anchor_at_config",
|
|
19
|
+
]);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { BillingCycle, BillingCycle$zodSchema } from "./billingcycle.js";
|
|
7
|
+
import { BillingPeriod, BillingPeriod$zodSchema } from "./billingperiod.js";
|
|
8
|
+
|
|
9
|
+
export type BillingPeriodConfig = {
|
|
10
|
+
billing_anchor?: string | undefined;
|
|
11
|
+
billing_cycle?: BillingCycle | undefined;
|
|
12
|
+
billing_period_count?: number | undefined;
|
|
13
|
+
billing_period_unit?: BillingPeriod | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const BillingPeriodConfig$zodSchema: z.ZodType<BillingPeriodConfig> = z
|
|
17
|
+
.object({
|
|
18
|
+
billing_anchor: z.iso.datetime({ offset: true }).optional(),
|
|
19
|
+
billing_cycle: BillingCycle$zodSchema.optional(),
|
|
20
|
+
billing_period_count: z.int().optional(),
|
|
21
|
+
billing_period_unit: BillingPeriod$zodSchema.optional(),
|
|
22
|
+
});
|
|
@@ -24,7 +24,7 @@ export type CreditGrantApplicationResponse = {
|
|
|
24
24
|
created_at?: string | undefined;
|
|
25
25
|
created_by?: string | undefined;
|
|
26
26
|
credit_grant_id?: string | undefined;
|
|
27
|
-
credits?:
|
|
27
|
+
credits?: string | undefined;
|
|
28
28
|
environment_id?: string | undefined;
|
|
29
29
|
failure_reason?: string | undefined;
|
|
30
30
|
id?: string | undefined;
|
|
@@ -51,7 +51,7 @@ export const CreditGrantApplicationResponse$zodSchema: z.ZodType<
|
|
|
51
51
|
created_at: z.iso.datetime({ offset: true }).optional(),
|
|
52
52
|
created_by: z.string().optional(),
|
|
53
53
|
credit_grant_id: z.string().optional(),
|
|
54
|
-
credits: z.
|
|
54
|
+
credits: z.string().optional(),
|
|
55
55
|
environment_id: z.string().optional(),
|
|
56
56
|
failure_reason: z.string().optional(),
|
|
57
57
|
id: z.string().optional(),
|
|
@@ -0,0 +1,19 @@
|
|
|
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 EntitlementGrantAllocationBehavior = {
|
|
9
|
+
FirstUsage: "first_usage",
|
|
10
|
+
UnitStart: "unit_start",
|
|
11
|
+
} as const;
|
|
12
|
+
export type EntitlementGrantAllocationBehavior = ClosedEnum<
|
|
13
|
+
typeof EntitlementGrantAllocationBehavior
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
export const EntitlementGrantAllocationBehavior$zodSchema = z.enum([
|
|
17
|
+
"first_usage",
|
|
18
|
+
"unit_start",
|
|
19
|
+
]);
|
|
@@ -9,6 +9,7 @@ export const EntitlementGrantDurationUnit = {
|
|
|
9
9
|
Hour: "hour",
|
|
10
10
|
Day: "day",
|
|
11
11
|
Week: "week",
|
|
12
|
+
SubscriptionPeriod: "subscription_period",
|
|
12
13
|
} as const;
|
|
13
14
|
export type EntitlementGrantDurationUnit = ClosedEnum<
|
|
14
15
|
typeof EntitlementGrantDurationUnit
|
|
@@ -18,4 +19,5 @@ export const EntitlementGrantDurationUnit$zodSchema = z.enum([
|
|
|
18
19
|
"hour",
|
|
19
20
|
"day",
|
|
20
21
|
"week",
|
|
22
|
+
"subscription_period",
|
|
21
23
|
]);
|
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
EntitlementEntityType,
|
|
13
13
|
EntitlementEntityType$zodSchema,
|
|
14
14
|
} from "./entitlemententitytype.js";
|
|
15
|
+
import {
|
|
16
|
+
EntitlementGrantAllocationBehavior,
|
|
17
|
+
EntitlementGrantAllocationBehavior$zodSchema,
|
|
18
|
+
} from "./entitlementgrantallocationbehavior.js";
|
|
15
19
|
import {
|
|
16
20
|
EntitlementGrantDurationUnit,
|
|
17
21
|
EntitlementGrantDurationUnit$zodSchema,
|
|
@@ -46,10 +50,11 @@ export type EntitlementResponse = {
|
|
|
46
50
|
feature?: FeatureResponse | undefined;
|
|
47
51
|
feature_id?: string | undefined;
|
|
48
52
|
feature_type?: FeatureType | undefined;
|
|
53
|
+
grant_allocation_behavior?: EntitlementGrantAllocationBehavior | undefined;
|
|
49
54
|
grant_duration_unit?: EntitlementGrantDurationUnit | undefined;
|
|
50
55
|
grant_duration_value?: number | undefined;
|
|
51
56
|
grant_measure?: EntitlementGrantMeasure | undefined;
|
|
52
|
-
grant_quota?:
|
|
57
|
+
grant_quota?: string | undefined;
|
|
53
58
|
id?: string | undefined;
|
|
54
59
|
is_enabled?: boolean | undefined;
|
|
55
60
|
is_soft_limit?: boolean | undefined;
|
|
@@ -81,10 +86,12 @@ export const EntitlementResponse$zodSchema: z.ZodType<EntitlementResponse> = z
|
|
|
81
86
|
feature: FeatureResponse$zodSchema.optional(),
|
|
82
87
|
feature_id: z.string().optional(),
|
|
83
88
|
feature_type: FeatureType$zodSchema.optional(),
|
|
89
|
+
grant_allocation_behavior: EntitlementGrantAllocationBehavior$zodSchema
|
|
90
|
+
.optional(),
|
|
84
91
|
grant_duration_unit: EntitlementGrantDurationUnit$zodSchema.optional(),
|
|
85
92
|
grant_duration_value: z.int().optional(),
|
|
86
93
|
grant_measure: EntitlementGrantMeasure$zodSchema.optional(),
|
|
87
|
-
grant_quota: z.
|
|
94
|
+
grant_quota: z.string().optional(),
|
|
88
95
|
id: z.string().optional(),
|
|
89
96
|
is_enabled: z.boolean().optional(),
|
|
90
97
|
is_soft_limit: z.boolean().optional(),
|
|
@@ -8,10 +8,12 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
8
8
|
export const EntityChangeBehaviour = {
|
|
9
9
|
Carry: "carry",
|
|
10
10
|
Drop: "drop",
|
|
11
|
+
Add: "add",
|
|
11
12
|
} as const;
|
|
12
13
|
export type EntityChangeBehaviour = ClosedEnum<typeof EntityChangeBehaviour>;
|
|
13
14
|
|
|
14
15
|
export const EntityChangeBehaviour$zodSchema = z.enum([
|
|
15
16
|
"carry",
|
|
16
17
|
"drop",
|
|
18
|
+
"add",
|
|
17
19
|
]);
|
|
@@ -18,6 +18,6 @@ export const EntityChangePolicy$zodSchema: z.ZodType<EntityChangePolicy> = z
|
|
|
18
18
|
default_behaviour: EntityChangeBehaviour$zodSchema.optional(),
|
|
19
19
|
overrides: z.record(z.string(), EntityChangeBehaviour$zodSchema).optional()
|
|
20
20
|
.describe(
|
|
21
|
-
"Overrides is keyed by addon_associations.id (instance), not catalogue addon_id.",
|
|
21
|
+
"Overrides is keyed by addon_associations.id (instance), not catalogue addon_id.\nThat is the id an EntityChangeResult reports as EntityID.",
|
|
22
22
|
),
|
|
23
23
|
});
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
EntityChangeBehaviour$zodSchema,
|
|
9
9
|
} from "./entitychangebehaviour.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./
|
|
11
|
+
SubscriptionChangeEntityType,
|
|
12
|
+
SubscriptionChangeEntityType$zodSchema,
|
|
13
|
+
} from "./subscriptionchangeentitytype.js";
|
|
14
14
|
|
|
15
15
|
export type EntityChangeResult = {
|
|
16
16
|
behaviour?: EntityChangeBehaviour | undefined;
|
|
17
17
|
entity_id?: string | undefined;
|
|
18
|
-
entity_type?:
|
|
18
|
+
entity_type?: SubscriptionChangeEntityType | undefined;
|
|
19
19
|
reference_id?: string | undefined;
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -23,6 +23,6 @@ export const EntityChangeResult$zodSchema: z.ZodType<EntityChangeResult> = z
|
|
|
23
23
|
.object({
|
|
24
24
|
behaviour: EntityChangeBehaviour$zodSchema.optional(),
|
|
25
25
|
entity_id: z.string().optional(),
|
|
26
|
-
entity_type:
|
|
26
|
+
entity_type: SubscriptionChangeEntityType$zodSchema.optional(),
|
|
27
27
|
reference_id: z.string().optional(),
|
|
28
28
|
});
|
|
@@ -17,6 +17,7 @@ export const IntegrationEntityType = {
|
|
|
17
17
|
ItemPrice: "item_price",
|
|
18
18
|
Price: "price",
|
|
19
19
|
InvoiceLineItem: "invoice_line_item",
|
|
20
|
+
SubscriptionLineItem: "subscription_line_item",
|
|
20
21
|
} as const;
|
|
21
22
|
export type IntegrationEntityType = ClosedEnum<typeof IntegrationEntityType>;
|
|
22
23
|
|
|
@@ -32,4 +33,5 @@ export const IntegrationEntityType$zodSchema = z.enum([
|
|
|
32
33
|
"item_price",
|
|
33
34
|
"price",
|
|
34
35
|
"invoice_line_item",
|
|
36
|
+
"subscription_line_item",
|
|
35
37
|
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
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 OnPendingSchedulePolicy = {
|
|
9
|
+
Reject: "reject",
|
|
10
|
+
Supersede: "supersede",
|
|
11
|
+
} as const;
|
|
12
|
+
export type OnPendingSchedulePolicy = ClosedEnum<
|
|
13
|
+
typeof OnPendingSchedulePolicy
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
export const OnPendingSchedulePolicy$zodSchema = z.enum([
|
|
17
|
+
"reject",
|
|
18
|
+
"supersede",
|
|
19
|
+
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
export type PlanPriceSyncStatusResponse = {
|
|
8
|
+
current_sequence?: number | undefined;
|
|
9
|
+
synced?: boolean | undefined;
|
|
10
|
+
unsynced_subscription_count?: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const PlanPriceSyncStatusResponse$zodSchema: z.ZodType<
|
|
14
|
+
PlanPriceSyncStatusResponse
|
|
15
|
+
> = z.object({
|
|
16
|
+
current_sequence: z.int().optional(),
|
|
17
|
+
synced: z.boolean().optional(),
|
|
18
|
+
unsynced_subscription_count: z.int().optional(),
|
|
19
|
+
});
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
EntitlementResponse,
|
|
12
12
|
EntitlementResponse$zodSchema,
|
|
13
13
|
} from "./entitlementresponse.js";
|
|
14
|
+
import {
|
|
15
|
+
PlanPriceSyncStatusResponse,
|
|
16
|
+
PlanPriceSyncStatusResponse$zodSchema,
|
|
17
|
+
} from "./planpricesyncstatusresponse.js";
|
|
14
18
|
import { PriceResponse, PriceResponse$zodSchema } from "./priceresponse.js";
|
|
15
19
|
import { Status, Status$zodSchema } from "./status.js";
|
|
16
20
|
|
|
@@ -26,6 +30,7 @@ export type PlanResponse = {
|
|
|
26
30
|
lookup_key?: string | undefined;
|
|
27
31
|
metadata?: { [k: string]: string } | undefined;
|
|
28
32
|
name?: string | undefined;
|
|
33
|
+
price_sync_status?: PlanPriceSyncStatusResponse | undefined;
|
|
29
34
|
prices?: Array<PriceResponse> | undefined;
|
|
30
35
|
status?: Status | undefined;
|
|
31
36
|
tenant_id?: string | undefined;
|
|
@@ -45,6 +50,7 @@ export const PlanResponse$zodSchema: z.ZodType<PlanResponse> = z.object({
|
|
|
45
50
|
lookup_key: z.string().optional(),
|
|
46
51
|
metadata: z.record(z.string(), z.string()).optional(),
|
|
47
52
|
name: z.string().optional(),
|
|
53
|
+
price_sync_status: PlanPriceSyncStatusResponse$zodSchema.optional(),
|
|
48
54
|
prices: z.array(z.lazy(() => PriceResponse$zodSchema)).optional().describe(
|
|
49
55
|
"TODO: Add inline addons",
|
|
50
56
|
),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { ReportingUnit, ReportingUnit$zodSchema } from "./reportingunit.js";
|
|
7
|
+
|
|
8
|
+
export type PriceFeatureResponse = {
|
|
9
|
+
reporting_unit?: ReportingUnit | undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const PriceFeatureResponse$zodSchema: z.ZodType<PriceFeatureResponse> = z
|
|
13
|
+
.object({
|
|
14
|
+
reporting_unit: ReportingUnit$zodSchema.optional(),
|
|
15
|
+
});
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
PriceEntityType,
|
|
17
17
|
PriceEntityType$zodSchema,
|
|
18
18
|
} from "./priceentitytype.js";
|
|
19
|
+
import {
|
|
20
|
+
PriceFeatureResponse,
|
|
21
|
+
PriceFeatureResponse$zodSchema,
|
|
22
|
+
} from "./pricefeatureresponse.js";
|
|
19
23
|
import {
|
|
20
24
|
PriceJSONBTransformQuantity,
|
|
21
25
|
PriceJSONBTransformQuantity$zodSchema,
|
|
@@ -48,6 +52,7 @@ export type PriceResponse = {
|
|
|
48
52
|
entity_id?: string | undefined;
|
|
49
53
|
entity_type?: PriceEntityType | undefined;
|
|
50
54
|
environment_id?: string | undefined;
|
|
55
|
+
feature?: PriceFeatureResponse | undefined;
|
|
51
56
|
group?: GroupResponse | undefined;
|
|
52
57
|
group_id?: string | undefined;
|
|
53
58
|
id?: string | undefined;
|
|
@@ -117,6 +122,7 @@ export const PriceResponse$zodSchema: z.ZodType<PriceResponse> = z.object({
|
|
|
117
122
|
environment_id: z.string().optional().describe(
|
|
118
123
|
"EnvironmentID is the environment identifier for the price",
|
|
119
124
|
),
|
|
125
|
+
feature: PriceFeatureResponse$zodSchema.optional(),
|
|
120
126
|
group: GroupResponse$zodSchema.optional(),
|
|
121
127
|
group_id: z.string().optional().describe(
|
|
122
128
|
"GroupID references the group this price belongs to",
|
|
@@ -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
|
+
import {
|
|
7
|
+
BillingPeriodBehaviour,
|
|
8
|
+
BillingPeriodBehaviour$zodSchema,
|
|
9
|
+
} from "./billingperiodbehaviour.js";
|
|
10
|
+
|
|
11
|
+
export type SubscriptionChangeBillingPeriodResult = {
|
|
12
|
+
behaviour?: BillingPeriodBehaviour | undefined;
|
|
13
|
+
billing_anchor?: string | undefined;
|
|
14
|
+
current_period_end?: string | undefined;
|
|
15
|
+
current_period_start?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const SubscriptionChangeBillingPeriodResult$zodSchema: z.ZodType<
|
|
19
|
+
SubscriptionChangeBillingPeriodResult
|
|
20
|
+
> = z.object({
|
|
21
|
+
behaviour: BillingPeriodBehaviour$zodSchema.optional(),
|
|
22
|
+
billing_anchor: z.iso.datetime({ offset: true }).optional(),
|
|
23
|
+
current_period_end: z.iso.datetime({ offset: true }).optional(),
|
|
24
|
+
current_period_start: z.iso.datetime({ offset: true }).optional(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import {
|
|
7
|
+
OnPendingSchedulePolicy,
|
|
8
|
+
OnPendingSchedulePolicy$zodSchema,
|
|
9
|
+
} from "./onpendingschedulepolicy.js";
|
|
10
|
+
|
|
11
|
+
export type SubscriptionChangeConflictPolicies = {
|
|
12
|
+
on_pending_schedule?: OnPendingSchedulePolicy | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const SubscriptionChangeConflictPolicies$zodSchema: z.ZodType<
|
|
16
|
+
SubscriptionChangeConflictPolicies
|
|
17
|
+
> = z.object({
|
|
18
|
+
on_pending_schedule: OnPendingSchedulePolicy$zodSchema.optional(),
|
|
19
|
+
});
|
|
@@ -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
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const SubscriptionChangeEntityType = {
|
|
9
|
+
Plan: "plan",
|
|
10
|
+
Addon: "addon",
|
|
11
|
+
CreditGrant: "credit_grant",
|
|
12
|
+
Entitlement: "entitlement",
|
|
13
|
+
EntitlementGrant: "entitlement_grant",
|
|
14
|
+
} as const;
|
|
15
|
+
export type SubscriptionChangeEntityType = ClosedEnum<
|
|
16
|
+
typeof SubscriptionChangeEntityType
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export const SubscriptionChangeEntityType$zodSchema = z.enum([
|
|
20
|
+
"plan",
|
|
21
|
+
"addon",
|
|
22
|
+
"credit_grant",
|
|
23
|
+
"entitlement",
|
|
24
|
+
"entitlement_grant",
|
|
25
|
+
]);
|
|
@@ -3,19 +3,36 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod";
|
|
6
|
+
import {
|
|
7
|
+
BillingPeriodBehaviour,
|
|
8
|
+
BillingPeriodBehaviour$zodSchema,
|
|
9
|
+
} from "./billingperiodbehaviour.js";
|
|
10
|
+
import {
|
|
11
|
+
BillingPeriodConfig,
|
|
12
|
+
BillingPeriodConfig$zodSchema,
|
|
13
|
+
} from "./billingperiodconfig.js";
|
|
6
14
|
import {
|
|
7
15
|
ProrationBehavior,
|
|
8
16
|
ProrationBehavior$zodSchema,
|
|
9
17
|
} from "./prorationbehavior.js";
|
|
18
|
+
import { ScheduleType, ScheduleType$zodSchema } from "./scheduletype.js";
|
|
19
|
+
import {
|
|
20
|
+
SubscriptionChangeConflictPolicies,
|
|
21
|
+
SubscriptionChangeConflictPolicies$zodSchema,
|
|
22
|
+
} from "./subscriptionchangeconflictpolicies.js";
|
|
10
23
|
import {
|
|
11
24
|
SubscriptionChangeEntityPolicies,
|
|
12
25
|
SubscriptionChangeEntityPolicies$zodSchema,
|
|
13
26
|
} from "./subscriptionchangeentitypolicies.js";
|
|
14
27
|
|
|
15
28
|
export type SubscriptionChangeV2Request = {
|
|
29
|
+
billing_period_behaviour?: BillingPeriodBehaviour | undefined;
|
|
30
|
+
billing_period_config?: BillingPeriodConfig | undefined;
|
|
31
|
+
change_at?: ScheduleType | undefined;
|
|
16
32
|
entity_policies?: SubscriptionChangeEntityPolicies | undefined;
|
|
17
33
|
idempotency_key?: string | undefined;
|
|
18
34
|
metadata?: { [k: string]: string } | undefined;
|
|
35
|
+
on_conflict_policies?: SubscriptionChangeConflictPolicies | undefined;
|
|
19
36
|
proration_behavior: ProrationBehavior;
|
|
20
37
|
target_plan_id: string;
|
|
21
38
|
};
|
|
@@ -23,9 +40,13 @@ export type SubscriptionChangeV2Request = {
|
|
|
23
40
|
export const SubscriptionChangeV2Request$zodSchema: z.ZodType<
|
|
24
41
|
SubscriptionChangeV2Request
|
|
25
42
|
> = z.object({
|
|
43
|
+
billing_period_behaviour: BillingPeriodBehaviour$zodSchema.optional(),
|
|
44
|
+
billing_period_config: BillingPeriodConfig$zodSchema.optional(),
|
|
45
|
+
change_at: ScheduleType$zodSchema.optional(),
|
|
26
46
|
entity_policies: SubscriptionChangeEntityPolicies$zodSchema.optional(),
|
|
27
47
|
idempotency_key: z.string().optional(),
|
|
28
48
|
metadata: z.record(z.string(), z.string()).optional(),
|
|
49
|
+
on_conflict_policies: SubscriptionChangeConflictPolicies$zodSchema.optional(),
|
|
29
50
|
proration_behavior: ProrationBehavior$zodSchema,
|
|
30
51
|
target_plan_id: z.string(),
|
|
31
52
|
});
|
|
@@ -12,6 +12,10 @@ import {
|
|
|
12
12
|
EntityChangeResult$zodSchema,
|
|
13
13
|
} from "./entitychangeresult.js";
|
|
14
14
|
import { PlanSummary, PlanSummary$zodSchema } from "./plansummary.js";
|
|
15
|
+
import {
|
|
16
|
+
SubscriptionChangeBillingPeriodResult,
|
|
17
|
+
SubscriptionChangeBillingPeriodResult$zodSchema,
|
|
18
|
+
} from "./subscriptionchangebillingperiodresult.js";
|
|
15
19
|
import {
|
|
16
20
|
SubscriptionChangeType,
|
|
17
21
|
SubscriptionChangeType$zodSchema,
|
|
@@ -22,13 +26,18 @@ import {
|
|
|
22
26
|
} from "./subscriptionresponse.js";
|
|
23
27
|
|
|
24
28
|
export type SubscriptionChangeV2Response = {
|
|
29
|
+
billing_period?: SubscriptionChangeBillingPeriodResult | undefined;
|
|
25
30
|
change_type?: SubscriptionChangeType | undefined;
|
|
26
31
|
changed_resources?: ChangedResources | undefined;
|
|
27
32
|
effective_at?: string | undefined;
|
|
28
33
|
entity_changes?: Array<EntityChangeResult> | undefined;
|
|
29
34
|
from_plan?: PlanSummary | undefined;
|
|
35
|
+
is_scheduled?: boolean | undefined;
|
|
30
36
|
metadata?: { [k: string]: string } | undefined;
|
|
37
|
+
schedule_id?: string | undefined;
|
|
38
|
+
scheduled_at?: string | undefined;
|
|
31
39
|
subscription?: SubscriptionResponse | undefined;
|
|
40
|
+
superseded_schedules?: Array<string> | undefined;
|
|
32
41
|
to_plan?: PlanSummary | undefined;
|
|
33
42
|
warnings?: Array<string> | undefined;
|
|
34
43
|
};
|
|
@@ -36,13 +45,22 @@ export type SubscriptionChangeV2Response = {
|
|
|
36
45
|
export const SubscriptionChangeV2Response$zodSchema: z.ZodType<
|
|
37
46
|
SubscriptionChangeV2Response
|
|
38
47
|
> = z.object({
|
|
48
|
+
billing_period: SubscriptionChangeBillingPeriodResult$zodSchema.optional(),
|
|
39
49
|
change_type: SubscriptionChangeType$zodSchema.optional(),
|
|
40
50
|
changed_resources: ChangedResources$zodSchema.optional(),
|
|
41
51
|
effective_at: z.iso.datetime({ offset: true }).optional(),
|
|
42
52
|
entity_changes: z.array(EntityChangeResult$zodSchema).optional(),
|
|
43
53
|
from_plan: PlanSummary$zodSchema.optional(),
|
|
54
|
+
is_scheduled: z.boolean().optional().describe(
|
|
55
|
+
"IsScheduled is true when the change was deferred to the period end instead\nof being applied immediately.",
|
|
56
|
+
),
|
|
44
57
|
metadata: z.record(z.string(), z.string()).optional(),
|
|
58
|
+
schedule_id: z.string().optional(),
|
|
59
|
+
scheduled_at: z.iso.datetime({ offset: true }).optional(),
|
|
45
60
|
subscription: SubscriptionResponse$zodSchema.optional(),
|
|
61
|
+
superseded_schedules: z.array(z.string()).optional().describe(
|
|
62
|
+
"SupersededSchedules lists the plan-change schedules this request cancelled under\non_conflict_policies.on_pending_schedule. Preview reports what execute would cancel.",
|
|
63
|
+
),
|
|
46
64
|
to_plan: PlanSummary$zodSchema.optional(),
|
|
47
65
|
warnings: z.array(z.string()).optional(),
|
|
48
66
|
});
|
package/src/tool-names.ts
CHANGED
|
@@ -250,7 +250,7 @@ export const toolNames: Array<{ name: string; description: string }>= [
|
|
|
250
250
|
},
|
|
251
251
|
{
|
|
252
252
|
"name": "execute-subscription-plan-change-v2",
|
|
253
|
-
"description": "Execute a plan change (v2, swap in place)\n\nChange a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction."
|
|
253
|
+
"description": "Execute a plan change (v2, swap in place)\n\nChange a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction.\n\nchange_at controls timing. Omitted or 'immediate' applies the change now. 'end_of_period' records a pending schedule that executes at the subscription's current period end: the response returns is_scheduled, schedule_id and scheduled_at instead of a completed change, and nothing is swapped or billed until the boundary.\n\nscheduled_at is resolved from the subscription's current period end at request time. If that period end is already in the past (a backdated start date, a resumed pause, or worker downtime can all leave a subscription behind), the change is due immediately and fires on the next billing scan rather than a period away — inspect scheduled_at to see this.\n\nOnly one plan change may be pending per subscription. By default (on_conflict_policies.on_pending_schedule = 'reject') a second request returns 400; cancel the existing schedule via POST /subscriptions/schedules/{schedule_id}/cancel first. Pending schedules are listable via GET /subscriptions/{id}/schedules.\n\nSet on_conflict_policies.on_pending_schedule to 'supersede' to replace the queued change instead: the pending schedule is cancelled and this request applied in the same transaction, so both land or neither does. The cancelled schedule ids are returned in superseded_schedules, and preview reports the same list without writing."
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
256
|
"name": "preview-subscription-plan-change-v2",
|