@univerjs/network 0.1.4 → 0.1.5

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.
@@ -1,24 +1,10 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Observable } from 'rxjs';
17
- import { Disposable } from '@univerjs/core';
18
- import { Injector } from '@wendellhu/redi';
1
+ import { HTTPEvent, HTTPResponse, HTTPResponseError } from '../response';
2
+ import { HTTPRequest } from '../request';
19
3
  import { IHTTPImplementation } from '../implementations/implementation';
20
- import type { HTTPRequest } from '../request';
21
- import type { HTTPEvent, HTTPResponse, HTTPResponseError } from '../response';
4
+ import { Injector } from '@wendellhu/redi';
5
+ import { Disposable } from '@univerjs/core';
6
+ import { Observable } from 'rxjs';
7
+
22
8
  /**
23
9
  * A mocked HTTP implementation service for testing purposes. Besides methods in the interface, it
24
10
  * provides several public methods to control the process of http request.
@@ -1,24 +1,10 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Disposable } from '@univerjs/core';
17
- import type { IDisposable } from '@wendellhu/redi';
18
- import type { HTTPResponseType } from './http';
19
- import { IHTTPImplementation } from './implementations/implementation';
1
+ import { HTTPInterceptorFn } from './interceptor';
20
2
  import { HTTPResponse } from './response';
21
- import type { HTTPInterceptorFn } from './interceptor';
3
+ import { IHTTPImplementation } from './implementations/implementation';
4
+ import { HTTPResponseType } from './http';
5
+ import { IDisposable } from '@wendellhu/redi';
6
+ import { Disposable } from '@univerjs/core';
7
+
22
8
  export interface IRequestParams {
23
9
  /** Query params. These params would be append to the url before the request is sent. */
24
10
  params?: {
@@ -1,21 +1,7 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { Observable } from 'rxjs';
17
- import type { HTTPRequest } from '../request';
18
- import type { HTTPEvent } from '../response';
1
+ import { HTTPEvent } from '../response';
2
+ import { HTTPRequest } from '../request';
3
+ import { Observable } from 'rxjs';
4
+
19
5
  /**
20
6
  * HTTP service could be implemented differently on platforms.
21
7
  */
@@ -26,4 +12,4 @@ export interface IHTTPImplementation {
26
12
  */
27
13
  send(request: HTTPRequest): Observable<HTTPEvent<any>>;
28
14
  }
29
- export declare const IHTTPImplementation: import("@wendellhu/redi").IdentifierDecorator<IHTTPImplementation>;
15
+ export declare const IHTTPImplementation: import('@wendellhu/redi').IdentifierDecorator<IHTTPImplementation>;
@@ -1,22 +1,8 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
1
+ import { IHTTPImplementation } from './implementation';
2
+ import { HTTPEvent } from '../response';
3
+ import { HTTPRequest } from '../request';
16
4
  import { Observable } from 'rxjs';
17
- import type { HTTPRequest } from '../request';
18
- import type { HTTPEvent } from '../response';
19
- import type { IHTTPImplementation } from './implementation';
5
+
20
6
  /**
21
7
  * A HTTP implementation using XHR. HTTP service provided by this service could only be async (we do not support sync XHR now).
22
8
  */
@@ -1,22 +1,8 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { Observable } from 'rxjs';
17
- import type { IAccessor } from '@wendellhu/redi';
18
- import type { HTTPRequest } from './request';
19
- import type { HTTPEvent } from './response';
1
+ import { HTTPEvent } from './response';
2
+ import { HTTPRequest } from './request';
3
+ import { IAccessor } from '@wendellhu/redi';
4
+ import { Observable } from 'rxjs';
5
+
20
6
  export type HTTPHandlerFn = (request: HTTPRequest) => Observable<HTTPEvent<unknown>>;
21
7
  /**
22
8
  * HTTP interceptor function. When the interceptor is called, it would receive a request object and a next function.
@@ -1,17 +1,3 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { HTTPInterceptorFn } from '../interceptor';
1
+ import { HTTPInterceptorFn } from '../interceptor';
2
+
17
3
  export declare const retryInterceptor: HTTPInterceptorFn;
@@ -1,19 +1,5 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { HTTPInterceptorFnFactory } from '../interceptor';
1
+ import { HTTPInterceptorFnFactory } from '../interceptor';
2
+
17
3
  export interface IThresholdInterceptorFactoryParams {
18
4
  maxParallel?: number;
19
5
  }
@@ -1,21 +1,7 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { HTTPHeaders } from './headers';
17
- import type { HTTPResponseType } from './http';
18
- import type { HTTPParams } from './params';
1
+ import { HTTPParams } from './params';
2
+ import { HTTPResponseType } from './http';
3
+ import { HTTPHeaders } from './headers';
4
+
19
5
  export type HTTPRequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
20
6
  export interface IHTTPRequestParams {
21
7
  body?: any;
@@ -1,19 +1,5 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { HTTPHeaders } from './headers';
1
+ import { HTTPHeaders } from './headers';
2
+
17
3
  /**
18
4
  * There are multiple events could be resolved from the HTTP server.
19
5
  */
@@ -1,26 +1,11 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { Nullable } from '@univerjs/core';
17
- import { Disposable } from '@univerjs/core';
18
1
  import { Observable } from 'rxjs';
2
+ import { Nullable, Disposable } from '@univerjs/core';
3
+
19
4
  export type SocketBodyType = string | ArrayBufferLike | Blob | ArrayBufferView;
20
5
  /**
21
6
  * This service is responsible for establishing bidi-directional connection to a remote server.
22
7
  */
23
- export declare const ISocketService: import("@wendellhu/redi").IdentifierDecorator<ISocketService>;
8
+ export declare const ISocketService: import('@wendellhu/redi').IdentifierDecorator<ISocketService>;
24
9
  export interface ISocketService {
25
10
  createSocket(url: string): Nullable<ISocket>;
26
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/network",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "author": "DreamNum <developer@univer.ai>",
6
6
  "license": "Apache-2.0",
@@ -51,17 +51,17 @@
51
51
  "peerDependencies": {
52
52
  "@wendellhu/redi": "0.13.0",
53
53
  "rxjs": ">=7.0.0",
54
- "@univerjs/core": "0.1.4"
54
+ "@univerjs/core": "0.1.5"
55
55
  },
56
56
  "dependencies": {},
57
57
  "devDependencies": {
58
58
  "@wendellhu/redi": "^0.13.0",
59
59
  "rxjs": "^7.8.1",
60
- "typescript": "^5.4.2",
61
- "vite": "^5.1.6",
60
+ "typescript": "^5.4.3",
61
+ "vite": "^5.2.6",
62
62
  "vitest": "^1.4.0",
63
- "@univerjs/core": "0.1.4",
64
- "@univerjs/shared": "0.1.4"
63
+ "@univerjs/core": "0.1.5",
64
+ "@univerjs/shared": "0.1.5"
65
65
  },
66
66
  "scripts": {
67
67
  "test": "vitest run",