# types/environment.types.ts

> 27 lines of code and 12 definitions.

Tree: Secrets
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/secrets#file-secrets-types-environment-types-ts
Source text: https://banes-lab.com/source/secrets/types/environment.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/secrets/types.md), after [types/detector.types.ts](https://banes-lab.com/source/secrets/types/detector.types.ts.md).

## Definitions

- `EnvironmentKindRule` (type_alias_declaration, line 4, exported)
- `EnvironmentKind` (type_alias_declaration, line 6, exported)
- `EnvironmentScope` (type_alias_declaration, line 8, exported)
- `EnvironmentEntry` (interface_declaration, line 10, exported)
- `DeclaredEntry` (type_alias_declaration, line 17)
- `EnvironmentKey` (type_alias_declaration, line 19, exported)
- `PortKey` (type_alias_declaration, line 21, exported)
- `TextKey` (type_alias_declaration, line 23, exported)
- `OptionalKey` (type_alias_declaration, line 25, exported)
- `FieldLabel` (interface_declaration, line 27, exported)
- `EntryAnswer` (interface_declaration, line 31, exported)
- `ValueAnswer` (interface_declaration, line 36, exported)

## Contained in

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

## Source

```typescript
import type { ENVIRONMENT_KIND_RULES, ENVIRONMENT_SCOPES } from "#configuration/constants/environment.constants";
import type { ENVIRONMENT_ENTRIES } from "#configuration/schemas/environment.schema";

export type EnvironmentKindRule = (typeof ENVIRONMENT_KIND_RULES)[number];

export type EnvironmentKind = EnvironmentKindRule["kind"];

export type EnvironmentScope = (typeof ENVIRONMENT_SCOPES)[number];

export interface EnvironmentEntry {
    readonly key: string;
    readonly kind: EnvironmentKind;
    readonly required: boolean;
    readonly scope: EnvironmentScope;
}

type DeclaredEntry = (typeof ENVIRONMENT_ENTRIES)[number];

export type EnvironmentKey = DeclaredEntry["key"];

export type PortKey = Extract<DeclaredEntry, { readonly kind: "port"; readonly required: true }>["key"];

export type TextKey = Exclude<Extract<DeclaredEntry, { readonly required: true }>["key"], PortKey>;

export type OptionalKey = Extract<DeclaredEntry, { readonly required: false }>["key"];

export interface FieldLabel {
    readonly label: string;
}

export interface EntryAnswer {
    readonly answer: string;
    readonly entry: { readonly fields: readonly FieldLabel[] };
}

export interface ValueAnswer {
    readonly answer: string;
    readonly value: string;
}
```
