parent
1d1296a483
commit
5062de8e65
25
src/server/saved_objects/index.d.ts
vendored
Normal file
25
src/server/saved_objects/index.d.ts
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export {
|
||||
SavedObject,
|
||||
SavedObjectsClient,
|
||||
SavedObjectsClientWrapperFactory,
|
||||
SavedObjectsService,
|
||||
} from './service';
|
29
src/server/saved_objects/service/create_saved_objects_service.d.ts
vendored
Normal file
29
src/server/saved_objects/service/create_saved_objects_service.d.ts
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { ScopedSavedObjectsClientProvider } from './lib';
|
||||
|
||||
export interface SavedObjectsService<Request = any> {
|
||||
// ATTENTION: these types are incomplete
|
||||
|
||||
addScopedSavedObjectsClientWrapperFactory: ScopedSavedObjectsClientProvider<
|
||||
Request
|
||||
>['addClientWrapperFactory'];
|
||||
types: string[];
|
||||
}
|
22
src/server/saved_objects/service/index.d.ts
vendored
Normal file
22
src/server/saved_objects/service/index.d.ts
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { SavedObjectsService } from './create_saved_objects_service';
|
||||
export { SavedObjectsClientWrapperFactory } from './lib';
|
||||
export { SavedObject, SavedObjectsClient } from './saved_objects_client';
|
24
src/server/saved_objects/service/lib/index.d.ts
vendored
Normal file
24
src/server/saved_objects/service/lib/index.d.ts
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export {
|
||||
SavedObjectsClientWrapperFactory,
|
||||
SavedObjectsClientWrapperOptions,
|
||||
ScopedSavedObjectsClientProvider,
|
||||
} from './scoped_client_provider';
|
38
src/server/saved_objects/service/lib/scoped_client_provider.d.ts
vendored
Normal file
38
src/server/saved_objects/service/lib/scoped_client_provider.d.ts
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { SavedObjectsClient } from '..';
|
||||
|
||||
export interface SavedObjectsClientWrapperOptions<Request = any> {
|
||||
client: SavedObjectsClient;
|
||||
request: Request;
|
||||
}
|
||||
|
||||
export type SavedObjectsClientWrapperFactory<Request = any> = (
|
||||
options: SavedObjectsClientWrapperOptions<Request>
|
||||
) => SavedObjectsClient;
|
||||
|
||||
export interface ScopedSavedObjectsClientProvider<Request = any> {
|
||||
// ATTENTION: these types are incomplete
|
||||
|
||||
addClientWrapperFactory(
|
||||
priority: number,
|
||||
wrapperFactory: SavedObjectsClientWrapperFactory<Request>
|
||||
): void;
|
||||
}
|
|
@ -1,7 +1,20 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export interface BaseOptions {
|
||||
|
@ -88,10 +101,3 @@ export interface SavedObjectsClient {
|
|||
options?: UpdateOptions
|
||||
) => Promise<SavedObject>;
|
||||
}
|
||||
|
||||
export interface SOCWrapperOptions {
|
||||
client: SavedObjectsClient;
|
||||
request: any;
|
||||
}
|
||||
|
||||
export type SOCWrapperFactory = (options: SOCWrapperOptions) => SavedObjectsClient;
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { SavedObjectsService } from 'src/server/saved_objects';
|
||||
// @ts-ignore
|
||||
import { AuditLogger } from '../../server/lib/audit_logger';
|
||||
// @ts-ignore
|
||||
|
@ -132,7 +134,10 @@ export const spaces = (kibana: any) =>
|
|||
},
|
||||
});
|
||||
|
||||
const { addScopedSavedObjectsClientWrapperFactory, types } = server.savedObjects;
|
||||
const {
|
||||
addScopedSavedObjectsClientWrapperFactory,
|
||||
types,
|
||||
} = server.savedObjects as SavedObjectsService;
|
||||
addScopedSavedObjectsClientWrapperFactory(
|
||||
Number.MAX_VALUE,
|
||||
spacesSavedObjectsClientWrapperFactory(spacesService, types)
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { SavedObjectsClientWrapperFactory } from 'src/server/saved_objects';
|
||||
import { SpacesService } from '../create_spaces_service';
|
||||
import { SOCWrapperOptions } from './saved_objects_client_types';
|
||||
import { SpacesSavedObjectsClient } from './spaces_saved_objects_client';
|
||||
|
||||
export function spacesSavedObjectsClientWrapperFactory(
|
||||
spacesService: SpacesService,
|
||||
types: string[]
|
||||
) {
|
||||
return ({ client, request }: SOCWrapperOptions) =>
|
||||
): SavedObjectsClientWrapperFactory {
|
||||
return ({ client, request }) =>
|
||||
new SpacesSavedObjectsClient({
|
||||
baseClient: client,
|
||||
request,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { DEFAULT_SPACE_ID } from '../../../common/constants';
|
||||
import { SpacesService } from '../create_spaces_service';
|
||||
import {
|
||||
BaseOptions,
|
||||
BulkCreateObject,
|
||||
|
@ -15,7 +13,9 @@ import {
|
|||
SavedObjectAttributes,
|
||||
SavedObjectsClient,
|
||||
UpdateOptions,
|
||||
} from './saved_objects_client_types';
|
||||
} from 'src/server/saved_objects/service/saved_objects_client';
|
||||
import { DEFAULT_SPACE_ID } from '../../../common/constants';
|
||||
import { SpacesService } from '../create_spaces_service';
|
||||
|
||||
interface SpacesSavedObjectsClientOptions {
|
||||
baseClient: SavedObjectsClient;
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
// @ts-ignore
|
||||
|
||||
import { Server } from 'hapi';
|
||||
import sinon from 'sinon';
|
||||
import { SavedObject } from './saved_objects_client/saved_objects_client_types';
|
||||
|
||||
import { SavedObject } from 'src/server/saved_objects';
|
||||
import { initSpacesRequestInterceptors } from './space_request_interceptors';
|
||||
|
||||
describe('interceptors', () => {
|
||||
|
|
Loading…
Reference in a new issue