3dviewer-sdk 1.0.8 → 1.0.9

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
@@ -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.js CHANGED
@@ -231,6 +231,30 @@ var FilesModule = class {
231
231
  }
232
232
  });
233
233
  }
234
+ // Check stream file info by one or more baseFileId values.
235
+ async checkFileInfo(baseFileIds) {
236
+ const payload = this.buildFileInfoPayload(baseFileIds);
237
+ const hostConversion = await this.resolveHostConversion();
238
+ const url = `${hostConversion}/api/StreamFile/info`;
239
+ const response = await fetch(url, {
240
+ method: "POST",
241
+ headers: {
242
+ "Content-Type": "application/json",
243
+ Accept: "application/json"
244
+ },
245
+ body: JSON.stringify(payload)
246
+ });
247
+ if (!response.ok) {
248
+ throw new Error(`Check file info failed (${response.status} ${response.statusText})`);
249
+ }
250
+ const text = await response.text();
251
+ if (!text) return null;
252
+ try {
253
+ return JSON.parse(text);
254
+ } catch {
255
+ return text;
256
+ }
257
+ }
234
258
  // Open iframe with an already prepared viewer URL.
235
259
  open(input) {
236
260
  const url = input.url;
@@ -426,6 +450,13 @@ var FilesModule = class {
426
450
  baseMinorRev: (_b = options.baseMinorRev) != null ? _b : 0
427
451
  };
428
452
  }
453
+ buildFileInfoPayload(baseFileIds) {
454
+ const ids = (Array.isArray(baseFileIds) ? baseFileIds : [baseFileIds]).map((baseFileId) => String(baseFileId).trim()).filter(Boolean);
455
+ if (ids.length === 0) {
456
+ throw new Error("No baseFileId provided");
457
+ }
458
+ return ids.map((baseFileId) => ({ baseFileId }));
459
+ }
429
460
  // Submit conversion/caching request and return service response.
430
461
  async cacheFile(file, baseFileId, options = {}) {
431
462
  const hostConversion = await this.resolveHostConversion();
package/dist/index.mjs CHANGED
@@ -205,6 +205,30 @@ var FilesModule = class {
205
205
  }
206
206
  });
207
207
  }
208
+ // Check stream file info by one or more baseFileId values.
209
+ async checkFileInfo(baseFileIds) {
210
+ const payload = this.buildFileInfoPayload(baseFileIds);
211
+ const hostConversion = await this.resolveHostConversion();
212
+ const url = `${hostConversion}/api/StreamFile/info`;
213
+ const response = await fetch(url, {
214
+ method: "POST",
215
+ headers: {
216
+ "Content-Type": "application/json",
217
+ Accept: "application/json"
218
+ },
219
+ body: JSON.stringify(payload)
220
+ });
221
+ if (!response.ok) {
222
+ throw new Error(`Check file info failed (${response.status} ${response.statusText})`);
223
+ }
224
+ const text = await response.text();
225
+ if (!text) return null;
226
+ try {
227
+ return JSON.parse(text);
228
+ } catch {
229
+ return text;
230
+ }
231
+ }
208
232
  // Open iframe with an already prepared viewer URL.
209
233
  open(input) {
210
234
  const url = input.url;
@@ -400,6 +424,13 @@ var FilesModule = class {
400
424
  baseMinorRev: (_b = options.baseMinorRev) != null ? _b : 0
401
425
  };
402
426
  }
427
+ buildFileInfoPayload(baseFileIds) {
428
+ const ids = (Array.isArray(baseFileIds) ? baseFileIds : [baseFileIds]).map((baseFileId) => String(baseFileId).trim()).filter(Boolean);
429
+ if (ids.length === 0) {
430
+ throw new Error("No baseFileId provided");
431
+ }
432
+ return ids.map((baseFileId) => ({ baseFileId }));
433
+ }
403
434
  // Submit conversion/caching request and return service response.
404
435
  async cacheFile(file, baseFileId, options = {}) {
405
436
  const hostConversion = await this.resolveHostConversion();
@@ -19,6 +19,10 @@ export declare type ConvertV2Options = {
19
19
  project?: string;
20
20
  convertOptions?: Partial<StreamConvertOptions>;
21
21
  };
22
+ export declare type FileInfoCheckInput = string | string[];
23
+ export declare type FileInfoCheckPayloadItem = {
24
+ baseFileId: string;
25
+ };
22
26
  declare type StreamConvertOptions = {
23
27
  convert3DModel: number;
24
28
  convert2DSheet: number;
@@ -77,6 +81,7 @@ export declare class FilesModule {
77
81
  convert(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
78
82
  prepare(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
79
83
  convertV2(options: ConvertV2Options): Promise<PreparedViewerData>;
84
+ checkFileInfo(baseFileIds: FileInfoCheckInput): Promise<unknown>;
80
85
  open(input: PreparedViewerData | {
81
86
  url: string;
82
87
  }): void;
@@ -95,6 +100,7 @@ export declare class FilesModule {
95
100
  private uploadInternal;
96
101
  private buildCachePayload;
97
102
  private buildConvertV2Payload;
103
+ private buildFileInfoPayload;
98
104
  private cacheFile;
99
105
  private cacheFileV2;
100
106
  private convertInternal;
@@ -87,6 +87,32 @@ export class FilesModule {
87
87
  }
88
88
  });
89
89
  }
90
+ // Check stream file info by one or more baseFileId values.
91
+ async checkFileInfo(baseFileIds) {
92
+ const payload = this.buildFileInfoPayload(baseFileIds);
93
+ const hostConversion = await this.resolveHostConversion();
94
+ const url = `${hostConversion}/api/StreamFile/info`;
95
+ const response = await fetch(url, {
96
+ method: "POST",
97
+ headers: {
98
+ "Content-Type": "application/json",
99
+ Accept: "application/json",
100
+ },
101
+ body: JSON.stringify(payload),
102
+ });
103
+ if (!response.ok) {
104
+ throw new Error(`Check file info failed (${response.status} ${response.statusText})`);
105
+ }
106
+ const text = await response.text();
107
+ if (!text)
108
+ return null;
109
+ try {
110
+ return JSON.parse(text);
111
+ }
112
+ catch {
113
+ return text;
114
+ }
115
+ }
90
116
  // Open iframe with an already prepared viewer URL.
91
117
  open(input) {
92
118
  const url = input.url;
@@ -297,6 +323,15 @@ export class FilesModule {
297
323
  baseMinorRev: (_b = options.baseMinorRev) !== null && _b !== void 0 ? _b : 0,
298
324
  };
299
325
  }
326
+ buildFileInfoPayload(baseFileIds) {
327
+ const ids = (Array.isArray(baseFileIds) ? baseFileIds : [baseFileIds])
328
+ .map((baseFileId) => String(baseFileId).trim())
329
+ .filter(Boolean);
330
+ if (ids.length === 0) {
331
+ throw new Error("No baseFileId provided");
332
+ }
333
+ return ids.map((baseFileId) => ({ baseFileId }));
334
+ }
300
335
  // Submit conversion/caching request and return service response.
301
336
  async cacheFile(file, baseFileId, options = {}) {
302
337
  const hostConversion = await this.resolveHostConversion();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3dviewer-sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [