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