@snail-js/api 0.1.26 → 0.1.27

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
@@ -4576,6 +4576,13 @@ class SnailServer {
4576
4576
  return options;
4577
4577
  }
4578
4578
  createSse(constructor) {
4579
+ const serverVersioning = Reflect.getMetadata(
4580
+ VERSIONING_KEY,
4581
+ this.constructor
4582
+ );
4583
+ if (serverVersioning) {
4584
+ this.Version = serverVersioning.defaultVersion || "";
4585
+ }
4579
4586
  const sseInstance = new constructor(this);
4580
4587
  return sseInstance;
4581
4588
  }
@@ -4747,7 +4754,7 @@ class SnailSse {
4747
4754
  const options = this.getSseOptions();
4748
4755
  const { path, withCredentials, version } = options;
4749
4756
  this._url = resolveUrl(path);
4750
- this._version = version;
4757
+ this._version = version ?? server.version;
4751
4758
  this._withCredentials = withCredentials ? withCredentials : false;
4752
4759
  this.initVersion();
4753
4760
  }
@@ -4810,7 +4817,7 @@ class SnailSse {
4810
4817
  }
4811
4818
  }
4812
4819
  get url() {
4813
- return this._url;
4820
+ return `${this._baseUrl}${this._url}`;
4814
4821
  }
4815
4822
  get eventSource() {
4816
4823
  return this._eventSource;
@@ -4580,6 +4580,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4580
4580
  return options;
4581
4581
  }
4582
4582
  createSse(constructor) {
4583
+ const serverVersioning = Reflect.getMetadata(
4584
+ VERSIONING_KEY,
4585
+ this.constructor
4586
+ );
4587
+ if (serverVersioning) {
4588
+ this.Version = serverVersioning.defaultVersion || "";
4589
+ }
4583
4590
  const sseInstance = new constructor(this);
4584
4591
  return sseInstance;
4585
4592
  }
@@ -4751,7 +4758,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4751
4758
  const options = this.getSseOptions();
4752
4759
  const { path, withCredentials, version } = options;
4753
4760
  this._url = resolveUrl(path);
4754
- this._version = version;
4761
+ this._version = version ?? server.version;
4755
4762
  this._withCredentials = withCredentials ? withCredentials : false;
4756
4763
  this.initVersion();
4757
4764
  }
@@ -4814,7 +4821,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4814
4821
  }
4815
4822
  }
4816
4823
  get url() {
4817
- return this._url;
4824
+ return `${this._baseUrl}${this._url}`;
4818
4825
  }
4819
4826
  get eventSource() {
4820
4827
  return this._eventSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snail-js/api",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Http Request with Decorators Api, build on axios",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",