3dviewer-sdk 1.1.1 → 1.1.3
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 +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +25 -0
- package/dist/index.mjs +25 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -360,6 +360,19 @@ type FileInfoCheckInputItem = string | {
|
|
|
360
360
|
baseMinorRev?: number;
|
|
361
361
|
};
|
|
362
362
|
type FileInfoCheckInput = FileInfoCheckInputItem | FileInfoCheckInputItem[];
|
|
363
|
+
type CreatePipelineOptions = {
|
|
364
|
+
modelFileId: string;
|
|
365
|
+
baseFileId: string;
|
|
366
|
+
baseMajorRev: number;
|
|
367
|
+
baseMinorRev: number;
|
|
368
|
+
filename: string;
|
|
369
|
+
convertType: string;
|
|
370
|
+
inputPath: string;
|
|
371
|
+
outputBucket: string;
|
|
372
|
+
mongoDatabaseName: string;
|
|
373
|
+
correlationId: string;
|
|
374
|
+
metadata?: Record<string, string>;
|
|
375
|
+
};
|
|
363
376
|
type StreamConvertOptions = {
|
|
364
377
|
convert3DModel: number;
|
|
365
378
|
convert2DSheet: number;
|
|
@@ -419,6 +432,7 @@ declare class FilesModule {
|
|
|
419
432
|
prepare(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
|
|
420
433
|
convertV2(options: ConvertV2Options): Promise<PreparedViewerData>;
|
|
421
434
|
checkFileInfo(baseFileIds: FileInfoCheckInput): Promise<unknown>;
|
|
435
|
+
createPipeline(options: CreatePipelineOptions): Promise<unknown>;
|
|
422
436
|
open(input: PreparedViewerData | {
|
|
423
437
|
url: string;
|
|
424
438
|
}): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -360,6 +360,19 @@ type FileInfoCheckInputItem = string | {
|
|
|
360
360
|
baseMinorRev?: number;
|
|
361
361
|
};
|
|
362
362
|
type FileInfoCheckInput = FileInfoCheckInputItem | FileInfoCheckInputItem[];
|
|
363
|
+
type CreatePipelineOptions = {
|
|
364
|
+
modelFileId: string;
|
|
365
|
+
baseFileId: string;
|
|
366
|
+
baseMajorRev: number;
|
|
367
|
+
baseMinorRev: number;
|
|
368
|
+
filename: string;
|
|
369
|
+
convertType: string;
|
|
370
|
+
inputPath: string;
|
|
371
|
+
outputBucket: string;
|
|
372
|
+
mongoDatabaseName: string;
|
|
373
|
+
correlationId: string;
|
|
374
|
+
metadata?: Record<string, string>;
|
|
375
|
+
};
|
|
363
376
|
type StreamConvertOptions = {
|
|
364
377
|
convert3DModel: number;
|
|
365
378
|
convert2DSheet: number;
|
|
@@ -419,6 +432,7 @@ declare class FilesModule {
|
|
|
419
432
|
prepare(file?: File, options?: ConvertOptions): Promise<PreparedViewerData>;
|
|
420
433
|
convertV2(options: ConvertV2Options): Promise<PreparedViewerData>;
|
|
421
434
|
checkFileInfo(baseFileIds: FileInfoCheckInput): Promise<unknown>;
|
|
435
|
+
createPipeline(options: CreatePipelineOptions): Promise<unknown>;
|
|
422
436
|
open(input: PreparedViewerData | {
|
|
423
437
|
url: string;
|
|
424
438
|
}): void;
|
package/dist/index.js
CHANGED
|
@@ -308,6 +308,31 @@ var FilesModule = class {
|
|
|
308
308
|
return text;
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
+
// Create a new conversion pipeline via POST /api/pipelines.
|
|
312
|
+
async createPipeline(options) {
|
|
313
|
+
const hostConversion = this.resolveHostConversion();
|
|
314
|
+
const url = `${hostConversion}/api/pipelines`;
|
|
315
|
+
const response = await fetch(url, {
|
|
316
|
+
method: "POST",
|
|
317
|
+
headers: {
|
|
318
|
+
"Content-Type": "application/json",
|
|
319
|
+
Accept: "application/json"
|
|
320
|
+
},
|
|
321
|
+
body: JSON.stringify(options)
|
|
322
|
+
});
|
|
323
|
+
if (!response.ok) {
|
|
324
|
+
throw new Error(
|
|
325
|
+
`Create pipeline failed (${response.status} ${response.statusText})`
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
const text = await response.text();
|
|
329
|
+
if (!text) return null;
|
|
330
|
+
try {
|
|
331
|
+
return JSON.parse(text);
|
|
332
|
+
} catch {
|
|
333
|
+
return text;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
311
336
|
// Open iframe with an already prepared viewer URL.
|
|
312
337
|
open(input) {
|
|
313
338
|
const url = input.url;
|
package/dist/index.mjs
CHANGED
|
@@ -282,6 +282,31 @@ var FilesModule = class {
|
|
|
282
282
|
return text;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
+
// Create a new conversion pipeline via POST /api/pipelines.
|
|
286
|
+
async createPipeline(options) {
|
|
287
|
+
const hostConversion = this.resolveHostConversion();
|
|
288
|
+
const url = `${hostConversion}/api/pipelines`;
|
|
289
|
+
const response = await fetch(url, {
|
|
290
|
+
method: "POST",
|
|
291
|
+
headers: {
|
|
292
|
+
"Content-Type": "application/json",
|
|
293
|
+
Accept: "application/json"
|
|
294
|
+
},
|
|
295
|
+
body: JSON.stringify(options)
|
|
296
|
+
});
|
|
297
|
+
if (!response.ok) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
`Create pipeline failed (${response.status} ${response.statusText})`
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
const text = await response.text();
|
|
303
|
+
if (!text) return null;
|
|
304
|
+
try {
|
|
305
|
+
return JSON.parse(text);
|
|
306
|
+
} catch {
|
|
307
|
+
return text;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
285
310
|
// Open iframe with an already prepared viewer URL.
|
|
286
311
|
open(input) {
|
|
287
312
|
const url = input.url;
|