forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattachments.ts
More file actions
53 lines (48 loc) · 1.92 KB
/
attachments.ts
File metadata and controls
53 lines (48 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { AttachmentType, AttachmentDataOf } from './attachment_types';
/**
* Represents a conversation attachment, as returned by the conversation API.
*/
export interface Attachment<
Type extends string = string,
DataType = Type extends AttachmentType ? AttachmentDataOf<Type> : Record<string, unknown>
> {
/** Unique identifier for the attachment */
id: string;
/** Type of the attachment */
type: Type;
/** data bound to the attachment */
data: DataType;
/** Human-readable description of the attachment */
description?: string;
/** should the attachment be hidden from the user - e.g. for screen context */
hidden?: boolean;
/**
* Origin/reference info for attachments created from external sources.
* For saved-object-backed types this is the saved object ID.
* Undefined for by-value attachments.
*/
origin?: string;
/**
* Stable identifier for the logical group this attachment belongs to.
* Attachments sharing the same group_id were submitted together as a single
* logical entity (e.g. multiple alert batches from one bulk-add action).
* Undefined for standalone attachments.
*/
group_id?: string;
}
/**
* Attachment type that accepts any attachment.
*/
export type UnknownAttachment = Attachment<string, unknown>;
// Strongly typed sub-types for known attachment types
export type TextAttachment = Attachment<AttachmentType.text>;
export type ScreenContextAttachment = Attachment<AttachmentType.screenContext>;
export type EsqlAttachment = Attachment<AttachmentType.esql>;
export type VisualizationAttachment = Attachment<AttachmentType.visualization>;
export type ConnectorAttachment = Attachment<AttachmentType.connector>;