Skip to content

Commit c60ab9e

Browse files
Remove enum from namespace
1 parent 22ef058 commit c60ab9e

10 files changed

Lines changed: 26 additions & 23 deletions

File tree

src/readiness/__tests__/readinessManager.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { EventEmitter } from '../../utils/MinEvents';
33
import { IReadinessManager } from '../types';
44
import { SDK_READY, SDK_UPDATE, SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED, SDK_READY_FROM_CACHE, SDK_SPLITS_CACHE_LOADED, SDK_READY_TIMED_OUT } from '../constants';
55
import { ISettings } from '../../types';
6-
import { SdkUpdateMetadata, SdkUpdateMetadataKeys, SdkReadyMetadata } from '../../../types/splitio';
6+
import { SdkUpdateMetadata, SdkReadyMetadata } from '../../../types/splitio';
7+
import { SdkUpdateMetadataKeys } from '../../sync/polling/types';
78

89
const settings = {
910
startup: {

src/sync/offline/syncTasks/fromObjectSyncTask.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ISettings } from '../../../types';
99
import { CONTROL } from '../../../utils/constants';
1010
import { SDK_SPLITS_ARRIVED, SDK_SEGMENTS_ARRIVED, SDK_SPLITS_CACHE_LOADED } from '../../../readiness/constants';
1111
import { SYNC_OFFLINE_DATA, ERROR_SYNC_OFFLINE_LOADING } from '../../../logger/constants';
12-
import { SdkUpdateMetadataKeys } from '../../../../types/splitio';
12+
import { SdkUpdateMetadataKeys } from '../../polling/types';
1313

1414
/**
1515
* Offline equivalent of `splitChangesUpdaterFactory`

src/sync/polling/types.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ import { IStorageSync } from '../../storages/types';
44
import { MEMBERSHIPS_LS_UPDATE, MEMBERSHIPS_MS_UPDATE } from '../streaming/types';
55
import { ITask, ISyncTask } from '../types';
66

7+
/**
8+
* Metadata keys for SDK update events.
9+
*/
10+
export enum SdkUpdateMetadataKeys {
11+
/**
12+
* The update event emitted when the SDK cache is updated with new data for flags.
13+
*/
14+
FLAGS_UPDATE = 'FLAGS_UPDATE',
15+
/**
16+
* The update event emitted when the SDK cache is updated with new data for segments.
17+
*/
18+
SEGMENTS_UPDATE = 'SEGMENTS_UPDATE'
19+
}
20+
721
export interface ISplitsSyncTask extends ISyncTask<[noCache?: boolean, till?: number, splitUpdateNotification?: { payload: ISplit | IRBSegment, changeNumber: number }], boolean> { }
822

923
export interface ISegmentsSyncTask extends ISyncTask<[fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number], boolean> { }

src/sync/polling/updaters/__tests__/mySegmentsUpdater.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { loggerMock } from '../../../../logger/__tests__/sdkLogger.mock';
77
import { IMySegmentsFetcher } from '../../fetchers/types';
88
import { IMembershipsResponse } from '../../../../dtos/types';
99
import { SDK_SEGMENTS_ARRIVED } from '../../../../readiness/constants';
10-
import { SdkUpdateMetadataKeys } from '../../../../../types/splitio';
10+
import { SdkUpdateMetadataKeys } from '../../types';
1111
import { MySegmentsData } from '../../types';
1212
import { MEMBERSHIPS_MS_UPDATE } from '../../../streaming/constants';
1313
import { IStorageSync } from '../../../../storages/types';

src/sync/polling/updaters/__tests__/segmentChangesUpdater.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { loggerMock } from '../../../../logger/__tests__/sdkLogger.mock';
77
import { ISegmentChangesFetcher } from '../../fetchers/types';
88
import { ISegmentChangesResponse } from '../../../../dtos/types';
99
import { SDK_SEGMENTS_ARRIVED } from '../../../../readiness/constants';
10-
import { SdkUpdateMetadataKeys } from '../../../../../types/splitio';
10+
import { SdkUpdateMetadataKeys } from '../../types';
1111

1212
describe('segmentChangesUpdater', () => {
1313
const segments = new SegmentsCacheInMemory();

src/sync/polling/updaters/__tests__/splitChangesUpdater.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { RBSegmentsCacheInMemory } from '../../../../storages/inMemory/RBSegment
1616
import { RB_SEGMENT_UPDATE, SPLIT_UPDATE } from '../../../streaming/constants';
1717
import { IN_RULE_BASED_SEGMENT } from '../../../../utils/constants';
1818
import { SDK_SPLITS_ARRIVED } from '../../../../readiness/constants';
19-
import { SdkUpdateMetadataKeys } from '../../../../../types/splitio';
19+
import { SdkUpdateMetadataKeys } from '../../types';
2020

2121
const ARCHIVED_FF = 'ARCHIVED';
2222

src/sync/polling/updaters/mySegmentsUpdater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { MySegmentsData } from '../types';
99
import { IMembershipsResponse } from '../../../dtos/types';
1010
import { MEMBERSHIPS_LS_UPDATE } from '../../streaming/constants';
1111
import { usesSegmentsSync } from '../../../storages/AbstractSplitsCacheSync';
12-
import { SdkUpdateMetadataKeys } from '../../../../types/splitio';
12+
import { SdkUpdateMetadataKeys } from '../types';
1313

1414
type IMySegmentsUpdater = (segmentsData?: MySegmentsData, noCache?: boolean, till?: number) => Promise<boolean>
1515

src/sync/polling/updaters/segmentChangesUpdater.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { SDK_SEGMENTS_ARRIVED } from '../../../readiness/constants';
55
import { ILogger } from '../../../logger/types';
66
import { LOG_PREFIX_INSTANTIATION, LOG_PREFIX_SYNC_SEGMENTS } from '../../../logger/constants';
77
import { timeout } from '../../../utils/promise/timeout';
8-
import { SdkUpdateMetadata, SdkUpdateMetadataKeys } from '../../../../types/splitio';
8+
import { SdkUpdateMetadata } from '../../../../types/splitio';
9+
import { SdkUpdateMetadataKeys } from '../types';
910

1011

1112
type ISegmentChangesUpdater = (fetchOnlyNew?: boolean, segmentName?: string, noCache?: boolean, till?: number) => Promise<boolean>

src/sync/polling/updaters/splitChangesUpdater.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { startsWith } from '../../../utils/lang';
1010
import { IN_RULE_BASED_SEGMENT, IN_SEGMENT, RULE_BASED_SEGMENT, STANDARD_SEGMENT } from '../../../utils/constants';
1111
import { setToArray } from '../../../utils/lang/sets';
1212
import { SPLIT_UPDATE } from '../../streaming/constants';
13-
import { SdkUpdateMetadata, SdkUpdateMetadataKeys } from '../../../../types/splitio';
13+
import { SdkUpdateMetadata } from '../../../../types/splitio';
14+
import { SdkUpdateMetadataKeys } from '../types';
1415

1516
export type InstantUpdate = { payload: ISplit | IRBSegment, changeNumber: number, type: string };
1617
type SplitChangesUpdater = (noCache?: boolean, till?: number, instantUpdate?: InstantUpdate) => Promise<boolean>

types/splitio.d.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -492,28 +492,14 @@ declare namespace SplitIO {
492492
removeItem(key: string): void | Promise<void>;
493493
}
494494

495-
/**
496-
* Metadata keys for SDK update events.
497-
*/
498-
const enum SdkUpdateMetadataKeys {
499-
/**
500-
* The update event emitted when the SDK cache is updated with new data for flags.
501-
*/
502-
FLAGS_UPDATE = 'FLAGS_UPDATE',
503-
/**
504-
* The update event emitted when the SDK cache is updated with new data for segments.
505-
*/
506-
SEGMENTS_UPDATE = 'SEGMENTS_UPDATE'
507-
}
508-
509495
/**
510496
* Metadata for the update event emitted when the SDK cache is updated with new data for flags or segments.
511497
*/
512498
type SdkUpdateMetadata = {
513499
/**
514500
* The type of update event.
515501
*/
516-
type: SdkUpdateMetadataKeys.FLAGS_UPDATE | SdkUpdateMetadataKeys.SEGMENTS_UPDATE
502+
type: 'FLAGS_UPDATE' | 'SEGMENTS_UPDATE'
517503
/**
518504
* The names of the flags or segments that were updated.
519505
*/

0 commit comments

Comments
 (0)