Skip to content

Commit c144f7a

Browse files
committed
chore: camel-cased-flagsmith-id
1 parent b6403a9 commit c144f7a

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

flagsmith-engine/evaluation/evaluationContext/mappers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function mapEnvironmentModelToEvaluationContext(
5959
variants,
6060
priority: fs.featureSegment?.priority,
6161
metadata: {
62-
flagsmith_id: fs.feature.id
62+
flagsmithId: fs.feature.id
6363
}
6464
};
6565
}
@@ -79,13 +79,13 @@ function mapEnvironmentModelToEvaluationContext(
7979
value: fs.getValue(),
8080
priority: fs.featureSegment?.priority,
8181
metadata: {
82-
flagsmith_id: fs.feature.id
82+
flagsmithId: fs.feature.id
8383
}
8484
}))
8585
: [],
8686
metadata: {
8787
source: SegmentSource.API,
88-
flagsmith_id: segment.id
88+
flagsmithId: segment.id
8989
}
9090
};
9191
}
@@ -153,7 +153,7 @@ function mapIdentityOverridesToSegments(identityOverrides: IdentityModel[]): Seg
153153
value: fs.getValue(),
154154
priority: -Infinity,
155155
metadata: {
156-
flagsmith_id: fs.feature.id
156+
flagsmithId: fs.feature.id
157157
}
158158
}));
159159

flagsmith-engine/evaluation/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export enum SegmentSource {
2525

2626
// Feature types
2727
export interface CustomFeatureMetadata extends FeatureMetadata {
28-
flagsmith_id: number;
28+
flagsmithId: number;
2929
}
3030

3131
export interface FeatureContextWithMetadata<T extends FeatureMetadata = FeatureMetadata>
@@ -49,7 +49,7 @@ export type EvaluationResultFlags<T extends FeatureMetadata = FeatureMetadata> =
4949

5050
// Segment types
5151
export interface CustomSegmentMetadata extends SegmentMetadata {
52-
flagsmith_id: number;
52+
flagsmithId: number;
5353
source?: SegmentSource;
5454
}
5555

flagsmith-engine/segments/models.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class SegmentModel {
224224
if (segmentResult.metadata?.source === SegmentSource.IDENTITY_OVERRIDE) {
225225
continue;
226226
}
227-
const flagsmithId = segmentResult.metadata?.flagsmith_id;
227+
const flagsmithId = segmentResult.metadata?.flagsmithId;
228228
if (!flagsmithId) {
229229
continue;
230230
}
@@ -246,11 +246,11 @@ export class SegmentModel {
246246
if (!overrides) return [];
247247
return overrides
248248
.filter(override => {
249-
const flagsmithId = override?.metadata?.flagsmith_id;
249+
const flagsmithId = override?.metadata?.flagsmithId;
250250
return typeof flagsmithId === 'number';
251251
})
252252
.map(override => {
253-
const flagsmithId = override.metadata!.flagsmith_id as number;
253+
const flagsmithId = override.metadata!.flagsmithId as number;
254254
const feature = new FeatureModel(
255255
flagsmithId,
256256
override.name,

sdk/models.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ export class Flags {
118118
): Flags {
119119
const flags: { [key: string]: Flag } = {};
120120
for (const flag of Object.values(evaluationResult.flags)) {
121-
const flagsmith_id = flag.metadata?.flagsmith_id;
122-
if (!flagsmith_id) {
121+
const flagsmithId = flag.metadata?.flagsmithId;
122+
if (!flagsmithId) {
123123
continue;
124124
}
125125

126126
flags[flag.name] = new Flag({
127127
enabled: flag.enabled,
128128
value: flag.value ?? null,
129-
featureId: flagsmith_id,
129+
featureId: flagsmithId,
130130
featureName: flag.name,
131131
reason: flag.reason
132132
});

tests/engine/unit/engine.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ test('shouldApplyOverride with priority conflicts', () => {
115115
enabled: true,
116116
value: 'value',
117117
priority: 5,
118-
metadata: { flagsmith_id: 1 }
118+
metadata: { flagsmithId: 1 }
119119
},
120120
segmentName: 'segment1'
121121
}
@@ -185,7 +185,7 @@ test('evaluateSegments handles segments with identity identifier matching', () =
185185
name: 'feature1',
186186
enabled: false,
187187
value: 'default_value',
188-
metadata: { flagsmith_id: 1 }
188+
metadata: { flagsmithId: 1 }
189189
}
190190
}
191191
};
@@ -272,7 +272,7 @@ test('evaluateSegments handles priority conflicts correctly', () => {
272272
name: 'feature1',
273273
enabled: false,
274274
value: 'default_value',
275-
metadata: { flagsmith_id: 1 }
275+
metadata: { flagsmithId: 1 }
276276
}
277277
}
278278
};
@@ -343,7 +343,7 @@ test('evaluateFeatures with multivariate evaluation', () => {
343343
{ value: 'variant_a', weight: 0, priority: 1 },
344344
{ value: 'variant_b', weight: 100, priority: 2 }
345345
],
346-
metadata: { flagsmith_id: 1 }
346+
metadata: { flagsmithId: 1 }
347347
}
348348
},
349349
identity: { key: 'test_user', identifier: 'test_user' },

tests/engine/unit/segments/segments_model.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ test('test_segment_rule_matching_function', () => {
141141
});
142142

143143
test('test_fromSegmentResult_with_multiple_variants', () => {
144-
const segmentResults = [{ name: 'test_segment', metadata: { flagsmith_id: '1' } }];
144+
const segmentResults = [{ name: 'test_segment', metadata: { flagsmithId: '1' } }];
145145

146146
const evaluationContext: EvaluationContext = {
147147
identity: {
@@ -159,7 +159,7 @@ test('test_fromSegmentResult_with_multiple_variants', () => {
159159
name: 'test_segment',
160160
metadata: {
161161
source: SegmentSource.API,
162-
flagsmith_id: '1'
162+
flagsmithId: '1'
163163
},
164164
rules: [
165165
{
@@ -181,7 +181,7 @@ test('test_fromSegmentResult_with_multiple_variants', () => {
181181
value: 'default_value',
182182
priority: 1,
183183
metadata: {
184-
flagsmith_id: 1
184+
flagsmithId: 1
185185
},
186186
variants: [
187187
{ id: 1, value: 'variant_a', weight: 30 },

0 commit comments

Comments
 (0)