@3dverse/livelink.core 0.3.0 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  import { RTID, UUID } from "../sources/types";
2
2
  import { EntityInterface } from "../sources/interfaces/EntityInterface";
3
- import { ConnectConfirmation, EditorEntity, EntityCreationOptions, EntityUpdatedEvent, UpdateEntitiesCommand } from "./messages/editor";
3
+ import { ConnectConfirmation, EditorEntity, EntityCreationOptions, EntityUpdatedEvent, UpdateComponentsCommand } from "./messages/editor";
4
4
  /**
5
5
  * This follows the Livelink protocol specifications for the broker messages.
6
6
  */
@@ -39,7 +39,7 @@ export declare class EditorMessageHandler extends EventTarget {
39
39
  /**
40
40
  *
41
41
  */
42
- updateComponents(data: UpdateEntitiesCommand): void;
42
+ updateComponents(data: UpdateComponentsCommand): void;
43
43
  /**
44
44
  *
45
45
  */
@@ -82,7 +82,7 @@ export declare class EditorMessageHandler extends EventTarget {
82
82
  on_entity_reparented(data: any): void;
83
83
  deleteEntities({ entity_uuids }: {
84
84
  entity_uuids: Array<UUID>;
85
- }): Promise<string[]> | undefined;
85
+ }): Promise<Array<UUID>>;
86
86
  on_entities_deleted(data: Array<UUID>): void;
87
87
  on_animation_sequence_instance_added(data: any): void;
88
88
  on_animation_sequence_instance_updated(data: any): void;
@@ -3,7 +3,7 @@
3
3
  * This file has been generated automatically from its AsyncAPI spec file.
4
4
  * See : https://gitlab.com/3dverse/platform/libs/js/asyncapi-server-generator
5
5
  */
6
- import { AssignClientToScriptMessage, AuthenticationResponse, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ResizeResponse, ScreenSpaceRayQuery, ScreenSpaceRayResult, SendSkeletonPoseMessage, SessionAuth, UpdateAnimationSequenceStateMessage, UpdateEntitiesFromJsonMessage, ViewportConfig } from "./messages/gateway";
6
+ import { AssignClientToScriptMessage, AuthenticationResponse, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ResizeResponse, ScreenSpaceRayQuery, ScreenSpaceRayResult, SkeletonPoseMessage, SessionAuth, UpdateAnimationSequenceStateMessage, UpdateEntitiesFromJsonMessage, ViewportConfig } from "./messages/gateway";
7
7
  import { UUID, Vec2ui16 } from "../sources/types";
8
8
  /**
9
9
  * Message handlers interface.
@@ -22,7 +22,7 @@ export declare class GatewayMessageHandler extends EventTarget {
22
22
  */
23
23
  protected _disconnect(): void;
24
24
  /***************************************************************************
25
- * AUTHENTICATION
25
+ * AUTHENTICATION (0)
26
26
  **************************************************************************/
27
27
  /**
28
28
  * Request
@@ -37,7 +37,7 @@ export declare class GatewayMessageHandler extends EventTarget {
37
37
  data_view: DataView;
38
38
  }): void;
39
39
  /***************************************************************************
40
- * HEARTBEAT
40
+ * HEARTBEAT (11)
41
41
  **************************************************************************/
42
42
  /**
43
43
  * Request
@@ -48,14 +48,12 @@ export declare class GatewayMessageHandler extends EventTarget {
48
48
  */
49
49
  _on_pulseHeartbeat_response(): void;
50
50
  /***************************************************************************
51
- * REGISTRATION
51
+ * REGISTRATION (1)
52
52
  **************************************************************************/
53
53
  /**
54
54
  * Request
55
55
  */
56
- configureClient({ client_config }: {
57
- client_config: ClientConfig;
58
- }): Promise<ClientConfigResponse>;
56
+ configureClient(client_config: ClientConfig): Promise<ClientConfigResponse>;
59
57
  /**
60
58
  * Reply
61
59
  */
@@ -63,7 +61,23 @@ export declare class GatewayMessageHandler extends EventTarget {
63
61
  data_view: DataView;
64
62
  }): void;
65
63
  /***************************************************************************
66
- * VIEWER CONTROL
64
+ * INPUTS (2)
65
+ **************************************************************************/
66
+ /**
67
+ * Send
68
+ */
69
+ sendInputState(input_state: InputState): void;
70
+ /***************************************************************************
71
+ * VIDEO STREAM (3)
72
+ **************************************************************************/
73
+ /**
74
+ * Receive
75
+ */
76
+ _onFrameReceived({ data_view }: {
77
+ data_view: DataView;
78
+ }): void;
79
+ /***************************************************************************
80
+ * VIEWER CONTROL (4)
67
81
  **************************************************************************/
68
82
  /**
69
83
  * Send
@@ -92,47 +106,16 @@ export declare class GatewayMessageHandler extends EventTarget {
92
106
  data_view: DataView;
93
107
  }): void;
94
108
  /***************************************************************************
95
- * INPUTS
96
- **************************************************************************/
97
- /**
98
- * Send
99
- */
100
- sendInputState({ input_state }: {
101
- input_state: InputState;
102
- }): void;
103
- /***************************************************************************
104
- * VIDEO STREAM
105
- **************************************************************************/
106
- /**
107
- * Receive
108
- */
109
- _onFrameReceived({ data_view }: {
110
- data_view: DataView;
111
- }): void;
112
- /***************************************************************************
113
- * SCRIPT EVENTS
114
- **************************************************************************/
115
- /**
116
- * Receive
117
- */
118
- _onScriptEventReceived({ data_view }: {
119
- data_view: DataView;
120
- }): void;
121
- /***************************************************************************
122
- * CLIENT REMOTE OPERATIONS
109
+ * CLIENT REMOTE OPERATIONS (5)
123
110
  **************************************************************************/
124
111
  /**
125
112
  * Request
126
113
  */
127
- castScreenSpaceRay({ screenSpaceRayQuery, }: {
128
- screenSpaceRayQuery: ScreenSpaceRayQuery;
129
- }): Promise<ScreenSpaceRayResult>;
114
+ castScreenSpaceRay(screenSpaceRayQuery: ScreenSpaceRayQuery): Promise<ScreenSpaceRayResult>;
130
115
  /**
131
116
  * Send
132
117
  */
133
- highlightEntities({ highlightEntitiesMessage }: {
134
- highlightEntitiesMessage: HighlightEntitiesMessage;
135
- }): void;
118
+ highlightEntities(highlightEntitiesMessage: HighlightEntitiesMessage): void;
136
119
  /**
137
120
  * Reply
138
121
  */
@@ -143,42 +126,39 @@ export declare class GatewayMessageHandler extends EventTarget {
143
126
  data_view: DataView;
144
127
  }): void;
145
128
  /***************************************************************************
146
- * EDITOR REMOTE OPERATIONS
129
+ * EDITOR REMOTE OPERATIONS (6)
147
130
  **************************************************************************/
148
131
  /**
149
132
  * Send
150
133
  */
151
- fireEvent({ fireEventMessage }: {
152
- fireEventMessage: FireEventMessage;
153
- }): void;
134
+ fireEvent(fireEventMessage: FireEventMessage): void;
154
135
  /**
155
136
  * Send
156
137
  */
157
- sendSkeletonPose({ sendSkeletonPoseMessage }: {
158
- sendSkeletonPoseMessage: SendSkeletonPoseMessage;
159
- }): void;
138
+ sendSkeletonPose(sendSkeletonPoseMessage: SkeletonPoseMessage): void;
160
139
  /**
161
140
  * Send
162
141
  */
163
- updateAnimationSequenceState({ updateAnimationSequenceStateMessage, }: {
164
- updateAnimationSequenceStateMessage: UpdateAnimationSequenceStateMessage;
165
- }): void;
142
+ updateAnimationSequenceState(updateAnimationSequenceStateMessage: UpdateAnimationSequenceStateMessage): void;
166
143
  /**
167
144
  * Send
168
145
  */
169
- assignClientToScript({ assignClientToScriptMessage, }: {
170
- assignClientToScriptMessage: AssignClientToScriptMessage;
171
- }): void;
146
+ assignClientToScript(assignClientToScriptMessage: AssignClientToScriptMessage): void;
172
147
  /**
173
148
  * Send
174
149
  */
175
- updateEntities({ updateEntitiesFromJsonMessage, }: {
176
- updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage;
177
- }): void;
150
+ updateEntitiesFromJson(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
178
151
  /**
179
152
  * Send
180
153
  */
181
- removeComponents({ removeComponentsCommand }: {
182
- removeComponentsCommand: RemoveComponentsCommand;
154
+ removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
155
+ /***************************************************************************
156
+ * SCRIPT EVENTS (14)
157
+ **************************************************************************/
158
+ /**
159
+ * Receive
160
+ */
161
+ _onScriptEventReceived({ data_view }: {
162
+ data_view: DataView;
183
163
  }): void;
184
164
  }
@@ -3,4 +3,4 @@ import type { ComponentType } from "../../types/components";
3
3
  /**
4
4
  *
5
5
  */
6
- export type UpdateEntitiesCommand = Record<UUID, Record<ComponentType, {}> | {}>;
6
+ export type UpdateComponentsCommand = Record<UUID, Record<ComponentType, {}>>;
@@ -2,19 +2,19 @@ import { RTID, Quat } from "../../../sources/types";
2
2
  /**
3
3
  *
4
4
  */
5
- export type SendSkeletonPoseMessage = {
5
+ export type SkeletonPoseMessage = {
6
6
  controller_rtid: RTID;
7
7
  pose: Map<number, Quat>;
8
8
  };
9
9
  /**
10
10
  *
11
11
  */
12
- export declare function compute_SendSkeletonPoseMessage_size(sendSkeletonPoseMessage: SendSkeletonPoseMessage): number;
12
+ export declare function compute_SkeletonPoseMessage_size(skeletonPoseMessage: SkeletonPoseMessage): number;
13
13
  /**
14
14
  *
15
15
  */
16
- export declare function serialize_SendSkeletonPoseMessage({ data_view, offset, sendSkeletonPoseMessage, }: {
16
+ export declare function serialize_SkeletonPoseMessage({ data_view, offset, skeletonPoseMessage, }: {
17
17
  data_view: DataView;
18
18
  offset?: number;
19
- sendSkeletonPoseMessage: SendSkeletonPoseMessage;
19
+ skeletonPoseMessage: SkeletonPoseMessage;
20
20
  }): number;
@@ -1,9 +1,9 @@
1
- import type { ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ScreenSpaceRayQuery, ScreenSpaceRayResult, UpdateEntitiesFromJsonMessage, ViewportConfig } from "../_prebuild/messages/gateway";
1
+ import type { AssignClientToScriptMessage, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, ScreenSpaceRayQuery, ScreenSpaceRayResult, SkeletonPoseMessage, UpdateAnimationSequenceStateMessage, UpdateEntitiesFromJsonMessage, ViewportConfig } from "../_prebuild/messages/gateway";
2
2
  import { ComponentSerializer } from "./ComponentSerializer";
3
- import { Quat, RTID, UUID, Vec2i } from "./types";
3
+ import { RTID, UUID, Vec2i } from "./types";
4
4
  import { EntityInterface } from "./interfaces/EntityInterface";
5
5
  import { SessionInterface } from "./interfaces/SessionInterface";
6
- import { EditorEntity, EntityCreationOptions, UpdateEntitiesCommand } from "../_prebuild/messages/editor";
6
+ import { EditorEntity, EntityCreationOptions, UpdateComponentsCommand } from "../_prebuild/messages/editor";
7
7
  /**
8
8
  * The LivelinkCore interface.
9
9
  *
@@ -15,23 +15,23 @@ import { EditorEntity, EntityCreationOptions, UpdateEntitiesCommand } from "../_
15
15
  * interface, allowing for interface evolution without breaking compatibility with existing
16
16
  * applications.
17
17
  */
18
- export declare class LivelinkCore extends EventTarget {
18
+ export declare class LivelinkCore {
19
19
  #private;
20
20
  /**
21
21
  * Connect to the session
22
22
  */
23
- _connect({ session, editor_url, }: {
23
+ connect({ session, editor_url, }: {
24
24
  session: SessionInterface;
25
25
  editor_url: string;
26
26
  }): Promise<ComponentSerializer>;
27
27
  /**
28
28
  * Closes the connections to the gateway and the editor.
29
29
  */
30
- _disconnect(): Promise<void>;
30
+ disconnect(): void;
31
31
  /**
32
32
  *
33
33
  */
34
- _addEventListener({ target, event_name, handler, }: {
34
+ addEventListener({ target, event_name, handler, }: {
35
35
  target: "gateway" | "editor";
36
36
  event_name: string;
37
37
  handler: EventListenerOrEventListenerObject;
@@ -39,129 +39,139 @@ export declare class LivelinkCore extends EventTarget {
39
39
  /**
40
40
  *
41
41
  */
42
- _removeEventListener({ target, event_name, handler, }: {
42
+ removeEventListener({ target, event_name, handler, }: {
43
43
  target: "gateway" | "editor";
44
44
  event_name: string;
45
45
  handler: EventListenerOrEventListenerObject;
46
46
  }): void;
47
+ /***************************************************************************
48
+ * REGISTRATION (1)
49
+ **************************************************************************/
47
50
  /**
48
51
  * Send the configuration requested by the client.
49
52
  */
50
53
  configureClient({ client_config }: {
51
54
  client_config: ClientConfig;
52
55
  }): Promise<ClientConfigResponse>;
56
+ /***************************************************************************
57
+ * INPUTS (2)
58
+ **************************************************************************/
53
59
  /**
54
60
  *
55
61
  */
56
- _resize({ size }: {
57
- size: Vec2i;
62
+ sendInputState({ input_state }: {
63
+ input_state: InputState;
58
64
  }): void;
65
+ /***************************************************************************
66
+ * VIEWER CONTROL (4)
67
+ **************************************************************************/
59
68
  /**
60
69
  *
61
70
  */
62
- _castScreenSpaceRay({ screenSpaceRayQuery, }: {
63
- screenSpaceRayQuery: ScreenSpaceRayQuery;
64
- }): Promise<ScreenSpaceRayResult>;
71
+ resize({ size }: {
72
+ size: Vec2i;
73
+ }): void;
65
74
  /**
66
75
  *
67
76
  */
68
- highlightEntities({ highlightEntitiesMessage }: {
69
- highlightEntitiesMessage: HighlightEntitiesMessage;
70
- }): void;
77
+ suspend(): void;
71
78
  /**
72
79
  *
73
80
  */
74
- fireEvent(fireEventMessage: FireEventMessage): void;
81
+ resume(): void;
75
82
  /**
76
83
  *
77
84
  */
78
- _sendSkeletonPose({ controller_rtid, pose }: {
79
- controller_rtid: RTID;
80
- pose: Map<number, Quat>;
85
+ setViewports({ viewports }: {
86
+ viewports: Array<ViewportConfig>;
81
87
  }): void;
88
+ /***************************************************************************
89
+ * CLIENT REMOTE OPERATIONS (5)
90
+ **************************************************************************/
82
91
  /**
83
92
  *
84
93
  */
85
- _spawnEntity({ entity, options, }: {
86
- entity: EntityInterface;
87
- options?: EntityCreationOptions;
88
- }): Promise<EditorEntity>;
94
+ castScreenSpaceRay({ screenSpaceRayQuery, }: {
95
+ screenSpaceRayQuery: ScreenSpaceRayQuery;
96
+ }): Promise<ScreenSpaceRayResult>;
89
97
  /**
90
98
  *
91
99
  */
92
- _deleteEntities({ entity_uuids }: {
93
- entity_uuids: Array<UUID>;
94
- }): Promise<void>;
100
+ highlightEntities({ highlightEntitiesMessage }: {
101
+ highlightEntitiesMessage: HighlightEntitiesMessage;
102
+ }): void;
103
+ /***************************************************************************
104
+ * EDITOR REMOTE OPERATIONS (6)
105
+ **************************************************************************/
95
106
  /**
96
- *
107
+ * 4
97
108
  */
98
- _findEntitiesByEUID({ entity_uuid }: {
99
- entity_uuid: UUID;
100
- }): Promise<Array<EditorEntity>>;
109
+ removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
101
110
  /**
102
- *
111
+ * 11
103
112
  */
104
- _resolveAncestors({ entity_rtid }: {
105
- entity_rtid: RTID;
106
- }): Promise<Array<EditorEntity>>;
113
+ fireEvent(fireEventMessage: FireEventMessage): void;
107
114
  /**
108
- *
115
+ * 15
109
116
  */
110
- _getChildren({ entity_rtid }: {
111
- entity_rtid: RTID;
112
- }): Promise<Array<EditorEntity>>;
117
+ updateEntitiesFromJson(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
113
118
  /**
114
- *
119
+ * 20
115
120
  */
116
- _sendInput({ input_state }: {
117
- input_state: InputState;
118
- }): void;
121
+ assignClientToScript(assignClientToScriptMessage: AssignClientToScriptMessage): void;
119
122
  /**
120
- *
123
+ * 23
121
124
  */
122
- _updateAnimationSequenceState(params: {
123
- linker_rtid: RTID;
124
- animation_sequence_id: UUID;
125
- state: 1 | 0;
126
- playback_speed: number;
127
- seek_offset?: number;
128
- }): void;
125
+ updateAnimationSequenceState(updateAnimationSequenceStateMessage: UpdateAnimationSequenceStateMessage): void;
129
126
  /**
130
- *
127
+ * 24
131
128
  */
132
- assignClientToScript({ client_uuid, script_uuid, entity_rtid, }: {
133
- client_uuid: UUID;
134
- script_uuid: UUID;
135
- entity_rtid: RTID;
136
- }): void;
129
+ sendSkeletonPose(skeletonPoseMessage: SkeletonPoseMessage): void;
130
+ /***************************************************************************
131
+ * EDITOR
132
+ **************************************************************************/
137
133
  /**
138
134
  *
139
135
  */
140
- _setViewports({ viewports }: {
141
- viewports: Array<ViewportConfig>;
142
- }): void;
136
+ spawnEntity({ entity, options, }: {
137
+ entity: EntityInterface;
138
+ options?: EntityCreationOptions;
139
+ }): Promise<EditorEntity>;
143
140
  /**
144
141
  *
145
142
  */
146
- resume(): void;
143
+ updateComponents(updateEntitiesCommand: UpdateComponentsCommand): void;
147
144
  /**
148
145
  *
149
146
  */
150
- suspend(): void;
147
+ deleteEntities({ entity_uuids }: {
148
+ entity_uuids: Array<UUID>;
149
+ }): Promise<void>;
151
150
  /**
152
151
  *
153
152
  */
154
- startSimulation(): void;
153
+ findEntitiesByEUID({ entity_uuid }: {
154
+ entity_uuid: UUID;
155
+ }): Promise<Array<EditorEntity>>;
155
156
  /**
156
157
  *
157
158
  */
158
- _updateEntities(updateEntitiesFromJsonMessage: UpdateEntitiesFromJsonMessage): void;
159
+ resolveAncestors({ entity_rtid }: {
160
+ entity_rtid: RTID;
161
+ }): Promise<Array<EditorEntity>>;
159
162
  /**
160
163
  *
161
164
  */
162
- _updateComponents(updateEntitiesCommand: UpdateEntitiesCommand): void;
165
+ getChildren({ entity_rtid }: {
166
+ entity_rtid: RTID;
167
+ }): Promise<Array<EditorEntity>>;
168
+ /***************************************************************************
169
+ * Utils
170
+ **************************************************************************/
163
171
  /**
164
172
  *
165
173
  */
166
- _removeComponents(removeComponentsCommand: RemoveComponentsCommand): void;
174
+ setSimulationState({ state }: {
175
+ state: "start_simulation" | "pause_simulation" | "stop_simulation";
176
+ }): void;
167
177
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dverse/livelink.core",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "3dverse Livelink Core types.",
5
5
  "main": "./dist/library.cjs",
6
6
  "module": "./dist/library.mjs",