Skip to content

Commit 2820ca3

Browse files
authored
Merge pull request #77 from dolittle/dolittle-client
Dolittle client
2 parents ad46b75 + ea1ef05 commit 2820ca3

28 files changed

Lines changed: 249 additions & 106 deletions

File tree

Samples/Advanced/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Copyright (c) Dolittle. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
import { Client } from '@dolittle/sdk';
4+
import { DolittleClient } from '@dolittle/sdk';
55
import { EventContext, PartitionId } from '@dolittle/sdk.events';
66
import { PartitionedFilterResult } from '@dolittle/sdk.events.filtering';
77

88
import { MyEvent } from './MyEvent';
99
import { MyEventHandler } from './MyEventHandler';
1010

11-
const client = Client
11+
const client = DolittleClient
1212
.forMicroservice('7a6155dd-9109-4488-8f6f-c57fe4b65bfb')
1313
.withVersion(1, 0, 2)
1414
.withEnvironment('test')

Samples/Container/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
import 'reflect-metadata';
5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { Container } from 'typedi';
77

88
import { MyEvent } from './MyEvent';
99
import { MyEventHandler } from './MyEventHandler';
1010

1111

12-
const client = Client
12+
const client = DolittleClient
1313
.forMicroservice('7a6155dd-9109-4488-8f6f-c57fe4b65bfb')
1414
.withContainer(Container)
1515
.withEventTypes(eventTypes =>

Samples/Tutorials/Aggregates/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
// Sample code for the tutorial at https://dolittle.io/tutorials/aggregates/
44

5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { TenantId } from '@dolittle/sdk.execution';
77
import { DishPrepared } from './DishPrepared';
88
import { DishHandler } from './DishHandler';
99
import { Kitchen } from './Kitchen';
1010

1111
(async () => {
12-
const client = Client
12+
const client = DolittleClient
1313
.forMicroservice('f39b1f61-d360-4675-b859-53c05c87c0e6')
1414
.withEventTypes(eventTypes =>
1515
eventTypes.register(DishPrepared))

Samples/Tutorials/Embeddings/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
// Sample code for the tutorial at https://dolittle.io/docs/tutorials/embeddings/
44

5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { TenantId } from '@dolittle/sdk.execution';
77
import { Employee } from './Employee';
88
import { EmployeeHired } from './EmployeeHired';
99
import { EmployeeRetired } from './EmployeeRetired';
1010
import { EmployeeTransferred } from './EmployeeTransferred';
1111

12-
const client = Client
12+
const client = DolittleClient
1313
.forMicroservice('f39b1f61-d360-4675-b859-53c05c87c0e6')
1414
.withEventTypes(eventTypes => {
1515
eventTypes.register(EmployeeHired);

Samples/Tutorials/EventHorizon/Consumer/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
// Sample code for the tutorial at https://dolittle.io/tutorials/event-horizon/
44

5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { PartitionId } from '@dolittle/sdk.events';
77
import { TenantId } from '@dolittle/sdk.execution';
88
import { DishPrepared } from './DishPrepared';
99

10-
const client = Client
10+
const client = DolittleClient
1111
.forMicroservice('a14bb24e-51f3-4d83-9eba-44c4cffe6bb9')
1212
.withRuntimeOn('localhost', 50055)
1313
.withEventTypes(eventTypes =>

Samples/Tutorials/EventHorizon/Producer/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
// Sample code for the tutorial at https://dolittle.io/tutorials/event-horizon/
44

5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { EventContext, PartitionId } from '@dolittle/sdk.events';
77
import { PartitionedFilterResult } from '@dolittle/sdk.events.filtering';
88
import { TenantId } from '@dolittle/sdk.execution';
99
import { DishPrepared } from './DishPrepared';
1010
import { DishHandler } from './DishHandler';
1111

12-
const client = Client
12+
const client = DolittleClient
1313
.forMicroservice('f39b1f61-d360-4675-b859-53c05c87c0e6')
1414
.withEventTypes(eventTypes =>
1515
eventTypes.register(DishPrepared))

Samples/Tutorials/GettingStarted/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
// Sample code for the tutorial at https://dolittle.io/tutorials/getting-started/typescript/
44

5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { TenantId } from '@dolittle/sdk.execution';
77
import { DishPrepared } from './DishPrepared';
88
import { DishHandler } from './DishHandler';
99

10-
const client = Client
10+
const client = DolittleClient
1111
.forMicroservice('f39b1f61-d360-4675-b859-53c05c87c0e6')
1212
.withEventTypes(eventTypes =>
1313
eventTypes.register(DishPrepared))

Samples/Tutorials/Projections/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
// Sample code for the tutorial at https://dolittle.io/docs/tutorials/projections/
44

5-
import { Client } from '@dolittle/sdk';
5+
import { DolittleClient } from '@dolittle/sdk';
66
import { TenantId } from '@dolittle/sdk.execution';
77
import { DishPrepared } from './DishPrepared';
88
import { DishCounter } from './DishCounter';
99
import { Chef } from './Chef';
1010

11-
const client = Client
11+
const client = DolittleClient
1212
.forMicroservice('f39b1f61-d360-4675-b859-53c05c87c0e6')
1313
.withEventTypes(eventTypes =>
1414
eventTypes.register(DishPrepared))

Source/embeddings/Embeddings.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
import { Guid } from '@dolittle/rudiments';
55
import { EmbeddingsClient } from '@dolittle/runtime.contracts/Embeddings/Embeddings_grpc_pb';
66
import { EmbeddingStoreClient } from '@dolittle/runtime.contracts/Embeddings/Store_grpc_pb';
7-
import { ExecutionContext, TenantId } from '@dolittle/sdk.execution';
7+
import { ExecutionContext, TenantIdLike } from '@dolittle/sdk.execution';
88
import { IProjectionAssociations, ProjectionsToSDKConverter } from '@dolittle/sdk.projections';
99
import { Logger } from 'winston';
1010
import { Embedding } from './Embedding';
1111
import { IEmbedding } from './IEmbedding';
12-
import { EmbeddingStore, IEmbeddingStore, EmbeddingStoreBuilder } from './Store';
12+
import { IEmbeddings } from './IEmbeddings';
13+
import { EmbeddingStoreBuilder } from './Store';
1314

1415
/**
15-
* Represents a builder for building an embedding sdk client.
16+
* Represents an implementation of {@link IEmbeddings}.
1617
*/
17-
export class Embeddings {
18-
18+
export class Embeddings extends IEmbeddings {
1919
/**
2020
* Initializes an instance of {@link EmbeddingStoreBuilder}.
2121
* @param {EmbeddingStoreClient} _embeddingsStoreClient The embedding store client.
@@ -29,14 +29,11 @@ export class Embeddings {
2929
private readonly _executionContext: ExecutionContext,
3030
private readonly _embeddingAssociations: IProjectionAssociations,
3131
private readonly _logger: Logger) {
32+
super();
3233
}
3334

34-
/**
35-
* Build an {@link IEmbeddingStore} for the given tenant.
36-
* @param {TenantId | Guid | string} tenantId The tenant id.
37-
* @returns {IEmbeddingStore} The embedding store.
38-
*/
39-
forTenant(tenantId: TenantId | Guid | string): IEmbedding {
35+
/** @inheritdoc */
36+
forTenant(tenantId: TenantIdLike): IEmbedding {
4037
const executionContext = this._executionContext
4138
.forTenant(tenantId)
4239
.forCorrelation(Guid.create());

Source/embeddings/IEmbeddings.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Dolittle. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
import { TenantIdLike } from '@dolittle/sdk.execution';
4+
import { IEmbedding } from './IEmbedding';
5+
6+
/**
7+
* Defines a builder for {@link IEmbedding}.
8+
*/
9+
export abstract class IEmbeddings {
10+
/**
11+
* Build an {@link IEmbeddingStore} for the given tenant.
12+
* @param { TenantIdLike } tenantId The tenant id.
13+
* @returns {IEmbeddingStore} The embedding store.
14+
*/
15+
abstract forTenant(tenantId: TenantIdLike): IEmbedding;
16+
}

0 commit comments

Comments
 (0)