Skip to content

Commit c9cb190

Browse files
committed
Merge main
Signed-off-by: marcozabel <[email protected]>
2 parents f1c6001 + 8feffee commit c9cb190

File tree

11 files changed

+65
-30
lines changed

11 files changed

+65
-30
lines changed

.release-please-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"libs/providers/launchdarkly-client": "0.3.3",
99
"libs/providers/go-feature-flag-web": "0.2.6",
1010
"libs/shared/flagd-core": "1.1.0",
11-
"libs/shared/ofrep-core": "1.2.0",
11+
"libs/shared/ofrep-core": "2.0.0",
1212
"libs/providers/ofrep": "0.2.1",
13-
"libs/providers/ofrep-web": "0.3.4",
13+
"libs/providers/ofrep-web": "0.3.5",
1414
"libs/providers/flipt": "0.1.3",
1515
"libs/providers/flagsmith-client": "0.1.3",
1616
"libs/providers/flipt-web": "0.1.5",

libs/providers/flagd/src/e2e/step-definitions/providerSteps.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ export const providerSteps: Steps =
7171
state.providerType = providerType;
7272
});
7373

74+
function mapProviderState(state: string): ProviderStatus {
75+
const mappedState = state.toUpperCase().replace('-', '_');
76+
const status = Object.values(ProviderStatus).find((s) => s === mappedState);
77+
78+
if (!status) {
79+
throw new Error(`Unknown provider status: ${state}`);
80+
}
81+
82+
return status;
83+
}
84+
85+
then(/^the client should be in (.*) state/, (providerState: string) => {
86+
expect(state.client?.providerStatus).toBe(mapProviderState(providerState));
87+
});
88+
7489
when(/^the connection is lost for (\d+)s$/, async (time) => {
7590
console.log('stopping flagd');
7691
await fetch('http://' + container.getLaunchpadUrl() + '/restart?seconds=' + time);
@@ -79,26 +94,4 @@ export const providerSteps: Steps =
7994
when('the flag was modified', async () => {
8095
await fetch('http://' + container.getLaunchpadUrl() + '/change');
8196
});
82-
83-
function mapProviderState(state: string): ProviderStatus {
84-
switch (state) {
85-
case 'fatal':
86-
return ProviderStatus.FATAL;
87-
case 'error':
88-
return ProviderStatus.ERROR;
89-
case 'ready':
90-
return ProviderStatus.READY;
91-
case 'stale':
92-
return ProviderStatus.STALE;
93-
case 'not-ready':
94-
return ProviderStatus.NOT_READY;
95-
96-
default:
97-
throw new Error('Unknown provider status');
98-
}
99-
}
100-
101-
and(/^the client should be in (.*) state/, (providerState: string) => {
102-
expect(state.client?.providerStatus).toBe(mapProviderState(providerState));
103-
});
10497
};

libs/providers/flagd/src/e2e/tests/rpc.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('rpc', () => {
2323
tagFilter:
2424
// remove filters as we add support for features
2525
// see: https://github.com/open-feature/js-sdk-contrib/issues/1096 and child issues
26-
'@rpc and not @targetURI and not @customCert and not @events and not @stream and not @grace and not @metadata and not @contextEnrichment and not @caching',
26+
'@rpc and not @targetURI and not @customCert and not @forbidden and not @events and not @stream and not @grace and not @metadata and not @contextEnrichment and not @caching',
2727
scenarioNameTemplate: (vars) => {
2828
return `${vars.scenarioTitle} (${vars.scenarioTags.join(',')} ${vars.featureTags.join(',')})`;
2929
},

libs/providers/flagd/src/lib/configuration.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ describe('Configuration', () => {
7777
expect(getConfig().contextEnricher({})).toStrictEqual({});
7878
});
7979

80+
it('should use flagd sync port over flagd port environment option', () => {
81+
const port = 8080;
82+
const syncPort = 9090;
83+
84+
process.env['FLAGD_PORT'] = `${port}`;
85+
process.env['FLAGD_SYNC_PORT'] = `${syncPort}`;
86+
87+
expect(getConfig()).toStrictEqual(
88+
expect.objectContaining({
89+
port: syncPort,
90+
}),
91+
);
92+
});
93+
8094
it('should use incoming options over defaults and environment variable', () => {
8195
const contextEnricher = (syncContext: EvaluationContext | null): EvaluationContext => {
8296
return { ...syncContext, extraKey: 'extraValue' };
@@ -96,6 +110,7 @@ describe('Configuration', () => {
96110

97111
process.env['FLAGD_HOST'] = 'override';
98112
process.env['FLAGD_PORT'] = '8080';
113+
process.env['FLAGD_SYNC_PORT'] = '9090';
99114
process.env['FLAGD_TLS'] = 'false';
100115
process.env['FLAGD_DEFAULT_AUTHORITY'] = 'test-authority-override';
101116

@@ -107,6 +122,11 @@ describe('Configuration', () => {
107122
expect(getConfig()).toStrictEqual(expect.objectContaining({ port: 8013 }));
108123
});
109124

125+
it('should ignore an invalid sync port set as an environment variable', () => {
126+
process.env['FLAGD_SYNC_PORT'] = 'invalid number';
127+
expect(getConfig()).toStrictEqual(expect.objectContaining({ port: 8013 }));
128+
});
129+
110130
describe('port handling', () => {
111131
describe('for "in-process" evaluation', () => {
112132
const resolverType = 'in-process';

libs/providers/flagd/src/lib/configuration.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const DEFAULT_IN_PROCESS_CONFIG: FlagdConfig = { ...DEFAULT_CONFIG, resolverType
116116
enum ENV_VAR {
117117
FLAGD_HOST = 'FLAGD_HOST',
118118
FLAGD_PORT = 'FLAGD_PORT',
119+
FLAGD_SYNC_PORT = 'FLAGD_SYNC_PORT',
119120
FLAGD_DEADLINE_MS = 'FLAGD_DEADLINE_MS',
120121
FLAGD_TLS = 'FLAGD_TLS',
121122
FLAGD_SOCKET_PATH = 'FLAGD_SOCKET_PATH',
@@ -152,6 +153,9 @@ const getEnvVarConfig = (): Partial<Config> => {
152153
...(Number(process.env[ENV_VAR.FLAGD_PORT]) && {
153154
port: Number(process.env[ENV_VAR.FLAGD_PORT]),
154155
}),
156+
...(Number(process.env[ENV_VAR.FLAGD_SYNC_PORT]) && {
157+
port: Number(process.env[ENV_VAR.FLAGD_SYNC_PORT]),
158+
}),
155159
...(Number(process.env[ENV_VAR.FLAGD_DEADLINE_MS]) && {
156160
deadlineMs: Number(process.env[ENV_VAR.FLAGD_DEADLINE_MS]),
157161
}),

libs/providers/ofrep-web/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.3.5](https://github.com/open-feature/js-sdk-contrib/compare/ofrep-web-provider-v0.3.4...ofrep-web-provider-v0.3.5) (2025-11-24)
4+
5+
6+
### 🐛 Bug Fixes
7+
8+
* use ofrep-core ^2.0.0 for ofrep providers ([#1411](https://github.com/open-feature/js-sdk-contrib/issues/1411)) ([c105aa3](https://github.com/open-feature/js-sdk-contrib/commit/c105aa3eb3b59b490c0fe7445f31e6e5e2a2f6ee))
9+
310
## [0.3.4](https://github.com/open-feature/js-sdk-contrib/compare/ofrep-web-provider-v0.3.3...ofrep-web-provider-v0.3.4) (2025-11-19)
411

512

libs/providers/ofrep-web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openfeature/ofrep-web-provider",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"license": "Apache-2.0",
55
"main": "./src/index.js",
66
"typings": "./src/index.d.ts",
@@ -12,6 +12,6 @@
1212
"@openfeature/web-sdk": "^1.4.0"
1313
},
1414
"dependencies": {
15-
"@openfeature/ofrep-core": "^1.0.0"
15+
"@openfeature/ofrep-core": "^2.0.0"
1616
}
1717
}

libs/providers/ofrep/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"@openfeature/server-sdk": "^1.6.0"
1313
},
1414
"dependencies": {
15-
"@openfeature/ofrep-core": "^1.0.0"
15+
"@openfeature/ofrep-core": "^2.0.0"
1616
}
1717
}

libs/shared/ofrep-core/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [2.0.0](https://github.com/open-feature/js-sdk-contrib/compare/ofrep-core-v1.2.0...ofrep-core-v2.0.0) (2025-11-24)
4+
5+
6+
### ⚠ BREAKING CHANGES
7+
8+
* release 2.0.0 ([#1409](https://github.com/open-feature/js-sdk-contrib/issues/1409))
9+
10+
### chore
11+
12+
* release 2.0.0 ([#1409](https://github.com/open-feature/js-sdk-contrib/issues/1409)) ([0546d3f](https://github.com/open-feature/js-sdk-contrib/commit/0546d3f9c5d0ccf337635fd41a56d26cadad6929))
13+
314
## [1.2.0](https://github.com/open-feature/js-sdk-contrib/compare/ofrep-core-v1.1.0...ofrep-core-v1.2.0) (2025-11-19)
415

516

libs/shared/ofrep-core/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# ofrep-core
22

33
The core implementation of OFREP core providers.
4-
This package is intended to be used by the concrete OFREP provider implementations for API access, error handling, ...
4+
This package is intended to be only used by the concrete OFREP provider implementations for API access, error handling, ...

0 commit comments

Comments
 (0)