statsig-node-vercel 0.0.1-beta.2 → 0.0.1-beta.4
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.
- package/EdgeConfigDataAdapter.ts +2 -12
- package/package.json +1 -1
package/EdgeConfigDataAdapter.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { AdapterResponse, IDataAdapter } from 'statsig-node';
|
|
2
2
|
import { get } from '@vercel/edge-config';
|
|
3
3
|
|
|
4
|
-
type Data = {
|
|
5
|
-
dynamic_configs: Record<string, unknown>[];
|
|
6
|
-
feature_gates: Record<string, unknown>[];
|
|
7
|
-
has_updates: boolean;
|
|
8
|
-
id_lists: unknown;
|
|
9
|
-
layer_configs: unknown[];
|
|
10
|
-
layers: unknown;
|
|
11
|
-
time: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
4
|
export class EdgeConfigDataAdapter implements IDataAdapter {
|
|
15
5
|
private configSpecsKey: string;
|
|
16
6
|
private supportConfigSpecPolling: boolean = false;
|
|
@@ -25,7 +15,7 @@ export class EdgeConfigDataAdapter implements IDataAdapter {
|
|
|
25
15
|
return { error: new Error(`Edge Config Adapter Only Supports Config Specs`) };
|
|
26
16
|
}
|
|
27
17
|
|
|
28
|
-
const data = await get
|
|
18
|
+
const data = await get(this.configSpecsKey);
|
|
29
19
|
if (data === undefined) {
|
|
30
20
|
return { error: new Error(`key (${key}) does not exist`) };
|
|
31
21
|
}
|
|
@@ -42,7 +32,7 @@ export class EdgeConfigDataAdapter implements IDataAdapter {
|
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
public async initialize(): Promise<void> {
|
|
45
|
-
const data = await get
|
|
35
|
+
const data = await get(this.configSpecsKey);
|
|
46
36
|
|
|
47
37
|
if (data) {
|
|
48
38
|
this.supportConfigSpecPolling = true;
|