@shapediver/viewer.session 3.0.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/LICENSE +73 -0
- package/README.md +1 -0
- package/dist/implementation/ExportApi.d.ts +36 -0
- package/dist/implementation/ExportApi.d.ts.map +1 -0
- package/dist/implementation/ExportApi.js +140 -0
- package/dist/implementation/ExportApi.js.map +1 -0
- package/dist/implementation/FileParameterApi.d.ts +10 -0
- package/dist/implementation/FileParameterApi.d.ts.map +1 -0
- package/dist/implementation/FileParameterApi.js +50 -0
- package/dist/implementation/FileParameterApi.js.map +1 -0
- package/dist/implementation/OutputApi.d.ts +38 -0
- package/dist/implementation/OutputApi.d.ts.map +1 -0
- package/dist/implementation/OutputApi.js +165 -0
- package/dist/implementation/OutputApi.js.map +1 -0
- package/dist/implementation/ParameterApi.d.ts +38 -0
- package/dist/implementation/ParameterApi.d.ts.map +1 -0
- package/dist/implementation/ParameterApi.js +151 -0
- package/dist/implementation/ParameterApi.js.map +1 -0
- package/dist/implementation/SessionApi.d.ts +98 -0
- package/dist/implementation/SessionApi.d.ts.map +1 -0
- package/dist/implementation/SessionApi.js +361 -0
- package/dist/implementation/SessionApi.js.map +1 -0
- package/dist/implementation/data/OutputApiData.d.ts +20 -0
- package/dist/implementation/data/OutputApiData.d.ts.map +1 -0
- package/dist/implementation/data/OutputApiData.js +51 -0
- package/dist/implementation/data/OutputApiData.js.map +1 -0
- package/dist/implementation/data/SessionApiData.d.ts +20 -0
- package/dist/implementation/data/SessionApiData.d.ts.map +1 -0
- package/dist/implementation/data/SessionApiData.js +51 -0
- package/dist/implementation/data/SessionApiData.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +120 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IExportApi.d.ts +27 -0
- package/dist/interfaces/IExportApi.d.ts.map +1 -0
- package/dist/interfaces/IExportApi.js +3 -0
- package/dist/interfaces/IExportApi.js.map +1 -0
- package/dist/interfaces/IFileParameterApi.d.ts +35 -0
- package/dist/interfaces/IFileParameterApi.d.ts.map +1 -0
- package/dist/interfaces/IFileParameterApi.js +3 -0
- package/dist/interfaces/IFileParameterApi.js.map +1 -0
- package/dist/interfaces/IOutputApi.d.ts +75 -0
- package/dist/interfaces/IOutputApi.d.ts.map +1 -0
- package/dist/interfaces/IOutputApi.js +3 -0
- package/dist/interfaces/IOutputApi.js.map +1 -0
- package/dist/interfaces/IParameterApi.d.ts +46 -0
- package/dist/interfaces/IParameterApi.d.ts.map +1 -0
- package/dist/interfaces/IParameterApi.js +3 -0
- package/dist/interfaces/IParameterApi.js.map +1 -0
- package/dist/interfaces/ISessionApi.d.ts +477 -0
- package/dist/interfaces/ISessionApi.d.ts.map +1 -0
- package/dist/interfaces/ISessionApi.js +3 -0
- package/dist/interfaces/ISessionApi.js.map +1 -0
- package/dist/interfaces/data/IOutputApiData.d.ts +7 -0
- package/dist/interfaces/data/IOutputApiData.d.ts.map +1 -0
- package/dist/interfaces/data/IOutputApiData.js +3 -0
- package/dist/interfaces/data/IOutputApiData.js.map +1 -0
- package/dist/interfaces/data/ISessionApiData.d.ts +7 -0
- package/dist/interfaces/data/ISessionApiData.d.ts.map +1 -0
- package/dist/interfaces/data/ISessionApiData.js +3 -0
- package/dist/interfaces/data/ISessionApiData.js.map +1 -0
- package/dist/main.d.ts +37 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +96 -0
- package/dist/main.js.map +1 -0
- package/package.json +63 -0
- package/src/implementation/ExportApi.ts +158 -0
- package/src/implementation/FileParameterApi.ts +34 -0
- package/src/implementation/OutputApi.ts +178 -0
- package/src/implementation/ParameterApi.ts +176 -0
- package/src/implementation/SessionApi.ts +408 -0
- package/src/implementation/data/OutputApiData.ts +53 -0
- package/src/implementation/data/SessionApiData.ts +53 -0
- package/src/index.ts +225 -0
- package/src/interfaces/IExportApi.ts +29 -0
- package/src/interfaces/IFileParameterApi.ts +39 -0
- package/src/interfaces/IOutputApi.ts +85 -0
- package/src/interfaces/IParameterApi.ts +55 -0
- package/src/interfaces/ISessionApi.ts +461 -0
- package/src/interfaces/data/IOutputApiData.ts +16 -0
- package/src/interfaces/data/ISessionApiData.ts +16 -0
- package/src/main.ts +95 -0
- package/tsconfig.json +17 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addListener,
|
|
3
|
+
generalOptions,
|
|
4
|
+
IGeneralOptions,
|
|
5
|
+
removeListener,
|
|
6
|
+
sceneTree,
|
|
7
|
+
version
|
|
8
|
+
} from '@shapediver/viewer.api.general';
|
|
9
|
+
import {
|
|
10
|
+
AnimationData,
|
|
11
|
+
AttributeData,
|
|
12
|
+
CustomData,
|
|
13
|
+
EventResponseMapping,
|
|
14
|
+
GeometryData,
|
|
15
|
+
HTMLElementAnchorCustomData,
|
|
16
|
+
HTMLElementAnchorData,
|
|
17
|
+
HTMLElementAnchorImageData,
|
|
18
|
+
HTMLElementAnchorTextData,
|
|
19
|
+
IAnchorDataImage,
|
|
20
|
+
IAnchorDataText,
|
|
21
|
+
IAnimationData,
|
|
22
|
+
IAnimationTrack,
|
|
23
|
+
IAttributeData,
|
|
24
|
+
ICameraEvent,
|
|
25
|
+
ICustomData,
|
|
26
|
+
IGeometryData,
|
|
27
|
+
IHTMLElementAnchorData,
|
|
28
|
+
IMapData,
|
|
29
|
+
IMaterialAbstractData,
|
|
30
|
+
IMaterialAbstractDataProperties,
|
|
31
|
+
IMaterialBasicLineData,
|
|
32
|
+
IMaterialBasicLineDataProperties,
|
|
33
|
+
IMaterialGemData,
|
|
34
|
+
IMaterialGemDataProperties,
|
|
35
|
+
IMaterialMultiPointData,
|
|
36
|
+
IMaterialMultiPointDataProperties,
|
|
37
|
+
IMaterialPointData,
|
|
38
|
+
IMaterialPointDataProperties,
|
|
39
|
+
IMaterialSpecularGlossinessData,
|
|
40
|
+
IMaterialSpecularGlossinessDataProperties,
|
|
41
|
+
IMaterialStandardData,
|
|
42
|
+
IMaterialStandardDataProperties,
|
|
43
|
+
IMaterialUnlitData,
|
|
44
|
+
IMaterialUnlitDataProperties,
|
|
45
|
+
IMaterialVariantsData,
|
|
46
|
+
IOutputEvent,
|
|
47
|
+
IParameterEvent,
|
|
48
|
+
IPrimitiveData,
|
|
49
|
+
IRenderingEvent,
|
|
50
|
+
ISceneEvent,
|
|
51
|
+
ISDTFAttributeData,
|
|
52
|
+
ISDTFAttributesData,
|
|
53
|
+
ISDTFAttributeVisualizationData,
|
|
54
|
+
ISDTFItemData,
|
|
55
|
+
ISDTFOverview,
|
|
56
|
+
ISDTFOverviewData,
|
|
57
|
+
ISessionEvent,
|
|
58
|
+
ISessionSettingsSections,
|
|
59
|
+
ISettingsSections,
|
|
60
|
+
ITaskEvent,
|
|
61
|
+
IViewportEvent,
|
|
62
|
+
IViewportSettingsSections,
|
|
63
|
+
MapData,
|
|
64
|
+
MATERIAL_ALPHA,
|
|
65
|
+
MATERIAL_SHADING,
|
|
66
|
+
MATERIAL_SIDE,
|
|
67
|
+
MATERIAL_TYPE,
|
|
68
|
+
MaterialBasicLineData,
|
|
69
|
+
MaterialGemData,
|
|
70
|
+
MaterialMultiPointData,
|
|
71
|
+
MaterialPointData,
|
|
72
|
+
MaterialSpecularGlossinessData,
|
|
73
|
+
MaterialStandardData,
|
|
74
|
+
MaterialUnlitData,
|
|
75
|
+
MaterialVariantsData,
|
|
76
|
+
PARAMETER_TYPE,
|
|
77
|
+
PARAMETER_VISUALIZATION,
|
|
78
|
+
PRIMITIVE_MODE,
|
|
79
|
+
PrimitiveData,
|
|
80
|
+
SDTF_TYPEHINT,
|
|
81
|
+
SDTFAttributeData,
|
|
82
|
+
SDTFAttributesData,
|
|
83
|
+
SDTFItemData,
|
|
84
|
+
SDTFOverviewData,
|
|
85
|
+
SdtfPrimitiveTypeGuard,
|
|
86
|
+
TASK_TYPE,
|
|
87
|
+
TEXTURE_FILTERING,
|
|
88
|
+
TEXTURE_WRAPPING
|
|
89
|
+
} from '@shapediver/viewer.shared.types';
|
|
90
|
+
import {
|
|
91
|
+
Box,
|
|
92
|
+
IBox,
|
|
93
|
+
IGeometry,
|
|
94
|
+
ISphere,
|
|
95
|
+
Sphere
|
|
96
|
+
} from '@shapediver/viewer.shared.math';
|
|
97
|
+
import { createSession, sessions } from './main';
|
|
98
|
+
import {
|
|
99
|
+
EVENTTYPE,
|
|
100
|
+
EVENTTYPE_CAMERA,
|
|
101
|
+
EVENTTYPE_DRAWING_TOOLS,
|
|
102
|
+
EVENTTYPE_INTERACTION,
|
|
103
|
+
EVENTTYPE_OUTPUT,
|
|
104
|
+
EVENTTYPE_PARAMETER,
|
|
105
|
+
EVENTTYPE_RENDERING,
|
|
106
|
+
EVENTTYPE_SCENE,
|
|
107
|
+
EVENTTYPE_SESSION,
|
|
108
|
+
EVENTTYPE_TASK,
|
|
109
|
+
EVENTTYPE_VIEWPORT,
|
|
110
|
+
IDomEventListener,
|
|
111
|
+
IEvent,
|
|
112
|
+
isARError,
|
|
113
|
+
isViewerCameraError,
|
|
114
|
+
isViewerDataProcessingError,
|
|
115
|
+
isViewerDrawingToolsError,
|
|
116
|
+
isViewerEnvironmentMapError,
|
|
117
|
+
isViewerError,
|
|
118
|
+
isViewerGeometryBackendError,
|
|
119
|
+
isViewerGeometryBackendGenericError,
|
|
120
|
+
isViewerGeometryBackendRequestError,
|
|
121
|
+
isViewerGeometryBackendResponseError,
|
|
122
|
+
isViewerInteractionError,
|
|
123
|
+
isViewerLightError,
|
|
124
|
+
isViewerSessionError,
|
|
125
|
+
isViewerSettingsError,
|
|
126
|
+
isViewerUnknownError,
|
|
127
|
+
isViewerValidationError,
|
|
128
|
+
isViewerViewportError,
|
|
129
|
+
isViewerWebGLError,
|
|
130
|
+
LOGGING_LEVEL,
|
|
131
|
+
MainEventTypes,
|
|
132
|
+
SESSION_SETTINGS_MODE,
|
|
133
|
+
ShapeDiverGeometryBackendError,
|
|
134
|
+
ShapeDiverGeometryBackendRequestError,
|
|
135
|
+
ShapeDiverGeometryBackendResponseError,
|
|
136
|
+
ShapeDiverGeometryBackendResponseErrorType,
|
|
137
|
+
ShapeDiverViewerArError,
|
|
138
|
+
ShapeDiverViewerCameraError,
|
|
139
|
+
ShapeDiverViewerDataProcessingError,
|
|
140
|
+
ShapeDiverViewerDrawingToolsError,
|
|
141
|
+
ShapeDiverViewerEnvironmentMapError,
|
|
142
|
+
ShapeDiverViewerError,
|
|
143
|
+
ShapeDiverViewerErrorType,
|
|
144
|
+
ShapeDiverViewerInteractionError,
|
|
145
|
+
ShapeDiverViewerLightError,
|
|
146
|
+
ShapeDiverViewerSessionError,
|
|
147
|
+
ShapeDiverViewerSettingsError,
|
|
148
|
+
ShapeDiverViewerUnknownError,
|
|
149
|
+
ShapeDiverViewerValidationError,
|
|
150
|
+
ShapeDiverViewerViewportError,
|
|
151
|
+
ShapeDiverViewerWebGLError
|
|
152
|
+
} from '@shapediver/viewer.shared.services';
|
|
153
|
+
import { IExportApi } from './interfaces/IExportApi';
|
|
154
|
+
import { IFileParameterApi } from './interfaces/IFileParameterApi';
|
|
155
|
+
import {
|
|
156
|
+
IMaterialContentDataV1,
|
|
157
|
+
IMaterialContentDataV2,
|
|
158
|
+
IMaterialContentDataV3,
|
|
159
|
+
ITag2D,
|
|
160
|
+
ITag3D,
|
|
161
|
+
ITexture,
|
|
162
|
+
TAG3D_JUSTIFICATION
|
|
163
|
+
} from '@shapediver/viewer.data-engine.shared-types';
|
|
164
|
+
import { IOutputApi } from './interfaces/IOutputApi';
|
|
165
|
+
import { IOutputApiData } from './interfaces/data/IOutputApiData';
|
|
166
|
+
import { IParameterApi } from './interfaces/IParameterApi';
|
|
167
|
+
import { ISessionApi } from './interfaces/ISessionApi';
|
|
168
|
+
import { ISessionApiData } from './interfaces/data/ISessionApiData';
|
|
169
|
+
import {
|
|
170
|
+
ISessionData,
|
|
171
|
+
ISessionOutputData,
|
|
172
|
+
SessionData,
|
|
173
|
+
SessionOutputData,
|
|
174
|
+
ShapeDiverResponseOutputChunk,
|
|
175
|
+
ShapeDiverResponseOutputContent
|
|
176
|
+
} from '@shapediver/viewer.session-engine.session-engine';
|
|
177
|
+
import {
|
|
178
|
+
ITransformation,
|
|
179
|
+
ITree,
|
|
180
|
+
ITreeNode,
|
|
181
|
+
ITreeNodeData,
|
|
182
|
+
Tree,
|
|
183
|
+
TreeNode
|
|
184
|
+
} from '@shapediver/viewer.shared.node-tree';
|
|
185
|
+
import { OutputApiData } from './implementation/data/OutputApiData';
|
|
186
|
+
import { SessionApiData } from './implementation/data/SessionApiData';
|
|
187
|
+
import { SessionCreationDefinition } from '@shapediver/viewer.creation-control-center.session';
|
|
188
|
+
import {
|
|
189
|
+
ShapeDiverResponseExport,
|
|
190
|
+
ShapeDiverResponseExportContent,
|
|
191
|
+
ShapeDiverResponseExportDefinitionGroup,
|
|
192
|
+
ShapeDiverResponseExportResult,
|
|
193
|
+
ShapeDiverResponseModelComputationStatus,
|
|
194
|
+
ShapeDiverResponseParameter
|
|
195
|
+
} from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
196
|
+
import {
|
|
197
|
+
ShapeDiverResponseExportDefinitionType as EXPORT_TYPE,
|
|
198
|
+
ShapeDiverResponseOutput,
|
|
199
|
+
ShapeDiverResponseOutputChunk as ShapeDiverResponseOutputChunkBackend,
|
|
200
|
+
ShapeDiverResponseOutputContent as ShapeDiverResponseOutputContentBackend
|
|
201
|
+
} from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
202
|
+
|
|
203
|
+
export { IExportApi, IFileParameterApi, IOutputApi, IParameterApi, ISessionApi };
|
|
204
|
+
export { ISessionApiData, SessionApiData, IOutputApiData, OutputApiData };
|
|
205
|
+
|
|
206
|
+
export { createSession, sessions };
|
|
207
|
+
|
|
208
|
+
export { addListener, removeListener, sceneTree, generalOptions, version, IGeneralOptions };
|
|
209
|
+
|
|
210
|
+
export { SessionCreationDefinition };
|
|
211
|
+
export { ITree, Tree, ITreeNode, TreeNode, ITreeNodeData };
|
|
212
|
+
export { PARAMETER_TYPE, EXPORT_TYPE, PARAMETER_VISUALIZATION, TAG3D_JUSTIFICATION, LOGGING_LEVEL, PRIMITIVE_MODE, MATERIAL_SIDE, MATERIAL_ALPHA, MATERIAL_SHADING, MATERIAL_TYPE, TEXTURE_WRAPPING, TEXTURE_FILTERING, SDTF_TYPEHINT, SESSION_SETTINGS_MODE };
|
|
213
|
+
export { TASK_TYPE, MainEventTypes, EVENTTYPE, EVENTTYPE_CAMERA, EVENTTYPE_OUTPUT, EVENTTYPE_PARAMETER, EVENTTYPE_RENDERING, EVENTTYPE_SCENE, EVENTTYPE_SESSION, EVENTTYPE_VIEWPORT, EVENTTYPE_INTERACTION, EVENTTYPE_DRAWING_TOOLS, EVENTTYPE_TASK };
|
|
214
|
+
export { IBox, Box, ISphere, Sphere, IGeometry, ITransformation, ShapeDiverResponseOutput, ShapeDiverResponseOutputContentBackend, ShapeDiverResponseOutputChunkBackend, ShapeDiverResponseOutputContent, ShapeDiverResponseOutputChunk, IDomEventListener, IEvent };
|
|
215
|
+
export { ShapeDiverResponseExport, ShapeDiverResponseExportContent, ShapeDiverResponseExportResult, ShapeDiverResponseModelComputationStatus, ShapeDiverResponseExportDefinitionGroup, ShapeDiverResponseParameter };
|
|
216
|
+
|
|
217
|
+
export { EventResponseMapping, IViewportEvent, ISessionEvent, IOutputEvent, ICameraEvent, ISceneEvent, ITaskEvent, IRenderingEvent, IParameterEvent, ISettingsSections, IViewportSettingsSections, ISessionSettingsSections };
|
|
218
|
+
export { IMaterialAbstractData, IMaterialAbstractDataProperties, IMaterialStandardData, MaterialStandardData, IMaterialStandardDataProperties, IMaterialUnlitData, MaterialUnlitData, IMaterialUnlitDataProperties, IMaterialPointData, MaterialPointData, IMaterialPointDataProperties, IMaterialMultiPointData, MaterialMultiPointData, IMaterialMultiPointDataProperties, IMaterialBasicLineData, MaterialBasicLineData, IMaterialBasicLineDataProperties, IMaterialSpecularGlossinessData, MaterialSpecularGlossinessData, IMaterialSpecularGlossinessDataProperties, IMaterialGemData, MaterialGemData, IMaterialGemDataProperties, IMapData, MapData, ITexture, IMaterialContentDataV1, IMaterialContentDataV2, IMaterialContentDataV3 };
|
|
219
|
+
export { IAnimationData, AnimationData, IAnimationTrack, IGeometryData, IAttributeData, IPrimitiveData, IMaterialVariantsData, GeometryData, AttributeData, PrimitiveData, MaterialVariantsData };
|
|
220
|
+
export { IAnchorDataImage, IAnchorDataText, ITag2D, ITag3D, IHTMLElementAnchorData, HTMLElementAnchorCustomData, HTMLElementAnchorTextData, HTMLElementAnchorImageData, HTMLElementAnchorData };
|
|
221
|
+
export { ICustomData, CustomData };
|
|
222
|
+
export { ISDTFOverviewData, SDTFOverviewData, ISDTFOverview, SDTFAttributesData, ISDTFAttributesData, ISDTFAttributeData, SDTFAttributeData, SDTFItemData, ISDTFItemData, ISDTFAttributeVisualizationData, SdtfPrimitiveTypeGuard };
|
|
223
|
+
export { ISessionData, SessionData, ISessionOutputData, SessionOutputData };
|
|
224
|
+
export { ShapeDiverViewerErrorType, ShapeDiverViewerError, ShapeDiverViewerDataProcessingError, ShapeDiverViewerEnvironmentMapError, ShapeDiverViewerWebGLError, ShapeDiverViewerSettingsError, ShapeDiverViewerSessionError, ShapeDiverViewerViewportError, ShapeDiverViewerUnknownError, ShapeDiverViewerArError, ShapeDiverViewerLightError, ShapeDiverViewerCameraError, ShapeDiverViewerValidationError, ShapeDiverViewerInteractionError, ShapeDiverViewerDrawingToolsError, ShapeDiverGeometryBackendError, ShapeDiverGeometryBackendRequestError, ShapeDiverGeometryBackendResponseError, ShapeDiverGeometryBackendResponseErrorType };
|
|
225
|
+
export { isViewerError, isViewerUnknownError, isViewerDataProcessingError, isViewerEnvironmentMapError, isViewerWebGLError, isViewerSettingsError, isViewerSessionError, isViewerViewportError, isViewerLightError, isViewerCameraError, isARError, isViewerValidationError, isViewerInteractionError, isViewerDrawingToolsError, isViewerGeometryBackendError, isViewerGeometryBackendGenericError, isViewerGeometryBackendRequestError, isViewerGeometryBackendResponseError };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ShapeDiverResponseExport } from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The api for an export of a corresponding [session]{@link ISessionApi}.
|
|
5
|
+
*
|
|
6
|
+
* Exports are used for outputting data which should not be visualized in the scene,
|
|
7
|
+
* or which should not be accessible via the viewport.
|
|
8
|
+
*
|
|
9
|
+
* Exports are NOT computed as part of customizations (see {@link customize}).
|
|
10
|
+
* The export can be requested by calling its {@link request} method.
|
|
11
|
+
*
|
|
12
|
+
* Only the properties of {@link ShapeDiverResponseExportDefinition} will stay constant over the lifetime of a session.
|
|
13
|
+
* All additional properties that are added via the extension to {@link ShapeDiverResponseExport} can change according to
|
|
14
|
+
* the last export request.
|
|
15
|
+
*/
|
|
16
|
+
export interface IExportApi extends ShapeDiverResponseExport {
|
|
17
|
+
// #region Public Methods (1)
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Request the export.
|
|
21
|
+
*
|
|
22
|
+
* @param parameters Parameter values to be used for this export request. Map from parameter id to parameter value. The current value will be used for any parameter not specified.
|
|
23
|
+
*
|
|
24
|
+
* @throws {@type ShapeDiverViewerError}
|
|
25
|
+
*/
|
|
26
|
+
request(parameters?: { [key: string]: unknown }): Promise<ShapeDiverResponseExport>;
|
|
27
|
+
|
|
28
|
+
// #endregion Public Methods (1)
|
|
29
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IParameterApi } from './IParameterApi';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The api for a file parameter of a corresponding [session]{@link ISessionApi}.
|
|
5
|
+
*
|
|
6
|
+
* File parameters accept {@link https://developer.mozilla.org/en-US/docs/Web/API/File|File} or
|
|
7
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Blob|Blob} objects. The data
|
|
8
|
+
* gets uploaded to the Geometry Backend prior to sending a _customization_ request.
|
|
9
|
+
* This prior upload assigns a unique id to the data, which can be read from {@link IFileParameter.value}
|
|
10
|
+
* once the upload completed. The unique id can be used to run further customizations
|
|
11
|
+
* using the same data, avoiding a further upload.
|
|
12
|
+
*
|
|
13
|
+
* {@link upload} is used to trigger the prior upload, in case one is necessary. This
|
|
14
|
+
* is taken care of automatically by {@link ISessionApi.customize} and
|
|
15
|
+
* {@link ISessionApi.customizeParallel}, but can also be triggered separately
|
|
16
|
+
* beforehand.
|
|
17
|
+
*/
|
|
18
|
+
export interface IFileParameterApi extends IParameterApi<File | Blob | string> {
|
|
19
|
+
// #region Public Methods (2)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the filename of the file with the given id. If no id is given, the filename of the current value is returned (if available).
|
|
23
|
+
*
|
|
24
|
+
* @param fileId - The id of the file to get the filename for.
|
|
25
|
+
* @returns The filename of the file with the given id, or the filename of the current value if no id is given. If the filename is not available, `undefined` is returned.
|
|
26
|
+
* @throws {@type ShapeDiverViewerError}
|
|
27
|
+
*/
|
|
28
|
+
getFilename(fileId?: string): Promise<string | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Upload the data (File, Blob) that is currently set to the {@link value} property.
|
|
31
|
+
* You can then use the returned id to either set it as the value of the parameter or use it in a subsequent customization.
|
|
32
|
+
* This call returns immediately in case no data is waiting to be uploaded.
|
|
33
|
+
*
|
|
34
|
+
* @throws {@type ShapeDiverViewerError}
|
|
35
|
+
*/
|
|
36
|
+
upload(): Promise<string>;
|
|
37
|
+
|
|
38
|
+
// #endregion Public Methods (2)
|
|
39
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ITreeNode } from '@shapediver/viewer.shared.node-tree';
|
|
2
|
+
import { ShapeDiverResponseOutput } from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
3
|
+
import { ShapeDiverResponseOutputContent } from '@shapediver/viewer.session-engine.session-engine';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The api for an output of a corresponding [session]{@link ISessionApi}.
|
|
7
|
+
*
|
|
8
|
+
* Outputs represent the channels through which data is output from the model
|
|
9
|
+
* represented by a session. They are computed as part of customizations (see {@link customize}).
|
|
10
|
+
*
|
|
11
|
+
* Outputs contain static properties which do not
|
|
12
|
+
* depend on parameter values, these are:
|
|
13
|
+
*
|
|
14
|
+
* * id
|
|
15
|
+
* * uid
|
|
16
|
+
* * name
|
|
17
|
+
* * material
|
|
18
|
+
* * chunks
|
|
19
|
+
* * dependency
|
|
20
|
+
* * order
|
|
21
|
+
* * tooltip
|
|
22
|
+
* * displayname
|
|
23
|
+
* * hidden
|
|
24
|
+
*
|
|
25
|
+
* The remaining properties are dynamic and may change depending on parameter values.
|
|
26
|
+
* Specifically the _content_ property refers to output assets and embedded data.
|
|
27
|
+
*
|
|
28
|
+
* Each output has a corresponding {@link node} in the [scene tree]{@link ITree}
|
|
29
|
+
* which represents the data that got output from the model for the parameter values
|
|
30
|
+
* stored in {@link IParameterApi.sessionValue}.
|
|
31
|
+
*
|
|
32
|
+
* An output's content can be updated manually by calling the {@link updateOutputContent} method.
|
|
33
|
+
* Using the {@link freeze} property the output's content can be frozen, which means subsequent
|
|
34
|
+
* {@link customize} calls will not update the output.
|
|
35
|
+
*/
|
|
36
|
+
export interface IOutputApi extends ShapeDiverResponseOutput {
|
|
37
|
+
// #region Properties (4)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The format of the items in the content array.
|
|
41
|
+
*/
|
|
42
|
+
readonly format: string[];
|
|
43
|
+
/**
|
|
44
|
+
* The {@link node} corresponding to the output in the [scene tree]{@link ITree}.
|
|
45
|
+
*/
|
|
46
|
+
readonly node?: ITreeNode;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The freeze flag.
|
|
50
|
+
* When set to true, calls to the following functions will not update the output:
|
|
51
|
+
*
|
|
52
|
+
* * {@link updateOutputContent}
|
|
53
|
+
* * {@link ISessionApi.customize}
|
|
54
|
+
* * {@link ISessionApi.updateOutputs}
|
|
55
|
+
*/
|
|
56
|
+
freeze: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* A callback that is executed whenever an output's {@link node} is to be replaced
|
|
59
|
+
* due to an update of the output's content.
|
|
60
|
+
* Provides the new scene tree node and the old one, so that data can be carried over.
|
|
61
|
+
* If the callback is a promise it will be awaited in the execution chain.
|
|
62
|
+
*/
|
|
63
|
+
updateCallback: ((newNode?: ITreeNode, oldNode?: ITreeNode) => void | Promise<void>) | null;
|
|
64
|
+
|
|
65
|
+
// #endregion Properties (4)
|
|
66
|
+
|
|
67
|
+
// #region Public Methods (1)
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Update the output's content, effectively overriding the content which was output from the model.
|
|
71
|
+
*
|
|
72
|
+
* This can be used to override the content which was output from the model (e.g. materials).
|
|
73
|
+
* In case you want the override content to persist further calls to {@link ISessionApi.customize},
|
|
74
|
+
* await the call to this function and then set {@link freeze} to true.
|
|
75
|
+
*
|
|
76
|
+
* @param content The new output content.
|
|
77
|
+
* @param preventUpdate Option to not update the output immediately (default: false). Use this to update
|
|
78
|
+
* the content of several outputs at the same time, then call {@link ISessionApi.updateOutputs}.
|
|
79
|
+
*
|
|
80
|
+
* @throws {@type ShapeDiverViewerError}
|
|
81
|
+
*/
|
|
82
|
+
updateOutputContent(content: ShapeDiverResponseOutputContent[], preventUpdate?: boolean): Promise<ITreeNode | undefined>;
|
|
83
|
+
|
|
84
|
+
// #endregion Public Methods (1)
|
|
85
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ShapeDiverResponseParameter } from '@shapediver/sdk.geometry-api-sdk-v2';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The api for a parameter of a corresponding [session]{@link ISessionApi}.
|
|
5
|
+
*
|
|
6
|
+
* Parameters represent the channels through which data can be input into the model
|
|
7
|
+
* represented by a session.
|
|
8
|
+
*
|
|
9
|
+
* The current value can be changed by setting the {@link value} property.
|
|
10
|
+
*/
|
|
11
|
+
export interface IParameterApi<T> extends ShapeDiverResponseParameter {
|
|
12
|
+
// #region Properties (2)
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The value that corresponds to the latest successful call to {@link ISessionApi.customize}.
|
|
16
|
+
* This property will be updated immediately before {@link ISessionApi.customize} returns.
|
|
17
|
+
*/
|
|
18
|
+
sessionValue: T | string;
|
|
19
|
+
/**
|
|
20
|
+
* The current value.
|
|
21
|
+
*
|
|
22
|
+
* Validation happens immediately when setting this property. An error will be thrown in case
|
|
23
|
+
* validation fails. Use {@link isValid} to test whether a value passes validation.
|
|
24
|
+
*
|
|
25
|
+
* In case {@link ISessionApi.automaticSceneUpdate} is true, setting the value will immediately
|
|
26
|
+
* trigger a customization (see {@link ISessionApi.customize}).
|
|
27
|
+
*/
|
|
28
|
+
value: T | string;
|
|
29
|
+
|
|
30
|
+
// #endregion Properties (2)
|
|
31
|
+
|
|
32
|
+
// #region Public Methods (4)
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Evaluates if a given value is valid for this parameter.
|
|
36
|
+
*
|
|
37
|
+
* @param value the value to evaluate
|
|
38
|
+
* @param throwError if true, an error is thrown if validation does not pass (default: false)
|
|
39
|
+
*/
|
|
40
|
+
isValid(value: unknown, throwError?: boolean): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Resets the value to the default value.
|
|
43
|
+
*/
|
|
44
|
+
resetToDefaultValue(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Resets the value to {@link sessionValue}.
|
|
47
|
+
*/
|
|
48
|
+
resetToSessionValue(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the current value as a string
|
|
51
|
+
*/
|
|
52
|
+
stringify(): string;
|
|
53
|
+
|
|
54
|
+
// #endregion Public Methods (4)
|
|
55
|
+
}
|