@univerjs-pro/exchange-node 1.3.1 → 1.5.2
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/README.md +251 -5
- package/lib/cjs/index.cjs +246 -27
- package/lib/cjs/mermaid.cjs +236 -0
- package/lib/cjs/pdf.cjs +233 -17
- package/lib/es/mermaid.js +1 -0
- package/lib/shared/runtime.cjs +8 -0
- package/lib/types/index.d.ts +12 -12
- package/lib/types/mermaid.d.ts +26 -0
- package/lib/types/pdf.d.ts +11 -5
- package/lib/types/types.d.ts +129 -50
- package/package.json +19 -9
package/lib/types/pdf.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { ExchangeFormat, IExportOptionsBase, IImportOptionsBase } from "./types.js";
|
|
1
|
+
import { ExchangeFormat, IExportFilesOptions, IExportOptionsBase, IImportFilesOptions, IImportOptionsBase } from "./types.js";
|
|
2
2
|
import "./index.js";
|
|
3
3
|
import { UniverInstanceType } from "@univerjs/core";
|
|
4
4
|
import { IPdfUnitData } from "@univerjs-pro/pdfs";
|
|
5
5
|
//#region src/pdf.d.ts
|
|
6
|
-
interface IPdfImportOptions extends IImportOptionsBase<UniverInstanceType.UNIVER_PDF, ExchangeFormat.PDF> {
|
|
7
|
-
|
|
6
|
+
export interface IPdfImportOptions extends IImportOptionsBase<UniverInstanceType.UNIVER_PDF, ExchangeFormat.PDF> {
|
|
7
|
+
/** Store distinct binary payloads, including source PDF, fonts, images and attachments. */
|
|
8
|
+
files?: IImportFilesOptions;
|
|
9
|
+
}
|
|
10
|
+
export interface IPdfExportOptions extends IExportOptionsBase<UniverInstanceType.UNIVER_PDF, ExchangeFormat.PDF> {
|
|
8
11
|
/** Missing or undecodable required images fail by default. False explicitly permits their omission. */
|
|
9
12
|
strictResources?: boolean;
|
|
13
|
+
/** Load the files required by the selected export route, including an external source PDF. */
|
|
14
|
+
files?: IExportFilesOptions;
|
|
15
|
+
/** Validated for uniform options. PDF does not request Office OLE child Units. */
|
|
16
|
+
ole?: IExportOptionsBase<UniverInstanceType.UNIVER_PDF, ExchangeFormat.PDF>['ole'];
|
|
10
17
|
}
|
|
11
18
|
declare module './types.js' {
|
|
12
19
|
interface ExchangeImportOptionsMap {
|
|
@@ -19,5 +26,4 @@ declare module './types.js' {
|
|
|
19
26
|
[UniverInstanceType.UNIVER_PDF]: IPdfUnitData;
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { IPdfExportOptions, IPdfImportOptions };
|
|
29
|
+
//#endregion
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IBaseSnapshot, IDocumentData, IWorkbookData, UniverInstanceType } from "@univerjs/core";
|
|
2
|
+
import { IBoardData } from "@univerjs-pro/boards";
|
|
2
3
|
import { ISlideData } from "@univerjs-pro/slides";
|
|
3
4
|
import { ISheetBlock, ISnapshot } from "@univerjs/protocol";
|
|
4
5
|
//#region src/types.d.ts
|
|
5
|
-
declare enum ExchangeFormat {
|
|
6
|
+
export declare enum ExchangeFormat {
|
|
6
7
|
XLS = "xls",
|
|
7
8
|
XLSX = "xlsx",
|
|
8
9
|
CSV = "csv",
|
|
@@ -11,82 +12,83 @@ declare enum ExchangeFormat {
|
|
|
11
12
|
DOCX = "docx",
|
|
12
13
|
PPT = "ppt",
|
|
13
14
|
PPTX = "pptx",
|
|
14
|
-
PDF = "pdf"
|
|
15
|
+
PDF = "pdf",
|
|
16
|
+
MERMAID = "mermaid"
|
|
15
17
|
}
|
|
16
|
-
declare enum FormulaCalculationMode {
|
|
18
|
+
export declare enum FormulaCalculationMode {
|
|
17
19
|
FORCED = "forced",
|
|
18
20
|
WHEN_EMPTY = "when_empty",
|
|
19
21
|
NO = "no"
|
|
20
22
|
}
|
|
21
|
-
declare enum CsvTypeInferenceMode {
|
|
23
|
+
export declare enum CsvTypeInferenceMode {
|
|
22
24
|
OFF = "off",
|
|
23
25
|
SAFE = "safe",
|
|
24
26
|
AGGRESSIVE = "aggressive"
|
|
25
27
|
}
|
|
26
|
-
declare enum CsvQuoteStyle {
|
|
28
|
+
export declare enum CsvQuoteStyle {
|
|
27
29
|
MINIMAL = "minimal",
|
|
28
30
|
ALWAYS = "always"
|
|
29
31
|
}
|
|
30
|
-
declare enum CsvLineEnding {
|
|
32
|
+
export declare enum CsvLineEnding {
|
|
31
33
|
LF = "lf",
|
|
32
34
|
CRLF = "cr_lf"
|
|
33
35
|
}
|
|
34
|
-
declare enum CsvValueMode {
|
|
36
|
+
export declare enum CsvValueMode {
|
|
35
37
|
DISPLAY = "display",
|
|
36
38
|
RAW = "raw"
|
|
37
39
|
}
|
|
38
|
-
declare enum CsvFormulaMode {
|
|
40
|
+
export declare enum CsvFormulaMode {
|
|
39
41
|
CACHED = "cached",
|
|
40
42
|
EXPRESSION = "expression"
|
|
41
43
|
}
|
|
42
|
-
declare enum BaseImportMode {
|
|
44
|
+
export declare enum BaseImportMode {
|
|
43
45
|
TABLES = "tables",
|
|
44
46
|
SHEETS = "sheets",
|
|
45
47
|
HYBRID = "hybrid",
|
|
46
48
|
AUTO = "auto"
|
|
47
49
|
}
|
|
48
|
-
declare enum BaseTypeInference {
|
|
50
|
+
export declare enum BaseTypeInference {
|
|
49
51
|
NONE = "none",
|
|
50
52
|
SAFE = "safe",
|
|
51
53
|
AGGRESSIVE = "aggressive"
|
|
52
54
|
}
|
|
53
|
-
declare enum BaseFormulaPolicy {
|
|
55
|
+
export declare enum BaseFormulaPolicy {
|
|
54
56
|
VALUES = "values",
|
|
55
57
|
TEXT = "text",
|
|
56
58
|
FAIL = "fail",
|
|
57
59
|
CONVERT_THEN_VALUES = "convertThenValues"
|
|
58
60
|
}
|
|
59
|
-
declare enum BaseImagePolicy {
|
|
61
|
+
export declare enum BaseImagePolicy {
|
|
60
62
|
SAFE = "safe",
|
|
61
63
|
CELL_ONLY = "cell-only",
|
|
62
64
|
MEDIA_TABLE = "media-table",
|
|
63
65
|
NONE = "none"
|
|
64
66
|
}
|
|
65
|
-
declare enum BaseHeaderPolicy {
|
|
67
|
+
export declare enum BaseHeaderPolicy {
|
|
66
68
|
FIRST_ROW = "firstRow",
|
|
67
69
|
NONE = "none"
|
|
68
70
|
}
|
|
69
|
-
declare enum BaseExportMode {
|
|
71
|
+
export declare enum BaseExportMode {
|
|
70
72
|
TABLES = "tables",
|
|
71
73
|
RANGES = "ranges"
|
|
72
74
|
}
|
|
73
|
-
declare enum BaseAttachmentPolicy {
|
|
75
|
+
export declare enum BaseAttachmentPolicy {
|
|
74
76
|
HYBRID = "hybrid",
|
|
75
77
|
MANIFEST = "manifest",
|
|
76
78
|
LINKS = "links",
|
|
77
79
|
NONE = "none"
|
|
78
80
|
}
|
|
79
|
-
declare enum DocxCompatibilityMode {
|
|
81
|
+
export declare enum DocxCompatibilityMode {
|
|
80
82
|
TRADITIONAL = "traditional",
|
|
81
83
|
MODERN = "modern"
|
|
82
84
|
}
|
|
83
|
-
interface IBaseFieldMapping {
|
|
85
|
+
export interface IBaseFieldMapping {
|
|
84
86
|
name?: string;
|
|
85
87
|
type?: string;
|
|
86
88
|
config?: unknown;
|
|
87
89
|
formulaPolicy?: BaseFormulaPolicy;
|
|
88
90
|
}
|
|
89
|
-
interface IBaseTableMapping {
|
|
91
|
+
export interface IBaseTableMapping {
|
|
90
92
|
include?: boolean;
|
|
91
93
|
name?: string;
|
|
92
94
|
primaryField?: string;
|
|
@@ -94,12 +96,12 @@ interface IBaseTableMapping {
|
|
|
94
96
|
formulaPolicy?: BaseFormulaPolicy;
|
|
95
97
|
fields?: Record<string, IBaseFieldMapping>;
|
|
96
98
|
}
|
|
97
|
-
interface IBaseImportMapping {
|
|
99
|
+
export interface IBaseImportMapping {
|
|
98
100
|
selectedOnly?: boolean;
|
|
99
101
|
tables?: Record<string, IBaseTableMapping>;
|
|
100
102
|
sheets?: Record<string, IBaseTableMapping>;
|
|
101
103
|
}
|
|
102
|
-
interface IBaseExportMapping {
|
|
104
|
+
export interface IBaseExportMapping {
|
|
103
105
|
tables?: Record<string, {
|
|
104
106
|
name?: string;
|
|
105
107
|
fields?: Record<string, {
|
|
@@ -107,13 +109,13 @@ interface IBaseExportMapping {
|
|
|
107
109
|
}>;
|
|
108
110
|
}>;
|
|
109
111
|
}
|
|
110
|
-
interface ICsvImportOptions {
|
|
112
|
+
export interface ICsvImportOptions {
|
|
111
113
|
delimiter?: 'auto' | 'comma' | 'tab' | 'semicolon' | 'pipe' | 'space' | string;
|
|
112
114
|
quote?: 'auto' | 'none' | 'double' | 'single' | string;
|
|
113
115
|
encoding?: string;
|
|
114
116
|
inferTypes?: CsvTypeInferenceMode;
|
|
115
117
|
}
|
|
116
|
-
type ICsvExportSelector = {
|
|
118
|
+
export type ICsvExportSelector = {
|
|
117
119
|
worksheetId: string;
|
|
118
120
|
worksheetName?: never;
|
|
119
121
|
tableId?: never;
|
|
@@ -134,7 +136,7 @@ type ICsvExportSelector = {
|
|
|
134
136
|
tableId?: never;
|
|
135
137
|
tableName: string;
|
|
136
138
|
};
|
|
137
|
-
type ICsvExportOptions = ICsvExportSelector & {
|
|
139
|
+
export type ICsvExportOptions = ICsvExportSelector & {
|
|
138
140
|
delimiter?: 'comma' | 'tab' | 'semicolon' | 'pipe' | 'space' | string;
|
|
139
141
|
quoteStyle?: CsvQuoteStyle;
|
|
140
142
|
lineEnding?: CsvLineEnding;
|
|
@@ -142,25 +144,81 @@ type ICsvExportOptions = ICsvExportSelector & {
|
|
|
142
144
|
valueMode?: CsvValueMode;
|
|
143
145
|
formulaMode?: CsvFormulaMode;
|
|
144
146
|
};
|
|
145
|
-
interface ExchangeDiagnostic {
|
|
147
|
+
export interface ExchangeDiagnostic {
|
|
146
148
|
code: string;
|
|
147
149
|
message: string;
|
|
148
150
|
details: Record<string, unknown>;
|
|
149
151
|
}
|
|
150
|
-
interface ConversionDiagnosticOptions {
|
|
152
|
+
export interface ConversionDiagnosticOptions {
|
|
151
153
|
onDiagnostics?: (items: readonly ExchangeDiagnostic[]) => void | Promise<void>;
|
|
152
154
|
}
|
|
153
|
-
|
|
155
|
+
/** One distinct file found inline during import. Identical bytes are offered once. */
|
|
156
|
+
export interface IImportedFile {
|
|
157
|
+
/** Original file name or package part name, such as `image1.png` or `Report.docx`. */
|
|
158
|
+
name: string;
|
|
159
|
+
mimeType: string;
|
|
160
|
+
size: number;
|
|
161
|
+
bytes: Uint8Array;
|
|
162
|
+
}
|
|
163
|
+
/** The application's decision for one imported file. */
|
|
164
|
+
export type IImportFileResult = {
|
|
165
|
+
mode: 'inline';
|
|
166
|
+
} | {
|
|
167
|
+
mode: 'reference';
|
|
168
|
+
source: string;
|
|
169
|
+
};
|
|
170
|
+
export interface IImportFilesOptions {
|
|
171
|
+
/**
|
|
172
|
+
* Called once per distinct file, in order. Returning `reference` replaces the inline bytes
|
|
173
|
+
* with a `UUID` reference to `source`. A rejection fails the import; calls already made have
|
|
174
|
+
* completed by then, so the application can clean up what it stored.
|
|
175
|
+
*/
|
|
176
|
+
store: (file: IImportedFile) => Promise<IImportFileResult>;
|
|
177
|
+
}
|
|
178
|
+
/** A reference an export must resolve. `unitId` is the snapshot the reference lives in. */
|
|
179
|
+
export interface IExportFileRef {
|
|
180
|
+
sourceType: 'UUID' | 'URL';
|
|
181
|
+
source: string;
|
|
182
|
+
unitId: string;
|
|
183
|
+
}
|
|
184
|
+
export interface IExportFileContent {
|
|
185
|
+
bytes: Uint8Array;
|
|
186
|
+
}
|
|
187
|
+
export interface IExportFilesOptions {
|
|
188
|
+
/**
|
|
189
|
+
* Called once per distinct reference and must return bytes. Without this option, `UUID` and
|
|
190
|
+
* `URL` references keep the current behavior: images are skipped where the format allows it
|
|
191
|
+
* and stored attachments fail the export.
|
|
192
|
+
*/
|
|
193
|
+
load: (ref: IExportFileRef) => Promise<IExportFileContent>;
|
|
194
|
+
}
|
|
195
|
+
export type OleOnlineUnitType = UniverInstanceType.UNIVER_DOC | UniverInstanceType.UNIVER_SHEET | UniverInstanceType.UNIVER_SLIDE;
|
|
196
|
+
export interface IOleOnlineUnitRef {
|
|
197
|
+
unitId: string;
|
|
198
|
+
type: OleOnlineUnitType;
|
|
199
|
+
}
|
|
200
|
+
/** Which version of converted attachments an export embeds. */
|
|
201
|
+
export type IExportOleOptions = {
|
|
202
|
+
attachmentSource?: 'original';
|
|
203
|
+
loadOnlineUnit?: never;
|
|
204
|
+
} | {
|
|
205
|
+
attachmentSource: 'online';
|
|
206
|
+
/** Read the confirmed snapshot of a converted attachment's online Unit. */
|
|
207
|
+
loadOnlineUnit: (ref: IOleOnlineUnitRef) => Promise<ISnapshotWithBlocks>;
|
|
208
|
+
};
|
|
209
|
+
export interface IImportOptionsBase<TType extends UniverInstanceType, TFormat extends ExchangeFormat> extends ConversionDiagnosticOptions {
|
|
154
210
|
type: TType;
|
|
155
211
|
format?: TFormat;
|
|
156
212
|
fileName?: string;
|
|
157
213
|
unitId?: string;
|
|
214
|
+
/** Omitted: images and attachments stay inline, as before. */
|
|
215
|
+
files?: IImportFilesOptions;
|
|
158
216
|
}
|
|
159
|
-
interface IGridImportOptions {
|
|
217
|
+
export interface IGridImportOptions {
|
|
160
218
|
minSheetRowCount?: number;
|
|
161
219
|
minSheetColumnCount?: number;
|
|
162
220
|
}
|
|
163
|
-
type ISheetImportOptions = IGridImportOptions & ((IImportOptionsBase<UniverInstanceType.UNIVER_SHEET, ExchangeFormat.XLS> & {
|
|
221
|
+
export type ISheetImportOptions = IGridImportOptions & ((IImportOptionsBase<UniverInstanceType.UNIVER_SHEET, ExchangeFormat.XLS> & {
|
|
164
222
|
csv?: never;
|
|
165
223
|
formulaCalculation?: never;
|
|
166
224
|
}) | (IImportOptionsBase<UniverInstanceType.UNIVER_SHEET, ExchangeFormat.XLSX> & {
|
|
@@ -178,44 +236,55 @@ interface IBaseImportConfig extends IGridImportOptions {
|
|
|
178
236
|
maxCells?: number | null;
|
|
179
237
|
mapping?: IBaseImportMapping;
|
|
180
238
|
}
|
|
181
|
-
type IBaseImportOptions = IBaseImportConfig & ((IImportOptionsBase<UniverInstanceType.UNIVER_BASE, ExchangeFormat.XLS | ExchangeFormat.XLSX> & {
|
|
239
|
+
export type IBaseImportOptions = IBaseImportConfig & ((IImportOptionsBase<UniverInstanceType.UNIVER_BASE, ExchangeFormat.XLS | ExchangeFormat.XLSX> & {
|
|
182
240
|
csv?: never;
|
|
241
|
+
files?: never;
|
|
183
242
|
}) | (IImportOptionsBase<UniverInstanceType.UNIVER_BASE, ExchangeFormat.CSV | ExchangeFormat.TSV> & {
|
|
184
243
|
csv?: ICsvImportOptions;
|
|
244
|
+
files?: never;
|
|
185
245
|
}));
|
|
186
|
-
interface IDocImportOptions extends IImportOptionsBase<UniverInstanceType.UNIVER_DOC, ExchangeFormat.DOC | ExchangeFormat.DOCX> {
|
|
246
|
+
export interface IDocImportOptions extends IImportOptionsBase<UniverInstanceType.UNIVER_DOC, ExchangeFormat.DOC | ExchangeFormat.DOCX> {
|
|
187
247
|
compatibilityMode?: DocxCompatibilityMode;
|
|
188
248
|
}
|
|
189
|
-
interface ISlideImportOptions extends IImportOptionsBase<UniverInstanceType.UNIVER_SLIDE, ExchangeFormat.PPT | ExchangeFormat.PPTX> {}
|
|
249
|
+
export interface ISlideImportOptions extends IImportOptionsBase<UniverInstanceType.UNIVER_SLIDE, ExchangeFormat.PPT | ExchangeFormat.PPTX> {}
|
|
190
250
|
/** Capability maps are extended by optional format entries such as /pdf. */
|
|
191
|
-
interface ExchangeImportOptionsMap {
|
|
251
|
+
export interface ExchangeImportOptionsMap {
|
|
192
252
|
[UniverInstanceType.UNIVER_SHEET]: ISheetImportOptions;
|
|
193
253
|
[UniverInstanceType.UNIVER_BASE]: IBaseImportOptions;
|
|
194
254
|
[UniverInstanceType.UNIVER_DOC]: IDocImportOptions;
|
|
195
255
|
[UniverInstanceType.UNIVER_SLIDE]: ISlideImportOptions;
|
|
196
256
|
}
|
|
197
|
-
interface ExchangeUnitDataMap {
|
|
257
|
+
export interface ExchangeUnitDataMap {
|
|
258
|
+
[UniverInstanceType.UNIVER_BOARD]: IBoardData;
|
|
198
259
|
[UniverInstanceType.UNIVER_SHEET]: IWorkbookData;
|
|
199
260
|
[UniverInstanceType.UNIVER_BASE]: IBaseSnapshot;
|
|
200
261
|
[UniverInstanceType.UNIVER_DOC]: IDocumentData;
|
|
201
262
|
[UniverInstanceType.UNIVER_SLIDE]: ISlideData;
|
|
202
263
|
}
|
|
203
|
-
type ImportOptions = ExchangeImportOptionsMap[keyof ExchangeImportOptionsMap];
|
|
204
|
-
type BufferImportOptions<T extends ImportOptions = ImportOptions> = T & {
|
|
264
|
+
export type ImportOptions = ExchangeImportOptionsMap[keyof ExchangeImportOptionsMap];
|
|
265
|
+
export type BufferImportOptions<T extends ImportOptions = ImportOptions> = T & {
|
|
205
266
|
fileName: string;
|
|
206
267
|
};
|
|
207
|
-
interface IExportOptionsBase<TType extends UniverInstanceType, TFormat extends ExchangeFormat> extends ConversionDiagnosticOptions, IExchangeConfig {
|
|
268
|
+
export interface IExportOptionsBase<TType extends UniverInstanceType, TFormat extends ExchangeFormat> extends ConversionDiagnosticOptions, IExchangeConfig {
|
|
208
269
|
type: TType;
|
|
209
270
|
format: TFormat;
|
|
271
|
+
/** Omitted: `UUID` and `URL` references are handled exactly as before. */
|
|
272
|
+
files?: IExportFilesOptions;
|
|
273
|
+
/** Omitted or `original`: converted attachments embed their original file. */
|
|
274
|
+
ole?: IExportOleOptions;
|
|
210
275
|
}
|
|
211
276
|
interface ISheetExportConfig {
|
|
212
277
|
/** @default FormulaCalculationMode.WHEN_EMPTY */
|
|
213
278
|
formulaCalculation?: FormulaCalculationMode;
|
|
214
279
|
}
|
|
215
|
-
type ISheetExportOptions = ISheetExportConfig & ((IExportOptionsBase<UniverInstanceType.UNIVER_SHEET, ExchangeFormat.XLSX> & {
|
|
280
|
+
export type ISheetExportOptions = ISheetExportConfig & ((IExportOptionsBase<UniverInstanceType.UNIVER_SHEET, ExchangeFormat.XLSX> & {
|
|
216
281
|
csv?: never;
|
|
282
|
+
/** Leave eligible PivotTable results for Excel to calculate on refresh. Defaults to false. */
|
|
283
|
+
deferPivotCalculation?: boolean;
|
|
217
284
|
}) | (IExportOptionsBase<UniverInstanceType.UNIVER_SHEET, ExchangeFormat.CSV | ExchangeFormat.TSV> & {
|
|
218
285
|
csv: ICsvExportOptions;
|
|
286
|
+
files?: never;
|
|
287
|
+
ole?: never;
|
|
219
288
|
}));
|
|
220
289
|
interface IBaseXlsxExportConfig {
|
|
221
290
|
mode?: BaseExportMode;
|
|
@@ -223,25 +292,35 @@ interface IBaseXlsxExportConfig {
|
|
|
223
292
|
attachmentPolicy?: BaseAttachmentPolicy;
|
|
224
293
|
mapping?: IBaseExportMapping;
|
|
225
294
|
}
|
|
226
|
-
type IBaseExportOptions = (IExportOptionsBase<UniverInstanceType.UNIVER_BASE, ExchangeFormat.XLSX> & IBaseXlsxExportConfig & {
|
|
295
|
+
export type IBaseExportOptions = (IExportOptionsBase<UniverInstanceType.UNIVER_BASE, ExchangeFormat.XLSX> & IBaseXlsxExportConfig & {
|
|
227
296
|
csv?: never;
|
|
297
|
+
files?: never;
|
|
298
|
+
ole?: never;
|
|
228
299
|
}) | (IExportOptionsBase<UniverInstanceType.UNIVER_BASE, ExchangeFormat.CSV | ExchangeFormat.TSV> & {
|
|
229
300
|
csv: ICsvExportOptions;
|
|
301
|
+
files?: never;
|
|
302
|
+
ole?: never;
|
|
230
303
|
});
|
|
231
|
-
interface IDocExportOptions extends IExportOptionsBase<UniverInstanceType.UNIVER_DOC, ExchangeFormat.DOCX> {}
|
|
232
|
-
interface ISlideExportOptions extends IExportOptionsBase<UniverInstanceType.UNIVER_SLIDE, ExchangeFormat.PPTX> {}
|
|
233
|
-
|
|
304
|
+
export interface IDocExportOptions extends IExportOptionsBase<UniverInstanceType.UNIVER_DOC, ExchangeFormat.DOCX> {}
|
|
305
|
+
export interface ISlideExportOptions extends IExportOptionsBase<UniverInstanceType.UNIVER_SLIDE, ExchangeFormat.PPTX> {}
|
|
306
|
+
/** Export the active Board page as one PPTX slide; if omitted, use pageOrder[0].
|
|
307
|
+
* Resource callbacks run only for required references. Valid ole options are accepted,
|
|
308
|
+
* but Boards currently have no OLE attachment elements or online child Units.
|
|
309
|
+
*/
|
|
310
|
+
export interface IBoardExportOptions extends IExportOptionsBase<UniverInstanceType.UNIVER_BOARD, ExchangeFormat.PPTX> {}
|
|
311
|
+
export interface ExchangeExportOptionsMap {
|
|
312
|
+
[UniverInstanceType.UNIVER_BOARD]: IBoardExportOptions;
|
|
234
313
|
[UniverInstanceType.UNIVER_SHEET]: ISheetExportOptions;
|
|
235
314
|
[UniverInstanceType.UNIVER_BASE]: IBaseExportOptions;
|
|
236
315
|
[UniverInstanceType.UNIVER_DOC]: IDocExportOptions;
|
|
237
316
|
[UniverInstanceType.UNIVER_SLIDE]: ISlideExportOptions;
|
|
238
317
|
}
|
|
239
|
-
type ExportOptions = ExchangeExportOptionsMap[keyof ExchangeExportOptionsMap];
|
|
240
|
-
interface ISnapshotWithBlocks {
|
|
318
|
+
export type ExportOptions = ExchangeExportOptionsMap[keyof ExchangeExportOptionsMap];
|
|
319
|
+
export interface ISnapshotWithBlocks {
|
|
241
320
|
snapshot: ISnapshot;
|
|
242
321
|
sheetBlocks: ISheetBlock[];
|
|
243
322
|
}
|
|
244
|
-
declare enum ExchangeErrorCode {
|
|
323
|
+
export declare enum ExchangeErrorCode {
|
|
245
324
|
INVALID_ARGUMENT = "INVALID_ARGUMENT",
|
|
246
325
|
UNSUPPORTED_FORMAT = "UNSUPPORTED_FORMAT",
|
|
247
326
|
INVALID_FILE = "INVALID_FILE",
|
|
@@ -259,7 +338,7 @@ declare enum ExchangeErrorCode {
|
|
|
259
338
|
LICENSE_USAGE_STATE_INVALID = "LICENSE_USAGE_STATE_INVALID",
|
|
260
339
|
LICENSE_USAGE_STORAGE_ERROR = "LICENSE_USAGE_STORAGE_ERROR"
|
|
261
340
|
}
|
|
262
|
-
declare class ExchangeError extends Error {
|
|
341
|
+
export declare class ExchangeError extends Error {
|
|
263
342
|
readonly code: ExchangeErrorCode;
|
|
264
343
|
readonly name = "ExchangeError";
|
|
265
344
|
constructor(code: ExchangeErrorCode, message: string, options?: {
|
|
@@ -271,20 +350,20 @@ declare class ExchangeError extends Error {
|
|
|
271
350
|
* export and quota-query options override them for that operation only.
|
|
272
351
|
* Provide both credentials together. configureExchange({}) explicitly selects Free.
|
|
273
352
|
*/
|
|
274
|
-
interface IExchangeConfig {
|
|
353
|
+
export interface IExchangeConfig {
|
|
275
354
|
license?: string;
|
|
276
355
|
licenseKey?: string;
|
|
277
356
|
}
|
|
278
357
|
/** Per-call credentials override defaults only for this export or quota query.
|
|
279
358
|
* Supply the complete pair; omitting both uses the configured or environment credentials.
|
|
280
359
|
*/
|
|
281
|
-
type IExportQuotaOptions = IExchangeConfig;
|
|
282
|
-
type ExportUnitType = 'sheet' | 'doc' | 'slide' | 'base' | 'pdf';
|
|
360
|
+
export type IExportQuotaOptions = IExchangeConfig;
|
|
361
|
+
export type ExportUnitType = 'sheet' | 'doc' | 'slide' | 'base' | 'pdf';
|
|
283
362
|
/** Shared quota snapshot, not export permission. Querying neither reserves nor consumes quota.
|
|
284
363
|
* Version, activation and unit-type restrictions are enforced only during export.
|
|
285
364
|
* Before activation, a limited quota describes the first period (periodStart is in the future).
|
|
286
365
|
*/
|
|
287
|
-
interface ExportQuota {
|
|
366
|
+
export interface ExportQuota {
|
|
288
367
|
licenseStatus: 'not_configured' | 'expired' | 'valid';
|
|
289
368
|
expiresAt: string | null;
|
|
290
369
|
observedAt: string;
|
|
@@ -296,4 +375,4 @@ interface ExportQuota {
|
|
|
296
375
|
periodEnd: string | null;
|
|
297
376
|
}
|
|
298
377
|
//#endregion
|
|
299
|
-
export {
|
|
378
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@univerjs-pro/
|
|
5
|
-
"@univerjs-pro/
|
|
6
|
-
"@univerjs-pro/
|
|
7
|
-
"@univerjs/
|
|
8
|
-
"@univerjs/
|
|
9
|
-
"@univerjs
|
|
4
|
+
"@univerjs-pro/boards": "1.5.2",
|
|
5
|
+
"@univerjs-pro/collaboration": "1.5.2",
|
|
6
|
+
"@univerjs-pro/exchange-node-binding": "~1.2.0",
|
|
7
|
+
"@univerjs-pro/pdfs": "1.5.2",
|
|
8
|
+
"@univerjs-pro/slides": "1.5.2",
|
|
9
|
+
"@univerjs/core": "1.5.2",
|
|
10
|
+
"@univerjs/protocol": "1.5.2"
|
|
10
11
|
},
|
|
11
12
|
"description": "Node.js SDK for converting between Office formats, Univer unit data, and snapshots",
|
|
12
13
|
"files": [
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
],
|
|
16
17
|
"name": "@univerjs-pro/exchange-node",
|
|
17
18
|
"peerDependencies": {
|
|
18
|
-
"@univerjs-pro/exchange-pdf-node-binding": "~1.0
|
|
19
|
+
"@univerjs-pro/exchange-pdf-node-binding": "~1.2.0"
|
|
19
20
|
},
|
|
20
21
|
"peerDependenciesMeta": {
|
|
21
22
|
"@univerjs-pro/exchange-pdf-node-binding": {
|
|
@@ -25,10 +26,13 @@
|
|
|
25
26
|
"sideEffects": [
|
|
26
27
|
"./src/pdf.ts",
|
|
27
28
|
"./lib/es/pdf.js",
|
|
28
|
-
"./lib/cjs/pdf.cjs"
|
|
29
|
+
"./lib/cjs/pdf.cjs",
|
|
30
|
+
"./src/mermaid.ts",
|
|
31
|
+
"./lib/es/mermaid.js",
|
|
32
|
+
"./lib/cjs/mermaid.cjs"
|
|
29
33
|
],
|
|
30
34
|
"type": "module",
|
|
31
|
-
"version": "1.
|
|
35
|
+
"version": "1.5.2",
|
|
32
36
|
"main": "./lib/cjs/index.cjs",
|
|
33
37
|
"module": "./lib/es/index.js",
|
|
34
38
|
"types": "./lib/types/index.d.ts",
|
|
@@ -44,6 +48,12 @@
|
|
|
44
48
|
"import": "./lib/es/pdf.js",
|
|
45
49
|
"require": "./lib/cjs/pdf.cjs",
|
|
46
50
|
"default": "./lib/es/pdf.js"
|
|
51
|
+
},
|
|
52
|
+
"./mermaid": {
|
|
53
|
+
"types": "./lib/types/mermaid.d.ts",
|
|
54
|
+
"import": "./lib/es/mermaid.js",
|
|
55
|
+
"require": "./lib/cjs/mermaid.cjs",
|
|
56
|
+
"default": "./lib/es/mermaid.js"
|
|
47
57
|
}
|
|
48
58
|
},
|
|
49
59
|
"publishConfig": {
|