Skip to content

Commit 738b19a

Browse files
committed
rename interfaces
1 parent 14843d5 commit 738b19a

File tree

19 files changed

+44
-44
lines changed

19 files changed

+44
-44
lines changed

apps/server/src/controllers/indexerController.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BadRequest } from '@overture-stack/maestro-common';
2-
import { MaestroProvider } from '@overture-stack/maestro-provider';
2+
import { initializeMaestroProvider } from '@overture-stack/maestro-provider';
33

44
import { defaultAppConfig } from '../config/provider.js';
55
import {
@@ -9,7 +9,7 @@ import {
99
} from '../utils/requestSchemas.js';
1010
import { validateRequest } from '../utils/requestValidation.js';
1111

12-
const maestroProvider = MaestroProvider(defaultAppConfig);
12+
const maestroProvider = initializeMaestroProvider(defaultAppConfig);
1313

1414
const indexRepository = validateRequest(indexRepositoryRequestschema, async (req, res, next) => {
1515
try {

packages/common/src/types/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export {
88
} from './config.js';
99
export { DataRecordValue, FailureData, IndexData, IndexResult } from './dataRecord.js';
1010
export { ConsoleLike, LoggerConfig } from './logger.js';
11-
export { IRepository, RepositoryIndexingOperations } from './repository.js';
12-
export { IElasticsearchService } from './service.js';
11+
export { Repository, RepositoryIndexingOperations } from './repository.js';
12+
export { ElasticsearchService } from './service.js';

packages/common/src/types/repository.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { DataRecordValue, IndexResult } from './dataRecord';
33
/**
44
* Interface for all types of repositories (i.e. song or lyric)
55
*/
6-
export interface IRepository {
6+
export interface Repository {
77
getRepositoryRecords(): AsyncGenerator<Record<string, DataRecordValue>[], void, unknown>;
88
getOrganizationRecords({
99
organization,

packages/common/src/types/service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { DataRecordValue, IndexResult } from './dataRecord.js';
33
/**
44
* Interface defining the contract for Elasticsearch service operations.
55
*/
6-
export interface IElasticsearchService {
6+
export interface ElasticsearchService {
77
/**
88
* Creates an index in Elasticsearch.
99
*

packages/indexer-client/src/client/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { type DataRecordValue, ElasticSearchConfig, IElasticsearchService } from '@overture-stack/maestro-common';
1+
import { type DataRecordValue, ElasticSearchConfig, ElasticsearchService } from '@overture-stack/maestro-common';
22

33
import { es7 } from './v7/client.js';
44
import { es8 } from './v8/client.js';
55

66
export type ESVersion = '7' | '8';
77

88
/**
9-
* Provides an instance of `IElasticsearchService` based on the specified Elasticsearch version in the configuration
9+
* Provides an instance of `ElasticsearchService` based on the specified Elasticsearch version in the configuration
1010
*
1111
* @param elasticSearchConfig The configuration object for Elasticsearch, including the version and custom settings
12-
* @returns An implementation of `IElasticsearchService` that matches the specified version
12+
* @returns An implementation of `ElasticsearchService` that matches the specified version
1313
* @throws Will throw an error if the provided Elasticsearch version is not supported
1414
*/
15-
export const clientProvider = (elasticSearchConfig: ElasticSearchConfig): IElasticsearchService => {
16-
let service: IElasticsearchService;
15+
export const clientProvider = (elasticSearchConfig: ElasticSearchConfig): ElasticsearchService => {
16+
let service: ElasticsearchService;
1717

1818
if (elasticSearchConfig.version === 7) {
1919
service = es7(elasticSearchConfig);

packages/indexer-client/src/client/v7/client.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Client } from 'es7';
33
import type {
44
DataRecordValue,
55
ElasticSearchConfig,
6-
IElasticsearchService,
6+
ElasticsearchService,
77
IndexResult,
88
} from '@overture-stack/maestro-common';
99

@@ -14,14 +14,14 @@ import { bulkUpsert, createIndexIfNotExists, deleteData, indexData, ping, update
1414
* Creates an instance of the Elasticsearch service for version 7.
1515
*
1616
* This function initializes an Elasticsearch client using the provided configuration
17-
* and returns an object that implements the `IElasticsearchService` interface.
17+
* and returns an object that implements the `ElasticsearchService` interface.
1818
* The returned object includes methods for creating an index, indexing data,
1919
* checking the connection, updating data, and deleting data.
2020
*
2121
* @param {ElasticSearchConfig} config The configuration of the Elasticsearch to connect to
22-
* @returns {IElasticsearchService} An object implementing the `IElasticsearchService` interface, providing methods to interact with Elasticsearch
22+
* @returns {ElasticsearchService} An object implementing the `ElasticsearchService` interface, providing methods to interact with Elasticsearch
2323
*/
24-
export const es7 = (config: ElasticSearchConfig): IElasticsearchService => {
24+
export const es7 = (config: ElasticSearchConfig): ElasticsearchService => {
2525
if (config.version !== 7) {
2626
throw Error('Invalid Client Configuration');
2727
}

packages/indexer-client/src/client/v8/client.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Client } from 'es8';
33
import type {
44
DataRecordValue,
55
ElasticSearchConfig,
6-
IElasticsearchService,
6+
ElasticsearchService,
77
IndexResult,
88
} from '@overture-stack/maestro-common';
99

@@ -14,14 +14,14 @@ import { bulkUpsert, createIndexIfNotExists, deleteData, indexData, ping, update
1414
* Creates an instance of the Elasticsearch service for version 8.
1515
*
1616
* This function initializes an Elasticsearch client using the provided configuration
17-
* and returns an object that implements the `IElasticsearchService` interface.
17+
* and returns an object that implements the `ElasticsearchService` interface.
1818
* The returned object includes methods for creating an index, indexing data,
1919
* checking the connection, updating data, and deleting data.
2020
*
2121
* @param {ElasticSearchConfig} config The configuration of the Elasticsearch to connect to
22-
* @returns {IElasticsearchService} An object implementing the `IElasticsearchService` interface, providing methods to interact with Elasticsearch
22+
* @returns {ElasticsearchService} An object implementing the `ElasticsearchService` interface, providing methods to interact with Elasticsearch
2323
*/
24-
export const es8 = (config: ElasticSearchConfig): IElasticsearchService => {
24+
export const es8 = (config: ElasticSearchConfig): ElasticsearchService => {
2525
if (config.version !== 8) {
2626
throw Error('Invalid Client Configuration');
2727
}

packages/indexer-client/test/integration/bulkUpsertIndexedData.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ElasticsearchContainer, StartedElasticsearchContainer } from '@testcontainers/elasticsearch';
22
import { expect } from 'chai';
33

4-
import type { DataRecordValue, IElasticsearchService } from '@overture-stack/maestro-common';
4+
import type { DataRecordValue, ElasticsearchService } from '@overture-stack/maestro-common';
55

66
import { es7 } from '../../src/client/v7/client.js';
77
import { es8 } from '../../src/client/v8/client.js';
88

99
export default function suite() {
1010
let container: StartedElasticsearchContainer;
11-
let client: IElasticsearchService;
11+
let client: ElasticsearchService;
1212

1313
before(async () => {
1414
// Start an Elasticsearch container

packages/indexer-client/test/integration/createdIndex.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ElasticsearchContainer, StartedElasticsearchContainer } from '@testcontainers/elasticsearch';
22
import { expect } from 'chai';
33

4-
import type { IElasticsearchService } from '@overture-stack/maestro-common';
4+
import type { ElasticsearchService } from '@overture-stack/maestro-common';
55

66
import { es7 } from '../../src/client/v7/client.js';
77
import { es8 } from '../../src/client/v8/client.js';
88

99
export default function suite() {
1010
let container: StartedElasticsearchContainer;
11-
let client: IElasticsearchService;
11+
let client: ElasticsearchService;
1212

1313
before(async () => {
1414
// Start an Elasticsearch container

packages/indexer-client/test/integration/indexData.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ElasticsearchContainer, StartedElasticsearchContainer } from '@testcontainers/elasticsearch';
22
import { expect } from 'chai';
33

4-
import { type DataRecordValue, IElasticsearchService } from '@overture-stack/maestro-common';
4+
import { type DataRecordValue, ElasticsearchService } from '@overture-stack/maestro-common';
55

66
import { es7 } from '../../src/client/v7/client.js';
77
import { es8 } from '../../src/client/v8/client.js';
88

99
export default function suite() {
1010
let container: StartedElasticsearchContainer;
11-
let client: IElasticsearchService;
11+
let client: ElasticsearchService;
1212

1313
before(async () => {
1414
// Start an Elasticsearch container

packages/indexer-client/test/integration/ping.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ElasticsearchContainer, StartedElasticsearchContainer } from '@testcontainers/elasticsearch';
22
import { expect } from 'chai';
33

4-
import type { IElasticsearchService } from '@overture-stack/maestro-common';
4+
import type { ElasticsearchService } from '@overture-stack/maestro-common';
55

66
import { es7 } from '../../src/client/v7/client.js';
77
import { es8 } from '../../src/client/v8/client.js';
88

99
export default function suite() {
1010
let container: StartedElasticsearchContainer;
11-
let client: IElasticsearchService;
11+
let client: ElasticsearchService;
1212

1313
before(async () => {
1414
// Start an Elasticsearch container

packages/indexer-client/test/integration/updateIndexedData.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ElasticsearchContainer, StartedElasticsearchContainer } from '@testcontainers/elasticsearch';
22
import { expect } from 'chai';
33

4-
import type { DataRecordValue, IElasticsearchService, IndexData } from '@overture-stack/maestro-common';
4+
import type { DataRecordValue, ElasticsearchService, IndexData } from '@overture-stack/maestro-common';
55

66
import { es7 } from '../../src/client/v7/client.js';
77
import { es8 } from '../../src/client/v8/client.js';
88

99
export default function suite() {
1010
let container: StartedElasticsearchContainer;
11-
let client: IElasticsearchService;
11+
let client: ElasticsearchService;
1212

1313
before(async () => {
1414
// Start an Elasticsearch container

packages/maestro-provider/src/api/api.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
BadRequest,
3-
type IElasticsearchService,
3+
type ElasticsearchService,
44
type IndexResult,
55
InternalServerError,
66
isEmpty,
@@ -27,10 +27,10 @@ const mergeResult = (accumulator: IndexResult, result: IndexResult): IndexResult
2727
/**
2828
* Creates an object containing indexing operations to be used in the API
2929
* @param config The configuration object for the `MaestroProvider`, which includes repository information
30-
* @param indexer An implementation of `IElasticsearchService` used for performing Elasticsearch operations
30+
* @param indexer An implementation of `ElasticsearchService` used for performing Elasticsearch operations
3131
* @returns
3232
*/
33-
export const api = (config: MaestroProviderConfig, indexer: IElasticsearchService): RepositoryIndexingOperations => {
33+
export const api = (config: MaestroProviderConfig, indexer: ElasticsearchService): RepositoryIndexingOperations => {
3434
const repositories = config.repositories;
3535
if (!repositories) {
3636
return {
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { IMaestroProvider, MaestroProvider } from './provider/index.js';
1+
export { initializeMaestroProvider, MaestroProvider } from './provider/index.js';
22
export type { ElasticSearchConfig, MaestroProviderConfig } from '@overture-stack/maestro-common';
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { IMaestroProvider, MaestroProvider } from './provider.js';
1+
export { initializeMaestroProvider, MaestroProvider } from './provider.js';

packages/maestro-provider/src/provider/provider.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
type IElasticsearchService,
2+
type ElasticsearchService,
33
type RepositoryIndexingOperations,
44
setLoggerConfig,
55
} from '@overture-stack/maestro-common';
@@ -11,23 +11,23 @@ import { api } from '../api/api.js';
1111
/**
1212
* Interface representing a provider for indexing operations
1313
*/
14-
export interface IMaestroProvider {
14+
export interface MaestroProvider {
1515
/**
1616
* The API for repository indexing operations.
1717
*/
1818
api: RepositoryIndexingOperations;
1919
/**
2020
* The Elasticsearch service implementation payload.
2121
*/
22-
payload: IElasticsearchService;
22+
payload: ElasticsearchService;
2323
}
2424

2525
/**
2626
* Creates The Maestro Provider based on the provided configuration
2727
* @param config The configuration object for initializing the Maestro provider
2828
* @returns The Maestro Provider object containing API operations and an Elasticsearch service instance
2929
*/
30-
export const MaestroProvider = (config: MaestroProviderConfig): IMaestroProvider => {
30+
export const initializeMaestroProvider = (config: MaestroProviderConfig): MaestroProvider => {
3131
if (config.logger) {
3232
setLoggerConfig(config.logger);
3333
}

packages/repository/src/repositories/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {
2-
type IRepository,
32
type LyricRepositoryConfig,
3+
type Repository,
44
RepositoryType,
55
type SongRepositoryConfig,
66
} from '@overture-stack/maestro-common';
77

88
import { lyricRepository } from './lyric/repository';
99
import { songRepository } from './song/repository';
1010

11-
export const repository = (config: LyricRepositoryConfig | SongRepositoryConfig): IRepository => {
11+
export const repository = (config: LyricRepositoryConfig | SongRepositoryConfig): Repository => {
1212
switch (config.type) {
1313
case RepositoryType.LYRIC:
1414
return lyricRepository(config);

packages/repository/src/repositories/lyric/repository.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import * as path from 'path';
22

33
import {
44
type DataRecordValue,
5-
type IRepository,
65
logger,
76
type LyricRepositoryConfig,
7+
type Repository,
88
} from '@overture-stack/maestro-common';
99

1010
import httpClient from '../../network/httpClient';
@@ -16,7 +16,7 @@ import { isArrayOfObjects } from '../../utils/utils';
1616
* @param config
1717
* @returns
1818
*/
19-
export const lyricRepository = (config: LyricRepositoryConfig): IRepository => {
19+
export const lyricRepository = (config: LyricRepositoryConfig): Repository => {
2020
const { baseUrl, categoryId, paginationSize } = config;
2121
const getRepositoryRecords = async function* (): AsyncGenerator<Record<string, DataRecordValue>[], void, unknown> {
2222
let page = 1;

packages/repository/src/repositories/song/repository.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path';
22

3-
import type { DataRecordValue, IRepository, SongRepositoryConfig } from '@overture-stack/maestro-common';
3+
import type { DataRecordValue, Repository, SongRepositoryConfig } from '@overture-stack/maestro-common';
44

55
import httpClient from '../../network/httpClient';
66
import { isArrayOfObjects } from '../../utils/utils';
@@ -10,7 +10,7 @@ import { isArrayOfObjects } from '../../utils/utils';
1010
* @param config
1111
* @returns
1212
*/
13-
export const songRepository = (config: SongRepositoryConfig): IRepository => {
13+
export const songRepository = (config: SongRepositoryConfig): Repository => {
1414
const { baseUrl, paginationSize } = config;
1515

1616
const getOrganizationRecords = async function* ({

0 commit comments

Comments
 (0)