|
| 1 | +/** |
| 2 | + * This is the API reference for the Fastly LaunchDarkly SDK. |
| 3 | + * |
| 4 | + * In typical usage, you will call {@link init} once per request to obtain an instance of |
| 5 | + * {@link LDClient}, which provides access to all of the SDK's functionality. |
| 6 | + * |
| 7 | + * For more information, see the SDK reference guide. |
| 8 | + * |
| 9 | + * @packageDocumentation |
| 10 | + */ |
1 | 11 | /// <reference types="@fastly/js-compute" /> |
2 | 12 | import { KVStore } from 'fastly:kv-store'; |
3 | 13 |
|
4 | | -import { BasicLogger } from '@launchdarkly/js-server-sdk-common'; |
| 14 | +import { BasicLogger, LDEvaluationReason } from '@launchdarkly/js-server-sdk-common'; |
5 | 15 |
|
6 | 16 | import { EdgeFeatureStore, EdgeProvider, LDClient } from './api'; |
7 | 17 | import { DEFAULT_EVENTS_BACKEND_NAME } from './api/LDClient'; |
8 | 18 | import createPlatformInfo from './createPlatformInfo'; |
9 | | -import validateOptions, { FastlySDKOptions } from './utils/validateOptions'; |
| 19 | +import validateOptions, { FastlySDKOptions, LDOptionsCommon } from './utils/validateOptions'; |
10 | 20 |
|
| 21 | +export type { |
| 22 | + BasicLogger, |
| 23 | + FastlySDKOptions, |
| 24 | + KVStore, |
| 25 | + LDClient, |
| 26 | + LDEvaluationReason, |
| 27 | + LDOptionsCommon, |
| 28 | +}; |
| 29 | + |
| 30 | +/** |
| 31 | + * Creates an instance of the Fastly LaunchDarkly client. |
| 32 | + * |
| 33 | + * Applications should instantiate a single instance for the lifetime of a request. |
| 34 | + * The client will begin attempting to connect to the configured Fastly KV as |
| 35 | + * soon as it is created. To determine when it is ready to use, call {@link LDClient.waitForInitialization}. |
| 36 | + * |
| 37 | + * **Important:** Do **not** try to instantiate `LDClient` with its constructor |
| 38 | + * (`new LDClient()/new LDClientImpl()/new LDClient()`); the SDK does not currently support |
| 39 | + * this. |
| 40 | + * |
| 41 | + * @param clientSideId |
| 42 | + * The client side ID. This is only used to query the kvStore above, |
| 43 | + * not to connect with LaunchDarkly servers. |
| 44 | + * @param kvStore |
| 45 | + * The Fastly KV store configured for LaunchDarkly. |
| 46 | + * @param options |
| 47 | + * Optional {@link FastlySDKOptions | configuration settings}. |
| 48 | + * @return |
| 49 | + * The new {@link LDClient} instance. |
| 50 | + */ |
11 | 51 | export const init = ( |
12 | 52 | clientSideId: string, |
13 | 53 | kvStore: KVStore, |
|
0 commit comments