"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serviceDefinition = void 0; var _configSchema = require("@kbn/config-schema"); /* * 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 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ const apiError = _configSchema.schema.object({ error: _configSchema.schema.string(), message: _configSchema.schema.string(), statusCode: _configSchema.schema.number(), metadata: _configSchema.schema.object({}, { unknowns: 'allow' }) }); const referenceSchema = _configSchema.schema.object({ name: _configSchema.schema.maybe(_configSchema.schema.string()), type: _configSchema.schema.string(), id: _configSchema.schema.string() }, { unknowns: 'forbid' }); const referencesSchema = _configSchema.schema.arrayOf(referenceSchema); const visualizeAttributesSchema = _configSchema.schema.object({ title: _configSchema.schema.string(), description: _configSchema.schema.maybe(_configSchema.schema.nullable(_configSchema.schema.string())), version: _configSchema.schema.maybe(_configSchema.schema.number()), kibanaSavedObjectMeta: _configSchema.schema.maybe(_configSchema.schema.object({ searchSourceJSON: _configSchema.schema.string() })), uiStateJSON: _configSchema.schema.maybe(_configSchema.schema.string()), visState: _configSchema.schema.maybe(_configSchema.schema.string()), savedSearchRefName: _configSchema.schema.maybe(_configSchema.schema.string()) }, { unknowns: 'forbid' }); const visualizeSavedObjectSchema = _configSchema.schema.object({ id: _configSchema.schema.string(), type: _configSchema.schema.string(), version: _configSchema.schema.maybe(_configSchema.schema.string()), createdAt: _configSchema.schema.maybe(_configSchema.schema.string()), updatedAt: _configSchema.schema.maybe(_configSchema.schema.string()), error: _configSchema.schema.maybe(apiError), attributes: visualizeAttributesSchema, references: referencesSchema, namespaces: _configSchema.schema.maybe(_configSchema.schema.arrayOf(_configSchema.schema.string())), originId: _configSchema.schema.maybe(_configSchema.schema.string()) }, { unknowns: 'allow' }); const getResultSchema = _configSchema.schema.object({ item: visualizeSavedObjectSchema, meta: _configSchema.schema.object({ outcome: _configSchema.schema.oneOf([_configSchema.schema.literal('exactMatch'), _configSchema.schema.literal('aliasMatch'), _configSchema.schema.literal('conflict')]), aliasTargetId: _configSchema.schema.maybe(_configSchema.schema.string()), aliasPurpose: _configSchema.schema.maybe(_configSchema.schema.oneOf([_configSchema.schema.literal('savedObjectConversion'), _configSchema.schema.literal('savedObjectImport')])) }, { unknowns: 'forbid' }) }, { unknowns: 'forbid' }); const createOptionsSchema = _configSchema.schema.object({ overwrite: _configSchema.schema.maybe(_configSchema.schema.boolean()), references: _configSchema.schema.maybe(referencesSchema) }); // Content management service definition. // We need it for BWC support between different versions of the content const serviceDefinition = { get: { out: { result: { schema: getResultSchema } } }, create: { in: { options: { schema: createOptionsSchema }, data: { schema: visualizeAttributesSchema } }, out: { result: { schema: _configSchema.schema.object({ item: visualizeSavedObjectSchema }, { unknowns: 'forbid' }) } } }, update: { in: { options: { schema: createOptionsSchema // same schema as "create" }, data: { schema: visualizeAttributesSchema } } }, search: { in: { options: { schema: _configSchema.schema.maybe(_configSchema.schema.object({ searchFields: _configSchema.schema.maybe(_configSchema.schema.arrayOf(_configSchema.schema.string())), types: _configSchema.schema.maybe(_configSchema.schema.arrayOf(_configSchema.schema.string())) }, { unknowns: 'forbid' })) } } } }; exports.serviceDefinition = serviceDefinition;