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.
| 6 | createNotificationInputSchema, |
| 7 | emitAmbientEventsInputSchema, |
| 8 | appPermissionSchema, |
| 9 | type AppPermission, |
| 10 | type BatchDeleteAppIndexDocumentsInput, |
| 11 | type BatchUpsertAppIndexDocumentsInput, |
| 12 | type ColineAppRegistrationPayload, |
| 13 | type CreateNotificationInputInput, |
| 14 | type EmitAmbientEventsInputInput, |
| 15 | } from "./manifest"; |
| 16 | import { ColineApiError } from "./errors"; |
| 17 |
| 18 | interface ApiErrorPayload { |
| 19 | error?: { |
| 20 | code?: string; |
| 21 | message?: string; |
| 22 | }; |
| 23 | } |
| 24 |
| 25 | async function parseJsonResponse<T>(response: Response): Promise<T> { |
| 26 | const payload = (await response.json().catch(() => null)) as T | null; |
| 27 |
| 28 | if (!response.ok) { |
| 29 | const errorMessage = |
| 30 | payload && |
| 31 | typeof payload === "object" && |
| 32 | "error_description" in payload && |
| 33 | typeof (payload as Record<string, unknown>)["error_description"] === "string" |
| 34 | ? ((payload as Record<string, unknown>)["error_description"] as string) |
| 35 | : `Request failed (${response.status}).`; |
| 36 |
| 37 | throw new ColineApiError({ |
| 38 | message: errorMessage, |
| 39 | type: "oauth", |
| 40 | status: response.status, |
| 41 | code: |
| 42 | payload && |
| 43 | typeof payload === "object" && |
| 44 | "error" in payload && |
| 45 | typeof (payload as Record<string, unknown>)["error"] === "string" |
| 46 | ? ((payload as Record<string, unknown>)["error"] as string) |
| 47 | : null, |
| 48 | }); |
| 49 | } |
| 50 |
| 51 | if (!payload) { |
| 52 | throw new ColineApiError({ |
| 53 | message: "Invalid JSON response.", |
| 54 | type: "oauth", |
| 55 | status: response.status, |
| 56 | }); |
| 57 | } |
| 58 |
| 59 | return payload; |
| 60 | } |
| 61 |
| 62 | async function parseApiResponse<T>(response: Response): Promise<T> { |
| 63 | const payload = (await response.json().catch(() => null)) as |
| 64 | | { data?: T; error?: ApiErrorPayload["error"] } |
| 65 | | null; |
| 66 |
| 67 | if (!response.ok) { |
| 68 | throw new ColineApiError({ |
| 69 | message: payload?.error?.message ?? `Request failed (${response.status}).`, |
| 70 | type: "api", |
| 71 | status: response.status, |
| 72 | code: payload?.error?.code ?? null, |
| 73 | }); |
| 74 | } |
| 75 |
| 76 | if (!payload || !("data" in payload)) { |
| 77 | throw new ColineApiError({ |
| 78 | message: "Invalid API response.", |
| 79 | type: "api", |
| 80 | status: response.status, |
| 81 | }); |
| 82 | } |
| 83 |
| 84 | return payload.data as T; |
| 85 | } |
| 86 |
| 87 | export interface ColineApiClientOptions { |
| 88 | baseUrl: string; |
| 89 | apiKey?: string; |
| 90 | fetch?: typeof fetch; |
| 91 | headers?: HeadersInit; |
| 92 | } |
| 93 |
| 94 | export interface RegisteredAppRecord { |
| 95 | appId: string; |
| 96 | appKey: string; |
| 97 | name: string; |
| 98 | description: string | null; |
| 99 | iconUrl: string | null; |
| 100 | status: "draft" | "active" | "disabled" | "archived"; |
| 101 | ownerUserId: string | null; |
| 102 | latestPublishedVersion: string | null; |
| 103 | } |
| 104 |
| 105 | export interface RegisteredAppDetail extends RegisteredAppRecord { |
| 106 | latestPublishedVersionId: string | null; |
| 107 | } |
| 108 |
| 109 | export interface RegisteredAppVersionSummary { |
| 110 | versionId: string; |
| 111 | version: string; |
| 112 | status: "draft" | "published" | "deprecated"; |
| 113 | apiBaseUrl: string; |
| 114 | permissions: string[]; |
| 115 | kairo: ColineKairoIntegration | null; |
| 116 | fileTypes: Array<{ |
| 117 | typeKey: string; |
| 118 | name: string; |
| 119 | description: string | null; |
| 120 | }>; |
| 121 | createdAt: string; |
| 122 | updatedAt: string; |
| 123 | } |
| 124 |
| 125 | export interface WorkspaceInstalledApp { |
| 126 | installId: string; |
| 127 | appId: string; |
| 128 | appKey: string; |
| 129 | name: string; |
| 130 | description: string | null; |
| 131 | iconUrl: string | null; |
| 132 | status: "active" | "suspended" | "revoked"; |
| 133 | installScope: "workspace" | "user"; |
| 134 | scopeSubjectId: string; |
| 135 | version: string | null; |
| 136 | } |
| 137 |
| 138 | export interface WorkspaceAppCatalogItem { |
| 139 | appId: string; |
| 140 | appKey: string; |
| 141 | name: string; |
| 142 | description: string | null; |
| 143 | iconUrl: string | null; |
| 144 | status: "draft" | "active" | "disabled" | "archived"; |
| 145 | latestPublishedVersion: string | null; |
| 146 | latestPublishedVersionId: string | null; |
| 147 | isInstalled: boolean; |
| 148 | } |
| 149 |
| 150 | export interface WorkspaceAppsResponse { |
| 151 | installedApps: WorkspaceInstalledApp[]; |
| 152 | catalog: WorkspaceAppCatalogItem[]; |
| 153 | permissions: { |
| 154 | canManageApps: boolean; |
| 155 | }; |
| 156 | } |
| 157 |
| 158 | export interface InstallWorkspaceAppInput { |
| 159 | appId: string; |
| 160 | pinnedVersionId?: string; |
| 161 | grantedPermissions?: AppPermission[]; |
| 162 | } |
| 163 |
| 164 | export interface InstallWorkspaceAppResponse { |
| 165 | installId: string; |
| 166 | appId: string; |
| 167 | appKey: string; |
| 168 | version: string; |
| 169 | grantedPermissions: AppPermission[]; |
| 170 | } |
| 171 |
| 172 | export interface WorkspaceAppPermissionsResponse { |
| 173 | install: WorkspaceInstalledApp; |
| 174 | availablePermissions: string[]; |
| 175 | grantedPermissions: string[]; |
| 176 | permissions: { |
| 177 | canManageApps: boolean; |
| 178 | }; |
| 179 | } |
| 180 |
| 181 | export interface WorkspaceInstalledAppResponse { |
| 182 | install: WorkspaceInstalledApp; |
| 183 | permissions: { |
| 184 | canManageApps: boolean; |
| 185 | }; |
| 186 | } |
| 187 |
| 188 | export interface AppFileDocumentResponse { |
| 189 | file: { |
| 190 | id: string; |
| 191 | name: string; |
| 192 | fileType: string; |
| 193 | appKey: string; |
| 194 | appName: string; |
| 195 | typeLabel: string; |
| 196 | openHref: string; |
| 197 | updatedAt: string; |
| 198 | }; |
| 199 | document: Record<string, unknown>; |
| 200 | version: number; |
| 201 | capabilities: { |
| 202 | canRead: boolean; |
| 203 | canWrite: boolean; |
| 204 | canManage: boolean; |
| 205 | }; |
| 206 | } |
| 207 |
| 208 | export interface TabModelRecord { |
| 209 | id: string; |
| 210 | object: "model"; |
| 211 | created: number; |
| 212 | owned_by: string; |
| 213 | providerModelId: string; |
| 214 | pricing: { |
| 215 | inputPerMillionUsd: number; |
| 216 | outputPerMillionUsd: number; |
| 217 | }; |
| 218 | capabilities: { |
| 219 | streaming: boolean; |
| 220 | surfaces: string[]; |
| 221 | }; |
| 222 | } |
| 223 |
| 224 | export interface OAuthTokenResponse { |
| 225 | access_token: string; |
| 226 | token_type: "Bearer"; |
| 227 | expires_in: number; |
| 228 | refresh_token: string; |
| 229 | scope: string; |
| 230 | } |
| 231 |
| 232 | export interface OAuthUserInfoResponse { |
| 233 | sub: string; |
| 234 | email: string; |
| 235 | email_verified: boolean; |
| 236 | name: string; |
| 237 | given_name: string | null; |
| 238 | family_name: string | null; |
| 239 | picture: string | null; |
| 240 | preferred_username: string | null; |
| 241 | scope: string; |
| 242 | } |
| 243 |
| 244 | export interface UpdateWorkspaceAppPermissionsInput { |
| 245 | grantedPermissions: AppPermission[]; |
| 246 | } |
| 247 |
| 248 | function joinUrl(baseUrl: string, path: string): string { |
| 249 | return `${baseUrl.replace(/\/+$/, "")}${path}`; |
| 250 | } |
| 251 |
| 252 | export class ColineApiClient { |
| 253 | private readonly baseUrl: string; |
| 254 | private readonly apiKey: string | undefined; |
| 255 | private readonly fetchImpl: typeof fetch; |
| 256 | private readonly defaultHeaders: HeadersInit | undefined; |
| 257 |
| 258 | constructor(options: ColineApiClientOptions) { |
| 259 | this.baseUrl = options.baseUrl; |
| 260 | this.apiKey = options.apiKey; |
| 261 | this.fetchImpl = options.fetch ?? fetch; |
| 262 | this.defaultHeaders = options.headers; |
| 263 | } |
| 264 |
| 265 | private async request<T>(path: string, init?: RequestInit): Promise<T> { |
| 266 | const headers = new Headers(this.defaultHeaders); |
| 267 | const requestHeaders = new Headers(init?.headers); |
| 268 | requestHeaders.forEach((value, key) => headers.set(key, value)); |
| 269 |
| 270 | if (!headers.has("Content-Type") && init?.body) { |
| 271 | headers.set("Content-Type", "application/json"); |
| 272 | } |
| 273 |
| 274 | if (this.apiKey && !headers.has("Authorization")) { |
| 275 | headers.set("Authorization", `Bearer ${this.apiKey}`); |
| 276 | } |
| 277 |
| 278 | const response = await this.fetchImpl(joinUrl(this.baseUrl, path), { |
| 279 | ...init, |
| 280 | headers, |
| 281 | }); |
| 282 |
| 283 | return parseApiResponse<T>(response); |
| 284 | } |
| 285 |
| 286 | withApiKey(apiKey: string): ColineApiClient { |
| 287 | const options: ColineApiClientOptions = { |
| 288 | baseUrl: this.baseUrl, |
| 289 | apiKey, |
| 290 | fetch: this.fetchImpl, |
| 291 | }; |
| 292 |
| 293 | if (this.defaultHeaders !== undefined) { |
| 294 | options.headers = this.defaultHeaders; |
| 295 | } |
| 296 |
| 297 | return new ColineApiClient(options); |
| 298 | } |
| 299 |
| 300 | withHeaders(headers: HeadersInit): ColineApiClient { |
| 301 | const mergedHeaders = new Headers(this.defaultHeaders); |
| 302 | new Headers(headers).forEach((value, key) => mergedHeaders.set(key, value)); |
| 303 |
| 304 | const options: ColineApiClientOptions = { |
| 305 | baseUrl: this.baseUrl, |
| 306 | fetch: this.fetchImpl, |
| 307 | headers: mergedHeaders, |
| 308 | }; |
| 309 |
| 310 | if (this.apiKey !== undefined) { |
| 311 | options.apiKey = this.apiKey; |
| 312 | } |
| 313 |
| 314 | return new ColineApiClient(options); |
| 315 | } |
| 316 |
| 317 | buildLoginWithColineAuthorizeUrl(input: { |
| 318 | clientId: string; |
| 319 | redirectUri: string; |
| 320 | scope?: string; |
| 321 | state?: string; |
| 322 | codeChallenge?: string; |
| 323 | codeChallengeMethod?: "S256" | "plain"; |
| 324 | }): string { |
| 325 | const url = new URL("/api/v1/oauth/authorize", this.baseUrl); |
| 326 | url.searchParams.set("response_type", "code"); |
| 327 | url.searchParams.set("client_id", input.clientId); |
| 328 | url.searchParams.set("redirect_uri", input.redirectUri); |
| 329 | if (input.scope) { |
| 330 | url.searchParams.set("scope", input.scope); |
| 331 | } |
| 332 | if (input.state) { |
| 333 | url.searchParams.set("state", input.state); |
| 334 | } |
| 335 | if (input.codeChallenge) { |
| 336 | url.searchParams.set("code_challenge", input.codeChallenge); |
| 337 | } |
| 338 | if (input.codeChallengeMethod) { |
| 339 | url.searchParams.set("code_challenge_method", input.codeChallengeMethod); |
| 340 | } |
| 341 | return url.toString(); |
| 342 | } |
| 343 |
| 344 | async listApps(): Promise<{ apps: RegisteredAppRecord[] }> { |
| 345 | return this.request<{ apps: RegisteredAppRecord[] }>("/api/v1/apps"); |
| 346 | } |
| 347 |
| 348 | async getApp(appKey: string): Promise<{ app: RegisteredAppDetail }> { |
| 349 | return this.request<{ app: RegisteredAppDetail }>(`/api/v1/apps/${appKey}`); |
| 350 | } |
| 351 |
| 352 | async listAppVersions( |
| 353 | appKey: string, |
| 354 | ): Promise<{ versions: RegisteredAppVersionSummary[] }> { |
| 355 | return this.request<{ versions: RegisteredAppVersionSummary[] }>( |
| 356 | `/api/v1/apps/${appKey}/versions`, |
| 357 | ); |
| 358 | } |
| 359 |
| 360 | async registerApp( |
| 361 | payload: ColineAppRegistrationPayload, |
| 362 | ): Promise<{ appId: string; appKey: string; versionId: string; version: string }> { |
| 363 | const body = colineAppRegistrationPayloadSchema.parse(payload); |
| 364 |
| 365 | return this.request<{ |
| 366 | appId: string; |
| 367 | appKey: string; |
| 368 | versionId: string; |
| 369 | version: string; |
| 370 | }>("/api/apps", { |
| 371 | method: "POST", |
| 372 | body: JSON.stringify(body), |
| 373 | }); |
| 374 | } |
| 375 |
| 376 | async listWorkspaceApps(workspaceSlug: string): Promise<WorkspaceAppsResponse> { |
| 377 | return this.request<WorkspaceAppsResponse>( |
| 378 | `/api/v1/workspaces/${workspaceSlug}/apps`, |
| 379 | ); |
| 380 | } |
| 381 |
| 382 | async installWorkspaceApp( |
| 383 | workspaceSlug: string, |
| 384 | input: InstallWorkspaceAppInput, |
| 385 | ): Promise<InstallWorkspaceAppResponse> { |
| 386 | const grantedPermissions = input.grantedPermissions |
| 387 | ? input.grantedPermissions.map((permission) => |
| 388 | appPermissionSchema.parse(permission), |
| 389 | ) |
| 390 | : undefined; |
| 391 |
| 392 | return this.request<InstallWorkspaceAppResponse>( |
| 393 | `/api/v1/workspaces/${workspaceSlug}/apps`, |
| 394 | { |
| 395 | method: "POST", |
| 396 | body: JSON.stringify({ |
| 397 | appId: input.appId, |
| 398 | ...(input.pinnedVersionId |
| 399 | ? { pinnedVersionId: input.pinnedVersionId } |
| 400 | : {}), |
| 401 | ...(grantedPermissions ? { grantedPermissions } : {}), |
| 402 | }), |
| 403 | }, |
| 404 | ); |
| 405 | } |
| 406 |
| 407 | async getWorkspaceAppPermissions( |
| 408 | workspaceSlug: string, |
| 409 | appKey: string, |
| 410 | ): Promise<WorkspaceAppPermissionsResponse> { |
| 411 | return this.request<WorkspaceAppPermissionsResponse>( |
| 412 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/permissions`, |
| 413 | ); |
| 414 | } |
| 415 |
| 416 | async getWorkspaceInstalledApp( |
| 417 | workspaceSlug: string, |
| 418 | appKey: string, |
| 419 | ): Promise<WorkspaceInstalledAppResponse> { |
| 420 | return this.request<WorkspaceInstalledAppResponse>( |
| 421 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}`, |
| 422 | ); |
| 423 | } |
| 424 |
| 425 | async updateWorkspaceAppPermissions( |
| 426 | workspaceSlug: string, |
| 427 | appKey: string, |
| 428 | input: UpdateWorkspaceAppPermissionsInput, |
| 429 | ): Promise<WorkspaceAppPermissionsResponse> { |
| 430 | return this.request<WorkspaceAppPermissionsResponse>( |
| 431 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/permissions`, |
| 432 | { |
| 433 | method: "PUT", |
| 434 | body: JSON.stringify({ |
| 435 | grantedPermissions: input.grantedPermissions.map((permission) => |
| 436 | appPermissionSchema.parse(permission), |
| 437 | ), |
| 438 | }), |
| 439 | }, |
| 440 | ); |
| 441 | } |
| 442 |
| 443 | async uninstallWorkspaceApp( |
| 444 | workspaceSlug: string, |
| 445 | appKey: string, |
| 446 | ): Promise<{ ok: true }> { |
| 447 | return this.request<{ ok: true }>( |
| 448 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}`, |
| 449 | { |
| 450 | method: "DELETE", |
| 451 | }, |
| 452 | ); |
| 453 | } |
| 454 |
| 455 | async emitAppAmbientEvents( |
| 456 | workspaceSlug: string, |
| 457 | appKey: string, |
| 458 | input: EmitAmbientEventsInputInput, |
| 459 | ): Promise<{ events: Array<{ id: string; dedupeKey: string }> }> { |
| 460 | const body = emitAmbientEventsInputSchema.parse(input); |
| 461 |
| 462 | return this.request<{ events: Array<{ id: string; dedupeKey: string }> }>( |
| 463 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/ambient/events`, |
| 464 | { |
| 465 | method: "POST", |
| 466 | body: JSON.stringify(body), |
| 467 | }, |
| 468 | ); |
| 469 | } |
| 470 |
| 471 | async createAppNotification( |
| 472 | workspaceSlug: string, |
| 473 | appKey: string, |
| 474 | input: CreateNotificationInputInput, |
| 475 | ): Promise<{ ok: true }> { |
| 476 | const body = createNotificationInputSchema.parse(input); |
| 477 |
| 478 | return this.request<{ ok: true }>( |
| 479 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/notifications`, |
| 480 | { |
| 481 | method: "POST", |
| 482 | body: JSON.stringify(body), |
| 483 | }, |
| 484 | ); |
| 485 | } |
| 486 |
| 487 | async upsertAppIndexDocuments( |
| 488 | workspaceSlug: string, |
| 489 | appKey: string, |
| 490 | input: BatchUpsertAppIndexDocumentsInput, |
| 491 | ): Promise<{ documents: Array<{ id: string; documentKey: string; visibilityMode: string }> }> { |
| 492 | const body = batchUpsertAppIndexDocumentsSchema.parse(input); |
| 493 |
| 494 | return this.request<{ |
| 495 | documents: Array<{ id: string; documentKey: string; visibilityMode: string }>; |
| 496 | }>(`/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/index-documents`, { |
| 497 | method: "POST", |
| 498 | body: JSON.stringify(body), |
| 499 | }); |
| 500 | } |
| 501 |
| 502 | async deleteAppIndexDocuments( |
| 503 | workspaceSlug: string, |
| 504 | appKey: string, |
| 505 | input: BatchDeleteAppIndexDocumentsInput, |
| 506 | ): Promise<{ deleted: Array<{ id: string; documentKey: string }> }> { |
| 507 | const body = batchDeleteAppIndexDocumentsSchema.parse(input); |
| 508 |
| 509 | return this.request<{ deleted: Array<{ id: string; documentKey: string }> }>( |
| 510 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/index-documents`, |
| 511 | { |
| 512 | method: "DELETE", |
| 513 | body: JSON.stringify(body), |
| 514 | }, |
| 515 | ); |
| 516 | } |
| 517 |
| 518 | async getAppFileDocument( |
| 519 | workspaceSlug: string, |
| 520 | appKey: string, |
| 521 | fileId: string, |
| 522 | ): Promise<AppFileDocumentResponse> { |
| 523 | return this.request<AppFileDocumentResponse>( |
| 524 | `/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/files/${fileId}`, |
| 525 | ); |
| 526 | } |
| 527 |
| 528 | async updateAppFileDocument( |
| 529 | workspaceSlug: string, |
| 530 | appKey: string, |
| 531 | fileId: string, |
| 532 | document: Record<string, unknown>, |
| 533 | ): Promise<{ document: Record<string, unknown>; version: number; updatedAt: string }> { |
| 534 | return this.request<{ |
| 535 | document: Record<string, unknown>; |
| 536 | version: number; |
| 537 | updatedAt: string; |
| 538 | }>(`/api/v1/workspaces/${workspaceSlug}/apps/${appKey}/files/${fileId}`, { |
| 539 | method: "PATCH", |
| 540 | body: JSON.stringify({ document }), |
| 541 | }); |
| 542 | } |
| 543 |
| 544 | async listTabModels(): Promise<{ object: "list"; data: TabModelRecord[] }> { |
| 545 | return this.request<{ object: "list"; data: TabModelRecord[] }>( |
| 546 | "/api/v1/tab/models", |
| 547 | ); |
| 548 | } |
| 549 |
| 550 | async createTabChatCompletion(input: { |
| 551 | model: string; |
| 552 | stream?: boolean; |
| 553 | tab_context: Record<string, unknown>; |
| 554 | messages?: Array<{ role?: string; content?: string }>; |
| 555 | }): Promise<{ |
| 556 | id: string; |
| 557 | object: "chat.completion"; |
| 558 | created: number; |
| 559 | model: string; |
| 560 | choices: Array<{ |
| 561 | index: number; |
| 562 | message: { role: "assistant"; content: string }; |
| 563 | finish_reason: "stop"; |
| 564 | }>; |
| 565 | usage: { |
| 566 | prompt_tokens: number; |
| 567 | completion_tokens: number; |
| 568 | total_tokens: number; |
| 569 | }; |
| 570 | }> { |
| 571 | return this.request("/api/v1/tab/chat/completions", { |
| 572 | method: "POST", |
| 573 | body: JSON.stringify(input), |
| 574 | }); |
| 575 | } |
| 576 |
| 577 | async exchangeOAuthCode(input: { |
| 578 | clientId: string; |
| 579 | clientSecret: string; |
| 580 | code: string; |
| 581 | redirectUri: string; |
| 582 | codeVerifier?: string; |
| 583 | }): Promise<OAuthTokenResponse> { |
| 584 | const response = await this.fetchImpl(joinUrl(this.baseUrl, "/api/v1/oauth/token"), { |
| 585 | method: "POST", |
| 586 | headers: { |
| 587 | "Content-Type": "application/json", |
| 588 | }, |
| 589 | body: JSON.stringify({ |
| 590 | grant_type: "authorization_code", |
| 591 | client_id: input.clientId, |
| 592 | client_secret: input.clientSecret, |
| 593 | code: input.code, |
| 594 | redirect_uri: input.redirectUri, |
| 595 | ...(input.codeVerifier ? { code_verifier: input.codeVerifier } : {}), |
| 596 | }), |
| 597 | }); |
| 598 |
| 599 | return parseJsonResponse<OAuthTokenResponse>(response); |
| 600 | } |
| 601 |
| 602 | async getOAuthUserInfo(accessToken: string): Promise<OAuthUserInfoResponse> { |
| 603 | const response = await this.fetchImpl(joinUrl(this.baseUrl, "/api/v1/oauth/userinfo"), { |
| 604 | method: "GET", |
| 605 | headers: { |
| 606 | Authorization: `Bearer ${accessToken}`, |
| 607 | }, |
| 608 | }); |
| 609 |
| 610 | return parseJsonResponse<OAuthUserInfoResponse>(response); |
| 611 | } |
| 612 | } |
| 613 |