3dviewer-sdk 1.0.8 → 1.0.10

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/dist/index.d.mts CHANGED
@@ -249,6 +249,10 @@ type ConvertV2Options = {
249
249
  project?: string;
250
250
  convertOptions?: Partial<StreamConvertOptions>;
251
251
  };
252
+ type FileInfoCheckInput = string | string[];
253
+ type FileInfoCheckPayloadItem = {
254
+ baseFileId: string;
255
+ };
252
256
  type StreamConvertOptions = {
253
257
  convert3DModel: number;
254
258
  convert2DSheet: number;
@@ -307,6 +311,7 @@ declare class FilesModule {
307
311
  convert(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
308
312
  prepare(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
309
313
  convertV2(options: ConvertV2Options): Promise<PreparedViewerData>;
314
+ checkFileInfo(baseFileIds: FileInfoCheckInput): Promise<unknown>;
310
315
  open(input: PreparedViewerData | {
311
316
  url: string;
312
317
  }): void;
@@ -325,6 +330,7 @@ declare class FilesModule {
325
330
  private uploadInternal;
326
331
  private buildCachePayload;
327
332
  private buildConvertV2Payload;
333
+ private buildFileInfoPayload;
328
334
  private cacheFile;
329
335
  private cacheFileV2;
330
336
  private convertInternal;
@@ -511,4 +517,4 @@ declare class Viewer3D {
511
517
  private handleMessage;
512
518
  }
513
519
 
514
- export { type ConvertOptions, type ConvertV2Options, type FilesConfig, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };
520
+ export { type ConvertOptions, type ConvertV2Options, type FileInfoCheckInput, type FileInfoCheckPayloadItem, type FilesConfig, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };
package/dist/index.d.ts CHANGED
@@ -1,514 +1,4 @@
1
- declare enum ViewerMessageType {
2
- LANGUAGE_CHANGE = "viewer-language-change",
3
- ZOOM = "viewer-zoom",
4
- DRAW_MODE = "viewer-draw-mode",
5
- EXPLODE = "viewer-explode",
6
- MARKUP_ACTION = "viewer-markup-action",
7
- MARKUP_SAVE = "viewer-markup-save",
8
- MARKUP_CANCEL = "viewer-markup-cancel",
9
- MARKUP_GET_LIST = "viewer-markup-get-list",
10
- MARKUP_SAVE_RESULT = "viewer-markup-save-result",
11
- MARKUP_CANCEL_RESULT = "viewer-markup-cancel-result",
12
- MARKUP_LIST = "viewer-markup-list",
13
- HOME = "viewer-home",
14
- PAN_TOGGLE = "viewer-pan-toggle",
15
- SELECT = "viewer-select",
16
- AREA_SELECT = "viewer-area-select",
17
- ORBIT = "viewer-orbit",
18
- ROTATE_Z = "viewer-rotate-z",
19
- WALK_THROUGH = "viewer-walk-through",
20
- ZOOM_WINDOW = "viewer-zoom-window",
21
- ZOOM_FIT = "viewer-zoom-fit",
22
- TOOLBAR_CONFIG = "viewer-toolbar-config",
23
- TOOLBAR_VISIBILITY = "viewer-toolbar-visibility",
24
- PANEL_OPEN = "viewer-panel-open",
25
- PANEL_CLOSE = "viewer-panel-close",
26
- CUTTING_PLANE_ACTION = "viewer-cutting-plane-action",
27
- SHEETS_GET_LIST = "viewer-sheets-get-list",
28
- SHEETS_LIST = "viewer-sheets-list",
29
- SHEETS_APPLY = "viewer-sheets-apply",
30
- TREE_SELECT_NODE = "viewer-tree-select-node",
31
- TREE_GET_NODE_IDS = "viewer-tree-get-node-ids",
32
- TREE_NODE_IDS = "viewer-tree-node-ids",
33
- PDF_PLAN_MODE = "viewer-pdf-plan-mode",
34
- PDF_DOCUMENT_MODE = "viewer-pdf-document-mode",
35
- PDF_FIRST_PAGE = "viewer-pdf-first-page",
36
- PDF_PREVIOUS_PAGE = "viewer-pdf-previous-page",
37
- PDF_NEXT_PAGE = "viewer-pdf-next-page",
38
- PDF_LAST_PAGE = "viewer-pdf-last-page",
39
- PDF_CURRENT_PAGE = "viewer-pdf-current-page",
40
- HOME_CLICK = "viewer-home-click",
41
- NODE_SELECT = "viewer-node-select",
42
- PAN_CHANGE = "viewer-pan-change"
43
- }
44
- type LanguageCode = "en" | "vn";
45
- type ToolbarVisibilityTarget = "all" | "left" | "center" | "right";
46
- type MarkupAction = "line" | "arrow" | "circle" | "ellipse" | "rectangle" | "polygon" | "polyline" | "textbox" | "note" | "callout" | "cloud" | "freehand";
47
- type MarkupOperationResultPayload = {
48
- requestId: string;
49
- success: boolean;
50
- timestamp: number;
51
- error?: string;
52
- };
53
- type MarkupListItem = {
54
- id: string;
55
- viewId: string;
56
- viewName?: string;
57
- title: string;
58
- type: string;
59
- shapeName?: string;
60
- createdDate?: string;
61
- modifiedDate?: string;
62
- createdBy?: string;
63
- lastModifiedBy?: string;
64
- };
65
- type SheetListItem = {
66
- id: string | number;
67
- name: string;
68
- is3D?: boolean;
69
- viewId?: string;
70
- };
71
- type PdfModeEventPayload = {
72
- mode: "plan" | "document";
73
- timestamp: number;
74
- };
75
- type PdfToolbarActionEventPayload = {
76
- timestamp: number;
77
- };
78
- type PdfCurrentPagePayload = {
79
- pageIndex: number;
80
- pageNumber: number;
81
- timestamp: number;
82
- };
83
-
84
- type ViewerEventMap = {
85
- "camera:home": {
86
- timestamp: number;
87
- };
88
- "node:select": {
89
- nodeId: string;
90
- timestamp: number;
91
- };
92
- "interaction:pan-change": {
93
- enabled: boolean;
94
- };
95
- "toolbar:pdf-plan-mode": PdfModeEventPayload;
96
- "toolbar:pdf-document-mode": PdfModeEventPayload;
97
- "toolbar:pdf-first-page": PdfToolbarActionEventPayload;
98
- "toolbar:pdf-previous-page": PdfToolbarActionEventPayload;
99
- "toolbar:pdf-next-page": PdfToolbarActionEventPayload;
100
- "toolbar:pdf-last-page": PdfToolbarActionEventPayload;
101
- "toolbar:pdf-current-page": PdfCurrentPagePayload;
102
- "modelTree:node-ids": {
103
- requestId: string;
104
- nodeIds: string[];
105
- timestamp: number;
106
- };
107
- "sheets:list": {
108
- requestId: string;
109
- sheets: {
110
- id: string | number;
111
- name: string;
112
- is3D?: boolean;
113
- viewId?: string;
114
- }[];
115
- activeSheetId?: string | number | null;
116
- timestamp: number;
117
- };
118
- "markup:list": {
119
- requestId: string;
120
- markups: MarkupListItem[];
121
- timestamp: number;
122
- };
123
- "markup:save": MarkupOperationResultPayload;
124
- "markup:cancel": MarkupOperationResultPayload;
125
- };
126
- type LoadStage = "idle" | "uploading" | "converting" | "rendering" | "completed" | "error";
127
- type LoadStatePayload = {
128
- isLoading: boolean;
129
- stage: LoadStage;
130
- message?: string;
131
- elapsedMs?: number;
132
- };
133
- type PreparedViewerData = {
134
- baseFileId: string;
135
- baseMajorRev: number;
136
- baseMinorRev: number;
137
- fileName: string;
138
- query: string;
139
- url: string;
140
- };
141
- type FilesEventMap = {
142
- "files:state": LoadStatePayload;
143
- "files:upload:start": {
144
- fileName: string;
145
- };
146
- "files:upload:success": {
147
- fileName: string;
148
- baseFileId: string;
149
- };
150
- "files:upload:error": {
151
- fileName: string;
152
- error: string;
153
- };
154
- "files:conversion:start": {
155
- fileName: string;
156
- };
157
- "files:conversion:success": PreparedViewerData;
158
- "files:conversion:error": {
159
- fileName: string;
160
- error: string;
161
- };
162
- "files:render:start": {
163
- url: string;
164
- };
165
- "files:render:success": {
166
- url: string;
167
- };
168
- "files:render:error": {
169
- url?: string;
170
- error: string;
171
- };
172
- "files:load:success": PreparedViewerData;
173
- "files:load:error": {
174
- error: string;
175
- };
176
- };
177
- type SdkEventMap = ViewerEventMap & FilesEventMap;
178
- type SdkEventKey = keyof SdkEventMap;
179
- type SdkEventPayload<K extends SdkEventKey> = SdkEventMap[K];
180
-
181
- declare class CameraModule {
182
- private viewer;
183
- on: {
184
- home: (cb: (payload: {
185
- timestamp: number;
186
- }) => void) => () => void;
187
- };
188
- constructor(viewer: Viewer3D);
189
- zoomIn(percent: number): void;
190
- zoomOut(percent: number): void;
191
- home(): void;
192
- }
193
-
194
- declare class InteractionModule {
195
- private viewer;
196
- on: {
197
- panChange: (cb: (payload: {
198
- enabled: boolean;
199
- }) => void) => () => void;
200
- };
201
- constructor(viewer: Viewer3D);
202
- enablePan(): void;
203
- disablePan(): void;
204
- select(): void;
205
- areaSelect(): void;
206
- orbit(): void;
207
- rotateZ(): void;
208
- walkThrough(): void;
209
- zoomWindow(): void;
210
- zoomFit(): void;
211
- drawModeShaded(): void;
212
- drawModeWireframe(): void;
213
- drawModeHiddenLine(): void;
214
- drawModeShadedWire(): void;
215
- drawModeXRay(): void;
216
- drawModeGhosting(): void;
217
- explode(magnitude: number): void;
218
- explodeOff(): void;
219
- private setDrawMode;
220
- }
221
-
222
- declare class NodeModule {
223
- private viewer;
224
- on: {
225
- select: (cb: (payload: {
226
- nodeId: string;
227
- timestamp: number;
228
- }) => void) => () => void;
229
- };
230
- constructor(viewer: Viewer3D);
231
- }
232
-
233
- type FilesConfig = {
234
- baseUrl?: string;
235
- viewerPath?: string;
236
- uploadPath?: string;
237
- };
238
- type ConvertOptions = {
239
- downloadUrl?: string;
240
- };
241
- type ConvertV2Options = {
242
- filename: string;
243
- originalFilePath: string;
244
- downloadUrl: string;
245
- baseFileId: string;
246
- baseMajorRev?: number;
247
- baseMinorRev?: number;
248
- overwrite?: boolean;
249
- project?: string;
250
- convertOptions?: Partial<StreamConvertOptions>;
251
- };
252
- type StreamConvertOptions = {
253
- convert3DModel: number;
254
- convert2DSheet: number;
255
- extractProperties: number;
256
- childModels: number;
257
- };
258
- declare class FilesModule {
259
- private viewer;
260
- on: {
261
- state: (cb: (payload: LoadStatePayload) => void) => () => void;
262
- uploadStart: (cb: (payload: {
263
- fileName: string;
264
- }) => void) => () => void;
265
- uploadSuccess: (cb: (payload: {
266
- fileName: string;
267
- baseFileId: string;
268
- }) => void) => () => void;
269
- uploadError: (cb: (payload: {
270
- fileName: string;
271
- error: string;
272
- }) => void) => () => void;
273
- conversionStart: (cb: (payload: {
274
- fileName: string;
275
- }) => void) => () => void;
276
- conversionSuccess: (cb: (payload: PreparedViewerData) => void) => () => void;
277
- conversionError: (cb: (payload: {
278
- fileName: string;
279
- error: string;
280
- }) => void) => () => void;
281
- renderStart: (cb: (payload: {
282
- url: string;
283
- }) => void) => () => void;
284
- renderSuccess: (cb: (payload: {
285
- url: string;
286
- }) => void) => () => void;
287
- renderError: (cb: (payload: {
288
- url?: string;
289
- error: string;
290
- }) => void) => () => void;
291
- loadSuccess: (cb: (payload: PreparedViewerData) => void) => () => void;
292
- loadError: (cb: (payload: {
293
- error: string;
294
- }) => void) => () => void;
295
- };
296
- private config;
297
- private operationStartTime;
298
- private state;
299
- private lastUploadSession;
300
- constructor(viewer: Viewer3D);
301
- setConfig(next: FilesConfig): void;
302
- getState(): LoadStatePayload;
303
- upload(file?: File): Promise<{
304
- fileName: string;
305
- baseFileId: string;
306
- }>;
307
- convert(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
308
- prepare(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
309
- convertV2(options: ConvertV2Options): Promise<PreparedViewerData>;
310
- open(input: PreparedViewerData | {
311
- url: string;
312
- }): void;
313
- render(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
314
- private resolveFile;
315
- private normalizeBaseUrl;
316
- private resolveBaseUrl;
317
- private resolveViewerPath;
318
- private resolveViewerOrigin;
319
- private resolveHostConversion;
320
- private getUploadPath;
321
- private fileSignature;
322
- private createBaseFileId;
323
- private createUploadSession;
324
- private getUploadSessionForFile;
325
- private uploadInternal;
326
- private buildCachePayload;
327
- private buildConvertV2Payload;
328
- private cacheFile;
329
- private cacheFileV2;
330
- private convertInternal;
331
- private convertV2Internal;
332
- private updateState;
333
- private withOperation;
334
- private toErrorMessage;
335
- }
336
-
337
- type GetSheetsOptions = {
338
- timeoutMs?: number;
339
- };
340
- declare class ToolbarModule {
341
- private viewer;
342
- on: {
343
- planMode: (cb: (payload: {
344
- mode: "plan" | "document";
345
- timestamp: number;
346
- }) => void) => () => void;
347
- documentMode: (cb: (payload: {
348
- mode: "plan" | "document";
349
- timestamp: number;
350
- }) => void) => () => void;
351
- firstPage: (cb: (payload: {
352
- timestamp: number;
353
- }) => void) => () => void;
354
- previousPage: (cb: (payload: {
355
- timestamp: number;
356
- }) => void) => () => void;
357
- nextPage: (cb: (payload: {
358
- timestamp: number;
359
- }) => void) => () => void;
360
- lastPage: (cb: (payload: {
361
- timestamp: number;
362
- }) => void) => () => void;
363
- currentPage: (cb: (payload: {
364
- pageIndex: number;
365
- pageNumber: number;
366
- timestamp: number;
367
- }) => void) => () => void;
368
- };
369
- constructor(viewer: Viewer3D);
370
- setDisabled3D(operators: string[]): void;
371
- setDisabledPdf(operators: string[]): void;
372
- clearDisabled3D(): void;
373
- clearDisabledPdf(): void;
374
- disableAll3D(): void;
375
- disableAllPdf(): void;
376
- enableAll3D(): void;
377
- enableAllPdf(): void;
378
- hideToolbar(): void;
379
- showToolbar(): void;
380
- setToolbarVisible(visible: boolean, target?: ToolbarVisibilityTarget): void;
381
- hideLeftToolbar(): void;
382
- showLeftToolbar(): void;
383
- hideCenterToolbar(): void;
384
- showCenterToolbar(): void;
385
- hideRightToolbar(): void;
386
- showRightToolbar(): void;
387
- openClippingPlanes(): void;
388
- closeClippingPlanes(): void;
389
- openSetting(): void;
390
- closeSetting(): void;
391
- openSetting3D(): void;
392
- closeSetting3D(): void;
393
- openSettingPdf(): void;
394
- closeSettingPdf(): void;
395
- openStatesObjects(): void;
396
- closeStatesObjects(): void;
397
- openLinkedObjects(): void;
398
- closeLinkedObjects(): void;
399
- openModelTree(): void;
400
- closeModelTree(): void;
401
- openObjectProperties(): void;
402
- closeObjectProperties(): void;
403
- openSheets(): void;
404
- closeSheets(): void;
405
- getSheets(options?: GetSheetsOptions): Promise<SheetListItem[]>;
406
- applySheet(sheetId: string | number): void;
407
- cuttingCloseSections(): void;
408
- cuttingMultipleSides(): void;
409
- cuttingToggleSelection(): void;
410
- cuttingTogglePlanes(): void;
411
- cuttingPlaneX(): void;
412
- cuttingPlaneY(): void;
413
- cuttingPlaneZ(): void;
414
- cuttingPlaneBox(): void;
415
- cuttingRotateBox(): void;
416
- cuttingReversePlaneX(): void;
417
- cuttingReversePlaneY(): void;
418
- cuttingReversePlaneZ(): void;
419
- private postConfig;
420
- private postToolbarVisibility;
421
- private postPanelOpen;
422
- private postPanelClose;
423
- private postCuttingAction;
424
- private postSheetsGetList;
425
- private postSheetsApply;
426
- }
427
-
428
- type GetNodeIdsOptions = {
429
- onlyRealNodes?: boolean;
430
- timeoutMs?: number;
431
- };
432
- declare class ModelTreeModule {
433
- private viewer;
434
- constructor(viewer: Viewer3D);
435
- open(): void;
436
- selectNode(nodeId: string | number): void;
437
- getNodeIds(options?: GetNodeIdsOptions): Promise<string[]>;
438
- }
439
-
440
- type MarkupRequestOptions = {
441
- timeoutMs?: number;
442
- };
443
- declare class MarkupModule {
444
- private viewer;
445
- constructor(viewer: Viewer3D);
446
- action(action: MarkupAction): void;
447
- drawLine(): void;
448
- drawArrow(): void;
449
- drawCircle(): void;
450
- drawEllipse(): void;
451
- drawRectangle(): void;
452
- drawPolygon(): void;
453
- drawPolyline(): void;
454
- drawTextBox(): void;
455
- drawNote(): void;
456
- drawCallout(): void;
457
- drawCloud(): void;
458
- drawFreehand(): void;
459
- save(options?: MarkupRequestOptions): Promise<void>;
460
- cancel(options?: MarkupRequestOptions): Promise<void>;
461
- getList(options?: MarkupRequestOptions): Promise<MarkupListItem[]>;
462
- private runRequest;
463
- }
464
-
465
- declare class LanguageModule {
466
- private viewer;
467
- constructor(viewer: Viewer3D);
468
- change(language: LanguageCode): void;
469
- set(language: LanguageCode): void;
470
- }
471
-
472
- type Viewer3DOptions = {
473
- container: HTMLElement | string;
474
- url?: string;
475
- baseUrl?: string;
476
- viewerPath?: string;
477
- uploadPath?: string;
478
- file?: File;
479
- width?: string;
480
- height?: string;
481
- sandbox?: string;
482
- allowedOrigin?: string;
483
- };
484
- declare class Viewer3D {
485
- private options;
486
- private containerEl;
487
- private iframeEl;
488
- private initialized;
489
- private emitter;
490
- camera: CameraModule;
491
- interaction: InteractionModule;
492
- node: NodeModule;
493
- files: FilesModule;
494
- toolbar: ToolbarModule;
495
- modelTree: ModelTreeModule;
496
- markup: MarkupModule;
497
- language: LanguageModule;
498
- constructor(options: Viewer3DOptions);
499
- getOptions(): Viewer3DOptions;
500
- patchOptions(next: Partial<Viewer3DOptions>): void;
501
- getUrl(): string | null;
502
- init(): void;
503
- render(file?: File): Promise<PreparedViewerData | void>;
504
- open(url: string): void;
505
- destroy(): void;
506
- private ensureInit;
507
- _on<K extends SdkEventKey>(event: K, cb: (payload: SdkEventPayload<K>) => void): () => void;
508
- _off<K extends SdkEventKey>(event: K, cb: (payload: SdkEventPayload<K>) => void): void;
509
- _emit<K extends SdkEventKey>(event: K, payload: SdkEventPayload<K>): void;
510
- postToViewer<TPayload = unknown>(type: ViewerMessageType, payload?: TPayload): void;
511
- private handleMessage;
512
- }
513
-
514
- export { type ConvertOptions, type ConvertV2Options, type FilesConfig, type LanguageCode, type LoadStage, type LoadStatePayload, type MarkupAction, type MarkupListItem, type MarkupOperationResultPayload, type PreparedViewerData, Viewer3D };
1
+ export { Viewer3D } from "./viewer";
2
+ export type { LoadStage, LoadStatePayload, PreparedViewerData, } from "./contracts/events";
3
+ export type { ConvertOptions, ConvertV2Options, FileInfoCheckInput, FileInfoCheckPayloadItem, FilesConfig, } from "./modules/files.module";
4
+ export type { LanguageCode, MarkupAction, MarkupListItem, MarkupOperationResultPayload, } from "./contracts/messages";