anmo 1.0.1 → 1.0.3

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 (2) hide show
  1. package/index.ts +3 -6
  2. package/package.json +4 -1
package/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { EventSource } from 'eventsource'
2
+
1
3
  /**
2
4
  * Type representing a map of feature flag keys to their enabled state
3
5
  */
@@ -116,11 +118,7 @@ export class AnmoClient {
116
118
  */
117
119
  async getFlags(): Promise<FlagMap> {
118
120
  try {
119
- const response = await fetch(`${this.baseUrl}/api/client/flags`, {
120
- headers: {
121
- "x-api-key": this.apiKey,
122
- },
123
- });
121
+ const response = await fetch(`${this.baseUrl}/api/client/flags?api-key=${this.apiKey}`);
124
122
 
125
123
  if (!response.ok) {
126
124
  const error = (await response
@@ -204,7 +202,6 @@ export class AnmoClient {
204
202
  }
205
203
 
206
204
  const url = `${this.baseUrl}/api/client/stream?api-key=${this.apiKey}`;
207
-
208
205
  this.eventSource = new EventSource(url);
209
206
 
210
207
  this.eventSource.onmessage = (event: Event) => {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "anmo",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "1.0.1",
5
+ "version": "1.0.3",
6
6
  "description": "Official Node.js SDK for Anmo Feature Flags",
7
7
  "files": [
8
8
  "index.ts",
@@ -36,5 +36,8 @@
36
36
  "repository": {
37
37
  "type": "git",
38
38
  "url": "https://github.com/AndrewVos/anmo"
39
+ },
40
+ "dependencies": {
41
+ "eventsource": "^4.1.0"
39
42
  }
40
43
  }