@shapediver/viewer.session-engine.session-engine 2.10.0 → 2.11.0
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/implementation/OutputDelayException.js +5 -1
- package/dist/implementation/OutputDelayException.js.map +1 -1
- package/dist/implementation/OutputLoader.js +30 -26
- package/dist/implementation/OutputLoader.js.map +1 -1
- package/dist/implementation/SessionData.js +6 -2
- package/dist/implementation/SessionData.js.map +1 -1
- package/dist/implementation/SessionEngine.d.ts +13 -11
- package/dist/implementation/SessionEngine.d.ts.map +1 -1
- package/dist/implementation/SessionEngine.js +265 -236
- package/dist/implementation/SessionEngine.js.map +1 -1
- package/dist/implementation/SessionOutputData.js +6 -2
- package/dist/implementation/SessionOutputData.js.map +1 -1
- package/dist/implementation/SessionTreeNode.js +6 -2
- package/dist/implementation/SessionTreeNode.js.map +1 -1
- package/dist/implementation/dto/Export.js +17 -13
- package/dist/implementation/dto/Export.js.map +1 -1
- package/dist/implementation/dto/FileParameter.js +34 -7
- package/dist/implementation/dto/FileParameter.js.map +1 -1
- package/dist/implementation/dto/Output.d.ts +6 -6
- package/dist/implementation/dto/Output.d.ts.map +1 -1
- package/dist/implementation/dto/Output.js +19 -14
- package/dist/implementation/dto/Output.js.map +1 -1
- package/dist/implementation/dto/Parameter.js +60 -33
- package/dist/implementation/dto/Parameter.js.map +1 -1
- package/dist/index.js +20 -11
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ISessionData.js +2 -1
- package/dist/interfaces/ISessionEngine.d.ts +6 -7
- package/dist/interfaces/ISessionEngine.d.ts.map +1 -1
- package/dist/interfaces/ISessionEngine.js +7 -5
- package/dist/interfaces/ISessionEngine.js.map +1 -1
- package/dist/interfaces/ISessionOutputData.js +2 -1
- package/dist/interfaces/ISessionTreeNode.js +2 -1
- package/dist/interfaces/dto/IExport.js +2 -1
- package/dist/interfaces/dto/IFileParameter.js +2 -1
- package/dist/interfaces/dto/IOutput.d.ts +1 -1
- package/dist/interfaces/dto/IOutput.d.ts.map +1 -1
- package/dist/interfaces/dto/IOutput.js +2 -1
- package/dist/interfaces/dto/IParameter.js +2 -1
- package/package.json +9 -9
- package/src/implementation/SessionEngine.ts +469 -406
- package/src/implementation/dto/Output.ts +16 -15
- package/src/interfaces/ISessionEngine.ts +49 -43
- package/src/interfaces/dto/IOutput.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { InputValidator, Logger, UuidGenerator } from '@shapediver/viewer.shared.services';
|
|
2
|
+
import { IOutput, ShapeDiverResponseOutputChunk, ShapeDiverResponseOutputContent } from '../../interfaces/dto/IOutput';
|
|
3
|
+
import { ITreeNode, TreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
4
|
+
import { SessionEngine } from '../SessionEngine';
|
|
5
|
+
import { ShapeDiverResponseModelComputationStatus, ShapeDiverResponseOutput } from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
6
6
|
|
|
7
7
|
export class Output implements IOutput {
|
|
8
8
|
// #region Properties (23)
|
|
@@ -47,7 +47,7 @@ export class Output implements IOutput {
|
|
|
47
47
|
|
|
48
48
|
// #endregion Constructors (1)
|
|
49
49
|
|
|
50
|
-
// #region Public Accessors (
|
|
50
|
+
// #region Public Accessors (30)
|
|
51
51
|
|
|
52
52
|
public get bbmax(): number[] | undefined {
|
|
53
53
|
return this.#bbmax;
|
|
@@ -169,10 +169,15 @@ export class Output implements IOutput {
|
|
|
169
169
|
this.#version = value;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
// #endregion Public Accessors (
|
|
172
|
+
// #endregion Public Accessors (30)
|
|
173
173
|
|
|
174
|
-
// #region Public Methods (
|
|
174
|
+
// #region Public Methods (4)
|
|
175
175
|
|
|
176
|
+
public triggerUpdateCallback(newNode?: TreeNode, oldNode?: TreeNode) {
|
|
177
|
+
if (this.#updateCallback) this.#updateCallback(newNode, oldNode);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
176
181
|
public updateOutput(newNode?: TreeNode, oldNode?: TreeNode) {
|
|
177
182
|
const outputDef = this.#sessionEngine.outputs[this.id];
|
|
178
183
|
this.updateOutputDefinition(outputDef);
|
|
@@ -187,14 +192,10 @@ export class Output implements IOutput {
|
|
|
187
192
|
}
|
|
188
193
|
}
|
|
189
194
|
|
|
190
|
-
public
|
|
191
|
-
if (this.#updateCallback) this.#updateCallback(newNode, oldNode);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public async updateOutputContent(outputContent: ShapeDiverResponseOutputContent[], preventUpdate: boolean = false): Promise<ITreeNode | undefined> {
|
|
195
|
+
public async updateOutputContent(outputContent: ShapeDiverResponseOutputContent[], preventUpdate: boolean = false, waitForViewportUpdate: boolean = false): Promise<ITreeNode | undefined> {
|
|
195
196
|
this.#sessionEngine.outputs[this.id].content = outputContent;
|
|
196
197
|
this.#sessionEngine.outputs[this.id].version = this.#uuidGenerator.create();
|
|
197
|
-
if (!preventUpdate) await this.#sessionEngine.updateOutputs();
|
|
198
|
+
if (!preventUpdate) await this.#sessionEngine.updateOutputs(undefined, waitForViewportUpdate);
|
|
198
199
|
return this.node;
|
|
199
200
|
}
|
|
200
201
|
|
|
@@ -218,5 +219,5 @@ export class Output implements IOutput {
|
|
|
218
219
|
this.#hidden = outputDef.hidden;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
// #endregion Public Methods (
|
|
222
|
+
// #endregion Public Methods (4)
|
|
222
223
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ITreeNode
|
|
1
|
+
import { ShapeDiverRequestCustomization, ShapeDiverRequestExport, ShapeDiverRequestGltfUploadQueryConversion, ShapeDiverResponseDto, ShapeDiverResponseExport } from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
2
|
+
import { ITreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
3
3
|
import { SettingsEngine } from '@shapediver/viewer.shared.services';
|
|
4
4
|
import { OutputLoaderTaskEventInfo } from '../implementation/OutputLoader';
|
|
5
5
|
import { IExport } from './dto/IExport';
|
|
@@ -62,48 +62,53 @@ export enum PARAMETER_VISUALIZATION {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface ISettingsSections {
|
|
65
|
+
// #region Properties (2)
|
|
66
|
+
|
|
65
67
|
session?: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
parameter?: {
|
|
69
|
+
/** Option to update the displayname of the parameters (default: false) */
|
|
70
|
+
displayname?: boolean,
|
|
71
|
+
/** Option to update the order of the parameters (default: false) */
|
|
72
|
+
order?: boolean,
|
|
73
|
+
/** Option to update the hidden state of the parameters (default: false) */
|
|
74
|
+
hidden?: boolean,
|
|
75
|
+
/** Option to update the value of the parameters (default: false) */
|
|
76
|
+
value?: boolean
|
|
77
|
+
},
|
|
78
|
+
export?: {
|
|
79
|
+
/** Option to update the displayname of the exports (default: false) */
|
|
80
|
+
displayname?: boolean,
|
|
81
|
+
/** Option to update the order of the exports (default: false) */
|
|
82
|
+
order?: boolean,
|
|
83
|
+
/** Option to update the hidden state of the exports (default: false) */
|
|
84
|
+
hidden?: boolean
|
|
85
|
+
}
|
|
84
86
|
},
|
|
85
87
|
viewport?: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
/** Option to update the ar settings (default: false) */
|
|
89
|
+
ar?: boolean,
|
|
90
|
+
/** Option to update the scene settings (default: false) */
|
|
91
|
+
scene?: boolean,
|
|
92
|
+
/** Option to update the camera settings (default: false) */
|
|
93
|
+
camera?: boolean,
|
|
94
|
+
/** Option to update the light settings (default: false) */
|
|
95
|
+
light?: boolean,
|
|
96
|
+
/** Option to update the environment settings (default: false) */
|
|
97
|
+
environment?: boolean
|
|
98
|
+
/** Option to update the general settings (default: false) */
|
|
99
|
+
general?: boolean
|
|
100
|
+
/** Option to update the postprocessing settings (default: false) */
|
|
101
|
+
postprocessing?: boolean
|
|
100
102
|
}
|
|
101
|
-
|
|
103
|
+
|
|
104
|
+
// #endregion Properties (2)
|
|
105
|
+
}
|
|
102
106
|
|
|
103
107
|
export interface ISessionEngine {
|
|
104
|
-
// #region Properties (
|
|
108
|
+
// #region Properties (13)
|
|
105
109
|
|
|
106
110
|
readonly jwtToken?: string;
|
|
111
|
+
|
|
107
112
|
canUploadGLTF: boolean;
|
|
108
113
|
exports: { [key: string]: IExport };
|
|
109
114
|
guid?: string;
|
|
@@ -111,36 +116,37 @@ export interface ISessionEngine {
|
|
|
111
116
|
initialized: boolean;
|
|
112
117
|
modelViewUrl: string;
|
|
113
118
|
outputs: { [key: string]: IOutput };
|
|
114
|
-
parameters: { [key: string]: IParameter<
|
|
119
|
+
parameters: { [key: string]: IParameter<unknown> };
|
|
115
120
|
refreshJwtToken: (() => Promise<string>) | undefined;
|
|
116
121
|
settingsEngine: SettingsEngine;
|
|
117
122
|
ticket?: string;
|
|
118
123
|
updateCallback: ((newNode: ITreeNode, oldNode: ITreeNode) => void) | null;
|
|
119
124
|
|
|
120
|
-
// #endregion Properties (
|
|
125
|
+
// #endregion Properties (13)
|
|
121
126
|
|
|
122
|
-
// #region Public Methods (
|
|
127
|
+
// #region Public Methods (21)
|
|
123
128
|
|
|
124
129
|
applySettings(response: ShapeDiverResponseDto, sections?: ISettingsSections): void;
|
|
125
130
|
canGoBack(): boolean;
|
|
126
131
|
canGoForward(): boolean;
|
|
127
132
|
close(): Promise<void>;
|
|
128
|
-
customize(force: boolean): Promise<ITreeNode>;
|
|
133
|
+
customize(force: boolean, waitForViewportUpdate?: boolean): Promise<ITreeNode>;
|
|
129
134
|
customizeParallel(parameterValues: { [key: string]: string }): Promise<ITreeNode>;
|
|
130
135
|
goBack(): Promise<ITreeNode>;
|
|
131
136
|
goForward(): Promise<ITreeNode>;
|
|
132
137
|
init(parameterValues?: { [key: string]: string; }): Promise<void>;
|
|
133
138
|
loadOutputs(cancelRequest: () => boolean, taskEventInfo: OutputLoaderTaskEventInfo): Promise<ITreeNode>;
|
|
134
139
|
loadOutputsParallel(responseDto: ShapeDiverResponseDto, cancelRequest: () => boolean, taskEventInfo: OutputLoaderTaskEventInfo): Promise<ITreeNode>;
|
|
135
|
-
requestExport(exportId: string, parameters:
|
|
140
|
+
requestExport(exportId: string, parameters: ShapeDiverRequestCustomization, maxWaitTime: number): Promise<ShapeDiverResponseExport>;
|
|
141
|
+
requestExports(body: ShapeDiverRequestExport, maxWaitMsec?: number): Promise<ShapeDiverResponseDto>;
|
|
136
142
|
resetSettings(sections?: ISettingsSections): void;
|
|
137
143
|
saveDefaultParameterValues(): Promise<boolean>;
|
|
138
144
|
saveSettings(viewportId?: string): Promise<boolean>;
|
|
139
145
|
saveUiProperties(): Promise<boolean>;
|
|
140
146
|
setJwtToken(token: string): Promise<void>;
|
|
141
|
-
updateOutputs(taskEventInfo?: OutputLoaderTaskEventInfo): Promise<ITreeNode>;
|
|
147
|
+
updateOutputs(taskEventInfo?: OutputLoaderTaskEventInfo, waitForViewportUpdate?: boolean): Promise<ITreeNode>;
|
|
142
148
|
uploadFile(parameterId: string, data: File, type: string): Promise<string>;
|
|
143
149
|
uploadGLTF(blob: Blob, conversion?: ShapeDiverRequestGltfUploadQueryConversion): Promise<ShapeDiverResponseDto>;
|
|
144
150
|
|
|
145
|
-
// #endregion Public Methods (
|
|
151
|
+
// #endregion Public Methods (21)
|
|
146
152
|
}
|
|
@@ -39,7 +39,7 @@ export interface IOutput extends ShapeDiverResponseOutput {
|
|
|
39
39
|
|
|
40
40
|
triggerUpdateCallback(newNode?: ITreeNode, oldNode?: ITreeNode): void;
|
|
41
41
|
updateOutput(newNode?: ITreeNode, oldNode?: ITreeNode): void;
|
|
42
|
-
updateOutputContent(content: ShapeDiverResponseOutputContent[], preventUpdate?: boolean): Promise<ITreeNode | undefined>;
|
|
42
|
+
updateOutputContent(content: ShapeDiverResponseOutputContent[], preventUpdate?: boolean, waitForViewportUpdate?: boolean): Promise<ITreeNode | undefined>;
|
|
43
43
|
updateOutputDefinition(outputDef: ShapeDiverResponseOutput): void;
|
|
44
44
|
|
|
45
45
|
// #endregion Public Methods (1)
|