mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[7.x] Add "legacy" Encrypted Saved Objects plugin typings. (#36128)
This commit is contained in:
parent
69f562ce14
commit
be8579ca3b
3 changed files with 17 additions and 2 deletions
|
@ -12,6 +12,11 @@ import { AuditLogger } from '../../server/lib/audit_logger';
|
|||
|
||||
import { CONFIG_PREFIX, PLUGIN_ID, Plugin } from './server/plugin';
|
||||
|
||||
/**
|
||||
* Public interface of the security plugin for the legacy plugin system.
|
||||
*/
|
||||
export type EncryptedSavedObjectsPlugin = ReturnType<Plugin['setup']>;
|
||||
|
||||
export const encryptedSavedObjects = (kibana: any) =>
|
||||
new kibana.Plugin({
|
||||
id: PLUGIN_ID,
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
import crypto from 'crypto';
|
||||
import { Legacy, Server } from 'kibana';
|
||||
import { SavedObjectsRepository } from 'src/legacy/server/saved_objects/service/lib';
|
||||
import { BaseOptions } from 'src/legacy/server/saved_objects/service/saved_objects_client';
|
||||
import {
|
||||
BaseOptions,
|
||||
SavedObject,
|
||||
SavedObjectAttributes,
|
||||
} from 'src/legacy/server/saved_objects/service/saved_objects_client';
|
||||
import {
|
||||
EncryptedSavedObjectsService,
|
||||
EncryptedSavedObjectTypeRegistration,
|
||||
|
@ -71,7 +75,11 @@ export class Plugin {
|
|||
isEncryptionError: (error: Error) => error instanceof EncryptionError,
|
||||
registerType: (typeRegistration: EncryptedSavedObjectTypeRegistration) =>
|
||||
service.registerType(typeRegistration),
|
||||
getDecryptedAsInternalUser: async (type: string, id: string, options?: BaseOptions) => {
|
||||
getDecryptedAsInternalUser: async <T extends SavedObjectAttributes = any>(
|
||||
type: string,
|
||||
id: string,
|
||||
options?: BaseOptions
|
||||
): Promise<SavedObject<T>> => {
|
||||
const savedObject = await internalRepository.get(type, id, options);
|
||||
return {
|
||||
...savedObject,
|
||||
|
|
2
x-pack/typings/hapi.d.ts
vendored
2
x-pack/typings/hapi.d.ts
vendored
|
@ -7,6 +7,7 @@
|
|||
import 'hapi';
|
||||
|
||||
import { CloudPlugin } from '../plugins/cloud';
|
||||
import { EncryptedSavedObjectsPlugin } from '../plugins/encrypted_saved_objects';
|
||||
import { SecurityPlugin } from '../plugins/security';
|
||||
import { XPackMainPlugin } from '../plugins/xpack_main/xpack_main';
|
||||
|
||||
|
@ -15,5 +16,6 @@ declare module 'hapi' {
|
|||
cloud?: CloudPlugin;
|
||||
xpack_main: XPackMainPlugin;
|
||||
security?: SecurityPlugin;
|
||||
encrypted_saved_objects?: EncryptedSavedObjectsPlugin;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue