diff --git a/apps/api/src/db/schema/consumer.ts b/apps/api/src/db/schema/consumer.ts index 68479c47..8edc714a 100644 --- a/apps/api/src/db/schema/consumer.ts +++ b/apps/api/src/db/schema/consumer.ts @@ -173,12 +173,13 @@ export const consumerSelectSchema = createSelectSchema(consumers, { .any() .refine( (deployment): boolean => - deploymentSelectSchema.safeParse(deployment).success, + !deployment || deploymentSelectSchema.safeParse(deployment).success, { message: 'Invalid lastDeployment' } ) .transform((deployment): any => { + if (!deployment) return undefined return deploymentSelectSchema.parse(deployment) }) .optional() diff --git a/apps/api/src/db/schema/deployment.ts b/apps/api/src/db/schema/deployment.ts index 55e23f81..c6ea14df 100644 --- a/apps/api/src/db/schema/deployment.ts +++ b/apps/api/src/db/schema/deployment.ts @@ -195,12 +195,14 @@ export const deploymentSelectSchema = createSelectSchema(deployments, { project: z .any() .refine( - (project): boolean => projectSelectSchema.safeParse(project).success, + (project): boolean => + !project || projectSelectSchema.safeParse(project).success, { message: 'Invalid lastDeployment' } ) .transform((project): any => { + if (!project) return undefined return projectSelectSchema.parse(project) }) .optional() diff --git a/apps/api/src/db/schema/project.ts b/apps/api/src/db/schema/project.ts index f8345fe7..2647dc6e 100644 --- a/apps/api/src/db/schema/project.ts +++ b/apps/api/src/db/schema/project.ts @@ -237,12 +237,14 @@ export const projectSelectSchema = createSelectSchema(projects, { .any() .refine( (deployment): boolean => - deploymentSelectSchema.safeParse(deployment).success, + !deployment || deploymentSelectSchema.safeParse(deployment).success, { message: 'Invalid lastPublishedDeployment' } ) .transform((deployment): any => { + if (!deployment) return undefined + return deploymentSelectSchema.parse(deployment) }) .optional(), @@ -252,12 +254,13 @@ export const projectSelectSchema = createSelectSchema(projects, { .any() .refine( (deployment): boolean => - deploymentSelectSchema.safeParse(deployment).success, + !deployment || deploymentSelectSchema.safeParse(deployment).success, { message: 'Invalid lastDeployment' } ) .transform((deployment): any => { + if (!deployment) return undefined return deploymentSelectSchema.parse(deployment) }) .optional() diff --git a/apps/web/src/app/marketplace/projects/[namespace]/[project-name]/marketplace-project-index.tsx b/apps/web/src/app/marketplace/projects/[namespace]/[project-name]/marketplace-project-index.tsx index 00bfc9c9..a6a4c29a 100644 --- a/apps/web/src/app/marketplace/projects/[namespace]/[project-name]/marketplace-project-index.tsx +++ b/apps/web/src/app/marketplace/projects/[namespace]/[project-name]/marketplace-project-index.tsx @@ -163,27 +163,31 @@ export function MarketplaceProjectIndex({ Pricing Plans - {project.lastPublishedDeployment!.pricingPlans.map((plan) => ( -
-

- {plan.name} -

+
+ {project.lastPublishedDeployment!.pricingPlans.map((plan) => ( +
+

+ {plan.name} +

-
{JSON.stringify(plan, null, 2)}
+
+                    {JSON.stringify(plan, null, 2)}
+                  
- -
- ))} + +
+ ))} +
)} diff --git a/packages/fixtures/valid/everything-openapi/agentic.config.ts b/packages/fixtures/valid/everything-openapi/agentic.config.ts index f682df46..63f1c60b 100644 --- a/packages/fixtures/valid/everything-openapi/agentic.config.ts +++ b/packages/fixtures/valid/everything-openapi/agentic.config.ts @@ -80,5 +80,82 @@ export default defineConfig({ inputSchemaAdditionalProperties: false, outputSchemaAdditionalProperties: false } + ], + pricingPlans: [ + { + name: 'Free', + slug: 'free', + lineItems: [ + { + slug: 'base', + usageType: 'licensed', + amount: 0 + }, + { + slug: 'requests', + usageType: 'metered', + billingScheme: 'per_unit', + unitAmount: 0 + } + ] + }, + { + name: 'Starter', + slug: 'starter', + lineItems: [ + { + slug: 'base', + usageType: 'licensed', + amount: 999 // $9.99 USD + }, + { + slug: 'requests', + usageType: 'metered', + billingScheme: 'tiered', + tiersMode: 'volume', + // free for first 1000 requests per month + // then $0.00053 USD for unlimited further requests that month + tiers: [ + { + upTo: 1000, + unitAmount: 0 + }, + { + upTo: 'inf', + unitAmount: 0.053 + } + ] + } + ] + }, + { + name: 'Pro', + slug: 'pro', + lineItems: [ + { + slug: 'base', + usageType: 'licensed', + amount: 2999 // $29.99 USD + }, + { + slug: 'requests', + usageType: 'metered', + billingScheme: 'tiered', + tiersMode: 'volume', + // free for first 10000 requests per month + // then $0.00049 USD for unlimited further requests that month + tiers: [ + { + upTo: 10_000, + unitAmount: 0 + }, + { + upTo: 'inf', + unitAmount: 0.049 + } + ] + } + ] + } ] }) diff --git a/packages/hono/src/error-handler.ts b/packages/hono/src/error-handler.ts index 0b6946e7..b9211855 100644 --- a/packages/hono/src/error-handler.ts +++ b/packages/hono/src/error-handler.ts @@ -75,7 +75,7 @@ export function errorHandler( console.error('Error Sentry.captureException failed', err, err_) } } - } else { + } else if (status !== 404) { logger.warn(status, err) } } diff --git a/readme.md b/readme.md index 34dc6ae9..634150ef 100644 --- a/readme.md +++ b/readme.md @@ -18,7 +18,6 @@ - consider a PrettyJson component which displays json but links to resources - stripe - stripe checkout for changing plans? (need to at least be able to upgrade) - - stripe billing portal - should we bypass stripe for `free` plans to increase conversions? - handle browser back/forward with `?next=` - add some social proof to signup page