forked from opensearch-project/OpenSearch-Dashboards
-
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.
Add api registry and allow it to be added into client config in data …
…source plugin (opensearch-project#5895) (opensearch-project#5906) * add api registry and allow it to be added into client config * add changelog * add documentation for multi data source plugin api registry * change to resolve promise before calling getQueryClient --------- Signed-off-by: Lu Yu <[email protected]>
- Loading branch information
Showing
13 changed files
with
129 additions
and
9 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
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
20 changes: 20 additions & 0 deletions
20
src/plugins/data_source/server/schema_registry/custom_api_schema_registry.test.ts
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,20 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { CustomApiSchemaRegistry } from './custom_api_schema_registry'; | ||
|
||
describe('CustomApiSchemaRegistry', () => { | ||
let registry: CustomApiSchemaRegistry; | ||
|
||
beforeEach(() => { | ||
registry = new CustomApiSchemaRegistry(); | ||
}); | ||
|
||
it('allows to register and get api schema', () => { | ||
const sqlPlugin = () => {}; | ||
registry.register(sqlPlugin); | ||
expect(registry.getAll()).toEqual([sqlPlugin]); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
src/plugins/data_source/server/schema_registry/custom_api_schema_registry.ts
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,19 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
export class CustomApiSchemaRegistry { | ||
private readonly schemaRegistry: any[]; | ||
|
||
constructor() { | ||
this.schemaRegistry = new Array(); | ||
} | ||
|
||
public register(schema: any) { | ||
this.schemaRegistry.push(schema); | ||
} | ||
|
||
public getAll(): any[] { | ||
return this.schemaRegistry; | ||
} | ||
} |
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { CustomApiSchemaRegistry } from './custom_api_schema_registry'; |
Oops, something went wrong.