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.
| 4 |
| export interface ColineActorIdentity { |
| 5 | userId: string; |
| 6 | email?: string; |
| 7 | handle?: string | null; |
| 8 | firstName?: string | null; |
| 9 | lastName?: string | null; |
| 10 | } |
| 11 |
| 12 | export interface ColineWorkspaceIdentity { |
| 13 | workspaceId: string; |
| 14 | workspaceSlug: string; |
| 15 | workspaceName?: string; |
| 16 | } |
| 17 |
| 18 | export interface ColineAppIdentity { |
| 19 | appKey: string; |
| 20 | appInstallId?: string; |
| 21 | } |
| 22 |
| 23 | export interface ColineFileReference { |
| 24 | id: string; |
| 25 | typeKey: string; |
| 26 | title?: string; |
| 27 | } |
| 28 |
| 29 | export interface ColineFilesApi { |
| 30 | getDocument(fileId: string): Promise<Record<string, unknown>>; |
| 31 | updateDocument( |
| 32 | fileId: string, |
| 33 | document: Record<string, unknown>, |
| 34 | ): Promise<{ version: number; updatedAt: string }>; |
| 35 | } |
| 36 |
| 37 | export interface ColineIndexApi { |
| 38 | upsert(input: { |
| 39 | documents: Array<{ |
| 40 | documentKey: string; |
| 41 | documentType: string; |
| 42 | fileId?: string; |
| 43 | title: string; |
| 44 | body: string; |
| 45 | url?: string; |
| 46 | metadata?: Record<string, unknown>; |
| 47 | }>; |
| 48 | }): Promise<{ |
| 49 | documents: Array<{ |
| 50 | id: string; |
| 51 | documentKey: string; |
| 52 | visibilityMode: string; |
| 53 | }>; |
| 54 | }>; |
| 55 | delete(input: { |
| 56 | documentKeys: string[]; |
| 57 | }): Promise<{ |
| 58 | deleted: Array<{ |
| 59 | id: string; |
| 60 | documentKey: string; |
| 61 | }>; |
| 62 | }>; |
| 63 | } |
| 64 |
| 65 | export interface ColineNotificationsApi { |
| 66 | create( |
| 67 | input: CreateNotificationInputInput, |
| 68 | ): Promise<{ ok: true }>; |
| 69 | } |
| 70 |
| 71 | export interface ColineRoutesApi { |
| 72 | openFile(fileId: string): ColineUiAction; |
| 73 | openAppHome(): ColineUiAction; |
| 74 | custom(type: string, payload?: Record<string, unknown>): ColineUiAction; |
| 75 | } |
| 76 |
| 77 | export interface ColineBaseContext { |
| 78 | workspace: ColineWorkspaceIdentity; |
| 79 | app: ColineAppIdentity; |
| 80 | actor?: ColineActorIdentity | null; |
| 81 | routes: ColineRoutesApi; |
| 82 | files: ColineFilesApi; |
| 83 | index: ColineIndexApi; |
| 84 | notifications: ColineNotificationsApi; |
| 85 | } |
| 86 |
| 87 | export interface HomeRenderContext extends ColineBaseContext {} |
| 88 |
| 89 | export interface FileRenderContext extends ColineBaseContext { |
| 90 | file: ColineFileReference; |
| 91 | } |
| 92 |
| 93 | export interface IndexSyncContext extends ColineBaseContext { |
| 94 | file?: ColineFileReference; |
| 95 | } |
| 96 |
| 97 | export type HomeRenderResult = ColineUiNode; |
| 98 | export type FileRenderResult = ColineUiNode; |
| 99 |