Files
Automata/packages/editor-ui/src/stores/nodeCreator.store.ts
कारतोफ्फेलस्क्रिप्ट™ 00a4b8b0c6 feat(core): Add support for building LLM applications (#7235)
This extracts all core and editor changes from #7246 and #7137, so that
we can get these changes merged first.

ADO-1120

[DB Tests](https://github.com/n8n-io/n8n/actions/runs/6379749011)
[E2E Tests](https://github.com/n8n-io/n8n/actions/runs/6379751480)
[Workflow Tests](https://github.com/n8n-io/n8n/actions/runs/6379752828)

---------

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Alex Grozav <alex@grozav.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-10-02 17:33:43 +02:00

59 lines
1.4 KiB
TypeScript

import { defineStore } from 'pinia';
import { STORES, TRIGGER_NODE_CREATOR_VIEW } from '@/constants';
import type {
NodeFilterType,
NodeCreatorOpenSource,
SimplifiedNodeType,
ActionsRecord,
} from '@/Interface';
import { computed, ref } from 'vue';
import { transformNodeType } from '@/components/Node/NodeCreator/utils';
export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, () => {
const selectedView = ref<NodeFilterType>(TRIGGER_NODE_CREATOR_VIEW);
const mergedNodes = ref<SimplifiedNodeType[]>([]);
const actions = ref<ActionsRecord<typeof mergedNodes.value>>({});
const showScrim = ref(false);
const openSource = ref<NodeCreatorOpenSource>('');
const allNodeCreatorNodes = computed(() =>
Object.values(mergedNodes.value).map((i) => transformNodeType(i)),
);
function setMergeNodes(nodes: SimplifiedNodeType[]) {
mergedNodes.value = nodes;
}
function setActions(nodes: ActionsRecord<typeof mergedNodes.value>) {
actions.value = nodes;
}
function setShowScrim(isVisible: boolean) {
showScrim.value = isVisible;
}
function setSelectedView(view: NodeFilterType) {
selectedView.value = view;
}
function setOpenSource(view: NodeCreatorOpenSource) {
openSource.value = view;
}
return {
openSource,
selectedView,
showScrim,
mergedNodes,
actions,
setShowScrim,
setSelectedView,
setOpenSource,
setActions,
setMergeNodes,
allNodeCreatorNodes,
};
});