@univerjs/network 0.17.0 → 0.18.0
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/facade.js +1 -1
- package/lib/cjs/index.js +2 -2
- package/lib/es/facade.js +1 -85
- package/lib/es/index.js +2 -627
- package/lib/facade.js +1 -85
- package/lib/index.js +2 -627
- package/lib/types/config/config.d.ts +16 -1
- package/lib/types/facade/f-network.d.ts +18 -2
- package/lib/types/facade/f-univer.d.ts +16 -1
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/services/http/__testing__/http-testing-utils.d.ts +17 -2
- package/lib/types/services/http/http.service.d.ts +22 -6
- package/lib/types/services/http/implementations/fetch.d.ts +18 -3
- package/lib/types/services/http/implementations/implementation.d.ts +19 -4
- package/lib/types/services/http/implementations/util.d.ts +16 -1
- package/lib/types/services/http/implementations/xhr.d.ts +18 -3
- package/lib/types/services/http/interceptor.d.ts +18 -3
- package/lib/types/services/http/interceptors/auth-interceptor.d.ts +16 -1
- package/lib/types/services/http/interceptors/merge-interceptor.d.ts +18 -3
- package/lib/types/services/http/interceptors/retry-interceptor.d.ts +17 -2
- package/lib/types/services/http/interceptors/threshold-interceptor.d.ts +17 -2
- package/lib/types/services/http/request.d.ts +17 -2
- package/lib/types/services/http/response.d.ts +17 -2
- package/lib/types/services/web-socket/web-socket.service.d.ts +18 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +7 -6
- package/lib/types/services/http/__testing__/http-params.spec.d.ts +0 -16
- package/lib/types/services/http/__testing__/http.service.spec.d.ts +0 -16
- package/lib/types/services/http/__testing__/request.spec.d.ts +0 -16
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPEvent, HTTPRequestMethod, HTTPResponse, IPostRequestParams, IRequestParams } from '@univerjs/network';
|
|
17
|
+
import type { Observable } from 'rxjs';
|
|
3
18
|
import { Injector } from '@univerjs/core';
|
|
4
19
|
import { FBase } from '@univerjs/core/facade';
|
|
20
|
+
import { HTTPService } from '@univerjs/network';
|
|
5
21
|
/**
|
|
6
22
|
* This Facade provides a set of methods to make HTTP requests. You should not
|
|
7
23
|
* create an instance of this class directly, instead, use `getNetwork` of
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { ISocket } from '@univerjs/network';
|
|
2
17
|
import { FUniver } from '@univerjs/core/facade';
|
|
3
18
|
import { FNetwork } from './f-network';
|
|
4
19
|
/**
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { IUniverNetworkConfig } from './config/config';
|
|
2
17
|
import { IConfigService, ILogService, Injector, Plugin } from '@univerjs/core';
|
|
3
18
|
/**
|
|
4
19
|
* This plugin add network services to the Univer instance.
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPRequest } from '../request';
|
|
17
|
+
import type { HTTPEvent, HTTPResponseError } from '../response';
|
|
3
18
|
import { Disposable, Injector } from '@univerjs/core';
|
|
4
19
|
import { Observable } from 'rxjs';
|
|
5
20
|
import { IHTTPImplementation } from '../implementations/implementation';
|
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { IDisposable } from '@univerjs/core';
|
|
17
|
+
import type { Observable } from 'rxjs';
|
|
18
|
+
import type { HTTPResponseType } from './http';
|
|
19
|
+
import type { HTTPInterceptorFn } from './interceptor';
|
|
20
|
+
import type { HTTPRequestMethod } from './request';
|
|
21
|
+
import type { HTTPEvent, HTTPResponse } from './response';
|
|
22
|
+
import { Disposable } from '@univerjs/core';
|
|
7
23
|
import { IHTTPImplementation } from './implementations/implementation';
|
|
8
24
|
export interface IRequestParams {
|
|
9
25
|
/** Query params. These params would be append to the url before the request is sent. */
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPRequest } from '../request';
|
|
17
|
+
import type { HTTPEvent } from '../response';
|
|
18
|
+
import type { IHTTPImplementation } from './implementation';
|
|
4
19
|
import { ILogService } from '@univerjs/core';
|
|
5
20
|
import { Observable } from 'rxjs';
|
|
6
21
|
/**
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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';
|
|
4
19
|
/**
|
|
5
20
|
* HTTP service could be implemented differently on platforms.
|
|
6
21
|
*/
|
|
@@ -11,4 +26,4 @@ export interface IHTTPImplementation {
|
|
|
11
26
|
*/
|
|
12
27
|
send(request: HTTPRequest): Observable<HTTPEvent<any>>;
|
|
13
28
|
}
|
|
14
|
-
export declare const IHTTPImplementation: import(
|
|
29
|
+
export declare const IHTTPImplementation: import("@wendellhu/redi").IdentifierDecorator<IHTTPImplementation>;
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPRequest } from '../request';
|
|
2
17
|
export declare function parseFetchParamsFromRequest(request: HTTPRequest): RequestInit;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPRequest } from '../request';
|
|
17
|
+
import type { HTTPEvent } from '../response';
|
|
18
|
+
import type { IHTTPImplementation } from './implementation';
|
|
4
19
|
import { ILogService } from '@univerjs/core';
|
|
5
20
|
import { Observable } from 'rxjs';
|
|
6
21
|
/**
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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';
|
|
4
19
|
export type HTTPHandlerFn = (request: HTTPRequest) => Observable<HTTPEvent<unknown>>;
|
|
5
20
|
/**
|
|
6
21
|
* HTTP interceptor function. When the interceptor is called, it would receive a request object and a next function.
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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';
|
|
2
17
|
export interface IAuthInterceptorParams {
|
|
3
18
|
errorStatusCodes: number[];
|
|
4
19
|
onAuthError: () => void;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPHandlerFn } from '../interceptor';
|
|
17
|
+
import type { HTTPRequest } from '../request';
|
|
3
18
|
import { Observable } from 'rxjs';
|
|
4
19
|
export declare const MergeInterceptorFactory: <T, C>(config: {
|
|
5
20
|
/**
|
|
@@ -29,4 +44,4 @@ export declare const MergeInterceptorFactory: <T, C>(config: {
|
|
|
29
44
|
config: T;
|
|
30
45
|
result: C;
|
|
31
46
|
}[];
|
|
32
|
-
}) => (requestConfig: HTTPRequest, next: HTTPHandlerFn) => Observable<import(
|
|
47
|
+
}) => (requestConfig: HTTPRequest, next: HTTPHandlerFn) => Observable<import("../response").HTTPEvent<unknown>>;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 type { HTTPInterceptorFnFactory } from '../interceptor';
|
|
3
18
|
export interface IRetryInterceptorFactoryParams {
|
|
4
19
|
maxRetryAttempts?: number;
|
|
5
20
|
delayInterval?: number;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 type { HTTPInterceptorFnFactory } from '../interceptor';
|
|
3
18
|
export interface IThresholdInterceptorFactoryParams {
|
|
4
19
|
maxParallel?: number;
|
|
5
20
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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';
|
|
3
18
|
export type HTTPRequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
4
19
|
export declare function __TEST_ONLY_RESET_REQUEST_UID_DO_NOT_USE_IN_PRODUCTION(): void;
|
|
5
20
|
export declare class HTTPRequest {
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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 { HTTPRequest } from './request';
|
|
3
18
|
export type HTTPEvent<T> = HTTPResponse<T> | HTTPProgress;
|
|
4
19
|
export declare enum HTTPEventType {
|
|
5
20
|
DownloadProgress = 0,
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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';
|
|
2
18
|
import { Observable } from 'rxjs';
|
|
3
19
|
export type SocketBodyType = string | ArrayBufferLike | Blob | ArrayBufferView;
|
|
4
20
|
/**
|
|
5
21
|
* This service is responsible for establishing bidi-directional connection to a remote server.
|
|
6
22
|
*/
|
|
7
|
-
export declare const ISocketService: import(
|
|
23
|
+
export declare const ISocketService: import("@wendellhu/redi").IdentifierDecorator<ISocketService>;
|
|
8
24
|
export interface ISocketService {
|
|
9
25
|
createSocket(url: string): Nullable<ISocket>;
|
|
10
26
|
}
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/core/facade`),require(`@univerjs/network`),require(`@univerjs/core`)):typeof define==`function`&&define.amd?define([`@univerjs/core/facade`,`@univerjs/network`,`@univerjs/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade,e.UniverNetwork,e.UniverCore))})(this,function(e,t,n){function r(e,t){return function(n,r){t(n,r,e)}}function i(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let a=class extends e.FBase{constructor(e,t){super(),this._injector=e,this._httpService=t}get(e,t){return this._httpService.get(e,t)}post(e,t){return this._httpService.post(e,t)}put(e,t){return this._httpService.put(e,t)}delete(e,t){return this._httpService.delete(e,t)}patch(e,t){return this._httpService.patch(e,t)}getSSE(e,t,n){return this._httpService.getSSE(e,t,n)}};a=i([r(0,(0,n.Inject)(n.Injector)),r(1,(0,n.Inject)(t.HTTPService))],a);var o=class extends e.FUniver{getNetwork(){return this._injector.createInstance(a)}createSocket(e){let n=this._injector.createInstance(t.WebSocketService).createSocket(e);if(!n)throw Error(`[WebSocketService]: failed to create socket!`);return n}};e.FUniver.extend(o)});
|
package/lib/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`).forEach(t=>{const[r,s]=t.split(":");r&&s&&this._setHeader(r,s)})}_handleHeadersConstructorProps(n){Object.entries(n).forEach(([t,r])=>this._setHeader(t,r))}_handleHeaders(n){n.forEach((t,r)=>this._setHeader(r,t))}}const A=a.createIdentifier("network.http-implementation");class B{constructor(n){this.params=n}toString(){return this.params?Object.keys(this.params).map(n=>{const t=this.params[n];return Array.isArray(t)?t.map(r=>`${n}=${r}`).join("&"):`${n}=${t}`}).join("&"):""}}let z=0;class U{constructor(n,t,r){m(this,"uid",z++);this.method=n,this.url=t,this.requestParams=r}get headers(){return this.requestParams.headers}get withCredentials(){return this.requestParams.withCredentials}get responseType(){return this.requestParams.responseType}getUrlWithParams(){var t,r;const n=(r=(t=this.requestParams)==null?void 0:t.params)==null?void 0:r.toString();return n?`${this.url}${this.url.includes("?")?"&":"?"}${n}`:this.url}getBody(){var r,s;const n=(r=this.headers.get("Content-Type"))!=null?r:O,t=(s=this.requestParams)==null?void 0:s.body;return t instanceof FormData?t:K(n)&&t&&typeof t=="object"?JSON.stringify(t):t?`${t}`:null}getHeadersInit(){var t;return this.headers.toHeadersInit((t=this.requestParams)==null?void 0:t.body)}}var Y=Object.getOwnPropertyDescriptor,P=(e,n,t,r)=>{for(var s=r>1?void 0:r?Y(n,t):n,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Q=(e,n)=>(t,r)=>n(t,r,e);c.HTTPService=class extends a.Disposable{constructor(t){super();m(this,"_interceptors",[]);m(this,"_pipe");this._http=t}registerHTTPInterceptor(t){if(this._interceptors.indexOf(t)!==-1)throw new Error("[HTTPService]: The interceptor has already been registered!");return this._interceptors.push(t),this._interceptors=this._interceptors.sort((r,s)=>{var i,o;return((i=r.priority)!=null?i:0)-((o=s.priority)!=null?o:0)}),this._pipe=null,a.toDisposable(()=>a.remove(this._interceptors,t))}get(t,r){return this.request("GET",t,r)}post(t,r){return this.request("POST",t,r)}put(t,r){return this.request("PUT",t,r)}delete(t,r){return this.request("DELETE",t,r)}patch(t,r){return this.request("PATCH",t,r)}async request(t,r,s){var g,p;const i=new L(s==null?void 0:s.headers),o=new B(s==null?void 0:s.params),l=new U(t,r,{headers:i,params:o,withCredentials:(g=s==null?void 0:s.withCredentials)!=null?g:!1,responseType:(p=s==null?void 0:s.responseType)!=null?p:"json",body:["GET","DELETE"].includes(t)||s==null?void 0:s.body}),w=y.of(l).pipe(_.concatMap(h=>this._runInterceptorsAndImplementation(h)));return await y.firstValueFrom(w)}stream(t,r,s){return this.getSSE(t,r,s)}getSSE(t,r,s){var w,d;const i=new L(s==null?void 0:s.headers),o=new B(s==null?void 0:s.params),l=new U(t,r,{headers:i,params:o,withCredentials:(w=s==null?void 0:s.withCredentials)!=null?w:!1,reportProgress:!0,responseType:(d=s==null?void 0:s.responseType)!=null?d:"json",body:["GET","DELETE"].includes(t)||s==null?void 0:s.body});return y.of(l).pipe(_.concatMap(g=>this._runInterceptorsAndImplementation(g)))}_runInterceptorsAndImplementation(t){return this._pipe||(this._pipe=this._interceptors.map(r=>r.interceptor).reduceRight((r,s)=>Z(r,s),(r,s)=>s(r))),this._pipe(t,r=>this._http.send(r))}},c.HTTPService=P([Q(0,A)],c.HTTPService);function Z(e,n){return(t,r)=>n(t,s=>e(s,r))}const H=200,S=300;var N=(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))(N||{}),D=(e=>(e[e.DownloadProgress=0]="DownloadProgress",e[e.Response=1]="Response",e))(D||{});class k{constructor({body:n,headers:t,status:r,statusText:s}){m(this,"type",1);m(this,"body");m(this,"headers");m(this,"status");m(this,"statusText");this.body=n,this.headers=t,this.status=r,this.statusText=s}}class G{constructor(n,t,r){m(this,"type",0);this.total=n,this.loaded=t,this.partialText=r}}class X{constructor(n,t,r){this.headers=n,this.status=t,this.statusText=r}}class R{constructor({request:n,headers:t,status:r,statusText:s,error:i}){m(this,"request");m(this,"headers");m(this,"status");m(this,"statusText");m(this,"error");this.request=n,this.headers=t,this.status=r,this.statusText=s,this.error=i}}function W(e){return{method:e.method,headers:e.getHeadersInit(),body:e.getBody(),credentials:e.withCredentials?"include":void 0}}var C=Object.getOwnPropertyDescriptor,T=(e,n,t,r)=>{for(var s=r>1?void 0:r?C(n,t):n,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ee=(e,n)=>(t,r)=>n(t,r,e);c.FetchHTTPImplementation=class{constructor(n){this._logService=n}send(n){return new y.Observable(t=>{const r=new AbortController;return this._send(n,t,r).catch(s=>{t.error(new R({error:s,request:n}))}),()=>r.abort()})}async _send(n,t,r){var g,p;let s;try{const h=W(n),v=n.getUrlWithParams(),f=fetch(v,{signal:r.signal,...h});this._logService.debug(`[FetchHTTPImplementation]: sending request to url ${v} with params ${h}`),s=await f}catch(h){const v=new R({request:n,error:h,status:(g=h.status)!=null?g:0,statusText:(p=h.statusText)!=null?p:"Unknown Error",headers:h.headers});this._logService.error("[FetchHTTPImplementation]: network error",v),t.error(v);return}const i=new L(s.headers),o=s.status,l=s.statusText;let w=null;if(s.body&&(w=await this._readBody(n,s,t)),o>=N.Ok&&o<N.MultipleChoices)t.next(new k({body:w,headers:i,status:o,statusText:l}));else{const h=new R({request:n,error:w,status:o,statusText:l,headers:i});this._logService.error("[FetchHTTPImplementation]: network error",h),t.error(h)}t.complete()}async _readBody(n,t,r){var v,f;const s=[],i=t.body.getReader(),o=t.headers.get("content-length");let l=0;const w=(v=n.requestParams)==null?void 0:v.reportProgress,d=n.responseType;let g,p;for(;;){const{done:I,value:u}=await i.read();if(I)break;s.push(u),l+=u.length,w&&d==="text"&&(g=(g!=null?g:"")+(p!=null?p:p=new TextDecoder).decode(u,{stream:!0}),r.next(new G(o?Number.parseInt(o,10):void 0,l,g)))}const h=te(s,l);try{const I=(f=t.headers.get("content-type"))!=null?f:"";return ne(n,h,I)}catch(I){const u=new R({request:n,error:I,status:t.status,statusText:t.statusText,headers:new L(t.headers)});return this._logService.error("[FetchHTTPImplementation]: network error",u),r.error(u),null}}},c.FetchHTTPImplementation=T([ee(0,a.ILogService)],c.FetchHTTPImplementation);function te(e,n){const t=new Uint8Array(n);let r=0;for(const s of e)t.set(s,r),r+=s.length;return t}const re=/^\)\]\}',?\n/;function ne(e,n,t){switch(e.responseType){case"json":const r=new TextDecoder().decode(n).replace(re,"");return r===""?null:JSON.parse(r);case"text":return new TextDecoder().decode(n);case"blob":return new Blob([n.buffer],{type:t});case"arraybuffer":return n.buffer;default:throw new Error(`[FetchHTTPImplementation]: unknown response type: ${e.responseType}.`)}}var se=Object.getOwnPropertyDescriptor,ie=(e,n,t,r)=>{for(var s=r>1?void 0:r?se(n,t):n,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},oe=(e,n)=>(t,r)=>n(t,r,e);c.XHRHTTPImplementation=class{constructor(n){this._logService=n}send(n){return new y.Observable(t=>{const r=new XMLHttpRequest,s=n.getUrlWithParams(),i=W(n),{responseType:o}=n;r.open(n.method,s),n.withCredentials&&(r.withCredentials=!0),i.headers&&Object.entries(i.headers).forEach(([p,h])=>r.setRequestHeader(p,h));const l=()=>{const p=r.statusText||"OK",h=new L(r.getAllResponseHeaders());return new X(h,r.status,p)},w=()=>{const{headers:p,statusText:h,status:v}=l();let f=null,I=null;v!==N.NoContent&&(f=typeof r.response>"u"?r.responseText:r.response);let u=v>=H&&v<S;if(o==="json"&&typeof f=="string"){const b=f;try{f=f?JSON.parse(f):null}catch(E){u=!1,f=b,I=E}}if(o==="blob"&&!(f instanceof Blob)&&(u=!1,I=new Error("Response is not a Blob object")),u)t.next(new k({body:f,headers:p,status:v,statusText:h}));else{const b=new R({request:n,error:I,headers:p,status:v,statusText:h});this._logService.error("[XHRHTTPImplementation]: network error",b),t.error(b)}},d=p=>{const h=new R({request:n,error:p,status:r.status||0,statusText:r.statusText||"Unknown Error",headers:l().headers});this._logService.error("[XHRHTTPImplementation]: network error",h),t.error(h)};r.responseType=o||"",r.addEventListener("load",w),r.addEventListener("error",d),r.addEventListener("abort",d),r.addEventListener("timeout",d);const g=n.getBody();return r.send(g),this._logService.debug("[XHRHTTPImplementation]",`sending request to url ${s} with params ${i}`),()=>{r.readyState!==r.DONE&&r.abort(),r.removeEventListener("load",w),r.removeEventListener("error",d),r.removeEventListener("abort",d),r.removeEventListener("timeout",d)}})}},c.XHRHTTPImplementation=ie([oe(0,a.ILogService)],c.XHRHTTPImplementation);var ce=Object.getOwnPropertyDescriptor,ae=(e,n,t,r)=>{for(var s=r>1?void 0:r?ce(n,t):n,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},q=(e,n)=>(t,r)=>n(t,r,e);c.UniverNetworkPlugin=(F=class extends a.Plugin{constructor(n=x,t,r,s){super(),this._config=n,this._logger=t,this._injector=r,this._configService=s;const{...i}=a.merge({},x,this._config);this._configService.setConfig(J,i)}onStarting(){var r,s,i;if(this._injector.get(c.HTTPService,a.Quantity.OPTIONAL,a.LookUp.SKIP_SELF)&&!((r=this._config)!=null&&r.forceUseNewInstance)){this._logger.warn("[UniverNetworkPlugin]",'HTTPService is already registered in an ancestor interceptor. Skipping registration. If you want to force a new instance, set "forceUseNewInstance" to true in the plugin configuration.');return}const t=(s=this._config)!=null&&s.useFetchImpl?c.FetchHTTPImplementation:typeof window<"u"?c.XHRHTTPImplementation:c.FetchHTTPImplementation;a.registerDependencies(this._injector,a.mergeOverrideWithDependencies([[c.HTTPService],[A,{useClass:t}]],(i=this._config)==null?void 0:i.override))}},m(F,"pluginName","UNIVER_NETWORK_PLUGIN"),m(F,"packageName",j.name),m(F,"version",j.version),F),c.UniverNetworkPlugin=ae([q(1,a.ILogService),q(2,a.Inject(a.Injector)),q(3,a.IConfigService)],c.UniverNetworkPlugin);const le=e=>{const{errorStatusCodes:n,onAuthError:t}=e;return(s,i)=>i(s).pipe(y.catchError(o=>(o instanceof R&&n.some(l=>l===o.status)&&t(),y.throwError(()=>o))))},he=(e=300)=>{let t=()=>{};return r=>new Promise(s=>{t();const i=setTimeout(()=>{s(!0)},e);t=()=>{clearTimeout(i),s(!1)}})},de=()=>(e,n)=>n.map(t=>({config:t,result:e})),pe=(e,n={})=>{const{isMatch:t,getParamsFromRequest:r,mergeParamsToRequest:s}=e,{fetchCheck:i=he(300),distributeResult:o=de()}=n,l=[],w=d=>d.map(g=>g.config);return(d,g)=>t(d)?new y.Observable(p=>{const h=r(d);l.push({next:f=>p.next(f),error:f=>p.error(f),config:h});const v=w(l);i(d).then(f=>{if(f){const I=[];v.forEach(u=>{const b=l.findIndex(E=>E.config===u);if(b>=0){const[E]=l.splice(b,1);I.push(E)}}),g(s(v,d)).subscribe({next:u=>{if(u.type===D.Response){const b=u.body,E=o(b,v);I.forEach(M=>{const V=E.find($=>$.config===M.config);if(V){const $=new k({body:V.result,headers:u.headers,status:u.status,statusText:u.statusText});M.next($)}else M.error("batch error")})}},complete:()=>p.complete(),error:u=>p.error(u)})}})}):g(d)},ue=3,ge=1e3,fe=e=>{var r,s;const n=(r=e==null?void 0:e.maxRetryAttempts)!=null?r:ue,t=(s=e==null?void 0:e.delayInterval)!=null?s:ge;return(i,o)=>o(i).pipe(_.retry({delay:t,count:n}))},me=e=>{const n=[],t=new Set,r=()=>{var s;for(;t.size<((s=e==null?void 0:e.maxParallel)!=null?s:1)&&n.length>0;){const i=n.shift();t.add(i),i()}};return(s,i)=>new y.Observable(o=>{const l=()=>i(s).subscribe({next:d=>o.next(d),error:d=>o.error(d),complete:()=>o.complete()}),w=()=>{t.delete(l),a.remove(n,l),r()};return n.push(l),r(),w})},ye=a.createIdentifier("univer.network.socket.service");class ve extends a.Disposable{createSocket(n){try{const t=new WebSocket(n),r=new a.DisposableCollection;return{URL:n,close:(i,o)=>{t.close(i,o),r.dispose()},send:i=>{t.send(i)},open$:new y.Observable(i=>{const o=l=>i.next(l);t.addEventListener("open",o),r.add(a.toDisposable(()=>t.removeEventListener("open",o)))}).pipe(_.share()),close$:new y.Observable(i=>{const o=l=>i.next(l);t.addEventListener("close",o),r.add(a.toDisposable(()=>t.removeEventListener("close",o)))}).pipe(_.share()),error$:new y.Observable(i=>{const o=l=>i.next(l);t.addEventListener("error",o),r.add(a.toDisposable(()=>t.removeEventListener("error",o)))}).pipe(_.share()),message$:new y.Observable(i=>{const o=l=>i.next(l);t.addEventListener("message",o),r.add(a.toDisposable(()=>t.removeEventListener("message",o)))}).pipe(_.share())}}catch(t){return console.error(t),null}}}c.AuthInterceptorFactory=le,c.HTTPEventType=D,c.HTTPHeaders=L,c.HTTPProgress=G,c.HTTPRequest=U,c.HTTPResponse=k,c.HTTPResponseError=R,c.HTTPStatusCode=N,c.IHTTPImplementation=A,c.ISocketService=ye,c.MergeInterceptorFactory=pe,c.ResponseHeader=X,c.RetryInterceptorFactory=fe,c.ThresholdInterceptorFactory=me,c.WebSocketService=ve,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`rxjs`),require(`rxjs/operators`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`rxjs`,`rxjs/operators`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverNetwork={},e.UniverCore,e.rxjs,e.rxjs.operators))})(this,function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=`@univerjs/network`,a=`0.18.0`;let o=`network.config`;Symbol(o);let s={};function c(e){"@babel/helpers - typeof";return c=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},c(e)}function l(e,t){if(c(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(c(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){var t=l(e,`string`);return c(t)==`symbol`?t:t+``}function d(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let f=`application/json`;function p(e){return Array.isArray(e)?e.some(e=>e.includes(f)):e.includes(f)}var m=class{constructor(e){d(this,`_headers`,new Map),typeof e==`string`?this._handleHeadersString(e):e instanceof Headers?this._handleHeaders(e):e&&this._handleHeadersConstructorProps(e)}forEach(e){this._headers.forEach((t,n)=>e(n,t))}has(e){return!!this._headers.has(e.toLowerCase())}get(e){let t=e.toLowerCase();return this._headers.has(t)?this._headers.get(t):null}set(e,t){this._setHeader(e,t)}toHeadersInit(e){let t={};return this._headers.forEach((e,n)=>{t[n]=e.join(`,`)}),t.accept!=null||(t.accept=`application/json, text/plain, */*`),!(e instanceof FormData)&&(t[`content-type`]!=null||(t[`content-type`]=`application/json;charset=UTF-8`)),t}_setHeader(e,t){let n=e.toLowerCase();this._headers.has(n)?this._headers.get(n).push(t.toString()):this._headers.set(n,[t.toString()])}_handleHeadersString(e){e.split(`
|
|
2
|
+
`).forEach(e=>{let[t,n]=e.split(`:`);t&&n&&this._setHeader(t,n)})}_handleHeadersConstructorProps(e){Object.entries(e).forEach(([e,t])=>this._setHeader(e,t))}_handleHeaders(e){e.forEach((e,t)=>this._setHeader(t,e))}};let h=(0,t.createIdentifier)(`network.http-implementation`);var g=class{constructor(e){this.params=e}toString(){return this.params?Object.keys(this.params).map(e=>{let t=this.params[e];return Array.isArray(t)?t.map(t=>`${e}=${t}`).join(`&`):`${e}=${t}`}).join(`&`):``}};let _=0;var v=class{get headers(){return this.requestParams.headers}get withCredentials(){return this.requestParams.withCredentials}get responseType(){return this.requestParams.responseType}constructor(e,t,n){this.method=e,this.url=t,this.requestParams=n,d(this,`uid`,_++)}getUrlWithParams(){var e;let t=(e=this.requestParams)==null||(e=e.params)==null?void 0:e.toString();return t?`${this.url}${this.url.includes(`?`)?`&`:`?`}${t}`:this.url}getBody(){var e,t;let n=(e=this.headers.get(`Content-Type`))==null?f:e,r=(t=this.requestParams)==null?void 0:t.body;return r instanceof FormData?r:p(n)&&r&&typeof r==`object`?JSON.stringify(r):r?`${r}`:null}getHeadersInit(){var e;return this.headers.toHeadersInit((e=this.requestParams)==null?void 0:e.body)}};function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let x=class extends t.Disposable{constructor(e){super(),this._http=e,d(this,`_interceptors`,[]),d(this,`_pipe`,void 0)}registerHTTPInterceptor(e){if(this._interceptors.indexOf(e)!==-1)throw Error(`[HTTPService]: The interceptor has already been registered!`);return this._interceptors.push(e),this._interceptors=this._interceptors.sort((e,t)=>{var n,r;return((n=e.priority)==null?0:n)-((r=t.priority)==null?0:r)}),this._pipe=null,(0,t.toDisposable)(()=>(0,t.remove)(this._interceptors,e))}get(e,t){return this.request(`GET`,e,t)}post(e,t){return this.request(`POST`,e,t)}put(e,t){return this.request(`PUT`,e,t)}delete(e,t){return this.request(`DELETE`,e,t)}patch(e,t){return this.request(`PATCH`,e,t)}async request(e,t,i){var a,o;return await(0,n.firstValueFrom)((0,n.of)(new v(e,t,{headers:new m(i==null?void 0:i.headers),params:new g(i==null?void 0:i.params),withCredentials:(a=i==null?void 0:i.withCredentials)==null?!1:a,responseType:(o=i==null?void 0:i.responseType)==null?`json`:o,body:[`GET`,`DELETE`].includes(e)||i==null?void 0:i.body})).pipe((0,r.concatMap)(e=>this._runInterceptorsAndImplementation(e))))}stream(e,t,n){return this.getSSE(e,t,n)}getSSE(e,t,i){var a,o;return(0,n.of)(new v(e,t,{headers:new m(i==null?void 0:i.headers),params:new g(i==null?void 0:i.params),withCredentials:(a=i==null?void 0:i.withCredentials)==null?!1:a,reportProgress:!0,responseType:(o=i==null?void 0:i.responseType)==null?`json`:o,body:[`GET`,`DELETE`].includes(e)||i==null?void 0:i.body})).pipe((0,r.concatMap)(e=>this._runInterceptorsAndImplementation(e)))}_runInterceptorsAndImplementation(e){return this._pipe||(this._pipe=this._interceptors.map(e=>e.interceptor).reduceRight((e,t)=>S(e,t),(e,t)=>t(e))),this._pipe(e,e=>this._http.send(e))}};x=b([y(0,h)],x);function S(e,t){return(n,r)=>t(n,t=>e(t,r))}let C=function(e){return 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}({}),w=function(e){return e[e.DownloadProgress=0]=`DownloadProgress`,e[e.Response=1]=`Response`,e}({});var T=class{constructor({body:e,headers:t,status:n,statusText:r}){d(this,`type`,w.Response),d(this,`body`,void 0),d(this,`headers`,void 0),d(this,`status`,void 0),d(this,`statusText`,void 0),this.body=e,this.headers=t,this.status=n,this.statusText=r}},E=class{constructor(e,t,n){this.total=e,this.loaded=t,this.partialText=n,d(this,`type`,w.DownloadProgress)}},D=class{constructor(e,t,n){this.headers=e,this.status=t,this.statusText=n}},O=class{constructor({request:e,headers:t,status:n,statusText:r,error:i}){d(this,`request`,void 0),d(this,`headers`,void 0),d(this,`status`,void 0),d(this,`statusText`,void 0),d(this,`error`,void 0),this.request=e,this.headers=t,this.status=n,this.statusText=r,this.error=i}};function k(e){return{method:e.method,headers:e.getHeadersInit(),body:e.getBody(),credentials:e.withCredentials?`include`:void 0}}let A=class{constructor(e){this._logService=e}send(e){return new n.Observable(t=>{let n=new AbortController;return this._send(e,t,n).catch(n=>{t.error(new O({error:n,request:e}))}),()=>n.abort()})}async _send(e,t,n){let r;try{let t=k(e),i=e.getUrlWithParams(),a=fetch(i,{signal:n.signal,...t});this._logService.debug(`[FetchHTTPImplementation]: sending request to url ${i} with params ${t}`),r=await a}catch(n){var i,a;let r=new O({request:e,error:n,status:(i=n.status)==null?0:i,statusText:(a=n.statusText)==null?`Unknown Error`:a,headers:n.headers});this._logService.error(`[FetchHTTPImplementation]: network error`,r),t.error(r);return}let o=new m(r.headers),s=r.status,c=r.statusText,l=null;if(r.body&&(l=await this._readBody(e,r,t)),s>=C.Ok&&s<C.MultipleChoices)t.next(new T({body:l,headers:o,status:s,statusText:c}));else{let n=new O({request:e,error:l,status:s,statusText:c,headers:o});this._logService.error(`[FetchHTTPImplementation]: network error`,n),t.error(n)}t.complete()}async _readBody(e,t,n){var r;let i=[],a=t.body.getReader(),o=t.headers.get(`content-length`),s=0,c=(r=e.requestParams)==null?void 0:r.reportProgress,l=e.responseType,u,d;for(;;){let{done:e,value:t}=await a.read();if(e)break;if(i.push(t),s+=t.length,c&&l===`text`){var f,p;u=((f=u)==null?``:f)+((p=d)==null?d=new TextDecoder:p).decode(t,{stream:!0}),n.next(new E(o?Number.parseInt(o,10):void 0,s,u))}}let h=j(i,s);try{var g;return N(e,h,(g=t.headers.get(`content-type`))==null?``:g)}catch(r){let i=new O({request:e,error:r,status:t.status,statusText:t.statusText,headers:new m(t.headers)});return this._logService.error(`[FetchHTTPImplementation]: network error`,i),n.error(i),null}}};A=b([y(0,t.ILogService)],A);function j(e,t){let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let M=/^\)\]\}',?\n/;function N(e,t,n){switch(e.responseType){case`json`:let r=new TextDecoder().decode(t).replace(M,``);return r===``?null:JSON.parse(r);case`text`:return new TextDecoder().decode(t);case`blob`:return new Blob([t.buffer],{type:n});case`arraybuffer`:return t.buffer;default:throw Error(`[FetchHTTPImplementation]: unknown response type: ${e.responseType}.`)}}let P=class{constructor(e){this._logService=e}send(e){return new n.Observable(t=>{let n=new XMLHttpRequest,r=e.getUrlWithParams(),i=k(e),{responseType:a}=e;n.open(e.method,r),e.withCredentials&&(n.withCredentials=!0),i.headers&&Object.entries(i.headers).forEach(([e,t])=>n.setRequestHeader(e,t));let o=()=>{let e=n.statusText||`OK`;return new D(new m(n.getAllResponseHeaders()),n.status,e)},s=()=>{let{headers:r,statusText:i,status:s}=o(),c=null,l=null;s!==C.NoContent&&(c=n.response===void 0?n.responseText:n.response);let u=s>=200&&s<300;if(a===`json`&&typeof c==`string`){let e=c;try{c=c?JSON.parse(c):null}catch(t){u=!1,c=e,l=t}}if(a===`blob`&&!(c instanceof Blob)&&(u=!1,l=Error(`Response is not a Blob object`)),u)t.next(new T({body:c,headers:r,status:s,statusText:i}));else{let n=new O({request:e,error:l,headers:r,status:s,statusText:i});this._logService.error(`[XHRHTTPImplementation]: network error`,n),t.error(n)}},c=r=>{let i=new O({request:e,error:r,status:n.status||0,statusText:n.statusText||`Unknown Error`,headers:o().headers});this._logService.error(`[XHRHTTPImplementation]: network error`,i),t.error(i)};n.responseType=a||``,n.addEventListener(`load`,s),n.addEventListener(`error`,c),n.addEventListener(`abort`,c),n.addEventListener(`timeout`,c);let l=e.getBody();return n.send(l),this._logService.debug(`[XHRHTTPImplementation]`,`sending request to url ${r} with params ${i}`),()=>{n.readyState!==n.DONE&&n.abort(),n.removeEventListener(`load`,s),n.removeEventListener(`error`,c),n.removeEventListener(`abort`,c),n.removeEventListener(`timeout`,c)}})}};P=b([y(0,t.ILogService)],P);let F=class extends t.Plugin{constructor(e=s,n,r,i){super(),this._config=e,this._logger=n,this._injector=r,this._configService=i;let{...a}=(0,t.merge)({},s,this._config);this._configService.setConfig(o,a)}onStarting(){var e,n,r;if(this._injector.get(x,t.Quantity.OPTIONAL,t.LookUp.SKIP_SELF)&&!((e=this._config)!=null&&e.forceUseNewInstance)){this._logger.warn(`[UniverNetworkPlugin]`,`HTTPService is already registered in an ancestor interceptor. Skipping registration. If you want to force a new instance, set "forceUseNewInstance" to true in the plugin configuration.`);return}let i=(n=this._config)!=null&&n.useFetchImpl?A:typeof window<`u`?P:A;(0,t.registerDependencies)(this._injector,(0,t.mergeOverrideWithDependencies)([[x],[h,{useClass:i}]],(r=this._config)==null?void 0:r.override))}};d(F,`pluginName`,`UNIVER_NETWORK_PLUGIN`),d(F,`packageName`,i),d(F,`version`,a),F=b([y(1,t.ILogService),y(2,(0,t.Inject)(t.Injector)),y(3,t.IConfigService)],F);let I=e=>{let{errorStatusCodes:t,onAuthError:r}=e;return(e,i)=>i(e).pipe((0,n.catchError)(e=>(e instanceof O&&t.some(t=>t===e.status)&&r(),(0,n.throwError)(()=>e))))},L=(e=300)=>{let t=()=>{};return n=>new Promise(n=>{t();let r=setTimeout(()=>{n(!0)},e);t=()=>{clearTimeout(r),n(!1)}})},R=()=>(e,t)=>t.map(t=>({config:t,result:e})),z=(e,t={})=>{let{isMatch:r,getParamsFromRequest:i,mergeParamsToRequest:a}=e,{fetchCheck:o=L(300),distributeResult:s=R()}=t,c=[],l=e=>e.map(e=>e.config);return(e,t)=>r(e)?new n.Observable(n=>{let r=i(e);c.push({next:e=>n.next(e),error:e=>n.error(e),config:r});let u=l(c);o(e).then(r=>{if(r){let r=[];u.forEach(e=>{let t=c.findIndex(t=>t.config===e);if(t>=0){let[e]=c.splice(t,1);r.push(e)}}),t(a(u,e)).subscribe({next:e=>{if(e.type===w.Response){let t=e.body,n=s(t,u);r.forEach(t=>{let r=n.find(e=>e.config===t.config);if(r){let n=new T({body:r.result,headers:e.headers,status:e.status,statusText:e.statusText});t.next(n)}else t.error(`batch error`)})}},complete:()=>n.complete(),error:e=>n.error(e)})}})}):t(e)},B=e=>{var t,n;let i=(t=e==null?void 0:e.maxRetryAttempts)==null?3:t,a=(n=e==null?void 0:e.delayInterval)==null?1e3:n;return(e,t)=>t(e).pipe((0,r.retry)({delay:a,count:i}))},V=e=>{let r=[],i=new Set,a=()=>{for(var t;i.size<((t=e==null?void 0:e.maxParallel)==null?1:t)&&r.length>0;){let e=r.shift();i.add(e),e()}};return(e,o)=>new n.Observable(n=>{let s=()=>o(e).subscribe({next:e=>n.next(e),error:e=>n.error(e),complete:()=>n.complete()});return r.push(s),a(),()=>{i.delete(s),(0,t.remove)(r,s),a()}})},H=(0,t.createIdentifier)(`univer.network.socket.service`);var U=class extends t.Disposable{createSocket(e){try{let i=new WebSocket(e),a=new t.DisposableCollection;return{URL:e,close:(e,t)=>{i.close(e,t),a.dispose()},send:e=>{i.send(e)},open$:new n.Observable(e=>{let n=t=>e.next(t);i.addEventListener(`open`,n),a.add((0,t.toDisposable)(()=>i.removeEventListener(`open`,n)))}).pipe((0,r.share)()),close$:new n.Observable(e=>{let n=t=>e.next(t);i.addEventListener(`close`,n),a.add((0,t.toDisposable)(()=>i.removeEventListener(`close`,n)))}).pipe((0,r.share)()),error$:new n.Observable(e=>{let n=t=>e.next(t);i.addEventListener(`error`,n),a.add((0,t.toDisposable)(()=>i.removeEventListener(`error`,n)))}).pipe((0,r.share)()),message$:new n.Observable(e=>{let n=t=>e.next(t);i.addEventListener(`message`,n),a.add((0,t.toDisposable)(()=>i.removeEventListener(`message`,n)))}).pipe((0,r.share)())}}catch(e){return console.error(e),null}}};e.AuthInterceptorFactory=I,Object.defineProperty(e,`FetchHTTPImplementation`,{enumerable:!0,get:function(){return A}}),e.HTTPEventType=w,e.HTTPHeaders=m,e.HTTPProgress=E,e.HTTPRequest=v,e.HTTPResponse=T,e.HTTPResponseError=O,Object.defineProperty(e,`HTTPService`,{enumerable:!0,get:function(){return x}}),e.HTTPStatusCode=C,e.IHTTPImplementation=h,e.ISocketService=H,e.MergeInterceptorFactory=z,e.ResponseHeader=D,e.RetryInterceptorFactory=B,e.ThresholdInterceptorFactory=V,Object.defineProperty(e,`UniverNetworkPlugin`,{enumerable:!0,get:function(){return F}}),e.WebSocketService=U,Object.defineProperty(e,`XHRHTTPImplementation`,{enumerable:!0,get:function(){return P}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/network",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "DreamNum <developer@univer.ai>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,21 +57,22 @@
|
|
|
57
57
|
"rxjs": ">=7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@univerjs/core": "0.
|
|
60
|
+
"@univerjs/core": "0.18.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"rxjs": "^7.8.2",
|
|
64
64
|
"typescript": "^5.9.3",
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"@univerjs-infra/shared": "0.17.0"
|
|
65
|
+
"vitest": "^4.1.0",
|
|
66
|
+
"@univerjs-infra/shared": "0.18.0"
|
|
68
67
|
},
|
|
69
68
|
"scripts": {
|
|
70
69
|
"test": "vitest run",
|
|
71
70
|
"test:watch": "vitest",
|
|
72
71
|
"coverage": "vitest run --coverage",
|
|
73
72
|
"typecheck": "tsc --noEmit",
|
|
74
|
-
"build": "univer-cli build"
|
|
73
|
+
"build:bundle": "univer-cli build",
|
|
74
|
+
"build:types": "tsc -p tsconfig.node.json",
|
|
75
|
+
"build": "pnpm run build:bundle && pnpm run build:types"
|
|
75
76
|
},
|
|
76
77
|
"module": "./lib/es/index.js"
|
|
77
78
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
-
export {};
|