Skip to content

Commit 311364d

Browse files
committed
refactor: revise public/internal APIs
1 parent bef0393 commit 311364d

File tree

3 files changed

+71
-136
lines changed

3 files changed

+71
-136
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
".": {
1717
"types": "./dist/index.d.ts",
1818
"default": "./dist/index.js"
19+
},
20+
"./internal": {
21+
"types": "./dist/internal.d.ts",
22+
"default": "./dist/internal.js"
1923
}
2024
},
2125
"scripts": {

src/index.ts

Lines changed: 14 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,25 @@
1-
import ApiEndpoints from './api-endpoints';
2-
import { logger as applicationLogger, loggerPrefix } from './application-logger';
3-
import { IAssignmentHooks } from './assignment-hooks';
4-
import { IAssignmentLogger, IAssignmentEvent } from './assignment-logger';
5-
import { IBanditLogger, IBanditEvent } from './bandit-logger';
6-
import {
7-
AbstractAssignmentCache,
8-
AssignmentCache,
9-
AsyncMap,
10-
AssignmentCacheKey,
11-
AssignmentCacheValue,
12-
AssignmentCacheEntry,
13-
assignmentCacheKeyToString,
14-
assignmentCacheValueToString,
15-
} from './cache/abstract-assignment-cache';
16-
import { LRUInMemoryAssignmentCache } from './cache/lru-in-memory-assignment-cache';
17-
import { NonExpiringInMemoryAssignmentCache } from './cache/non-expiring-in-memory-cache-assignment';
18-
import EppoClient, {
1+
// Public APIs.
2+
//
3+
// The section below is intended for public usage and may be re-exported by SDKs.
4+
export { KVStore, MemoryStore } from './kvstore';
5+
export { IAssignmentHooks } from './assignment-hooks';
6+
export { IAssignmentLogger, IAssignmentEvent } from './assignment-logger';
7+
export { IBanditLogger, IBanditEvent } from './bandit-logger';
8+
export {
9+
default as EppoClient,
1910
EppoClientParameters,
2011
IAssignmentDetails,
2112
IContainerExperiment,
2213
} from './client/eppo-client';
23-
import { Subject } from './client/subject';
24-
import FlagConfigRequestor from './configuration-requestor';
25-
import {
26-
IConfigurationWire,
27-
IObfuscatedPrecomputedConfigurationResponse,
28-
IPrecomputedConfigurationResponse,
29-
} from './configuration-wire/configuration-wire-types';
30-
import * as constants from './constants';
31-
import { decodePrecomputedFlag } from './decoding';
32-
import { EppoAssignmentLogger } from './eppo-assignment-logger';
33-
import BatchEventProcessor from './events/batch-event-processor';
34-
import { BoundedEventQueue } from './events/bounded-event-queue';
35-
import DefaultEventDispatcher, {
36-
DEFAULT_EVENT_DISPATCHER_CONFIG,
37-
DEFAULT_EVENT_DISPATCHER_BATCH_SIZE,
38-
newDefaultEventDispatcher,
39-
} from './events/default-event-dispatcher';
40-
import Event from './events/event';
41-
import EventDispatcher from './events/event-dispatcher';
42-
import NamedEventQueue from './events/named-event-queue';
43-
import NetworkStatusListener from './events/network-status-listener';
44-
import HttpClient from './http-client';
45-
import {
46-
PrecomputedFlag,
47-
Flag,
48-
ObfuscatedFlag,
49-
VariationType,
50-
FormatEnum,
51-
BanditParameters,
52-
BanditVariation,
53-
IObfuscatedPrecomputedBandit,
54-
Variation,
55-
Environment,
56-
} from './interfaces';
57-
import { KVStore, MemoryStore } from './kvstore';
58-
import { buildStorageKeySuffix } from './obfuscation';
59-
import {
14+
export { Subject } from './client/subject';
15+
export * as constants from './constants';
16+
export { EppoAssignmentLogger } from './eppo-assignment-logger';
17+
18+
export {
6019
AttributeType,
6120
Attributes,
6221
BanditActions,
6322
BanditSubjectAttributes,
6423
ContextAttributes,
6524
FlagKey,
6625
} from './types';
67-
import * as validation from './validation';
68-
69-
export {
70-
loggerPrefix,
71-
applicationLogger,
72-
AbstractAssignmentCache,
73-
IAssignmentDetails,
74-
IAssignmentHooks,
75-
IAssignmentLogger,
76-
EppoAssignmentLogger,
77-
IAssignmentEvent,
78-
IBanditLogger,
79-
IBanditEvent,
80-
IContainerExperiment,
81-
EppoClientParameters,
82-
EppoClient,
83-
constants,
84-
ApiEndpoints,
85-
FlagConfigRequestor,
86-
HttpClient,
87-
validation,
88-
89-
// Precomputed Client
90-
IObfuscatedPrecomputedConfigurationResponse,
91-
IObfuscatedPrecomputedBandit,
92-
93-
// Configuration store
94-
KVStore,
95-
MemoryStore,
96-
97-
// Assignment cache
98-
AssignmentCacheKey,
99-
AssignmentCacheValue,
100-
AssignmentCacheEntry,
101-
AssignmentCache,
102-
AsyncMap,
103-
NonExpiringInMemoryAssignmentCache,
104-
LRUInMemoryAssignmentCache,
105-
assignmentCacheKeyToString,
106-
assignmentCacheValueToString,
107-
108-
// Interfaces
109-
Flag,
110-
ObfuscatedFlag,
111-
Variation,
112-
VariationType,
113-
AttributeType,
114-
Attributes,
115-
ContextAttributes,
116-
BanditSubjectAttributes,
117-
BanditActions,
118-
BanditVariation,
119-
BanditParameters,
120-
Environment,
121-
FormatEnum,
122-
123-
// event dispatcher types
124-
NamedEventQueue,
125-
EventDispatcher,
126-
BoundedEventQueue,
127-
DEFAULT_EVENT_DISPATCHER_CONFIG,
128-
DEFAULT_EVENT_DISPATCHER_BATCH_SIZE,
129-
newDefaultEventDispatcher,
130-
BatchEventProcessor,
131-
NetworkStatusListener,
132-
DefaultEventDispatcher,
133-
Event,
134-
135-
// Configuration interchange.
136-
IConfigurationWire,
137-
IPrecomputedConfigurationResponse,
138-
PrecomputedFlag,
139-
FlagKey,
140-
141-
// Test helpers
142-
decodePrecomputedFlag,
143-
144-
// Utilities
145-
buildStorageKeySuffix,
146-
Subject,
147-
};

src/internal.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Internal APIs.
2+
//
3+
// The section below is intended for internal usage in SDKs and is not part of the public API. It is
4+
// not subjected to semantic versioning and may change at any time.
5+
export { loggerPrefix, logger as applicationLogger } from './application-logger';
6+
export { default as ApiEndpoints } from './api-endpoints';
7+
export { default as ConfigurationRequestor } from './configuration-requestor';
8+
export { default as HttpClient } from './http-client';
9+
export { validateNotBlank } from './validation';
10+
export { LRUInMemoryAssignmentCache } from './cache/lru-in-memory-assignment-cache';
11+
export { buildStorageKeySuffix } from './obfuscation';
12+
export {
13+
AbstractAssignmentCache,
14+
AssignmentCache,
15+
AsyncMap,
16+
AssignmentCacheKey,
17+
AssignmentCacheValue,
18+
AssignmentCacheEntry,
19+
assignmentCacheKeyToString,
20+
assignmentCacheValueToString,
21+
} from './cache/abstract-assignment-cache';
22+
export { NonExpiringInMemoryAssignmentCache } from './cache/non-expiring-in-memory-cache-assignment';
23+
export {
24+
IConfigurationWire,
25+
IObfuscatedPrecomputedConfigurationResponse,
26+
IPrecomputedConfigurationResponse,
27+
} from './configuration-wire/configuration-wire-types';
28+
export { decodePrecomputedFlag } from './decoding';
29+
export { default as BatchEventProcessor } from './events/batch-event-processor';
30+
export { BoundedEventQueue } from './events/bounded-event-queue';
31+
export {
32+
default as DefaultEventDispatcher,
33+
DEFAULT_EVENT_DISPATCHER_CONFIG,
34+
DEFAULT_EVENT_DISPATCHER_BATCH_SIZE,
35+
newDefaultEventDispatcher,
36+
} from './events/default-event-dispatcher';
37+
export { default as Event } from './events/event';
38+
export { default as EventDispatcher } from './events/event-dispatcher';
39+
export { default as NamedEventQueue } from './events/named-event-queue';
40+
export { default as NetworkStatusListener } from './events/network-status-listener';
41+
export {
42+
PrecomputedFlag,
43+
Flag,
44+
ObfuscatedFlag,
45+
VariationType,
46+
FormatEnum,
47+
BanditParameters,
48+
BanditVariation,
49+
IObfuscatedPrecomputedBandit,
50+
Variation,
51+
Environment,
52+
} from './interfaces';
53+
export { FlagKey } from './types';

0 commit comments

Comments
 (0)