@3dverse/livelink.core 0.7.4 → 0.7.6

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, UpdateComponentsCommand } from "./messages/editor";
3
+ import { ConnectConfirmation, EditorEntity, EntityCreationOptions, EntityUpdatedEvent, EntityVisibilityChangedEvent, UpdateComponentsCommand } from "./messages/editor";
4
4
  import { ComponentType } from "./types/components";
5
5
  /**
6
6
  * This follows the Livelink protocol specifications for the broker messages.
@@ -39,7 +39,7 @@ export declare class EditorMessageHandler extends EventTarget {
39
39
  entities: Array<EntityInterface>;
40
40
  options?: EntityCreationOptions;
41
41
  }): Promise<EditorEntity[]>;
42
- on_entities_created(data: Array<EditorEntity>): void;
42
+ onEntitiesCreated(data: Array<EditorEntity>): void;
43
43
  /**
44
44
  *
45
45
  */
@@ -97,6 +97,13 @@ export declare class EditorMessageHandler extends EventTarget {
97
97
  findEntitiesByNames({ entity_names }: {
98
98
  entity_names: Array<String>;
99
99
  }): Promise<Array<EditorEntity>>;
100
+ /**
101
+ *
102
+ */
103
+ setEntityVisibility({ entity_rtid, is_visible }: {
104
+ entity_rtid: RTID;
105
+ is_visible: boolean;
106
+ }): void;
100
107
  onFindEntitiesByNames(data: Record<string, EditorEntity>): void;
101
108
  /**
102
109
  *
@@ -107,32 +114,32 @@ export declare class EditorMessageHandler extends EventTarget {
107
114
  onClientColor(data: any): void;
108
115
  onSceneStatsUpdate(data: any): void;
109
116
  onServerError(data: any): void;
110
- on_create_entity(data: any): void;
111
- on_create_entities(data: any): void;
112
- on_restore_entities(data: any): void;
113
- on_spawn_entity(data: any): void;
114
- on_entity_reparented(data: any): void;
117
+ onCreateEntity(data: any): void;
118
+ onCreateEntities(data: any): void;
119
+ onRestoreEntities(data: any): void;
120
+ onSpawnEntity(data: any): void;
121
+ onEntityReparented(data: any): void;
115
122
  deleteEntities({ entity_uuids }: {
116
123
  entity_uuids: Array<UUID>;
117
124
  }): Promise<Array<UUID>>;
118
- on_entities_deleted(data: Array<UUID>): void;
119
- on_animation_sequence_instance_added(data: any): void;
120
- on_animation_sequence_instance_updated(data: any): void;
121
- on_animation_sequence_instance_removed(data: any): void;
122
- on_node_visibility_changed(data: any): void;
123
- on_action_error(data: any): void;
124
- on_attach_components(data: any): void;
125
- on_update_components(emitter_id: UUID | null, entitiesUpdatedEvent: Record<UUID, EntityUpdatedEvent>): void;
126
- on_detach_components(data: any): void;
127
- on_delete_entities(data: any): void;
128
- on_delete_entities_with_rtid(data: any): void;
129
- on_reparent_entity(data: any): void;
130
- on_entities_overridden(data: any): void;
131
- on_update_settings(data: any): void;
132
- on_select_entities(data: any): void;
133
- on_add_animation_sequence_instance(data: any): void;
134
- on_update_animation_sequence_instance(data: any): void;
135
- on_remove_animation_sequence_instance(data: any): void;
136
- on_set_node_visibility(data: any): void;
125
+ onEntitiesDeleted(data: Array<UUID>): void;
126
+ onAnimationSequenceInstanceAdded(data: any): void;
127
+ onAnimationSequenceInstanceUpdated(data: any): void;
128
+ onAnimationSequenceInstanceRemoved(data: any): void;
129
+ onEntityVisibilityChanged(data: EntityVisibilityChangedEvent): void;
130
+ onActionError(data: any): void;
131
+ onAttachComponents(data: any): void;
132
+ onUpdateComponents(emitter_id: UUID | null, entitiesUpdatedEvent: Record<UUID, EntityUpdatedEvent>): void;
133
+ onDetachComponents(data: any): void;
134
+ onDeleteEntities(data: any): void;
135
+ onDeleteEntitiesWithRtid(data: any): void;
136
+ onReparentEntity(data: any): void;
137
+ onEntitiesOverridden(data: any): void;
138
+ onUpdateSettings(data: any): void;
139
+ onSelectEntities(data: any): void;
140
+ onAddAnimationSequenceInstance(data: any): void;
141
+ onUpdateAnimationSequenceInstance(data: any): void;
142
+ onRemoveAnimationSequenceInstance(data: any): void;
143
+ onSetEntityVisibility(data: any): void;
137
144
  onUnhandledMessage(type: string, data: any): void;
138
145
  }
@@ -52,8 +52,9 @@ export declare class GatewayConnection {
52
52
  /**
53
53
  *
54
54
  */
55
- send({ data }: {
55
+ send({ data, is_heart_beat }: {
56
56
  data: ArrayBufferLike | string;
57
+ is_heart_beat?: boolean;
57
58
  }): void;
58
59
  /**
59
60
  *
@@ -4,7 +4,7 @@
4
4
  * See : https://gitlab.com/3dverse/platform/libs/js/asyncapi-server-generator
5
5
  */
6
6
  import { AssignClientToScriptMessage, AuthenticationResponse, ClientConfig, ClientConfigResponse, FireEventMessage, HighlightEntitiesMessage, InputState, RemoveComponentsCommand, RemoveFilterMessage, ResizeResponse, ScreenSpaceRayQuery, ScreenSpaceRayResult, SessionAuth, SetFilterMessage, SkeletonPoseMessage, ToggleFilterMessage, UpdateEntitiesFromBytesMessage, UpdateEntitiesFromJsonMessage, ViewportConfigs } from "./messages/gateway";
7
- import { UUID, Vec2ui16 } from "../sources/types";
7
+ import { UUID, Vec2ui16, GatewayDisconnectedReason } from "../sources/types";
8
8
  /**
9
9
  * Message handlers interface.
10
10
  * This follows the Livelink protocol specifications for the gateway messages.
@@ -24,7 +24,17 @@ export declare class GatewayMessageHandler extends EventTarget {
24
24
  /**
25
25
  *
26
26
  */
27
- _onDisconnected(): void;
27
+ _onConnected(): void;
28
+ /**
29
+ *
30
+ */
31
+ _onDisconnected({ reason }: {
32
+ reason: GatewayDisconnectedReason;
33
+ }): void;
34
+ /**
35
+ *
36
+ */
37
+ _onMessageSent(is_heart_beat?: boolean): void;
28
38
  /***************************************************************************
29
39
  * AUTHENTICATION (0)
30
40
  **************************************************************************/
@@ -0,0 +1,5 @@
1
+ import { RTID } from "../../../sources/types";
2
+ export type EntityVisibilityChangedEvent = {
3
+ entityRTID: RTID;
4
+ isVisible: boolean;
5
+ };
@@ -3,3 +3,4 @@ export * from "./EditorEntity";
3
3
  export * from "./EntityCreationOptions";
4
4
  export * from "./EntityUpdatedEvent";
5
5
  export * from "./UpdateComponentsCommand";
6
+ export * from "./EntityVisibilityChangedEvent";
@@ -91,6 +91,9 @@ export declare enum InputOperation {
91
91
  touch_pinch_end = 29,
92
92
  headset_move = 30
93
93
  }
94
+ /**
95
+ *
96
+ */
94
97
  export declare enum EditorRemoteOperation {
95
98
  update_config = 0,
96
99
  create_entity = 1,
@@ -1,4 +1,5 @@
1
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";
2
3
  import { Serializer } from "./Serializer";
3
4
  import { RTID, UUID, Vec2i } from "./types";
4
5
  import { EntityInterface } from "./interfaces/EntityInterface";
@@ -19,6 +20,10 @@ import { ComponentType } from "./core";
19
20
  */
20
21
  export declare class LivelinkCore {
21
22
  #private;
23
+ /**
24
+ * Get the gateway activity watcher.
25
+ */
26
+ get activity_watcher(): ActivityWatcher;
22
27
  /**
23
28
  * Connect to the session
24
29
  */
@@ -191,6 +196,13 @@ export declare class LivelinkCore {
191
196
  findEntitiesByNames({ entity_names }: {
192
197
  entity_names: Array<string>;
193
198
  }): Promise<Array<EditorEntity>>;
199
+ /**
200
+ * @deprecated
201
+ */
202
+ setEntityVisibility({ entity_rtid, is_visible }: {
203
+ entity_rtid: RTID;
204
+ is_visible: boolean;
205
+ }): Promise<void>;
194
206
  /**
195
207
  *
196
208
  */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Watch activity on the gateway.
3
+ */
4
+ export declare class ActivityWatcher extends EventTarget {
5
+ #private;
6
+ /**
7
+ * Start the timeouts.
8
+ */
9
+ start(): void;
10
+ /**
11
+ * Stop the timeouts if running.
12
+ */
13
+ stop(): void;
14
+ /**
15
+ * Reset the timeouts.
16
+ */
17
+ reset(): void;
18
+ }
@@ -1,5 +1,6 @@
1
1
  import { GatewayMessageHandler } from "../../_prebuild/GatewayMessageHandler";
2
2
  import { SessionInterface } from "../interfaces/SessionInterface";
3
+ import { ActivityWatcher } from "./ActivityWatcher";
3
4
  import { UUID } from "../types";
4
5
  /**
5
6
  * The gateway controller is the exposed interface of the Livelink gateway protocol.
@@ -9,6 +10,10 @@ import { UUID } from "../types";
9
10
  */
10
11
  export declare class GatewayController extends GatewayMessageHandler {
11
12
  #private;
13
+ /**
14
+ *
15
+ */
16
+ get activity_watcher(): ActivityWatcher;
12
17
  /**
13
18
  * Opens a connection to the gateway where the provided session is running.
14
19
  *
@@ -27,4 +32,20 @@ export declare class GatewayController extends GatewayMessageHandler {
27
32
  * Closes the connection to the gateway.
28
33
  */
29
34
  disconnect(): void;
35
+ /**
36
+ *
37
+ */
38
+ _onInactivityTimeout: () => void;
39
+ /**
40
+ *
41
+ */
42
+ _onConnected(): void;
43
+ /**
44
+ *
45
+ */
46
+ _onDisconnected(): void;
47
+ /**
48
+ *
49
+ */
50
+ _onMessageSent(is_heart_beat?: boolean): void;
30
51
  }
@@ -5,3 +5,5 @@ export declare const FTL_EDITOR_ROP_HEADER_SIZE: 25;
5
5
  export declare const LITTLE_ENDIAN: true;
6
6
  export declare const BIG_ENDIAN: false;
7
7
  export declare const HEARTBEAT_PERIOD_IN_MS: 2000;
8
+ export declare const INACTIVITY_WARNING_IN_SEC: 300;
9
+ export declare const INACTIVITY_TIMEOUT_IN_SEC: 360;
@@ -2,3 +2,7 @@ export * from "./math";
2
2
  export * from "./nativeTypes";
3
3
  export * from "./RTID";
4
4
  export * from "./UUID";
5
+ /**
6
+ * The reason why the gateway has disconnected.
7
+ */
8
+ export type GatewayDisconnectedReason = "closed" | "forcibly_closed" | "inactivity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dverse/livelink.core",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "3dverse Livelink Core types.",
5
5
  "main": "./dist/library.cjs",
6
6
  "module": "./dist/library.mjs",