Line data Source code
1 : /**
2 : * Frontend augmentations for node definitions.
3 : *
4 : * This module defines type extensions that augment the backend node definition
5 : * types with frontend-specific properties. These augmentations are applied at
6 : * runtime and are not part of the backend API contract.
7 : */
8 : import type { ComboInputOptions, InputSpec } from '@comfyorg/object-info-parser'
9 :
10 : /**
11 : * Frontend augmentation for image upload combo inputs.
12 : * This extends ComboInputOptions with properties injected by the uploadImage extension.
13 : */
14 : interface ImageUploadComboOptions extends ComboInputOptions {
15 : /**
16 : * Reference to the associated filename combo widget.
17 : * Injected by uploadImage.ts to link upload buttons with their combo widgets.
18 : *
19 : * @remarks This property exists only in the frontend runtime.
20 : */
21 : imageInputName: string
22 : }
23 :
24 : /**
25 : * Type guard to check if an InputSpec has image upload augmentations.
26 : * Narrows from base InputSpec to augmented type.
27 : */
28 244 : export function isImageUploadInput(
29 : inputData: InputSpec
30 : ): inputData is [string, ImageUploadComboOptions] {
31 244 : const options = inputData[1]
32 244 : return (
33 : options !== undefined &&
34 : typeof options === 'object' &&
35 : 'imageInputName' in options &&
36 : typeof options.imageInputName === 'string'
37 : )
38 : }
|