@univerjs/network 0.1.6 → 0.1.8

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/lib/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.defineProperty;var U=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>(U(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@univerjs/core"),d=require("rxjs"),b=require("rxjs/operators"),_=require("@wendellhu/redi"),E="application/json";class f{constructor(t){h(this,"_headers",new Map);typeof t=="string"?t.split(`
2
- `).forEach(n=>{const[r,s]=n.split(":");r&&s&&this._setHeader(r,s)}):t&&Object.keys(t).forEach(([n,r])=>{this._setHeader(n,r)})}forEach(t){this._headers.forEach((n,r)=>t(r,n))}has(t){return!!this._headers.has(t.toLowerCase())}get(t){const n=t.toLowerCase();return this._headers.has(n)?this._headers.get(n):null}_setHeader(t,n){const r=t.toLowerCase();this._headers.has(r)?this._headers.get(r).push(n.toString()):this._headers.set(r,[n.toString()])}}const L=_.createIdentifier("network.http-implementation");class O{constructor(t){this.params=t}toString(){return this.params?Object.keys(this.params).map(t=>`${t}=${this.params[t]}`).join("&"):""}}let M=0;class q{constructor(t,n,r){h(this,"uid",M++);this.method=t,this.url=n,this.requestParams=r}get headers(){return this.requestParams.headers}get withCredentials(){return this.requestParams.withCredentials}get responseType(){return this.requestParams.responseType}getUrlWithParams(){var n,r;const t=(r=(n=this.requestParams)==null?void 0:n.params)==null?void 0:r.toString();return t?`${this.url}${this.url.includes("?")?"&":"?"}${t}`:this.url}getBody(){var r,s;const t=(r=this.headers.get("Content-Type"))!=null?r:E,n=(s=this.requestParams)==null?void 0:s.body;return t===E&&n&&typeof n=="object"?JSON.stringify(n):n?`${n}`:null}}class w{constructor({body:t,headers:n,status:r,statusText:s}){h(this,"body");h(this,"headers");h(this,"status");h(this,"statusText");this.body=t,this.headers=n,this.status=r,this.statusText=s}}class u{constructor({headers:t,status:n,statusText:r,error:s}){h(this,"headers");h(this,"status");h(this,"statusText");h(this,"error");this.headers=t,this.status=n,this.statusText=r,this.error=s}}class F{constructor(t,n,r){this.headers=t,this.status=n,this.statusText=r}}var k=Object.defineProperty,D=Object.getOwnPropertyDescriptor,j=(e,t,n,r)=>{for(var s=r>1?void 0:r?D(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(r?i(t,n,s):i(s))||s);return r&&s&&k(t,n,s),s},$=(e,t)=>(n,r)=>t(n,r,e);exports.HTTPService=class extends y.Disposable{constructor(n){super();h(this,"_interceptors",[]);h(this,"_pipe");this._http=n}registerHTTPInterceptor(n){if(this._interceptors.indexOf(n)!==-1)throw new Error("[HTTPService]: The interceptor has already been registered!");return this._interceptors.push(n),this._interceptors=this._interceptors.sort((r,s)=>{var o,i;return((o=r.priority)!=null?o:0)-((i=s.priority)!=null?i:0)}),this._pipe=null,y.toDisposable(()=>y.remove(this._interceptors,n))}get(n,r){return this._request("GET",n,r)}post(n,r){return this._request("POST",n,r)}put(n,r){return this._request("PUT",n,r)}delete(n,r){return this._request("DELETE",n,r)}async _request(n,r,s){var p,v;const o=new f(s==null?void 0:s.headers),i=new O(s==null?void 0:s.params),c=new q(n,r,{headers:o,params:i,withCredentials:(p=s==null?void 0:s.withCredentials)!=null?p:!1,responseType:(v=s==null?void 0:s.responseType)!=null?v:"json",body:n==="GET"||s==null?void 0:s.body}),a=d.of(c).pipe(b.concatMap(m=>this._runInterceptorsAndImplementation(m))),l=await d.firstValueFrom(a);if(l instanceof w)return l;throw new Error(`${l.error}`)}_runInterceptorsAndImplementation(n){return this._pipe||(this._pipe=this._interceptors.map(r=>r.interceptor).reduceRight((r,s)=>B(r,s),(r,s)=>s(r))),this._pipe(n,r=>this._http.send(r))}};exports.HTTPService=j([$(0,L)],exports.HTTPService);function B(e,t){return(n,r)=>t(n,s=>e(s,r))}const G=200,V=300;var x=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(x||{});class W{send(t){return new d.Observable(n=>{const r=new XMLHttpRequest;r.open(t.method,t.getUrlWithParams()),t.withCredentials&&(r.withCredentials=!0),t.headers.forEach((a,l)=>r.setRequestHeader(a,l.join(","))),t.headers.has("Accept")||r.setRequestHeader("Accept","application/json, text/plain, */*"),t.headers.has("Content-Type")||r.setRequestHeader("Content-Type","application/json;charset=UTF-8");const s=()=>{const a=r.statusText||"OK",l=new f(r.getAllResponseHeaders());return new F(l,r.status,a)},o=()=>{const{headers:a,statusText:l,status:p}=s(),{responseType:v}=t;let m=null,g=null;p!==x.NoContent&&(m=typeof r.response>"u"?r.responseText:r.response);let R=p>=G&&p<V;if(v==="json"&&typeof m=="string"){const I=m;try{m=m?JSON.parse(m):null}catch(N){R=!1,m=I,g=N}}R?n.next(new w({body:m,headers:a,status:p,statusText:l})):n.next(new u({error:g,headers:a,status:p,statusText:l}))},i=a=>{const l=new u({error:a,status:r.status||0,statusText:r.statusText||"Unknown Error",headers:s().headers});n.next(l)};r.addEventListener("load",o),r.addEventListener("error",i),r.addEventListener("abort",i),r.addEventListener("timeout",i);const c=t.getBody();return r.send(c),()=>{r.readyState!==r.DONE&&r.abort(),r.removeEventListener("load",o),r.removeEventListener("error",i),r.removeEventListener("abort",i),r.removeEventListener("timeout",i)}})}}const X=_.createIdentifier("univer.socket");class z extends y.Disposable{createSocket(t){try{const n=new WebSocket(t),r=new y.DisposableCollection;return{URL:t,close:(o,i)=>{n.close(o,i),r.dispose()},send:o=>{n.send(o)},open$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("open",i),r.add(y.toDisposable(()=>n.removeEventListener("open",i)))}).pipe(b.share()),close$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("close",i),r.add(y.toDisposable(()=>n.removeEventListener("close",i)))}).pipe(b.share()),error$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("error",i),r.add(y.toDisposable(()=>n.removeEventListener("error",i)))}).pipe(b.share()),message$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("message",i),r.add(y.toDisposable(()=>n.removeEventListener("message",i)))}).pipe(b.share())}}catch(n){return console.error(n),null}}}const J=2,Y=1e3,K=(e,t)=>t(e).pipe(b.retryWhen(n=>n.pipe(b.concatMap((r,s)=>s>J?d.throwError(r):d.of(r)),d.delay(Y)))),Q=(e,t)=>{const n=[],r=new Set,s=()=>{var o;for(;r.size<((o=t==null?void 0:t.maxParallel)!=null?o:1)&&n.length>0;){const i=n.shift();r.add(i),i()}};return(o,i)=>new d.Observable(c=>{const a=()=>i(o).subscribe({next:p=>c.next(p),error:p=>c.next(p),complete:()=>c.complete()}),l=()=>{r.delete(a),y.remove(n,a),s()};return n.push(a),s(),l})};exports.HTTPHeaders=f;exports.HTTPRequest=q;exports.HTTPResponse=w;exports.IHTTPImplementation=L;exports.ISocketService=X;exports.ThresholdInterceptorFactory=Q;exports.WebSocketService=z;exports.XHRHTTPImplementation=W;exports.retryInterceptor=K;
1
+ "use strict";var A=Object.defineProperty;var U=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>(U(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@univerjs/core"),d=require("rxjs"),b=require("rxjs/operators"),_=require("@wendellhu/redi"),u="application/json";class w{constructor(t){h(this,"_headers",new Map);typeof t=="string"?t.split(`
2
+ `).forEach(n=>{const[r,s]=n.split(":");r&&s&&this._setHeader(r,s)}):t&&Object.keys(t).forEach(([n,r])=>{this._setHeader(n,r)})}forEach(t){this._headers.forEach((n,r)=>t(r,n))}has(t){return!!this._headers.has(t.toLowerCase())}get(t){const n=t.toLowerCase();return this._headers.has(n)?this._headers.get(n):null}_setHeader(t,n){const r=t.toLowerCase();this._headers.has(r)?this._headers.get(r).push(n.toString()):this._headers.set(r,[n.toString()])}}const L=_.createIdentifier("network.http-implementation");class O{constructor(t){this.params=t}toString(){return this.params?Object.keys(this.params).map(t=>`${t}=${this.params[t]}`).join("&"):""}}let M=0;class q{constructor(t,n,r){h(this,"uid",M++);this.method=t,this.url=n,this.requestParams=r}get headers(){return this.requestParams.headers}get withCredentials(){return this.requestParams.withCredentials}get responseType(){return this.requestParams.responseType}getUrlWithParams(){var n,r;const t=(r=(n=this.requestParams)==null?void 0:n.params)==null?void 0:r.toString();return t?`${this.url}${this.url.includes("?")?"&":"?"}${t}`:this.url}getBody(){var r,s;const t=(r=this.headers.get("Content-Type"))!=null?r:u,n=(s=this.requestParams)==null?void 0:s.body;return t===u&&n&&typeof n=="object"?JSON.stringify(n):n?`${n}`:null}}class g{constructor({body:t,headers:n,status:r,statusText:s}){h(this,"body");h(this,"headers");h(this,"status");h(this,"statusText");this.body=t,this.headers=n,this.status=r,this.statusText=s}}class f{constructor({headers:t,status:n,statusText:r,error:s}){h(this,"headers");h(this,"status");h(this,"statusText");h(this,"error");this.headers=t,this.status=n,this.statusText=r,this.error=s}}class F{constructor(t,n,r){this.headers=t,this.status=n,this.statusText=r}}var k=Object.defineProperty,D=Object.getOwnPropertyDescriptor,j=(e,t,n,r)=>{for(var s=r>1?void 0:r?D(t,n):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(r?i(t,n,s):i(s))||s);return r&&s&&k(t,n,s),s},$=(e,t)=>(n,r)=>t(n,r,e);exports.HTTPService=class extends y.Disposable{constructor(n){super();h(this,"_interceptors",[]);h(this,"_pipe");this._http=n}registerHTTPInterceptor(n){if(this._interceptors.indexOf(n)!==-1)throw new Error("[HTTPService]: The interceptor has already been registered!");return this._interceptors.push(n),this._interceptors=this._interceptors.sort((r,s)=>{var o,i;return((o=r.priority)!=null?o:0)-((i=s.priority)!=null?i:0)}),this._pipe=null,y.toDisposable(()=>y.remove(this._interceptors,n))}get(n,r){return this._request("GET",n,r)}post(n,r){return this._request("POST",n,r)}put(n,r){return this._request("PUT",n,r)}delete(n,r){return this._request("DELETE",n,r)}async _request(n,r,s){var p,v;const o=new w(s==null?void 0:s.headers),i=new O(s==null?void 0:s.params),c=new q(n,r,{headers:o,params:i,withCredentials:(p=s==null?void 0:s.withCredentials)!=null?p:!1,responseType:(v=s==null?void 0:s.responseType)!=null?v:"json",body:n==="GET"||s==null?void 0:s.body}),a=d.of(c).pipe(b.concatMap(m=>this._runInterceptorsAndImplementation(m))),l=await d.firstValueFrom(a);if(l instanceof g)return l;throw new Error(`${l.error}`)}_runInterceptorsAndImplementation(n){return this._pipe||(this._pipe=this._interceptors.map(r=>r.interceptor).reduceRight((r,s)=>B(r,s),(r,s)=>s(r))),this._pipe(n,r=>this._http.send(r))}};exports.HTTPService=j([$(0,L)],exports.HTTPService);function B(e,t){return(n,r)=>t(n,s=>e(s,r))}const G=200,V=300;var x=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(x||{});class W{send(t){return new d.Observable(n=>{const r=new XMLHttpRequest;r.open(t.method,t.getUrlWithParams()),t.withCredentials&&(r.withCredentials=!0),t.headers.forEach((a,l)=>r.setRequestHeader(a,l.join(","))),t.headers.has("Accept")||r.setRequestHeader("Accept","application/json, text/plain, */*"),t.headers.has("Content-Type")||r.setRequestHeader("Content-Type","application/json;charset=UTF-8");const s=()=>{const a=r.statusText||"OK",l=new w(r.getAllResponseHeaders());return new F(l,r.status,a)},o=()=>{const{headers:a,statusText:l,status:p}=s(),{responseType:v}=t;let m=null,R=null;p!==x.NoContent&&(m=typeof r.response>"u"?r.responseText:r.response);let E=p>=G&&p<V;if(v==="json"&&typeof m=="string"){const I=m;try{m=m?JSON.parse(m):null}catch(N){E=!1,m=I,R=N}}E?n.next(new g({body:m,headers:a,status:p,statusText:l})):n.next(new f({error:R,headers:a,status:p,statusText:l}))},i=a=>{const l=new f({error:a,status:r.status||0,statusText:r.statusText||"Unknown Error",headers:s().headers});n.next(l)};r.addEventListener("load",o),r.addEventListener("error",i),r.addEventListener("abort",i),r.addEventListener("timeout",i);const c=t.getBody();return r.send(c),()=>{r.readyState!==r.DONE&&r.abort(),r.removeEventListener("load",o),r.removeEventListener("error",i),r.removeEventListener("abort",i),r.removeEventListener("timeout",i)}})}}const X=_.createIdentifier("univer.socket");class z extends y.Disposable{createSocket(t){try{const n=new WebSocket(t),r=new y.DisposableCollection;return{URL:t,close:(o,i)=>{n.close(o,i),r.dispose()},send:o=>{n.send(o)},open$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("open",i),r.add(y.toDisposable(()=>n.removeEventListener("open",i)))}).pipe(b.share()),close$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("close",i),r.add(y.toDisposable(()=>n.removeEventListener("close",i)))}).pipe(b.share()),error$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("error",i),r.add(y.toDisposable(()=>n.removeEventListener("error",i)))}).pipe(b.share()),message$:new d.Observable(o=>{const i=c=>o.next(c);n.addEventListener("message",i),r.add(y.toDisposable(()=>n.removeEventListener("message",i)))}).pipe(b.share())}}catch(n){return console.error(n),null}}}const J=2,Y=1e3,K=(e,t)=>t(e).pipe(b.retryWhen(n=>n.pipe(b.concatMap((r,s)=>s>J?d.throwError(r):d.of(r)),d.delay(Y)))),Q=(e,t)=>{const n=[],r=new Set,s=()=>{var o;for(;r.size<((o=t==null?void 0:t.maxParallel)!=null?o:1)&&n.length>0;){const i=n.shift();r.add(i),i()}};return(o,i)=>new d.Observable(c=>{const a=()=>i(o).subscribe({next:p=>c.next(p),error:p=>c.next(p),complete:()=>c.complete()}),l=()=>{r.delete(a),y.remove(n,a),s()};return n.push(a),s(),l})};exports.HTTPHeaders=w;exports.HTTPRequest=q;exports.HTTPResponse=g;exports.HTTPResponseError=f;exports.IHTTPImplementation=L;exports.ISocketService=X;exports.ThresholdInterceptorFactory=Q;exports.WebSocketService=z;exports.XHRHTTPImplementation=W;exports.retryInterceptor=K;
package/lib/es/index.js CHANGED
@@ -292,6 +292,7 @@ export {
292
292
  N as HTTPHeaders,
293
293
  z as HTTPRequest,
294
294
  A as HTTPResponse,
295
+ R as HTTPResponseError,
295
296
  _ as HTTPService,
296
297
  G as IHTTPImplementation,
297
298
  se as ISocketService,
@@ -17,8 +17,8 @@ export { HTTPHeaders } from './services/http/headers';
17
17
  export { HTTPService } from './services/http/http.service';
18
18
  export { IHTTPImplementation } from './services/http/implementations/implementation';
19
19
  export { XHRHTTPImplementation } from './services/http/implementations/xhr';
20
- export { HTTPRequest } from './services/http/request';
21
- export { HTTPResponse } from './services/http/response';
20
+ export { HTTPRequest, type HTTPRequestMethod } from './services/http/request';
21
+ export { HTTPResponse, type HTTPEvent, HTTPResponseError } from './services/http/response';
22
22
  export { type ISocket, ISocketService, type SocketBodyType, WebSocketService, } from './services/web-socket/web-socket.service';
23
23
  export type { IRequestParams, IPostRequestParams } from './services/http/http.service';
24
24
  export type { HTTPHandlerFn, HTTPInterceptorFn, HTTPInterceptorFnFactory } from './services/http/interceptor';
package/lib/umd/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(c,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs","rxjs/operators","@wendellhu/redi"],a):(c=typeof globalThis<"u"?globalThis:c||self,a(c.UniverNetwork={},c.UniverCore,c.rxjs,c.rxjs.operators,c["@wendellhu/redi"]))})(this,function(c,a,l,v,R){"use strict";var Q=Object.defineProperty;var Z=(c,a,l)=>a in c?Q(c,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):c[a]=l;var m=(c,a,l)=>(Z(c,typeof a!="symbol"?a+"":a,l),l);const g="application/json";class b{constructor(t){m(this,"_headers",new Map);typeof t=="string"?t.split(`
2
- `).forEach(n=>{const[r,i]=n.split(":");r&&i&&this._setHeader(r,i)}):t&&Object.keys(t).forEach(([n,r])=>{this._setHeader(n,r)})}forEach(t){this._headers.forEach((n,r)=>t(r,n))}has(t){return!!this._headers.has(t.toLowerCase())}get(t){const n=t.toLowerCase();return this._headers.has(n)?this._headers.get(n):null}_setHeader(t,n){const r=t.toLowerCase();this._headers.has(r)?this._headers.get(r).push(n.toString()):this._headers.set(r,[n.toString()])}}const E=R.createIdentifier("network.http-implementation");class A{constructor(t){this.params=t}toString(){return this.params?Object.keys(this.params).map(t=>`${t}=${this.params[t]}`).join("&"):""}}let U=0;class _{constructor(t,n,r){m(this,"uid",U++);this.method=t,this.url=n,this.requestParams=r}get headers(){return this.requestParams.headers}get withCredentials(){return this.requestParams.withCredentials}get responseType(){return this.requestParams.responseType}getUrlWithParams(){var n,r;const t=(r=(n=this.requestParams)==null?void 0:n.params)==null?void 0:r.toString();return t?`${this.url}${this.url.includes("?")?"&":"?"}${t}`:this.url}getBody(){var r,i;const t=(r=this.headers.get("Content-Type"))!=null?r:g,n=(i=this.requestParams)==null?void 0:i.body;return t===g&&n&&typeof n=="object"?JSON.stringify(n):n?`${n}`:null}}class u{constructor({body:t,headers:n,status:r,statusText:i}){m(this,"body");m(this,"headers");m(this,"status");m(this,"statusText");this.body=t,this.headers=n,this.status=r,this.statusText=i}}class L{constructor({headers:t,status:n,statusText:r,error:i}){m(this,"headers");m(this,"status");m(this,"statusText");m(this,"error");this.headers=t,this.status=n,this.statusText=r,this.error=i}}class O{constructor(t,n,r){this.headers=t,this.status=n,this.statusText=r}}var M=Object.defineProperty,x=Object.getOwnPropertyDescriptor,F=(e,t,n,r)=>{for(var i=r>1?void 0:r?x(t,n):t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=(r?s(t,n,i):s(i))||i);return r&&i&&M(t,n,i),i},k=(e,t)=>(n,r)=>t(n,r,e);c.HTTPService=class extends a.Disposable{constructor(n){super();m(this,"_interceptors",[]);m(this,"_pipe");this._http=n}registerHTTPInterceptor(n){if(this._interceptors.indexOf(n)!==-1)throw new Error("[HTTPService]: The interceptor has already been registered!");return this._interceptors.push(n),this._interceptors=this._interceptors.sort((r,i)=>{var o,s;return((o=r.priority)!=null?o:0)-((s=i.priority)!=null?s:0)}),this._pipe=null,a.toDisposable(()=>a.remove(this._interceptors,n))}get(n,r){return this._request("GET",n,r)}post(n,r){return this._request("POST",n,r)}put(n,r){return this._request("PUT",n,r)}delete(n,r){return this._request("DELETE",n,r)}async _request(n,r,i){var y,w;const o=new b(i==null?void 0:i.headers),s=new A(i==null?void 0:i.params),h=new _(n,r,{headers:o,params:s,withCredentials:(y=i==null?void 0:i.withCredentials)!=null?y:!1,responseType:(w=i==null?void 0:i.responseType)!=null?w:"json",body:n==="GET"||i==null?void 0:i.body}),p=l.of(h).pipe(v.concatMap(f=>this._runInterceptorsAndImplementation(f))),d=await l.firstValueFrom(p);if(d instanceof u)return d;throw new Error(`${d.error}`)}_runInterceptorsAndImplementation(n){return this._pipe||(this._pipe=this._interceptors.map(r=>r.interceptor).reduceRight((r,i)=>D(r,i),(r,i)=>i(r))),this._pipe(n,r=>this._http.send(r))}},c.HTTPService=F([k(0,E)],c.HTTPService);function D(e,t){return(n,r)=>t(n,i=>e(i,r))}const j=200,$=300;var q=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(q||{});class B{send(t){return new l.Observable(n=>{const r=new XMLHttpRequest;r.open(t.method,t.getUrlWithParams()),t.withCredentials&&(r.withCredentials=!0),t.headers.forEach((p,d)=>r.setRequestHeader(p,d.join(","))),t.headers.has("Accept")||r.setRequestHeader("Accept","application/json, text/plain, */*"),t.headers.has("Content-Type")||r.setRequestHeader("Content-Type","application/json;charset=UTF-8");const i=()=>{const p=r.statusText||"OK",d=new b(r.getAllResponseHeaders());return new O(d,r.status,p)},o=()=>{const{headers:p,statusText:d,status:y}=i(),{responseType:w}=t;let f=null,I=null;y!==q.NoContent&&(f=typeof r.response>"u"?r.responseText:r.response);let N=y>=j&&y<$;if(w==="json"&&typeof f=="string"){const Y=f;try{f=f?JSON.parse(f):null}catch(K){N=!1,f=Y,I=K}}N?n.next(new u({body:f,headers:p,status:y,statusText:d})):n.next(new L({error:I,headers:p,status:y,statusText:d}))},s=p=>{const d=new L({error:p,status:r.status||0,statusText:r.statusText||"Unknown Error",headers:i().headers});n.next(d)};r.addEventListener("load",o),r.addEventListener("error",s),r.addEventListener("abort",s),r.addEventListener("timeout",s);const h=t.getBody();return r.send(h),()=>{r.readyState!==r.DONE&&r.abort(),r.removeEventListener("load",o),r.removeEventListener("error",s),r.removeEventListener("abort",s),r.removeEventListener("timeout",s)}})}}const G=R.createIdentifier("univer.socket");class V extends a.Disposable{createSocket(t){try{const n=new WebSocket(t),r=new a.DisposableCollection;return{URL:t,close:(o,s)=>{n.close(o,s),r.dispose()},send:o=>{n.send(o)},open$:new l.Observable(o=>{const s=h=>o.next(h);n.addEventListener("open",s),r.add(a.toDisposable(()=>n.removeEventListener("open",s)))}).pipe(v.share()),close$:new l.Observable(o=>{const s=h=>o.next(h);n.addEventListener("close",s),r.add(a.toDisposable(()=>n.removeEventListener("close",s)))}).pipe(v.share()),error$:new l.Observable(o=>{const s=h=>o.next(h);n.addEventListener("error",s),r.add(a.toDisposable(()=>n.removeEventListener("error",s)))}).pipe(v.share()),message$:new l.Observable(o=>{const s=h=>o.next(h);n.addEventListener("message",s),r.add(a.toDisposable(()=>n.removeEventListener("message",s)))}).pipe(v.share())}}catch(n){return console.error(n),null}}}const W=2,X=1e3,z=(e,t)=>t(e).pipe(v.retryWhen(n=>n.pipe(v.concatMap((r,i)=>i>W?l.throwError(r):l.of(r)),l.delay(X)))),J=(e,t)=>{const n=[],r=new Set,i=()=>{var o;for(;r.size<((o=t==null?void 0:t.maxParallel)!=null?o:1)&&n.length>0;){const s=n.shift();r.add(s),s()}};return(o,s)=>new l.Observable(h=>{const p=()=>s(o).subscribe({next:y=>h.next(y),error:y=>h.next(y),complete:()=>h.complete()}),d=()=>{r.delete(p),a.remove(n,p),i()};return n.push(p),i(),d})};c.HTTPHeaders=b,c.HTTPRequest=_,c.HTTPResponse=u,c.IHTTPImplementation=E,c.ISocketService=G,c.ThresholdInterceptorFactory=J,c.WebSocketService=V,c.XHRHTTPImplementation=B,c.retryInterceptor=z,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(o,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs","rxjs/operators","@wendellhu/redi"],a):(o=typeof globalThis<"u"?globalThis:o||self,a(o.UniverNetwork={},o.UniverCore,o.rxjs,o.rxjs.operators,o["@wendellhu/redi"]))})(this,function(o,a,l,v,E){"use strict";var Q=Object.defineProperty;var Z=(o,a,l)=>a in o?Q(o,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[a]=l;var m=(o,a,l)=>(Z(o,typeof a!="symbol"?a+"":a,l),l);const g="application/json";class b{constructor(t){m(this,"_headers",new Map);typeof t=="string"?t.split(`
2
+ `).forEach(n=>{const[r,i]=n.split(":");r&&i&&this._setHeader(r,i)}):t&&Object.keys(t).forEach(([n,r])=>{this._setHeader(n,r)})}forEach(t){this._headers.forEach((n,r)=>t(r,n))}has(t){return!!this._headers.has(t.toLowerCase())}get(t){const n=t.toLowerCase();return this._headers.has(n)?this._headers.get(n):null}_setHeader(t,n){const r=t.toLowerCase();this._headers.has(r)?this._headers.get(r).push(n.toString()):this._headers.set(r,[n.toString()])}}const _=E.createIdentifier("network.http-implementation");class A{constructor(t){this.params=t}toString(){return this.params?Object.keys(this.params).map(t=>`${t}=${this.params[t]}`).join("&"):""}}let U=0;class L{constructor(t,n,r){m(this,"uid",U++);this.method=t,this.url=n,this.requestParams=r}get headers(){return this.requestParams.headers}get withCredentials(){return this.requestParams.withCredentials}get responseType(){return this.requestParams.responseType}getUrlWithParams(){var n,r;const t=(r=(n=this.requestParams)==null?void 0:n.params)==null?void 0:r.toString();return t?`${this.url}${this.url.includes("?")?"&":"?"}${t}`:this.url}getBody(){var r,i;const t=(r=this.headers.get("Content-Type"))!=null?r:g,n=(i=this.requestParams)==null?void 0:i.body;return t===g&&n&&typeof n=="object"?JSON.stringify(n):n?`${n}`:null}}class u{constructor({body:t,headers:n,status:r,statusText:i}){m(this,"body");m(this,"headers");m(this,"status");m(this,"statusText");this.body=t,this.headers=n,this.status=r,this.statusText=i}}class R{constructor({headers:t,status:n,statusText:r,error:i}){m(this,"headers");m(this,"status");m(this,"statusText");m(this,"error");this.headers=t,this.status=n,this.statusText=r,this.error=i}}class O{constructor(t,n,r){this.headers=t,this.status=n,this.statusText=r}}var M=Object.defineProperty,x=Object.getOwnPropertyDescriptor,F=(e,t,n,r)=>{for(var i=r>1?void 0:r?x(t,n):t,c=e.length-1,s;c>=0;c--)(s=e[c])&&(i=(r?s(t,n,i):s(i))||i);return r&&i&&M(t,n,i),i},k=(e,t)=>(n,r)=>t(n,r,e);o.HTTPService=class extends a.Disposable{constructor(n){super();m(this,"_interceptors",[]);m(this,"_pipe");this._http=n}registerHTTPInterceptor(n){if(this._interceptors.indexOf(n)!==-1)throw new Error("[HTTPService]: The interceptor has already been registered!");return this._interceptors.push(n),this._interceptors=this._interceptors.sort((r,i)=>{var c,s;return((c=r.priority)!=null?c:0)-((s=i.priority)!=null?s:0)}),this._pipe=null,a.toDisposable(()=>a.remove(this._interceptors,n))}get(n,r){return this._request("GET",n,r)}post(n,r){return this._request("POST",n,r)}put(n,r){return this._request("PUT",n,r)}delete(n,r){return this._request("DELETE",n,r)}async _request(n,r,i){var y,w;const c=new b(i==null?void 0:i.headers),s=new A(i==null?void 0:i.params),h=new L(n,r,{headers:c,params:s,withCredentials:(y=i==null?void 0:i.withCredentials)!=null?y:!1,responseType:(w=i==null?void 0:i.responseType)!=null?w:"json",body:n==="GET"||i==null?void 0:i.body}),p=l.of(h).pipe(v.concatMap(f=>this._runInterceptorsAndImplementation(f))),d=await l.firstValueFrom(p);if(d instanceof u)return d;throw new Error(`${d.error}`)}_runInterceptorsAndImplementation(n){return this._pipe||(this._pipe=this._interceptors.map(r=>r.interceptor).reduceRight((r,i)=>D(r,i),(r,i)=>i(r))),this._pipe(n,r=>this._http.send(r))}},o.HTTPService=F([k(0,_)],o.HTTPService);function D(e,t){return(n,r)=>t(n,i=>e(i,r))}const j=200,$=300;var q=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(q||{});class B{send(t){return new l.Observable(n=>{const r=new XMLHttpRequest;r.open(t.method,t.getUrlWithParams()),t.withCredentials&&(r.withCredentials=!0),t.headers.forEach((p,d)=>r.setRequestHeader(p,d.join(","))),t.headers.has("Accept")||r.setRequestHeader("Accept","application/json, text/plain, */*"),t.headers.has("Content-Type")||r.setRequestHeader("Content-Type","application/json;charset=UTF-8");const i=()=>{const p=r.statusText||"OK",d=new b(r.getAllResponseHeaders());return new O(d,r.status,p)},c=()=>{const{headers:p,statusText:d,status:y}=i(),{responseType:w}=t;let f=null,I=null;y!==q.NoContent&&(f=typeof r.response>"u"?r.responseText:r.response);let N=y>=j&&y<$;if(w==="json"&&typeof f=="string"){const Y=f;try{f=f?JSON.parse(f):null}catch(K){N=!1,f=Y,I=K}}N?n.next(new u({body:f,headers:p,status:y,statusText:d})):n.next(new R({error:I,headers:p,status:y,statusText:d}))},s=p=>{const d=new R({error:p,status:r.status||0,statusText:r.statusText||"Unknown Error",headers:i().headers});n.next(d)};r.addEventListener("load",c),r.addEventListener("error",s),r.addEventListener("abort",s),r.addEventListener("timeout",s);const h=t.getBody();return r.send(h),()=>{r.readyState!==r.DONE&&r.abort(),r.removeEventListener("load",c),r.removeEventListener("error",s),r.removeEventListener("abort",s),r.removeEventListener("timeout",s)}})}}const G=E.createIdentifier("univer.socket");class V extends a.Disposable{createSocket(t){try{const n=new WebSocket(t),r=new a.DisposableCollection;return{URL:t,close:(c,s)=>{n.close(c,s),r.dispose()},send:c=>{n.send(c)},open$:new l.Observable(c=>{const s=h=>c.next(h);n.addEventListener("open",s),r.add(a.toDisposable(()=>n.removeEventListener("open",s)))}).pipe(v.share()),close$:new l.Observable(c=>{const s=h=>c.next(h);n.addEventListener("close",s),r.add(a.toDisposable(()=>n.removeEventListener("close",s)))}).pipe(v.share()),error$:new l.Observable(c=>{const s=h=>c.next(h);n.addEventListener("error",s),r.add(a.toDisposable(()=>n.removeEventListener("error",s)))}).pipe(v.share()),message$:new l.Observable(c=>{const s=h=>c.next(h);n.addEventListener("message",s),r.add(a.toDisposable(()=>n.removeEventListener("message",s)))}).pipe(v.share())}}catch(n){return console.error(n),null}}}const W=2,X=1e3,z=(e,t)=>t(e).pipe(v.retryWhen(n=>n.pipe(v.concatMap((r,i)=>i>W?l.throwError(r):l.of(r)),l.delay(X)))),J=(e,t)=>{const n=[],r=new Set,i=()=>{var c;for(;r.size<((c=t==null?void 0:t.maxParallel)!=null?c:1)&&n.length>0;){const s=n.shift();r.add(s),s()}};return(c,s)=>new l.Observable(h=>{const p=()=>s(c).subscribe({next:y=>h.next(y),error:y=>h.next(y),complete:()=>h.complete()}),d=()=>{r.delete(p),a.remove(n,p),i()};return n.push(p),i(),d})};o.HTTPHeaders=b,o.HTTPRequest=L,o.HTTPResponse=u,o.HTTPResponseError=R,o.IHTTPImplementation=_,o.ISocketService=G,o.ThresholdInterceptorFactory=J,o.WebSocketService=V,o.XHRHTTPImplementation=B,o.retryInterceptor=z,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/network",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "private": false,
5
5
  "author": "DreamNum <developer@univer.ai>",
6
6
  "license": "Apache-2.0",
@@ -49,18 +49,18 @@
49
49
  "npm": ">=8.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@wendellhu/redi": "0.13.0",
52
+ "@wendellhu/redi": "^0.13.3",
53
53
  "rxjs": ">=7.0.0",
54
- "@univerjs/core": "0.1.6"
54
+ "@univerjs/core": "0.1.8"
55
55
  },
56
56
  "devDependencies": {
57
- "@wendellhu/redi": "^0.13.0",
57
+ "@wendellhu/redi": "^0.13.3",
58
58
  "rxjs": "^7.8.1",
59
- "typescript": "^5.4.3",
60
- "vite": "^5.2.7",
61
- "vitest": "^1.4.0",
62
- "@univerjs/core": "0.1.6",
63
- "@univerjs/shared": "0.1.6"
59
+ "typescript": "^5.4.5",
60
+ "vite": "^5.2.10",
61
+ "vitest": "^1.5.0",
62
+ "@univerjs/core": "0.1.8",
63
+ "@univerjs/shared": "0.1.8"
64
64
  },
65
65
  "scripts": {
66
66
  "test": "vitest run",