diff --git a/packages/ingest-types/src/index.ts b/packages/ingest-types/src/index.ts index 27d40003c06..4eee2d42087 100644 --- a/packages/ingest-types/src/index.ts +++ b/packages/ingest-types/src/index.ts @@ -30,6 +30,11 @@ export type { AgentCreateThreadErrors, AgentCreateThreadResponse, AgentCreateThreadResponses, + AgentDeleteSkillData, + AgentDeleteSkillError, + AgentDeleteSkillErrors, + AgentDeleteSkillResponse, + AgentDeleteSkillResponses, AgentDraftSnapshot, AgentError, AgentGetDraftData, @@ -42,6 +47,11 @@ export type { AgentGetMessagesErrors, AgentGetMessagesResponse, AgentGetMessagesResponses, + AgentListSkillsData, + AgentListSkillsError, + AgentListSkillsErrors, + AgentListSkillsResponse, + AgentListSkillsResponses, AgentListThreadsData, AgentListThreadsError, AgentListThreadsErrors, @@ -54,6 +64,14 @@ export type { AgentPostMessageRequest, AgentPostMessageResponse, AgentPostMessageResponses, + AgentPublishSkillData, + AgentPublishSkillError, + AgentPublishSkillErrors, + AgentPublishSkillResponse, + AgentPublishSkillResponses, + AgentSkill, + AgentSkillListResponse, + AgentSkillPublishRequest, AgentThreadCreated, AgentThreadCreateRequest, AgentThreadListResponse, @@ -68,13 +86,21 @@ export type { AssetTagHistogramResponse, AssetUpdated, AssetWritable, + BillingAddress, BillingBalanceResponse, + BillingCapabilities, + BillingCapabilitiesResponse, + BillingCapabilityRolloutDefaults, + BillingCapabilityScope, + BillingCompanyDetailsResponse, + BillingCompanyDetailsUpdateRequest, BillingEvent, BillingEventsResponse, BillingOpStatusResponse, BillingPlansResponse, BillingStatus, BillingStatusResponse, + BillingTaxId, BulkRevokeApiKeysResponse, BulkRevokeWorkspaceMemberApiKeysData, BulkRevokeWorkspaceMemberApiKeysError, @@ -210,6 +236,7 @@ export type { CreateWorkspaceResponse, CreateWorkspaceResponses, CredentialOption, + CurrentWorkspaceResponse, DeleteAssetData, DeleteAssetError, DeleteAssetErrors, @@ -318,6 +345,16 @@ export type { GetBillingBalanceErrors, GetBillingBalanceResponse, GetBillingBalanceResponses, + GetBillingCapabilitiesData, + GetBillingCapabilitiesError, + GetBillingCapabilitiesErrors, + GetBillingCapabilitiesResponse, + GetBillingCapabilitiesResponses, + GetBillingCompanyDetailsData, + GetBillingCompanyDetailsError, + GetBillingCompanyDetailsErrors, + GetBillingCompanyDetailsResponse, + GetBillingCompanyDetailsResponses, GetBillingEventsData, GetBillingEventsError, GetBillingEventsErrors, @@ -348,6 +385,11 @@ export type { GetChurnkeyAuthErrors, GetChurnkeyAuthResponse, GetChurnkeyAuthResponses, + GetCurrentWorkspaceData, + GetCurrentWorkspaceError, + GetCurrentWorkspaceErrors, + GetCurrentWorkspaceResponse, + GetCurrentWorkspaceResponses, GetCustomNodeProxyData, GetCustomNodeProxyErrors, GetCustomNodeProxyResponses, @@ -703,6 +745,11 @@ export type { ListJobsResponse, ListJobsResponses, ListMembersResponse, + ListSavedPaymentMethodsData, + ListSavedPaymentMethodsError, + ListSavedPaymentMethodsErrors, + ListSavedPaymentMethodsResponse, + ListSavedPaymentMethodsResponses, ListSecretProvidersData, ListSecretProvidersError, ListSecretProvidersErrors, @@ -895,6 +942,7 @@ export type { RevokeWorkspaceInviteErrors, RevokeWorkspaceInviteResponse, RevokeWorkspaceInviteResponses, + SavedPaymentMethod, SecretListResponse, SecretProvider, SecretProvidersResponse, @@ -916,6 +964,7 @@ export type { SubscribeResponses, SubscribeToLogsData, SubscribeToLogsResponses, + SubscriptionDiscount, SubscriptionDuration, SubscriptionTier, SystemStatsResponse, @@ -933,6 +982,11 @@ export type { UpdateAssetErrors, UpdateAssetResponse, UpdateAssetResponses, + UpdateBillingCompanyDetailsData, + UpdateBillingCompanyDetailsError, + UpdateBillingCompanyDetailsErrors, + UpdateBillingCompanyDetailsResponse, + UpdateBillingCompanyDetailsResponses, UpdateHubProfileData, UpdateHubProfileError, UpdateHubProfileErrors, diff --git a/packages/ingest-types/src/types.gen.ts b/packages/ingest-types/src/types.gen.ts index 7b1f1b8dba3..cbcf44bfb21 100644 --- a/packages/ingest-types/src/types.gen.ts +++ b/packages/ingest-types/src/types.gen.ts @@ -33,6 +33,7 @@ export type SubscriptionTier = | 'PRO' | 'FOUNDERS_EDITION' | 'TEAM' + | 'ENTERPRISE' /** * Abbreviated workspace metadata used in list responses. @@ -746,6 +747,22 @@ export type SystemStatsResponse = { */ export type SubscriptionDuration = 'MONTHLY' | 'ANNUAL' +export type SubscriptionDiscount = { + /** + * What this discount removed from the amount due today. + */ + amount_off_cents?: number + code: string + kind: 'plan' | 'promotion' + /** + * Customer-facing display name of the underlying coupon. `code` can + * be an internal identifier (e.g. team_commitment_7_5); render this + * when present. + * + */ + name?: string +} + /** * Response after successfully subscribing to a billing plan. */ @@ -799,6 +816,13 @@ export type SubscribeRequest = { * */ confirm_reactivation?: boolean + /** + * Stripe ConfirmationToken created from deferred Payment Element + * details. For an initial subscription, the backend creates the exact + * invoice PaymentIntent and confirms it with this token. + * + */ + confirmation_token?: string /** * Client-provided key to prevent duplicate operations. * If a billing op with this key already exists, returns the existing op instead of creating a new one. @@ -809,6 +833,12 @@ export type SubscribeRequest = { * Target plan slug to subscribe to */ plan_slug: string + /** + * Optional customer-facing Stripe promotion code. The backend + * resolves and validates it, then stacks it with plan discounts. + * + */ + promotion_code?: string /** * Echoes PreviewSubscribeResponse.proration_at from the preview the * caller consented to. When present, the charge is prorated to this @@ -821,12 +851,31 @@ export type SubscribeRequest = { * */ proration_at?: string + /** + * Opaque quote id returned by PreviewSubscribeResponse. + */ + quote_id?: string + /** + * Quote version returned by PreviewSubscribeResponse. + */ + quote_version?: number /** * URL to redirect after payment method is added successfully. - * Required if workspace has no payment method on file. + * Required if the workspace has no payment method on file, when + * confirmation_token is provided, or when a selected saved payment + * method is redirect-based (any non-card type). Redirect-based flows + * require an absolute HTTPS URL; plain HTTP is accepted only for + * loopback hosts during local development. * */ return_url?: string + /** + * Optional saved payment method selected for this subscription. It + * must be attached to the current workspace's Stripe customer. + * Mutually exclusive with confirmation_token. + * + */ + saved_payment_method_id?: string /** * Selected team credit-stop preset id (e.g. "team_700") for the * per-credit Team plan. Required when subscribing to a per-credit Team @@ -921,6 +970,23 @@ export type SecretListResponse = { data: Array } +export type SavedPaymentMethod = { + /** + * Card brand. Present only for card payment methods. + */ + brand?: string + id: string + /** + * Exactly one item is the default when the returned list is non-empty. + */ + is_default: boolean + /** + * Masked card suffix. Present only for card payment methods. + */ + last4?: string + type: string +} + /** * Response after accepting a resubscribe request. */ @@ -1232,6 +1298,7 @@ export type PreviewSubscribeResponse = { * Whether this subscription change is allowed */ allowed: boolean + amount_due_cents?: number /** * Amount that will be charged at next billing period in cents */ @@ -1248,7 +1315,9 @@ export type PreviewSubscribeResponse = { * Credits granted today in cents (prorated for mid-period upgrades) */ credits_today_cents: number + currency?: string current_plan?: PreviewPlanInfo + discounts?: Array /** * When the change takes effect */ @@ -1258,6 +1327,20 @@ export type PreviewSubscribeResponse = { */ is_immediate: boolean new_plan: PreviewPlanInfo + /** + * The Stripe payment method configuration governing which payment + * methods the embedded checkout offers for this environment. Mount + * Stripe Elements with `paymentMethodConfiguration` set to this id + * instead of hardcoding payment method types. Present on every + * successful preview while embedded checkout is enabled and absent + * from legacy previews. + * + */ + payment_method_configuration_id?: string + /** + * Normalized promotion code accepted by Stripe. + */ + promotion_code?: string /** * The instant cost_today_cents was priced at (Stripe-native transitions * only; absent for other billing rails). Echo this back as proration_at @@ -1267,10 +1350,34 @@ export type PreviewSubscribeResponse = { * */ proration_at?: string + /** + * Opaque short-lived quote identifier to echo on Subscribe. + */ + quote_id?: string + /** + * Quote contract version to echo on Subscribe. + */ + quote_version?: number /** * Reason why the change is not allowed (only present if allowed=false) */ reason?: string + renewal_amount_cents?: number + /** + * The next recurring charge and target-plan period end. Current servers + * always return this later than effective_at and following the target + * plan's billing interval. Optional in the schema for older clients. + * + */ + renewal_at?: string + /** + * Whether this previewed change requires explicit reactivation + * consent. Computed from the persisted subscription and a short-lived + * cache of Stripe lifecycle state. The subscribe enforcement path + * performs its own uncached Stripe lifecycle read. + * + */ + requires_reactivation_confirmation?: boolean /** * Type of subscription transition */ @@ -1336,6 +1443,10 @@ export type PreviewSubscribeRequest = { * Target plan slug to preview subscribing to */ plan_slug: string + /** + * Optional Stripe promotion code to validate and include in the exact quote. + */ + promotion_code?: string /** * Selected per-credit Team plan stop to preview. */ @@ -3146,6 +3257,23 @@ export type DeleteSessionResponse = { success: boolean } +/** + * The workspace bound to the presented credential, plus how that credential authenticated. Same shape as Workspace with the caller's role and the auth method added, and without created_at (callers of this endpoint want identity, not provenance). + */ +export type CurrentWorkspaceResponse = { + /** + * How this request authenticated. Known values are firebase, cookie, comfy_api_key, comfy_admin_key, cloud_api_key and cloud_jwt; treat it as an open string so a new auth method is not a breaking change. + */ + auth_method: string + id: string + name: string + /** + * The requesting user's role in this workspace. Omitted (absent from the object, never an explicit null) when the credential carries no resolvable user membership. + */ + role?: 'owner' | 'member' + type: 'personal' | 'team' +} + /** * Request body for creating a new workspace. */ @@ -3423,6 +3551,23 @@ export type BulkRevokeApiKeysResponse = { revoked_count: number } +/** + * A tax identifier for a company Stripe customer. Stripe validates the + * type/value combination synchronously and verifies VAT/ABN-style IDs + * asynchronously. + * + */ +export type BillingTaxId = { + /** + * Stripe tax ID type, e.g. `eu_vat`, `us_ein`, `au_abn`. See + * https://docs.stripe.com/api/tax_ids/object#tax_id_object-type + * for the full list. + * + */ + type: string + value: string +} + /** * Current billing and subscription status for a workspace. */ @@ -3432,7 +3577,8 @@ export type BillingStatusResponse = { * customer. Today this is a Stripe-hosted payment page for an invoice * needing authentication (SCA/3DS); * send the customer there to complete payment. Mirrors the field of - * the same name on BillingOpStatusResponse. + * the same name on BillingOpStatusResponse. This bearer capability is + * returned only to workspace billing managers. * */ action_url?: string @@ -3461,6 +3607,16 @@ export type BillingStatusResponse = { * Current workspace members plus non-expired pending invites, used against max_seats. 0 when billing is disabled. */ occupied_seats: number + /** + * Present when a pending operation supports embedded Stripe + * authentication. It may be returned alongside a hosted payment page + * when both recovery methods are available. This bearer + * capability is returned only to workspace billing managers. Pass + * directly to Stripe.js; do not log or + * persist it in client storage. + * + */ + payment_intent_client_secret?: string /** * The workspace's in-flight billing operation, when one exists. Lets a * client recover a payment it has lost the local reference to — a @@ -3532,30 +3688,84 @@ export type BillingOpStatusResponse = { * Present while status is "pending" and the operation cannot proceed * without the customer. Today this is a Stripe-hosted payment page for * a subscription whose first invoice needs authentication (SCA/3DS); - * send the customer there to complete payment. Absent otherwise. + * send the customer there to complete payment. This bearer capability is + * returned only to workspace billing managers. Absent otherwise. * */ action_url?: string + /** + * State derived from the PaymentIntent attached to this operation's + * exact stored Stripe invoice. Absent when the operation has no + * correlated PaymentIntent. + * + */ + authentication_state?: + | 'requires_action' + | 'processing' + | 'failed_retryable' + | 'succeeded' + | 'reconciliation_needed' /** * When the operation completed (success or failure) */ completed_at?: string /** - * Error message if status is failed + * Coarse classification of why the correlated PaymentIntent's last + * payment attempt failed, derived at read time from the provider's + * machine-readable error and decline codes — never from provider + * message text or payment-method details. Present only when the + * intent has recorded a failed attempt and the operation is either + * still pending with authentication_state failed_retryable or has + * terminally failed. generic means the attempt failed for a reason + * outside this vocabulary. + * + */ + decline_reason?: + | 'card_declined' + | 'insufficient_funds' + | 'expired_card' + | 'incorrect_cvc' + | 'authentication_required' + | 'authentication_failed' + | 'processing_error' + | 'generic' + /** + * PII-safe failure code or generic failure message */ error_message?: string /** * Unique identifier for the billing operation */ id: string + /** + * Stripe PaymentIntent client secret for completing requires_action. + * This bearer capability is returned only to workspace billing managers + * and is absent otherwise. + * + */ + payment_intent_client_secret?: string + /** + * Typed next action for a failed operation. Absent for pending and succeeded operations. + */ + recovery_action?: + | 'retry' + | 'replace_payment_method' + | 'authenticate_payment' + | 'contact_support' + /** + * Whether the customer can recover by starting a new billing operation after performing recovery_action. + */ + retryable?: boolean /** * When the operation was initiated */ started_at: string /** - * Current status of the operation + * Current status of the operation. reconciliation_needed is terminal + * for client polling but requires support reconciliation. + * */ - status: 'pending' | 'succeeded' | 'failed' + status: 'pending' | 'succeeded' | 'failed' | 'reconciliation_needed' } /** @@ -3605,6 +3815,104 @@ export type BillingEvent = { } } +/** + * Fields to set on the workspace's Stripe customer. Every group is + * optional; omit a group to leave that part of the customer unchanged. + * + */ +export type BillingCompanyDetailsUpdateRequest = { + address?: BillingAddress + /** + * Legal or trading name to show on invoices. + */ + company_name?: string + tax_id?: BillingTaxId +} + +/** + * A billing address for a company Stripe customer. city and postal_code + * are optional because some countries (e.g. Hong Kong, the UAE, Panama) + * have no postal code and are not collected for them; Stripe validates + * what a given country actually requires. + * + */ +export type BillingAddress = { + city?: string + /** + * Two-letter ISO 3166-1 country code. + */ + country: string + line1: string + line2?: string + postal_code?: string + state?: string +} + +/** + * Company billing details on file for the workspace's Stripe customer. + * A field is absent until the workspace sets it via PATCH + * /api/billing/company-details. + * + */ +export type BillingCompanyDetailsResponse = { + address?: BillingAddress + company_name?: string + tax_id?: BillingTaxId +} + +export type BillingCapabilityScope = { + user_id: string + workspace_id: string +} + +/** + * Identifies capability values currently using safe rollout defaults + * instead of deterministic policy results. A true value is UI guidance, + * not evidence that the corresponding write will succeed. + * + */ +export type BillingCapabilityRolloutDefaults = { + can_downgrade_to_personal: boolean + can_subscribe_self_serve: boolean + can_top_up: boolean +} + +/** + * Effective billing UI guidance for one authenticated user and workspace. + */ +export type BillingCapabilitiesResponse = { + capabilities: BillingCapabilities + /** + * Time after which the client must refetch this snapshot. + */ + expires_at: string + resolved_for: BillingCapabilityScope + /** + * JavaScript-safe, time-sortable revision for this snapshot. It + * increases monotonically within a serving process. Clients should + * invalidate on a different X-Capability-Revision value and use + * expires_at as the cross-instance freshness bound. + * + */ + revision: number + rollout_defaults_applied: BillingCapabilityRolloutDefaults +} + +/** + * Conservative UI guidance. These values do not authorize billing writes; + * each write endpoint independently enforces its permission policy. + * + */ +export type BillingCapabilities = { + can_cancel: boolean + can_change_seats: boolean + can_downgrade_to_personal: boolean + can_invite_members: boolean + can_reactivate: boolean + can_subscribe_self_serve: boolean + can_top_up: boolean +} + /** * Current credit balance and usage details for a workspace. */ @@ -3839,6 +4147,69 @@ export type AgentThreadCreateRequest = { workflow_id?: string } +/** + * A user-authored skill pack to create or replace. Plain JSON — a pack body is small enough that a signed-URL upload would be pure overhead. + */ +export type AgentSkillPublishRequest = { + /** + * Accepted only so an `always: true` copied out of a SKILL.md frontmatter is refused with an explanation instead of silently dropped. User packs are on-demand only, so true is rejected. + */ + always?: boolean + /** + * The full instruction text, injected only when the pack is loaded. Capped per pack and, together with the caller's other packs, in total; the exact byte limits are deployment configuration and are named in the rejection message when exceeded. + */ + body: string + /** + * One line saying when the agent should load this pack. It is what every prompt carries for an unloaded pack, so it is a trigger description, not a title. Single-line: control characters, including CR and LF, are refused. maxLength is counted in code points, as JSON Schema defines it, and the service counts the same way. + */ + description: string + /** + * The pack's flat identifier and the load_skill argument: letters, digits, '.', '_' and '-'. Publishing a name already held by the caller replaces that pack. A name matching a built-in always-on pack is refused; a name matching a built-in on-demand pack is accepted, and is the name consumption will resolve to the user's pack. Must contain at least one character that is not a dot: "." and ".." are path segments a normalizing client rewrites. + */ + name: string +} + +/** + * The caller's skill packs, ordered by name. + */ +export type AgentSkillListResponse = { + skills: Array +} + +/** + * One of the caller's user-authored skill packs. + */ +export type AgentSkill = { + /** + * The full instruction text. + */ + body: string + /** + * Lowercase hex sha256 of body, with no algorithm prefix. Stamped on every write, so a client can tell whether the stored pack matches the body it last sent. + */ + body_hash: string + /** + * RFC3339 timestamp of when the pack was first published. + */ + created_at: string + /** + * One-line trigger description the agent selects the pack from. + */ + description: string + /** + * Server-assigned pack ID. + */ + id: string + /** + * The pack's flat identifier and the load_skill argument. + */ + name: string + /** + * RFC3339 timestamp of the pack's most recent publish. + */ + updated_at: string +} + /** * A user turn posted to the agent. */ @@ -4318,6 +4689,160 @@ export type AgentGetDraftResponses = { export type AgentGetDraftResponse = AgentGetDraftResponses[keyof AgentGetDraftResponses] +export type AgentListSkillsData = { + body?: never + path?: never + query?: never + url: '/api/agent/skills' +} + +export type AgentListSkillsErrors = { + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * The caller is not enrolled in the cohort gate fronting these CRUD routes: the agent-skill-packs flag, or the agent-in-app-experience flag gating the whole /api/agent surface. Both default off and fail closed (a missing evaluation context resolves to false), and both answer 404 rather than 403 so the surface is invisible when off. Ingest-raised, so the body is the standard ErrorResponse shape. + */ + 404: ErrorResponse + /** + * Internal server error (ingest-raised failures use the standard ErrorResponse shape instead) + */ + 500: AgentError + /** + * Agent service unavailable + */ + 502: ErrorResponse + /** + * The agent proxy is not configured to forward safely (a non-local agent service URL with no shared machine-to-machine secret), so ingest refuses rather than sending unverifiable identity headers. + */ + 503: ErrorResponse +} + +export type AgentListSkillsError = + AgentListSkillsErrors[keyof AgentListSkillsErrors] + +export type AgentListSkillsResponses = { + /** + * The caller's skill packs. + */ + 200: AgentSkillListResponse +} + +export type AgentListSkillsResponse = + AgentListSkillsResponses[keyof AgentListSkillsResponses] + +export type AgentPublishSkillData = { + body: AgentSkillPublishRequest + path?: never + query?: never + url: '/api/agent/skills' +} + +export type AgentPublishSkillErrors = { + /** + * The pack was rejected by publish-time validation (name shape, empty description or body, control characters in either, body over the per-pack size cap, always:true, a reserved always-on name, or comfy-cli shell syntax in the body). The message names what to change. + */ + 400: AgentError + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * The caller is not enrolled in the cohort gate fronting these CRUD routes: the agent-skill-packs flag, or the agent-in-app-experience flag gating the whole /api/agent surface. Both default off and fail closed (a missing evaluation context resolves to false), and both answer 404 rather than 403 so the surface is invisible when off. Ingest-raised, so the body is the standard ErrorResponse shape. + */ + 404: ErrorResponse + /** + * A per-user budget is full — the pack count, or the combined size of the caller's packs. Nothing about this pack can be edited to make it fit; another pack has to be deleted first. + */ + 409: AgentError + /** + * Request body over ingest's transport-level cap (AGENT_SKILL_REQUEST_BODY_LIMIT), which is set well above the per-pack size cap so an over-size pack gets the actionable 400 above instead. Reaching this means the request itself is outsized. + */ + 413: ErrorResponse + /** + * Internal server error (ingest-raised failures use the standard ErrorResponse shape instead) + */ + 500: AgentError + /** + * Agent service unavailable + */ + 502: ErrorResponse + /** + * The agent proxy is not configured to forward safely (a non-local agent service URL with no shared machine-to-machine secret), so ingest refuses rather than sending unverifiable identity headers. + */ + 503: ErrorResponse +} + +export type AgentPublishSkillError = + AgentPublishSkillErrors[keyof AgentPublishSkillErrors] + +export type AgentPublishSkillResponses = { + /** + * An existing pack of the same name was replaced. + */ + 200: AgentSkill + /** + * A new pack was created. + */ + 201: AgentSkill +} + +export type AgentPublishSkillResponse = + AgentPublishSkillResponses[keyof AgentPublishSkillResponses] + +export type AgentDeleteSkillData = { + body?: never + path: { + /** + * The pack's name. + */ + name: string + } + query?: never + url: '/api/agent/skills/{name}' +} + +export type AgentDeleteSkillErrors = { + /** + * The name is not a valid pack name. + */ + 400: ErrorResponse + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * The caller holds no pack with that name, or the caller is not enrolled in the cohort gate fronting these CRUD routes (the agent-skill-packs flag, or the agent-in-app-experience flag gating the whole /api/agent surface). Both flags default off and fail closed, and both answer 404 rather than 403 so the surface is invisible when off. The schema below is the agent-raised no-such-pack body; the gate-off 404 is ingest-raised and uses the standard ErrorResponse shape instead. + */ + 404: AgentError + /** + * Internal server error (ingest-raised failures use the standard ErrorResponse shape instead) + */ + 500: AgentError + /** + * Agent service unavailable + */ + 502: ErrorResponse + /** + * The agent proxy is not configured to forward safely (a non-local agent service URL with no shared machine-to-machine secret), so ingest refuses rather than sending unverifiable identity headers. + */ + 503: ErrorResponse +} + +export type AgentDeleteSkillError = + AgentDeleteSkillErrors[keyof AgentDeleteSkillErrors] + +export type AgentDeleteSkillResponses = { + /** + * The pack was deleted. + */ + 204: void +} + +export type AgentDeleteSkillResponse = + AgentDeleteSkillResponses[keyof AgentDeleteSkillResponses] + export type AgentListThreadsData = { body?: never path?: never @@ -5953,6 +6478,45 @@ export type GetBillingBalanceResponses = { export type GetBillingBalanceResponse = GetBillingBalanceResponses[keyof GetBillingBalanceResponses] +export type GetBillingCapabilitiesData = { + body?: never + path?: never + query?: never + url: '/api/billing/capabilities' +} + +export type GetBillingCapabilitiesErrors = { + /** + * Workspace or user context required + */ + 401: ErrorResponse + /** + * Actor is not a member of the authenticated workspace + */ + 403: ErrorResponse + /** + * Workspace not found + */ + 404: ErrorResponse + /** + * Billing service unavailable or returned an invalid response + */ + 502: ErrorResponse +} + +export type GetBillingCapabilitiesError = + GetBillingCapabilitiesErrors[keyof GetBillingCapabilitiesErrors] + +export type GetBillingCapabilitiesResponses = { + /** + * Effective billing capabilities + */ + 200: BillingCapabilitiesResponse +} + +export type GetBillingCapabilitiesResponse = + GetBillingCapabilitiesResponses[keyof GetBillingCapabilitiesResponses] + export type GetChurnkeyAuthData = { body?: never path?: never @@ -5992,6 +6556,76 @@ export type GetChurnkeyAuthResponses = { export type GetChurnkeyAuthResponse = GetChurnkeyAuthResponses[keyof GetChurnkeyAuthResponses] +export type GetBillingCompanyDetailsData = { + body?: never + path?: never + query?: never + url: '/api/billing/company-details' +} + +export type GetBillingCompanyDetailsErrors = { + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * Workspace owner role required + */ + 403: ErrorResponse + /** + * Internal server error + */ + 500: ErrorResponse +} + +export type GetBillingCompanyDetailsError = + GetBillingCompanyDetailsErrors[keyof GetBillingCompanyDetailsErrors] + +export type GetBillingCompanyDetailsResponses = { + /** + * Success + */ + 200: BillingCompanyDetailsResponse +} + +export type GetBillingCompanyDetailsResponse = + GetBillingCompanyDetailsResponses[keyof GetBillingCompanyDetailsResponses] + +export type UpdateBillingCompanyDetailsData = { + body: BillingCompanyDetailsUpdateRequest + path?: never + query?: never + url: '/api/billing/company-details' +} + +export type UpdateBillingCompanyDetailsErrors = { + /** + * Bad request (e.g., missing address fields or an invalid tax ID) + */ + 400: ErrorResponse + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * Internal server error + */ + 500: ErrorResponse +} + +export type UpdateBillingCompanyDetailsError = + UpdateBillingCompanyDetailsErrors[keyof UpdateBillingCompanyDetailsErrors] + +export type UpdateBillingCompanyDetailsResponses = { + /** + * Success + */ + 200: BillingCompanyDetailsResponse +} + +export type UpdateBillingCompanyDetailsResponse = + UpdateBillingCompanyDetailsResponses[keyof UpdateBillingCompanyDetailsResponses] + export type GetBillingEventsData = { body?: never path?: never @@ -6100,6 +6734,45 @@ export type GetBillingOpStatusResponses = { export type GetBillingOpStatusResponse = GetBillingOpStatusResponses[keyof GetBillingOpStatusResponses] +export type ListSavedPaymentMethodsData = { + body?: never + path?: never + query?: never + url: '/api/billing/payment-methods' +} + +export type ListSavedPaymentMethodsErrors = { + /** + * Billing is disabled + */ + 400: ErrorResponse + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * Workspace owner role required + */ + 403: ErrorResponse + /** + * Internal server error + */ + 500: ErrorResponse +} + +export type ListSavedPaymentMethodsError = + ListSavedPaymentMethodsErrors[keyof ListSavedPaymentMethodsErrors] + +export type ListSavedPaymentMethodsResponses = { + /** + * Saved payment methods + */ + 200: Array +} + +export type ListSavedPaymentMethodsResponse = + ListSavedPaymentMethodsResponses[keyof ListSavedPaymentMethodsResponses] + export type GetPaymentPortalData = { body?: PaymentPortalRequest path?: never @@ -6182,6 +6855,10 @@ export type PreviewSubscribeErrors = { * Unauthorized */ 401: ErrorResponse + /** + * Workspace owner role required + */ + 403: ErrorResponse /** * Internal server error */ @@ -6614,25 +7291,7 @@ export type GetFeaturesResponses = { * Whether the server supports preview metadata */ supports_preview_metadata?: boolean - [key: string]: - | unknown - | { - /** - * Total free jobs granted for the current period - */ - allowance: number - /** - * Free jobs remaining (allowance - used, floored at 0) - */ - remaining: number - /** - * Free jobs consumed so far - */ - used: number - } - | number - | boolean - | undefined + [key: string]: unknown } } @@ -10901,6 +11560,41 @@ export type UpdateWorkspaceResponses = { export type UpdateWorkspaceResponse = UpdateWorkspaceResponses[keyof UpdateWorkspaceResponses] +export type GetCurrentWorkspaceData = { + body?: never + path?: never + query?: never + url: '/api/workspaces/current' +} + +export type GetCurrentWorkspaceErrors = { + /** + * Unauthorized + */ + 401: ErrorResponse + /** + * No workspace resolves for this credential — it carries no workspace binding, the workspace was deleted, or the credential's user is no longer a member. Deliberately not 401: the credential itself is valid, so clients must not discard it or re-authenticate. + */ + 404: ErrorResponse + /** + * Internal server error + */ + 500: ErrorResponse +} + +export type GetCurrentWorkspaceError = + GetCurrentWorkspaceErrors[keyof GetCurrentWorkspaceErrors] + +export type GetCurrentWorkspaceResponses = { + /** + * The credential's workspace + */ + 200: CurrentWorkspaceResponse +} + +export type GetCurrentWorkspaceResponse = + GetCurrentWorkspaceResponses[keyof GetCurrentWorkspaceResponses] + export type GetStaticExtensionsData = { body?: never path: { diff --git a/packages/ingest-types/src/zod.gen.ts b/packages/ingest-types/src/zod.gen.ts index a4504755451..384ee8f9919 100644 --- a/packages/ingest-types/src/zod.gen.ts +++ b/packages/ingest-types/src/zod.gen.ts @@ -11,7 +11,8 @@ export const zSubscriptionTier = z.enum([ 'CREATOR', 'PRO', 'FOUNDERS_EDITION', - 'TEAM' + 'TEAM', + 'ENTERPRISE' ]) /** @@ -480,6 +481,21 @@ export const zSystemStatsResponse = z.object({ */ export const zSubscriptionDuration = z.enum(['MONTHLY', 'ANNUAL']) +export const zSubscriptionDiscount = z.object({ + amount_off_cents: z.coerce + .bigint() + .min(BigInt('-9223372036854775808'), { + message: 'Invalid value: Expected int64 to be >= -9223372036854775808' + }) + .max(BigInt('9223372036854775807'), { + message: 'Invalid value: Expected int64 to be <= 9223372036854775807' + }) + .optional(), + code: z.string(), + kind: z.enum(['plan', 'promotion']), + name: z.string().optional() +}) + /** * Response after successfully subscribing to a billing plan. */ @@ -497,10 +513,15 @@ export const zSubscribeRequest = z.object({ billing_cycle: z.enum(['monthly', 'yearly']).optional(), cancel_url: z.string().optional(), confirm_reactivation: z.boolean().optional(), + confirmation_token: z.string().optional(), idempotency_key: z.string().optional(), plan_slug: z.string(), + promotion_code: z.string().optional(), proration_at: z.string().datetime().optional(), + quote_id: z.string().optional(), + quote_version: z.number().int().optional(), return_url: z.string().optional(), + saved_payment_method_id: z.string().regex(/^pm_/).optional(), team_credit_stop_id: z.string().optional() }) @@ -549,6 +570,17 @@ export const zSecretListResponse = z.object({ data: z.array(zSecretResponse) }) +export const zSavedPaymentMethod = z.object({ + brand: z.string().optional(), + id: z.string().regex(/^pm_/), + is_default: z.boolean(), + last4: z + .string() + .regex(/^[0-9]{4}$/) + .optional(), + type: z.string() +}) + /** * Response after accepting a resubscribe request. */ @@ -763,6 +795,15 @@ export const zPreviewPlanInfo = z.object({ */ export const zPreviewSubscribeResponse = z.object({ allowed: z.boolean(), + amount_due_cents: z.coerce + .bigint() + .min(BigInt('-9223372036854775808'), { + message: 'Invalid value: Expected int64 to be >= -9223372036854775808' + }) + .max(BigInt('9223372036854775807'), { + message: 'Invalid value: Expected int64 to be <= 9223372036854775807' + }) + .optional(), cost_next_period_cents: z.coerce .bigint() .min(BigInt('-9223372036854775808'), { @@ -795,12 +836,29 @@ export const zPreviewSubscribeResponse = z.object({ .max(BigInt('9223372036854775807'), { message: 'Invalid value: Expected int64 to be <= 9223372036854775807' }), + currency: z.string().optional(), current_plan: zPreviewPlanInfo.optional(), + discounts: z.array(zSubscriptionDiscount).optional(), effective_at: z.string().datetime(), is_immediate: z.boolean(), new_plan: zPreviewPlanInfo, + payment_method_configuration_id: z.string().optional(), + promotion_code: z.string().optional(), proration_at: z.string().datetime().optional(), + quote_id: z.string().optional(), + quote_version: z.number().int().optional(), reason: z.string().optional(), + renewal_amount_cents: z.coerce + .bigint() + .min(BigInt('-9223372036854775808'), { + message: 'Invalid value: Expected int64 to be >= -9223372036854775808' + }) + .max(BigInt('9223372036854775807'), { + message: 'Invalid value: Expected int64 to be <= 9223372036854775807' + }) + .optional(), + renewal_at: z.string().datetime().optional(), + requires_reactivation_confirmation: z.boolean().optional(), transition_type: z.enum([ 'new_subscription', 'upgrade', @@ -814,6 +872,7 @@ export const zPreviewSubscribeResponse = z.object({ */ export const zPreviewSubscribeRequest = z.object({ plan_slug: z.string(), + promotion_code: z.string().optional(), team_credit_stop_id: z.string().optional() }) @@ -1887,6 +1946,17 @@ export const zDeleteSessionResponse = z.object({ success: z.boolean() }) +/** + * The workspace bound to the presented credential, plus how that credential authenticated. Same shape as Workspace with the caller's role and the auth method added, and without created_at (callers of this endpoint want identity, not provenance). + */ +export const zCurrentWorkspaceResponse = z.object({ + auth_method: z.string(), + id: z.string(), + name: z.string(), + role: z.enum(['owner', 'member']).optional(), + type: z.enum(['personal', 'team']) +}) + /** * Request body for creating a new workspace. */ @@ -1978,7 +2048,10 @@ export const zCreateSessionResponse = z.object({ * Request body for creating a new user secret. */ export const zCreateSecretRequest = z.object({ - credential_type: z.enum(['api_key', 'gcp_service_account']).optional(), + credential_type: z + .enum(['api_key', 'gcp_service_account']) + .optional() + .default('api_key'), name: z.string().min(1).max(255), provider: z.string().max(64).optional(), secret_value: z.string().min(1) @@ -2038,6 +2111,17 @@ export const zBulkRevokeApiKeysResponse = z.object({ revoked_count: z.number().int().gte(0) }) +/** + * A tax identifier for a company Stripe customer. Stripe validates the + * type/value combination synchronously and verifies VAT/ABN-style IDs + * asynchronously. + * + */ +export const zBillingTaxId = z.object({ + type: z.string(), + value: z.string() +}) + /** * Payment lifecycle status */ @@ -2062,6 +2146,7 @@ export const zBillingStatusResponse = z.object({ is_active: z.boolean(), max_seats: z.number().int(), occupied_seats: z.number().int(), + payment_intent_client_secret: z.string().optional(), pending_billing_op_id: z.string().optional(), pending_billing_op_type: z.enum(['subscription', 'topup']).optional(), plan_slug: z.string().optional(), @@ -2086,11 +2171,42 @@ export const zBillingPlansResponse = z.object({ */ export const zBillingOpStatusResponse = z.object({ action_url: z.string().optional(), + authentication_state: z + .enum([ + 'requires_action', + 'processing', + 'failed_retryable', + 'succeeded', + 'reconciliation_needed' + ]) + .optional(), completed_at: z.string().datetime().optional(), + decline_reason: z + .enum([ + 'card_declined', + 'insufficient_funds', + 'expired_card', + 'incorrect_cvc', + 'authentication_required', + 'authentication_failed', + 'processing_error', + 'generic' + ]) + .optional(), error_message: z.string().optional(), id: z.string(), + payment_intent_client_secret: z.string().optional(), + recovery_action: z + .enum([ + 'retry', + 'replace_payment_method', + 'authenticate_payment', + 'contact_support' + ]) + .optional(), + retryable: z.boolean().optional(), started_at: z.string().datetime(), - status: z.enum(['pending', 'succeeded', 'failed']) + status: z.enum(['pending', 'succeeded', 'failed', 'reconciliation_needed']) }) /** @@ -2114,6 +2230,93 @@ export const zBillingEventsResponse = z.object({ totalPages: z.number().int() }) +/** + * A billing address for a company Stripe customer. city and postal_code + * are optional because some countries (e.g. Hong Kong, the UAE, Panama) + * have no postal code and are not collected for them; Stripe validates + * what a given country actually requires. + * + */ +export const zBillingAddress = z.object({ + city: z.string().optional(), + country: z.string(), + line1: z.string(), + line2: z.string().optional(), + postal_code: z.string().optional(), + state: z.string().optional() +}) + +/** + * Fields to set on the workspace's Stripe customer. Every group is + * optional; omit a group to leave that part of the customer unchanged. + * + */ +export const zBillingCompanyDetailsUpdateRequest = z.object({ + address: zBillingAddress.optional(), + company_name: z.string().optional(), + tax_id: zBillingTaxId.optional() +}) + +/** + * Company billing details on file for the workspace's Stripe customer. + * A field is absent until the workspace sets it via PATCH + * /api/billing/company-details. + * + */ +export const zBillingCompanyDetailsResponse = z.object({ + address: zBillingAddress.optional(), + company_name: z.string().optional(), + tax_id: zBillingTaxId.optional() +}) + +export const zBillingCapabilityScope = z.object({ + user_id: z.string(), + workspace_id: z.string() +}) + +/** + * Identifies capability values currently using safe rollout defaults + * instead of deterministic policy results. A true value is UI guidance, + * not evidence that the corresponding write will succeed. + * + */ +export const zBillingCapabilityRolloutDefaults = z.object({ + can_downgrade_to_personal: z.boolean(), + can_subscribe_self_serve: z.boolean(), + can_top_up: z.boolean() +}) + +/** + * Conservative UI guidance. These values do not authorize billing writes; + * each write endpoint independently enforces its permission policy. + * + */ +export const zBillingCapabilities = z.object({ + can_cancel: z.boolean(), + can_change_seats: z.boolean(), + can_downgrade_to_personal: z.boolean(), + can_invite_members: z.boolean(), + can_reactivate: z.boolean(), + can_subscribe_self_serve: z.boolean(), + can_top_up: z.boolean() +}) + +/** + * Effective billing UI guidance for one authenticated user and workspace. + */ +export const zBillingCapabilitiesResponse = z.object({ + capabilities: zBillingCapabilities, + expires_at: z.string().datetime(), + resolved_for: zBillingCapabilityScope, + revision: z.coerce + .bigint() + .min(BigInt('-9223372036854775808'), { + message: 'Invalid value: Expected int64 to be >= -9223372036854775808' + }) + .lte(BigInt(9007199254740991)), + rollout_defaults_applied: zBillingCapabilityRolloutDefaults +}) + /** * Current credit balance and usage details for a workspace. */ @@ -2236,6 +2439,39 @@ export const zAgentThreadCreateRequest = z.object({ workflow_id: z.string().optional() }) +/** + * A user-authored skill pack to create or replace. Plain JSON — a pack body is small enough that a signed-URL upload would be pure overhead. + */ +export const zAgentSkillPublishRequest = z.object({ + always: z.boolean().optional().default(false), + body: z.string(), + description: z.string().max(1024), + name: z + .string() + .max(64) + .regex(/^[A-Za-z0-9._-]*[A-Za-z0-9_-][A-Za-z0-9._-]*$/) +}) + +/** + * One of the caller's user-authored skill packs. + */ +export const zAgentSkill = z.object({ + body: z.string(), + body_hash: z.string(), + created_at: z.string(), + description: z.string(), + id: z.string(), + name: z.string(), + updated_at: z.string() +}) + +/** + * The caller's skill packs, ordered by name. + */ +export const zAgentSkillListResponse = z.object({ + skills: z.array(zAgentSkill) +}) + /** * A user turn posted to the agent. */ @@ -2374,47 +2610,25 @@ export const zAssetCreatedWritable = zAssetWritable.and( }) ) -export const zGetJwksData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * JWKS response */ export const zGetJwksResponse = zJwksResponse -export const zGetOAuthAuthorizationServerData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Authorization-server metadata */ export const zGetOAuthAuthorizationServerResponse = zOAuthAuthorizationServerMetadata -export const zGetOAuthProtectedResourceData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Protected-resource metadata */ export const zGetOAuthProtectedResourceResponse = zOAuthProtectedResourceMetadata -export const zGetOAuthProtectedResourceByPathData = z.object({ - body: z.never().optional(), - path: z.object({ - resourcePath: z.string().regex(/^[a-zA-Z0-9._-]+$/) - }), - query: z.never().optional() +export const zGetOAuthProtectedResourceByPathPath = z.object({ + resourcePath: z.string().regex(/^[a-zA-Z0-9._-]+$/) }) /** @@ -2423,28 +2637,16 @@ export const zGetOAuthProtectedResourceByPathData = z.object({ export const zGetOAuthProtectedResourceByPathResponse = zOAuthProtectedResourceMetadata -export const zGetCustomNodeProxyData = z.object({ - body: z.never().optional(), - path: z.object({ - path: z.string() - }), - query: z.never().optional() +export const zGetCustomNodeProxyPath = z.object({ + path: z.string() }) -export const zPostCustomNodeProxyData = z.object({ - body: z.never().optional(), - path: z.object({ - path: z.string() - }), - query: z.never().optional() +export const zPostCustomNodeProxyPath = z.object({ + path: z.string() }) -export const zAgentGetDraftData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - workflow_id: z.string() - }) +export const zAgentGetDraftQuery = z.object({ + workflow_id: z.string() }) /** @@ -2452,15 +2654,33 @@ export const zAgentGetDraftData = z.object({ */ export const zAgentGetDraftResponse = zAgentDraftSnapshot -export const zAgentListThreadsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - limit: z.number().int().gte(1).lte(100).optional().default(20), - after: z.string().optional() - }) - .optional() +/** + * The caller's skill packs. + */ +export const zAgentListSkillsResponse = zAgentSkillListResponse + +export const zAgentPublishSkillBody = zAgentSkillPublishRequest + +/** + * An existing pack of the same name was replaced. + */ +export const zAgentPublishSkillResponse = zAgentSkill + +export const zAgentDeleteSkillPath = z.object({ + name: z + .string() + .max(64) + .regex(/^[A-Za-z0-9._-]*[A-Za-z0-9_-][A-Za-z0-9._-]*$/) +}) + +/** + * The pack was deleted. + */ +export const zAgentDeleteSkillResponse = z.void() + +export const zAgentListThreadsQuery = z.object({ + limit: z.number().int().gte(1).lte(100).optional().default(20), + after: z.string().optional() }) /** @@ -2468,24 +2688,18 @@ export const zAgentListThreadsData = z.object({ */ export const zAgentListThreadsResponse = zAgentThreadListResponse -export const zAgentCreateThreadData = z.object({ - body: zAgentThreadCreateRequest.optional(), - path: z.never().optional(), - query: z.never().optional() -}) +export const zAgentCreateThreadBody = zAgentThreadCreateRequest /** * Thread created */ export const zAgentCreateThreadResponse = zAgentThreadCreated -export const zAgentAnswerAskData = z.object({ - body: zAgentAnswerRequest, - path: z.object({ - id: z.string(), - ask_id: z.string() - }), - query: z.never().optional() +export const zAgentAnswerAskBody = zAgentAnswerRequest + +export const zAgentAnswerAskPath = z.object({ + id: z.string(), + ask_id: z.string() }) /** @@ -2493,12 +2707,8 @@ export const zAgentAnswerAskData = z.object({ */ export const zAgentAnswerAskResponse = zAgentAnswerAccepted -export const zAgentGetMessagesData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zAgentGetMessagesPath = z.object({ + id: z.string() }) /** @@ -2506,12 +2716,10 @@ export const zAgentGetMessagesData = z.object({ */ export const zAgentGetMessagesResponse = z.array(zAgentMessage) -export const zAgentPostMessageData = z.object({ - body: zAgentPostMessageRequest, - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zAgentPostMessageBody = zAgentPostMessageRequest + +export const zAgentPostMessagePath = z.object({ + id: z.string() }) /** @@ -2519,13 +2727,9 @@ export const zAgentPostMessageData = z.object({ */ export const zAgentPostMessageResponse = zAgentTurnAccepted -export const zAgentCancelMessageData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string(), - message_id: z.string() - }), - query: z.never().optional() +export const zAgentCancelMessagePath = z.object({ + id: z.string(), + message_id: z.string() }) /** @@ -2533,29 +2737,24 @@ export const zAgentCancelMessageData = z.object({ */ export const zAgentCancelMessageResponse = zAgentCancelAccepted -export const zListAssetsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - include_tags: z.array(z.string()).optional(), - exclude_tags: z.array(z.string()).optional(), - tags_all: z.array(z.string()).optional(), - tags_any: z.array(z.string()).optional(), - tags_none: z.array(z.string()).optional(), - name_contains: z.string().optional(), - metadata_filter: z.string().optional(), - limit: z.number().int().gte(1).lte(500).optional().default(20), - offset: z.number().int().gte(0).optional().default(0), - sort: z - .enum(['name', 'created_at', 'updated_at', 'size', 'last_access_time']) - .optional(), - order: z.enum(['asc', 'desc']).optional(), - include_public: z.boolean().optional().default(true), - hash: z.string().optional(), - after: z.string().optional() - }) +export const zListAssetsQuery = z.object({ + include_tags: z.array(z.string()).optional(), + exclude_tags: z.array(z.string()).optional(), + tags_all: z.array(z.string()).optional(), + tags_any: z.array(z.string()).optional(), + tags_none: z.array(z.string()).optional(), + name_contains: z.string().optional(), + metadata_filter: z.string().optional(), + limit: z.number().int().gte(1).lte(500).optional().default(20), + offset: z.number().int().gte(0).optional().default(0), + sort: z + .enum(['name', 'created_at', 'updated_at', 'size', 'last_access_time']) .optional() + .default('created_at'), + order: z.enum(['asc', 'desc']).optional().default('desc'), + include_public: z.boolean().optional().default(true), + hash: z.string().optional(), + after: z.string().optional() }) /** @@ -2563,22 +2762,18 @@ export const zListAssetsData = z.object({ */ export const zListAssetsResponse2 = zListAssetsResponse -export const zCreateAssetData = z.object({ - body: z.object({ - file: z.string(), - hash: z - .string() - .regex(/^(blake3|sha256):[a-f0-9]{64}$/) - .optional(), - id: z.string().uuid().optional(), - mime_type: z.string().optional(), - name: z.string().optional(), - preview_id: z.string().uuid().optional(), - tags: z.string().optional(), - user_metadata: z.string().optional() - }), - path: z.never().optional(), - query: z.never().optional() +export const zCreateAssetBody = z.object({ + file: z.string(), + hash: z + .string() + .regex(/^(blake3|sha256):[a-f0-9]{64}$/) + .optional(), + id: z.string().uuid().optional(), + mime_type: z.string().optional(), + name: z.string().optional(), + preview_id: z.string().uuid().optional(), + tags: z.string().optional(), + user_metadata: z.string().optional() }) /** @@ -2588,12 +2783,8 @@ export const zCreateAssetData = z.object({ */ export const zCreateAssetResponse = zAssetCreated -export const zDeleteAssetData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zDeleteAssetPath = z.object({ + id: z.string().uuid() }) /** @@ -2601,12 +2792,8 @@ export const zDeleteAssetData = z.object({ */ export const zDeleteAssetResponse = z.void() -export const zGetAssetByIdData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zGetAssetByIdPath = z.object({ + id: z.string().uuid() }) /** @@ -2614,17 +2801,15 @@ export const zGetAssetByIdData = z.object({ */ export const zGetAssetByIdResponse = zAsset -export const zUpdateAssetData = z.object({ - body: z.object({ - mime_type: z.string().optional(), - name: z.string().optional(), - preview_id: z.string().uuid().optional(), - user_metadata: z.record(z.unknown()).optional() - }), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zUpdateAssetBody = z.object({ + mime_type: z.string().optional(), + name: z.string().optional(), + preview_id: z.string().uuid().optional(), + user_metadata: z.record(z.unknown()).optional() +}) + +export const zUpdateAssetPath = z.object({ + id: z.string().uuid() }) /** @@ -2632,16 +2817,12 @@ export const zUpdateAssetData = z.object({ */ export const zUpdateAssetResponse = zAssetUpdated -export const zGetAssetContentData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z - .object({ - disposition: z.enum(['inline', 'attachment']).optional() - }) - .optional() +export const zGetAssetContentPath = z.object({ + id: z.string() +}) + +export const zGetAssetContentQuery = z.object({ + disposition: z.enum(['inline', 'attachment']).optional().default('attachment') }) /** @@ -2649,14 +2830,12 @@ export const zGetAssetContentData = z.object({ */ export const zGetAssetContentResponse = z.string() -export const zRemoveAssetTagsData = z.object({ - body: z.object({ - tags: z.array(z.string()).min(1) - }), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zRemoveAssetTagsBody = z.object({ + tags: z.array(z.string()).min(1) +}) + +export const zRemoveAssetTagsPath = z.object({ + id: z.string().uuid() }) /** @@ -2664,14 +2843,12 @@ export const zRemoveAssetTagsData = z.object({ */ export const zRemoveAssetTagsResponse = zTagsModificationResponse -export const zAddAssetTagsData = z.object({ - body: z.object({ - tags: z.array(z.string()).min(1) - }), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zAddAssetTagsBody = z.object({ + tags: z.array(z.string()).min(1) +}) + +export const zAddAssetTagsPath = z.object({ + id: z.string().uuid() }) /** @@ -2679,15 +2856,11 @@ export const zAddAssetTagsData = z.object({ */ export const zAddAssetTagsResponse = zTagsModificationResponse -export const zCreateAssetDownloadData = z.object({ - body: z.object({ - preview_id: z.string().uuid().optional(), - source_url: z.string().url(), - tags: z.array(z.string()).optional(), - user_metadata: z.record(z.unknown()).optional() - }), - path: z.never().optional(), - query: z.never().optional() +export const zCreateAssetDownloadBody = z.object({ + preview_id: z.string().uuid().optional(), + source_url: z.string().url(), + tags: z.array(z.string()).optional(), + user_metadata: z.record(z.unknown()).optional() }) export const zCreateAssetDownloadResponse = z.union([ @@ -2695,18 +2868,15 @@ export const zCreateAssetDownloadResponse = z.union([ zAssetDownloadResponse ]) -export const zCreateAssetExportData = z.object({ - body: z.object({ - asset_ids: z.array(z.string()).optional(), - include_previews: z.boolean().optional().default(false), - job_asset_name_filters: z.record(z.array(z.string()).min(1)).optional(), - job_ids: z.array(z.string()).optional(), - naming_strategy: z - .enum(['group_by_job_id', 'preserve', 'asset_id', 'group_by_job_time']) - .optional() - }), - path: z.never().optional(), - query: z.never().optional() +export const zCreateAssetExportBody = z.object({ + asset_ids: z.array(z.string()).optional(), + include_previews: z.boolean().optional().default(false), + job_asset_name_filters: z.record(z.array(z.string()).min(1)).optional(), + job_ids: z.array(z.string()).optional(), + naming_strategy: z + .enum(['group_by_job_id', 'preserve', 'asset_id', 'group_by_job_time']) + .optional() + .default('group_by_job_time') }) /** @@ -2714,12 +2884,8 @@ export const zCreateAssetExportData = z.object({ */ export const zCreateAssetExportResponse = zAssetDownloadResponse -export const zDownloadExportData = z.object({ - body: z.never().optional(), - path: z.object({ - exportName: z.string().regex(/^[a-zA-Z0-9_-]+\.zip$/) - }), - query: z.never().optional() +export const zDownloadExportPath = z.object({ + exportName: z.string().regex(/^[a-zA-Z0-9_-]+\.zip$/) }) /** @@ -2727,16 +2893,12 @@ export const zDownloadExportData = z.object({ */ export const zDownloadExportResponse = zExportDownloadUrlResponse -export const zCreateAssetFromHashData = z.object({ - body: z.object({ - hash: z.string().regex(/^blake3:[a-f0-9]{64}$/), - mime_type: z.string().optional(), - name: z.string().optional(), - tags: z.array(z.string()).min(1), - user_metadata: z.record(z.unknown()).optional() - }), - path: z.never().optional(), - query: z.never().optional() +export const zCreateAssetFromHashBody = z.object({ + hash: z.string().regex(/^blake3:[a-f0-9]{64}$/), + mime_type: z.string().optional(), + name: z.string().optional(), + tags: z.array(z.string()).min(1), + user_metadata: z.record(z.unknown()).optional() }) /** @@ -2746,42 +2908,24 @@ export const zCreateAssetFromHashData = z.object({ */ export const zCreateAssetFromHashResponse = zAssetCreated -export const zPostAssetsFromWorkflowData = z.object({ - body: zWorkflowApiAssetsRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zPostAssetsFromWorkflowBody = zWorkflowApiAssetsRequest /** * Success */ export const zPostAssetsFromWorkflowResponse = zWorkflowApiAssetsResponse -export const zCheckAssetByHashData = z.object({ - body: z.never().optional(), - path: z.object({ - hash: z.string().regex(/^blake3:[a-f0-9]{64}$/) - }), - query: z.never().optional() +export const zCheckAssetByHashPath = z.object({ + hash: z.string().regex(/^blake3:[a-f0-9]{64}$/) }) -export const zImportPublishedAssetsData = z.object({ - body: zImportPublishedAssetsRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zImportPublishedAssetsBody = zImportPublishedAssetsRequest /** * Successfully imported assets */ export const zImportPublishedAssetsResponse2 = zImportPublishedAssetsResponse -export const zPruneAssetsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Prune result */ @@ -2790,12 +2934,8 @@ export const zPruneAssetsResponse = z.object({ status: z.string().optional() }) -export const zGetRemoteAssetMetadataData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - url: z.string().url() - }) +export const zGetRemoteAssetMetadataQuery = z.object({ + url: z.string().url() }) /** @@ -2803,14 +2943,8 @@ export const zGetRemoteAssetMetadataData = z.object({ */ export const zGetRemoteAssetMetadataResponse = zAssetMetadataResponse -export const zSeedAssetsData = z.object({ - body: z - .object({ - roots: z.array(z.string()).optional() - }) - .optional(), - path: z.never().optional(), - query: z.never().optional() +export const zSeedAssetsBody = z.object({ + roots: z.array(z.string()).optional() }) /** @@ -2820,12 +2954,6 @@ export const zSeedAssetsResponse = z.object({ status: z.string().optional() }) -export const zCancelAssetSeedData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Scan cancelled */ @@ -2833,33 +2961,21 @@ export const zCancelAssetSeedResponse = z.object({ status: z.string().optional() }) -export const zGetAssetSeedStatusData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Scan progress details (files scanned, total, status, etc.) */ export const zGetAssetSeedStatusResponse = z.record(z.unknown()) -export const zGetAssetTagHistogramData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - include_tags: z.array(z.string()).optional(), - exclude_tags: z.array(z.string()).optional(), - tags_all: z.array(z.string()).optional(), - tags_any: z.array(z.string()).optional(), - tags_none: z.array(z.string()).optional(), - name_contains: z.string().optional(), - metadata_filter: z.string().optional(), - limit: z.number().int().gte(1).lte(1000).optional().default(100), - include_public: z.boolean().optional().default(true) - }) - .optional() +export const zGetAssetTagHistogramQuery = z.object({ + include_tags: z.array(z.string()).optional(), + exclude_tags: z.array(z.string()).optional(), + tags_all: z.array(z.string()).optional(), + tags_any: z.array(z.string()).optional(), + tags_none: z.array(z.string()).optional(), + name_contains: z.string().optional(), + metadata_filter: z.string().optional(), + limit: z.number().int().gte(1).lte(1000).optional().default(100), + include_public: z.boolean().optional().default(true) }) /** @@ -2867,22 +2983,14 @@ export const zGetAssetTagHistogramData = z.object({ */ export const zGetAssetTagHistogramResponse = zAssetTagHistogramResponse -export const zCreateDesktopLoginCodeData = z.object({ - body: zDesktopLoginCodeCreateRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateDesktopLoginCodeBody = zDesktopLoginCodeCreateRequest /** * Login code created */ export const zCreateDesktopLoginCodeResponse = zDesktopLoginCodeCreateResponse -export const zExchangeDesktopLoginCodeData = z.object({ - body: zDesktopLoginCodeExchangeRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zExchangeDesktopLoginCodeBody = zDesktopLoginCodeExchangeRequest /** * Pending (not yet redeemed) or complete with a custom token @@ -2890,86 +2998,67 @@ export const zExchangeDesktopLoginCodeData = z.object({ export const zExchangeDesktopLoginCodeResponse = zDesktopLoginCodeExchangeResponse -export const zRedeemDesktopLoginCodeData = z.object({ - body: zDesktopLoginCodeRedeemRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zRedeemDesktopLoginCodeBody = zDesktopLoginCodeRedeemRequest /** * Code redeemed (or already redeemed by the same user) */ export const zRedeemDesktopLoginCodeResponse = zDesktopLoginCodeRedeemResponse -export const zDeleteSessionData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Session deleted successfully */ export const zDeleteSessionResponse2 = zDeleteSessionResponse -export const zCreateSessionData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Session created successfully */ export const zCreateSessionResponse2 = zCreateSessionResponse -export const zExchangeTokenData = z.object({ - body: zExchangeTokenRequest.optional(), - path: z.never().optional(), - query: z.never().optional() -}) +export const zExchangeTokenBody = zExchangeTokenRequest /** * Token exchanged successfully */ export const zExchangeTokenResponse2 = zExchangeTokenResponse -export const zGetBillingBalanceData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Credit balance */ export const zGetBillingBalanceResponse = zBillingBalanceResponse -export const zGetChurnkeyAuthData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) +/** + * Effective billing capabilities + */ +export const zGetBillingCapabilitiesResponse = zBillingCapabilitiesResponse /** * Success */ export const zGetChurnkeyAuthResponse = zChurnkeyAuthResponse -export const zGetBillingEventsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - page: z.number().int().gte(1).optional().default(1), - limit: z.number().int().gte(1).lte(100).optional().default(20), - scope: z.enum(['self', 'workspace', 'user']).optional(), - user_id: z.string().optional(), - filter: z.string().optional(), - start_date: z.string().datetime().optional(), - end_date: z.string().datetime().optional() - }) - .optional() +/** + * Success + */ +export const zGetBillingCompanyDetailsResponse = zBillingCompanyDetailsResponse + +export const zUpdateBillingCompanyDetailsBody = + zBillingCompanyDetailsUpdateRequest + +/** + * Success + */ +export const zUpdateBillingCompanyDetailsResponse = + zBillingCompanyDetailsResponse + +export const zGetBillingEventsQuery = z.object({ + page: z.number().int().gte(1).optional().default(1), + limit: z.number().int().gte(1).lte(100).optional().default(20), + scope: z.enum(['self', 'workspace', 'user']).optional().default('self'), + user_id: z.string().optional(), + filter: z.string().optional(), + start_date: z.string().datetime().optional(), + end_date: z.string().datetime().optional() }) /** @@ -2977,12 +3066,8 @@ export const zGetBillingEventsData = z.object({ */ export const zGetBillingEventsResponse = zBillingEventsResponse -export const zGetBillingOpStatusData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zGetBillingOpStatusPath = z.object({ + id: z.string() }) /** @@ -2990,106 +3075,72 @@ export const zGetBillingOpStatusData = z.object({ */ export const zGetBillingOpStatusResponse = zBillingOpStatusResponse -export const zGetPaymentPortalData = z.object({ - body: zPaymentPortalRequest.optional(), - path: z.never().optional(), - query: z.never().optional() -}) +/** + * Saved payment methods + */ +export const zListSavedPaymentMethodsResponse = z.array(zSavedPaymentMethod) + +export const zGetPaymentPortalBody = zPaymentPortalRequest /** * Success */ export const zGetPaymentPortalResponse = zPaymentPortalResponse -export const zGetBillingPlansData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Available plans with pricing */ export const zGetBillingPlansResponse = zBillingPlansResponse -export const zPreviewSubscribeData = z.object({ - body: zPreviewSubscribeRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zPreviewSubscribeBody = zPreviewSubscribeRequest /** * Subscription preview */ export const zPreviewSubscribeResponse2 = zPreviewSubscribeResponse -export const zGetBillingStatusData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Billing status */ export const zGetBillingStatusResponse = zBillingStatusResponse -export const zSubscribeData = z.object({ - body: zSubscribeRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zSubscribeBody = zSubscribeRequest /** * Subscription created or payment method needed */ export const zSubscribeResponse2 = zSubscribeResponse -export const zCancelSubscriptionData = z.object({ - body: zCancelSubscriptionRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCancelSubscriptionBody = zCancelSubscriptionRequest /** * Subscription cancellation scheduled */ export const zCancelSubscriptionResponse2 = zCancelSubscriptionResponse -export const zResubscribeData = z.object({ - body: zResubscribeRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zResubscribeBody = zResubscribeRequest /** * Subscription resumed successfully */ export const zResubscribeResponse2 = zResubscribeResponse -export const zCreateTopupData = z.object({ - body: zCreateTopupRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateTopupBody = zCreateTopupRequest /** * Top-up initiated successfully */ export const zCreateTopupResponse2 = zCreateTopupResponse -export const zGetBillingUsageTimeSeriesData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - group_by: z.enum(['model', 'endpoint', 'product']).optional(), - granularity: z.enum(['hour', 'day', 'month']).optional(), - starting_on: z.string().datetime().optional(), - ending_before: z.string().datetime().optional(), - months: z.number().int().gte(1).lte(24).optional().default(6) - }) +export const zGetBillingUsageTimeSeriesQuery = z.object({ + group_by: z + .enum(['model', 'endpoint', 'product']) .optional() + .default('model'), + granularity: z.enum(['hour', 'day', 'month']).optional().default('month'), + starting_on: z.string().datetime().optional(), + ending_before: z.string().datetime().optional(), + months: z.number().int().gte(1).lte(24).optional().default(6) }) /** @@ -3097,34 +3148,18 @@ export const zGetBillingUsageTimeSeriesData = z.object({ */ export const zGetBillingUsageTimeSeriesResponse = zUsageTimeSeries -export const zGetEmbeddingsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Embedding names */ export const zGetEmbeddingsResponse = z.array(z.string()) -export const zGetModelFoldersData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success - List of model folders */ export const zGetModelFoldersResponse = z.array(zModelFolder) -export const zGetModelsInFolderData = z.object({ - body: z.never().optional(), - path: z.object({ - folder: z.string() - }), - query: z.never().optional() +export const zGetModelsInFolderPath = z.object({ + folder: z.string() }) /** @@ -3132,34 +3167,14 @@ export const zGetModelsInFolderData = z.object({ */ export const zGetModelsInFolderResponse = z.array(zModelFile) -export const zGetModelPreviewData = z.object({ - body: z.never().optional(), - path: z.object({ - folder: z.string(), - path_index: z.number().int(), - filename: z.string() - }), - query: z.never().optional() -}) - -export const zGetNodeInfoSchemaData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - -export const zGetNodeByIdData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zGetModelPreviewPath = z.object({ + folder: z.string(), + path_index: z.number().int(), + filename: z.string() }) -export const zGetExtensionsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zGetNodeByIdPath = z.object({ + id: z.string() }) /** @@ -3167,12 +3182,6 @@ export const zGetExtensionsData = z.object({ */ export const zGetExtensionsResponse = z.array(z.string()) -export const zGetFeaturesData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ @@ -3188,23 +3197,15 @@ export const zGetFeaturesResponse = z.object({ supports_preview_metadata: z.boolean().optional() }) -export const zSubmitFeedbackData = z.object({ - body: zFeedbackRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zSubmitFeedbackBody = zFeedbackRequest /** * Feedback submitted successfully */ export const zSubmitFeedbackResponse = zFeedbackResponse -export const zGetMaskLayersData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string() - }) +export const zGetMaskLayersQuery = z.object({ + filename: z.string() }) /** @@ -3217,21 +3218,9 @@ export const zGetMaskLayersResponse = z.object({ painted_masked: z.string().nullish() }) -export const zFreeMemoryData = z.object({ - body: z - .object({ - free_memory: z.boolean().optional(), - unload_models: z.boolean().optional() - }) - .optional(), - path: z.never().optional(), - query: z.never().optional() -}) - -export const zGetGlobalSubgraphsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zFreeMemoryBody = z.object({ + free_memory: z.boolean().optional(), + unload_models: z.boolean().optional() }) /** @@ -3239,12 +3228,8 @@ export const zGetGlobalSubgraphsData = z.object({ */ export const zGetGlobalSubgraphsResponse = z.record(zGlobalSubgraphInfo) -export const zGetGlobalSubgraphData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zGetGlobalSubgraphPath = z.object({ + id: z.string() }) /** @@ -3252,35 +3237,15 @@ export const zGetGlobalSubgraphData = z.object({ */ export const zGetGlobalSubgraphResponse = zGlobalSubgraphData -export const zGetLegacyHistoryData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - -export const zManageHistoryData = z.object({ - body: zHistoryManageRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zManageHistoryBody = zHistoryManageRequest -export const zGetLegacyHistoryByIdData = z.object({ - body: z.never().optional(), - path: z.object({ - prompt_id: z.string() - }), - query: z.never().optional() +export const zGetLegacyHistoryByIdPath = z.object({ + prompt_id: z.string() }) -export const zGetHistoryData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - max_items: z.number().int().optional(), - offset: z.number().int().optional().default(0) - }) - .optional() +export const zGetHistoryQuery = z.object({ + max_items: z.number().int().optional(), + offset: z.number().int().optional().default(0) }) /** @@ -3288,12 +3253,8 @@ export const zGetHistoryData = z.object({ */ export const zGetHistoryResponse = zHistoryResponse -export const zGetHistoryForPromptData = z.object({ - body: z.never().optional(), - path: z.object({ - prompt_id: z.string() - }), - query: z.never().optional() +export const zGetHistoryForPromptPath = z.object({ + prompt_id: z.string() }) /** @@ -3301,25 +3262,15 @@ export const zGetHistoryForPromptData = z.object({ */ export const zGetHistoryForPromptResponse = zHistoryDetailResponse -export const zCreateHubAssetUploadUrlData = z.object({ - body: zHubAssetUploadUrlRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateHubAssetUploadUrlBody = zHubAssetUploadUrlRequest /** * Presigned upload URL and token */ export const zCreateHubAssetUploadUrlResponse = zHubAssetUploadUrlResponse -export const zListHubLabelsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - type: z.enum(['tag', 'model', 'custom_node']).optional() - }) - .optional() +export const zListHubLabelsQuery = z.object({ + type: z.enum(['tag', 'model', 'custom_node']).optional() }) /** @@ -3327,23 +3278,15 @@ export const zListHubLabelsData = z.object({ */ export const zListHubLabelsResponse = zHubLabelListResponse -export const zCreateHubProfileData = z.object({ - body: zCreateHubProfileRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateHubProfileBody = zCreateHubProfileRequest /** * Hub profile created */ export const zCreateHubProfileResponse = zHubProfile -export const zGetHubProfileByUsernameData = z.object({ - body: z.never().optional(), - path: z.object({ - username: z.string() - }), - query: z.never().optional() +export const zGetHubProfileByUsernamePath = z.object({ + username: z.string() }) /** @@ -3351,12 +3294,10 @@ export const zGetHubProfileByUsernameData = z.object({ */ export const zGetHubProfileByUsernameResponse = zHubProfile -export const zUpdateHubProfileData = z.object({ - body: zUpdateHubProfileRequest, - path: z.object({ - username: z.string() - }), - query: z.never().optional() +export const zUpdateHubProfileBody = zUpdateHubProfileRequest + +export const zUpdateHubProfilePath = z.object({ + username: z.string() }) /** @@ -3364,12 +3305,8 @@ export const zUpdateHubProfileData = z.object({ */ export const zUpdateHubProfileResponse = zHubProfile -export const zCheckHubUsernameData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - username: z.string() - }) +export const zCheckHubUsernameQuery = z.object({ + username: z.string() }) /** @@ -3377,31 +3314,19 @@ export const zCheckHubUsernameData = z.object({ */ export const zCheckHubUsernameResponse = zHubUsernameCheckResponse -export const zGetMyHubProfileData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Hub profile */ export const zGetMyHubProfileResponse = zHubProfile -export const zListHubWorkflowsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - cursor: z.string().optional(), - limit: z.number().int().gte(1).lte(100).optional().default(20), - search: z.string().optional(), - tag: z.string().optional(), - username: z.string().optional(), - detail: z.boolean().optional().default(false), - status: z.array(zHubWorkflowStatus).optional() - }) - .optional() +export const zListHubWorkflowsQuery = z.object({ + cursor: z.string().optional(), + limit: z.number().int().gte(1).lte(100).optional().default(20), + search: z.string().optional(), + tag: z.string().optional(), + username: z.string().optional(), + detail: z.boolean().optional().default(false), + status: z.array(zHubWorkflowStatus).optional() }) /** @@ -3409,23 +3334,15 @@ export const zListHubWorkflowsData = z.object({ */ export const zListHubWorkflowsResponse = zHubWorkflowListResponse -export const zPublishHubWorkflowData = z.object({ - body: zPublishHubWorkflowRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zPublishHubWorkflowBody = zPublishHubWorkflowRequest /** * Workflow published to hub */ export const zPublishHubWorkflowResponse = zHubWorkflowDetail -export const zDeleteHubWorkflowData = z.object({ - body: z.never().optional(), - path: z.object({ - share_id: z.string() - }), - query: z.never().optional() +export const zDeleteHubWorkflowPath = z.object({ + share_id: z.string() }) /** @@ -3433,12 +3350,8 @@ export const zDeleteHubWorkflowData = z.object({ */ export const zDeleteHubWorkflowResponse = z.void() -export const zGetHubWorkflowData = z.object({ - body: z.never().optional(), - path: z.object({ - share_id: z.string() - }), - query: z.never().optional() +export const zGetHubWorkflowPath = z.object({ + share_id: z.string() }) /** @@ -3446,14 +3359,8 @@ export const zGetHubWorkflowData = z.object({ */ export const zGetHubWorkflowResponse = zHubWorkflowDetail -export const zListHubWorkflowIndexData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - status: z.array(zHubWorkflowStatus).optional() - }) - .optional() +export const zListHubWorkflowIndexQuery = z.object({ + status: z.array(zHubWorkflowStatus).optional() }) /** @@ -3461,40 +3368,20 @@ export const zListHubWorkflowIndexData = z.object({ */ export const zListHubWorkflowIndexResponse = z.array(zHubWorkflowTemplateEntry) -export const zGetI18nData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Nested map of locale to translation key-value pairs */ export const zGetI18nResponse = z.record(z.unknown()) -export const zCreateInputUploadUrlData = z.object({ - body: zInputUploadUrlRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateInputUploadUrlBody = zInputUploadUrlRequest /** * Upload grant minted */ export const zCreateInputUploadUrlResponse = zUploadGrantResponse -export const zInterruptJobData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - -export const zAcceptWorkspaceInviteData = z.object({ - body: z.never().optional(), - path: z.object({ - token: z.string() - }), - query: z.never().optional() +export const zAcceptWorkspaceInvitePath = z.object({ + token: z.string() }) /** @@ -3502,28 +3389,16 @@ export const zAcceptWorkspaceInviteData = z.object({ */ export const zAcceptWorkspaceInviteResponse = zAcceptInviteResponse -export const zGetLegacyJobByIdData = z.object({ - body: z.never().optional(), - path: z.object({ - job_id: z.string() - }), - query: z.never().optional() +export const zGetLegacyJobByIdPath = z.object({ + job_id: z.string() }) -export const zGetLegacyJobOutputsData = z.object({ - body: z.never().optional(), - path: z.object({ - job_id: z.string() - }), - query: z.never().optional() +export const zGetLegacyJobOutputsPath = z.object({ + job_id: z.string() }) -export const zGetJobStatusData = z.object({ - body: z.never().optional(), - path: z.object({ - job_id: z.string().uuid() - }), - query: z.never().optional() +export const zGetJobStatusPath = z.object({ + job_id: z.string().uuid() }) /** @@ -3531,21 +3406,18 @@ export const zGetJobStatusData = z.object({ */ export const zGetJobStatusResponse = zJobStatusResponse -export const zListJobsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - status: z.string().optional(), - workflow_id: z.string().optional(), - output_type: z.enum(['image', 'video', 'audio', '3d']).optional(), - sort_by: z.enum(['create_time', 'execution_time']).optional(), - sort_order: z.enum(['asc', 'desc']).optional(), - after: z.string().optional(), - offset: z.number().int().gte(0).optional().default(0), - limit: z.number().int().gte(1).lte(1000).optional().default(100) - }) +export const zListJobsQuery = z.object({ + status: z.string().optional(), + workflow_id: z.string().optional(), + output_type: z.enum(['image', 'video', 'audio', '3d']).optional(), + sort_by: z + .enum(['create_time', 'execution_time']) .optional() + .default('create_time'), + sort_order: z.enum(['asc', 'desc']).optional().default('desc'), + after: z.string().optional(), + offset: z.number().int().gte(0).optional().default(0), + limit: z.number().int().gte(1).lte(1000).optional().default(100) }) /** @@ -3553,16 +3425,12 @@ export const zListJobsData = z.object({ */ export const zListJobsResponse = zJobsListResponse -export const zGetJobDetailData = z.object({ - body: z.never().optional(), - path: z.object({ - job_id: z.string().uuid() - }), - query: z - .object({ - short_link: z.enum(['ephemeral_tool_chain', 'default']).optional() - }) - .optional() +export const zGetJobDetailPath = z.object({ + job_id: z.string().uuid() +}) + +export const zGetJobDetailQuery = z.object({ + short_link: z.enum(['ephemeral_tool_chain', 'default']).optional() }) /** @@ -3570,17 +3438,13 @@ export const zGetJobDetailData = z.object({ */ export const zGetJobDetailResponse = zJobDetailResponse -export const zGetJobAssetsData = z.object({ - body: z.never().optional(), - path: z.object({ - job_id: z.string().uuid() - }), - query: z - .object({ - limit: z.number().int().gte(1).lte(500).optional().default(20), - offset: z.number().int().gte(0).optional().default(0) - }) - .optional() +export const zGetJobAssetsPath = z.object({ + job_id: z.string().uuid() +}) + +export const zGetJobAssetsQuery = z.object({ + limit: z.number().int().gte(1).lte(500).optional().default(20), + offset: z.number().int().gte(0).optional().default(0) }) /** @@ -3588,12 +3452,8 @@ export const zGetJobAssetsData = z.object({ */ export const zGetJobAssetsResponse = zJobAssetsResponse -export const zCancelJobData = z.object({ - body: z.never().optional(), - path: z.object({ - job_id: z.string().uuid() - }), - query: z.never().optional() +export const zCancelJobPath = z.object({ + job_id: z.string().uuid() }) /** @@ -3601,35 +3461,15 @@ export const zCancelJobData = z.object({ */ export const zCancelJobResponse = zJobCancelResponse -export const zCancelJobsData = z.object({ - body: zJobsCancelRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCancelJobsBody = zJobsCancelRequest /** * Success - cancel requests dispatched (or jobs were already terminal) */ export const zCancelJobsResponse = zJobsCancelResponse -export const zGetLegacyModelsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - -export const zGetLegacyModelsByFolderData = z.object({ - body: z.never().optional(), - path: z.object({ - folder: z.string() - }), - query: z.never().optional() -}) - -export const zGetNodeReplacementsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zGetLegacyModelsByFolderPath = z.object({ + folder: z.string() }) /** @@ -3637,29 +3477,13 @@ export const zGetNodeReplacementsData = z.object({ */ export const zGetNodeReplacementsResponse = z.record(z.unknown()) -export const zGetNodeInfoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ export const zGetNodeInfoResponse = z.record(zNodeInfo) -export const zGetLegacyObjectInfoByNodeClassData = z.object({ - body: z.never().optional(), - path: z.object({ - node_class: z.string() - }), - query: z.never().optional() -}) - -export const zGetPromptInfoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zGetLegacyObjectInfoByNodeClassPath = z.object({ + node_class: z.string() }) /** @@ -3667,29 +3491,15 @@ export const zGetPromptInfoData = z.object({ */ export const zGetPromptInfoResponse = zPromptInfo -export const zExecutePromptData = z.object({ - body: zPromptRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zExecutePromptBody = zPromptRequest /** * Success - Prompt accepted */ export const zExecutePromptResponse = zPromptResponse -export const zGetLegacyPromptByIdData = z.object({ - body: z.never().optional(), - path: z.object({ - prompt_id: z.string() - }), - query: z.never().optional() -}) - -export const zGetProvidersData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zGetLegacyPromptByIdPath = z.object({ + prompt_id: z.string() }) /** @@ -3697,56 +3507,32 @@ export const zGetProvidersData = z.object({ */ export const zGetProvidersResponse = zProviderCatalogResponse -export const zGetQueueInfoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ export const zGetQueueInfoResponse = zQueueInfo -export const zManageQueueData = z.object({ - body: zQueueManageRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zManageQueueBody = zQueueManageRequest /** * Success */ export const zManageQueueResponse = zQueueManageResponse -export const zListSecretsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ export const zListSecretsResponse = zSecretListResponse -export const zCreateSecretData = z.object({ - body: zCreateSecretRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateSecretBody = zCreateSecretRequest /** * Secret created successfully */ export const zCreateSecretResponse = zSecretResponse -export const zDeleteSecretData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zDeleteSecretPath = z.object({ + id: z.string().uuid() }) /** @@ -3754,12 +3540,8 @@ export const zDeleteSecretData = z.object({ */ export const zDeleteSecretResponse = z.void() -export const zGetSecretData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zGetSecretPath = z.object({ + id: z.string().uuid() }) /** @@ -3767,12 +3549,10 @@ export const zGetSecretData = z.object({ */ export const zGetSecretResponse = zSecretResponse -export const zUpdateSecretData = z.object({ - body: zUpdateSecretRequest, - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zUpdateSecretBody = zUpdateSecretRequest + +export const zUpdateSecretPath = z.object({ + id: z.string().uuid() }) /** @@ -3780,45 +3560,28 @@ export const zUpdateSecretData = z.object({ */ export const zUpdateSecretResponse = zSecretResponse -export const zListSecretProvidersData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ export const zListSecretProvidersResponse = zSecretProvidersResponse -export const zGetAllSettingsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * User settings as key-value pairs */ export const zGetAllSettingsResponse = z.record(z.unknown()) -export const zUpdateMultipleSettingsData = z.object({ - body: z.record(z.unknown()), - path: z.never().optional(), - query: z.never().optional() -}) +/** + * Settings to update as key-value pairs + */ +export const zUpdateMultipleSettingsBody = z.record(z.unknown()) /** * Updated user settings */ export const zUpdateMultipleSettingsResponse = z.record(z.unknown()) -export const zGetSettingByIdData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zGetSettingByIdPath = z.object({ + id: z.string() }) /** @@ -3828,12 +3591,13 @@ export const zGetSettingByIdResponse = z.object({ value: z.unknown().optional() }) -export const zUpdateSettingByIdData = z.object({ - body: z.unknown(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +/** + * New value for the setting + */ +export const zUpdateSettingByIdBody = z.unknown() + +export const zUpdateSettingByIdPath = z.object({ + id: z.string() }) /** @@ -3843,30 +3607,18 @@ export const zUpdateSettingByIdResponse = z.object({ value: z.unknown().optional() }) -export const zGetSystemStatsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ export const zGetSystemStatsResponse = zSystemStatsResponse -export const zListTagsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - prefix: z.string().optional(), - limit: z.number().int().gte(1).lte(1000).optional().default(100), - offset: z.number().int().gte(0).optional().default(0), - order: z.enum(['count_desc', 'name_asc']).optional(), - include_zero: z.boolean().optional().default(false), - include_public: z.boolean().optional().default(true) - }) - .optional() +export const zListTagsQuery = z.object({ + prefix: z.string().optional(), + limit: z.number().int().gte(1).lte(1000).optional().default(100), + offset: z.number().int().gte(0).optional().default(0), + order: z.enum(['count_desc', 'name_asc']).optional().default('count_desc'), + include_zero: z.boolean().optional().default(false), + include_public: z.boolean().optional().default(true) }) /** @@ -3874,21 +3626,15 @@ export const zListTagsData = z.object({ */ export const zListTagsResponse2 = zListTagsResponse -export const zListTasksData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - task_name: z.string().optional(), - idempotency_key: z.string().optional(), - status: z.string().optional(), - created_after: z.string().datetime().optional(), - created_before: z.string().datetime().optional(), - sort_order: z.enum(['asc', 'desc']).optional(), - offset: z.number().int().gte(0).optional().default(0), - limit: z.number().int().gte(1).lte(100).optional().default(20) - }) - .optional() +export const zListTasksQuery = z.object({ + task_name: z.string().optional(), + idempotency_key: z.string().optional(), + status: z.string().optional(), + created_after: z.string().datetime().optional(), + created_before: z.string().datetime().optional(), + sort_order: z.enum(['asc', 'desc']).optional().default('desc'), + offset: z.number().int().gte(0).optional().default(0), + limit: z.number().int().gte(1).lte(100).optional().default(20) }) /** @@ -3896,12 +3642,8 @@ export const zListTasksData = z.object({ */ export const zListTasksResponse = zTasksListResponse -export const zGetTaskData = z.object({ - body: z.never().optional(), - path: z.object({ - task_id: z.string().uuid() - }), - query: z.never().optional() +export const zGetTaskPath = z.object({ + task_id: z.string().uuid() }) /** @@ -3909,15 +3651,11 @@ export const zGetTaskData = z.object({ */ export const zGetTaskResponse = zTaskResponse -export const zUploadImageData = z.object({ - body: z.object({ - image: z.string(), - overwrite: z.string().optional(), - subfolder: z.string().optional(), - type: z.string().optional() - }), - path: z.never().optional(), - query: z.never().optional() +export const zUploadImageBody = z.object({ + image: z.string(), + overwrite: z.string().optional(), + subfolder: z.string().optional(), + type: z.string().optional() }) /** @@ -3929,13 +3667,9 @@ export const zUploadImageResponse = z.object({ type: z.string().optional() }) -export const zUploadMaskData = z.object({ - body: z.object({ - image: z.string(), - original_ref: z.string() - }), - path: z.never().optional(), - query: z.never().optional() +export const zUploadMaskBody = z.object({ + image: z.string(), + original_ref: z.string() }) /** @@ -3947,12 +3681,10 @@ export const zUploadMaskResponse = z.object({ type: z.string().optional() }) -export const zUploadGrantPutData = z.object({ - body: z.string(), - path: z.object({ - upload_id: z.string() - }), - query: z.never().optional() +export const zUploadGrantPutBody = z.string() + +export const zUploadGrantPutPath = z.object({ + upload_id: z.string() }) export const zUploadGrantPutResponse = z.union([ @@ -3960,28 +3692,16 @@ export const zUploadGrantPutResponse = z.union([ zWorkflowResponse ]) -export const zGetUserData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Success */ export const zGetUserResponse = zUserResponse -export const zGetUserdataData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - dir: z.string().optional(), - recurse: z.boolean().optional().default(false), - split: z.boolean().optional().default(false), - full_info: z.boolean().optional().default(false) - }) - .optional() +export const zGetUserdataQuery = z.object({ + dir: z.string().optional(), + recurse: z.boolean().optional().default(false), + split: z.boolean().optional().default(false), + full_info: z.boolean().optional().default(false) }) /** @@ -3989,12 +3709,8 @@ export const zGetUserdataData = z.object({ */ export const zGetUserdataResponse = zGetUserDataResponseFull -export const zDeleteUserdataFileData = z.object({ - body: z.never().optional(), - path: z.object({ - file: z.string() - }), - query: z.never().optional() +export const zDeleteUserdataFilePath = z.object({ + file: z.string() }) /** @@ -4002,12 +3718,8 @@ export const zDeleteUserdataFileData = z.object({ */ export const zDeleteUserdataFileResponse = z.void() -export const zGetUserdataFileData = z.object({ - body: z.never().optional(), - path: z.object({ - file: z.string() - }), - query: z.never().optional() +export const zGetUserdataFilePath = z.object({ + file: z.string() }) /** @@ -4015,17 +3727,15 @@ export const zGetUserdataFileData = z.object({ */ export const zGetUserdataFileResponse = z.string() -export const zPostUserdataFileData = z.object({ - body: z.string(), - path: z.object({ - file: z.string() - }), - query: z - .object({ - overwrite: z.enum(['true', 'false']).optional(), - full_info: z.enum(['true', 'false']).optional() - }) - .optional() +export const zPostUserdataFileBody = z.string() + +export const zPostUserdataFilePath = z.object({ + file: z.string() +}) + +export const zPostUserdataFileQuery = z.object({ + overwrite: z.enum(['true', 'false']).optional().default('true'), + full_info: z.enum(['true', 'false']).optional().default('false') }) /** @@ -4033,17 +3743,13 @@ export const zPostUserdataFileData = z.object({ */ export const zPostUserdataFileResponse = zUserDataResponseFull -export const zMoveUserdataFileData = z.object({ - body: z.never().optional(), - path: z.object({ - file: z.string(), - dest: z.string() - }), - query: z - .object({ - overwrite: z.enum(['true', 'false']).optional() - }) - .optional() +export const zMoveUserdataFilePath = z.object({ + file: z.string(), + dest: z.string() +}) + +export const zMoveUserdataFileQuery = z.object({ + overwrite: z.enum(['true', 'false']).optional().default('true') }) /** @@ -4051,12 +3757,8 @@ export const zMoveUserdataFileData = z.object({ */ export const zMoveUserdataFileResponse = zUserDataResponseFull -export const zGetUserdataFilePublishData = z.object({ - body: z.never().optional(), - path: z.object({ - file: z.string() - }), - query: z.never().optional() +export const zGetUserdataFilePublishPath = z.object({ + file: z.string() }) /** @@ -4064,12 +3766,10 @@ export const zGetUserdataFilePublishData = z.object({ */ export const zGetUserdataFilePublishResponse = zWorkflowPublishInfo -export const zPostUserdataFilePublishData = z.object({ - body: zPublishWorkflowAssetsRequest, - path: z.object({ - file: z.string() - }), - query: z.never().optional() +export const zPostUserdataFilePublishBody = zPublishWorkflowAssetsRequest + +export const zPostUserdataFilePublishPath = z.object({ + file: z.string() }) /** @@ -4077,12 +3777,6 @@ export const zPostUserdataFilePublishData = z.object({ */ export const zPostUserdataFilePublishResponse = zWorkflowPublishInfo -export const zGetUsersInfoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Userdata storage information */ @@ -4091,18 +3785,8 @@ export const zGetUsersInfoResponse = z.object({ storage: z.string() }) -export const zGetLegacyUserdataV2Data = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - -export const zGetVhsQueryVideoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string() - }) +export const zGetVhsQueryVideoQuery = z.object({ + filename: z.string() }) /** @@ -4117,41 +3801,29 @@ export const zGetVhsQueryVideoResponse = z.object({ }) }) -export const zGetVhsViewAudioData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string(), - type: z.string().optional(), - subfolder: z.string().optional() - }) +export const zGetVhsViewAudioQuery = z.object({ + filename: z.string(), + type: z.string().optional(), + subfolder: z.string().optional() }) -export const zGetVhsViewVideoData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string(), - type: z.string().optional(), - subfolder: z.string().optional() - }) +export const zGetVhsViewVideoQuery = z.object({ + filename: z.string(), + type: z.string().optional(), + subfolder: z.string().optional() }) -export const zViewFileData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string(), - subfolder: z.string().optional(), - type: z.string().optional(), - fullpath: z.string().optional(), - format: z.string().optional(), - frame_rate: z.number().int().optional(), - workflow: z.string().optional(), - timestamp: z.number().int().optional(), - channel: z.string().optional(), - res: z.number().int().gte(64).lte(1024).optional() - }) +export const zViewFileQuery = z.object({ + filename: z.string(), + subfolder: z.string().optional(), + type: z.string().optional(), + fullpath: z.string().optional(), + format: z.string().optional(), + frame_rate: z.number().int().optional(), + workflow: z.string().optional(), + timestamp: z.number().int().optional(), + channel: z.string().optional(), + res: z.number().int().gte(64).lte(1024).optional() }) /** @@ -4159,26 +3831,12 @@ export const zViewFileData = z.object({ */ export const zViewFileResponse = z.string() -export const zGetLegacyViewMetadataData = z.object({ - body: z.never().optional(), - path: z.object({ - folder_name: z.string() - }), - query: z.never().optional() -}) - -export const zGetApiViewVideoAliasData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string() - }) +export const zGetLegacyViewMetadataPath = z.object({ + folder_name: z.string() }) -export const zGetWorkflowTemplatesData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zGetApiViewVideoAliasQuery = z.object({ + filename: z.string() }) /** @@ -4186,19 +3844,16 @@ export const zGetWorkflowTemplatesData = z.object({ */ export const zGetWorkflowTemplatesResponse = z.record(z.unknown()) -export const zListWorkflowsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - limit: z.number().int().lte(100).optional().default(20), - offset: z.number().int().optional().default(0), - name: z.string().optional(), - default_view: z.enum(['workflow', 'app']).optional(), - sort: z.enum(['create_time', 'update_time', 'name']).optional(), - order: z.enum(['asc', 'desc']).optional() - }) +export const zListWorkflowsQuery = z.object({ + limit: z.number().int().lte(100).optional().default(20), + offset: z.number().int().optional().default(0), + name: z.string().optional(), + default_view: z.enum(['workflow', 'app']).optional(), + sort: z + .enum(['create_time', 'update_time', 'name']) .optional() + .default('create_time'), + order: z.enum(['asc', 'desc']).optional().default('desc') }) /** @@ -4206,23 +3861,15 @@ export const zListWorkflowsData = z.object({ */ export const zListWorkflowsResponse = zWorkflowListResponse -export const zCreateWorkflowData = z.object({ - body: zCreateWorkflowRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateWorkflowBody = zCreateWorkflowRequest /** * Workflow created successfully */ export const zCreateWorkflowResponse = zWorkflowResponse -export const zDeleteWorkflowData = z.object({ - body: z.never().optional(), - path: z.object({ - workflow_id: z.string() - }), - query: z.never().optional() +export const zDeleteWorkflowPath = z.object({ + workflow_id: z.string() }) /** @@ -4230,12 +3877,8 @@ export const zDeleteWorkflowData = z.object({ */ export const zDeleteWorkflowResponse = z.void() -export const zGetWorkflowData = z.object({ - body: z.never().optional(), - path: z.object({ - workflow_id: z.string() - }), - query: z.never().optional() +export const zGetWorkflowPath = z.object({ + workflow_id: z.string() }) /** @@ -4243,12 +3886,10 @@ export const zGetWorkflowData = z.object({ */ export const zGetWorkflowResponse = zWorkflowResponse -export const zUpdateWorkflowData = z.object({ - body: zUpdateWorkflowRequest, - path: z.object({ - workflow_id: z.string() - }), - query: z.never().optional() +export const zUpdateWorkflowBody = zUpdateWorkflowRequest + +export const zUpdateWorkflowPath = z.object({ + workflow_id: z.string() }) /** @@ -4256,12 +3897,8 @@ export const zUpdateWorkflowData = z.object({ */ export const zUpdateWorkflowResponse = zWorkflowResponse -export const zGetWorkflowContentData = z.object({ - body: z.never().optional(), - path: z.object({ - workflow_id: z.string() - }), - query: z.never().optional() +export const zGetWorkflowContentPath = z.object({ + workflow_id: z.string() }) /** @@ -4269,12 +3906,10 @@ export const zGetWorkflowContentData = z.object({ */ export const zGetWorkflowContentResponse = zWorkflowVersionContentResponse -export const zForkWorkflowData = z.object({ - body: zForkWorkflowRequest, - path: z.object({ - workflow_id: z.string() - }), - query: z.never().optional() +export const zForkWorkflowBody = zForkWorkflowRequest + +export const zForkWorkflowPath = z.object({ + workflow_id: z.string() }) /** @@ -4282,12 +3917,10 @@ export const zForkWorkflowData = z.object({ */ export const zForkWorkflowResponse = zWorkflowResponse -export const zCreateWorkflowVersionData = z.object({ - body: zCreateWorkflowVersionRequest, - path: z.object({ - workflow_id: z.string() - }), - query: z.never().optional() +export const zCreateWorkflowVersionBody = zCreateWorkflowVersionRequest + +export const zCreateWorkflowVersionPath = z.object({ + workflow_id: z.string() }) /** @@ -4295,12 +3928,8 @@ export const zCreateWorkflowVersionData = z.object({ */ export const zCreateWorkflowVersionResponse = zWorkflowVersionResponse -export const zGetPublishedWorkflowData = z.object({ - body: z.never().optional(), - path: z.object({ - share_id: z.string() - }), - query: z.never().optional() +export const zGetPublishedWorkflowPath = z.object({ + share_id: z.string() }) /** @@ -4308,25 +3937,15 @@ export const zGetPublishedWorkflowData = z.object({ */ export const zGetPublishedWorkflowResponse = zPublishedWorkflowDetail -export const zCreateWorkflowUploadUrlData = z.object({ - body: zWorkflowUploadUrlRequest.optional(), - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateWorkflowUploadUrlBody = zWorkflowUploadUrlRequest /** * Upload grant minted */ export const zCreateWorkflowUploadUrlResponse = zUploadGrantResponse -export const zListWorkspaceApiKeysData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - include_revoked: z.boolean().optional().default(false) - }) - .optional() +export const zListWorkspaceApiKeysQuery = z.object({ + include_revoked: z.boolean().optional().default(false) }) /** @@ -4334,23 +3953,15 @@ export const zListWorkspaceApiKeysData = z.object({ */ export const zListWorkspaceApiKeysResponse2 = zListWorkspaceApiKeysResponse -export const zCreateWorkspaceApiKeyData = z.object({ - body: zCreateWorkspaceApiKeyRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateWorkspaceApiKeyBody = zCreateWorkspaceApiKeyRequest /** * API key created (plaintext returned once) */ export const zCreateWorkspaceApiKeyResponse2 = zCreateWorkspaceApiKeyResponse -export const zRevokeWorkspaceApiKeyData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string().uuid() - }), - query: z.never().optional() +export const zRevokeWorkspaceApiKeyPath = z.object({ + id: z.string().uuid() }) /** @@ -4358,34 +3969,20 @@ export const zRevokeWorkspaceApiKeyData = z.object({ */ export const zRevokeWorkspaceApiKeyResponse = z.void() -export const zListWorkspaceInvitesData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * List of pending invites */ export const zListWorkspaceInvitesResponse = zListInvitesResponse -export const zCreateWorkspaceInviteData = z.object({ - body: zCreateInviteRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateWorkspaceInviteBody = zCreateInviteRequest /** * Invite created */ export const zCreateWorkspaceInviteResponse = zPendingInvite -export const zRevokeWorkspaceInviteData = z.object({ - body: z.never().optional(), - path: z.object({ - inviteId: z.string() - }), - query: z.never().optional() +export const zRevokeWorkspaceInvitePath = z.object({ + inviteId: z.string() }) /** @@ -4393,12 +3990,8 @@ export const zRevokeWorkspaceInviteData = z.object({ */ export const zRevokeWorkspaceInviteResponse = z.void() -export const zResendWorkspaceInviteData = z.object({ - body: z.never().optional(), - path: z.object({ - inviteId: z.string() - }), - query: z.never().optional() +export const zResendWorkspaceInvitePath = z.object({ + inviteId: z.string() }) /** @@ -4406,26 +3999,14 @@ export const zResendWorkspaceInviteData = z.object({ */ export const zResendWorkspaceInviteResponse = zPendingInvite -export const zLeaveWorkspaceData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Successfully left workspace */ export const zLeaveWorkspaceResponse = z.void() -export const zListWorkspaceMembersData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - offset: z.number().int().gte(0).optional().default(0), - limit: z.number().int().gte(1).lte(100).optional().default(20) - }) - .optional() +export const zListWorkspaceMembersQuery = z.object({ + offset: z.number().int().gte(0).optional().default(0), + limit: z.number().int().gte(1).lte(100).optional().default(20) }) /** @@ -4433,12 +4014,8 @@ export const zListWorkspaceMembersData = z.object({ */ export const zListWorkspaceMembersResponse = zListMembersResponse -export const zBulkRevokeWorkspaceMemberApiKeysData = z.object({ - body: z.never().optional(), - path: z.object({ - user_id: z.string().min(1) - }), - query: z.never().optional() +export const zBulkRevokeWorkspaceMemberApiKeysPath = z.object({ + user_id: z.string().min(1) }) /** @@ -4447,12 +4024,8 @@ export const zBulkRevokeWorkspaceMemberApiKeysData = z.object({ export const zBulkRevokeWorkspaceMemberApiKeysResponse = zBulkRevokeApiKeysResponse -export const zRemoveWorkspaceMemberData = z.object({ - body: z.never().optional(), - path: z.object({ - userId: z.string() - }), - query: z.never().optional() +export const zRemoveWorkspaceMemberPath = z.object({ + userId: z.string() }) /** @@ -4460,12 +4033,10 @@ export const zRemoveWorkspaceMemberData = z.object({ */ export const zRemoveWorkspaceMemberResponse = z.void() -export const zUpdateWorkspaceMemberRoleData = z.object({ - body: zUpdateMemberRoleRequest, - path: z.object({ - userId: z.string() - }), - query: z.never().optional() +export const zUpdateWorkspaceMemberRoleBody = zUpdateMemberRoleRequest + +export const zUpdateWorkspaceMemberRolePath = z.object({ + userId: z.string() }) /** @@ -4473,56 +4044,32 @@ export const zUpdateWorkspaceMemberRoleData = z.object({ */ export const zUpdateWorkspaceMemberRoleResponse = zMember -export const zGetProviderPolicyData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * The policy document */ export const zGetProviderPolicyResponse = zProviderPolicy -export const zPutProviderPolicyData = z.object({ - body: zProviderPolicy, - path: z.never().optional(), - query: z.never().optional() -}) +export const zPutProviderPolicyBody = zProviderPolicy /** * Policy replaced */ export const zPutProviderPolicyResponse = zProviderPolicy -export const zListWorkspacesData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * List of workspaces */ export const zListWorkspacesResponse2 = zListWorkspacesResponse -export const zCreateWorkspaceData = z.object({ - body: zCreateWorkspaceRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zCreateWorkspaceBody = zCreateWorkspaceRequest /** * Workspace created */ export const zCreateWorkspaceResponse = zWorkspace -export const zDeleteWorkspaceData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zDeleteWorkspacePath = z.object({ + id: z.string() }) /** @@ -4530,12 +4077,8 @@ export const zDeleteWorkspaceData = z.object({ */ export const zDeleteWorkspaceResponse = z.void() -export const zGetWorkspaceData = z.object({ - body: z.never().optional(), - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zGetWorkspacePath = z.object({ + id: z.string() }) /** @@ -4543,12 +4086,10 @@ export const zGetWorkspaceData = z.object({ */ export const zGetWorkspaceResponse = zWorkspace -export const zUpdateWorkspaceData = z.object({ - body: zUpdateWorkspaceRequest, - path: z.object({ - id: z.string() - }), - query: z.never().optional() +export const zUpdateWorkspaceBody = zUpdateWorkspaceRequest + +export const zUpdateWorkspacePath = z.object({ + id: z.string() }) /** @@ -4556,26 +4097,17 @@ export const zUpdateWorkspaceData = z.object({ */ export const zUpdateWorkspaceResponse = zWorkspace -export const zGetStaticExtensionsData = z.object({ - body: z.never().optional(), - path: z.object({ - path: z.string() - }), - query: z.never().optional() -}) +/** + * The credential's workspace + */ +export const zGetCurrentWorkspaceResponse = zCurrentWorkspaceResponse -export const zRedirectExtensionScriptsData = z.object({ - body: z.never().optional(), - path: z.object({ - file: z.string() - }), - query: z.never().optional() +export const zGetStaticExtensionsPath = z.object({ + path: z.string() }) -export const zGetHealthData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() +export const zRedirectExtensionScriptsPath = z.object({ + file: z.string() }) /** @@ -4583,12 +4115,6 @@ export const zGetHealthData = z.object({ */ export const zGetHealthResponse = z.string() -export const zGetInternalFolderPathsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Map of folder type name to list of path entries */ @@ -4596,23 +4122,11 @@ export const zGetInternalFolderPathsResponse = z.record( z.array(z.array(z.string())) ) -export const zGetInternalLogsData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Log text */ export const zGetInternalLogsResponse = z.string() -export const zGetInternalLogsRawData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.never().optional() -}) - /** * Structured log data */ @@ -4633,39 +4147,25 @@ export const zGetInternalLogsRawResponse = z.object({ .optional() }) -export const zSubscribeToLogsData = z.object({ - body: z.object({ - clientId: z.string(), - enabled: z.boolean() - }), - path: z.never().optional(), - query: z.never().optional() +export const zSubscribeToLogsBody = z.object({ + clientId: z.string(), + enabled: z.boolean() }) -export const zGetStaticKjwebAsyncData = z.object({ - body: z.never().optional(), - path: z.object({ - path: z.string() - }), - query: z.never().optional() +export const zGetStaticKjwebAsyncPath = z.object({ + path: z.string() }) -export const zGetOAuthAuthorizeData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - response_type: z.string().optional(), - client_id: z.string().optional(), - redirect_uri: z.string().optional(), - scope: z.string().optional(), - state: z.string().optional(), - code_challenge: z.string().optional(), - code_challenge_method: z.string().optional(), - resource: z.string().optional(), - oauth_request_id: z.string().optional() - }) - .optional() +export const zGetOAuthAuthorizeQuery = z.object({ + response_type: z.string().optional(), + client_id: z.string().optional(), + redirect_uri: z.string().optional(), + scope: z.string().optional(), + state: z.string().optional(), + code_challenge: z.string().optional(), + code_challenge_method: z.string().optional(), + resource: z.string().optional(), + oauth_request_id: z.string().optional() }) /** @@ -4674,15 +4174,11 @@ export const zGetOAuthAuthorizeData = z.object({ */ export const zGetOAuthAuthorizeResponse = zOAuthConsentChallenge -export const zPostOAuthAuthorizeData = z.object({ - body: z.object({ - csrf_token: z.string(), - decision: z.enum(['allow', 'deny']), - oauth_request_id: z.string().uuid(), - workspace_id: z.string() - }), - path: z.never().optional(), - query: z.never().optional() +export const zPostOAuthAuthorizeBody = z.object({ + csrf_token: z.string(), + decision: z.enum(['allow', 'deny']), + oauth_request_id: z.string().uuid(), + workspace_id: z.string() }) /** @@ -4690,30 +4186,22 @@ export const zPostOAuthAuthorizeData = z.object({ */ export const zPostOAuthAuthorizeResponse = zOAuthAuthorizeRedirectResponse -export const zPostOAuthRegisterData = z.object({ - body: zOAuthRegisterRequest, - path: z.never().optional(), - query: z.never().optional() -}) +export const zPostOAuthRegisterBody = zOAuthRegisterRequest /** * Registered. Body echoes the metadata RFC 7591 §3.2.1 requires. */ export const zPostOAuthRegisterResponse = zOAuthRegisterResponse -export const zPostOAuthTokenData = z.object({ - body: z.object({ - client_id: z.string(), - client_secret: z.string().optional(), - code: z.string().optional(), - code_verifier: z.string().optional(), - grant_type: z.enum(['authorization_code', 'refresh_token']), - redirect_uri: z.string().optional(), - refresh_token: z.string().optional(), - scope: z.string().optional() - }), - path: z.never().optional(), - query: z.never().optional() +export const zPostOAuthTokenBody = z.object({ + client_id: z.string(), + client_secret: z.string().optional(), + code: z.string().optional(), + code_verifier: z.string().optional(), + grant_type: z.enum(['authorization_code', 'refresh_token']), + redirect_uri: z.string().optional(), + refresh_token: z.string().optional(), + scope: z.string().optional() }) /** @@ -4721,28 +4209,14 @@ export const zPostOAuthTokenData = z.object({ */ export const zPostOAuthTokenResponse = zOAuthTokenResponse -export const zGetTemplateProxyData = z.object({ - body: z.never().optional(), - path: z.object({ - path: z.string() - }), - query: z.never().optional() +export const zGetTemplateProxyPath = z.object({ + path: z.string() }) -export const zGetViewCompatAliasData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z.object({ - filename: z.string() - }) +export const zGetViewCompatAliasQuery = z.object({ + filename: z.string() }) -export const zGetWebsocketData = z.object({ - body: z.never().optional(), - path: z.never().optional(), - query: z - .object({ - clientId: z.string().optional() - }) - .optional() +export const zGetWebsocketQuery = z.object({ + clientId: z.string().optional() }) diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 2c4eac862d6..ca999970117 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -2894,6 +2894,9 @@ "free": { "name": "Free" }, + "enterprise": { + "name": "Enterprise" + }, "founder": { "name": "Founder's Edition" }, diff --git a/src/platform/cloud/subscription/billingPolicyCapabilities.test.ts b/src/platform/cloud/subscription/billingPolicyCapabilities.test.ts index bfa043ac38a..c94e875b593 100644 --- a/src/platform/cloud/subscription/billingPolicyCapabilities.test.ts +++ b/src/platform/cloud/subscription/billingPolicyCapabilities.test.ts @@ -18,6 +18,10 @@ describe('getBillingPolicyCapabilities', () => { 'LocalTeamWithoutActiveSubscription', { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } ], + [ + 'LocalEnterpriseWithoutActiveSubscription', + { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } + ], [ 'LocalAndUnknown', { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } @@ -45,6 +49,10 @@ describe('getBillingPolicyCapabilities', () => { 'CloudTeamWithoutActiveSubscription', { topUpAccess: 'subscription-required', showsSubscribeUpsellUI: false } ], + [ + 'CloudEnterpriseWithoutActiveSubscription', + { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } + ], [ 'CloudAndUnknown', { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } diff --git a/src/platform/cloud/subscription/billingPolicyCapabilities.ts b/src/platform/cloud/subscription/billingPolicyCapabilities.ts index a2989b49960..e8869ce05f3 100644 --- a/src/platform/cloud/subscription/billingPolicyCapabilities.ts +++ b/src/platform/cloud/subscription/billingPolicyCapabilities.ts @@ -20,6 +20,8 @@ export function getBillingPolicyCapabilities( return { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } case 'LocalTeamWithoutActiveSubscription': return { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } + case 'LocalEnterpriseWithoutActiveSubscription': + return { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } case 'LocalAndUnknown': return { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } case 'LocalAndFree': @@ -44,6 +46,10 @@ export function getBillingPolicyCapabilities( topUpAccess: 'subscription-required', showsSubscribeUpsellUI: false } + // Sales-managed: reactivation goes through sales, so unlike the lapsed + // self-serve Team state it neither withholds top-up nor upsells. + case 'CloudEnterpriseWithoutActiveSubscription': + return { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } case 'CloudAndUnknown': return { topUpAccess: 'allowed', showsSubscribeUpsellUI: false } case 'CloudAndFree': diff --git a/src/platform/cloud/subscription/billingPolicyState.ts b/src/platform/cloud/subscription/billingPolicyState.ts index 436473f6337..17fc0a5c476 100644 --- a/src/platform/cloud/subscription/billingPolicyState.ts +++ b/src/platform/cloud/subscription/billingPolicyState.ts @@ -1,6 +1,7 @@ export type BillingPolicyState = | { kind: 'LocalWithoutActiveSubscription' } | { kind: 'LocalTeamWithoutActiveSubscription' } + | { kind: 'LocalEnterpriseWithoutActiveSubscription' } | { kind: 'LocalAndUnknown' } | { kind: 'LocalAndFree' } | { kind: 'LocalAndStandard' } @@ -10,6 +11,7 @@ export type BillingPolicyState = | { kind: 'LocalAndTeam' } | { kind: 'CloudWithoutActiveSubscription' } | { kind: 'CloudTeamWithoutActiveSubscription' } + | { kind: 'CloudEnterpriseWithoutActiveSubscription' } | { kind: 'CloudAndUnknown' } | { kind: 'CloudAndFree' } | { kind: 'CloudAndStandard' } diff --git a/src/platform/cloud/subscription/composables/useBillingPolicyState.test.ts b/src/platform/cloud/subscription/composables/useBillingPolicyState.test.ts index e54d2ad5195..e0a902941e2 100644 --- a/src/platform/cloud/subscription/composables/useBillingPolicyState.test.ts +++ b/src/platform/cloud/subscription/composables/useBillingPolicyState.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest' +import type { IngestSubscriptionTier } from '@/platform/cloud/subscription/constants/tierPricing' import { deriveBillingPolicyState } from './useBillingPolicyState' describe('deriveBillingPolicyState', () => { @@ -128,4 +129,103 @@ describe('deriveBillingPolicyState', () => { ).toEqual({ kind }) } ) + + // The tier union is generated from the backend spec, so a value outside it is + // reachable at runtime even though the type forbids it. It must resolve to the + // restrictive state, not Unknown: Unknown grants topUpAccess 'allowed', which + // would hand paid-plan access to a tier purely for being unrecognised. + it.for([ + ['CloudWithoutActiveSubscription', true], + ['LocalWithoutActiveSubscription', false] + ] as const)( + 'resolves an unrecognised tier as %s (isCloud=%s)', + ([kind, isCloud]) => { + expect( + deriveBillingPolicyState({ + isCloud, + canAccessSubscriptionFeatures: true, + isTeamPlan: false, + tier: 'SOME_FUTURE_TIER' as IngestSubscriptionTier + }) + ).toEqual({ kind }) + } + ) + + // Sales-managed: active takes the team policy states; lapsed keeps its own + // state so it is never shown the personal subscribe upsell. + it.for<[string, boolean, boolean]>([ + ['CloudAndTeam', true, true], + ['LocalAndTeam', true, false], + ['CloudEnterpriseWithoutActiveSubscription', false, true], + ['LocalEnterpriseWithoutActiveSubscription', false, false] + ])( + 'resolves an ENTERPRISE tier as %s (canAccess=%s, isCloud=%s)', + ([kind, canAccess, isCloud]) => { + expect( + deriveBillingPolicyState({ + isCloud, + canAccessSubscriptionFeatures: canAccess, + isTeamPlan: false, + tier: 'ENTERPRISE' + }) + ).toEqual({ kind }) + } + ) +}) + +// Characterization of the full pre-ENTERPRISE input space. Every row pins the +// behavior that existed before the ENTERPRISE branch was added; a change to +// any of these rows is a regression, not a refactor. +describe('deriveBillingPolicyState regression matrix', () => { + const suffixTable: [ + IngestSubscriptionTier | null, + boolean, // canAccessSubscriptionFeatures + boolean, // isTeamPlan + string + ][] = [ + [null, true, false, 'AndUnknown'], + [null, false, false, 'WithoutActiveSubscription'], + [null, true, true, 'AndTeam'], + [null, false, true, 'TeamWithoutActiveSubscription'], + ['FREE', true, false, 'AndFree'], + ['FREE', false, false, 'WithoutActiveSubscription'], + ['FREE', true, true, 'AndTeam'], + ['FREE', false, true, 'TeamWithoutActiveSubscription'], + ['STANDARD', true, false, 'AndStandard'], + ['STANDARD', false, false, 'WithoutActiveSubscription'], + ['STANDARD', true, true, 'AndTeam'], + ['STANDARD', false, true, 'TeamWithoutActiveSubscription'], + ['CREATOR', true, false, 'AndCreator'], + ['CREATOR', false, false, 'WithoutActiveSubscription'], + ['CREATOR', true, true, 'AndTeam'], + ['CREATOR', false, true, 'TeamWithoutActiveSubscription'], + ['PRO', true, false, 'AndPro'], + ['PRO', false, false, 'WithoutActiveSubscription'], + ['PRO', true, true, 'AndTeam'], + ['PRO', false, true, 'TeamWithoutActiveSubscription'], + ['FOUNDERS_EDITION', true, false, 'AndFounders'], + ['FOUNDERS_EDITION', false, false, 'WithoutActiveSubscription'], + ['FOUNDERS_EDITION', true, true, 'AndTeam'], + ['FOUNDERS_EDITION', false, true, 'TeamWithoutActiveSubscription'], + ['TEAM', true, false, 'AndTeam'], + ['TEAM', false, false, 'TeamWithoutActiveSubscription'], + ['TEAM', true, true, 'AndTeam'], + ['TEAM', false, true, 'TeamWithoutActiveSubscription'] + ] + + it.for(suffixTable)( + 'tier=%s canAccess=%s isTeamPlan=%s stays %s in both distributions', + ([tier, canAccess, isTeamPlan, suffix]) => { + for (const isCloud of [true, false]) { + expect( + deriveBillingPolicyState({ + isCloud, + canAccessSubscriptionFeatures: canAccess, + isTeamPlan, + tier + }) + ).toEqual({ kind: `${isCloud ? 'Cloud' : 'Local'}${suffix}` }) + } + } + ) }) diff --git a/src/platform/cloud/subscription/composables/useBillingPolicyState.ts b/src/platform/cloud/subscription/composables/useBillingPolicyState.ts index c107a7d9604..773af7bc3e8 100644 --- a/src/platform/cloud/subscription/composables/useBillingPolicyState.ts +++ b/src/platform/cloud/subscription/composables/useBillingPolicyState.ts @@ -18,6 +18,18 @@ export function deriveBillingPolicyState(input: { }): BillingPolicyState { const distribution = input.isCloud ? 'Cloud' : 'Local' + // ENTERPRISE is a workspace-level, sales-managed plan and never self-serve. + // Active, it takes the team policy states; lapsed, it keeps its own state so + // it is never classified as plain WithoutActiveSubscription, which would + // expose the personal subscribe upsell to a sales-managed customer. + if (input.tier === 'ENTERPRISE') { + return { + kind: input.canAccessSubscriptionFeatures + ? `${distribution}AndTeam` + : `${distribution}EnterpriseWithoutActiveSubscription` + } + } + if (input.isTeamPlan || input.tier === 'TEAM') { return { kind: input.canAccessSubscriptionFeatures @@ -44,7 +56,24 @@ export function deriveBillingPolicyState(input: { case null: return { kind: `${distribution}AndUnknown` } default: - return input.tier satisfies never + // COMPATIBILITY FALLBACK, NOT A POLICY SIGNAL. + // + // The tier union is generated from the backend spec and can gain values + // without a frontend change, so this must not be a compile error. It + // resolves to the restrictive state rather than Unknown because Unknown + // grants topUpAccess 'allowed' — an unrecognised tier must not be handed + // paid-plan access for the sole reason that this build does not know it. + // + // It is deliberately NOT business-correct: a sales-managed tier that is + // genuinely active collapses to the same state as no subscription at all, + // so any UI keyed off this can offer subscribe/upgrade to someone who is + // already paying. Fail-closed on access, wrong on intent. + // + // Do not build cancellation, reactivation, pricing or upgrade decisions on + // this branch. Those need explicit server-sent capabilities (canOpenPricing, + // canChangePlan, canCancel, canReactivate) so a new tier cannot silently + // inherit a frontend-computed policy. + return { kind: `${distribution}WithoutActiveSubscription` } } } diff --git a/src/platform/cloud/subscription/constants/tierPricing.test.ts b/src/platform/cloud/subscription/constants/tierPricing.test.ts new file mode 100644 index 00000000000..4b54a1e63b7 --- /dev/null +++ b/src/platform/cloud/subscription/constants/tierPricing.test.ts @@ -0,0 +1,61 @@ +import { describe, expect, it } from 'vitest' + +import type { IngestSubscriptionTier } from './tierPricing' +import { hasActivePaidPlan, toTierKey } from './tierPricing' + +describe('toTierKey', () => { + it('maps every personal-catalog tier to its key', () => { + expect(toTierKey('FREE')).toBe('free') + expect(toTierKey('STANDARD')).toBe('standard') + expect(toTierKey('CREATOR')).toBe('creator') + expect(toTierKey('PRO')).toBe('pro') + expect(toTierKey('FOUNDERS_EDITION')).toBe('founder') + }) + + it('returns null for workspace-level tiers', () => { + expect(toTierKey('TEAM')).toBeNull() + expect(toTierKey('ENTERPRISE')).toBeNull() + }) + + // The tier arrives as unvalidated JSON from the backend, so a value outside + // the union is reachable at runtime even though the type forbids it. It must + // return null rather than failing, which is what keeps a backend-side tier + // addition from breaking the frontend. + it('returns null for a tier the frontend does not know', () => { + expect(toTierKey('SOME_FUTURE_TIER' as IngestSubscriptionTier)).toBeNull() + }) + + // hasOwnProperty rather than `in`: these are inherited from Object.prototype, + // so `in` would return a function or object where a TierKey is expected. + it.for(['constructor', 'toString', '__proto__', 'valueOf'])( + 'returns null for the inherited property %s', + (key) => { + expect(toTierKey(key as IngestSubscriptionTier)).toBeNull() + } + ) + + // tier is unvalidated backend JSON, so a non-string is reachable. These must + // return null rather than coercing to a property key or throwing. + it.for([[['FREE']], [{}], [null], [undefined], [42]])( + 'returns null for the non-string value %s', + ([value]) => { + expect(toTierKey(value as unknown as IngestSubscriptionTier)).toBeNull() + } + ) +}) + +describe('hasActivePaidPlan', () => { + // Deliberately not keyed off toTierKey: workspace-level tiers map to no + // catalog key yet are paid plans, so a null key must not read as unpaid. + it('treats catalog, workspace-level, and unrecognised tiers as paid', () => { + expect(hasActivePaidPlan('PRO')).toBe(true) + expect(hasActivePaidPlan('TEAM')).toBe(true) + expect(hasActivePaidPlan('ENTERPRISE')).toBe(true) + }) + + it('treats FREE and an absent tier as unpaid', () => { + expect(hasActivePaidPlan('FREE')).toBe(false) + expect(hasActivePaidPlan(null)).toBe(false) + expect(hasActivePaidPlan(undefined)).toBe(false) + }) +}) diff --git a/src/platform/cloud/subscription/constants/tierPricing.ts b/src/platform/cloud/subscription/constants/tierPricing.ts index 84c3aa088b0..dd9fbcf3221 100644 --- a/src/platform/cloud/subscription/constants/tierPricing.ts +++ b/src/platform/cloud/subscription/constants/tierPricing.ts @@ -56,9 +56,27 @@ const TIER_FEATURES: Record = { export const DEFAULT_TIER_KEY: TierKey = 'standard' -// TEAM is workspace-level, so it maps to no key in this personal plan catalog. +// Membership is tested rather than listing the exclusions, so a tier added to +// the ingest enum narrows to false and returns null instead of failing the +// build. Two details are load-bearing: +// - `typeof`, because tier is unvalidated backend JSON and need not be a +// string; hasOwnProperty coerces its argument to a property key, so +// ['FREE'] would be accepted as FREE and a null toString would throw. +// - own-property rather than `in`, which walks the prototype chain and would +// return an inherited function for 'constructor' or 'toString'. +function isRegistrySubscriptionTier( + tier: unknown +): tier is RegistrySubscriptionTier { + return ( + typeof tier === 'string' && + Object.prototype.hasOwnProperty.call(TIER_TO_KEY, tier) + ) +} + +// Workspace-level tiers (TEAM, and any added later) map to no key in this +// personal plan catalog. export function toTierKey(tier: IngestSubscriptionTier): TierKey | null { - return tier === 'TEAM' ? null : TIER_TO_KEY[tier] + return isRegistrySubscriptionTier(tier) ? TIER_TO_KEY[tier] : null } // Includes the workspace-level TEAM, which toTierKey maps to null: a catalog diff --git a/src/platform/workspace/composables/useWorkspaceTierLabel.test.ts b/src/platform/workspace/composables/useWorkspaceTierLabel.test.ts index 1e8f69d872a..6906d9b49c4 100644 --- a/src/platform/workspace/composables/useWorkspaceTierLabel.test.ts +++ b/src/platform/workspace/composables/useWorkspaceTierLabel.test.ts @@ -12,7 +12,8 @@ vi.mock('vue-i18n', () => ({ 'subscription.tiers.standard.name': 'Standard', 'subscription.tiers.creator.name': 'Creator', 'subscription.tiers.pro.name': 'Pro', - 'subscription.tiers.founder.name': "Founder's Edition" + 'subscription.tiers.founder.name': "Founder's Edition", + 'subscription.tiers.enterprise.name': 'Enterprise' } return tierNames[key] ?? key }) @@ -103,12 +104,30 @@ describe('useWorkspaceTierLabel', () => { expect(result).toBeNull() }) - it('returns null when plan slug does not match any known tier', () => { + it('labels lowercase enterprise plan slugs', () => { + const result = getTierLabel({ + isSubscribed: true, + subscriptionPlan: 'enterprise_monthly', + subscriptionTier: null + }) + expect(result).toBe('Enterprise') + }) + + it('labels enterprise plan slugs', () => { const result = getTierLabel({ isSubscribed: true, subscriptionPlan: 'ENTERPRISE_CUSTOM', subscriptionTier: null }) + expect(result).toBe('Enterprise') + }) + + it('returns null when plan slug does not match any known tier', () => { + const result = getTierLabel({ + isSubscribed: true, + subscriptionPlan: 'ULTRA_CUSTOM', + subscriptionTier: null + }) expect(result).toBeNull() }) diff --git a/src/platform/workspace/composables/useWorkspaceTierLabel.ts b/src/platform/workspace/composables/useWorkspaceTierLabel.ts index 2956c8c0c4d..bf76d317c77 100644 --- a/src/platform/workspace/composables/useWorkspaceTierLabel.ts +++ b/src/platform/workspace/composables/useWorkspaceTierLabel.ts @@ -8,7 +8,8 @@ const tierKeyMap: Record = { CREATOR: 'creator', PRO: 'pro', FOUNDER: 'founder', - FOUNDERS_EDITION: 'founder' + FOUNDERS_EDITION: 'founder', + ENTERPRISE: 'enterprise' } interface WorkspaceSubscriptionInfo { @@ -42,7 +43,9 @@ export function useWorkspaceTierLabel() { if (!workspace.subscriptionPlan) return null - const planSlug = workspace.subscriptionPlan + // Plan identifiers arrive in both cases: comfy-api sends uppercase slugs, + // cloud sends lowercase ones (e.g. enterprise plan rows). + const planSlug = workspace.subscriptionPlan.toUpperCase() const tierMatch = Object.keys(tierKeyMap) .sort((a, b) => b.length - a.length) .find((tier) => planSlug === tier || planSlug.startsWith(`${tier}_`))