# types/deployment.types.ts

> 185 lines of code and 38 definitions.

Tree: Bane's Lab Deploy
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/deploy#file-deploy-types-deployment-types-ts
Source text: https://banes-lab.com/source/deploy/types/deployment.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/deploy/types.md), before [types/discord.types.ts](https://banes-lab.com/source/deploy/types/discord.types.ts.md).

## Definitions

- `TransferOptions` (interface_declaration, line 1, exported)
- `UploadStats` (interface_declaration, line 5, exported)
- `Journal` (interface_declaration, line 12, exported)
- `TransferPlan` (interface_declaration, line 19, exported)
- `TransferState` (interface_declaration, line 26, exported)
- `TransferView` (interface_declaration, line 33, exported)
- `Progress` (interface_declaration, line 47, exported)
- `ProgressSink` (interface_declaration, line 53, exported)
- `ByteStep` (type_alias_declaration, line 58, exported)
- `CommandResult` (interface_declaration, line 60, exported)
- `ChildExit` (interface_declaration, line 66, exported)
- `ManagedBackup` (interface_declaration, line 71, exported)
- `Shell` (interface_declaration, line 76, exported)
- `Span` (interface_declaration, line 84, exported)
- `Secrets` (interface_declaration, line 89, exported)
- `SearchPing` (interface_declaration, line 99, exported)
- `PingPoster` (type_alias_declaration, line 106, exported)
- `SearchSitemaps` (interface_declaration, line 108, exported)
- `PackageSource` (interface_declaration, line 113, exported)
- `Relation` (interface_declaration, line 118, exported)
- `PackageStanza` (interface_declaration, line 123, exported)
- `InstalledPackage` (interface_declaration, line 132, exported)
- `SourceArchive` (interface_declaration, line 138, exported)
- `SourceModule` (interface_declaration, line 144, exported)
- `ModuleLoader` (interface_declaration, line 149, exported)
- `Platform` (interface_declaration, line 154, exported)
- `PackagePlan` (interface_declaration, line 159, exported)
- `IndexFetcher` (type_alias_declaration, line 165, exported)
- `ProbeResponse` (interface_declaration, line 167, exported)
- `ProbeFetcher` (type_alias_declaration, line 173, exported)
- `DaneKeys` (interface_declaration, line 175, exported)
- `ServedKey` (interface_declaration, line 181, exported)
- `DaneReader` (type_alias_declaration, line 186, exported)
- `ProbeExpectation` (interface_declaration, line 188, exported)
- `CatalogRow` (interface_declaration, line 195, exported)
- `SetupContext` (interface_declaration, line 204, exported)
- `SetupEffect` (interface_declaration, line 212, exported)
- `Outcome` (interface_declaration, line 217, exported)

## Contained in

- [types](https://banes-lab.com/anatomy/deploy/folder-deploy-types.md)

## Source

```typescript
export interface TransferOptions {
    readonly step: (transferred: number, chunk: number, size: number) => void;
}

export interface UploadStats {
    readonly failedCount: number;
    readonly totalBytes: number;
    readonly totalFileCount: number;
    readonly uploadedCount: number;
}

export interface Journal {
    readonly error: (message: string) => void;
    readonly log: (message: string) => void;
    readonly mark: (message: string) => void;
    readonly summary: () => string;
}

export interface TransferPlan {
    readonly label: string;
    readonly size: number;
    readonly total: number;
    readonly unit: string;
}

export interface TransferState extends TransferPlan {
    readonly done: number;
    readonly failed: number;
    readonly startedAt: number;
    readonly transferred: number;
}

export interface TransferView {
    readonly bar: string;
    readonly done: string;
    readonly failed: string;
    readonly label: string;
    readonly left: string;
    readonly moved: string;
    readonly percent: string;
    readonly rate: string;
    readonly size: string;
    readonly total: string;
    readonly unit: string;
}

export interface Progress {
    readonly advance: (items: number, bytes: number, failed: boolean) => void;
    readonly finish: () => void;
    readonly note: (message: string) => void;
}

export interface ProgressSink {
    readonly isTTY?: boolean;
    readonly write: (text: string) => boolean;
}

export type ByteStep = (transferred: number, size: number) => void;

export interface CommandResult {
    readonly code: number | null;
    readonly stderr: string;
    readonly stdout: string;
}

export interface ChildExit {
    readonly code: number | null;
    readonly signal: string | null;
}

export interface ManagedBackup {
    readonly local: string | null;
    readonly remote: string;
}

export interface Shell {
    readonly connect: () => Promise<void>;
    readonly dispose: () => void;
    readonly download: (localPath: string, remotePath: string, step?: ByteStep) => Promise<void>;
    readonly run: (command: string) => Promise<CommandResult>;
    readonly upload: (localPath: string, remotePath: string, step?: ByteStep) => Promise<void>;
}

export interface Span {
    readonly finishedAt: number;
    readonly startedAt: number;
}

export interface Secrets {
    readonly deployWebhook: string;
    readonly host: string;
    readonly keyFile: string;
    readonly nginxWebhook: string;
    readonly passphrase: string | null;
    readonly searchKey: string;
    readonly user: string;
}

export interface SearchPing {
    readonly host: string;
    readonly key: string;
    readonly keyLocation: string;
    readonly urlList: readonly string[];
}

export type PingPoster = (endpoint: string, ping: SearchPing) => Promise<number>;

export interface SearchSitemaps {
    readonly after: string;
    readonly before: string | null;
}

export interface PackageSource {
    readonly base: string;
    readonly component: string;
}

export interface Relation {
    readonly exact: string | null;
    readonly name: string;
}

export interface PackageStanza {
    readonly depends: readonly Relation[];
    readonly name: string;
    readonly provides: readonly string[];
    readonly sha256: string;
    readonly url: string;
    readonly version: string;
}

export interface InstalledPackage {
    readonly configured: boolean;
    readonly name: string;
    readonly version: string | null;
}

export interface SourceArchive {
    readonly archive: string;
    readonly folder: string;
    readonly sha256: string;
}

export interface SourceModule extends SourceArchive {
    readonly object: string;
    readonly version: string;
}

export interface ModuleLoader {
    readonly file: string;
    readonly object: string;
}

export interface Platform {
    readonly architecture: string;
    readonly codename: string;
}

export interface PackagePlan {
    readonly added: readonly string[];
    readonly install: readonly PackageStanza[];
    readonly revert: readonly PackageStanza[];
}

export type IndexFetcher = (url: string) => Promise<string>;

export interface ProbeResponse {
    readonly body: string;
    readonly status: number;
    readonly type: string;
}

export type ProbeFetcher = (url: string, method: string) => Promise<ProbeResponse>;

export interface DaneKeys {
    readonly name: string;
    readonly published: readonly string[];
    readonly served: string;
}

export interface ServedKey {
    readonly digest: string;
    readonly port: number;
}

export type DaneReader = (site: string) => Promise<DaneKeys>;

export interface ProbeExpectation {
    readonly address: string;
    readonly method: string;
    readonly status: number;
    readonly type: string;
}

export interface CatalogRow {
    readonly bytes: number;
    readonly fingerprint: string;
    readonly json: string;
    readonly markdown: string | null;
    readonly ref: string | null;
    readonly title: string | null;
}

export interface SetupContext {
    readonly fetchIndex: IndexFetcher;
    readonly journal: Journal;
    readonly modules: readonly SourceModule[];
    readonly plan: PackagePlan;
    readonly shell: Shell;
}

export interface SetupEffect {
    readonly applies: (context: SetupContext) => boolean;
    readonly run: (context: SetupContext) => Promise<void>;
}

export interface Outcome {
    readonly backup: string;
    readonly failure: string;
    readonly span: Span;
    readonly stats: UploadStats | null;
}
```
