Add index file. Add prepare script

This commit is contained in:
2026-05-24 16:45:29 +02:00
parent ca933de6ce
commit fb64b1b2ea
4 changed files with 15 additions and 3 deletions

View File

@@ -1,11 +1,12 @@
{ {
"name": "ssesession", "name": "sse-session",
"version": "0.0.1", "version": "0.0.1",
"description": "", "description": "",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest" "test:watch": "vitest",
"prepare": "npm run build"
}, },
"files": [ "files": [
"dist" "dist"

View File

@@ -0,0 +1,5 @@
export * from "./types.js";
export * from "./sse-session.js";
export * from "./sse-event-parser.js";
export * from "./utils/index.js";

View File

@@ -411,7 +411,9 @@ export class SSESession extends EventEmitter<SSESessionEventMap> {
const response = await this.options.fetch(this.url, requestOptions); const response = await this.options.fetch(this.url, requestOptions);
if (!response.ok) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`); const responseCode = response.status;
const responseText = await response.text();
throw new Error(`HTTP error! Status: ${responseCode} - ${responseText}`);
} }
if (!response.body) { if (!response.body) {

4
src/utils/index.ts Normal file
View File

@@ -0,0 +1,4 @@
export * from "./async-push-iterator.js";
export * from "./exponential-backoff.js";
export * from "./event-emitter.js";
export * from "./misc.js";