@univerjs-pro/exchange-client 0.4.2 → 0.5.0-nightly.202411091605
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 -0
- package/lib/cjs/index.js +2 -2
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/facade.js +1 -0
- package/lib/es/index.js +2 -2
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/types/index.d.ts +483 -10
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +2 -2
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +38 -20
- package/lib/locale/en-US.json +0 -20
- package/lib/locale/fa-IR.json +0 -20
- package/lib/locale/ru-RU.json +0 -20
- package/lib/locale/vi-VN.json +0 -20
- package/lib/locale/zh-CN.json +0 -20
- package/lib/locale/zh-TW.json +0 -20
- package/lib/types/controllers/config.schema.d.ts +0 -16
- package/lib/types/controllers/exchange.controller.d.ts +0 -8
- package/lib/types/locale/en-US.d.ts +0 -3
- package/lib/types/locale/fa-IR.d.ts +0 -3
- package/lib/types/locale/ru-RU.d.ts +0 -3
- package/lib/types/locale/vi-VN.d.ts +0 -3
- package/lib/types/locale/zh-CN.d.ts +0 -21
- package/lib/types/locale/zh-TW.d.ts +0 -3
- package/lib/types/plugin.d.ts +0 -11
- package/lib/types/services/__tests__/snapshot.spec.d.ts +0 -16
- package/lib/types/services/exchange.service.d.ts +0 -87
- package/lib/types/services/operate.service.d.ts +0 -121
- package/lib/types/services/request.service.d.ts +0 -107
- package/lib/types/services/upload-notification.service.d.ts +0 -52
- package/lib/types/services/utils/snapshot.d.ts +0 -76
- package/lib/types/services/utils/tool.d.ts +0 -19
- package/lib/types/views/UploadNotificationContainer.d.ts +0 -2
- package/lib/types/views/link-list/LinkList.d.ts +0 -6
- package/lib/types/views/upload-again/UploadAgain.d.ts +0 -2
- package/lib/types/views/upload-button/UploadButton.d.ts +0 -7
- package/lib/types/views/upload-error/UploadError.d.ts +0 -2
- package/lib/types/views/upload-notification/UploadNotification.d.ts +0 -2
- package/lib/types/views/upload-success/UploadSuccess.d.ts +0 -5
- package/lib/types/views/uploading/Uploading.d.ts +0 -2
- package/lib/types/views/uploading/upload-cancel/UploadCancel.d.ts +0 -2
- package/lib/types/views/uploading/upload-progress/UploadProgress.d.ts +0 -5
@@ -1,107 +0,0 @@
|
|
1
|
-
import { IDisposable, IConfigService } from '@univerjs/core';
|
2
|
-
import { IError, UniverType } from '@univerjs/protocol';
|
3
|
-
import { ISheetBlockJson, ISnapshotJson } from './utils/snapshot';
|
4
|
-
import { HTTPService } from '@univerjs/network';
|
5
|
-
/** @deprecated Will be removed in the 0.2.19 release */
|
6
|
-
export declare const EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY = "EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY";
|
7
|
-
/** @deprecated Will be removed in the 0.2.19 release */
|
8
|
-
export declare const EXCHANGE_IMPORT_SERVER_URL_KEY = "EXCHANGE_IMPORT_SERVER_URL_KEY";
|
9
|
-
/** @deprecated Will be removed in the 0.2.19 release */
|
10
|
-
export declare const EXCHANGE_EXPORT_SERVER_URL_KEY = "EXCHANGE_EXPORT_SERVER_URL_KEY";
|
11
|
-
/** @deprecated Will be removed in the 0.2.19 release */
|
12
|
-
export declare const EXCHANGE_GET_TASK_SERVER_URL_KEY = "EXCHANGE_GET_TASK_SERVER_URL_KEY";
|
13
|
-
/** @deprecated Will be removed in the 0.2.19 release */
|
14
|
-
export declare const EXCHANGE_SIGN_URL_SERVER_URL_KEY = "EXCHANGE_SIGN_URL_SERVER_URL_KEY";
|
15
|
-
export interface IFileUploadResponse {
|
16
|
-
FileId: string;
|
17
|
-
error: IError;
|
18
|
-
}
|
19
|
-
export declare enum ImportOutputType {
|
20
|
-
UNDEFINED = 0,
|
21
|
-
/** UNIT - Import to univer unit, unit is store in the database */
|
22
|
-
UNIT = 1,
|
23
|
-
/** JSON - Import and convert to a json file which represents a univer unit, not store in the database */
|
24
|
-
JSON = 2,
|
25
|
-
UNRECOGNIZED = -1
|
26
|
-
}
|
27
|
-
export interface IImportRequest {
|
28
|
-
fileID: string;
|
29
|
-
type: UniverType;
|
30
|
-
outputType: ImportOutputType;
|
31
|
-
/** not supported yet */
|
32
|
-
fileUrl: string;
|
33
|
-
}
|
34
|
-
export interface IImportResponse {
|
35
|
-
taskID: string;
|
36
|
-
error: IError;
|
37
|
-
}
|
38
|
-
export interface IExportRequest {
|
39
|
-
/** if unitID is specified, the input is the unit in the database */
|
40
|
-
unitID: string;
|
41
|
-
/** if jsonID is specified, the input is the json file which represents a univer unit */
|
42
|
-
jsonID: string;
|
43
|
-
type: UniverType;
|
44
|
-
}
|
45
|
-
export interface IExportResponse {
|
46
|
-
error: IError | undefined;
|
47
|
-
taskID: string;
|
48
|
-
}
|
49
|
-
export interface IGetTaskResponse {
|
50
|
-
error: IError | undefined;
|
51
|
-
taskID: string;
|
52
|
-
status: string;
|
53
|
-
import?: IImportTaskResult | undefined;
|
54
|
-
export?: IExportTaskResult | undefined;
|
55
|
-
}
|
56
|
-
export interface IImportTaskResult {
|
57
|
-
outputType: ImportOutputType;
|
58
|
-
unitID: string;
|
59
|
-
jsonID: string;
|
60
|
-
}
|
61
|
-
export interface IExportTaskResult {
|
62
|
-
fileID: string;
|
63
|
-
fileUrl: string;
|
64
|
-
}
|
65
|
-
export interface ISignUrlResponse {
|
66
|
-
error: IError | undefined;
|
67
|
-
url: string;
|
68
|
-
}
|
69
|
-
export interface IBindingResponse {
|
70
|
-
error: IError;
|
71
|
-
}
|
72
|
-
export interface ISnapshotJsonResponse {
|
73
|
-
snapshot: Partial<ISnapshotJson>;
|
74
|
-
sheetBlocks: ISheetBlockJson;
|
75
|
-
}
|
76
|
-
export interface IRequestService {
|
77
|
-
upload(file: File | string): Promise<IFileUploadResponse | undefined>;
|
78
|
-
import(importRequest: IImportRequest): Promise<IImportResponse | undefined>;
|
79
|
-
export(exportRequest: IExportRequest): Promise<IExportResponse | undefined>;
|
80
|
-
getTask(taskID: string): Promise<IGetTaskResponse | undefined>;
|
81
|
-
signUrl(fileID: string): Promise<ISignUrlResponse | undefined>;
|
82
|
-
}
|
83
|
-
export declare const IRequestService: import('@wendellhu/redi').IdentifierDecorator<IRequestService>;
|
84
|
-
/**
|
85
|
-
* TODO@Dushusir maybe move to ExchangeClientPlugin plugin for reuse
|
86
|
-
*/
|
87
|
-
export declare class RequestService implements IRequestService, IDisposable {
|
88
|
-
private readonly _configService;
|
89
|
-
private readonly _httpService;
|
90
|
-
constructor(_configService: IConfigService, _httpService: HTTPService);
|
91
|
-
dispose(): void;
|
92
|
-
/**
|
93
|
-
* upload file to server
|
94
|
-
* @param file
|
95
|
-
*/
|
96
|
-
upload(file: File | string, size?: number, flate?: boolean): Promise<IFileUploadResponse | undefined>;
|
97
|
-
import(importRequest: IImportRequest): Promise<IImportResponse | undefined>;
|
98
|
-
export(exportRequest: IExportRequest): Promise<IExportResponse | undefined>;
|
99
|
-
getTask(taskID: string): Promise<IGetTaskResponse | undefined>;
|
100
|
-
signUrl(fileID: string): Promise<ISignUrlResponse | undefined>;
|
101
|
-
private _getUploadFileURL;
|
102
|
-
private _getImportURL;
|
103
|
-
private _getExportURL;
|
104
|
-
private _getTaskURL;
|
105
|
-
private _getSignURL;
|
106
|
-
private _getMaxPollingTime;
|
107
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { Disposable, IDisposable } from '@univerjs/core';
|
2
|
-
import { Observable } from 'rxjs';
|
3
|
-
import { UniverType } from '@univerjs/protocol';
|
4
|
-
export declare enum UploadNotificationState {
|
5
|
-
UPLOADING = 0,
|
6
|
-
SUCCESS = 1,
|
7
|
-
ERROR = 2
|
8
|
-
}
|
9
|
-
export interface ILinkList {
|
10
|
-
link: string;
|
11
|
-
name: string;
|
12
|
-
type: UniverType;
|
13
|
-
}
|
14
|
-
export interface IUploadNotificationService {
|
15
|
-
visible$: Observable<boolean>;
|
16
|
-
state$: Observable<UploadNotificationState>;
|
17
|
-
list$: Observable<ILinkList[]>;
|
18
|
-
/**
|
19
|
-
* Show upload notification
|
20
|
-
*/
|
21
|
-
show(): void;
|
22
|
-
/**
|
23
|
-
* Hide upload notification
|
24
|
-
*/
|
25
|
-
hide(): void;
|
26
|
-
/**
|
27
|
-
* Update upload notification state
|
28
|
-
* @param state
|
29
|
-
*/
|
30
|
-
updateState(state: UploadNotificationState): void;
|
31
|
-
/**
|
32
|
-
* Push link to upload notification
|
33
|
-
* @param link
|
34
|
-
*/
|
35
|
-
pushLink(link: ILinkList): void;
|
36
|
-
}
|
37
|
-
export declare const IUploadNotificationService: import('@wendellhu/redi').IdentifierDecorator<IUploadNotificationService>;
|
38
|
-
export declare class UploadNotificationService extends Disposable implements IUploadNotificationService, IDisposable {
|
39
|
-
private readonly _visible$;
|
40
|
-
private readonly _state$;
|
41
|
-
private readonly _list$;
|
42
|
-
readonly visible$: Observable<boolean>;
|
43
|
-
readonly state$: Observable<UploadNotificationState>;
|
44
|
-
readonly list$: Observable<ILinkList[]>;
|
45
|
-
private _list;
|
46
|
-
constructor();
|
47
|
-
dispose(): void;
|
48
|
-
show(): void;
|
49
|
-
hide(): void;
|
50
|
-
updateState(state: UploadNotificationState): void;
|
51
|
-
pushLink(link: ILinkList): void;
|
52
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
import { IWorkbookData, Nullable } from '@univerjs/core';
|
2
|
-
import { ICopyFileMetaRequest, ICopyFileMetaResponse, IDocumentMeta, IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetLatestCsReqIdBySidRequest, IGetLatestCsReqIdBySidResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse, ISheetBlock, ISnapshot, IWorkbookMeta, IWorksheetMeta } from '@univerjs/protocol';
|
3
|
-
import { ILogContext, ISnapshotServerService } from '@univerjs-pro/collaboration';
|
4
|
-
export interface IWorksheetMetaJson extends Omit<IWorksheetMeta, 'originalMeta'> {
|
5
|
-
originalMeta: string;
|
6
|
-
}
|
7
|
-
export interface IWorkbookMetaJson extends Omit<IWorkbookMeta, 'originalMeta' | 'sheets'> {
|
8
|
-
originalMeta: string;
|
9
|
-
sheets: {
|
10
|
-
[key: string]: Partial<IWorksheetMetaJson>;
|
11
|
-
};
|
12
|
-
}
|
13
|
-
export interface IDocumentMetaJson extends Omit<IDocumentMeta, 'originalMeta'> {
|
14
|
-
originalMeta: string;
|
15
|
-
}
|
16
|
-
export interface ISnapshotJson extends Omit<ISnapshot, 'workbook' | 'doc'> {
|
17
|
-
workbook: Partial<IWorkbookMetaJson>;
|
18
|
-
doc: Partial<IDocumentMetaJson>;
|
19
|
-
}
|
20
|
-
export interface ISheetBlockData extends Omit<ISheetBlock, 'data'> {
|
21
|
-
data: string;
|
22
|
-
}
|
23
|
-
export interface ISheetBlockJson {
|
24
|
-
[key: string]: Partial<ISheetBlockData>;
|
25
|
-
}
|
26
|
-
export interface ISnapshotBlockJson {
|
27
|
-
snapshot: ISnapshotJson;
|
28
|
-
sheetBlocks: ISheetBlockJson;
|
29
|
-
}
|
30
|
-
export interface ISnapshotBlockJsonResponse {
|
31
|
-
snapshot: ISnapshot;
|
32
|
-
sheetBlocks: {
|
33
|
-
[key: string]: ISheetBlock;
|
34
|
-
};
|
35
|
-
}
|
36
|
-
/**
|
37
|
-
* Convert the Uint8Array in the snapshot to a string for easy transmission to the backend
|
38
|
-
* @param snapshot
|
39
|
-
* @returns
|
40
|
-
*/
|
41
|
-
export declare function transformSnapshotMetaToString(snapshot: ISnapshot): Nullable<ISnapshotJson>;
|
42
|
-
/**
|
43
|
-
* Convert the Uint8Array in the sheet block to a string for easy transmission to the backend
|
44
|
-
* @param sheetBlocks
|
45
|
-
* @returns
|
46
|
-
*/
|
47
|
-
export declare function transformSheetBlockMetaToString(sheetBlocks: ISheetBlock[]): ISheetBlockJson;
|
48
|
-
/**
|
49
|
-
* Convert the workbook data to snapshot data
|
50
|
-
* @param workbookData
|
51
|
-
* @returns
|
52
|
-
*/
|
53
|
-
export declare function transformWorkbookDataToSnapshotJson(workbookData: IWorkbookData): Promise<ISnapshotBlockJson>;
|
54
|
-
/**
|
55
|
-
* The server needs to fully implement all interfaces, but when used by the client, use saveSheetBlock to cache the sheet block locally, and use getSheetBlock to obtain the sheet block.
|
56
|
-
*/
|
57
|
-
export declare class ClientSnapshotServerService implements ISnapshotServerService {
|
58
|
-
private _sheetBlockCache;
|
59
|
-
/** Load snapshot from a database. */
|
60
|
-
getUnitOnRev(context: ILogContext, params: IGetUnitOnRevRequest): Promise<IGetUnitOnRevResponse>;
|
61
|
-
/** Load sheet block from a database. */
|
62
|
-
getSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetSheetBlockResponse>;
|
63
|
-
/** Load deserialized sheet block from a database. */
|
64
|
-
getDeserializedSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetDeserializedSheetBlockResponse>;
|
65
|
-
/** Fetch missing changeset */
|
66
|
-
fetchMissingChangesets(context: ILogContext, params: IFetchMissingChangesetsRequest): Promise<IFetchMissingChangesetsResponse>;
|
67
|
-
getResourcesRequest(context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
|
68
|
-
/** Save snapshot to a database. */
|
69
|
-
saveSnapshot(context: ILogContext, params: ISaveSnapshotRequest): Promise<ISaveSnapshotResponse>;
|
70
|
-
/** Save sheet block to a database. */
|
71
|
-
saveSheetBlock(context: ILogContext, params: ISaveSheetBlockRequest): Promise<ISaveSheetBlockResponse>;
|
72
|
-
/** Save changeset to a database. */
|
73
|
-
saveChangeset(context: ILogContext, params: ISaveChangesetRequest): Promise<ISaveChangesetResponse>;
|
74
|
-
copyFileMeta(context: ILogContext, params: ICopyFileMetaRequest): Promise<ICopyFileMetaResponse>;
|
75
|
-
getLatestCsReqIdBySid(context: ILogContext, params: IGetLatestCsReqIdBySidRequest): Promise<IGetLatestCsReqIdBySidResponse>;
|
76
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { UniverType } from '@univerjs/protocol';
|
2
|
-
export declare function downloadFileByURL(url: string, filename: string, fileExt: string): void;
|
3
|
-
/**
|
4
|
-
* Triggers a download of a given File object.
|
5
|
-
*
|
6
|
-
* @param {File} file - The File object to be downloaded.
|
7
|
-
*/
|
8
|
-
export declare function downloadFile(file: File | Blob, filename: string, fileExt: string): void;
|
9
|
-
export declare function getUniverTypeByFile(file: File): UniverType.UNIVER_UNKNOWN | UniverType.UNIVER_DOC | UniverType.UNIVER_SHEET | UniverType.UNIVER_SLIDE;
|
10
|
-
export declare function getUploadFile(types: UniverType[], multiple?: boolean): Promise<FileList | null>;
|
11
|
-
export declare function getFileByURL(url: string): Promise<File | undefined>;
|
12
|
-
export declare function getFileNameFromURL(url: string): string | undefined;
|
13
|
-
export declare function getTextFromURL(url: string): Promise<string | undefined>;
|
14
|
-
export declare function blobToString(blob: Blob): Promise<string>;
|
15
|
-
export declare function bufferToFile(buffer: Uint8Array): File;
|
16
|
-
export declare function replaceType(path: string, type: string): string;
|
17
|
-
export declare function replaceUnitId(path: string, type: string): string;
|
18
|
-
export declare function replaceTaskID(path: string, taskID: string): string;
|
19
|
-
export declare function replaceFileID(path: string, fileID: string): string;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { default as React } from 'react';
|
2
|
-
export interface IUploadButton {
|
3
|
-
children?: React.ReactNode;
|
4
|
-
className?: string;
|
5
|
-
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
6
|
-
}
|
7
|
-
export declare function UploadButton(props: IUploadButton): React.JSX.Element;
|