UNPKG

dsl-builder

Version:

OpenSearch Query Builder - Extract from OpenSearch Dashboards

88 lines (87 loc) 3.14 kB
import { Permissions } from './acl'; /** * Don't use this type, it's simply a helper type for {@link SavedObjectAttribute} * * @public */ export type SavedObjectAttributeSingle = string | number | boolean | null | undefined | SavedObjectAttributes; /** * Type definition for a Saved Object attribute value * * @public */ export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttributeSingle[]; /** * The data for a Saved Object is stored as an object in the `attributes` * property. * * @public */ export interface SavedObjectAttributes { [key: string]: SavedObjectAttribute; } /** * A reference to another saved object. * * @public */ export interface SavedObjectReference { name: string; type: string; id: string; } /** * Information about the migrations that have been applied to this SavedObject. * When OpenSearch Dashboards starts up, OpenSearchDashboardsMigrator detects outdated documents and * migrates them based on this value. For each migration that has been applied, * the plugin's name is used as a key and the latest migration version as the * value. * * @example * migrationVersion: { * dashboard: '7.1.1', * space: '6.6.6', * } * * @public */ export interface SavedObjectsMigrationVersion { [pluginName: string]: string; } export interface SavedObject<T = unknown> { /** The ID of this Saved Object, guaranteed to be unique for all objects of the same `type` */ id: string; /** The type of Saved Object. Each plugin can define it's own custom Saved Object types. */ type: string; /** An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. */ version?: string; /** Timestamp of the last time this document had been updated. */ updated_at?: string; error?: SavedObjectError; /** {@inheritdoc SavedObjectAttributes} */ attributes: T; /** {@inheritdoc SavedObjectReference} */ references: SavedObjectReference[]; /** {@inheritdoc SavedObjectsMigrationVersion} */ migrationVersion?: SavedObjectsMigrationVersion; /** Namespace(s) that this saved object exists in. This attribute is only used for multi-namespace saved object types. */ namespaces?: string[]; /** * The ID of the saved object this originated from. This is set if this object's `id` was regenerated; that can happen during migration * from a legacy single-namespace type, or during import. It is only set during migration or create operations. This is used during import * to ensure that ID regeneration is deterministic, so saved objects will be overwritten if they are imported multiple times into a given * space. */ originId?: string; /** Workspace(s) that this saved object exists in. */ workspaces?: string[]; /** Permissions that this saved objects exists in. */ permissions?: Permissions; } export interface SavedObjectError { error: string; message: string; statusCode: number; metadata?: Record<string, unknown>; } export type SavedObjectPermissions = Permissions;