Skip to content

Commit 1e4c97a

Browse files
committed
feat!: use new evaluation/sync protos
* use new evaluation.proto * use new sync.proto * requires usage of flagd v0.7.3+ Signed-off-by: Todd Baert <[email protected]>
1 parent 6b7338e commit 1e4c97a

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ jobs:
3838

3939
services:
4040
flagd:
41-
image: ghcr.io/open-feature/flagd-testbed:v0.4.11
41+
image: ghcr.io/open-feature/flagd-testbed:v0.5.1
4242
ports:
4343
- 8013:8013
4444
flagd-unstable:
45-
image: ghcr.io/open-feature/flagd-testbed-unstable:v0.4.11
45+
image: ghcr.io/open-feature/flagd-testbed-unstable:v0.5.1
4646
ports:
4747
- 8014:8013
4848
sync:
49-
image: ghcr.io/open-feature/sync-testbed:v0.4.11
49+
image: ghcr.io/open-feature/sync-testbed:v0.5.1
5050
ports:
5151
- 9090:9090
5252
sync-unstable:
53-
image: ghcr.io/open-feature/sync-testbed-unstable:v0.4.11
53+
image: ghcr.io/open-feature/sync-testbed-unstable:v0.5.1
5454
ports:
5555
- 9091:9090
5656

libs/providers/flagd-web/src/lib/flagd-web-provider.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
StandardResolutionReasons,
1111
} from '@openfeature/web-sdk';
1212
import fetchMock from 'jest-fetch-mock';
13-
import { Service } from '../proto/ts/schema/v1/schema_connect';
14-
import { AnyFlag, EventStreamResponse, ResolveAllResponse } from '../proto/ts/schema/v1/schema_pb';
13+
import { Service } from '../proto/ts/flagd/evaluation/v1/evaluation_connect';
14+
import { AnyFlag, EventStreamResponse, ResolveAllResponse } from '../proto/ts/flagd/evaluation/v1/evaluation_pb';
1515
import { FlagdWebProvider } from './flagd-web-provider';
1616

1717
const EVENT_CONFIGURATION_CHANGE = 'configuration_change';

libs/providers/flagd-web/src/lib/flagd-web-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
StandardResolutionReasons,
1717
TypeMismatchError,
1818
} from '@openfeature/web-sdk';
19-
import { Service } from '../proto/ts/schema/v1/schema_connect';
20-
import { AnyFlag } from '../proto/ts/schema/v1/schema_pb';
19+
import { Service } from '../proto/ts/flagd/evaluation/v1/evaluation_connect';
20+
import { AnyFlag } from '../proto/ts/flagd/evaluation/v1/evaluation_pb';
2121
import { FlagdProviderOptions, getOptions } from './options';
2222

2323
export const ERROR_DISABLED = 'DISABLED';

libs/providers/flagd/src/lib/flagd-provider.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
ResolveStringRequest,
2525
ResolveStringResponse,
2626
ServiceClient,
27-
} from '../proto/ts/schema/v1/schema';
27+
} from '../proto/ts/flagd/evaluation/v1/evaluation';
2828
import { EVENT_CONFIGURATION_CHANGE, EVENT_PROVIDER_READY } from './constants';
2929
import { FlagdProvider } from './flagd-provider';
3030
import { FlagChangeMessage, GRPCService } from './service/grpc/grpc-service';

libs/providers/flagd/src/lib/service/grpc/grpc-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
ResolveStringRequest,
2828
ResolveStringResponse,
2929
ServiceClient,
30-
} from '../../../proto/ts/schema/v1/schema';
30+
} from '../../../proto/ts/flagd/evaluation/v1/evaluation';
3131
import { Config } from '../../configuration';
3232
import { DEFAULT_MAX_CACHE_SIZE, EVENT_CONFIGURATION_CHANGE, EVENT_PROVIDER_READY } from '../../constants';
3333
import { FlagdProvider } from '../../flagd-provider';

libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GrpcFetch } from './grpc-fetch';
22
import { Config } from '../../../configuration';
3-
import { FlagSyncServiceClient, SyncFlagsResponse, SyncState } from '../../../../proto/ts/sync/v1/sync_service';
3+
import { FlagSyncServiceClient, SyncFlagsResponse } from '../../../../proto/ts/flagd/sync/v1/sync';
44
import { ConnectivityState } from '@grpc/grpc-js/build/src/connectivity-state';
55

66
let watchStateCallback: () => void = () => ({});
@@ -70,7 +70,7 @@ describe('grpc fetch', () => {
7070
done(err);
7171
});
7272

73-
onDataCallback({ flagConfiguration, state: SyncState.SYNC_STATE_ALL });
73+
onDataCallback({ flagConfiguration });
7474
});
7575

7676
it('should handle data sync reconnection', (done) => {
@@ -86,13 +86,13 @@ describe('grpc fetch', () => {
8686
.then(() => {
8787
try {
8888
// Updated flags
89-
onDataCallback({ flagConfiguration: updatedFlagConfig, state: SyncState.SYNC_STATE_ALL });
89+
onDataCallback({ flagConfiguration: updatedFlagConfig });
9090
// Stream error
9191
onErrorCallback(new Error('Some connection error'));
9292
// Force clearing
9393
watchStateCallback();
9494
// Reconnect
95-
onDataCallback({ flagConfiguration: reconnectFlagConfig, state: SyncState.SYNC_STATE_ALL });
95+
onDataCallback({ flagConfiguration: reconnectFlagConfig });
9696

9797
// Callback assertions
9898
expect(dataCallback).toHaveBeenCalledTimes(3);
@@ -117,7 +117,7 @@ describe('grpc fetch', () => {
117117
dataCallback.mockReturnValue(['test']);
118118

119119
// First connection
120-
onDataCallback({ flagConfiguration: initFlagConfig, state: SyncState.SYNC_STATE_ALL });
120+
onDataCallback({ flagConfiguration: initFlagConfig });
121121
});
122122

123123
it('should handle error and watch channel for reconnect', (done) => {

libs/providers/flagd/src/lib/service/in-process/grpc/grpc-fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ClientReadableStream, ServiceError, credentials } from '@grpc/grpc-js';
22
import { Logger } from '@openfeature/core';
33
import { GeneralError } from '@openfeature/server-sdk';
4-
import { FlagSyncServiceClient, SyncFlagsRequest, SyncFlagsResponse } from '../../../../proto/ts/sync/v1/sync_service';
4+
import { FlagSyncServiceClient, SyncFlagsRequest, SyncFlagsResponse } from '../../../../proto/ts/flagd/sync/v1/sync';
55
import { Config } from '../../../configuration';
66
import { DataFetch } from '../data-fetch';
77
import { closeStreamIfDefined } from '../../common';

0 commit comments

Comments
 (0)