Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion examples/todo-server-tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
"declaration": true,
"noEmitOnError": true,
"verbatimModuleSyntax": false,
// TODO: Remove DOM here!! The Node SDK should not need DOM types.
"lib": ["ESNext", "DOM"],
"types": ["node"],
"paths": {
"featurehub-javascript-node-sdk": ["../../packages/node/src"]
"featurehub-javascript-client-sdk": ["../../packages/js/src"],
"featurehub-javascript-node-sdk": ["../../packages/node/src"],
/*
This is a workaround to bypass Typescript checking of the cross-sha256 package.
The author of the package improperly exported the source .ts file alongside the js file
*/
"cross-sha256": [
"../../node_modules/.pnpm/[email protected]/node_modules/cross-sha256/index.d.ts"
]
}
},
"include": ["src/**/*", "features/**/*"]
Expand Down
1 change: 0 additions & 1 deletion packages/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
"cross-sha256": "^1.2.0",
"murmurhash": "^2.0.1",
"netmask": "^2.0.2",
"restify": "^11.1.0",
"semver-compare": "^1.0.0"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/js/src/featurehub_eventsource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export declare class EventSource {
readonly readyState: number;
readonly withCredentials: boolean;

onopen: (evt: MessageEvent) => any;
onmessage: (evt: MessageEvent) => any;
onerror: (evt: MessageEvent) => any;
onopen?: ((evt: Event) => void) | null;
onmessage?: ((evt: MessageEvent) => void) | null;
onerror?: ((evt: Event) => void) | null;

constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict);

Expand Down
5 changes: 2 additions & 3 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@
"vite": "7.1.10"
},
"dependencies": {
"eventsource": "^2.0.2",
"featurehub-javascript-client-sdk": "^1.4.0",
"restify": "^11.1.0"
"eventsource": "^4.0.0",
"featurehub-javascript-client-sdk": "workspace:*"
},
"engines": {
"node": ">=20.0.0"
Expand Down
6 changes: 2 additions & 4 deletions packages/node/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports */
import { EventSource } from "eventsource";
import {
EdgeFeatureHubConfig,
type FeatureEnvironmentCollection,
Expand All @@ -20,12 +20,10 @@ import {
} from "featurehub-javascript-client-sdk";
import { URL } from "url";

const ES = require("eventsource");

export * from "featurehub-javascript-client-sdk";

FeatureHubEventSourceClient.eventSourceProvider = (url, dict) => {
return new ES(url, dict);
return new EventSource(url, dict);
};

interface PromiseLikeData {
Expand Down
16 changes: 13 additions & 3 deletions packages/node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "featurehub-tsconfig/base.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"noEmitOnError": true,
"verbatimModuleSyntax": false,
"types": ["node"]
// TODO: Remove DOM here!! The Node SDK should not need DOM types. We need to define a core JS package
"lib": ["ESNext", "DOM"],
"types": ["node"],
"paths": {
"featurehub-javascript-client-sdk": ["../js/src"],
/*
This is a workaround to bypass Typescript checking of the cross-sha256 package.
The author of the package improperly exported the source .ts file alongside the js file
*/
"cross-sha256": [
"../../node_modules/.pnpm/[email protected]/node_modules/cross-sha256/index.d.ts"
]
}
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist"]
Expand Down
Loading
Loading