import type { GeneralRecord, PipelineStreamStatus, Secret, TriggerNamespacePipelineResponse, TriggerUserPipelineWithStreamData } from "instill-sdk"; import { Monaco } from "@monaco-editor/react"; import { editor } from "monaco-editor"; import { Edge, Node, OnConnect, OnEdgesChange, OnNodesChange, ReactFlowInstance } from "reactflow"; import { NodeData } from "../../view"; import { EditorRecipeUpdater } from "../../view/recipe-editor/lib"; import { Nullable } from "../type"; import { InstillJSONSchema } from "../use-instill-form"; import { SmartHint } from "../use-smart-hint"; export type WarnUnsavedChangesDialogState = { open: boolean; confirmNavigation: Nullable<() => void>; }; export type PipelineBuilderState = { pipelineId: Nullable; pipelineName: Nullable; nodes: Node[]; edges: Edge[]; rightPanelIsOpen: boolean; isSavingPipeline: boolean; pipelineRecipeIsDirty: boolean; pipelineIsNew: boolean; selectedConnectorNodeId: Nullable; currentAdvancedConfigurationNodeID: Nullable; connectorFormIsDirty: boolean; selectResourceDialogIsOpen: boolean; collapseAllNodes: boolean; testModeTriggerResponse: Nullable; pipelineOpenAPIOutputSchema: Nullable; currentVersion: Nullable; initializedByTemplateOrClone: boolean; isOwner: boolean; isTriggeringPipeline: boolean; dialogPublishPipelineIsOpen: boolean; dialogSharePipelineIsOpen: boolean; pipelineIsReadOnly: boolean; isEditingIterator: boolean; tempSavedNodesForEditingIteratorFlow: Node[]; editingIteratorID: Nullable; warnUnsavedChangesDialogState: WarnUnsavedChangesDialogState; triggerWithStreamData: TriggerUserPipelineWithStreamData[]; displayEventNodes: boolean; }; export type PipelineBuilderAction = { initPipelineBuilder: () => void; initIteratorRelatedState: () => void; updatePipelineId: (fn: (prev: Nullable) => Nullable) => void; updatePipelineName: (fn: (prev: Nullable) => Nullable) => void; updateNodes: (fn: (prev: Node[]) => Node[]) => void; updateEdges: (fn: (prev: Edge[]) => Edge[]) => void; onNodesChange: OnNodesChange; onEdgesChange: OnEdgesChange; onConnect: OnConnect; updateRightPanelIsOpen: (fn: (prev: boolean) => boolean) => void; updateIsSavingPipeline: (fn: (prev: boolean) => boolean) => void; updatePipelineRecipeIsDirty: (fn: (prev: boolean) => boolean) => void; updatePipelineIsNew: (fn: (prev: boolean) => boolean) => void; updateSelectedConnectorNodeId: (fn: (prev: Nullable) => Nullable) => void; updateCurrentAdvancedConfigurationNodeID: (fn: (prev: Nullable) => Nullable) => void; updateConnectorFormIsDirty: (fn: (prev: boolean) => boolean) => void; updateSelectResourceDialogIsOpen: (fn: (prev: boolean) => boolean) => void; updateCollapseAllNodes: (fn: (prev: boolean) => boolean) => void; updateTestModeTriggerResponse: (fn: (prev: Nullable) => Nullable) => void; updatePipelineOpenAPIOutputSchema: (fn: (prev: Nullable) => Nullable) => void; updateCurrentVersion: (fn: (prev: Nullable) => Nullable) => void; updateInitializedByTemplateOrClone: (fn: (prev: boolean) => boolean) => void; updateIsOwner: (fn: (prev: boolean) => boolean) => void; updateIsTriggeringPipeline: (fn: (prev: boolean) => boolean) => void; updateDialogPublishPipelineIsOpen: (fn: (prev: boolean) => boolean) => void; updateDialogSharePipelineIsOpen: (fn: (prev: boolean) => boolean) => void; updatePipelineIsReadOnly: (fn: (prev: boolean) => boolean) => void; updateIsEditingIterator: (fn: (prev: boolean) => boolean) => void; updateTempSavedNodesForEditingIteratorFlow: (fn: (prev: Node[]) => Node[]) => void; updateEditingIteratorID: (fn: (prev: Nullable) => Nullable) => void; updateWarnUnsavdChangesDialogState: (fn: (prev: WarnUnsavedChangesDialogState) => WarnUnsavedChangesDialogState) => void; updateTriggerWithStreamData: (fn: (prev: TriggerUserPipelineWithStreamData[]) => TriggerUserPipelineWithStreamData[]) => void; updateDisplayEventNodes: (fn: (prev: boolean) => boolean) => void; }; export type PipelineBuilderSlice = PipelineBuilderState & PipelineBuilderAction; export type SmartHintSlice = { smartHints: SmartHint[]; updateSmartHints: (fn: (prev: SmartHint[]) => SmartHint[]) => void; }; export type GeneralSlice = { accessToken: Nullable; updateAccessToken: (fn: (prev: Nullable) => Nullable) => void; enabledQuery: boolean; updateEnabledQuery: (fn: (prev: boolean) => boolean) => void; entitySecrets: Secret[]; updateEntitySecrets: (fn: (prev: Secret[]) => Secret[]) => void; navigationNamespaceAnchor: Nullable; updateNavigationNamespaceAnchor: (fn: (prev: Nullable) => Nullable) => void; isTrialEndReadOnly: boolean; updateIsTrialEndReadOnly: (fn: (prev: boolean) => boolean) => void; }; export declare enum DefaultEditorViewIDs { MAIN_PREVIEW_FLOW = 0, MAIN_INPUT = 1, MAIN_OUTPUT = 2, GETTING_STARTED = 3 } export type EditorViewID = string | DefaultEditorViewIDs; export type EditorViewType = "preview" | "docs" | "input" | "output"; export type EditorView = { id: EditorViewID; type: EditorViewType; view: React.ReactNode; title: string; closeable: boolean; }; export type EditorViewSection = { views: EditorView[]; currentViewId: Nullable; }; export type EditorMultiScreenModel = { main: EditorViewSection; topRight: EditorViewSection; bottomRight: EditorViewSection; }; export type EditorSlice = { openActionCmdk: boolean; updateOpenActionCmdk: (fn: (prev: boolean) => boolean) => void; openComponentCmdo: boolean; updateOpenComponentCmdo: (fn: (prev: boolean) => boolean) => void; selectedComponentId: Nullable; updateSelectedComponentId: (fn: (prev: Nullable) => Nullable) => void; editorRef: Nullable; updateEditorRef: (fn: (prev: Nullable) => Nullable) => void; monacoRef: Nullable; updateMonacoRef: (fn: (prev: Nullable) => Nullable) => void; /** * We use this value to control the multile screen editor */ editorMultiScreenModel: EditorMultiScreenModel; updateEditorMultiScreenModel: (fn: (prev: EditorMultiScreenModel) => EditorMultiScreenModel) => void; /** * This is used to store the react flow instance for the editor preview * You can control the react flow instance via this instance */ editorPreviewReactFlowInstance: Nullable; updateEditorPreviewReactFlowInstance: (fn: (prev: Nullable) => Nullable) => void; /** * This value is only for caching the user input in the editor. * * Don't use this to update the raw value of the editor. If it is for actions like * adding a new component, updating a component, etc, use the respective actions * from the monaco-editor to have history record for undo/redo. * @returns void */ rawRecipeOnDom: Nullable; updateRawRecipeOnDom: (fn: (prev: Nullable) => Nullable) => void; isSavingRecipe: boolean; updateIsSavingRecipe: (fn: (prev: boolean) => boolean) => void; hasUnsavedRecipe: boolean; updateHasUnsavedRecipe: (fn: (prev: boolean) => boolean) => void; /** * This is used to trigger the import recipe file uploader * Once this is triggered and the user select the desired file, * The import recipe dialog will be opened and the file will be read */ importRecipeInputTriggerRef: React.MutableRefObject; /** * This is used to store the pipeline and component status, input, output, and error * for the trigger pipeline stream */ triggerPipelineStreamMap: Nullable; updateTriggerPipelineStreamMap: (fn: (prev: Nullable) => Nullable) => void; /** * This is the ref for run button * You can use this ref to click the run button and then trigger the pipeline */ runButtonRef: React.MutableRefObject; updateRunButtonRef: (fn: (prev: React.MutableRefObject) => React.MutableRefObject) => void; /** * This is the returned of useDebouncedRecipeUpdater, we store it in the store * due to we might want to cancel or flush all the debounce invokion like when * user force saved using autonomousRecipeUpdater */ editorDebouncedRecipeUpdater: Nullable; updateEditorDebouncedRecipeUpdater: (fn: (prev: Nullable) => Nullable) => void; /** * This is to control the flow's control is under demo mode or not * When in the editor, it will be false * When in the pipeline preview, it will be true */ flowIsUnderDemoMode: boolean; updateFlowIsUnderDemoMode: (fn: (prev: boolean) => boolean) => void; }; export type FeatureFlagSlice = { featureFlagChatEnabled: boolean; updateFeatureFlagChatEnabled: (fn: (prev: boolean) => boolean) => void; }; export type TriggerPipelineStreamMap = { component?: Record; pipeline?: { status?: PipelineStreamStatus; output?: GeneralRecord; error?: GeneralRecord; }; }; export type RecentlyUsedSlice = { recentlyUsedStartComponentFieldTypes: string[]; updateRecentlyUsedStartComponentFieldTypes: (fn: (prev: string[]) => string[]) => void; }; export type InstillStore = SmartHintSlice & PipelineBuilderSlice & GeneralSlice & RecentlyUsedSlice & EditorSlice & FeatureFlagSlice; export type InstillStoreMutators = [ [ "zustand/devtools", never ], [ "zustand/subscribeWithSelector", never ] ]; //# sourceMappingURL=types.d.ts.map