@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.
- 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 -58
- package/dist/_prebuild/GatewayMessageHandler.d.ts +1 -194
- package/dist/_prebuild/engine_types/ComponentsHashes.d.ts +5 -0
- package/dist/_prebuild/engine_types/ComponentsRecord.d.ts +207 -0
- package/dist/_prebuild/engine_types/SceneSettingsRecord.d.ts +50 -0
- package/dist/_prebuild/engine_types/assets.d.ts +96 -0
- package/dist/_prebuild/{types → engine_types}/components.d.ts +221 -159
- package/dist/_prebuild/{types/settings.d.ts → engine_types/sceneSettings.d.ts} +85 -70
- package/dist/_prebuild/messages/editor/ConnectConfirmation.d.ts +1 -70
- package/dist/_prebuild/messages/editor/EditorEntity.d.ts +0 -25
- package/dist/_prebuild/messages/editor/EntityUpdatedEvent.d.ts +1 -7
- package/dist/_prebuild/messages/editor/EntityVisibilityChangedEvent.d.ts +1 -5
- 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 +4 -111
- package/dist/_prebuild/messages/gateway/events/AssetLoadingEvent.d.ts +1 -0
- package/dist/_prebuild/messages/gateway/{FrameData.d.ts → events/FrameDataEvent.d.ts} +1 -17
- 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 +63 -0
- 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 +133 -128
- package/dist/sources/SessionInterface.d.ts +20 -0
- 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 -53
- package/dist/sources/controllers/GatewayEvents.d.ts +54 -0
- package/dist/sources/core.d.ts +29 -8
- 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 -20
- package/dist/sources/types/UUID.d.ts +7 -17
- package/dist/sources/types/dataObjects.d.ts +52 -0
- package/dist/sources/types/index.d.ts +3 -5
- package/dist/sources/types/math.d.ts +8 -91
- package/dist/sources/types/nativeTypes.d.ts +25 -86
- package/dist/sources/types/utils.d.ts +19 -0
- package/package.json +13 -3
- package/dist/_prebuild/enums.d.ts +0 -3
- 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 -21
- 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/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 -18
- package/dist/_prebuild/messages/gateway/ResizeResponse.d.ts +0 -14
- package/dist/_prebuild/messages/gateway/ScreenSpaceRayQuery.d.ts +0 -29
- 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 -19
- package/dist/_prebuild/messages/gateway/ToggleFilterMessage.d.ts +0 -19
- 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/assets.d.ts +0 -23
- package/dist/sources/LivelinkCoreModule.d.ts +0 -39
- package/dist/sources/RequestHandler.d.ts +0 -47
- package/dist/sources/Serializer.d.ts +0 -34
- package/dist/sources/controllers/ActivityWatcher.d.ts +0 -42
- package/dist/sources/interfaces/ClientInterface.d.ts +0 -7
- package/dist/sources/interfaces/EntityInterface.d.ts +0 -9
- package/dist/sources/interfaces/SessionInterface.d.ts +0 -19
- package/dist/sources/interfaces/index.d.ts +0 -3
- /package/dist/sources/{types/constants.d.ts → constants.d.ts} +0 -0
|
@@ -1,123 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
5
|
-
authentication = 0,
|
|
6
|
-
registration = 1,
|
|
7
|
-
video_stream = 2,
|
|
8
|
-
inputs = 3,
|
|
9
|
-
viewer_control = 4,
|
|
10
|
-
client_remote_operations = 5,
|
|
11
|
-
editor_remote_operations = 6,
|
|
12
|
-
DEPRECATED__camera_sharing = 7,
|
|
13
|
-
broadcast_clients = 8,
|
|
14
|
-
broadcast_video_stream = 9,
|
|
15
|
-
DEPRECATED__spatial_anchor = 10,
|
|
16
|
-
heartbeat = 11,
|
|
17
|
-
video_stream_header = 12,
|
|
18
|
-
audio_stream = 13,
|
|
19
|
-
broadcast_script_events = 14,
|
|
20
|
-
asset_loading_events = 15,
|
|
21
|
-
gpu_memory_profiler = 16
|
|
22
|
-
}
|
|
4
|
+
export type CodecType = "h264" | "h264rgb" | "h265";
|
|
23
5
|
/**
|
|
24
6
|
*
|
|
25
7
|
*/
|
|
26
|
-
export
|
|
27
|
-
asset_loading_status = 0,
|
|
28
|
-
DEPRECATED__update_ar_cameras = 1,
|
|
29
|
-
create_controller = 2,
|
|
30
|
-
cast_screen_space_ray = 3,
|
|
31
|
-
select_entities = 4,
|
|
32
|
-
set_controllers_state = 5,
|
|
33
|
-
delete_controller = 6,
|
|
34
|
-
update_action_map = 7,
|
|
35
|
-
update_selection_color = 8,
|
|
36
|
-
update_camera_controller_settings = 9,
|
|
37
|
-
physics_raycast = 10
|
|
38
|
-
}
|
|
8
|
+
export type EncodingProfile = "base" | "main" | "high";
|
|
39
9
|
/**
|
|
40
10
|
*
|
|
41
11
|
*/
|
|
42
|
-
export
|
|
43
|
-
resize = 0,
|
|
44
|
-
DEPRECATED_update_action_map = 1,
|
|
45
|
-
suspend = 2,
|
|
46
|
-
resume = 3,
|
|
47
|
-
encoder_params = 4,
|
|
48
|
-
set_viewports = 5
|
|
49
|
-
}
|
|
12
|
+
export type HighlightMode = "None" | "HighlightAndKeepOldSelection" | "HighlightAndDiscardOldSelection";
|
|
50
13
|
/**
|
|
51
14
|
*
|
|
52
15
|
*/
|
|
53
|
-
export
|
|
54
|
-
h264 = 0,
|
|
55
|
-
h264rgb = 1,
|
|
56
|
-
h265 = 2
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
*/
|
|
61
|
-
export declare enum InputOperation {
|
|
62
|
-
reset = 0,
|
|
63
|
-
lbutton_down = 1,
|
|
64
|
-
mbutton_down = 2,
|
|
65
|
-
rbutton_down = 3,
|
|
66
|
-
lbutton_up = 4,
|
|
67
|
-
mbutton_up = 5,
|
|
68
|
-
rbutton_up = 6,
|
|
69
|
-
mouse_move = 7,
|
|
70
|
-
on_key_down = 8,
|
|
71
|
-
on_key_up = 9,
|
|
72
|
-
resize = 10,
|
|
73
|
-
disconnect = 11,
|
|
74
|
-
touch_start = 12,
|
|
75
|
-
touch_end = 13,
|
|
76
|
-
touch_move = 14,
|
|
77
|
-
touch_pinch_start = 15,
|
|
78
|
-
touch_pinch_move = 16,
|
|
79
|
-
window_resized = 17,
|
|
80
|
-
send_camera = 18,
|
|
81
|
-
input_resolution = 19,
|
|
82
|
-
cam_matrix = 20,
|
|
83
|
-
projection_matrix = 21,
|
|
84
|
-
wheel = 22,
|
|
85
|
-
hololens_tap = 23,
|
|
86
|
-
scene_info = 24,
|
|
87
|
-
scene_uuid = 25,
|
|
88
|
-
gamepad_axis = 26,
|
|
89
|
-
gamepad_buttons = 27,
|
|
90
|
-
mouse_move_delta = 28,
|
|
91
|
-
touch_pinch_end = 29,
|
|
92
|
-
headset_move = 30
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
export declare enum EditorRemoteOperation {
|
|
98
|
-
update_config = 0,
|
|
99
|
-
create_entity = 1,
|
|
100
|
-
reparent_entity = 2,
|
|
101
|
-
update_entities_from_bytes = 3,
|
|
102
|
-
remove_components = 4,
|
|
103
|
-
delete_entities = 5,
|
|
104
|
-
set_visibility = 6,
|
|
105
|
-
update_material = 7,
|
|
106
|
-
update_volume_material = 8,
|
|
107
|
-
DEPRECATED__update_data_object = 9,
|
|
108
|
-
reload_asset = 10,
|
|
109
|
-
fire_event = 11,
|
|
110
|
-
update_script_data_object = 12,
|
|
111
|
-
DEPRECATED__update_render_graph_data_object = 13,
|
|
112
|
-
reload_shaders = 14,
|
|
113
|
-
update_entities_from_json = 15,
|
|
114
|
-
set_filter = 16,
|
|
115
|
-
remove_filter = 17,
|
|
116
|
-
toggle_filter = 18,
|
|
117
|
-
DEPRECATED__update_animation_controller_data_object = 19,
|
|
118
|
-
assign_client_uuid_to_script = 20,
|
|
119
|
-
DEPRECATED__update_animation_sequence_instance = 21,
|
|
120
|
-
DEPRECATED__remove_animation_sequence_instance = 22,
|
|
121
|
-
DEPRECATED__update_animation_sequence_state = 23,
|
|
122
|
-
send_skeleton_pose = 24
|
|
123
|
-
}
|
|
16
|
+
export type InputOperation = "reset" | "lbutton_down" | "mbutton_down" | "rbutton_down" | "lbutton_up" | "mbutton_up" | "rbutton_up" | "mouse_move" | "on_key_down" | "on_key_up" | "resize" | "disconnect" | "touch_start" | "touch_end" | "touch_move" | "touch_pinch_start" | "touch_pinch_move" | "window_resized" | "send_camera" | "input_resolution" | "cam_matrix" | "projection_matrix" | "wheel" | "hololens_tap" | "scene_info" | "scene_uuid" | "gamepad_axis" | "gamepad_buttons" | "mouse_move_delta" | "touch_pinch_end" | "headset_move";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { Mat4, RTID, UUID, Vec3 } from "
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
export type FrameData = {
|
|
6
|
-
encoded_frame_size: number;
|
|
7
|
-
meta_data_size: number;
|
|
8
|
-
encoded_frame: DataView;
|
|
9
|
-
meta_data: RawFrameMetaData;
|
|
10
|
-
};
|
|
1
|
+
import { Mat4, RTID, UUID, Vec3 } from "../../../../sources/types";
|
|
11
2
|
/**
|
|
12
3
|
*
|
|
13
4
|
*/
|
|
@@ -33,10 +24,3 @@ export type ViewportMetaData = {
|
|
|
33
24
|
camera_rtid: RTID;
|
|
34
25
|
ws_from_ls: Mat4;
|
|
35
26
|
};
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
export declare function deserialize_FrameData({ data_view, offset }: {
|
|
40
|
-
data_view: DataView;
|
|
41
|
-
offset?: number;
|
|
42
|
-
}): FrameData;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export * from "./
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export * from "./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./UpdateEntitiesFromBytesMessage";
|
|
18
|
-
export * from "./UpdateEntitiesFromJsonMessage";
|
|
19
|
-
export * from "./ViewportConfig";
|
|
20
|
-
export * from "./SetFilterMessage";
|
|
21
|
-
export * from "./ToggleFilterMessage";
|
|
22
|
-
export * from "./RemoveFilterMessage";
|
|
1
|
+
/**
|
|
2
|
+
* @category Core
|
|
3
|
+
*/
|
|
4
|
+
export * as Commands from "./commands";
|
|
5
|
+
/**
|
|
6
|
+
* @category Core
|
|
7
|
+
*/
|
|
8
|
+
export * as Queries from "./queries";
|
|
9
|
+
/**
|
|
10
|
+
* @category Core
|
|
11
|
+
*/
|
|
12
|
+
export * as Events from "./events";
|
|
13
|
+
/**
|
|
14
|
+
* @category Core
|
|
15
|
+
*/
|
|
16
|
+
export * as Enums from "./enums";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RTID, Vec2, Vec3 } from "../../../../sources/types";
|
|
2
|
+
import { HighlightMode } from "../enums";
|
|
3
|
+
/**
|
|
4
|
+
* @category Payloads
|
|
5
|
+
*/
|
|
6
|
+
export type ScreenSpaceRayQuery = {
|
|
7
|
+
camera_rtid: RTID;
|
|
8
|
+
pos: Vec2;
|
|
9
|
+
mode: HighlightMode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @category Responses
|
|
13
|
+
*/
|
|
14
|
+
export type ScreenSpaceRayResponse = {
|
|
15
|
+
entity_rtid: RTID;
|
|
16
|
+
position: Vec3;
|
|
17
|
+
normal: Vec3;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ScreenSpaceRayQuery";
|
package/dist/library.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var l=(r,e)=>{for(var o in e)n(r,o,{get:e[o],enumerable:!0})},L=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c(e))!p.call(r,i)&&i!==o&&n(r,i,{get:()=>e[i],enumerable:!(t=a(e,i))||t.enumerable});return r};var m=r=>L(n({},"__esModule",{value:!0}),r);var u={};l(u,{DynamicLoader:()=>s});module.exports=m(u);var C=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,s=class r{static#e=null;static get Core(){if(!r.#e)throw new Error("Livelink core not initialized");return r.#e}static async load(e=""){if(r.#e)return;let o=await r.#r(e),{LivelinkCore:t}=await o();r.#e=t,console.info("Livelink core initialized")}static async#r(e=""){if(!C)return new Function("return import('https://cdn.3dverse.com/livelink/core/"+(e?e+"/":"")+"core.mjs');");let t=await(await fetch("https://cdn.3dverse.com/livelink/core/")).text();return new Function("return import('data:text/javascript;base64,"+btoa(t)+"')")}constructor(){}};
|
|
2
2
|
//# sourceMappingURL=library.cjs.map
|
package/dist/library.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../sources/library.ts", "../sources/
|
|
4
|
-
"sourcesContent": ["export * from \"./
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
6
|
-
"names": ["library_exports", "__export", "
|
|
3
|
+
"sources": ["../sources/library.ts", "../sources/DynamicLoader.ts"],
|
|
4
|
+
"sourcesContent": ["export * from \"./DynamicLoader\";\nexport type * from \"./core\";\n", "import type { LivelinkCore } from \"./LivelinkCore\";\n\n/**\n *\n */\nconst isNode = typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\n/**\n *\n */\ndeclare const LIVELINK_CORE_URL: string;\n\n/**\n *\n */\ntype LivelinkCoreType = typeof LivelinkCore;\n\n/**\n *\n */\ntype CoreImporter = () => Promise<{ LivelinkCore: LivelinkCoreType }>;\n\n/**\n * Dynamically loads the Livelink core library.\n *\n * {@link DynamicLoader.load} must be called before accessing {@link DynamicLoader.Core}.\n *\n * ### Usage\n * ```typescript\n * await DynamicLoader.load(\"1.0\");\n * const core = new DynamicLoader.Core();\n * ```\n *\n * @category Core\n */\nexport class DynamicLoader {\n /**\n *\n */\n static #core: LivelinkCoreType | null = null;\n\n /**\n * Returns the core type.\n */\n static get Core(): LivelinkCoreType {\n if (!DynamicLoader.#core) {\n throw new Error(\"Livelink core not initialized\");\n }\n return DynamicLoader.#core;\n }\n\n /**\n * Dynamically loads the Livelink core library.\n *\n * Must be called before accessing {@link DynamicLoader.Core}.\n *\n * @param version - The version of the core library to load.\n */\n static async load(version: \"\" | \"1.0\" | \"2.0\" = \"\"): Promise<void> {\n if (DynamicLoader.#core) {\n return;\n }\n\n const dynamicImport = await DynamicLoader.#createImporter(version);\n const { LivelinkCore } = await dynamicImport();\n\n DynamicLoader.#core = LivelinkCore;\n\n //TODO: log the commit SHA\n console.info(\"Livelink core initialized\");\n }\n\n /**\n *\n */\n static async #createImporter(version: string = \"\"): Promise<CoreImporter> {\n if (!isNode) {\n return new Function(\n \"return import('\" + LIVELINK_CORE_URL + (version ? version + \"/\" : \"\") + \"core.mjs');\",\n ) as CoreImporter;\n }\n\n const response = await fetch(LIVELINK_CORE_URL);\n const moduleData = await response.text();\n return new Function(\"return import('data:text/javascript;base64,\" + btoa(moduleData) + \"')\") as CoreImporter;\n }\n\n /**\n *\n */\n private constructor() {}\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GCKA,IAAMI,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,KA8BzFC,EAAN,MAAMC,CAAc,CAIvB,MAAOC,GAAiC,KAKxC,WAAW,MAAyB,CAChC,GAAI,CAACD,EAAcC,GACf,MAAM,IAAI,MAAM,+BAA+B,EAEnD,OAAOD,EAAcC,EACzB,CASA,aAAa,KAAKC,EAA8B,GAAmB,CAC/D,GAAIF,EAAcC,GACd,OAGJ,IAAME,EAAgB,MAAMH,EAAcI,GAAgBF,CAAO,EAC3D,CAAE,aAAAG,CAAa,EAAI,MAAMF,EAAc,EAE7CH,EAAcC,GAAQI,EAGtB,QAAQ,KAAK,2BAA2B,CAC5C,CAKA,YAAaD,GAAgBF,EAAkB,GAA2B,CACtE,GAAI,CAACJ,EACD,OAAO,IAAI,SACP,yDAAyCI,EAAUA,EAAU,IAAM,IAAM,aAC7E,EAIJ,IAAMI,EAAa,MADF,MAAM,MAAM,wCAAiB,GACZ,KAAK,EACvC,OAAO,IAAI,SAAS,8CAAgD,KAAKA,CAAU,EAAI,IAAI,CAC/F,CAKQ,aAAc,CAAC,CAC3B",
|
|
6
|
+
"names": ["library_exports", "__export", "DynamicLoader", "__toCommonJS", "isNode", "DynamicLoader", "_DynamicLoader", "#core", "version", "dynamicImport", "#createImporter", "LivelinkCore", "moduleData"]
|
|
7
7
|
}
|
package/dist/library.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=class e{static#e=null;static get Core(){if(!e.#e)throw new Error("Livelink core not initialized");return e.#e}static async load(r=""){if(e.#e)return;let t=await e.#r(r),{LivelinkCore:o}=await t();e.#e=o,console.info("Livelink core initialized")}static async#r(r=""){if(!n)return new Function("return import('https://cdn.3dverse.com/livelink/core/"+(r?r+"/":"")+"core.mjs');");let o=await(await fetch("https://cdn.3dverse.com/livelink/core/")).text();return new Function("return import('data:text/javascript;base64,"+btoa(o)+"')")}constructor(){}};export{i as DynamicLoader};
|
|
2
2
|
//# sourceMappingURL=library.mjs.map
|
package/dist/library.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../sources/
|
|
4
|
-
"sourcesContent": ["import type { LivelinkCore
|
|
5
|
-
"mappings": "AAKA,IAAMA,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,
|
|
6
|
-
"names": ["isNode", "
|
|
3
|
+
"sources": ["../sources/DynamicLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import type { LivelinkCore } from \"./LivelinkCore\";\n\n/**\n *\n */\nconst isNode = typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\n/**\n *\n */\ndeclare const LIVELINK_CORE_URL: string;\n\n/**\n *\n */\ntype LivelinkCoreType = typeof LivelinkCore;\n\n/**\n *\n */\ntype CoreImporter = () => Promise<{ LivelinkCore: LivelinkCoreType }>;\n\n/**\n * Dynamically loads the Livelink core library.\n *\n * {@link DynamicLoader.load} must be called before accessing {@link DynamicLoader.Core}.\n *\n * ### Usage\n * ```typescript\n * await DynamicLoader.load(\"1.0\");\n * const core = new DynamicLoader.Core();\n * ```\n *\n * @category Core\n */\nexport class DynamicLoader {\n /**\n *\n */\n static #core: LivelinkCoreType | null = null;\n\n /**\n * Returns the core type.\n */\n static get Core(): LivelinkCoreType {\n if (!DynamicLoader.#core) {\n throw new Error(\"Livelink core not initialized\");\n }\n return DynamicLoader.#core;\n }\n\n /**\n * Dynamically loads the Livelink core library.\n *\n * Must be called before accessing {@link DynamicLoader.Core}.\n *\n * @param version - The version of the core library to load.\n */\n static async load(version: \"\" | \"1.0\" | \"2.0\" = \"\"): Promise<void> {\n if (DynamicLoader.#core) {\n return;\n }\n\n const dynamicImport = await DynamicLoader.#createImporter(version);\n const { LivelinkCore } = await dynamicImport();\n\n DynamicLoader.#core = LivelinkCore;\n\n //TODO: log the commit SHA\n console.info(\"Livelink core initialized\");\n }\n\n /**\n *\n */\n static async #createImporter(version: string = \"\"): Promise<CoreImporter> {\n if (!isNode) {\n return new Function(\n \"return import('\" + LIVELINK_CORE_URL + (version ? version + \"/\" : \"\") + \"core.mjs');\",\n ) as CoreImporter;\n }\n\n const response = await fetch(LIVELINK_CORE_URL);\n const moduleData = await response.text();\n return new Function(\"return import('data:text/javascript;base64,\" + btoa(moduleData) + \"')\") as CoreImporter;\n }\n\n /**\n *\n */\n private constructor() {}\n}\n"],
|
|
5
|
+
"mappings": "AAKA,IAAMA,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,KA8BzFC,EAAN,MAAMC,CAAc,CAIvB,MAAOC,GAAiC,KAKxC,WAAW,MAAyB,CAChC,GAAI,CAACD,EAAcC,GACf,MAAM,IAAI,MAAM,+BAA+B,EAEnD,OAAOD,EAAcC,EACzB,CASA,aAAa,KAAKC,EAA8B,GAAmB,CAC/D,GAAIF,EAAcC,GACd,OAGJ,IAAME,EAAgB,MAAMH,EAAcI,GAAgBF,CAAO,EAC3D,CAAE,aAAAG,CAAa,EAAI,MAAMF,EAAc,EAE7CH,EAAcC,GAAQI,EAGtB,QAAQ,KAAK,2BAA2B,CAC5C,CAKA,YAAaD,GAAgBF,EAAkB,GAA2B,CACtE,GAAI,CAACJ,EACD,OAAO,IAAI,SACP,yDAAyCI,EAAUA,EAAU,IAAM,IAAM,aAC7E,EAIJ,IAAMI,EAAa,MADF,MAAM,MAAM,wCAAiB,GACZ,KAAK,EACvC,OAAO,IAAI,SAAS,8CAAgD,KAAKA,CAAU,EAAI,IAAI,CAC/F,CAKQ,aAAc,CAAC,CAC3B",
|
|
6
|
+
"names": ["isNode", "DynamicLoader", "_DynamicLoader", "#core", "version", "dynamicImport", "#createImporter", "LivelinkCore", "moduleData"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Watch activity on the gateway.
|
|
3
|
+
*
|
|
4
|
+
* Activity is defined as any message sent to the gateway that is **not** a heartbeat.
|
|
5
|
+
*
|
|
6
|
+
* Internally the activity watcher uses two timeouts:
|
|
7
|
+
* - Inactivity warning: the time in seconds after which the `on-warning` event is dispatched.
|
|
8
|
+
* - Inactivity timeout: the time in seconds after which the `on-timeout` event is dispatched.
|
|
9
|
+
*
|
|
10
|
+
* The `on-timeout` event automatically triggers the disconnection from the gateway.
|
|
11
|
+
*
|
|
12
|
+
* The application **should** listen to these events and act accordingly.
|
|
13
|
+
*
|
|
14
|
+
* Usually, when the `on-warning` event is dispatched, the application should display a warning to the user.
|
|
15
|
+
* It is up to the application to decide what can be qualified as activity.
|
|
16
|
+
* For example, the application could consider the user moving the mouse as activity. In this case, the application
|
|
17
|
+
* would listen to the "mousemove" event and reset the activity watcher whenever the mouse is moved calling
|
|
18
|
+
* the {@linkcode ActivityWatcher.reset} method.
|
|
19
|
+
*
|
|
20
|
+
* When the `on-timeout` event is dispatched, there is no way to recover the connection. The application should
|
|
21
|
+
* display an error message to the user.
|
|
22
|
+
*
|
|
23
|
+
* @category Core
|
|
24
|
+
*/
|
|
25
|
+
export declare class ActivityWatcher {
|
|
26
|
+
#private;
|
|
27
|
+
/**
|
|
28
|
+
* Inactivity warning in seconds.
|
|
29
|
+
* Amount of time in seconds after which the `on-inactivity-warning` event is dispatched.
|
|
30
|
+
*/
|
|
31
|
+
get inactivity_warning(): number;
|
|
32
|
+
/**
|
|
33
|
+
* Inactivity timeout in seconds.
|
|
34
|
+
* Amount of time in seconds after which the `on-timeout` event is dispatched.
|
|
35
|
+
*/
|
|
36
|
+
get inactivity_timeout(): number;
|
|
37
|
+
/**
|
|
38
|
+
* True if the timeouts have been started.
|
|
39
|
+
*/
|
|
40
|
+
get is_running(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* True if activity watcher has timed out
|
|
43
|
+
*/
|
|
44
|
+
get has_timed_out(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Set the timeouts.
|
|
47
|
+
*
|
|
48
|
+
* Setting these values will reset the activity watcher if it is running.
|
|
49
|
+
*
|
|
50
|
+
* @param params
|
|
51
|
+
* @param params.warn_after_seconds - Amount of time in seconds after which the `on-warning` event is dispatched.
|
|
52
|
+
* Must be less than `timeout_after_seconds`.
|
|
53
|
+
* @param params.timeout_after_seconds - Amount of time in seconds after which the `on-timeout` event is dispatched.
|
|
54
|
+
*/
|
|
55
|
+
setTimeouts({ warn_after_seconds, timeout_after_seconds, }: {
|
|
56
|
+
warn_after_seconds: number;
|
|
57
|
+
timeout_after_seconds: number;
|
|
58
|
+
}): void;
|
|
59
|
+
/**
|
|
60
|
+
* Reset the timeouts.
|
|
61
|
+
*/
|
|
62
|
+
reset: () => void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from "./controllers/GatewayEvents";
|
|
2
|
+
export * from "./controllers/EditorEvents";
|
|
3
|
+
import { AssetLoadingStatusEvent, FrameReceivedEvent, ScriptEventTriggeredEvent } from "./controllers/GatewayEvents";
|
|
4
|
+
import { EntitiesUpdatedEvent, EntityVisibilityChangedEvent } from "./controllers/EditorEvents";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare class DisconnectedEvent extends Event {
|
|
9
|
+
readonly reason: DisconnectionReason;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare class ActivityWarningEvent extends Event {
|
|
15
|
+
/**
|
|
16
|
+
* The number of seconds remaining before the client is disconnected.
|
|
17
|
+
*/
|
|
18
|
+
readonly seconds_remaining: number;
|
|
19
|
+
/**
|
|
20
|
+
* Resets the timer for the activity warning.
|
|
21
|
+
*/
|
|
22
|
+
readonly resetTimer: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export type CoreEvents = {
|
|
28
|
+
"on-activity-warning": ActivityWarningEvent;
|
|
29
|
+
"on-disconnected": DisconnectedEvent;
|
|
30
|
+
"on-frame-received": FrameReceivedEvent;
|
|
31
|
+
"on-script-event-received": ScriptEventTriggeredEvent;
|
|
32
|
+
"on-asset-loading-status-received": AssetLoadingStatusEvent;
|
|
33
|
+
"on-entities-updated": EntitiesUpdatedEvent;
|
|
34
|
+
"on-entity-visibility-changed": EntityVisibilityChangedEvent;
|
|
35
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { LivelinkCore } from "./LivelinkCore";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
type LivelinkCoreType = typeof LivelinkCore;
|
|
6
|
+
/**
|
|
7
|
+
* Dynamically loads the Livelink core library.
|
|
8
|
+
*
|
|
9
|
+
* {@link DynamicLoader.load} must be called before accessing {@link DynamicLoader.Core}.
|
|
10
|
+
*
|
|
11
|
+
* ### Usage
|
|
12
|
+
* ```typescript
|
|
13
|
+
* await DynamicLoader.load("1.0");
|
|
14
|
+
* const core = new DynamicLoader.Core();
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @category Core
|
|
18
|
+
*/
|
|
19
|
+
export declare class DynamicLoader {
|
|
20
|
+
#private;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the core type.
|
|
23
|
+
*/
|
|
24
|
+
static get Core(): LivelinkCoreType;
|
|
25
|
+
/**
|
|
26
|
+
* Dynamically loads the Livelink core library.
|
|
27
|
+
*
|
|
28
|
+
* Must be called before accessing {@link DynamicLoader.Core}.
|
|
29
|
+
*
|
|
30
|
+
* @param version - The version of the core library to load.
|
|
31
|
+
*/
|
|
32
|
+
static load(version?: "" | "1.0" | "2.0"): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
private constructor();
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ComponentName, EntityCore } from "../_prebuild/engine_types/ComponentsRecord";
|
|
2
|
+
import { RTID, UUID } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* @inline
|
|
5
|
+
*/
|
|
6
|
+
type FindEntityQueryByRTID = {
|
|
7
|
+
/**
|
|
8
|
+
* The RTID of the entity to find.
|
|
9
|
+
*/
|
|
10
|
+
rtid: RTID;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @inline
|
|
14
|
+
*/
|
|
15
|
+
type FindEntityQueryByLinkage = {
|
|
16
|
+
/**
|
|
17
|
+
* The EUID of the entity to find.
|
|
18
|
+
*/
|
|
19
|
+
euid: UUID;
|
|
20
|
+
/**
|
|
21
|
+
* The exact linkage of the entity to find starting from the topmost linker.
|
|
22
|
+
*/
|
|
23
|
+
linkage: Array<UUID>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @inline
|
|
27
|
+
*/
|
|
28
|
+
type FindEntityQueryByEUID = {
|
|
29
|
+
/**
|
|
30
|
+
* The EUID of the entity to find.
|
|
31
|
+
* No linkage is provided in this case.
|
|
32
|
+
* All entities with the same EUID are returned.
|
|
33
|
+
*/
|
|
34
|
+
euid: UUID;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @inline
|
|
38
|
+
*/
|
|
39
|
+
type FindEntityQueryByNames = {
|
|
40
|
+
/**
|
|
41
|
+
* The names of the entities to find.
|
|
42
|
+
*/
|
|
43
|
+
names: Array<string>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @inline
|
|
47
|
+
*/
|
|
48
|
+
type FindEntityQueryWithComponents = {
|
|
49
|
+
/**
|
|
50
|
+
* The components that the entities must have.
|
|
51
|
+
*/
|
|
52
|
+
mandatory_components: Array<ComponentName>;
|
|
53
|
+
/**
|
|
54
|
+
* The components that the entities must not have.
|
|
55
|
+
*/
|
|
56
|
+
forbidden_components?: Array<ComponentName>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Find entity query to find entities based on different criteria.
|
|
60
|
+
*
|
|
61
|
+
* @category Entity Utils
|
|
62
|
+
*/
|
|
63
|
+
export type FindEntityQuery = FindEntityQueryByRTID | FindEntityQueryByLinkage | FindEntityQueryByEUID | FindEntityQueryByNames | FindEntityQueryWithComponents;
|
|
64
|
+
/**
|
|
65
|
+
* Options for the find entity query.
|
|
66
|
+
*
|
|
67
|
+
* @inline
|
|
68
|
+
*
|
|
69
|
+
* @category Entity Utils
|
|
70
|
+
*/
|
|
71
|
+
export type FindEntityOptions = {
|
|
72
|
+
/**
|
|
73
|
+
* Whether to include the ancestors of the found entities.
|
|
74
|
+
* This will incur an additional query to fetch the ancestors for each entity found.
|
|
75
|
+
*/
|
|
76
|
+
include_ancestors?: boolean;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The response to a find entity query.
|
|
80
|
+
*
|
|
81
|
+
* @category Entity Utils
|
|
82
|
+
*/
|
|
83
|
+
export type EntityResponse = {
|
|
84
|
+
/**
|
|
85
|
+
* The components of the entity.
|
|
86
|
+
*/
|
|
87
|
+
components: EntityCore;
|
|
88
|
+
/**
|
|
89
|
+
* The ancestors of the entity.
|
|
90
|
+
*
|
|
91
|
+
* If undefined, the ancestors were not requested, and it should not be assumed that the entity has no ancestors.
|
|
92
|
+
*
|
|
93
|
+
* It defined and empty, the entity has no ancestors.
|
|
94
|
+
*
|
|
95
|
+
* Otherwise, it contains the ancestors of the entity starting with the topmost ancestor (the one that has no
|
|
96
|
+
* parent) going all the way down to the direct parent of the entity.
|
|
97
|
+
*/
|
|
98
|
+
ancestors?: Array<EntityResponse>;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* @category Entity Utils
|
|
102
|
+
*/
|
|
103
|
+
export type UpdateEntityCommand = {
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
entity_components: EntityCore;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
dirty_components: Array<ComponentName>;
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
deleted_components: Array<ComponentName>;
|
|
116
|
+
};
|
|
117
|
+
export {};
|