@flagsmith/flagsmith 11.0.0-internal.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +38 -0
  2. package/evaluation-context.d.ts +27 -0
  3. package/evaluation-context.ts +29 -0
  4. package/flagsmith-core.d.ts +18 -0
  5. package/index.d.ts +8 -0
  6. package/index.js +2 -0
  7. package/index.js.map +1 -0
  8. package/index.mjs +2 -0
  9. package/index.mjs.map +1 -0
  10. package/isomorphic.d.ts +5 -0
  11. package/isomorphic.js +2 -0
  12. package/isomorphic.js.map +1 -0
  13. package/isomorphic.mjs +2 -0
  14. package/isomorphic.mjs.map +1 -0
  15. package/next-middleware.d.ts +5 -0
  16. package/next-middleware.js +2 -0
  17. package/next-middleware.js.map +1 -0
  18. package/next-middleware.mjs +2 -0
  19. package/next-middleware.mjs.map +1 -0
  20. package/package.json +57 -0
  21. package/react.d.ts +32 -0
  22. package/react.js +2 -0
  23. package/react.js.map +1 -0
  24. package/react.mjs +2 -0
  25. package/react.mjs.map +1 -0
  26. package/src/evaluation-context.d.ts +27 -0
  27. package/src/flagsmith-core.d.ts +18 -0
  28. package/src/flagsmith-core.ts +1092 -0
  29. package/src/index.d.ts +8 -0
  30. package/src/index.ts +22 -0
  31. package/src/isomorphic.d.ts +5 -0
  32. package/src/isomorphic.ts +27 -0
  33. package/src/next-middleware.d.ts +5 -0
  34. package/src/next-middleware.ts +8 -0
  35. package/src/react.d.ts +32 -0
  36. package/src/react.tsx +200 -0
  37. package/src/readme.md +1 -0
  38. package/src/types.d.ts +338 -0
  39. package/src/utils/angular-fetch.ts +36 -0
  40. package/src/utils/async-storage.ts +41 -0
  41. package/src/utils/emitter.ts +90 -0
  42. package/src/utils/ensureTrailingSlash.ts +3 -0
  43. package/src/utils/get-changes.ts +19 -0
  44. package/src/utils/set-dynatrace-value.ts +15 -0
  45. package/src/utils/types.ts +24 -0
  46. package/src/utils/version.ts +2 -0
  47. package/types.d.ts +338 -0
  48. package/utils/angular-fetch.d.ts +6 -0
  49. package/utils/async-storage.d.ts +7 -0
  50. package/utils/emitter.d.ts +11 -0
  51. package/utils/ensureTrailingSlash.d.ts +1 -0
  52. package/utils/get-changes.d.ts +2 -0
  53. package/utils/set-dynatrace-value.d.ts +2 -0
  54. package/utils/types.d.ts +7 -0
  55. package/utils/version.d.ts +1 -0
@@ -0,0 +1,41 @@
1
+ export type AsyncStorageType = {
2
+ getItemSync?: (key:string)=>string|null
3
+ getItem: (key:string, cb?:(err:Error|null, res:string|null)=>void)=>Promise<string|null>
4
+ setItem: (key:string, value: string)=>Promise<string|null>
5
+ } | null
6
+ const AsyncStorage: AsyncStorageType = {
7
+ getItemSync: function(key) {
8
+ try {
9
+ const data = localStorage.getItem(key);
10
+ return data || null
11
+ } catch (e) {
12
+ return null
13
+ }
14
+ },
15
+ getItem: function (key, cb) {
16
+ return new Promise<any>((resolve, reject) => {
17
+ try {
18
+ const result = this.getItemSync!(key);
19
+ cb?.(null, result)
20
+ resolve(result)
21
+ } catch (err) {
22
+ cb && cb(err as Error, null);
23
+ reject(err);
24
+ }
25
+ });
26
+ },
27
+ setItem: function (key:string, value:string, cb?: (err:Error|null, res:string|null)=>void) {
28
+ return new Promise<any>((resolve, reject) => {
29
+ try {
30
+ localStorage.setItem(key, value);
31
+ cb && cb(null, value);
32
+ resolve(value);
33
+ } catch (err) {
34
+ cb && cb(err as Error, null);
35
+ reject(err);
36
+ }
37
+ });
38
+ }
39
+ };
40
+
41
+ export default AsyncStorage
@@ -0,0 +1,90 @@
1
+ interface EventCallback {
2
+ id: string;
3
+ fn: () => void;
4
+ ctx?: any;
5
+ }
6
+
7
+ type EventName = string;
8
+
9
+ interface EventMap {
10
+ [eventName: string]: EventCallback[];
11
+ }
12
+
13
+ class Emitter {
14
+ private e: EventMap = {};
15
+
16
+ private generateCallbackId(): string {
17
+ return Math.random().toString(36).substring(7);
18
+ }
19
+
20
+ on(name: EventName, callback: () => void, ctx?: any): () => this {
21
+ const e = this.e || (this.e = {});
22
+ const id = this.generateCallbackId();
23
+
24
+ const listener = {
25
+ id: id,
26
+ fn: callback,
27
+ ctx: ctx
28
+ };
29
+
30
+ (e[name] || (e[name] = [])).push(listener);
31
+
32
+ const offFunction = () => {
33
+ this.off(name, id);
34
+ };
35
+
36
+ return offFunction.bind(this) as () => this;
37
+ }
38
+
39
+ once(
40
+ name: string, // EventName inlined as string
41
+ callback: (...args: any[]) => void,
42
+ ctx?: any
43
+ ): () => this {
44
+ const self = this;
45
+ const id = this.generateCallbackId();
46
+
47
+ function listener(this: unknown, ...args: any[]) {
48
+ self.off(name, id);
49
+ callback.apply(ctx, args);
50
+ }
51
+
52
+ (listener as any)._ = callback;
53
+
54
+ return this.on(name, listener, ctx) as () => this;
55
+ }
56
+
57
+ emit(name: EventName, ...data: any[]): this {
58
+ const evtArr = ((this.e || (this.e = {}))[name] || []).slice();
59
+ const len = evtArr.length;
60
+
61
+ for (let i = 0; i < len; i++) {
62
+ evtArr[i].fn.apply(evtArr[i].ctx, data as any);
63
+ }
64
+
65
+ return this;
66
+ }
67
+
68
+ off(name: EventName, callbackOrId?: (() => void) | string, ctx?: any): this {
69
+ const e = this.e || (this.e = {});
70
+ const evts = e[name];
71
+ const liveEvents: EventCallback[] = [];
72
+
73
+ if (evts && callbackOrId) {
74
+ for (let i = 0, len = evts.length; i < len; i++) {
75
+ if (
76
+ (typeof callbackOrId === 'function' && evts[i].fn !== callbackOrId) ||
77
+ (typeof callbackOrId === 'string' && evts[i].id !== callbackOrId)
78
+ ) {
79
+ liveEvents.push(evts[i]);
80
+ }
81
+ }
82
+ }
83
+
84
+ (liveEvents.length ? e[name] = liveEvents : delete e[name]);
85
+
86
+ return this;
87
+ }
88
+ }
89
+
90
+ export default Emitter;
@@ -0,0 +1,3 @@
1
+ export function ensureTrailingSlash(str: string): string {
2
+ return str.endsWith('/') ? str : str + '/';
3
+ }
@@ -0,0 +1,19 @@
1
+ import { IFlags, Traits } from '../types';
2
+ import deepEqual from 'fast-deep-equal';
3
+
4
+ export default function(before: Traits | IFlags | undefined | null, after:Traits | IFlags | undefined | null) {
5
+ const changedValues = Object.keys(after||{}).filter((flagKey)=>{
6
+ const beforeValue = before?.[flagKey]
7
+ const afterValue = after?.[flagKey]
8
+ return !deepEqual(beforeValue, afterValue)
9
+ })
10
+ Object.keys(before||{}).filter((flagKey)=>{
11
+ if(!Object.keys(after||{}).includes(flagKey)) {
12
+ changedValues.push(flagKey)
13
+ }
14
+ })
15
+ if (!Object.keys(changedValues).length) {
16
+ return null
17
+ }
18
+ return changedValues
19
+ }
@@ -0,0 +1,15 @@
1
+ // transforms any trait to match sendSessionProperties
2
+ // https://www.dynatrace.com/support/doc/javascriptapi/interfaces/dtrum_types.DtrumApi.html#addActionProperties
3
+ import { DynatraceObject } from '../types';
4
+ export default function (obj: DynatraceObject, trait: string, value: string|number|boolean|null|undefined) {
5
+ let key: keyof DynatraceObject= 'shortString'
6
+ let convertToString = true
7
+ if (typeof value === 'number') {
8
+ key = 'javaDouble'
9
+ convertToString = false
10
+ }
11
+ // @ts-expect-error
12
+ obj[key] = obj[key] || {}
13
+ // @ts-expect-error
14
+ obj[key][trait] = convertToString ? value+"":value
15
+ }
@@ -0,0 +1,24 @@
1
+ import { EvaluationContext, TraitEvaluationContext } from "../evaluation-context";
2
+ import { ClientEvaluationContext, ITraits, IFlagsmithTrait } from "../types";
3
+
4
+ export function isTraitEvaluationContext(trait: TraitEvaluationContext | IFlagsmithTrait): trait is TraitEvaluationContext {
5
+ return !!trait && typeof trait == 'object' && trait.value !== undefined;
6
+ }
7
+
8
+ export function toTraitEvaluationContextObject(traits: ITraits): { [key: string]: null | TraitEvaluationContext } {
9
+ return Object.fromEntries(
10
+ Object.entries(traits).map(
11
+ ([tKey, tValue]) => [tKey, isTraitEvaluationContext(tValue) ? tValue : {value: tValue}]
12
+ )
13
+ );
14
+ }
15
+
16
+ export function toEvaluationContext(clientEvaluationContext: ClientEvaluationContext): EvaluationContext {
17
+ return {
18
+ ...clientEvaluationContext,
19
+ identity: !!clientEvaluationContext.identity ? {
20
+ ...clientEvaluationContext.identity,
21
+ traits: toTraitEvaluationContextObject(clientEvaluationContext.identity.traits || {})
22
+ } : undefined,
23
+ }
24
+ }
@@ -0,0 +1,2 @@
1
+ // Auto-generated by write-version.js
2
+ export const SDK_VERSION = "11.0.0-internal.1";
package/types.d.ts ADDED
@@ -0,0 +1,338 @@
1
+ import { EvaluationContext, IdentityEvaluationContext, TraitEvaluationContext } from "./evaluation-context";
2
+ import { FlagSource } from "./flagsmith-core";
3
+
4
+ type IFlagsmithValue<T = string | number | boolean | null> = T
5
+
6
+ export type DynatraceObject = {
7
+ "javaLongOrObject": Record<string, number>,
8
+ "date": Record<string, Date>,
9
+ "shortString": Record<string, string>,
10
+ "javaDouble": Record<string, number>,
11
+ }
12
+
13
+ export interface IFlagsmithFeature<Value = IFlagsmithValue> {
14
+ id?: number;
15
+ enabled: boolean;
16
+ value: Value;
17
+ }
18
+
19
+ export declare type IFlagsmithTrait = IFlagsmithValue | TraitEvaluationContext;
20
+ export declare type IFlags<F extends string = string> = Record<F, IFlagsmithFeature>;
21
+ export declare type ITraits<T extends string = string> = Record<T, IFlagsmithTrait>;
22
+ export declare type Traits<T extends string = string> = Record<T, TraitEvaluationContext | null>;
23
+
24
+ export interface ClientIdentityEvaluationContext extends Omit<IdentityEvaluationContext, "traits"> {
25
+ traits?: null | ITraits;
26
+ }
27
+ export interface ClientEvaluationContext extends Omit<EvaluationContext, "identity"> {
28
+ identity?: null | ClientIdentityEvaluationContext;
29
+ }
30
+
31
+ export declare type GetValueOptions<T = Array<any> | object> = {
32
+ skipAnalytics?: boolean
33
+ json?: boolean
34
+ fallback?: T
35
+ }
36
+
37
+ export declare type HasFeatureOptions = {
38
+ skipAnalytics?: boolean
39
+ fallback?: boolean
40
+ } | boolean
41
+
42
+
43
+ export declare type IIdentity<T = string> = T;
44
+
45
+ export interface IRetrieveInfo {
46
+ isFromServer: boolean;
47
+ flagsChanged: string[] | null;
48
+ traitsChanged: string[] | null;
49
+ }
50
+
51
+ export interface IState<F extends string = string> {
52
+ api: string;
53
+ flags?: IFlags<FKey<F>>;
54
+ evaluationContext?: EvaluationContext;
55
+ evaluationEvent?: Record<string, Record<string, number>> | null;
56
+ ts?: number;
57
+ identity?: string;
58
+ }
59
+
60
+ declare type ICacheOptions = {
61
+ ttl?: number;
62
+ skipAPI?: boolean;
63
+ storageKey?: string;
64
+ loadStale?: boolean;
65
+ };
66
+
67
+ export declare type IDatadogRum = {
68
+ trackTraits: boolean
69
+ client: {
70
+ setUser: (newUser: {
71
+ [x: string]: unknown
72
+ }) => void;
73
+ getUser: () => {
74
+ [x: string]: unknown
75
+ };
76
+ [extraProps: string]: any
77
+ }
78
+ }
79
+
80
+
81
+ export type ISentryClient = {
82
+ getIntegrationByName(name:"FeatureFlags"): {
83
+ addFeatureFlag(flag: string, enabled: boolean): void;
84
+ } | undefined;
85
+ } | undefined;
86
+
87
+
88
+ export { FlagSource };
89
+
90
+ export declare type LoadingState = {
91
+ error: Error | null, // Current error, resets on next attempt to fetch flags
92
+ isFetching: boolean, // Whether there is a current request to fetch server flags
93
+ isLoading: boolean, // Whether any flag data exists
94
+ source: FlagSource // Indicates freshness of flags
95
+ }
96
+
97
+ export type OnChange<F extends string = string> = (previousFlags: IFlags<FKey<F>> | null, params: IRetrieveInfo, loadingState:LoadingState) => void
98
+
99
+ export type ApplicationMetadata = {
100
+ name: string;
101
+ version?: string;
102
+ }
103
+
104
+ export interface IInitConfig<F extends string | Record<string, any> = string, T extends string = string> {
105
+ AsyncStorage?: any;
106
+ api?: string;
107
+ evaluationContext?: ClientEvaluationContext;
108
+ cacheFlags?: boolean;
109
+ cacheOptions?: ICacheOptions;
110
+ datadogRum?: IDatadogRum;
111
+ sentryClient?: ISentryClient;
112
+ defaultFlags?: IFlags<FKey<F>>;
113
+ fetch?: any;
114
+ realtime?: boolean;
115
+ eventSourceUrl?: string;
116
+ enableAnalytics?: boolean;
117
+ enableDynatrace?: boolean;
118
+ enableLogs?: boolean;
119
+ angularHttpClient?: any;
120
+ environmentID?: string;
121
+ headers?: object;
122
+ identity?: IIdentity;
123
+ traits?: ITraits<T>;
124
+ onChange?: OnChange<FKey<F>>;
125
+ onError?: (err: Error) => void;
126
+ preventFetch?: boolean;
127
+ state?: IState;
128
+ _trigger?: () => void;
129
+ _triggerLoadingState?: () => void;
130
+ /**
131
+ * Customer application metadata
132
+ */
133
+ applicationMetadata?: ApplicationMetadata;
134
+ /**
135
+ * Configuration for the evaluation analytics pipeline. When provided,
136
+ * individual flag evaluation events are buffered and sent to the pipeline endpoint.
137
+ */
138
+ evaluationAnalyticsConfig?: {
139
+ /** URL of the pipeline server (e.g. 'https://analytics.flagsmith.com/'). */
140
+ analyticsServerUrl: string;
141
+ /** Maximum events to buffer in memory before dropping oldest. Default 1000. */
142
+ maxBuffer?: number;
143
+ /** Flush interval in milliseconds. Set to 0 to flush immediately after each evaluation. Default 10000 (10s). */
144
+ flushInterval?: number;
145
+ };
146
+ }
147
+
148
+ export interface IPipelineEvent {
149
+ event_id: string; // flag_name or event_name
150
+ event_type: 'flag_evaluation' | 'custom_event';
151
+ evaluated_at: number;
152
+ identity_identifier: string | null;
153
+ enabled?: boolean | null;
154
+ value: IFlagsmithValue;
155
+ traits?: { [key: string]: null | TraitEvaluationContext } | null;
156
+ metadata?: Record<string, any> | null;
157
+ }
158
+
159
+ export interface IPipelineEventBatch {
160
+ events: IPipelineEvent[];
161
+ environment_key: string;
162
+ }
163
+
164
+ export interface IFlagsmithResponse {
165
+ identifier?: string,
166
+ traits?: {
167
+ trait_key: string;
168
+ trait_value: IFlagsmithValue;
169
+ transient?: boolean;
170
+ }[];
171
+ flags?: {
172
+ enabled: boolean;
173
+ feature_state_value: IFlagsmithValue;
174
+ feature: {
175
+ id: number;
176
+ name: string;
177
+ };
178
+ }[];
179
+ }
180
+ type FKey<F> = F extends string ? F : keyof F;
181
+ type FValue<F, K extends FKey<F>> = F extends Record<string, any>
182
+ ? F[K] | null
183
+ : IFlagsmithValue;
184
+
185
+ /**
186
+ * Example usage:
187
+ *
188
+ * // A) Using string flags:
189
+ * import flagsmith from 'flagsmith' as IFlagsmith<"featureOne"|"featureTwo">;
190
+ *
191
+ * // B) Using an object for F - this can be generated by our CLI: https://github.com/Flagsmith/flagsmith-cli :
192
+ * interface MyFeatureInterface {
193
+ * featureOne: string;
194
+ * featureTwo: number;
195
+ * }
196
+ * import flagsmith from 'flagsmith' as IFlagsmith<MyFeatureInterface>;
197
+ */
198
+ export interface IFlagsmith<
199
+ F extends string | Record<string, any> = string,
200
+ T extends string = string
201
+ >
202
+ {
203
+ /**
204
+ * Initialise the sdk against a particular environment
205
+ */
206
+ init: (config: IInitConfig<FKey<F>, T>) => Promise<void>;
207
+ /**
208
+ * Set evaluation context. Refresh the flags.
209
+ */
210
+ setContext: (context: ClientEvaluationContext) => Promise<void>;
211
+ /**
212
+ * Merge current evaluation context with the provided one. Refresh the flags.
213
+ */
214
+ updateContext: (context: ClientEvaluationContext) => Promise<void>;
215
+ /**
216
+ /**
217
+ * Get current context.
218
+ */
219
+ getContext: () => EvaluationContext;
220
+ /**
221
+ * Trigger a manual fetch of the environment features
222
+ */
223
+ getFlags: () => Promise<void>;
224
+ /**
225
+ * Returns the current flags
226
+ */
227
+ getAllFlags: () => IFlags<FKey<F>>;
228
+ /**
229
+ * Identify user, triggers a call to get flags if `flagsmith.init` has been called
230
+ * */
231
+ identify: (userId: string, traits?: Record<T, IFlagsmithValue>) => Promise<void>;
232
+ /**
233
+ * Retrieves the current state of flagsmith
234
+ */
235
+ getState: () => IState;
236
+ /**
237
+ * Set the current state of flagsmith
238
+ */
239
+ setState: (state: IState) => void;
240
+ /**
241
+ * Clears the identity, triggers a call to getFlags
242
+ */
243
+ logout: () => Promise<void>;
244
+ /**
245
+ * Polls the flagsmith API, specify interval in ms
246
+ */
247
+ startListening: (interval?: number) => void;
248
+ /**
249
+ * Stops polling
250
+ */
251
+ stopListening: () => void;
252
+ /**
253
+ * Returns whether a feature is enabled, or a fallback value if it does not exist.
254
+ * @param {HasFeatureOptions} [optionsOrSkipAnalytics=false] If `true`, will not track analytics for this flag
255
+ * evaluation. Using a boolean for this parameter is deprecated - use `{ skipAnalytics: true }` instead.
256
+ * @param [optionsOrSkipAnalytics.fallback=false] Returns this value if the feature does not exist.
257
+ * @param [optionsOrSkipAnalytics.skipAnalytics=false] If `true`, do not track analytics for this feature evaluation.
258
+ * @example
259
+ * flagsmith.hasFeature("power_user_feature")
260
+ * @example
261
+ * flagsmith.hasFeature("enabled_by_default_feature", { fallback: true })
262
+ */
263
+ hasFeature: (key: FKey<F>, optionsOrSkipAnalytics?: HasFeatureOptions) => boolean;
264
+
265
+ /**
266
+ * Returns the value of a feature, or a fallback value.
267
+ * @param [options.json=false] Deserialise the feature value using `JSON.parse` and return the result or `options.fallback`.
268
+ * @param [options.fallback=null] Return this value in any of these cases:
269
+ * * The feature does not exist.
270
+ * * The feature has no value.
271
+ * * `options.json` is `true` and the feature's value is not valid JSON.
272
+ * @param [options.skipAnalytics=false] If `true`, do not track analytics for this feature evaluation.
273
+ * @param [skipAnalytics=false] Deprecated - use `options.skipAnalytics` instead.
274
+ * @example
275
+ * flagsmith.getValue("remote_config") // "{\"hello\":\"world\"}"
276
+ * flagsmith.getValue("remote_config", { json: true }) // { hello: "world" }
277
+ * @example
278
+ * flagsmith.getValue("font_size") // "12px"
279
+ * flagsmith.getValue("font_size", { json: true, fallback: "8px" }) // "8px"
280
+ */
281
+ getValue<K extends FKey<F>>(
282
+ key: K,
283
+ options?: GetValueOptions<FValue<F, K>>,
284
+ skipAnalytics?: boolean
285
+ ): IFlagsmithValue<FValue<F, K>>;
286
+ /**
287
+ * Get the value of a particular trait for the identified user
288
+ */
289
+ getTrait: (key: T) => IFlagsmithValue;
290
+ /**
291
+ * Get the values of all traits for the identified user
292
+ */
293
+ getAllTraits: () => Record<string, IFlagsmithValue>;
294
+ /**
295
+ * Set a specific trait for a given user id, triggers a call to get flags
296
+ * */
297
+ setTrait: (key: T, value: IFlagsmithTrait) => Promise<void>;
298
+ /**
299
+ * Set a key value set of traits for a given user, triggers a call to get flags
300
+ */
301
+ setTraits: (traits: ITraits) => Promise<void>;
302
+ /**
303
+ * The stored identity of the user
304
+ */
305
+ identity?: IIdentity;
306
+ /**
307
+ * Whether the flagsmith SDK is initialised
308
+ */
309
+ initialised?: boolean;
310
+
311
+ /**
312
+ * Returns ths current loading state
313
+ */
314
+ loadingState?: LoadingState;
315
+
316
+ /**
317
+ * Used internally, this function will callback separately to onChange whenever flags are updated
318
+ */
319
+ _trigger?: () => void;
320
+ /**
321
+ * Used internally, this function will trigger the useFlagsmithLoading hook when loading state changes
322
+ */
323
+ _triggerLoadingState?: () => void;
324
+ /**
325
+ * Used internally, this is the cache options provided in flagsmith.init
326
+ */
327
+ cacheOptions: {
328
+ ttl: number;
329
+ skipAPI: boolean;
330
+ loadStale: boolean;
331
+ };
332
+ /**
333
+ * Used internally, this is the api provided in flagsmith.init, defaults to our production API
334
+ */
335
+ api: string
336
+ }
337
+
338
+ export {};
@@ -0,0 +1,6 @@
1
+ declare const _default: (angularHttpClient: any) => (url: string, params: {
2
+ headers: Record<string, string>;
3
+ method: "GET" | "POST" | "PUT";
4
+ body?: string | undefined;
5
+ }) => Promise<unknown>;
6
+ export default _default;
@@ -0,0 +1,7 @@
1
+ export type AsyncStorageType = {
2
+ getItemSync?: (key: string) => string | null;
3
+ getItem: (key: string, cb?: (err: Error | null, res: string | null) => void) => Promise<string | null>;
4
+ setItem: (key: string, value: string) => Promise<string | null>;
5
+ } | null;
6
+ declare const AsyncStorage: AsyncStorageType;
7
+ export default AsyncStorage;
@@ -0,0 +1,11 @@
1
+ type EventName = string;
2
+ declare class Emitter {
3
+ private e;
4
+ private generateCallbackId;
5
+ on(name: EventName, callback: () => void, ctx?: any): () => this;
6
+ once(name: string, // EventName inlined as string
7
+ callback: (...args: any[]) => void, ctx?: any): () => this;
8
+ emit(name: EventName, ...data: any[]): this;
9
+ off(name: EventName, callbackOrId?: (() => void) | string, ctx?: any): this;
10
+ }
11
+ export default Emitter;
@@ -0,0 +1 @@
1
+ export declare function ensureTrailingSlash(str: string): string;
@@ -0,0 +1,2 @@
1
+ import { IFlags, Traits } from '../types';
2
+ export default function (before: Traits | IFlags | undefined | null, after: Traits | IFlags | undefined | null): string[] | null;
@@ -0,0 +1,2 @@
1
+ import { DynatraceObject } from '../types';
2
+ export default function (obj: DynatraceObject, trait: string, value: string | number | boolean | null | undefined): void;
@@ -0,0 +1,7 @@
1
+ import { EvaluationContext, TraitEvaluationContext } from "../evaluation-context";
2
+ import { ClientEvaluationContext, ITraits, IFlagsmithTrait } from "../types";
3
+ export declare function isTraitEvaluationContext(trait: TraitEvaluationContext | IFlagsmithTrait): trait is TraitEvaluationContext;
4
+ export declare function toTraitEvaluationContextObject(traits: ITraits): {
5
+ [key: string]: null | TraitEvaluationContext;
6
+ };
7
+ export declare function toEvaluationContext(clientEvaluationContext: ClientEvaluationContext): EvaluationContext;
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION = "11.0.0-internal.1";