import type { TImmutableContainerPlatform, TOciManifestMediaType, TSha256Digest } from './immutableimage.js'; import type { TServiceDeploymentCapability } from './user.js'; import type { IDeploymentRouteRequest, IServiceDeploymentOperation, TDeploymentOperationMode, TDeploymentOperationPhase } from './deploymentoperation.js'; export type TDeploymentPreflightDecision = 'GO' | 'NO-GO'; export type TDeploymentPreflightBlockerCode = 'INVALID_REQUEST' | 'AUTHORIZATION_MISSING' | 'ORGANIZATION_SCOPE_MISSING' | 'SERVICE_OWNERSHIP_MISMATCH' | 'DEPLOYMENT_OPERATION_NOT_FOUND' | 'DEPLOYMENT_OPERATION_CONFLICT' | 'DEPLOY_ON_PUSH_MUST_BE_DISABLED' | 'REGISTRY_AUTHENTICATION_UNAVAILABLE' | 'REGISTRY_REPOSITORY_MISMATCH' | 'REGISTRY_TAG_CONFLICT' | 'SOURCE_REVISION_INVALID' | 'SOURCE_WORKTREE_DIRTY' | 'VERSION_NOT_RESERVED' | 'VERSION_COLLISION' | 'NAMESPACE_NOT_RESERVED' | 'NAMESPACE_COLLISION' | 'NAMESPACE_NOT_PROVEN_BLANK' | 'CONFIGURATION_DIGEST_INVALID' | 'INTENT_DIGEST_INVALID' | 'PROPOSED_CONFIGURATION_INCOMPLETE' | 'CURRENT_REFERENCE_MUTABLE' | 'CURRENT_RUNTIME_DIGEST_MISSING' | 'OCI_INDEX_DIGEST_REQUIRED' | 'OCI_INDEX_NOT_FOUND' | 'OCI_INDEX_MEDIA_TYPE_REQUIRED' | 'OCI_PLATFORM_MISSING' | 'OCI_PLATFORM_MANIFEST_MISSING' | 'IMMUTABLE_RELEASE_TAG_REQUIRED' | 'IMMUTABLE_RELEASE_TAG_NOT_RESERVED' | 'RELEASE_EVIDENCE_MISSING' | 'RELEASE_EVIDENCE_INVALID' | 'RELEASE_EVIDENCE_AMBIGUOUS' | 'RELEASE_NOT_AUTHORIZED' | 'GREENFIELD_EXECUTION_UNAVAILABLE' | 'ROUTE_PROMOTION_FENCE_UNAVAILABLE' | 'POST_DEPLOYMENT_VERIFICATION_UNAVAILABLE' | 'WOULD_REPLACE_EXISTING_STATE' | 'PLATFORM_CAPABILITY_UNAVAILABLE' | 'CORESTORE_INVENTORY_UNAVAILABLE' | 'RUNTIME_ATTESTATION_MISMATCH' | 'ROLLOUT_ACTIVE_CONFLICT' | 'ROLLOUT_NOT_SUCCEEDED' | 'ROUTE_UNAVAILABLE' | 'ROUTE_VERIFICATION_FAILED' | 'TLS_VERIFICATION_FAILED'; export interface IDeploymentPreflightBlocker { code: TDeploymentPreflightBlockerCode; message: string; } export type TDeploymentPreflightWarningCode = 'RECOVERY_REDEPLOY_OVER_FAILED_RUNTIME'; /** * Auditable non-blocking preflight finding. Warnings never veto a decision. * `RECOVERY_REDEPLOY_OVER_FAILED_RUNTIME` documents that an existing-service * reserve preflight suppressed the CURRENT_RUNTIME_DIGEST_MISSING and * RUNTIME_ATTESTATION_MISMATCH blockers because the current runtime provides * no consistent attested digest and the service's most recent deployment * operation ended 'failed' or 'cleaned' (a recovery redeploy over a known-bad * runtime). No other blocker is ever relaxed. */ export interface IDeploymentPreflightWarning { code: TDeploymentPreflightWarningCode; message: string; } export interface IDeploymentPreflightAuthorizationCheck { capability: TServiceDeploymentCapability; granted: boolean; } export interface IOciPlatformDescriptorSummary { os: string; architecture: string; digest?: TSha256Digest; mediaType?: string; runnable: boolean; manifestPresent: boolean; } export interface IDeploymentPreflightRuntimeTask { deploymentId: string; nodeName?: string; status: string; healthStatus?: string; imageReference?: string; observedDigest?: TSha256Digest; reportedDigest?: TSha256Digest; verificationStatus?: 'not-required' | 'pending' | 'verified' | 'missing' | 'mismatched'; } export interface IDeploymentPreflightPlatformBinding { capability: 'database' | 'objectstorage' | 'pushnotification'; desiredState: 'enabled' | 'disabled'; status: 'requested' | 'provisioning' | 'ready' | 'degraded' | 'failed' | 'disabled'; } export interface IDeploymentPreflightCorestoreResource { capability: 'database' | 'objectstorage'; provider: string; resourceName: string; } export interface IDeploymentPreflightProposedCorestoreResource { capability: 'database' | 'objectstorage'; resourceName: string; } export interface IDeploymentPreflightProposedVolumeMount { mountPath: string; storageClass: 'corestore' | 'ephemeral'; capability?: 'database' | 'objectstorage'; } /** * Secret-free candidate configuration declared by the source checkout. * Cloudly derives namespace and resource names; callers may not probe arbitrary * cluster names through this contract. */ export interface IDeploymentPreflightProposedConfiguration { schemaVersion: 1; declarationComplete: boolean; projectName: string; targetPlatforms: TImmutableContainerPlatform[]; publicDomains: string[]; environmentVariableNames: string[]; /** Exact OCI/Docker argument vector appended after the image entrypoint. */ containerArgs?: string[]; containerPorts: number[]; volumeMounts: IDeploymentPreflightProposedVolumeMount[]; requiredCapabilities: Array<'database' | 'objectstorage' | 'pushnotification'>; } export interface IDeploymentReleaseEvidenceReference { kind: 'provenance' | 'sbom' | 'signature' | 'vulnerability-policy' | 'release-authorization'; statementDigest: TSha256Digest; subjectDigest: TSha256Digest; verifier: string; verifiedAt: number; } /** Evidence is descriptive input until a trusted Cloudly verifier validates it. */ export interface IDeploymentReleaseEvidence { sourceRevision: string; version: string; configurationDigest: TSha256Digest; ociIndexDigest: TSha256Digest; releaseAuthorized: boolean; attestations: IDeploymentReleaseEvidenceReference[]; } export interface IDeploymentPreflightRequestData { requestId: string; serviceId: string; organizationId?: string; mode?: TDeploymentOperationMode; phase?: TDeploymentOperationPhase; operationId?: string; sourceRevision: string; sourceDirty: boolean; version: string; intentDigest: string; proposedConfiguration: IDeploymentPreflightProposedConfiguration; ociIndexDigest?: string; releaseTag?: string; releaseEvidence?: IDeploymentReleaseEvidence; routes?: IDeploymentRouteRequest[]; /** Legacy v14 discriminator. Equivalent to mode: 'greenfield'. */ greenfield?: true; } export interface IDeploymentPreflightReport { schemaVersion: 2; decision: TDeploymentPreflightDecision; mutationPerformed: false; generatedAt: number; service: { organizationId?: string; serviceId: string; serviceName: string; workspaceIdentity: string; registryHost: string; registryRepository: string; deployOnPush: boolean; }; mode?: TDeploymentOperationMode; phase?: TDeploymentOperationPhase; operation?: IServiceDeploymentOperation; source: { revision: string; dirty: boolean; version: string; intentDigest: TSha256Digest; configurationDigest: TSha256Digest; }; currentImage: { tag?: string; digest?: TSha256Digest; imageReference?: string; mutableReference: boolean; mediaType?: TOciManifestMediaType; platforms: IOciPlatformDescriptorSummary[]; }; requestedImage: { digest?: TSha256Digest; releaseTag?: string; tagReserved: boolean; mediaType?: TOciManifestMediaType; platforms: IOciPlatformDescriptorSummary[]; }; runtimeTasks: IDeploymentPreflightRuntimeTask[]; runtimeAttestation: { requiredReplicaCount: number; observedReplicaCount: number; healthyReplicaCount: number; verifiedReplicaCount: number; observedDigestReplicaCount: number; observedDigestConsistent: boolean; consistentDigest: boolean; }; platformBindings: IDeploymentPreflightPlatformBinding[]; corestoreResources: IDeploymentPreflightCorestoreResource[]; proposed: { namespace: string; configuration: IDeploymentPreflightProposedConfiguration; corestoreResources: IDeploymentPreflightProposedCorestoreResource[]; namespaceReserved: boolean; inventoryComplete: boolean; namespaceBlank: boolean | 'unknown'; versionReserved: boolean; wouldReplaceExistingState: boolean | 'unknown'; }; authorizationChecks: IDeploymentPreflightAuthorizationCheck[]; compatibilityBlockers: IDeploymentPreflightBlocker[]; /** Additive auditable non-blocking findings; absent when nothing was relaxed. */ warnings?: IDeploymentPreflightWarning[]; } export interface IGreenfieldDeploymentFence { sourceServiceId: string; sourceRevision: string; version: string; ociIndexDigest: TSha256Digest; configurationDigest: TSha256Digest; targetNamespace: string; } /** @deprecated Use IServiceDeploymentOperation. */ export type IGreenfieldDeploymentOperation = IServiceDeploymentOperation; export declare const validateDeploymentPreflightRequest: (requestArg: unknown) => IDeploymentPreflightBlocker[]; export declare const validateDeploymentReleaseEvidence: (argsArg: { evidence: unknown; sourceRevision: string; version: string; configurationDigest: TSha256Digest; ociIndexDigest: TSha256Digest; }) => IDeploymentPreflightBlocker[];