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