Skip to content

Commit

Permalink
Introduce src/common for code/types shared between public/server
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Jul 4, 2019
1 parent 9e78c2c commit 5f7b8e9
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 25 deletions.
27 changes: 27 additions & 0 deletions src/core/common/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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,
SavedObjectAttributes,
SavedObjectReference,
SavedObjectsClientContract as SavedObjectsServerClientContract,
SavedObjectsFindOptions,
SavedObjectsMigrationVersion,
} from '../server/saved_objects';
12 changes: 6 additions & 6 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { IconType } from '@elastic/eui';
import { Observable } from 'rxjs';
import React from 'react';
import * as Rx from 'rxjs';
import { SavedObject } from 'src/core/server';
import { SavedObjectAttributes } from 'src/core/server';
import { SavedObjectReference } from 'src/core/server';
import { SavedObjectsClientContract as SavedObjectsApi } from 'src/core/server';
import { SavedObjectsFindOptions } from 'src/core/server';
import { SavedObjectsMigrationVersion } from 'src/core/server';
import { SavedObject } from 'src/core/common';
import { SavedObjectAttributes } from 'src/core/common';
import { SavedObjectReference } from 'src/core/common';
import { SavedObjectsServerClientContract as SavedObjectsApi } from 'src/core/common';
import { SavedObjectsFindOptions } from 'src/core/common';
import { SavedObjectsMigrationVersion } from 'src/core/common';
import { EuiGlobalToastListToast as Toast } from '@elastic/eui';

// @public (undocumented)
Expand Down
8 changes: 4 additions & 4 deletions src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {
SavedObject,
SavedObjectAttributes,
SavedObjectReference,
SavedObjectsClientContract as SavedObjectsApi,
SavedObjectsServerClientContract as SavedObjectsApi,
SavedObjectsFindOptions,
SavedObjectsMigrationVersion,
} from 'src/core/server';
} from 'src/core/common';
// TODO: Migrate to an error modal powered by the NP?
import {
isAutoCreateIndexError,
Expand All @@ -40,10 +40,10 @@ export {
SavedObject,
SavedObjectAttributes,
SavedObjectReference,
SavedObjectsClientContract as SavedObjectsApi,
SavedObjectsServerClientContract as SavedObjectsApi,
SavedObjectsFindOptions,
SavedObjectsMigrationVersion,
} from 'src/core/server';
} from 'src/core/common';

interface RequestParams {
method: 'POST' | 'GET' | 'PUT' | 'DELETE';
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/saved_objects/simple_saved_object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { get, has, set } from 'lodash';
import { SavedObject as SavedObjectType, SavedObjectAttributes } from 'src/core/server';
import { SavedObject as SavedObjectType, SavedObjectAttributes } from 'src/core/common';
import { SavedObjectsClient } from './saved_objects_client';

/**
Expand Down
8 changes: 0 additions & 8 deletions src/core/server/saved_objects/service/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ export interface SavedObjectsBulkGetObject {
fields?: string[];
}

/**
*
* @public
*/
export interface SavedObjectsBulkResponse<T extends SavedObjectAttributes = any> {
saved_objects: Array<SavedObject<T>>;
}

/**
*
* @public
Expand Down
6 changes: 0 additions & 6 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,6 @@ export interface SavedObjectsBulkResponse<T extends SavedObjectAttributes = any>
saved_objects: Array<SavedObject<T>>;
}

// @public (undocumented)
export interface SavedObjectsBulkResponse<T extends SavedObjectAttributes = any> {
// (undocumented)
saved_objects: Array<SavedObject<T>>;
}

// @internal (undocumented)
export class SavedObjectsClient {
// Warning: (ae-forgotten-export) The symbol "SavedObjectsRepository" needs to be exported by the entry point index.d.ts
Expand Down
1 change: 1 addition & 0 deletions src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default {
moduleNameMapper: {
'^plugins/([^\/.]*)(.*)': '<rootDir>/src/legacy/core_plugins/$1/public$2',
'^ui/(.*)': '<rootDir>/src/legacy/ui/public/$1',
'^src/core/(.*)': '<rootDir>/src/core/$1',
'^uiExports/(.*)': '<rootDir>/src/dev/jest/mocks/file_mock.js',
'^test_utils/(.*)': '<rootDir>/src/test_utils/public/$1',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/dev/jest/mocks/file_mock.js',
Expand Down

0 comments on commit 5f7b8e9

Please sign in to comment.