export type THostedAppHostType = 'onebox' | 'cloudly' | string; export declare const hostedAppOidcRoleClaim: "roles"; export declare const hostedAppOidcAppInstanceIdClaim: "servezone_app_instance_id"; export declare const hostedAppMachineServiceIdClaim: "servezone_service_id"; export declare const hostedAppMachineAudience: "serve.zone/hosted-app-lifecycle"; export interface IHostedAppMachineClaims { sub: string; aud: typeof hostedAppMachineAudience; iat: number; exp: number; [hostedAppOidcAppInstanceIdClaim]: string; [hostedAppMachineServiceIdClaim]: string; } export declare const createHostedAppMachineSubject: (appInstanceIdArg: string) => string; export declare const validateHostedAppMachineClaims: (claimsArg: unknown, expectedArg: { appInstanceId: string; serviceId: string; nowEpochSeconds?: number; }) => string[]; export interface IHostedAppRoleDefinition { /** Stable role identifier emitted in the hosted app's audience-scoped token. */ id: string; label: string; description?: string; } export interface IHostedAppRoleAssignment { /** Immutable hosted app instance identifier. Never use a mutable service name as this boundary. */ appInstanceId: string; userId: string; roleIds: string[]; assignedAt: number; assignedByUserId: string; } export interface IHostedAppPlatformOidcClaims { iss: string; sub: string; /** Mutable display name only. Never use this claim as identity authority. */ preferred_username: string; aud: string; iat: number; exp: number; auth_time: number; nonce?: string; [hostedAppOidcAppInstanceIdClaim]: string; [hostedAppOidcRoleClaim]: string[]; } interface IHostedAppPlatformOidcRegistrationBase { /** Immutable OIDC client_id and ID-token audience for this hosted app. */ appInstanceId: string; roleDefinitions: IHostedAppRoleDefinition[]; updatedAt: number; } type THostedAppRedirectUris = [string, ...string[]]; export type IHostedAppPlatformOidcRegistration = (IHostedAppPlatformOidcRegistrationBase & { status: 'disabled'; redirectUris: []; issuer?: never; clientId?: never; error?: never; }) | (IHostedAppPlatformOidcRegistrationBase & { status: 'enabling'; issuer: string; clientId: string; redirectUris: THostedAppRedirectUris; error?: never; }) | (IHostedAppPlatformOidcRegistrationBase & { status: 'enabled' | 'disabling'; issuer: string; clientId: string; redirectUris: THostedAppRedirectUris; error?: never; }) | (IHostedAppPlatformOidcRegistrationBase & { status: 'error'; redirectUris: string[]; issuer?: string; clientId?: string; error: string; }); export declare const validateHostedAppRoleDefinitions: (rolesArg: unknown) => string[]; export declare const validateHostedAppPlatformOidcClaims: (claimsArg: unknown, expectedArg: { issuer: string; appInstanceId: string; nonce?: string; nowEpochSeconds?: number; }) => string[]; export declare const validateHostedAppPlatformOidcRegistration: (registrationArg: unknown, expectedArg: { appOrigin: string; }) => string[]; export type THostedAppRuntimeStatus = 'starting' | 'running' | 'setupRequired' | 'degraded' | 'stopped' | 'unknown'; export type THostedAppBootstrapActionType = 'setupRoute' | 'message'; export type THostedAppBootstrapActionStatus = 'requested' | 'ready' | 'completed' | 'dismissed' | 'expired'; export type THostedAppUpgradeStatus = 'unknown' | 'upToDate' | 'available' | 'running' | 'success' | 'failed'; interface IHostedAppBootstrapActionBase { id: string; /** Server-managed CAS revision incremented on every action transition. */ revision: number; status: THostedAppBootstrapActionStatus; label: string; expiresAt?: number; createdAt: number; updatedAt: number; completedAt?: number; dismissedAt?: number; } export type IHostedAppBootstrapAction = (IHostedAppBootstrapActionBase & { type: 'setupRoute'; route: string; message?: never; }) | (IHostedAppBootstrapActionBase & { type: 'message'; route?: never; message: string; }); export interface IHostedAppUpgradeState { status: THostedAppUpgradeStatus; appTemplateId?: string; currentVersion?: string; latestVersion?: string; targetVersion?: string; operationId?: string; warnings?: string[]; blockers?: string[]; error?: string; startedAt?: number; updatedAt?: number; completedAt?: number; } export interface IHostedAppLifecycleReport { appName?: string; appVersion?: string; publicUrl?: string; runtimeStatus?: THostedAppRuntimeStatus; statusMessage?: string; capabilities?: string[]; } export interface IHostedAppLifecycleState extends IHostedAppLifecycleReport { appInstanceId: string; hostType: THostedAppHostType; reportedAt?: number; bootstrapAction?: IHostedAppBootstrapAction; upgradeState?: IHostedAppUpgradeState; } type THostedAppBootstrapActionServerFields = 'id' | 'revision' | 'status' | 'createdAt' | 'updatedAt' | 'completedAt' | 'dismissedAt'; export type IHostedAppBootstrapActionRequest = (Omit, THostedAppBootstrapActionServerFields> & { id?: string; }) | (Omit, THostedAppBootstrapActionServerFields> & { id?: string; }); export declare const normalizeHostedAppSetupRoute: (routeArg: unknown) => string | undefined; export declare const validateHostedAppBootstrapActionRequest: (actionArg: unknown) => string[]; export {};