@snail-js/api 0.1.9 → 0.1.11

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/dist/snail-api.js CHANGED
@@ -4143,7 +4143,7 @@ class Snail {
4143
4143
  );
4144
4144
  const sseUrl = this.generateSseUrl(baseURL, versionUrl || url);
4145
4145
  enableLog && console.log("sse-url:", sseUrl);
4146
- return this.initSse(sseUrl, sseOption, target);
4146
+ return () => this.initSse(sseUrl, sseOption, target);
4147
4147
  }
4148
4148
  }
4149
4149
  });
@@ -4164,12 +4164,10 @@ class Snail {
4164
4164
  }
4165
4165
  setSse(target) {
4166
4166
  const onOpenFunc = Reflect.getMetadata(EVENT_SOURCE_OPEN_KEY, target);
4167
- console.log("sse-proxy[open]:", onOpenFunc);
4168
4167
  if (typeof onOpenFunc == "function") {
4169
4168
  this.eventSource && (this.eventSource.onopen = onOpenFunc);
4170
4169
  }
4171
4170
  const onErrorFunc = Reflect.getMetadata(EVENT_SOURCE_ERROR_KEY, target);
4172
- console.log("sse-proxy[error]:", onErrorFunc);
4173
4171
  if (typeof onErrorFunc == "function") {
4174
4172
  this.eventSource && (this.eventSource.onerror = onErrorFunc);
4175
4173
  }
@@ -4147,7 +4147,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4147
4147
  );
4148
4148
  const sseUrl = this.generateSseUrl(baseURL, versionUrl || url);
4149
4149
  enableLog && console.log("sse-url:", sseUrl);
4150
- return this.initSse(sseUrl, sseOption, target);
4150
+ return () => this.initSse(sseUrl, sseOption, target);
4151
4151
  }
4152
4152
  }
4153
4153
  });
@@ -4168,12 +4168,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4168
4168
  }
4169
4169
  setSse(target) {
4170
4170
  const onOpenFunc = Reflect.getMetadata(EVENT_SOURCE_OPEN_KEY, target);
4171
- console.log("sse-proxy[open]:", onOpenFunc);
4172
4171
  if (typeof onOpenFunc == "function") {
4173
4172
  this.eventSource && (this.eventSource.onopen = onOpenFunc);
4174
4173
  }
4175
4174
  const onErrorFunc = Reflect.getMetadata(EVENT_SOURCE_ERROR_KEY, target);
4176
- console.log("sse-proxy[error]:", onErrorFunc);
4177
4175
  if (typeof onErrorFunc == "function") {
4178
4176
  this.eventSource && (this.eventSource.onerror = onErrorFunc);
4179
4177
  }
@@ -1,5 +1,8 @@
1
1
  export type SseProxy<T extends object> = {
2
- [K in keyof T]: T[K] extends (...args: infer A) => any ? () => () => void : T[K];
2
+ [K in keyof T]: T[K] extends (...args: infer A) => any ? () => () => {
3
+ close: () => void;
4
+ eventSource: EventSource;
5
+ } : T[K];
3
6
  };
4
7
  export declare class RegisterSseEvent {
5
8
  eventName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snail-js/api",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Http Request with Decorators Api, build on axios",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",