Skip to content

Commit

Permalink
Add sidecarFile and tree types
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlauer-Hax committed Nov 19, 2023
1 parent ec8f378 commit ebb6949
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions spec/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ export const sidecarRequest = zod.discriminatedUnion("type", [
zod.object({
type: zod.literal("state"),
state: serverPowerActions
}),
zod.object({
type: zod.literal("tree"),
path: zod.string()
})
]);

Expand All @@ -324,18 +328,21 @@ const addon = zod.object({
background: zod.string(),
});

export const sidecarFile = zod.object({
name: zod.string(),
canWrite: zod.boolean(),
isFile: zod.boolean(),
fileMimeType: zod.string().optional(),
lastModified: zod.number().optional(),
size: zod.number().optional(),
});

export const sidecarResponse = zod.discriminatedUnion("type", [
zod.object({
type: zod.literal("list"),
path: zod.string(),
canWrite: zod.boolean(),
list: zod.object({
name: zod.string(),
canWrite: zod.boolean().optional(),
fileMimeType: zod.string().optional(),
lastModified: zod.number().optional(),
size: zod.number().optional(),
}).array()
list: sidecarFile.array()
}),
zod.object({
type: zod.literal("read"),
Expand Down Expand Up @@ -372,6 +379,12 @@ export const sidecarResponse = zod.discriminatedUnion("type", [
zod.object({
type: zod.literal("addons"),
success: zod.boolean(),
}),
zod.object({
type: zod.literal("tree"),
path: zod.string(),
canWrite: zod.boolean(),
files: sidecarFile.array()
})
]);

Expand Down Expand Up @@ -488,4 +501,5 @@ export type ServerCreate = zod.infer<typeof serverCreate>;
export type Song = zod.infer<typeof song>;
export type StoreItems = zod.infer<typeof storeItems>;
export type Transcript = zod.infer<typeof transcript>;
export type Wallet = zod.infer<typeof wallet>;
export type Wallet = zod.infer<typeof wallet>;
export type SidecarFile = zod.infer<typeof sidecarFile>;

0 comments on commit ebb6949

Please sign in to comment.