@3dverse/livelink.core 0.8.0 → 1.0.1
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/README.md +61 -17
- package/dist/_prebuild/EditorConnection.d.ts +1 -29
- package/dist/_prebuild/EditorMessageHandler.d.ts +1 -139
- package/dist/_prebuild/GatewayConnection.d.ts +1 -64
- package/dist/_prebuild/GatewayMessageHandler.d.ts +1 -197
- package/dist/_prebuild/engine_types/ComponentsHashes.d.ts +5 -0
- package/dist/_prebuild/{types → engine_types}/ComponentsRecord.d.ts +65 -44
- package/dist/_prebuild/{types → engine_types}/assets.d.ts +69 -0
- package/dist/_prebuild/{types → engine_types}/components.d.ts +164 -164
- package/dist/_prebuild/messages/editor/ConnectConfirmation.d.ts +1 -71
- package/dist/_prebuild/messages/editor/EditorEntity.d.ts +1 -75
- package/dist/_prebuild/messages/editor/EntityUpdatedEvent.d.ts +1 -7
- package/dist/_prebuild/messages/editor/EntityVisibilityChangedEvent.d.ts +1 -8
- package/dist/_prebuild/messages/editor/UpdateComponentsCommand.d.ts +1 -6
- package/dist/_prebuild/messages/editor/index.d.ts +0 -1
- package/dist/_prebuild/messages/gateway/commands/AssignClientToScriptCommand.d.ts +9 -0
- package/dist/_prebuild/messages/gateway/commands/AuthenticationCommand.d.ts +1 -0
- package/dist/_prebuild/messages/gateway/{ClientConfig.d.ts → commands/ConfigureClientCommand.d.ts} +11 -13
- package/dist/_prebuild/messages/gateway/commands/FireEventCommand.d.ts +11 -0
- package/dist/_prebuild/messages/gateway/commands/HighlightEntitiesCommand.d.ts +8 -0
- package/dist/_prebuild/messages/gateway/commands/InputStateCommand.d.ts +8 -0
- package/dist/_prebuild/messages/gateway/commands/RemoveComponentsCommand.d.ts +1 -0
- package/dist/_prebuild/messages/gateway/commands/RemoveFilterCommand.d.ts +7 -0
- package/dist/_prebuild/messages/gateway/commands/ResizeCommand.d.ts +13 -0
- package/dist/_prebuild/messages/gateway/commands/SendSkeletonPoseCommand.d.ts +25 -0
- package/dist/_prebuild/messages/gateway/commands/SetFilterCommand.d.ts +8 -0
- package/dist/_prebuild/messages/gateway/commands/ToggleFilterCommand.d.ts +8 -0
- package/dist/_prebuild/messages/gateway/commands/UpdateEntitiesFromBytesCommand.d.ts +1 -0
- package/dist/_prebuild/messages/gateway/commands/UpdateEntitiesFromJsonCommand.d.ts +1 -0
- package/dist/_prebuild/messages/gateway/commands/ViewportConfigCommand.d.ts +16 -0
- package/dist/_prebuild/messages/gateway/commands/index.d.ts +15 -0
- package/dist/_prebuild/messages/gateway/enums.d.ts +8 -115
- package/dist/_prebuild/messages/gateway/events/AssetLoadingEvent.d.ts +1 -0
- package/dist/_prebuild/messages/gateway/events/FrameDataEvent.d.ts +26 -0
- package/dist/_prebuild/messages/gateway/events/ScriptEvent.d.ts +10 -0
- package/dist/_prebuild/messages/gateway/events/index.d.ts +3 -0
- package/dist/_prebuild/messages/gateway/index.d.ts +16 -22
- package/dist/_prebuild/messages/gateway/queries/ScreenSpaceRayQuery.d.ts +18 -0
- package/dist/_prebuild/messages/gateway/queries/index.d.ts +1 -0
- package/dist/_prebuild/messages/index.d.ts +2 -0
- package/dist/library.cjs +1 -1
- package/dist/library.cjs.map +4 -4
- package/dist/library.mjs +1 -1
- package/dist/library.mjs.map +4 -4
- package/dist/sources/ActivityWatcher.d.ts +40 -21
- package/dist/sources/CoreEvents.d.ts +35 -0
- package/dist/sources/DynamicLoader.d.ts +38 -0
- package/dist/sources/EntityUtils.d.ts +117 -0
- package/dist/sources/LivelinkCore.d.ts +131 -127
- package/dist/sources/{interfaces/SessionInterface.d.ts → SessionInterface.d.ts} +2 -6
- package/dist/sources/TypedEventTarget.d.ts +14 -0
- package/dist/sources/controllers/EditorController.d.ts +1 -21
- package/dist/sources/controllers/EditorEvents.d.ts +27 -0
- package/dist/sources/controllers/GatewayController.d.ts +1 -60
- package/dist/sources/controllers/GatewayEvents.d.ts +54 -0
- package/dist/sources/core.d.ts +12 -11
- package/dist/sources/internal/RequestHandler.d.ts +1 -0
- package/dist/sources/internal/Serializer.d.ts +1 -0
- package/dist/sources/library.d.ts +1 -1
- package/dist/sources/types/RTID.d.ts +6 -21
- package/dist/sources/types/UUID.d.ts +11 -21
- package/dist/sources/types/dataObjects.d.ts +1 -1
- package/dist/sources/types/index.d.ts +1 -0
- package/dist/sources/types/math.d.ts +1 -105
- package/dist/sources/types/nativeTypes.d.ts +0 -132
- package/dist/sources/types/utils.d.ts +19 -0
- package/package.json +6 -4
- package/dist/_prebuild/enums.d.ts +0 -6
- package/dist/_prebuild/messages/editor/EntityCreationCoreOptions.d.ts +0 -6
- package/dist/_prebuild/messages/gateway/AssetLoadingEvent.d.ts +0 -14
- package/dist/_prebuild/messages/gateway/AssignClientToScriptMessage.d.ts +0 -22
- package/dist/_prebuild/messages/gateway/AuthenticationResponse.d.ts +0 -31
- package/dist/_prebuild/messages/gateway/ClientConfigResponse.d.ts +0 -16
- package/dist/_prebuild/messages/gateway/FireEventMessage.d.ts +0 -23
- package/dist/_prebuild/messages/gateway/FrameData.d.ts +0 -42
- package/dist/_prebuild/messages/gateway/HighlightEntitiesMessage.d.ts +0 -22
- package/dist/_prebuild/messages/gateway/InputState.d.ts +0 -22
- package/dist/_prebuild/messages/gateway/RemoveComponentsCommand.d.ts +0 -23
- package/dist/_prebuild/messages/gateway/RemoveFilterMessage.d.ts +0 -19
- package/dist/_prebuild/messages/gateway/ResizeResponse.d.ts +0 -14
- package/dist/_prebuild/messages/gateway/ScreenSpaceRayQuery.d.ts +0 -30
- package/dist/_prebuild/messages/gateway/ScreenSpaceRayResult.d.ts +0 -16
- package/dist/_prebuild/messages/gateway/ScriptEvent.d.ts +0 -17
- package/dist/_prebuild/messages/gateway/SendSkeletonPoseMessage.d.ts +0 -28
- package/dist/_prebuild/messages/gateway/SessionAuth.d.ts +0 -8
- package/dist/_prebuild/messages/gateway/SetFilterMessage.d.ts +0 -20
- package/dist/_prebuild/messages/gateway/ToggleFilterMessage.d.ts +0 -20
- package/dist/_prebuild/messages/gateway/UpdateEntitiesFromBytesMessage.d.ts +0 -25
- package/dist/_prebuild/messages/gateway/UpdateEntitiesFromJsonMessage.d.ts +0 -23
- package/dist/_prebuild/messages/gateway/ViewportConfig.d.ts +0 -30
- package/dist/_prebuild/types/ComponentsHashes.d.ts +0 -53
- package/dist/sources/LivelinkCoreModule.d.ts +0 -39
- package/dist/sources/RequestHandler.d.ts +0 -49
- package/dist/sources/Serializer.d.ts +0 -34
- package/dist/sources/interfaces/ClientInterface.d.ts +0 -12
- package/dist/sources/interfaces/EntityInterface.d.ts +0 -20
- package/dist/sources/interfaces/index.d.ts +0 -3
- /package/dist/_prebuild/{types → engine_types}/SceneSettingsRecord.d.ts +0 -0
- /package/dist/_prebuild/{types → engine_types}/sceneSettings.d.ts +0 -0
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import { EntityInterface } from "./interfaces/EntityInterface";
|
|
4
|
-
import { SessionInterface } from "./interfaces/SessionInterface";
|
|
1
|
+
import type { GatewayMessages } from "../_prebuild/messages";
|
|
2
|
+
import { ComponentName, ComponentType, EntityCore, ComponentsManifest } from "../_prebuild/engine_types/ComponentsRecord";
|
|
5
3
|
import { RTID, UUID, Vec2i } from "./types";
|
|
6
|
-
import { ComponentType, SceneSettingsRecord } from "./core";
|
|
7
|
-
import { Serializer } from "./Serializer";
|
|
8
4
|
import { ActivityWatcher } from "./ActivityWatcher";
|
|
5
|
+
import { SessionInterface } from "./SessionInterface";
|
|
6
|
+
import { TypedEventTarget } from "./TypedEventTarget";
|
|
7
|
+
import { CoreEvents } from "./CoreEvents";
|
|
8
|
+
import { EntityResponse, FindEntityOptions, FindEntityQuery, UpdateEntityCommand } from "./EntityUtils";
|
|
9
9
|
/**
|
|
10
|
-
* The LivelinkCore
|
|
10
|
+
* The LivelinkCore is the main entry point to the Livelink API.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* Instead, applications should embed the 3dverse/livelink.js library, responsible for importing the
|
|
14
|
-
* current library, 3dverse/livelink.core.js.
|
|
12
|
+
* It implements the communication protocol with the 3dverse server.
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* It has two main responsibilities:
|
|
15
|
+
* - It manages the connection to the 3dverse server.
|
|
16
|
+
* - It provides methods to interact with the 3dverse server as defined in the Livelink protocol.
|
|
17
|
+
*
|
|
18
|
+
* An activity watcher is embedded to monitor the activity of the client.
|
|
19
|
+
* If the client is inactive for a certain amount of time, the connection is closed.
|
|
20
|
+
* See {@link ActivityWatcher}.
|
|
19
21
|
*
|
|
20
22
|
* @category Core
|
|
21
23
|
*/
|
|
22
|
-
export declare class LivelinkCore {
|
|
24
|
+
export declare class LivelinkCore extends TypedEventTarget<CoreEvents> {
|
|
23
25
|
#private;
|
|
24
26
|
/**
|
|
25
27
|
* Get the gateway activity watcher.
|
|
@@ -27,209 +29,211 @@ export declare class LivelinkCore {
|
|
|
27
29
|
get activity_watcher(): ActivityWatcher;
|
|
28
30
|
/**
|
|
29
31
|
* Connect to the session
|
|
32
|
+
*
|
|
33
|
+
* @param params
|
|
34
|
+
* @param params.session - The session to connect to. MUST be joinable.
|
|
35
|
+
* @param params.editor_url - The URL of the editor.
|
|
30
36
|
*/
|
|
31
37
|
connect({ session, editor_url }: {
|
|
32
38
|
session: SessionInterface;
|
|
33
39
|
editor_url: string;
|
|
34
|
-
}): Promise<
|
|
35
|
-
component_descriptors: Record<string, ComponentDescriptor>;
|
|
36
|
-
settings: SceneSettingsRecord;
|
|
37
|
-
serializer: Serializer;
|
|
38
|
-
}>;
|
|
40
|
+
}): Promise<void>;
|
|
39
41
|
/**
|
|
40
|
-
* Closes the connections to the
|
|
42
|
+
* Closes the connections to the 3dverse server.
|
|
41
43
|
*/
|
|
42
44
|
disconnect(): void;
|
|
43
45
|
/**
|
|
44
46
|
*
|
|
45
47
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}): void;
|
|
48
|
+
sanitizeComponentValue<_ComponentName extends ComponentName>({ component_name, value, }: {
|
|
49
|
+
component_name: _ComponentName;
|
|
50
|
+
value: Partial<ComponentType<_ComponentName>> | undefined;
|
|
51
|
+
}): ComponentType<_ComponentName>;
|
|
51
52
|
/**
|
|
53
|
+
* Set the simulation state.
|
|
52
54
|
*
|
|
55
|
+
* @param params
|
|
56
|
+
* @param params.state - The state of the simulation.
|
|
53
57
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
event_name: string;
|
|
57
|
-
handler: EventListenerOrEventListenerObject;
|
|
58
|
+
setSimulationState({ state }: {
|
|
59
|
+
state: "start_simulation" | "pause_simulation" | "stop_simulation";
|
|
58
60
|
}): void;
|
|
61
|
+
/**
|
|
62
|
+
* Create entities.
|
|
63
|
+
*
|
|
64
|
+
* @param params
|
|
65
|
+
* @param params.components - The components to use to create the entities.
|
|
66
|
+
* @param params.delete_on_client_disconnection - Whether to delete the entities when the client disconnects.
|
|
67
|
+
* @param params.is_transient - Whether the entities are transient.
|
|
68
|
+
* @returns A promise that resolves to the created entities.
|
|
69
|
+
*
|
|
70
|
+
* @throws If any entity could not be created.
|
|
71
|
+
*/
|
|
72
|
+
createEntities({ components, delete_on_client_disconnection, is_transient, }: {
|
|
73
|
+
components: Array<ComponentsManifest>;
|
|
74
|
+
delete_on_client_disconnection: boolean;
|
|
75
|
+
is_transient: boolean;
|
|
76
|
+
}): Promise<Array<EntityCore>>;
|
|
77
|
+
/**
|
|
78
|
+
* Update entities.
|
|
79
|
+
*/
|
|
80
|
+
updateEntities({ update_commands, persist, }: {
|
|
81
|
+
update_commands: Array<UpdateEntityCommand>;
|
|
82
|
+
persist: boolean;
|
|
83
|
+
}): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Find entities based on a query.
|
|
86
|
+
*/
|
|
87
|
+
findEntities({ query, options, }: {
|
|
88
|
+
query: FindEntityQuery;
|
|
89
|
+
options?: FindEntityOptions;
|
|
90
|
+
}): Promise<Array<EntityResponse>>;
|
|
59
91
|
/***************************************************************************
|
|
60
92
|
* REGISTRATION (1)
|
|
61
93
|
**************************************************************************/
|
|
62
94
|
/**
|
|
63
95
|
* Send the configuration requested by the client.
|
|
96
|
+
*
|
|
97
|
+
* @param params
|
|
98
|
+
* @param params.client_config - The configuration requested by the client.
|
|
64
99
|
*/
|
|
65
|
-
configureClient({ client_config }: {
|
|
66
|
-
client_config: ClientConfig;
|
|
67
|
-
}): Promise<ClientConfigResponse>;
|
|
100
|
+
configureClient({ client_config, }: {
|
|
101
|
+
client_config: GatewayMessages.Commands.ClientConfig;
|
|
102
|
+
}): Promise<GatewayMessages.Commands.ClientConfigResponse>;
|
|
68
103
|
/***************************************************************************
|
|
69
104
|
* INPUTS (2)
|
|
70
105
|
**************************************************************************/
|
|
71
106
|
/**
|
|
107
|
+
* Send the input state of an input device.
|
|
72
108
|
*
|
|
109
|
+
* @param params
|
|
110
|
+
* @param params.input_state - The input state of the input device.
|
|
73
111
|
*/
|
|
74
112
|
sendInputState({ input_state }: {
|
|
75
|
-
input_state:
|
|
113
|
+
input_state: GatewayMessages.Commands.InputStateData;
|
|
76
114
|
}): void;
|
|
77
115
|
/***************************************************************************
|
|
78
116
|
* VIEWER CONTROL (4)
|
|
79
117
|
**************************************************************************/
|
|
80
118
|
/**
|
|
119
|
+
* Resize the remote rendering surface.
|
|
81
120
|
*
|
|
121
|
+
* @param params
|
|
122
|
+
* @param params.size - The new size of the remote rendering surface.
|
|
82
123
|
*/
|
|
83
124
|
resize({ size }: {
|
|
84
125
|
size: Vec2i;
|
|
85
126
|
}): void;
|
|
86
127
|
/**
|
|
87
|
-
*
|
|
128
|
+
* Suspend the rendering client. The server won't send any more frames until the client is resumed.
|
|
88
129
|
*/
|
|
89
130
|
suspend(): void;
|
|
90
131
|
/**
|
|
91
|
-
*
|
|
132
|
+
* Resume the rendering client.
|
|
92
133
|
*/
|
|
93
134
|
resume(): void;
|
|
94
135
|
/**
|
|
136
|
+
* Set the viewports configuration of the current client.
|
|
95
137
|
*
|
|
138
|
+
* @param params
|
|
139
|
+
* @param params.viewport_configs - The viewports configuration.
|
|
96
140
|
*/
|
|
97
141
|
setViewports({ viewport_configs }: {
|
|
98
|
-
viewport_configs: Array<ViewportConfig>;
|
|
142
|
+
viewport_configs: Array<GatewayMessages.Commands.ViewportConfig>;
|
|
99
143
|
}): void;
|
|
100
144
|
/***************************************************************************
|
|
101
145
|
* CLIENT REMOTE OPERATIONS (5)
|
|
102
146
|
**************************************************************************/
|
|
103
147
|
/**
|
|
148
|
+
* Cast a screen space ray.
|
|
104
149
|
*
|
|
150
|
+
* @param params
|
|
151
|
+
* @param params.screenSpaceRayQuery - The screen space ray query.
|
|
152
|
+
* @returns A promise that resolves to the screen space ray result.
|
|
105
153
|
*/
|
|
106
154
|
castScreenSpaceRay({ screenSpaceRayQuery, }: {
|
|
107
|
-
screenSpaceRayQuery: ScreenSpaceRayQuery;
|
|
108
|
-
}): Promise<
|
|
155
|
+
screenSpaceRayQuery: GatewayMessages.Queries.ScreenSpaceRayQuery;
|
|
156
|
+
}): Promise<GatewayMessages.Queries.ScreenSpaceRayResponse>;
|
|
109
157
|
/**
|
|
158
|
+
* Mark entities as selected.
|
|
110
159
|
*
|
|
160
|
+
* @param params
|
|
161
|
+
* @param params.highlightEntitiesMessage - The message to highlight entities.
|
|
111
162
|
*/
|
|
112
|
-
highlightEntities({ highlightEntitiesMessage }: {
|
|
113
|
-
highlightEntitiesMessage:
|
|
163
|
+
highlightEntities({ highlightEntitiesMessage, }: {
|
|
164
|
+
highlightEntitiesMessage: GatewayMessages.Commands.HighlightEntitiesData;
|
|
114
165
|
}): void;
|
|
115
|
-
/***************************************************************************
|
|
116
|
-
* EDITOR REMOTE OPERATIONS (6)
|
|
117
|
-
**************************************************************************/
|
|
118
|
-
/**
|
|
119
|
-
* 3
|
|
120
|
-
*/
|
|
121
|
-
updateEntitiesFromBytes(updateEntitiesFromBytesMessage: UpdateEntitiesFromBytesMessage): void;
|
|
122
|
-
/**
|
|
123
|
-
* 4
|
|
124
|
-
*/
|
|
125
|
-
removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
|
|
126
166
|
/**
|
|
127
|
-
* 11
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* 15
|
|
132
|
-
*/
|
|
133
|
-
updateEntitiesFromJson(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
|
|
134
|
-
/**
|
|
135
|
-
* 16
|
|
136
|
-
*/
|
|
137
|
-
setFilter(setFilterMessage: SetFilterMessage): void;
|
|
138
|
-
/**
|
|
139
|
-
* 17
|
|
140
|
-
*/
|
|
141
|
-
removeFilter(removeFilterMessage: RemoveFilterMessage): void;
|
|
142
|
-
/**
|
|
143
|
-
* 18
|
|
167
|
+
* 11 - Fire an event.
|
|
168
|
+
*
|
|
169
|
+
* @param fireEventMessage - The message to fire an event.
|
|
144
170
|
*/
|
|
145
|
-
|
|
171
|
+
fireEvent(fireEventMessage: GatewayMessages.Commands.FireEventData): void;
|
|
146
172
|
/**
|
|
147
|
-
*
|
|
173
|
+
* 16 - Set a filter.
|
|
174
|
+
*
|
|
175
|
+
* @param setFilterMessage - The message to set a filter.
|
|
176
|
+
*
|
|
177
|
+
* @experimental
|
|
148
178
|
*/
|
|
149
|
-
|
|
179
|
+
setFilter(setFilterMessage: GatewayMessages.Commands.SetFilterData): void;
|
|
150
180
|
/**
|
|
151
|
-
*
|
|
181
|
+
* 17 - Remove a filter.
|
|
182
|
+
*
|
|
183
|
+
* @param removeFilterMessage - The message to remove a filter.
|
|
184
|
+
*
|
|
185
|
+
* @experimental
|
|
152
186
|
*/
|
|
153
|
-
|
|
154
|
-
/***************************************************************************
|
|
155
|
-
* EDITOR
|
|
156
|
-
**************************************************************************/
|
|
187
|
+
removeFilter(removeFilterMessage: GatewayMessages.Commands.RemoveFilterData): void;
|
|
157
188
|
/**
|
|
189
|
+
* 18 - Toggle a filter.
|
|
158
190
|
*
|
|
191
|
+
* @param toggleFilterMessage - The message to toggle a filter.
|
|
192
|
+
*
|
|
193
|
+
* @experimental
|
|
159
194
|
*/
|
|
160
|
-
|
|
161
|
-
entities: Array<EntityInterface>;
|
|
162
|
-
options?: EntityCreationCoreOptions;
|
|
163
|
-
}): Promise<Array<EditorEntity>>;
|
|
195
|
+
toggleFilter(toggleFilterMessage: GatewayMessages.Commands.ToggleFilterData): void;
|
|
164
196
|
/**
|
|
197
|
+
* 20 - Assign a client to a script. The target script will consume the specified client's inputs.
|
|
165
198
|
*
|
|
199
|
+
* @param assignClientToScriptMessage - The message to assign a client to a script.
|
|
166
200
|
*/
|
|
167
|
-
|
|
168
|
-
entity: EntityInterface;
|
|
169
|
-
options?: EntityCreationCoreOptions;
|
|
170
|
-
}): Promise<EditorEntity>;
|
|
201
|
+
assignClientToScript(assignClientToScriptMessage: GatewayMessages.Commands.AssignClientToScriptData): void;
|
|
171
202
|
/**
|
|
203
|
+
* 24 - Send a skeleton pose.
|
|
172
204
|
*
|
|
205
|
+
* @param skeletonPoseMessage - The message to send a skeleton pose.
|
|
173
206
|
*/
|
|
174
|
-
|
|
207
|
+
sendSkeletonPose(skeletonPoseMessage: GatewayMessages.Commands.SkeletonPoseData): void;
|
|
175
208
|
/**
|
|
209
|
+
* Delete entities.
|
|
176
210
|
*
|
|
211
|
+
* @param params
|
|
212
|
+
* @param params.entity_uuids - The UUIDs of the entities to delete.
|
|
177
213
|
*/
|
|
178
214
|
deleteEntities({ entity_uuids }: {
|
|
179
215
|
entity_uuids: Array<UUID>;
|
|
180
216
|
}): Promise<void>;
|
|
181
217
|
/**
|
|
218
|
+
* Set the visibility of the specified entity.
|
|
182
219
|
*
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}): Promise<Array<EditorEntity>>;
|
|
187
|
-
/**
|
|
188
|
-
* @deprecated
|
|
189
|
-
*/
|
|
190
|
-
findEntitiesWithComponents({ mandatory_components, forbidden_components, }: {
|
|
191
|
-
mandatory_components: Array<ComponentType>;
|
|
192
|
-
forbidden_components?: Array<ComponentType>;
|
|
193
|
-
}): Promise<Array<EditorEntity>>;
|
|
194
|
-
/**
|
|
195
|
-
* @deprecated
|
|
196
|
-
*/
|
|
197
|
-
findEntitiesByNames({ entity_names }: {
|
|
198
|
-
entity_names: Array<string>;
|
|
199
|
-
}): Promise<Array<EditorEntity>>;
|
|
200
|
-
/**
|
|
201
|
-
* @deprecated
|
|
220
|
+
* @param params
|
|
221
|
+
* @param params.entity_rtid - The RTID of the entity to set the visibility.
|
|
222
|
+
* @param params.is_visible - The visibility of the entity.
|
|
202
223
|
*/
|
|
203
224
|
setEntityVisibility({ entity_rtid, is_visible }: {
|
|
204
225
|
entity_rtid: RTID;
|
|
205
226
|
is_visible: boolean;
|
|
206
227
|
}): Promise<void>;
|
|
207
228
|
/**
|
|
229
|
+
* Resolve the children of the specified entity.
|
|
230
|
+
* Children are the direct children of the entity.
|
|
208
231
|
*
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
linkage: Array<UUID>;
|
|
213
|
-
}): Promise<EditorEntity | null>;
|
|
214
|
-
/**
|
|
215
|
-
*
|
|
216
|
-
*/
|
|
217
|
-
resolveAncestors({ entity_rtid }: {
|
|
218
|
-
entity_rtid: RTID;
|
|
219
|
-
}): Promise<Array<EditorEntity>>;
|
|
220
|
-
/**
|
|
221
|
-
*
|
|
232
|
+
* @param params
|
|
233
|
+
* @param params.entity_rtid - The RTID of the entity to resolve the children.
|
|
234
|
+
* @returns A promise that resolves to the children of the entity or an empty array if the entity has no children.
|
|
222
235
|
*/
|
|
223
236
|
getChildren({ entity_rtid }: {
|
|
224
237
|
entity_rtid: RTID;
|
|
225
|
-
}): Promise<Array<
|
|
226
|
-
/***************************************************************************
|
|
227
|
-
* Utils
|
|
228
|
-
**************************************************************************/
|
|
229
|
-
/**
|
|
230
|
-
*
|
|
231
|
-
*/
|
|
232
|
-
setSimulationState({ state }: {
|
|
233
|
-
state: "start_simulation" | "pause_simulation" | "stop_simulation";
|
|
234
|
-
}): void;
|
|
238
|
+
}): Promise<Array<EntityCore>>;
|
|
235
239
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UUID } from "
|
|
1
|
+
import { UUID } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Session interface.
|
|
4
4
|
*
|
|
@@ -14,11 +14,7 @@ export interface SessionInterface {
|
|
|
14
14
|
*/
|
|
15
15
|
get session_key(): string | null;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Will be called to set the current client unique identifier in UUID format.
|
|
18
18
|
*/
|
|
19
19
|
set client_id(client_id: UUID | null);
|
|
20
|
-
/**
|
|
21
|
-
* Must return true if the session is joinable.
|
|
22
|
-
*/
|
|
23
|
-
isJoinable(): boolean;
|
|
24
20
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Core
|
|
3
|
+
*/
|
|
4
|
+
export declare class TypedEventTarget<EventMap extends Record<string, Event>> {
|
|
5
|
+
#private;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
addEventListener<_EventName extends keyof EventMap & string>(event_name: _EventName, listener: (event: EventMap[_EventName]) => void, options?: AddEventListenerOptions | boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
removeEventListener<_EventName extends keyof EventMap & string>(event_name: _EventName, listener: (event: EventMap[_EventName]) => void, options?: EventListenerOptions | boolean): void;
|
|
14
|
+
}
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ConnectConfirmation } from "../../_prebuild/messages/editor";
|
|
3
|
-
import { SessionInterface } from "../interfaces/SessionInterface";
|
|
4
|
-
import { UUID } from "../types";
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare class EditorController extends EditorMessageHandler {
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
connectToSession({ session, client_id, editor_url, }: {
|
|
13
|
-
session: SessionInterface;
|
|
14
|
-
client_id: UUID;
|
|
15
|
-
editor_url: string;
|
|
16
|
-
}): Promise<ConnectConfirmation>;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
disconnect(): void;
|
|
21
|
-
}
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComponentsRecord } from "../../_prebuild/engine_types/ComponentsRecord";
|
|
2
|
+
import { RTID, UUID } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class EntitiesUpdatedEvent extends Event {
|
|
7
|
+
/**
|
|
8
|
+
* An array of entities that have been updated.
|
|
9
|
+
*/
|
|
10
|
+
readonly updated_entities: Array<{
|
|
11
|
+
entity_euid: UUID;
|
|
12
|
+
updated_components: Partial<ComponentsRecord>;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export declare class EntityVisibilityChangedEvent extends Event {
|
|
19
|
+
/**
|
|
20
|
+
* The RTID of the entity whose visibility state has changed.
|
|
21
|
+
*/
|
|
22
|
+
readonly entity_rtid: RTID;
|
|
23
|
+
/**
|
|
24
|
+
* The new visibility state of the entity.
|
|
25
|
+
*/
|
|
26
|
+
readonly is_visible: boolean;
|
|
27
|
+
}
|
|
@@ -1,60 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { GatewayMessageHandler } from "../../_prebuild/GatewayMessageHandler";
|
|
3
|
-
import { SessionInterface } from "../interfaces/SessionInterface";
|
|
4
|
-
import { ActivityWatcher } from "../ActivityWatcher";
|
|
5
|
-
import { UUID } from "../types";
|
|
6
|
-
/**
|
|
7
|
-
* The gateway controller is the exposed interface of the Livelink gateway protocol.
|
|
8
|
-
*
|
|
9
|
-
* It's the object responsible for providing access to any request message the gateway exposes.
|
|
10
|
-
* Additionally, it is responsible for handling the responses to requests.
|
|
11
|
-
*/
|
|
12
|
-
export declare class GatewayController extends GatewayMessageHandler {
|
|
13
|
-
#private;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
get activity_watcher(): ActivityWatcher;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
get latency(): number;
|
|
22
|
-
/**
|
|
23
|
-
* Opens a connection to the gateway where the provided session is running.
|
|
24
|
-
*
|
|
25
|
-
* @returns {Promise<UUID>} The created client UUID representing the current user encoded
|
|
26
|
-
* in `session.session_key`.
|
|
27
|
-
*
|
|
28
|
-
* @throws {InvalidSession} Thrown if the provided session is not valid.
|
|
29
|
-
*
|
|
30
|
-
* @throws {AuthenticationFailed} Thrown if the authentication to the gateway fails and provides
|
|
31
|
-
* the reason.
|
|
32
|
-
*/
|
|
33
|
-
connectToSession({ session }: {
|
|
34
|
-
session: SessionInterface;
|
|
35
|
-
}): Promise<UUID>;
|
|
36
|
-
/**
|
|
37
|
-
* Closes the connection to the gateway.
|
|
38
|
-
*/
|
|
39
|
-
disconnect(): void;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
_onInactivityTimeout: () => void;
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
_onConnected(): void;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
_onDisconnected({ reason }: {
|
|
52
|
-
reason: GatewayDisconnectedReason;
|
|
53
|
-
}): void;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
_onMessageSent({ is_heart_beat }: {
|
|
58
|
-
is_heart_beat?: boolean;
|
|
59
|
-
}): void;
|
|
60
|
-
}
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export * from "../../_prebuild/messages/gateway/events";
|
|
2
|
+
import { RawFrameMetaData } from "../../_prebuild/messages/gateway/events";
|
|
3
|
+
import { RTID, ScriptDataObject } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare class FrameReceivedEvent extends Event {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
readonly encoded_frame: DataView;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
readonly meta_data: RawFrameMetaData;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare class ScriptEventTriggeredEvent extends Event {
|
|
21
|
+
/**
|
|
22
|
+
* The RTID of the emitter of the event.
|
|
23
|
+
*/
|
|
24
|
+
readonly emitter_rtid: RTID;
|
|
25
|
+
/**
|
|
26
|
+
* The name of the event.
|
|
27
|
+
*/
|
|
28
|
+
readonly event_name: string;
|
|
29
|
+
/**
|
|
30
|
+
* The RTIDs of the entities that are the targets of the event.
|
|
31
|
+
*/
|
|
32
|
+
readonly target_rtids: Array<RTID>;
|
|
33
|
+
/**
|
|
34
|
+
* The data object of the event.
|
|
35
|
+
*/
|
|
36
|
+
readonly data_object: ScriptDataObject;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export declare class AssetLoadingStatusEvent extends Event {
|
|
42
|
+
/**
|
|
43
|
+
* Whether the server is currently loading payloads.
|
|
44
|
+
*/
|
|
45
|
+
readonly loading_payloads: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The number of pending requests.
|
|
48
|
+
*/
|
|
49
|
+
readonly pending_requests: number;
|
|
50
|
+
/**
|
|
51
|
+
* The number of loading scenes.
|
|
52
|
+
*/
|
|
53
|
+
readonly pending_scenes: number;
|
|
54
|
+
}
|
package/dist/sources/core.d.ts
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
export * from "./LivelinkCore";
|
|
2
|
-
export * from "./Serializer";
|
|
3
2
|
export * from "./ActivityWatcher";
|
|
3
|
+
export * from "./SessionInterface";
|
|
4
|
+
export * from "./EntityUtils";
|
|
4
5
|
export * from "./types";
|
|
5
|
-
export * from "./interfaces";
|
|
6
6
|
export * from "../_prebuild/messages/editor";
|
|
7
7
|
export * from "../_prebuild/messages/gateway";
|
|
8
|
-
export * from "../_prebuild/
|
|
9
|
-
export * from "../_prebuild/
|
|
10
|
-
export * from "../_prebuild/types/ComponentsHashes";
|
|
11
|
-
export * from "../_prebuild/types/SceneSettingsRecord";
|
|
12
|
-
export type { GatewayDisconnectedReason } from "../_prebuild/GatewayConnection";
|
|
8
|
+
export * from "../_prebuild/engine_types/ComponentsRecord";
|
|
9
|
+
export * from "../_prebuild/engine_types/ComponentsHashes";
|
|
13
10
|
/**
|
|
14
11
|
* @category Core
|
|
15
12
|
*/
|
|
16
|
-
export * as
|
|
13
|
+
export * as Events from "./CoreEvents";
|
|
17
14
|
/**
|
|
15
|
+
* All assets defined in the engine.
|
|
16
|
+
*
|
|
17
|
+
* @privateRemarks
|
|
18
|
+
* We should filter out the assets that cannot be referenced in a component.
|
|
19
|
+
*
|
|
18
20
|
* @category Engine Schemas
|
|
19
21
|
*/
|
|
20
|
-
export * as Assets from "../_prebuild/
|
|
22
|
+
export * as Assets from "../_prebuild/engine_types/assets";
|
|
21
23
|
/**
|
|
22
24
|
* All the settings that can be applied to a scene.
|
|
23
25
|
*
|
|
24
26
|
* @category Engine Schemas
|
|
25
27
|
*/
|
|
26
|
-
export * as SceneSettings from "../_prebuild/types/sceneSettings";
|
|
27
28
|
/**
|
|
28
29
|
* All the components that can be attached to an entity.
|
|
29
30
|
*
|
|
30
31
|
* @category Engine Schemas
|
|
31
32
|
*/
|
|
32
|
-
export * as Components from "../_prebuild/
|
|
33
|
+
export * as Components from "../_prebuild/engine_types/components";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./DynamicLoader";
|
|
2
2
|
export type * from "./core";
|
|
@@ -1,24 +1,9 @@
|
|
|
1
|
+
import { NativeType } from "./utils";
|
|
1
2
|
/**
|
|
3
|
+
* RTID stands for RunTime ID.
|
|
4
|
+
* It is an identifier that is guaranteed to be unique for each entity in the scene.
|
|
5
|
+
* It is only valid for the lifetime of the session.
|
|
6
|
+
*
|
|
2
7
|
* @category Engine Types
|
|
3
8
|
*/
|
|
4
|
-
export type RTID = bigint
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* 4 for now until 64 bits is supported by backend
|
|
8
|
-
*/
|
|
9
|
-
export declare const RTID_BYTE_SIZE: 4;
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export declare function serialize_RTID({ data_view, offset, value, }: {
|
|
14
|
-
data_view: DataView;
|
|
15
|
-
offset: number;
|
|
16
|
-
value: RTID;
|
|
17
|
-
}): number;
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export declare function deserialize_RTID({ data_view, offset }: {
|
|
22
|
-
data_view: DataView;
|
|
23
|
-
offset: number;
|
|
24
|
-
}): RTID;
|
|
9
|
+
export type RTID = NativeType<bigint>;
|