| 1 | import * as Schema from "effect/Schema"; |
| 2 | |
| 3 | import { TrimmedNonEmptyString } from "./baseSchemas.ts"; |
| 4 | |
| 5 | export const AdvertisedEndpointProviderKind = Schema.Literals([ |
| 6 | "core", |
| 7 | "private-network", |
| 8 | "tunnel", |
| 9 | "manual", |
| 10 | ]); |
| 11 | export type AdvertisedEndpointProviderKind = typeof AdvertisedEndpointProviderKind.Type; |
| 12 | |
| 13 | export const AdvertisedEndpointReachability = Schema.Literals([ |
| 14 | "loopback", |
| 15 | "lan", |
| 16 | "private-network", |
| 17 | "public", |
| 18 | ]); |
| 19 | export type AdvertisedEndpointReachability = typeof AdvertisedEndpointReachability.Type; |
| 20 | |
| 21 | export const AdvertisedEndpointHostedHttpsCompatibility = Schema.Literals([ |
| 22 | "compatible", |
| 23 | "mixed-content-blocked", |
| 24 | "requires-configuration", |
| 25 | "unknown", |
| 26 | ]); |
| 27 | export type AdvertisedEndpointHostedHttpsCompatibility = |
| 28 | typeof AdvertisedEndpointHostedHttpsCompatibility.Type; |
| 29 | |
| 30 | export const AdvertisedEndpointStatus = Schema.Literals(["available", "unavailable", "unknown"]); |
| 31 | export type AdvertisedEndpointStatus = typeof AdvertisedEndpointStatus.Type; |
| 32 | |
| 33 | export const AdvertisedEndpointSource = Schema.Literals([ |
| 34 | "desktop-core", |
| 35 | "desktop-addon", |
| 36 | "server", |
| 37 | "user", |
| 38 | ]); |
| 39 | export type AdvertisedEndpointSource = typeof AdvertisedEndpointSource.Type; |
| 40 | |
| 41 | export const AdvertisedEndpointProvider = Schema.Struct({ |
| 42 | id: TrimmedNonEmptyString, |
| 43 | label: TrimmedNonEmptyString, |
| 44 | kind: AdvertisedEndpointProviderKind, |
| 45 | isAddon: Schema.Boolean, |
| 46 | }); |
| 47 | export type AdvertisedEndpointProvider = typeof AdvertisedEndpointProvider.Type; |
| 48 | |
| 49 | export const AdvertisedEndpointCompatibility = Schema.Struct({ |
| 50 | hostedHttpsApp: AdvertisedEndpointHostedHttpsCompatibility, |
| 51 | desktopApp: Schema.Literals(["compatible", "unknown"]), |
| 52 | }); |
| 53 | export type AdvertisedEndpointCompatibility = typeof AdvertisedEndpointCompatibility.Type; |
| 54 | |
| 55 | export const AdvertisedEndpoint = Schema.Struct({ |
| 56 | id: TrimmedNonEmptyString, |
| 57 | label: TrimmedNonEmptyString, |
| 58 | provider: AdvertisedEndpointProvider, |
| 59 | httpBaseUrl: TrimmedNonEmptyString, |
| 60 | wsBaseUrl: TrimmedNonEmptyString, |
| 61 | reachability: AdvertisedEndpointReachability, |
| 62 | compatibility: AdvertisedEndpointCompatibility, |
| 63 | source: AdvertisedEndpointSource, |
| 64 | status: AdvertisedEndpointStatus, |
| 65 | isDefault: Schema.optional(Schema.Boolean), |
| 66 | description: Schema.optional(TrimmedNonEmptyString), |
| 67 | }); |
| 68 | export type AdvertisedEndpoint = typeof AdvertisedEndpoint.Type; |