@univerjs/core 0.2.9 → 0.2.11
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 +5 -7
- package/lib/es/index.js +42 -503
- package/lib/types/index.d.ts +0 -7
- package/lib/types/services/authz-io/type.d.ts +2 -2
- package/lib/types/services/command/command.service.d.ts +111 -28
- package/lib/types/shared/numfmt.d.ts +2 -1
- package/lib/types/shared/types/numfmt.type.d.ts +227 -0
- package/lib/types/shared/types.d.ts +3 -0
- package/lib/types/sheets/typedef.d.ts +1 -1
- package/lib/types/types/const/const.d.ts +4 -0
- package/lib/umd/index.js +5 -7
- package/package.json +5 -5
- package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +0 -22
- package/lib/types/services/snapshot/__tests__/snapshot-transform.spec.d.ts +0 -16
- package/lib/types/services/snapshot/snapshot-server.service.d.ts +0 -42
- package/lib/types/services/snapshot/snapshot-transform.d.ts +0 -31
- package/lib/types/services/snapshot/snapshot-utils.d.ts +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Core library for Univer.",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
|
|
50
50
|
"rxjs": ">=7.0.0",
|
|
51
|
-
"@univerjs/core": "0.2.
|
|
51
|
+
"@univerjs/core": "0.2.11"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@types/lodash.mergewith": "^4.6.9",
|
|
55
|
-
"@univerjs/protocol": "0.1.39-alpha.
|
|
55
|
+
"@univerjs/protocol": "0.1.39-alpha.15",
|
|
56
56
|
"@wendellhu/redi": "0.16.1",
|
|
57
57
|
"lodash.mergewith": "^4.6.2",
|
|
58
58
|
"nanoid": "5.0.7",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"@types/numeral": "^2.0.5",
|
|
65
65
|
"rxjs": "^7.8.1",
|
|
66
66
|
"typescript": "^5.5.4",
|
|
67
|
-
"vite": "^5.4.
|
|
67
|
+
"vite": "^5.4.2",
|
|
68
68
|
"vitest": "^2.0.5",
|
|
69
|
-
"@univerjs/shared": "0.2.
|
|
69
|
+
"@univerjs/shared": "0.2.11"
|
|
70
70
|
},
|
|
71
71
|
"univerSpace": {
|
|
72
72
|
".": {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse, ISheetBlock, ISnapshot } from '@univerjs/protocol';
|
|
2
|
-
import { ILogContext } from '../../log/context';
|
|
3
|
-
import { ISnapshotServerService } from '../snapshot-server.service';
|
|
4
|
-
import { IWorkbookData } from '../../../sheets/typedef';
|
|
5
|
-
export declare const testSnapshot: () => ISnapshot;
|
|
6
|
-
export declare const testSheetBlocks: () => ISheetBlock[];
|
|
7
|
-
export declare const testWorkbookData: () => IWorkbookData;
|
|
8
|
-
export declare class MockSnapshotServerService implements ISnapshotServerService {
|
|
9
|
-
/** Load snapshot from a database. */
|
|
10
|
-
getUnitOnRev(context: ILogContext, params: IGetUnitOnRevRequest): Promise<IGetUnitOnRevResponse>;
|
|
11
|
-
/** Load sheet block from a database. */
|
|
12
|
-
getSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetSheetBlockResponse>;
|
|
13
|
-
/** Fetch missing changeset */
|
|
14
|
-
fetchMissingChangesets(context: ILogContext, params: IFetchMissingChangesetsRequest): Promise<IFetchMissingChangesetsResponse>;
|
|
15
|
-
getResourcesRequest(context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
|
|
16
|
-
/** Save snapshot to a database. */
|
|
17
|
-
saveSnapshot(context: ILogContext, params: ISaveSnapshotRequest): Promise<ISaveSnapshotResponse>;
|
|
18
|
-
/** Save sheet block to a database. */
|
|
19
|
-
saveSheetBlock(context: ILogContext, params: ISaveSheetBlockRequest): Promise<ISaveSheetBlockResponse>;
|
|
20
|
-
/** Save changeset to a database. */
|
|
21
|
-
saveChangeset(context: ILogContext, params: ISaveChangesetRequest): Promise<ISaveChangesetResponse>;
|
|
22
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse } from '@univerjs/protocol';
|
|
2
|
-
import { ILogContext } from '../log/context';
|
|
3
|
-
/**
|
|
4
|
-
* It provides implementations for server side controllers to load or save
|
|
5
|
-
* or load snapshots. This service should be implemented by the host environment.
|
|
6
|
-
* And it shouldn't contain any business logic.
|
|
7
|
-
*/
|
|
8
|
-
export declare const ISnapshotServerService: import('../../common/di').IdentifierDecorator<ISnapshotServerService>;
|
|
9
|
-
export interface ISnapshotServerService {
|
|
10
|
-
/** Load snapshot from a database. */
|
|
11
|
-
getUnitOnRev: (context: ILogContext, params: IGetUnitOnRevRequest) => Promise<IGetUnitOnRevResponse>;
|
|
12
|
-
/** Load sheet block from a database. */
|
|
13
|
-
getSheetBlock: (context: ILogContext, params: IGetSheetBlockRequest) => Promise<IGetSheetBlockResponse>;
|
|
14
|
-
/** Fetch missing changeset */
|
|
15
|
-
fetchMissingChangesets: (context: ILogContext, params: IFetchMissingChangesetsRequest) => Promise<IFetchMissingChangesetsResponse>;
|
|
16
|
-
getResourcesRequest: (context: ILogContext, params: IGetResourcesRequest) => Promise<IGetResourcesResponse>;
|
|
17
|
-
/** Save snapshot to a database. */
|
|
18
|
-
saveSnapshot: (context: ILogContext, params: ISaveSnapshotRequest) => Promise<ISaveSnapshotResponse>;
|
|
19
|
-
/** Save sheet block to a database. */
|
|
20
|
-
saveSheetBlock: (context: ILogContext, params: ISaveSheetBlockRequest) => Promise<ISaveSheetBlockResponse>;
|
|
21
|
-
/** Save changeset to a database. */
|
|
22
|
-
saveChangeset: (context: ILogContext, params: ISaveChangesetRequest) => Promise<ISaveChangesetResponse>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 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.
|
|
26
|
-
*/
|
|
27
|
-
export declare class ClientSnapshotServerService implements ISnapshotServerService {
|
|
28
|
-
private _sheetBlockCache;
|
|
29
|
-
/** Load snapshot from a database. */
|
|
30
|
-
getUnitOnRev(context: ILogContext, params: IGetUnitOnRevRequest): Promise<IGetUnitOnRevResponse>;
|
|
31
|
-
/** Load sheet block from a database. */
|
|
32
|
-
getSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetSheetBlockResponse>;
|
|
33
|
-
/** Fetch missing changeset */
|
|
34
|
-
fetchMissingChangesets(context: ILogContext, params: IFetchMissingChangesetsRequest): Promise<IFetchMissingChangesetsResponse>;
|
|
35
|
-
getResourcesRequest(context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
|
|
36
|
-
/** Save snapshot to a database. */
|
|
37
|
-
saveSnapshot(context: ILogContext, params: ISaveSnapshotRequest): Promise<ISaveSnapshotResponse>;
|
|
38
|
-
/** Save sheet block to a database. */
|
|
39
|
-
saveSheetBlock(context: ILogContext, params: ISaveSheetBlockRequest): Promise<ISaveSheetBlockResponse>;
|
|
40
|
-
/** Save changeset to a database. */
|
|
41
|
-
saveChangeset(context: ILogContext, params: ISaveChangesetRequest): Promise<ISaveChangesetResponse>;
|
|
42
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ISheetBlock, ISnapshot } from '@univerjs/protocol';
|
|
2
|
-
import { ILogContext } from '../log/context';
|
|
3
|
-
import { IDocumentData } from '../../types/interfaces/i-document-data';
|
|
4
|
-
import { IWorkbookData } from '../../sheets/typedef';
|
|
5
|
-
import { ISnapshotServerService } from './snapshot-server.service';
|
|
6
|
-
export declare function generateTempDocumentSnapshot(_context: ILogContext, document: IDocumentData, unitID: string, rev: number): Promise<{
|
|
7
|
-
snapshot: ISnapshot;
|
|
8
|
-
}>;
|
|
9
|
-
export declare function generateTemporarySnap(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
10
|
-
snapshotRes: ISnapshot;
|
|
11
|
-
}>;
|
|
12
|
-
export declare function transformWorkbookDataToSnapshot(context: ILogContext, workbook: IWorkbookData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
13
|
-
snapshot: ISnapshot;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Assemble a snapshot to a workbook.
|
|
17
|
-
* @param snapshot
|
|
18
|
-
* @param sheetBlocks
|
|
19
|
-
*/
|
|
20
|
-
export declare function transformSnapshotToWorkbookData(snapshot: ISnapshot, sheetBlocks: ISheetBlock[], _context?: ILogContext): IWorkbookData;
|
|
21
|
-
export declare function transformSnapshotToDocumentData(snapshot: ISnapshot): IDocumentData;
|
|
22
|
-
export declare function transformDocumentDataToSnapshot(context: ILogContext, document: IDocumentData, unitID: string, rev: number, snapshotService: ISnapshotServerService): Promise<{
|
|
23
|
-
snapshot: ISnapshot;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param snapshot
|
|
28
|
-
* @param snapshotService
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export declare function getSheetBlocksFromSnapshot(snapshot: ISnapshot, snapshotService: ISnapshotServerService): Promise<ISheetBlock[]>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ISheetBlock } from '@univerjs/protocol';
|
|
2
|
-
import { IDocumentData } from '../../types/interfaces/i-document-data';
|
|
3
|
-
import { IObjectMatrixPrimitiveType } from '../../shared/object-matrix';
|
|
4
|
-
import { ICellData, IWorkbookData, IWorksheetData } from '../../sheets/typedef';
|
|
5
|
-
export declare const textEncoder: TextEncoder;
|
|
6
|
-
export declare const textDecoder: TextDecoder;
|
|
7
|
-
/**
|
|
8
|
-
* @param worksheet
|
|
9
|
-
*/
|
|
10
|
-
export declare function encodeWorksheetOtherMetas(worksheet: Partial<IWorksheetData>): Uint8Array;
|
|
11
|
-
export declare function encodeWorkbookOtherMetas(workbook: IWorkbookData): Uint8Array;
|
|
12
|
-
export declare function encodeDocOriginalMeta(document: IDocumentData): Uint8Array;
|
|
13
|
-
export declare function decodeWorksheetOtherMetas(buffer: Uint8Array | string): Partial<IWorksheetData>;
|
|
14
|
-
export declare function decodeWorkbookOtherMetas(buffer: Uint8Array | string): Partial<IWorkbookData>;
|
|
15
|
-
export declare function decodePartOfCellData(buffer: Uint8Array | string): IObjectMatrixPrimitiveType<ICellData>;
|
|
16
|
-
export declare function decodeDocOriginalMeta(buffer: Uint8Array | string): Partial<IDocumentData>;
|
|
17
|
-
export declare function splitCellDataToBlocks(cellData: IObjectMatrixPrimitiveType<ICellData>, maxColumn: number): ISheetBlock[];
|