Remove `namespaceAgnostic` field that was deprecated in #54605, use `namespaceType` instead.
This commit is contained in:
parent
d88f9a3634
commit
f6cb14ad1a
44 changed files with 67 additions and 134 deletions
|
@ -25,6 +25,5 @@ This is only internal for now, and will only be public when we expose the regist
|
|||
| [mappings](./kibana-plugin-core-server.savedobjectstype.mappings.md) | <code>SavedObjectsTypeMappingDefinition</code> | The [mapping definition](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) for the type. |
|
||||
| [migrations](./kibana-plugin-core-server.savedobjectstype.migrations.md) | <code>SavedObjectMigrationMap</code> | An optional map of [migrations](./kibana-plugin-core-server.savedobjectmigrationfn.md) to be used to migrate the type. |
|
||||
| [name](./kibana-plugin-core-server.savedobjectstype.name.md) | <code>string</code> | The name of the type, which is also used as the internal id. |
|
||||
| [namespaceAgnostic](./kibana-plugin-core-server.savedobjectstype.namespaceagnostic.md) | <code>boolean</code> | Is the type global (true), or not (false). |
|
||||
| [namespaceType](./kibana-plugin-core-server.savedobjectstype.namespacetype.md) | <code>SavedObjectsNamespaceType</code> | The [namespace type](./kibana-plugin-core-server.savedobjectsnamespacetype.md) for the type. |
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsType](./kibana-plugin-core-server.savedobjectstype.md) > [namespaceAgnostic](./kibana-plugin-core-server.savedobjectstype.namespaceagnostic.md)
|
||||
|
||||
## SavedObjectsType.namespaceAgnostic property
|
||||
|
||||
> Warning: This API is now obsolete.
|
||||
>
|
||||
> Use `namespaceType` instead.
|
||||
>
|
||||
|
||||
Is the type global (true), or not (false).
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
namespaceAgnostic?: boolean;
|
||||
```
|
|
@ -9,5 +9,5 @@ The [namespace type](./kibana-plugin-core-server.savedobjectsnamespacetype.md) f
|
|||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
namespaceType?: SavedObjectsNamespaceType;
|
||||
namespaceType: SavedObjectsNamespaceType;
|
||||
```
|
||||
|
|
|
@ -22,7 +22,7 @@ import { SavedObjectsType } from 'kibana/server';
|
|||
export const todoSavedObject: SavedObjectsType = {
|
||||
name: 'todo',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
title: {
|
||||
|
|
|
@ -26,7 +26,7 @@ const createRegistry = (...types: Array<Partial<SavedObjectsType>>) => {
|
|||
types.forEach(type =>
|
||||
registry.registerType({
|
||||
name: 'unknown',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
migrations: {},
|
||||
|
@ -41,7 +41,7 @@ test('mappings without index pattern goes to default index', () => {
|
|||
kibanaIndexName: '.kibana',
|
||||
registry: createRegistry({
|
||||
name: 'type1',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
}),
|
||||
indexMap: {
|
||||
type1: {
|
||||
|
@ -73,7 +73,7 @@ test(`mappings with custom index pattern doesn't go to default index`, () => {
|
|||
kibanaIndexName: '.kibana',
|
||||
registry: createRegistry({
|
||||
name: 'type1',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
indexPattern: '.other_kibana',
|
||||
}),
|
||||
indexMap: {
|
||||
|
@ -106,7 +106,7 @@ test('creating a script gets added to the index pattern', () => {
|
|||
kibanaIndexName: '.kibana',
|
||||
registry: createRegistry({
|
||||
name: 'type1',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
indexPattern: '.other_kibana',
|
||||
convertToAliasScript: `ctx._id = ctx._source.type + ':' + ctx._id`,
|
||||
}),
|
||||
|
@ -141,12 +141,12 @@ test('throws when two scripts are defined for an index pattern', () => {
|
|||
const registry = createRegistry(
|
||||
{
|
||||
name: 'type1',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
convertToAliasScript: `ctx._id = ctx._source.type + ':' + ctx._id`,
|
||||
},
|
||||
{
|
||||
name: 'type2',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
convertToAliasScript: `ctx._id = ctx._source.type + ':' + ctx._id`,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -32,7 +32,7 @@ const createRegistry = (...types: Array<Partial<SavedObjectsType>>) => {
|
|||
types.forEach(type =>
|
||||
registry.registerType({
|
||||
name: 'unknown',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
migrations: {},
|
||||
|
|
|
@ -27,7 +27,7 @@ const defaultSavedObjectTypes: SavedObjectsType[] = [
|
|||
{
|
||||
name: 'testtype',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
name: { type: 'keyword' },
|
||||
|
|
|
@ -28,8 +28,8 @@ const createRegistry = (types: Array<Partial<SavedObjectsType>>) => {
|
|||
types.forEach(type =>
|
||||
registry.registerType({
|
||||
name: 'unknown',
|
||||
namespaceAgnostic: false,
|
||||
hidden: false,
|
||||
namespaceType: 'single',
|
||||
mappings: { properties: {} },
|
||||
migrations: {},
|
||||
...type,
|
||||
|
@ -120,7 +120,7 @@ function mockOptions(): KibanaMigratorOptions {
|
|||
{
|
||||
name: 'testtype',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
name: { type: 'keyword' },
|
||||
|
@ -131,7 +131,7 @@ function mockOptions(): KibanaMigratorOptions {
|
|||
{
|
||||
name: 'testtype2',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
indexPattern: 'other-index',
|
||||
mappings: {
|
||||
properties: {
|
||||
|
|
|
@ -49,7 +49,7 @@ export const createExportableType = (name: string): SavedObjectsType => {
|
|||
return {
|
||||
name,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {},
|
||||
},
|
||||
|
|
|
@ -183,14 +183,6 @@ describe('SavedObjectTypeRegistry', () => {
|
|||
expectResult(false, { namespaceType: 'single' });
|
||||
expectResult(false, { namespaceType: undefined });
|
||||
});
|
||||
|
||||
// deprecated test cases
|
||||
it(`returns true when namespaceAgnostic is true`, () => {
|
||||
expectResult(true, { namespaceAgnostic: true, namespaceType: 'agnostic' });
|
||||
expectResult(true, { namespaceAgnostic: true, namespaceType: 'multiple' });
|
||||
expectResult(true, { namespaceAgnostic: true, namespaceType: 'single' });
|
||||
expectResult(true, { namespaceAgnostic: true, namespaceType: undefined });
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isSingleNamespace', () => {
|
||||
|
@ -213,14 +205,6 @@ describe('SavedObjectTypeRegistry', () => {
|
|||
expectResult(false, { namespaceType: 'agnostic' });
|
||||
expectResult(false, { namespaceType: 'multiple' });
|
||||
});
|
||||
|
||||
// deprecated test cases
|
||||
it(`returns false when namespaceAgnostic is true`, () => {
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: 'agnostic' });
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: 'multiple' });
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: 'single' });
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: undefined });
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isMultiNamespace', () => {
|
||||
|
@ -243,14 +227,6 @@ describe('SavedObjectTypeRegistry', () => {
|
|||
expectResult(false, { namespaceType: 'single' });
|
||||
expectResult(false, { namespaceType: undefined });
|
||||
});
|
||||
|
||||
// deprecated test cases
|
||||
it(`returns false when namespaceAgnostic is true`, () => {
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: 'agnostic' });
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: 'multiple' });
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: 'single' });
|
||||
expectResult(false, { namespaceAgnostic: true, namespaceType: undefined });
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isHidden', () => {
|
||||
|
|
|
@ -72,11 +72,7 @@ export class SavedObjectTypeRegistry {
|
|||
* resolves to `false` if the type is not registered
|
||||
*/
|
||||
public isNamespaceAgnostic(type: string) {
|
||||
return (
|
||||
this.types.get(type)?.namespaceType === 'agnostic' ||
|
||||
this.types.get(type)?.namespaceAgnostic ||
|
||||
false
|
||||
);
|
||||
return this.types.get(type)?.namespaceType === 'agnostic';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,6 +80,7 @@ export class SavedObjectTypeRegistry {
|
|||
* resolves to `true` if the type is not registered
|
||||
*/
|
||||
public isSingleNamespace(type: string) {
|
||||
// in the case we somehow registered a type with an invalid `namespaceType`, treat it as single-namespace
|
||||
return !this.isNamespaceAgnostic(type) && !this.isMultiNamespace(type);
|
||||
}
|
||||
|
||||
|
@ -92,7 +89,7 @@ export class SavedObjectTypeRegistry {
|
|||
* resolves to `false` if the type is not registered
|
||||
*/
|
||||
public isMultiNamespace(type: string) {
|
||||
return !this.isNamespaceAgnostic(type) && this.types.get(type)?.namespaceType === 'multiple';
|
||||
return this.types.get(type)?.namespaceType === 'multiple';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('SavedObjectsRepository#createRepository', () => {
|
|||
typeRegistry.registerType({
|
||||
name: 'nsAgnosticType',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
name: { type: 'keyword' },
|
||||
|
@ -44,7 +44,7 @@ describe('SavedObjectsRepository#createRepository', () => {
|
|||
typeRegistry.registerType({
|
||||
name: 'nsType',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
indexPattern: 'beats',
|
||||
mappings: {
|
||||
properties: {
|
||||
|
@ -56,7 +56,7 @@ describe('SavedObjectsRepository#createRepository', () => {
|
|||
typeRegistry.registerType({
|
||||
name: 'hiddenType',
|
||||
hidden: true,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
name: { type: 'keyword' },
|
||||
|
|
|
@ -202,15 +202,10 @@ export interface SavedObjectsType {
|
|||
* See {@link SavedObjectsServiceStart.createInternalRepository | createInternalRepository}.
|
||||
*/
|
||||
hidden: boolean;
|
||||
/**
|
||||
* Is the type global (true), or not (false).
|
||||
* @deprecated Use `namespaceType` instead.
|
||||
*/
|
||||
namespaceAgnostic?: boolean;
|
||||
/**
|
||||
* The {@link SavedObjectsNamespaceType | namespace type} for the type.
|
||||
*/
|
||||
namespaceType?: SavedObjectsNamespaceType;
|
||||
namespaceType: SavedObjectsNamespaceType;
|
||||
/**
|
||||
* If defined, the type instances will be stored in the given index instead of the default one.
|
||||
*/
|
||||
|
|
|
@ -421,14 +421,6 @@ describe('convertTypesToLegacySchema', () => {
|
|||
namespaceType: 'multiple',
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
// deprecated test case
|
||||
{
|
||||
name: 'typeD',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'multiple', // if namespaceAgnostic and namespaceType are both set, namespaceAgnostic takes precedence
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
];
|
||||
expect(convertTypesToLegacySchema(types)).toEqual({
|
||||
typeA: {
|
||||
|
@ -448,12 +440,6 @@ describe('convertTypesToLegacySchema', () => {
|
|||
isNamespaceAgnostic: false,
|
||||
multiNamespace: true,
|
||||
},
|
||||
// deprecated test case
|
||||
typeD: {
|
||||
hidden: false,
|
||||
isNamespaceAgnostic: true,
|
||||
multiNamespace: false,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -82,8 +82,8 @@ export const convertTypesToLegacySchema = (
|
|||
return {
|
||||
...schema,
|
||||
[type.name]: {
|
||||
isNamespaceAgnostic: type.namespaceAgnostic || type.namespaceType === 'agnostic',
|
||||
multiNamespace: !type.namespaceAgnostic && type.namespaceType === 'multiple',
|
||||
isNamespaceAgnostic: type.namespaceType === 'agnostic',
|
||||
multiNamespace: type.namespaceType === 'multiple',
|
||||
hidden: type.hidden,
|
||||
indexPattern: type.indexPattern,
|
||||
convertToAliasScript: type.convertToAliasScript,
|
||||
|
|
|
@ -2263,9 +2263,7 @@ export interface SavedObjectsType {
|
|||
mappings: SavedObjectsTypeMappingDefinition;
|
||||
migrations?: SavedObjectMigrationMap;
|
||||
name: string;
|
||||
// @deprecated
|
||||
namespaceAgnostic?: boolean;
|
||||
namespaceType?: SavedObjectsNamespaceType;
|
||||
namespaceType: SavedObjectsNamespaceType;
|
||||
}
|
||||
|
||||
// @public
|
||||
|
|
|
@ -22,7 +22,7 @@ import { SavedObjectsType } from '../../saved_objects';
|
|||
export const uiSettingsType: SavedObjectsType = {
|
||||
name: 'config',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
// we don't want to allow `true` in the public `SavedObjectsTypeMappingDefinition` type, however
|
||||
// this is needed for the config that is kinda a special type. To avoid adding additional internal types
|
||||
|
|
|
@ -23,7 +23,7 @@ import { indexPatternSavedObjectTypeMigrations } from './index_pattern_migration
|
|||
export const indexPatternSavedObjectType: SavedObjectsType = {
|
||||
name: 'index-pattern',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
management: {
|
||||
icon: 'indexPatternApp',
|
||||
defaultSearchField: 'title',
|
||||
|
|
|
@ -22,7 +22,7 @@ import { SavedObjectsType } from 'kibana/server';
|
|||
export const querySavedObjectType: SavedObjectsType = {
|
||||
name: 'query',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
management: {
|
||||
icon: 'search',
|
||||
defaultSearchField: 'title',
|
||||
|
|
|
@ -23,7 +23,7 @@ import { searchSavedObjectTypeMigrations } from './search_migrations';
|
|||
export const searchSavedObjectType: SavedObjectsType = {
|
||||
name: 'search',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
management: {
|
||||
icon: 'discoverApp',
|
||||
defaultSearchField: 'title',
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('SavedObjectsManagement', () => {
|
|||
registry.registerType({
|
||||
name: 'unknown',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: { properties: {} },
|
||||
migrations: {},
|
||||
...type,
|
||||
|
|
|
@ -33,7 +33,7 @@ export function registerMappings(registerType: SavedObjectsServiceSetup['registe
|
|||
registerType({
|
||||
name: 'application_usage_totals',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
appId: { type: 'keyword' },
|
||||
|
@ -46,7 +46,7 @@ export function registerMappings(registerType: SavedObjectsServiceSetup['registe
|
|||
registerType({
|
||||
name: 'application_usage_transactional',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
timestamp: { type: 'date' },
|
||||
|
|
|
@ -38,7 +38,7 @@ export function registerUiMetricUsageCollector(
|
|||
registerType({
|
||||
name: 'ui-metric',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
count: {
|
||||
|
|
|
@ -125,7 +125,7 @@ export class TelemetryPlugin implements Plugin {
|
|||
registerType({
|
||||
name: 'telemetry',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
enabled: {
|
||||
|
|
|
@ -31,7 +31,7 @@ const resetCount: SavedObjectMigrationFn = doc => ({
|
|||
export const tsvbTelemetrySavedObjectType: SavedObjectsType = {
|
||||
name: 'tsvb-validation-telemetry',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
failedRequests: {
|
||||
|
|
|
@ -23,7 +23,7 @@ import { visualizationSavedObjectTypeMigrations } from './visualization_migratio
|
|||
export const visualizationSavedObjectType: SavedObjectsType = {
|
||||
name: 'visualization',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
management: {
|
||||
icon: 'visualizeApp',
|
||||
defaultSearchField: 'title',
|
||||
|
|
|
@ -383,7 +383,7 @@ function migrationsToTypes(migrations) {
|
|||
return Object.entries(migrations).map(([type, migrations]) => ({
|
||||
name: type,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: { properties: {} },
|
||||
migrations: { ...migrations },
|
||||
}));
|
||||
|
|
|
@ -11,7 +11,7 @@ export const CASE_SAVED_OBJECT = 'cases';
|
|||
export const caseSavedObjectType: SavedObjectsType = {
|
||||
name: CASE_SAVED_OBJECT,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
closed_at: {
|
||||
|
|
|
@ -11,7 +11,7 @@ export const CASE_COMMENT_SAVED_OBJECT = 'cases-comments';
|
|||
export const caseCommentSavedObjectType: SavedObjectsType = {
|
||||
name: CASE_COMMENT_SAVED_OBJECT,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
comment: {
|
||||
|
|
|
@ -11,7 +11,7 @@ export const CASE_CONFIGURE_SAVED_OBJECT = 'cases-configure';
|
|||
export const caseConfigureSavedObjectType: SavedObjectsType = {
|
||||
name: CASE_CONFIGURE_SAVED_OBJECT,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
created_at: {
|
||||
|
|
|
@ -11,7 +11,7 @@ export const CASE_USER_ACTION_SAVED_OBJECT = 'cases-user-actions';
|
|||
export const caseUserActionSavedObjectType: SavedObjectsType = {
|
||||
name: CASE_USER_ACTION_SAVED_OBJECT,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
action_field: {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { TELEMETRY_DOC_ID } from './telemetry';
|
|||
export const fileUploadTelemetryMappingsType: SavedObjectsType = {
|
||||
name: TELEMETRY_DOC_ID,
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
filesUploadedTotalCount: {
|
||||
|
|
|
@ -12,7 +12,7 @@ export function setupSavedObjects(core: CoreSetup) {
|
|||
core.savedObjects.registerType({
|
||||
name: 'lens',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
management: {
|
||||
icon: 'lensApp',
|
||||
defaultSearchField: 'title',
|
||||
|
@ -46,7 +46,7 @@ export function setupSavedObjects(core: CoreSetup) {
|
|||
core.savedObjects.registerType({
|
||||
name: 'lens-ui-telemetry',
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
name: {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { TELEMETRY_DOC_ID } from './telemetry';
|
|||
export const mlTelemetryMappingsType: SavedObjectsType = {
|
||||
name: TELEMETRY_DOC_ID,
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {
|
||||
file_data_visualizer: {
|
||||
|
|
|
@ -57,26 +57,26 @@ describe('copySavedObjectsToSpaces', () => {
|
|||
typeRegistry.getAllTypes.mockReturnValue([
|
||||
{
|
||||
name: 'dashboard',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'visualization',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'globaltype',
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
]);
|
||||
|
||||
typeRegistry.isNamespaceAgnostic.mockImplementation((type: string) =>
|
||||
typeRegistry.getAllTypes().some(t => t.name === type && t.namespaceAgnostic)
|
||||
typeRegistry.getAllTypes().some(t => t.name === type && t.namespaceType === 'agnostic')
|
||||
);
|
||||
|
||||
coreStart.savedObjects.getTypeRegistry.mockReturnValue(typeRegistry);
|
||||
|
|
|
@ -57,26 +57,26 @@ describe('resolveCopySavedObjectsToSpacesConflicts', () => {
|
|||
typeRegistry.getAllTypes.mockReturnValue([
|
||||
{
|
||||
name: 'dashboard',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'visualization',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'globaltype',
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
]);
|
||||
|
||||
typeRegistry.isNamespaceAgnostic.mockImplementation((type: string) =>
|
||||
typeRegistry.getAllTypes().some(t => t.name === type && t.namespaceAgnostic)
|
||||
typeRegistry.getAllTypes().some(t => t.name === type && t.namespaceType === 'agnostic')
|
||||
);
|
||||
|
||||
coreStart.savedObjects.getTypeRegistry.mockReturnValue(typeRegistry);
|
||||
|
|
|
@ -81,7 +81,7 @@ describe('Spaces Plugin', () => {
|
|||
|
||||
expect(core.savedObjects.registerType).toHaveBeenCalledWith({
|
||||
name: 'space',
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
hidden: true,
|
||||
mappings: expect.any(Object),
|
||||
migrations: expect.any(Object),
|
||||
|
|
|
@ -46,37 +46,37 @@ export const createMockSavedObjectsService = (spaces: any[] = []) => {
|
|||
typeRegistry.getAllTypes.mockReturnValue([
|
||||
{
|
||||
name: 'visualization',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'dashboard',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'index-pattern',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'globalType',
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
{
|
||||
name: 'space',
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
hidden: true,
|
||||
mappings: { properties: {} },
|
||||
},
|
||||
]);
|
||||
typeRegistry.isNamespaceAgnostic.mockImplementation((type: string) =>
|
||||
typeRegistry.getAllTypes().some(t => t.name === type && t.namespaceAgnostic)
|
||||
typeRegistry.getAllTypes().some(t => t.name === type && t.namespaceType === 'agnostic')
|
||||
);
|
||||
savedObjects.getTypeRegistry.mockReturnValue(typeRegistry);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ describe('SpacesSavedObjectsService', () => {
|
|||
"6.6.0": [Function],
|
||||
},
|
||||
"name": "space",
|
||||
"namespaceAgnostic": true,
|
||||
"namespaceType": "agnostic",
|
||||
},
|
||||
]
|
||||
`);
|
||||
|
|
|
@ -20,7 +20,7 @@ export class SpacesSavedObjectsService {
|
|||
core.savedObjects.registerType({
|
||||
name: 'space',
|
||||
hidden: true,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: SpacesSavedObjectMappings,
|
||||
migrations: {
|
||||
'6.6.0': migrateToKibana660,
|
||||
|
|
|
@ -13,21 +13,21 @@ import { SavedObjectTypeRegistry } from 'src/core/server';
|
|||
const typeRegistry = new SavedObjectTypeRegistry();
|
||||
typeRegistry.registerType({
|
||||
name: 'foo',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
});
|
||||
|
||||
typeRegistry.registerType({
|
||||
name: 'bar',
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
});
|
||||
|
||||
typeRegistry.registerType({
|
||||
name: 'space',
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
hidden: true,
|
||||
mappings: { properties: {} },
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export const settingsObjectId = 'uptime-dynamic-settings-singleton';
|
|||
export const umDynamicSettings: SavedObjectsType = {
|
||||
name: settingsObjectType,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: {
|
||||
properties: {
|
||||
heartbeatIndices: {
|
||||
|
|
|
@ -29,7 +29,7 @@ export const plugin: PluginInitializer<void, void, PluginsSetup, PluginsStart> =
|
|||
core.savedObjects.registerType({
|
||||
name: SAVED_OBJECT_WITH_SECRET_TYPE,
|
||||
hidden: false,
|
||||
namespaceAgnostic: false,
|
||||
namespaceType: 'single',
|
||||
mappings: deepFreeze({
|
||||
properties: {
|
||||
publicProperty: { type: 'keyword' },
|
||||
|
|
|
@ -50,7 +50,7 @@ export class EventLogFixturePlugin
|
|||
core.savedObjects.registerType({
|
||||
name: 'event_log_test',
|
||||
hidden: false,
|
||||
namespaceAgnostic: true,
|
||||
namespaceType: 'agnostic',
|
||||
mappings: {
|
||||
properties: {},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue