@babylonjs/node-particle-editor 9.3.0 → 9.3.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.
|
@@ -2792,7 +2792,6 @@ export interface IDisplayManager {
|
|
|
2792
2792
|
|
|
2793
2793
|
}
|
|
2794
2794
|
declare module "@babylonjs/node-particle-editor/modularTool/modularTool" {
|
|
2795
|
-
import { IDisposable } from "@babylonjs/core/index";
|
|
2796
2795
|
import { IExtensionFeed } from "@babylonjs/node-particle-editor/modularTool/extensibility/extensionFeed";
|
|
2797
2796
|
import { WeaklyTypedServiceDefinition, ServiceContainer } from "@babylonjs/node-particle-editor/modularTool/modularity/serviceContainer";
|
|
2798
2797
|
import { ShellServiceOptions } from "@babylonjs/node-particle-editor/modularTool/services/shellService";
|
|
@@ -2833,7 +2832,65 @@ export type ModularToolOptions = {
|
|
|
2833
2832
|
* @param options The options for the tool.
|
|
2834
2833
|
* @returns A token that can be used to dispose of the tool.
|
|
2835
2834
|
*/
|
|
2836
|
-
export function MakeModularTool(options: ModularToolOptions):
|
|
2835
|
+
export function MakeModularTool(options: ModularToolOptions): {
|
|
2836
|
+
dispose: () => Promise<void>;
|
|
2837
|
+
};
|
|
2838
|
+
|
|
2839
|
+
}
|
|
2840
|
+
declare module "@babylonjs/node-particle-editor/modularTool/modularBridge" {
|
|
2841
|
+
import { IDisposable } from "@babylonjs/core/index";
|
|
2842
|
+
import { WeaklyTypedServiceDefinition, ServiceContainer } from "@babylonjs/node-particle-editor/modularTool/modularity/serviceContainer";
|
|
2843
|
+
/**
|
|
2844
|
+
* Options for creating a modular bridge container.
|
|
2845
|
+
* @experimental
|
|
2846
|
+
* @internal
|
|
2847
|
+
*/
|
|
2848
|
+
export type ModularBridgeOptions = {
|
|
2849
|
+
/**
|
|
2850
|
+
* WebSocket port for the bridge's browser port. Defaults to 4400.
|
|
2851
|
+
*/
|
|
2852
|
+
port?: number;
|
|
2853
|
+
/**
|
|
2854
|
+
* Session display name reported to the bridge. Defaults to `document.title`.
|
|
2855
|
+
*/
|
|
2856
|
+
name?: string;
|
|
2857
|
+
/**
|
|
2858
|
+
* Whether the bridge should automatically start trying to connect.
|
|
2859
|
+
* Defaults to false.
|
|
2860
|
+
*/
|
|
2861
|
+
autoStart?: boolean;
|
|
2862
|
+
/**
|
|
2863
|
+
* Additional service definitions to register with the bridge container.
|
|
2864
|
+
*/
|
|
2865
|
+
serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
|
|
2866
|
+
};
|
|
2867
|
+
/**
|
|
2868
|
+
* A token returned by {@link MakeModularBridge} that owns the headless
|
|
2869
|
+
* {@link ServiceContainer}. Dispose it to tear down the bridge and all services.
|
|
2870
|
+
* @experimental
|
|
2871
|
+
* @internal
|
|
2872
|
+
*/
|
|
2873
|
+
export type ModularBridgeToken = IDisposable & {
|
|
2874
|
+
/**
|
|
2875
|
+
* The headless ServiceContainer that hosts the bridge.
|
|
2876
|
+
*/
|
|
2877
|
+
readonly serviceContainer: ServiceContainer;
|
|
2878
|
+
/**
|
|
2879
|
+
* Whether this token has been disposed.
|
|
2880
|
+
*/
|
|
2881
|
+
readonly isDisposed: boolean;
|
|
2882
|
+
};
|
|
2883
|
+
/**
|
|
2884
|
+
* Creates a headless {@link ServiceContainer} that hosts a bridge service.
|
|
2885
|
+
*
|
|
2886
|
+
* The returned token owns the container. Dispose it to tear down the bridge.
|
|
2887
|
+
*
|
|
2888
|
+
* @param options Optional configuration for the bridge.
|
|
2889
|
+
* @returns A {@link ModularBridgeToken} that owns the container.
|
|
2890
|
+
* @experimental
|
|
2891
|
+
* @internal
|
|
2892
|
+
*/
|
|
2893
|
+
export function MakeModularBridge(options?: ModularBridgeOptions): ModularBridgeToken;
|
|
2837
2894
|
|
|
2838
2895
|
}
|
|
2839
2896
|
declare module "@babylonjs/node-particle-editor/modularTool/themes/babylonTheme" {
|
|
@@ -3313,6 +3370,359 @@ import { ServiceDefinition } from "@babylonjs/node-particle-editor/modularTool/m
|
|
|
3313
3370
|
import { IShellService } from "@babylonjs/node-particle-editor/modularTool/services/shellService";
|
|
3314
3371
|
export const ExtensionListServiceDefinition: ServiceDefinition<[], [IShellService]>;
|
|
3315
3372
|
|
|
3373
|
+
}
|
|
3374
|
+
declare module "@babylonjs/node-particle-editor/modularTool/services/cli/protocol" {
|
|
3375
|
+
/**
|
|
3376
|
+
* Serializable description of a command argument, used in protocol messages.
|
|
3377
|
+
*/
|
|
3378
|
+
export type CommandArgInfo = {
|
|
3379
|
+
/** The name of the argument. */
|
|
3380
|
+
name: string;
|
|
3381
|
+
/** A human-readable description of the argument. */
|
|
3382
|
+
description: string;
|
|
3383
|
+
/** Whether this argument is required. */
|
|
3384
|
+
required?: boolean;
|
|
3385
|
+
/** The type of the argument. Defaults to "string". When "file", the CLI reads the file and sends its contents. */
|
|
3386
|
+
type?: "string" | "file";
|
|
3387
|
+
};
|
|
3388
|
+
/**
|
|
3389
|
+
* Serializable description of a command, used in protocol messages.
|
|
3390
|
+
*/
|
|
3391
|
+
export type CommandInfo = {
|
|
3392
|
+
/** A unique identifier for the command. */
|
|
3393
|
+
id: string;
|
|
3394
|
+
/** A human-readable description of the command. */
|
|
3395
|
+
description: string;
|
|
3396
|
+
/** The arguments this command accepts. */
|
|
3397
|
+
args?: CommandArgInfo[];
|
|
3398
|
+
};
|
|
3399
|
+
/**
|
|
3400
|
+
* Serializable description of a session, used in protocol messages.
|
|
3401
|
+
*/
|
|
3402
|
+
export type SessionInfo = {
|
|
3403
|
+
/** The numeric session identifier. */
|
|
3404
|
+
id: number;
|
|
3405
|
+
/** The display name of the session. */
|
|
3406
|
+
name: string;
|
|
3407
|
+
/** ISO 8601 timestamp of when the session connected. */
|
|
3408
|
+
connectedAt: string;
|
|
3409
|
+
};
|
|
3410
|
+
/**
|
|
3411
|
+
* CLI → Bridge: Request the list of active browser sessions.
|
|
3412
|
+
*/
|
|
3413
|
+
export type SessionsRequest = {
|
|
3414
|
+
/** The message type discriminator. */
|
|
3415
|
+
type: "sessions";
|
|
3416
|
+
};
|
|
3417
|
+
/**
|
|
3418
|
+
* CLI → Bridge: Request the list of commands available from a session.
|
|
3419
|
+
*/
|
|
3420
|
+
export type CommandsRequest = {
|
|
3421
|
+
/** The message type discriminator. */
|
|
3422
|
+
type: "commands";
|
|
3423
|
+
/** The session to query for commands. */
|
|
3424
|
+
sessionId: number;
|
|
3425
|
+
};
|
|
3426
|
+
/**
|
|
3427
|
+
* CLI → Bridge: Execute a command on a session.
|
|
3428
|
+
*/
|
|
3429
|
+
export type ExecRequest = {
|
|
3430
|
+
/** The message type discriminator. */
|
|
3431
|
+
type: "exec";
|
|
3432
|
+
/** The session to execute the command on. */
|
|
3433
|
+
sessionId: number;
|
|
3434
|
+
/** The identifier of the command to execute. */
|
|
3435
|
+
commandId: string;
|
|
3436
|
+
/** Key-value pairs of arguments for the command. */
|
|
3437
|
+
args: Record<string, string>;
|
|
3438
|
+
};
|
|
3439
|
+
/**
|
|
3440
|
+
* CLI → Bridge: Stop the bridge process.
|
|
3441
|
+
*/
|
|
3442
|
+
export type StopRequest = {
|
|
3443
|
+
/** The message type discriminator. */
|
|
3444
|
+
type: "stop";
|
|
3445
|
+
};
|
|
3446
|
+
/**
|
|
3447
|
+
* All messages that the CLI sends to the bridge.
|
|
3448
|
+
*/
|
|
3449
|
+
export type CliRequest = SessionsRequest | CommandsRequest | ExecRequest | StopRequest;
|
|
3450
|
+
/**
|
|
3451
|
+
* Bridge → CLI: Response with the list of active sessions.
|
|
3452
|
+
*/
|
|
3453
|
+
export type SessionsResponse = {
|
|
3454
|
+
/** The message type discriminator. */
|
|
3455
|
+
type: "sessionsResponse";
|
|
3456
|
+
/** The list of active sessions. */
|
|
3457
|
+
sessions: SessionInfo[];
|
|
3458
|
+
};
|
|
3459
|
+
/**
|
|
3460
|
+
* Bridge → CLI: Response with the list of commands from a session.
|
|
3461
|
+
*/
|
|
3462
|
+
export type CommandsResponse = {
|
|
3463
|
+
/** The message type discriminator. */
|
|
3464
|
+
type: "commandsResponse";
|
|
3465
|
+
/** The list of available commands, if successful. */
|
|
3466
|
+
commands?: CommandInfo[];
|
|
3467
|
+
/** An error message, if the request failed. */
|
|
3468
|
+
error?: string;
|
|
3469
|
+
};
|
|
3470
|
+
/**
|
|
3471
|
+
* Bridge → CLI: Response with the result of a command execution.
|
|
3472
|
+
*/
|
|
3473
|
+
export type ExecResponse = {
|
|
3474
|
+
/** The message type discriminator. */
|
|
3475
|
+
type: "execResponse";
|
|
3476
|
+
/** The result of the command execution, if successful. */
|
|
3477
|
+
result?: string;
|
|
3478
|
+
/** An error message, if the execution failed. */
|
|
3479
|
+
error?: string;
|
|
3480
|
+
};
|
|
3481
|
+
/**
|
|
3482
|
+
* Bridge → CLI: Acknowledgement that the bridge is stopping.
|
|
3483
|
+
*/
|
|
3484
|
+
export type StopResponse = {
|
|
3485
|
+
/** The message type discriminator. */
|
|
3486
|
+
type: "stopResponse";
|
|
3487
|
+
/** Whether the bridge stopped successfully. */
|
|
3488
|
+
success: boolean;
|
|
3489
|
+
};
|
|
3490
|
+
/**
|
|
3491
|
+
* All messages that the bridge sends to the CLI.
|
|
3492
|
+
*/
|
|
3493
|
+
export type CliResponse = SessionsResponse | CommandsResponse | ExecResponse | StopResponse;
|
|
3494
|
+
/**
|
|
3495
|
+
* Browser → Bridge: Register a new session.
|
|
3496
|
+
*/
|
|
3497
|
+
export type RegisterRequest = {
|
|
3498
|
+
/** The message type discriminator. */
|
|
3499
|
+
type: "register";
|
|
3500
|
+
/** The display name for this session. */
|
|
3501
|
+
name: string;
|
|
3502
|
+
};
|
|
3503
|
+
/**
|
|
3504
|
+
* Browser → Bridge: Response to a listCommands request from the bridge.
|
|
3505
|
+
*/
|
|
3506
|
+
export type CommandListResponse = {
|
|
3507
|
+
/** The message type discriminator. */
|
|
3508
|
+
type: "commandListResponse";
|
|
3509
|
+
/** The identifier of the original request. */
|
|
3510
|
+
requestId: string;
|
|
3511
|
+
/** The list of registered commands. */
|
|
3512
|
+
commands: CommandInfo[];
|
|
3513
|
+
};
|
|
3514
|
+
/**
|
|
3515
|
+
* Browser → Bridge: Response to an execCommand request from the bridge.
|
|
3516
|
+
*/
|
|
3517
|
+
export type CommandResponse = {
|
|
3518
|
+
/** The message type discriminator. */
|
|
3519
|
+
type: "commandResponse";
|
|
3520
|
+
/** The identifier of the original request. */
|
|
3521
|
+
requestId: string;
|
|
3522
|
+
/** The result of the command execution, if successful. */
|
|
3523
|
+
result?: string;
|
|
3524
|
+
/** An error message, if the execution failed. */
|
|
3525
|
+
error?: string;
|
|
3526
|
+
};
|
|
3527
|
+
/**
|
|
3528
|
+
* Browser → Bridge: Response to a getInfo request from the bridge.
|
|
3529
|
+
*/
|
|
3530
|
+
export type InfoResponse = {
|
|
3531
|
+
/** The message type discriminator. */
|
|
3532
|
+
type: "infoResponse";
|
|
3533
|
+
/** The identifier of the original request. */
|
|
3534
|
+
requestId: string;
|
|
3535
|
+
/** The current display name of the session. */
|
|
3536
|
+
name: string;
|
|
3537
|
+
};
|
|
3538
|
+
/**
|
|
3539
|
+
* All messages that the browser sends to the bridge.
|
|
3540
|
+
*/
|
|
3541
|
+
export type BrowserRequest = RegisterRequest | CommandListResponse | CommandResponse | InfoResponse;
|
|
3542
|
+
/**
|
|
3543
|
+
* Bridge → Browser: Request the list of registered commands.
|
|
3544
|
+
*/
|
|
3545
|
+
export type ListCommandsRequest = {
|
|
3546
|
+
/** The message type discriminator. */
|
|
3547
|
+
type: "listCommands";
|
|
3548
|
+
/** A unique identifier for this request. */
|
|
3549
|
+
requestId: string;
|
|
3550
|
+
};
|
|
3551
|
+
/**
|
|
3552
|
+
* Bridge → Browser: Request execution of a command.
|
|
3553
|
+
*/
|
|
3554
|
+
export type ExecCommandRequest = {
|
|
3555
|
+
/** The message type discriminator. */
|
|
3556
|
+
type: "execCommand";
|
|
3557
|
+
/** A unique identifier for this request. */
|
|
3558
|
+
requestId: string;
|
|
3559
|
+
/** The identifier of the command to execute. */
|
|
3560
|
+
commandId: string;
|
|
3561
|
+
/** Key-value pairs of arguments for the command. */
|
|
3562
|
+
args: Record<string, string>;
|
|
3563
|
+
};
|
|
3564
|
+
/**
|
|
3565
|
+
* Bridge → Browser: Request current session information.
|
|
3566
|
+
*/
|
|
3567
|
+
export type GetInfoRequest = {
|
|
3568
|
+
/** The message type discriminator. */
|
|
3569
|
+
type: "getInfo";
|
|
3570
|
+
/** A unique identifier for this request. */
|
|
3571
|
+
requestId: string;
|
|
3572
|
+
};
|
|
3573
|
+
/**
|
|
3574
|
+
* All messages that the bridge sends to the browser.
|
|
3575
|
+
*/
|
|
3576
|
+
export type BrowserResponse = ListCommandsRequest | ExecCommandRequest | GetInfoRequest;
|
|
3577
|
+
|
|
3578
|
+
}
|
|
3579
|
+
declare module "@babylonjs/node-particle-editor/modularTool/services/cli/bridgeService" {
|
|
3580
|
+
import { ServiceDefinition } from "@babylonjs/node-particle-editor/modularTool/modularity/serviceDefinition";
|
|
3581
|
+
import { ICliConnectionStatus } from "@babylonjs/node-particle-editor/modularTool/services/cli/bridgeConnectionStatus";
|
|
3582
|
+
import { IBridgeCommandRegistry } from "@babylonjs/node-particle-editor/modularTool/services/cli/bridgeCommandRegistry";
|
|
3583
|
+
/**
|
|
3584
|
+
* Options for the CLI bridge service.
|
|
3585
|
+
* @experimental
|
|
3586
|
+
* @internal
|
|
3587
|
+
*/
|
|
3588
|
+
export type BridgeServiceOptions = {
|
|
3589
|
+
/**
|
|
3590
|
+
* The WebSocket port for the bridge's browser port.
|
|
3591
|
+
*/
|
|
3592
|
+
port: number;
|
|
3593
|
+
/**
|
|
3594
|
+
* The session display name sent to the bridge.
|
|
3595
|
+
* Can be a getter to provide a dynamic value that is re-read
|
|
3596
|
+
* each time the bridge queries session information.
|
|
3597
|
+
*/
|
|
3598
|
+
name: string;
|
|
3599
|
+
/**
|
|
3600
|
+
* Whether to automatically start connecting when the service is created.
|
|
3601
|
+
*/
|
|
3602
|
+
autoStart: boolean;
|
|
3603
|
+
};
|
|
3604
|
+
/**
|
|
3605
|
+
* Creates the service definition for the CLI Bridge Service.
|
|
3606
|
+
* @param options The options for connecting to the bridge.
|
|
3607
|
+
* @returns A service definition that produces an IBridgeCommandRegistry and ICliConnectionStatus.
|
|
3608
|
+
* @experimental
|
|
3609
|
+
* @internal
|
|
3610
|
+
*/
|
|
3611
|
+
export function MakeBridgeServiceDefinition(options: BridgeServiceOptions): ServiceDefinition<[IBridgeCommandRegistry, ICliConnectionStatus], []>;
|
|
3612
|
+
|
|
3613
|
+
}
|
|
3614
|
+
declare module "@babylonjs/node-particle-editor/modularTool/services/cli/bridgeConnectionStatus" {
|
|
3615
|
+
import { IReadonlyObservable } from "@babylonjs/core/index";
|
|
3616
|
+
import { IService } from "@babylonjs/node-particle-editor/modularTool/modularity/serviceDefinition";
|
|
3617
|
+
/**
|
|
3618
|
+
* The service identity for the CLI connection status.
|
|
3619
|
+
* @experimental
|
|
3620
|
+
* @internal
|
|
3621
|
+
*/
|
|
3622
|
+
export const CliConnectionStatusIdentity: unique symbol;
|
|
3623
|
+
/**
|
|
3624
|
+
* Provides the connection status and enable/disable control for the CLI bridge.
|
|
3625
|
+
* @experimental
|
|
3626
|
+
* @internal
|
|
3627
|
+
*/
|
|
3628
|
+
export interface ICliConnectionStatus extends IService<typeof CliConnectionStatusIdentity> {
|
|
3629
|
+
/**
|
|
3630
|
+
* Whether the bridge is enabled. When true, the bridge actively tries to
|
|
3631
|
+
* maintain a WebSocket connection. When false, the bridge is disconnected
|
|
3632
|
+
* and idle.
|
|
3633
|
+
*/
|
|
3634
|
+
isEnabled: boolean;
|
|
3635
|
+
/**
|
|
3636
|
+
* Whether the bridge WebSocket is currently connected.
|
|
3637
|
+
*/
|
|
3638
|
+
readonly isConnected: boolean;
|
|
3639
|
+
/**
|
|
3640
|
+
* Observable that fires when either {@link isEnabled} or {@link isConnected} changes.
|
|
3641
|
+
*/
|
|
3642
|
+
readonly onConnectionStatusChanged: IReadonlyObservable<void>;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
}
|
|
3646
|
+
declare module "@babylonjs/node-particle-editor/modularTool/services/cli/bridgeCommandRegistry" {
|
|
3647
|
+
import { IDisposable } from "@babylonjs/core/index";
|
|
3648
|
+
import { IService } from "@babylonjs/node-particle-editor/modularTool/modularity/serviceDefinition";
|
|
3649
|
+
/**
|
|
3650
|
+
* The type of a bridge command argument, which determines how
|
|
3651
|
+
* the CLI processes the value before sending it to the browser.
|
|
3652
|
+
* @experimental
|
|
3653
|
+
* @internal
|
|
3654
|
+
*/
|
|
3655
|
+
export type BridgeCommandArgType = "string" | "file";
|
|
3656
|
+
/**
|
|
3657
|
+
* Describes an argument for a bridge command.
|
|
3658
|
+
* @experimental
|
|
3659
|
+
* @internal
|
|
3660
|
+
*/
|
|
3661
|
+
export type BridgeCommandArg = {
|
|
3662
|
+
/**
|
|
3663
|
+
* The name of the argument.
|
|
3664
|
+
*/
|
|
3665
|
+
name: string;
|
|
3666
|
+
/**
|
|
3667
|
+
* A description of the argument.
|
|
3668
|
+
*/
|
|
3669
|
+
description: string;
|
|
3670
|
+
/**
|
|
3671
|
+
* Whether the argument is required.
|
|
3672
|
+
*/
|
|
3673
|
+
required?: boolean;
|
|
3674
|
+
/**
|
|
3675
|
+
* The type of the argument. Defaults to "string".
|
|
3676
|
+
* When set to "file", the CLI reads the file at the given path
|
|
3677
|
+
* and passes its contents as the argument value.
|
|
3678
|
+
*/
|
|
3679
|
+
type?: BridgeCommandArgType;
|
|
3680
|
+
};
|
|
3681
|
+
/**
|
|
3682
|
+
* Describes a command that can be invoked from the bridge.
|
|
3683
|
+
* @experimental
|
|
3684
|
+
* @internal
|
|
3685
|
+
*/
|
|
3686
|
+
export type BridgeCommandDescriptor = {
|
|
3687
|
+
/**
|
|
3688
|
+
* A unique identifier for the command.
|
|
3689
|
+
*/
|
|
3690
|
+
id: string;
|
|
3691
|
+
/**
|
|
3692
|
+
* A human-readable description of what the command does.
|
|
3693
|
+
*/
|
|
3694
|
+
description: string;
|
|
3695
|
+
/**
|
|
3696
|
+
* The arguments that this command accepts.
|
|
3697
|
+
*/
|
|
3698
|
+
args?: BridgeCommandArg[];
|
|
3699
|
+
/**
|
|
3700
|
+
* Executes the command with the given arguments and returns a result string.
|
|
3701
|
+
* @param args A map of argument names to their values.
|
|
3702
|
+
* @returns A promise that resolves to the result string.
|
|
3703
|
+
*/
|
|
3704
|
+
executeAsync: (args: Record<string, string>) => Promise<string>;
|
|
3705
|
+
};
|
|
3706
|
+
/**
|
|
3707
|
+
* The service identity for the bridge command registry.
|
|
3708
|
+
* @experimental
|
|
3709
|
+
* @internal
|
|
3710
|
+
*/
|
|
3711
|
+
export const BridgeCommandRegistryIdentity: unique symbol;
|
|
3712
|
+
/**
|
|
3713
|
+
* A registry for commands that can be invoked from the bridge.
|
|
3714
|
+
* @experimental
|
|
3715
|
+
* @internal
|
|
3716
|
+
*/
|
|
3717
|
+
export interface IBridgeCommandRegistry extends IService<typeof BridgeCommandRegistryIdentity> {
|
|
3718
|
+
/**
|
|
3719
|
+
* Registers a command that can be invoked from the bridge.
|
|
3720
|
+
* @param descriptor The command descriptor.
|
|
3721
|
+
* @returns A disposable token that unregisters the command when disposed.
|
|
3722
|
+
*/
|
|
3723
|
+
addCommand(descriptor: BridgeCommandDescriptor): IDisposable;
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3316
3726
|
}
|
|
3317
3727
|
declare module "@babylonjs/node-particle-editor/modularTool/modularity/serviceDefinition" {
|
|
3318
3728
|
import { IDisposable } from "@babylonjs/core/index";
|
|
@@ -3337,14 +3747,13 @@ type ExtractContractIdentities<ServiceContracts extends IService<symbol>[]> = {
|
|
|
3337
3747
|
[Index in keyof ServiceContracts]: ExtractContractIdentity<ServiceContracts[Index]>;
|
|
3338
3748
|
};
|
|
3339
3749
|
type UnionToIntersection<Union> = (Union extends any ? (k: Union) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
3340
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
3341
3750
|
/**
|
|
3342
3751
|
* A factory function responsible for creating a service instance.
|
|
3343
3752
|
* Consumed services are passed as arguments to the factory function.
|
|
3344
|
-
* The returned value must implement all produced services, and may IDisposable.
|
|
3345
|
-
* If
|
|
3753
|
+
* The returned value must implement all produced services, and may implement IDisposable.
|
|
3754
|
+
* If no services are produced, the returned value may implement IDisposable, otherwise it may return void.
|
|
3346
3755
|
*/
|
|
3347
|
-
export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes
|
|
3756
|
+
export type ServiceFactory<Produces extends IService<symbol>[], Consumes extends IService<symbol>[]> = (...dependencies: [...Consumes]) => Produces extends [] ? Partial<IDisposable> | void : Partial<IDisposable> & UnionToIntersection<Produces[number]>;
|
|
3348
3757
|
/**
|
|
3349
3758
|
* Defines a service, which is a logical unit that consumes other services (dependencies), and optionally produces services that can be consumed by other services (dependents).
|
|
3350
3759
|
*/
|
|
@@ -3410,20 +3819,19 @@ export class ServiceContainer implements IDisposable {
|
|
|
3410
3819
|
*/
|
|
3411
3820
|
constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
|
|
3412
3821
|
/**
|
|
3413
|
-
* Adds a set of service definitions
|
|
3822
|
+
* Adds a set of service definitions to the service container.
|
|
3414
3823
|
* The services are sorted based on their dependencies.
|
|
3415
|
-
* @param
|
|
3416
|
-
* @returns A disposable that will remove the service
|
|
3824
|
+
* @param serviceDefinitions The service definitions to register.
|
|
3825
|
+
* @returns A disposable that will remove the service definitions from the service container.
|
|
3417
3826
|
*/
|
|
3418
|
-
|
|
3827
|
+
addServices(...serviceDefinitions: WeaklyTypedServiceDefinition[]): IDisposable;
|
|
3419
3828
|
/**
|
|
3420
3829
|
* Registers a service definition in the service container.
|
|
3421
3830
|
* @param serviceDefinition The service definition to register.
|
|
3422
|
-
* @param abortSignal An optional abort signal.
|
|
3423
3831
|
* @returns A disposable that will remove the service definition from the service container.
|
|
3424
3832
|
*/
|
|
3425
|
-
|
|
3426
|
-
private
|
|
3833
|
+
addService<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>): IDisposable;
|
|
3834
|
+
private _addService;
|
|
3427
3835
|
/**
|
|
3428
3836
|
* Resolves a dependency by contract identity for a consuming service.
|
|
3429
3837
|
* Checks local services first, then walks up the parent chain.
|