forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[embeddable] remove embeddable factory methods from setup and start A…
…PI (elastic#204797) Part of embeddable rebuild cleanup. PR removes legacy embeddable factory registration APIs. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
b809806
commit 3b61e7b
Showing
38 changed files
with
172 additions
and
1,082 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/plugins/embeddable/public/__snapshots__/plugin.test.ts.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { identity } from 'lodash'; | ||
import { SerializableRecord } from '@kbn/utility-types'; | ||
import { EnhancementRegistryDefinition, EnhancementRegistryItem } from './types'; | ||
|
||
export class EnhancementsRegistry { | ||
private registry: Map<string, EnhancementRegistryItem> = new Map(); | ||
|
||
public registerEnhancement = (enhancement: EnhancementRegistryDefinition) => { | ||
if (this.registry.has(enhancement.id)) { | ||
throw new Error(`enhancement with id ${enhancement.id} already exists in the registry`); | ||
} | ||
this.registry.set(enhancement.id, { | ||
id: enhancement.id, | ||
telemetry: enhancement.telemetry || ((state, stats) => stats), | ||
inject: enhancement.inject || identity, | ||
extract: | ||
enhancement.extract || | ||
((state: SerializableRecord) => { | ||
return { state, references: [] }; | ||
}), | ||
migrations: enhancement.migrations || {}, | ||
}); | ||
}; | ||
|
||
public getEnhancements = (): EnhancementRegistryItem[] => { | ||
return Array.from(this.registry.values()); | ||
}; | ||
|
||
public getEnhancement = (id: string): EnhancementRegistryItem => { | ||
return ( | ||
this.registry.get(id) || { | ||
id: 'unknown', | ||
telemetry: (state, stats) => stats, | ||
inject: identity, | ||
extract: (state: SerializableRecord) => { | ||
return { state, references: [] }; | ||
}, | ||
migrations: {}, | ||
} | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import type { SerializableRecord } from '@kbn/utility-types'; | ||
import { PersistableState, PersistableStateDefinition } from '@kbn/kibana-utils-plugin/common'; | ||
|
||
export interface EnhancementRegistryDefinition<P extends SerializableRecord = SerializableRecord> | ||
extends PersistableStateDefinition<P> { | ||
id: string; | ||
} | ||
|
||
export interface EnhancementRegistryItem<P extends SerializableRecord = SerializableRecord> | ||
extends PersistableState<P> { | ||
id: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
src/plugins/embeddable/public/lib/embeddables/default_embeddable_factory_provider.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.