@3dsource/angular-unreal-module 0.0.101-dev.0 → 0.0.101-dev.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.
package/README.md CHANGED
@@ -236,10 +236,10 @@ Inject `UnrealCallbackService` to listen for callback events from Unreal Engine
236
236
 
237
237
  There are two methods:
238
238
 
239
- | Method | Description |
240
- | ------------------------ | ------------------------------------------------------------------------------------------------------------------- |
241
- | `fromUnrealCallback` | Listens for callbacks matching a command or event key. Supports MetaBox commands and custom Unreal callback events. |
242
- | `observeCommandResponse` | Sends a command and waits for its matching response by `correlationId`. Includes timeout and error handling. |
239
+ | Method | Description |
240
+ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
241
+ | `fromUnrealCallback` | Listens for callbacks matching a command or event key. Supports MetaBox commands and custom Unreal callback events. Returns `Observable<UnrealCallbackDescriptor[K]>`. |
242
+ | `observeCommandResponse` | Sends a command and waits for its matching response by `correlationId`. Returns `Observable<MetaBoxCommandList[K]>`. Includes timeout and error handling. |
243
243
 
244
244
  **Custom Unreal callback events** (defined in `UnrealCallbackEventMap`):
245
245
 
@@ -4700,17 +4700,12 @@ class UnrealCallbackService {
4700
4700
  */
4701
4701
  observeCommandResponse(data, sender, timeOut = 60000, dispatchOnTimeout = true) {
4702
4702
  const correlationId = generateUuid();
4703
- const observable = this.actions$.pipe(ofType(unrealCommandCallback), map$1(({ json }) => {
4704
- // !!!IMPORTANT!!! ALL COMMANDS NEED TO CONTAIN COMMAND CALLBACKS
4705
- // Some callbacks do not have commandCallback wrapper,
4706
- // so first we check if it exists,
4707
- // then fall back to JSON itself
4708
- return 'commandCallback' in json
4709
- ? { json }
4710
- : { json: { commandCallback: json } };
4711
- }), filter(({ json }) => json.commandCallback.correlationId === correlationId), timeout(timeOut), catchError(() => dispatchOnTimeout
4712
- ? of({ json: { commandCallback: { correlationId: 'timeout' } } })
4713
- : of(null)), take(1), tapLog('Command Response Observer'), filter(Truthy));
4703
+ const observable = this.actions$.pipe(ofType(unrealCommandCallback), map$1(({ json }) => 'commandCallback' in json ? json.commandCallback : json), filter((json) => json.correlationId === correlationId), timeout(timeOut), catchError(() => dispatchOnTimeout
4704
+ ? of({ command: 'timeout', correlationId: 'timeout' })
4705
+ : of(null)), take(1), tapLog('Command Response Observer'), filter(Truthy), map$1((data) => ({
4706
+ command: data.command,
4707
+ payload: 'payload' in data ? data.payload : null,
4708
+ })));
4714
4709
  setTimeout(() => sender({ ...data, correlationId }), 0);
4715
4710
  return observable;
4716
4711
  }