| ... | @@ -1,8 +1,8 @@ | ... | @@ -1,8 +1,8 @@ |
| 1 | import * as Cause from "effect/Cause"; | 1 | import * as Cause from "effect/Cause"; |
| 2 | import * as Data from "effect/Data"; | | |
| 3 | import * as Effect from "effect/Effect"; | 2 | import * as Effect from "effect/Effect"; |
| 4 | import * as Option from "effect/Option"; | 3 | import * as Option from "effect/Option"; |
| 5 | import * as Ref from "effect/Ref"; | 4 | import * as Ref from "effect/Ref"; |
| | 5 | import * as Schema from "effect/Schema"; |
| 6 | | 6 | |
| 7 | import * as NetService from "@t3tools/shared/Net"; | 7 | import * as NetService from "@t3tools/shared/Net"; |
| 8 | import * as Crypto from "effect/Crypto"; | 8 | import * as Crypto from "effect/Crypto"; |
| ... | @@ -33,22 +33,24 @@ const makeDesktopRunId = Crypto.Crypto.pipe( | ... | @@ -33,22 +33,24 @@ const makeDesktopRunId = Crypto.Crypto.pipe( |
| 33 | Effect.map((value) => value.replaceAll("-", "").slice(0, 12)), | 33 | Effect.map((value) => value.replaceAll("-", "").slice(0, 12)), |
| 34 | ); | 34 | ); |
| 35 | | 35 | |
| 36 | class DesktopBackendPortUnavailableError extends Data.TaggedError( | 36 | export class DesktopBackendPortUnavailableError extends Schema.TaggedErrorClass<DesktopBackendPortUnavailableError>()( |
| 37 | "DesktopBackendPortUnavailableError", | 37 | "DesktopBackendPortUnavailableError", |
| 38 | )<{ | 38 | { |
| 39 | readonly startPort: number; | 39 | startPort: Schema.Int, |
| 40 | readonly maxPort: number; | 40 | maxPort: Schema.Int, |
| 41 | readonly hosts: readonly string[]; | 41 | hosts: Schema.Array(Schema.String), |
| 42 | }> { | 42 | }, |
| 43 | override get message() { | 43 | ) { |
| | 44 | override get message(): string { |
| 44 | return `No desktop backend port is available on hosts ${this.hosts.join(", ")} between ${this.startPort} and ${this.maxPort}.`; | 45 | return `No desktop backend port is available on hosts ${this.hosts.join(", ")} between ${this.startPort} and ${this.maxPort}.`; |
| 45 | } | 46 | } |
| 46 | } | 47 | } |
| 47 | | 48 | |
| 48 | class DesktopDevelopmentBackendPortRequiredError extends Data.TaggedError( | 49 | export class DesktopDevelopmentBackendPortRequiredError extends Schema.TaggedErrorClass<DesktopDevelopmentBackendPortRequiredError>()( |
| 49 | "DesktopDevelopmentBackendPortRequiredError", | 50 | "DesktopDevelopmentBackendPortRequiredError", |
| 50 | )<{}> { | 51 | {}, |
| 51 | override get message() { | 52 | ) { |
| | 53 | override get message(): string { |
| 52 | return "T3CODE_PORT is required in desktop development."; | 54 | return "T3CODE_PORT is required in desktop development."; |
| 53 | } | 55 | } |
| 54 | } | 56 | } |