Add index file. Add prepare script
This commit is contained in:
@@ -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"
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export * from "./types.js";
|
||||||
|
export * from "./sse-session.js";
|
||||||
|
export * from "./sse-event-parser.js";
|
||||||
|
|
||||||
|
export * from "./utils/index.js";
|
||||||
@@ -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
4
src/utils/index.ts
Normal 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";
|
||||||
Reference in New Issue
Block a user