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 | undefined; |
| 7 | handle?: string | null | undefined; |
| 8 | firstName?: string | null | undefined; |
| 9 | lastName?: string | null | undefined; |
| 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 | undefined; |
| 27 | } |
| 28 |
| 29 | export interface ColineFileListItem extends ColineFileReference { |
| 30 | name: string; |
| 31 | fileType: string; |
| 32 | driveId: string; |
| 33 | parentId: string | null; |
| 34 | appKey: string; |
| 35 | appName: string; |
| 36 | openHref: string; |
| 37 | version: number; |
| 38 | updatedAt: string; |
| 39 | createdAt: string; |
| 40 | capabilities: { |
| 41 | canRead: boolean; |
| 42 | canWrite: boolean; |
| 43 | canManage: boolean; |
| 44 | }; |
| 45 | } |
| 46 |
| 47 | export interface ColineFilesApi { |
| 48 | listFiles(input?: { |
| 49 | driveId?: string; |
| 50 | typeKey?: string; |
| 51 | limit?: number; |
| 52 | }): Promise<{ |
| 53 | files: ColineFileListItem[]; |
| 54 | availableFileTypes: Array<{ |
| 55 | typeKey: string; |
| 56 | name: string; |
| 57 | description: string | null; |
| 58 | }>; |
| 59 | }>; |
| 60 | getDocument(fileId: string): Promise<Record<string, unknown>>; |
| 61 | updateDocument( |
| 62 | fileId: string, |
| 63 | document: Record<string, unknown>, |
| 64 | ): Promise<{ version: number; updatedAt: string }>; |
| 65 | } |
| 66 |
| 67 | export interface ColineIndexApi { |
| 68 | upsert(input: { |
| 69 | documents: Array<{ |
| 70 | documentKey: string; |
| 71 | documentType: string; |
| 72 | fileId?: string; |
| 73 | title: string; |
| 74 | body: string; |
| 75 | url?: string; |
| 76 | metadata?: Record<string, unknown>; |
| 77 | }>; |
| 78 | }): Promise<{ |
| 79 | documents: Array<{ |
| 80 | id: string; |
| 81 | documentKey: string; |
| 82 | visibilityMode: string; |
| 83 | }>; |
| 84 | }>; |
| 85 | delete(input: { |
| 86 | documentKeys: string[]; |
| 87 | }): Promise<{ |
| 88 | deleted: Array<{ |
| 89 | id: string; |
| 90 | documentKey: string; |
| 91 | }>; |
| 92 | }>; |
| 93 | } |
| 94 |
| 95 | export interface ColineNotificationsApi { |
| 96 | create( |
| 97 | input: CreateNotificationInputInput, |
| 98 | ): Promise<{ ok: true }>; |
| 99 | } |
| 100 |
| 101 | export interface ColineRoutesApi { |
| 102 | openFile(fileId: string): ColineUiAction; |
| 103 | openAppHome(): ColineUiAction; |
| 104 | navigate(href: string): ColineUiAction; |
| 105 | createFile(input: { |
| 106 | name: string; |
| 107 | typeKey: string; |
| 108 | driveId?: string; |
| 109 | parentId?: string | null; |
| 110 | document?: Record<string, unknown>; |
| 111 | }): ColineUiAction; |
| 112 | custom(type: string, payload?: Record<string, unknown>): ColineUiAction; |
| 113 | } |
| 114 |
| 115 | export interface ColineBaseContext { |
| 116 | workspace: ColineWorkspaceIdentity; |
| 117 | app: ColineAppIdentity; |
| 118 | actor?: ColineActorIdentity | null; |
| 119 | routes: ColineRoutesApi; |
| 120 | files?: ColineFilesApi; |
| 121 | index?: ColineIndexApi; |
| 122 | notifications?: ColineNotificationsApi; |
| 123 | } |
| 124 |
| 125 | export interface HomeRenderContext extends ColineBaseContext {} |
| 126 |
| 127 | export interface FileRenderContext extends ColineBaseContext { |
| 128 | file: ColineFileReference; |
| 129 | document: Record<string, unknown>; |
| 130 | } |
| 131 |
| 132 | export interface IndexSyncContext extends ColineBaseContext { |
| 133 | file?: ColineFileReference; |
| 134 | } |
| 135 |
| 136 | export type HomeRenderResult = ColineUiNode; |
| 137 | export type FileRenderResult = ColineUiNode; |
| 138 |