Open History to see the last commit
1import { Schema } from "effect";
2import { TrimmedNonEmptyString } from "./baseSchemas";
3import { KeybindingRule, ResolvedKeybindingsConfig } from "./keybindings";
4import { EditorId } from "./editor";
5
6export const KeybindingsMalformedConfigIssue = Schema.Struct({
7 kind: Schema.Literal("keybindings.malformed-config"),
8 message: TrimmedNonEmptyString,
9});
10export type KeybindingsMalformedConfigIssue = typeof KeybindingsMalformedConfigIssue.Type;
11
12export const KeybindingsInvalidEntryIssue = Schema.Struct({
13 kind: Schema.Literal("keybindings.invalid-entry"),
14 message: TrimmedNonEmptyString,
15 index: Schema.Number,
16});
17export type KeybindingsInvalidEntryIssue = typeof KeybindingsInvalidEntryIssue.Type;
18
19export const ServerConfigIssue = Schema.Union([
20 KeybindingsMalformedConfigIssue,
21 KeybindingsInvalidEntryIssue,
22]);
23export type ServerConfigIssue = typeof ServerConfigIssue.Type;
24
25export const ServerConfigIssues = Schema.Array(ServerConfigIssue);
26export type ServerConfigIssues = typeof ServerConfigIssues.Type;
27
28export const ServerConfig = Schema.Struct({
29 cwd: TrimmedNonEmptyString,
30 keybindingsConfigPath: TrimmedNonEmptyString,
31 keybindings: ResolvedKeybindingsConfig,
32 issues: ServerConfigIssues,
33 availableEditors: Schema.Array(EditorId),
34});
35export type ServerConfig = typeof ServerConfig.Type;
36
37export const ServerUpsertKeybindingInput = KeybindingRule;
38export type ServerUpsertKeybindingInput = typeof ServerUpsertKeybindingInput.Type;
39
40export const ServerUpsertKeybindingResult = Schema.Struct({
41 keybindings: ResolvedKeybindingsConfig,
42 issues: ServerConfigIssues,
43});
44export type ServerUpsertKeybindingResult = typeof ServerUpsertKeybindingResult.Type;
45
46export const ServerConfigUpdatedPayload = Schema.Struct({
47 issues: ServerConfigIssues,
48});
49export type ServerConfigUpdatedPayload = typeof ServerConfigUpdatedPayload.Type;