kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
1532fa6345
commit
3e3f23db35
|
@ -111,8 +111,6 @@ export function registerV1DeploymentsCreateDeployment(
|
||||||
// - origin API base URL
|
// - origin API base URL
|
||||||
// - origin adapter OpenAPI or MCP specs
|
// - origin adapter OpenAPI or MCP specs
|
||||||
// - tool definitions
|
// - tool definitions
|
||||||
|
|
||||||
// TODO: fix types
|
|
||||||
const agenticProjectConfig = await resolveAgenticProjectConfig(body, {
|
const agenticProjectConfig = await resolveAgenticProjectConfig(body, {
|
||||||
label: `deployment "${deploymentIdentifier}"`,
|
label: `deployment "${deploymentIdentifier}"`,
|
||||||
logger
|
logger
|
||||||
|
|
|
@ -216,7 +216,7 @@ export async function upsertStripePricing({
|
||||||
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": unitAmount is required for per_unit billing schemes.`
|
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": unitAmount is required for per_unit billing schemes.`
|
||||||
)
|
)
|
||||||
assert(
|
assert(
|
||||||
!pricingPlanLineItem.tiers,
|
!(pricingPlanLineItem as any).tiers,
|
||||||
400,
|
400,
|
||||||
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": per_unit billing schemes cannot have tiers.`
|
`Invalid pricing plan metric "${pricingPlanLineItemSlug}" for pricing plan "${pricingPlanSlug}": per_unit billing schemes cannot have tiers.`
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,5 +3,5 @@ import Stripe from 'stripe'
|
||||||
import { env } from '@/lib/env'
|
import { env } from '@/lib/env'
|
||||||
|
|
||||||
export const stripe = new Stripe(env.STRIPE_SECRET_KEY, {
|
export const stripe = new Stripe(env.STRIPE_SECRET_KEY, {
|
||||||
apiVersion: '2025-04-30.basil'
|
apiVersion: '2025-05-28.basil'
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,6 +7,11 @@ import {
|
||||||
resolvedAgenticProjectConfigSchema
|
resolvedAgenticProjectConfigSchema
|
||||||
} from '@agentic/platform-types'
|
} from '@agentic/platform-types'
|
||||||
|
|
||||||
|
// NOTE: The extra typing and cast here are necessary because we're
|
||||||
|
// overriding the default zod types for some fields (e.g. `pricingPlans`) in
|
||||||
|
// order to get stricter TypeScript types than what zod v3 allows (nested
|
||||||
|
// discrimianted unions). This should be removed once we upgrade to zod v4.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
@ -14,10 +19,6 @@ export function parseAgenticProjectConfig(
|
||||||
inputConfig: unknown,
|
inputConfig: unknown,
|
||||||
{ strip = false, strict = false }: { strip?: boolean; strict?: boolean } = {}
|
{ strip = false, strict = false }: { strip?: boolean; strict?: boolean } = {}
|
||||||
): AgenticProjectConfig {
|
): AgenticProjectConfig {
|
||||||
// NOTE: The extra typing and cast here are necessary because we're
|
|
||||||
// overriding the default zod types for some fields (e.g. `pricingPlans`) in
|
|
||||||
// order to get stricter TypeScript types than what zod v3 allows (nested
|
|
||||||
// discrimianted unions). This should be removed once we upgrade to zod v4.
|
|
||||||
return parseZodSchema<
|
return parseZodSchema<
|
||||||
z.infer<typeof agenticProjectConfigSchema>,
|
z.infer<typeof agenticProjectConfigSchema>,
|
||||||
ZodTypeDef,
|
ZodTypeDef,
|
||||||
|
@ -39,10 +40,6 @@ export function parseResolvedAgenticProjectConfig(
|
||||||
inputConfig: unknown,
|
inputConfig: unknown,
|
||||||
{ strip = false, strict = false }: { strip?: boolean; strict?: boolean } = {}
|
{ strip = false, strict = false }: { strip?: boolean; strict?: boolean } = {}
|
||||||
): ResolvedAgenticProjectConfig {
|
): ResolvedAgenticProjectConfig {
|
||||||
// NOTE: The extra typing and cast here are necessary because we're
|
|
||||||
// overriding the default zod types for some fields (e.g. `pricingPlans`) in
|
|
||||||
// order to get stricter TypeScript types than what zod v3 allows (nested
|
|
||||||
// discrimianted unions). This should be removed once we upgrade to zod v4.
|
|
||||||
return parseZodSchema<
|
return parseZodSchema<
|
||||||
z.infer<typeof resolvedAgenticProjectConfigSchema>,
|
z.infer<typeof resolvedAgenticProjectConfigSchema>,
|
||||||
ZodTypeDef,
|
ZodTypeDef,
|
||||||
|
|
|
@ -162,11 +162,13 @@ export type AgenticProjectConfigInput = Simplify<
|
||||||
pricingPlans?: PricingPlanList
|
pricingPlans?: PricingPlanList
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
export type AgenticProjectConfig = Simplify<
|
export type AgenticProjectConfig =
|
||||||
Omit<z.output<typeof agenticProjectConfigSchema>, 'pricingPlans'> & {
|
| Simplify<
|
||||||
pricingPlans: PricingPlanList
|
Omit<z.output<typeof agenticProjectConfigSchema>, 'pricingPlans'> & {
|
||||||
}
|
pricingPlans: PricingPlanList
|
||||||
>
|
}
|
||||||
|
>
|
||||||
|
| z.output<typeof agenticProjectConfigSchema>
|
||||||
|
|
||||||
export const resolvedAgenticProjectConfigSchema =
|
export const resolvedAgenticProjectConfigSchema =
|
||||||
agenticProjectConfigSchema.extend({
|
agenticProjectConfigSchema.extend({
|
||||||
|
|
|
@ -404,8 +404,10 @@ export const pricingPlanLineItemSchema = z
|
||||||
.openapi('PricingPlanLineItem')
|
.openapi('PricingPlanLineItem')
|
||||||
// export type PricingPlanLineItem = z.infer<typeof pricingPlanLineItemSchema>
|
// export type PricingPlanLineItem = z.infer<typeof pricingPlanLineItemSchema>
|
||||||
|
|
||||||
// This is a more complex discriminated union based on:
|
// This is a more complex discriminated union based on: `slug`, `usageType`,
|
||||||
// `slug`, `usageType`, and `billingScheme`
|
// and `billingScheme`.
|
||||||
|
// TODO: clean up this type
|
||||||
|
// TODO: add `Input` version to support `string` rateLimit.interval
|
||||||
export type PricingPlanLineItem =
|
export type PricingPlanLineItem =
|
||||||
| BasePricingPlanLineItem
|
| BasePricingPlanLineItem
|
||||||
| RequestsPricingPlanLineItem
|
| RequestsPricingPlanLineItem
|
||||||
|
|
Ładowanie…
Reference in New Issue