@3dverse/livelink.core 0.8.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) 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 -64
  5. package/dist/_prebuild/GatewayMessageHandler.d.ts +1 -197
  6. package/dist/_prebuild/engine_types/ComponentsHashes.d.ts +5 -0
  7. package/dist/_prebuild/{types → engine_types}/ComponentsRecord.d.ts +65 -44
  8. package/dist/_prebuild/{types → engine_types}/assets.d.ts +69 -0
  9. package/dist/_prebuild/{types → engine_types}/components.d.ts +164 -164
  10. package/dist/_prebuild/messages/editor/ConnectConfirmation.d.ts +1 -71
  11. package/dist/_prebuild/messages/editor/EditorEntity.d.ts +1 -75
  12. package/dist/_prebuild/messages/editor/EntityUpdatedEvent.d.ts +1 -7
  13. package/dist/_prebuild/messages/editor/EntityVisibilityChangedEvent.d.ts +1 -8
  14. package/dist/_prebuild/messages/editor/UpdateComponentsCommand.d.ts +1 -6
  15. package/dist/_prebuild/messages/editor/index.d.ts +0 -1
  16. package/dist/_prebuild/messages/gateway/commands/AssignClientToScriptCommand.d.ts +9 -0
  17. package/dist/_prebuild/messages/gateway/commands/AuthenticationCommand.d.ts +1 -0
  18. package/dist/_prebuild/messages/gateway/{ClientConfig.d.ts → commands/ConfigureClientCommand.d.ts} +11 -13
  19. package/dist/_prebuild/messages/gateway/commands/FireEventCommand.d.ts +11 -0
  20. package/dist/_prebuild/messages/gateway/commands/HighlightEntitiesCommand.d.ts +8 -0
  21. package/dist/_prebuild/messages/gateway/commands/InputStateCommand.d.ts +8 -0
  22. package/dist/_prebuild/messages/gateway/commands/RemoveComponentsCommand.d.ts +1 -0
  23. package/dist/_prebuild/messages/gateway/commands/RemoveFilterCommand.d.ts +7 -0
  24. package/dist/_prebuild/messages/gateway/commands/ResizeCommand.d.ts +13 -0
  25. package/dist/_prebuild/messages/gateway/commands/SendSkeletonPoseCommand.d.ts +25 -0
  26. package/dist/_prebuild/messages/gateway/commands/SetFilterCommand.d.ts +8 -0
  27. package/dist/_prebuild/messages/gateway/commands/ToggleFilterCommand.d.ts +8 -0
  28. package/dist/_prebuild/messages/gateway/commands/UpdateEntitiesFromBytesCommand.d.ts +1 -0
  29. package/dist/_prebuild/messages/gateway/commands/UpdateEntitiesFromJsonCommand.d.ts +1 -0
  30. package/dist/_prebuild/messages/gateway/commands/ViewportConfigCommand.d.ts +16 -0
  31. package/dist/_prebuild/messages/gateway/commands/index.d.ts +15 -0
  32. package/dist/_prebuild/messages/gateway/enums.d.ts +8 -115
  33. package/dist/_prebuild/messages/gateway/events/AssetLoadingEvent.d.ts +1 -0
  34. package/dist/_prebuild/messages/gateway/events/FrameDataEvent.d.ts +26 -0
  35. package/dist/_prebuild/messages/gateway/events/ScriptEvent.d.ts +10 -0
  36. package/dist/_prebuild/messages/gateway/events/index.d.ts +3 -0
  37. package/dist/_prebuild/messages/gateway/index.d.ts +16 -22
  38. package/dist/_prebuild/messages/gateway/queries/ScreenSpaceRayQuery.d.ts +18 -0
  39. package/dist/_prebuild/messages/gateway/queries/index.d.ts +1 -0
  40. package/dist/_prebuild/messages/index.d.ts +2 -0
  41. package/dist/library.cjs +1 -1
  42. package/dist/library.cjs.map +4 -4
  43. package/dist/library.mjs +1 -1
  44. package/dist/library.mjs.map +4 -4
  45. package/dist/sources/ActivityWatcher.d.ts +40 -21
  46. package/dist/sources/CoreEvents.d.ts +35 -0
  47. package/dist/sources/DynamicLoader.d.ts +38 -0
  48. package/dist/sources/EntityUtils.d.ts +117 -0
  49. package/dist/sources/LivelinkCore.d.ts +131 -127
  50. package/dist/sources/{interfaces/SessionInterface.d.ts → SessionInterface.d.ts} +2 -6
  51. package/dist/sources/TypedEventTarget.d.ts +14 -0
  52. package/dist/sources/controllers/EditorController.d.ts +1 -21
  53. package/dist/sources/controllers/EditorEvents.d.ts +27 -0
  54. package/dist/sources/controllers/GatewayController.d.ts +1 -60
  55. package/dist/sources/controllers/GatewayEvents.d.ts +54 -0
  56. package/dist/sources/core.d.ts +12 -11
  57. package/dist/sources/internal/RequestHandler.d.ts +1 -0
  58. package/dist/sources/internal/Serializer.d.ts +1 -0
  59. package/dist/sources/library.d.ts +1 -1
  60. package/dist/sources/types/RTID.d.ts +6 -21
  61. package/dist/sources/types/UUID.d.ts +11 -21
  62. package/dist/sources/types/dataObjects.d.ts +1 -1
  63. package/dist/sources/types/index.d.ts +1 -0
  64. package/dist/sources/types/math.d.ts +1 -105
  65. package/dist/sources/types/nativeTypes.d.ts +0 -132
  66. package/dist/sources/types/utils.d.ts +19 -0
  67. package/package.json +6 -4
  68. package/dist/_prebuild/enums.d.ts +0 -6
  69. package/dist/_prebuild/messages/editor/EntityCreationCoreOptions.d.ts +0 -6
  70. package/dist/_prebuild/messages/gateway/AssetLoadingEvent.d.ts +0 -14
  71. package/dist/_prebuild/messages/gateway/AssignClientToScriptMessage.d.ts +0 -22
  72. package/dist/_prebuild/messages/gateway/AuthenticationResponse.d.ts +0 -31
  73. package/dist/_prebuild/messages/gateway/ClientConfigResponse.d.ts +0 -16
  74. package/dist/_prebuild/messages/gateway/FireEventMessage.d.ts +0 -23
  75. package/dist/_prebuild/messages/gateway/FrameData.d.ts +0 -42
  76. package/dist/_prebuild/messages/gateway/HighlightEntitiesMessage.d.ts +0 -22
  77. package/dist/_prebuild/messages/gateway/InputState.d.ts +0 -22
  78. package/dist/_prebuild/messages/gateway/RemoveComponentsCommand.d.ts +0 -23
  79. package/dist/_prebuild/messages/gateway/RemoveFilterMessage.d.ts +0 -19
  80. package/dist/_prebuild/messages/gateway/ResizeResponse.d.ts +0 -14
  81. package/dist/_prebuild/messages/gateway/ScreenSpaceRayQuery.d.ts +0 -30
  82. package/dist/_prebuild/messages/gateway/ScreenSpaceRayResult.d.ts +0 -16
  83. package/dist/_prebuild/messages/gateway/ScriptEvent.d.ts +0 -17
  84. package/dist/_prebuild/messages/gateway/SendSkeletonPoseMessage.d.ts +0 -28
  85. package/dist/_prebuild/messages/gateway/SessionAuth.d.ts +0 -8
  86. package/dist/_prebuild/messages/gateway/SetFilterMessage.d.ts +0 -20
  87. package/dist/_prebuild/messages/gateway/ToggleFilterMessage.d.ts +0 -20
  88. package/dist/_prebuild/messages/gateway/UpdateEntitiesFromBytesMessage.d.ts +0 -25
  89. package/dist/_prebuild/messages/gateway/UpdateEntitiesFromJsonMessage.d.ts +0 -23
  90. package/dist/_prebuild/messages/gateway/ViewportConfig.d.ts +0 -30
  91. package/dist/_prebuild/types/ComponentsHashes.d.ts +0 -53
  92. package/dist/sources/LivelinkCoreModule.d.ts +0 -39
  93. package/dist/sources/RequestHandler.d.ts +0 -49
  94. package/dist/sources/Serializer.d.ts +0 -34
  95. package/dist/sources/interfaces/ClientInterface.d.ts +0 -12
  96. package/dist/sources/interfaces/EntityInterface.d.ts +0 -20
  97. package/dist/sources/interfaces/index.d.ts +0 -3
  98. /package/dist/_prebuild/{types → engine_types}/SceneSettingsRecord.d.ts +0 -0
  99. /package/dist/_prebuild/{types → engine_types}/sceneSettings.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../sources/library.ts", "../sources/LivelinkCoreModule.ts"],
4
- "sourcesContent": ["export * from \"./LivelinkCoreModule\";\nexport type * from \"./core\";\n", "import type { LivelinkCore, CoreEnums } from \"./core\";\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 CoreEnumsType = typeof CoreEnums;\n\n/**\n *\n */\ntype CoreImporter = () => Promise<{\n LivelinkCore: LivelinkCoreType;\n CoreEnums: CoreEnumsType;\n}>;\n\n/**\n *\n */\nexport class LivelinkCoreModule {\n /**\n *\n */\n static #core: LivelinkCoreType | null = null;\n\n /**\n *\n */\n static #enums: CoreEnumsType | null = null;\n\n /**\n *\n */\n static async init() {\n if (LivelinkCoreModule.#core) {\n return;\n }\n\n const dynamicImport = await LivelinkCoreModule.createImporter();\n const { LivelinkCore, CoreEnums } = await dynamicImport();\n\n LivelinkCoreModule.#core = LivelinkCore;\n LivelinkCoreModule.#enums = CoreEnums;\n\n console.info(\"Livelink core initialized\");\n }\n\n /**\n *\n */\n static async createImporter(): Promise<CoreImporter> {\n if (!isNode) {\n return new Function(\"return import('\" + LIVELINK_CORE_URL + \"');\") 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 static get Core(): LivelinkCoreType {\n if (!LivelinkCoreModule.#core) {\n throw new Error(\"Livelink core not initialized\");\n }\n return LivelinkCoreModule.#core;\n }\n\n /**\n *\n */\n static get Enums(): CoreEnumsType {\n if (!LivelinkCoreModule.#enums) {\n throw new Error(\"Livelink core not initialized\");\n }\n return LivelinkCoreModule.#enums;\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GCKA,IAAMI,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,KA4BzFC,EAAN,MAAMC,CAAmB,CAI5B,MAAOC,GAAiC,KAKxC,MAAOC,GAA+B,KAKtC,aAAa,MAAO,CAChB,GAAIF,EAAmBC,GACnB,OAGJ,IAAME,EAAgB,MAAMH,EAAmB,eAAe,EACxD,CAAE,aAAAI,EAAc,UAAAC,CAAU,EAAI,MAAMF,EAAc,EAExDH,EAAmBC,GAAQG,EAC3BJ,EAAmBE,GAASG,EAE5B,QAAQ,KAAK,2BAA2B,CAC5C,CAKA,aAAa,gBAAwC,CACjD,GAAI,CAACP,EACD,OAAO,IAAI,SAAS,8EAA6C,EAIrE,IAAMQ,EAAa,MADF,MAAM,MAAM,4DAAiB,GACZ,KAAK,EACvC,OAAO,IAAI,SAAS,8CAAgD,KAAKA,CAAU,EAAI,IAAI,CAC/F,CAKA,WAAW,MAAyB,CAChC,GAAI,CAACN,EAAmBC,GACpB,MAAM,IAAI,MAAM,+BAA+B,EAEnD,OAAOD,EAAmBC,EAC9B,CAKA,WAAW,OAAuB,CAC9B,GAAI,CAACD,EAAmBE,GACpB,MAAM,IAAI,MAAM,+BAA+B,EAEnD,OAAOF,EAAmBE,EAC9B,CACJ",
6
- "names": ["library_exports", "__export", "LivelinkCoreModule", "__toCommonJS", "isNode", "LivelinkCoreModule", "_LivelinkCoreModule", "#core", "#enums", "dynamicImport", "LivelinkCore", "CoreEnums", "moduleData"]
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 */\ndeclare const LIVELINK_CORE_VERSION: string;\n\n/**\n *\n */\ndeclare const LIVELINK_CORE_COMMIT_SHA: 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();\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(target: \"prod\" | \"dev\" | \"debug\" = \"prod\"): Promise<void> {\n console.log({ LIVELINK_CORE_URL, LIVELINK_CORE_VERSION, LIVELINK_CORE_COMMIT_SHA });\n if (DynamicLoader.#core) {\n return;\n }\n\n const dynamicImport = await DynamicLoader.#createImporter(target);\n const { LivelinkCore } = await dynamicImport();\n\n DynamicLoader.#core = LivelinkCore;\n\n console.info(`LiveLink core ${LIVELINK_CORE_VERSION} [${target}] [#${LIVELINK_CORE_COMMIT_SHA}] initialized`);\n }\n\n /**\n *\n */\n static async #createImporter(target: string): Promise<CoreImporter> {\n const moduleURL = LIVELINK_CORE_URL + \"/\" + (target !== \"prod\" ? `core.${target}.mjs` : \"core.mjs\");\n\n if (!isNode) {\n return new Function(\"return import('\" + moduleURL + \"')\") as CoreImporter;\n }\n\n const response = await fetch(moduleURL);\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,KAwCzFC,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,EAAmC,OAAuB,CAExE,GADA,QAAQ,IAAI,CAAE,8DAAmB,4BAAuB,mCAAyB,CAAC,EAC9EF,EAAcC,GACd,OAGJ,IAAME,EAAgB,MAAMH,EAAcI,GAAgBF,CAAM,EAC1D,CAAE,aAAAG,CAAa,EAAI,MAAMF,EAAc,EAE7CH,EAAcC,GAAQI,EAEtB,QAAQ,KAAK,sBAA2CH,CAAM,2BAA8C,CAChH,CAKA,YAAaE,GAAgBF,EAAuC,CAChE,IAAMI,EAAY,8CAA2BJ,IAAW,OAAS,QAAQA,CAAM,OAAS,YAExF,GAAI,CAACJ,EACD,OAAO,IAAI,SAAS,kBAAoBQ,EAAY,IAAI,EAI5D,IAAMC,EAAa,MADF,MAAM,MAAMD,CAAS,GACJ,KAAK,EACvC,OAAO,IAAI,SAAS,8CAAgD,KAAKC,CAAU,EAAI,IAAI,CAC/F,CAKQ,aAAc,CAAC,CAC3B",
6
+ "names": ["library_exports", "__export", "DynamicLoader", "__toCommonJS", "isNode", "DynamicLoader", "_DynamicLoader", "#core", "target", "dynamicImport", "#createImporter", "LivelinkCore", "moduleURL", "moduleData"]
7
7
  }
package/dist/library.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var i=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,t=class e{static#e=null;static#r=null;static async init(){if(e.#e)return;let o=await e.createImporter(),{LivelinkCore:r,CoreEnums:n}=await o();e.#e=r,e.#r=n,console.info("Livelink core initialized")}static async createImporter(){if(!i)return new Function("return import('https://storage.googleapis.com/livelink-prod/core/core.mjs');");let r=await(await fetch("https://storage.googleapis.com/livelink-prod/core/core.mjs")).text();return new Function("return import('data:text/javascript;base64,"+btoa(r)+"')")}static get Core(){if(!e.#e)throw new Error("Livelink core not initialized");return e.#e}static get Enums(){if(!e.#r)throw new Error("Livelink core not initialized");return e.#r}};export{t as LivelinkCoreModule};
1
+ var s=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(o="prod"){if(console.log({LIVELINK_CORE_URL:"https://cdn.3dverse.com/livelink/core/1.0",LIVELINK_CORE_VERSION:"1.0",LIVELINK_CORE_COMMIT_SHA:"f7c0a762"}),e.#e)return;let r=await e.#o(o),{LivelinkCore:t}=await r();e.#e=t,console.info(`LiveLink core 1.0 [${o}] [#f7c0a762] initialized`)}static async#o(o){let r="https://cdn.3dverse.com/livelink/core/1.0/"+(o!=="prod"?`core.${o}.mjs`:"core.mjs");if(!s)return new Function("return import('"+r+"')");let n=await(await fetch(r)).text();return new Function("return import('data:text/javascript;base64,"+btoa(n)+"')")}constructor(){}};export{i as DynamicLoader};
2
2
  //# sourceMappingURL=library.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../sources/LivelinkCoreModule.ts"],
4
- "sourcesContent": ["import type { LivelinkCore, CoreEnums } from \"./core\";\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 CoreEnumsType = typeof CoreEnums;\n\n/**\n *\n */\ntype CoreImporter = () => Promise<{\n LivelinkCore: LivelinkCoreType;\n CoreEnums: CoreEnumsType;\n}>;\n\n/**\n *\n */\nexport class LivelinkCoreModule {\n /**\n *\n */\n static #core: LivelinkCoreType | null = null;\n\n /**\n *\n */\n static #enums: CoreEnumsType | null = null;\n\n /**\n *\n */\n static async init() {\n if (LivelinkCoreModule.#core) {\n return;\n }\n\n const dynamicImport = await LivelinkCoreModule.createImporter();\n const { LivelinkCore, CoreEnums } = await dynamicImport();\n\n LivelinkCoreModule.#core = LivelinkCore;\n LivelinkCoreModule.#enums = CoreEnums;\n\n console.info(\"Livelink core initialized\");\n }\n\n /**\n *\n */\n static async createImporter(): Promise<CoreImporter> {\n if (!isNode) {\n return new Function(\"return import('\" + LIVELINK_CORE_URL + \"');\") 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 static get Core(): LivelinkCoreType {\n if (!LivelinkCoreModule.#core) {\n throw new Error(\"Livelink core not initialized\");\n }\n return LivelinkCoreModule.#core;\n }\n\n /**\n *\n */\n static get Enums(): CoreEnumsType {\n if (!LivelinkCoreModule.#enums) {\n throw new Error(\"Livelink core not initialized\");\n }\n return LivelinkCoreModule.#enums;\n }\n}\n"],
5
- "mappings": "AAKA,IAAMA,EAAS,OAAO,QAAY,KAAe,QAAQ,UAAY,MAAQ,QAAQ,SAAS,MAAQ,KA4BzFC,EAAN,MAAMC,CAAmB,CAI5B,MAAOC,GAAiC,KAKxC,MAAOC,GAA+B,KAKtC,aAAa,MAAO,CAChB,GAAIF,EAAmBC,GACnB,OAGJ,IAAME,EAAgB,MAAMH,EAAmB,eAAe,EACxD,CAAE,aAAAI,EAAc,UAAAC,CAAU,EAAI,MAAMF,EAAc,EAExDH,EAAmBC,GAAQG,EAC3BJ,EAAmBE,GAASG,EAE5B,QAAQ,KAAK,2BAA2B,CAC5C,CAKA,aAAa,gBAAwC,CACjD,GAAI,CAACP,EACD,OAAO,IAAI,SAAS,8EAA6C,EAIrE,IAAMQ,EAAa,MADF,MAAM,MAAM,4DAAiB,GACZ,KAAK,EACvC,OAAO,IAAI,SAAS,8CAAgD,KAAKA,CAAU,EAAI,IAAI,CAC/F,CAKA,WAAW,MAAyB,CAChC,GAAI,CAACN,EAAmBC,GACpB,MAAM,IAAI,MAAM,+BAA+B,EAEnD,OAAOD,EAAmBC,EAC9B,CAKA,WAAW,OAAuB,CAC9B,GAAI,CAACD,EAAmBE,GACpB,MAAM,IAAI,MAAM,+BAA+B,EAEnD,OAAOF,EAAmBE,EAC9B,CACJ",
6
- "names": ["isNode", "LivelinkCoreModule", "_LivelinkCoreModule", "#core", "#enums", "dynamicImport", "LivelinkCore", "CoreEnums", "moduleData"]
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 */\ndeclare const LIVELINK_CORE_VERSION: string;\n\n/**\n *\n */\ndeclare const LIVELINK_CORE_COMMIT_SHA: 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();\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(target: \"prod\" | \"dev\" | \"debug\" = \"prod\"): Promise<void> {\n console.log({ LIVELINK_CORE_URL, LIVELINK_CORE_VERSION, LIVELINK_CORE_COMMIT_SHA });\n if (DynamicLoader.#core) {\n return;\n }\n\n const dynamicImport = await DynamicLoader.#createImporter(target);\n const { LivelinkCore } = await dynamicImport();\n\n DynamicLoader.#core = LivelinkCore;\n\n console.info(`LiveLink core ${LIVELINK_CORE_VERSION} [${target}] [#${LIVELINK_CORE_COMMIT_SHA}] initialized`);\n }\n\n /**\n *\n */\n static async #createImporter(target: string): Promise<CoreImporter> {\n const moduleURL = LIVELINK_CORE_URL + \"/\" + (target !== \"prod\" ? `core.${target}.mjs` : \"core.mjs\");\n\n if (!isNode) {\n return new Function(\"return import('\" + moduleURL + \"')\") as CoreImporter;\n }\n\n const response = await fetch(moduleURL);\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,KAwCzFC,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,EAAmC,OAAuB,CAExE,GADA,QAAQ,IAAI,CAAE,8DAAmB,4BAAuB,mCAAyB,CAAC,EAC9EF,EAAcC,GACd,OAGJ,IAAME,EAAgB,MAAMH,EAAcI,GAAgBF,CAAM,EAC1D,CAAE,aAAAG,CAAa,EAAI,MAAMF,EAAc,EAE7CH,EAAcC,GAAQI,EAEtB,QAAQ,KAAK,sBAA2CH,CAAM,2BAA8C,CAChH,CAKA,YAAaE,GAAgBF,EAAuC,CAChE,IAAMI,EAAY,8CAA2BJ,IAAW,OAAS,QAAQA,CAAM,OAAS,YAExF,GAAI,CAACJ,EACD,OAAO,IAAI,SAAS,kBAAoBQ,EAAY,IAAI,EAI5D,IAAMC,EAAa,MADF,MAAM,MAAMD,CAAS,GACJ,KAAK,EACvC,OAAO,IAAI,SAAS,8CAAgD,KAAKC,CAAU,EAAI,IAAI,CAC/F,CAKQ,aAAc,CAAC,CAC3B",
6
+ "names": ["isNode", "DynamicLoader", "_DynamicLoader", "#core", "target", "dynamicImport", "#createImporter", "LivelinkCore", "moduleURL", "moduleData"]
7
7
  }
@@ -1,44 +1,63 @@
1
1
  /**
2
2
  * Watch activity on the gateway.
3
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
+ *
4
23
  * @category Core
5
24
  */
6
- export declare class ActivityWatcher extends EventTarget {
25
+ export declare class ActivityWatcher {
7
26
  #private;
8
- /**
9
- * True if activity watcher has timedout
10
- */
11
- get has_timed_out(): boolean;
12
- /**
13
- * Inactivity timeout in seconds.
14
- */
15
- get inactivity_timeout(): number;
16
- /**
17
- * Inactivity timeout in seconds.
18
- */
19
- set inactivity_timeout(seconds: number);
20
27
  /**
21
28
  * Inactivity warning in seconds.
29
+ * Amount of time in seconds after which the `on-inactivity-warning` event is dispatched.
22
30
  */
23
31
  get inactivity_warning(): number;
24
32
  /**
25
- * Inactivity warning in seconds.
33
+ * Inactivity timeout in seconds.
34
+ * Amount of time in seconds after which the `on-timeout` event is dispatched.
26
35
  */
27
- set inactivity_warning(seconds: number);
36
+ get inactivity_timeout(): number;
28
37
  /**
29
- *
38
+ * True if the timeouts have been started.
30
39
  */
31
40
  get is_running(): boolean;
32
41
  /**
33
- * Start the timeouts.
42
+ * True if activity watcher has timed out
34
43
  */
35
- start(): void;
44
+ get has_timed_out(): boolean;
36
45
  /**
37
- * Stop the timeouts if running.
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.
38
54
  */
39
- stop(): void;
55
+ setTimeouts({ warn_after_seconds, timeout_after_seconds, }: {
56
+ warn_after_seconds: number;
57
+ timeout_after_seconds: number;
58
+ }): void;
40
59
  /**
41
60
  * Reset the timeouts.
42
61
  */
43
- reset(): void;
62
+ reset: () => void;
44
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 InactivityWarningEvent 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-inactivity-warning": InactivityWarningEvent;
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();
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(target?: "prod" | "dev" | "debug"): 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 {};