Skip to content

Commit 62b14f8

Browse files
committed
Minor changes from testing.
1 parent c224cd6 commit 62b14f8

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

packages/sdk/browser/src/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import {
22
AutoEnvAttributes,
3+
EvaluationSeriesContext,
4+
EvaluationSeriesData,
5+
Hook,
6+
HookMetadata,
7+
IdentifySeriesContext,
8+
IdentifySeriesData,
9+
IdentifySeriesResult,
10+
IdentifySeriesStatus,
311
LDContext,
412
LDContextCommon,
513
LDContextMeta,
@@ -19,7 +27,7 @@ import { BrowserClient, LDClient } from './BrowserClient';
1927
import { BrowserIdentifyOptions as LDIdentifyOptions } from './BrowserIdentifyOptions';
2028
import { BrowserOptions as LDOptions } from './options';
2129

22-
export {
30+
export type {
2331
LDClient,
2432
LDFlagSet,
2533
LDContext,
@@ -34,6 +42,14 @@ export {
3442
LDEvaluationDetailTyped,
3543
LDEvaluationReason,
3644
LDIdentifyOptions,
45+
Hook,
46+
HookMetadata,
47+
EvaluationSeriesContext,
48+
EvaluationSeriesData,
49+
IdentifySeriesContext,
50+
IdentifySeriesData,
51+
IdentifySeriesResult,
52+
IdentifySeriesStatus,
3753
};
3854

3955
export function init(clientSideId: string, options?: LDOptions): LDClient {

packages/shared/sdk-client/__tests__/HookRunner.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { LDContext, LDEvaluationDetail, LDLogger } from '@launchdarkly/js-sdk-common';
22

3-
import { Hook, IdentifyResult } from '../src/api/integrations/Hooks';
3+
import { Hook, IdentifySeriesResult } from '../src/api/integrations/Hooks';
44
import HookRunner from '../src/HookRunner';
55

66
describe('given a hook runner and test hook', () => {
@@ -135,7 +135,7 @@ describe('given a hook runner and test hook', () => {
135135
it('should execute identify hooks', () => {
136136
const context: LDContext = { kind: 'user', key: 'user-123' };
137137
const timeout = 10;
138-
const identifyResult: IdentifyResult = { status: 'completed' };
138+
const identifyResult: IdentifySeriesResult = { status: 'completed' };
139139

140140
const identifyCallback = hookRunner.identify(context, timeout);
141141
identifyCallback(identifyResult);
@@ -182,7 +182,7 @@ describe('given a hook runner and test hook', () => {
182182
it('should pass identify series data from before to after hooks', () => {
183183
const context: LDContext = { kind: 'user', key: 'user-123' };
184184
const timeout = 10;
185-
const identifyResult: IdentifyResult = { status: 'completed' };
185+
const identifyResult: IdentifySeriesResult = { status: 'completed' };
186186

187187
testHook.beforeIdentify = jest
188188
.fn()

packages/shared/sdk-client/src/HookRunner.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
EvaluationSeriesContext,
55
EvaluationSeriesData,
66
Hook,
7-
IdentifyResult,
87
IdentifySeriesContext,
98
IdentifySeriesData,
9+
IdentifySeriesResult,
1010
} from './api/integrations/Hooks';
1111
import { LDEvaluationDetail } from './api/LDEvaluationDetail';
1212

@@ -97,7 +97,7 @@ function executeAfterIdentify(
9797
hooks: Hook[],
9898
hookContext: IdentifySeriesContext,
9999
updatedData: IdentifySeriesData[],
100-
result: IdentifyResult,
100+
result: IdentifySeriesResult,
101101
) {
102102
// This iterates in reverse, versus reversing a shallow copy of the hooks,
103103
// for efficiency.
@@ -146,7 +146,10 @@ export default class HookRunner {
146146
return result;
147147
}
148148

149-
identify(context: LDContext, timeout: number | undefined): (result: IdentifyResult) => void {
149+
identify(
150+
context: LDContext,
151+
timeout: number | undefined,
152+
): (result: IdentifySeriesResult) => void {
150153
const hooks: Hook[] = [...this.hooks];
151154
const hookContext: IdentifySeriesContext = {
152155
context,

packages/shared/sdk-client/src/api/integrations/Hooks.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ export interface IdentifySeriesData {
5959
/**
6060
* The status an identify operation completed with.
6161
*/
62-
export type IdentifyStatus = 'completed' | 'error';
62+
export type IdentifySeriesStatus = 'completed' | 'error';
6363

6464
/**
6565
* The result applies to a single identify operation. An operation may complete
6666
* with an error and then later complete successfully. Only the first completion
6767
* will be executed in the evaluation series.
6868
*/
69-
export interface IdentifyResult {
70-
status: IdentifyStatus;
69+
export interface IdentifySeriesResult {
70+
status: IdentifySeriesStatus;
7171
}
7272

7373
/**
@@ -157,6 +157,6 @@ export interface Hook {
157157
afterIdentify?(
158158
hookContext: IdentifySeriesContext,
159159
data: IdentifySeriesData,
160-
result: IdentifyResult,
160+
result: IdentifySeriesResult,
161161
): IdentifySeriesData;
162162
}

packages/shared/sdk-client/src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ export type {
2020
LDOptions,
2121
ConnectionMode,
2222
LDIdentifyOptions,
23+
Hook,
24+
HookMetadata,
25+
EvaluationSeriesContext,
26+
EvaluationSeriesData,
27+
IdentifySeriesContext,
28+
IdentifySeriesData,
29+
IdentifySeriesResult,
30+
IdentifySeriesStatus,
2331
} from './api';
2432

2533
export type { DataManager, DataManagerFactory, ConnectionParams } from './DataManager';

0 commit comments

Comments
 (0)