-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiles.ts
More file actions
47 lines (39 loc) · 1.08 KB
/
files.ts
File metadata and controls
47 lines (39 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import type { SyncDiagnostic } from '@powersync/cli-core';
import { z } from 'zod';
/**
* Individual file item returned from the editor files API.
*/
export type FileItem = {
content: string;
filename: string;
label: string;
type: string;
};
/**
* Response to GET request to editor files API, containing an array of file items.
*/
export type FilesResponse = {
files: FileItem[];
};
/**
* Updates the local filesystem with the given file content. The editor calls this API when the user saves a file.
*/
export const SaveFileRequest = z.object({
content: z.string(),
filename: z.literal('service.yaml').or(z.literal('sync-config.yaml'))
});
export type SaveFileRequest = z.infer<typeof SaveFileRequest>;
/**
* Validates the sync rules content and returns any issues found.
*/
export const ValidateSyncRulesRequest = z.object({
content: z.string()
});
export type ValidateSyncRulesRequest = z.infer<typeof ValidateSyncRulesRequest>;
/**
* Result from sync rules validation.
*/
export type ValidateSyncRulesResponse = {
issues: SyncDiagnostic[];
passed: boolean;
};