The Coline App SDK: apps, tools, file types and surfaces that run inside Coline workspaces, and public websites with Coline Sites. TypeScript, with an in-memory test workspace. MIT.
| "app.home.read", |
| 5 | "files.read", |
| 6 | "files.write", |
| 7 | "index.write", |
| 8 | "notifications.read_own", |
| 9 | "notifications.write", |
| 10 | "profile.read", |
| 11 | "tasks.read", |
| 12 | "tasks.write", |
| 13 | ] as const; |
| 14 |
| 15 | export const appPermissionSchema = z.enum(appPermissionValues); |
| 16 | export type AppPermission = z.infer<typeof appPermissionSchema>; |
| 17 |
| 18 | export const appHomeRenderModeValues = ["cached", "live", "hybrid"] as const; |
| 19 | export const appHomeRenderModeSchema = z.enum(appHomeRenderModeValues); |
| 20 | export type AppHomeRenderMode = z.infer<typeof appHomeRenderModeSchema>; |
| 21 |
| 22 | export const appHostingSchema = z.object({ |
| 23 | mode: z.literal("external"), |
| 24 | baseUrl: z.url(), |
| 25 | }); |
| 26 | export type AppHostingConfig = z.infer<typeof appHostingSchema>; |
| 27 |
| 28 | export const colineAppManifestSchema = z.object({ |
| 29 | key: z.string().trim().min(3).max(120), |
| 30 | name: z.string().trim().min(1).max(120), |
| 31 | description: z.string().trim().min(1).max(500).optional(), |
| 32 | iconUrl: z.url().optional(), |
| 33 | permissions: z.array(appPermissionSchema).default([]), |
| 34 | hosting: appHostingSchema, |
| 35 | }); |
| 36 | export type ColineAppManifest = z.infer<typeof colineAppManifestSchema>; |
| 37 |
| 38 | export const colineFileTypeSchema = z.object({ |
| 39 | typeKey: z.string().trim().min(3).max(160), |
| 40 | name: z.string().trim().min(1).max(120), |
| 41 | description: z.string().trim().min(1).max(500).optional(), |
| 42 | storage: z.enum(["coline_document"]), |
| 43 | indexable: z.boolean().default(true), |
| 44 | homeRenderMode: appHomeRenderModeSchema.default("cached"), |
| 45 | }); |
| 46 | export type ColineFileTypeDefinitionInput = z.input<typeof colineFileTypeSchema>; |
| 47 | export type ColineFileTypeDefinition = z.infer<typeof colineFileTypeSchema>; |
| 48 |
| 49 | export const colineAppRegistrationPayloadSchema = z.object({ |
| 50 | version: z.string().trim().min(1).max(64), |
| 51 | manifest: colineAppManifestSchema, |
| 52 | fileTypes: z.array(colineFileTypeSchema).default([]), |
| 53 | }); |
| 54 | export type ColineAppRegistrationPayload = z.infer< |
| 55 | typeof colineAppRegistrationPayloadSchema |
| 56 | >; |
| 57 |