import { ActionStatus, ActionType } from '../actions/types' import { RootState } from '../store' import { VarDataType } from '../types' export const createWorkflowStoreSnapshot = (): RootState => ({ metadata: { id: '', name: 'Fresh New', description: 'A new flow description', icon: 'new-icon', tags: ['new', 'flow', 'mock'], favourite: false, }, actions: [ { id: 'act1id', name: 'core__search@1.0', type: ActionType.SOURCE, metadata: { status: ActionStatus.PUBLISHED, label: 'New Action', description: 'A new action description', icon: 'new-icon', cost: 0, time: 0, }, lAttributes: [], pAttributes: [ { id: '__tmpl-text:text', name: 'tmpl-text', datatype: VarDataType.text, required: true, value: 'This is the {text}!', label: 'PAR ACT1 Web Text', description: 'PAR ACT1 Web Text', }, ], rAttributes: [ { id: '__web-text:text', name: 'web-text', datatype: VarDataType.text, required: true, value: '', label: 'OUT ACT1 Web Text', description: 'OUT ACT1 Web Text', }, { id: '__web-url:url', name: 'web-url', datatype: VarDataType.url, required: true, value: '', label: 'OUT ACT1 Web Url', description: 'OUT ACT1 Web Url', }, ], }, { id: 'act2id', name: 'core__api@1.0', type: ActionType.ACTION, metadata: { status: ActionStatus.PUBLISHED, label: 'New Action #2', description: 'A new action description', icon: 'new-icon', cost: 0, time: 0, }, lAttributes: [ { id: '__pipe-text:text', name: 'pipe-text', datatype: VarDataType.text, required: true, value: '', label: 'IN ACT2 Pipe Text', description: 'IN ACT2 Pipe Text', }, { id: '__pipe-url:url', name: 'pipe-url', datatype: VarDataType.url, required: true, value: '', label: 'IN ACT2 Pipe Url', description: 'IN ACT2 Pipe Url', }, ], pAttributes: [], rAttributes: [ { id: '__pipe-text:text', name: 'pipe-text', datatype: VarDataType.text, required: true, value: '', label: 'OUT ACT2 Pipe Text', description: 'OUT ACT2 Pipe Text', }, { id: '__pipe-url:url', name: 'pipe-url', datatype: VarDataType.url, required: true, value: '', label: 'OUT ACT2 Pipe Url', description: 'OUT ACT2 Pipe Url', }, ], }, { id: 'act3id', name: 'core__ai@1.0', type: ActionType.ACTION, metadata: { status: ActionStatus.PUBLISHED, label: 'New Action #3', description: 'A new action description', icon: 'new-icon', cost: 0, time: 0, }, lAttributes: [ { id: '__var-a-text:text', name: 'var-a-text', datatype: VarDataType.text, required: true, value: '', label: 'IN ACT3 Pipe Text', description: 'IN ACT3 Pipe Text', }, { id: '__var-b-url:url', name: 'var-b-url', datatype: VarDataType.url, required: true, value: '', label: 'IN ACT3 Pipe Url', description: 'IN ACT3 Pipe Url', }, ], pAttributes: [], rAttributes: [ { id: '__pipe-text:text', name: 'pipe-text', datatype: VarDataType.text, required: true, value: '', label: 'OUT ACT3 Pipe Text', description: 'OUT ACT3 Pipe Text', }, { id: '__pipe-url:url', name: 'pipe-url', datatype: VarDataType.url, required: true, value: '', label: 'OUT ACT3 Pipe Url', description: 'OUT ACT3 Pipe Url', }, { id: '__pipe-version:number', name: 'pipe-version', datatype: VarDataType.number, required: true, value: '', label: 'OUT ACT3 Pipe Version', description: 'OUT ACT3 Pipe Version', }, ], }, ], relations: [ { id: 'act1id-rel', actName: 'core__search@1.0', label: 'New Action #1', rel: ['act2id-rel'], x: 100, y: 0, }, { id: 'act2id-rel', actName: 'core__api@1.0', label: 'New Action #2', rel: ['act3id-rel'], x: 200, y: 0, }, { id: 'act3id-rel', actName: 'core__ai@1.0', label: 'New Action #3', rel: [], x: 300, y: 0, }, ], pipeline: [ { id: 'act1id-rel', params: { '__tmpl-text:text': 'This is the {text}!', }, consume: {}, produce: { 'act1id-rel__web-text:text': '__web-text:text', 'act1id-rel__web-url:url': '__web-url:url', }, }, { id: 'act2id-rel', params: {}, consume: { 'act2id-rel__var-a-text:text': 'act1id-rel__web-text:text', 'act2id-rel__var-b-url:url': 'act1id-rel__web-url:url', }, produce: { 'act2id-rel__pipe-text:text': '__pipe-text:text', 'act2id-rel__pipe-url:url': '__pipe-url:url', }, }, { id: 'act3id-rel', params: {}, consume: { 'act3id-rel__var-b-text:text': 'act1id-rel__web-text:text', 'act3id-rel__var-c-url:url': 'act2id-rel__pipe-url:url', }, produce: { 'act3id-rel__pipe-text:text': '__pipe-text:text', 'act3id-rel__pipe-url:url': '__pipe-url:url', 'act3id-rel__pipe-version:number': '__pipe-version:number', }, }, ], labels: { 'act1id-rel__web-text:text': 'Drafter | Product Text ', 'act1id-rel__web-url:url': 'Drafter | Product Url', }, views: [ { id: 'view1', layout: 'horizontal_line', label: 'Cards', elements: { 'act3id-rel__pipe-text:text': 'CardDescription', 'act1id-rel__web-url:url': 'CardDescription', 'act1id-rel__web-text:text': 'CardDescription', }, position: 1, }, ], __legacy: { variables: {} }, }) export const selectFirstActionRelationAttributesExpected = () => { const action = createWorkflowStoreSnapshot().actions[0] return { lAttributes: action.lAttributes, pAttributes: action.pAttributes, rAttributes: action.rAttributes, } } export const allProducedAttributesExpected = () => [ { datatype: 'text', description: 'OUT ACT1 Web Text', globalId: 'act1id-rel__web-text:text', id: '__web-text:text', label: 'OUT ACT1 Web Text', name: 'web-text', required: true, value: '', }, { datatype: 'url', description: 'OUT ACT1 Web Url', globalId: 'act1id-rel__web-url:url', id: '__web-url:url', label: 'OUT ACT1 Web Url', name: 'web-url', required: true, value: '', }, { datatype: 'text', description: 'OUT ACT2 Pipe Text', globalId: 'act2id-rel__pipe-text:text', id: '__pipe-text:text', label: 'OUT ACT2 Pipe Text', name: 'pipe-text', required: true, value: '', }, { datatype: 'url', description: 'OUT ACT2 Pipe Url', globalId: 'act2id-rel__pipe-url:url', id: '__pipe-url:url', label: 'OUT ACT2 Pipe Url', name: 'pipe-url', required: true, value: '', }, { datatype: 'text', description: 'OUT ACT3 Pipe Text', globalId: 'act3id-rel__pipe-text:text', id: '__pipe-text:text', label: 'OUT ACT3 Pipe Text', name: 'pipe-text', required: true, value: '', }, { datatype: 'url', description: 'OUT ACT3 Pipe Url', globalId: 'act3id-rel__pipe-url:url', id: '__pipe-url:url', label: 'OUT ACT3 Pipe Url', name: 'pipe-url', required: true, value: '', }, { datatype: 'number', description: 'OUT ACT3 Pipe Version', globalId: 'act3id-rel__pipe-version:number', id: '__pipe-version:number', label: 'OUT ACT3 Pipe Version', name: 'pipe-version', required: true, value: '', }, ] export const selectAllProducedAttributesBeforeActionExected = () => [ { id: '__web-text:text', name: 'web-text', datatype: 'text', required: true, value: '', label: 'OUT ACT1 Web Text', description: 'OUT ACT1 Web Text', globalId: 'act1id-rel__web-text:text', }, { id: '__web-url:url', name: 'web-url', datatype: 'url', required: true, value: '', label: 'OUT ACT1 Web Url', description: 'OUT ACT1 Web Url', globalId: 'act1id-rel__web-url:url', }, { id: '__pipe-text:text', name: 'pipe-text', datatype: 'text', required: true, value: '', label: 'OUT ACT2 Pipe Text', description: 'OUT ACT2 Pipe Text', globalId: 'act2id-rel__pipe-text:text', }, { id: '__pipe-url:url', name: 'pipe-url', datatype: 'url', required: true, value: '', label: 'OUT ACT2 Pipe Url', description: 'OUT ACT2 Pipe Url', globalId: 'act2id-rel__pipe-url:url', }, ] export const selectAllActionRelationsAsExecutionExpected = () => [ { id: 'act1id-rel', rel: ['act2id-rel'], cmdId: 'core__search@1.0', //'act1id', cmdName: '', // 'core__search', cmdOptions: { 'tmpl-text': 'This is the {text}!' }, context: {}, lAttributes: [], rAttributes: [ 'act1id-rel__web-text:text=web-text', 'act1id-rel__web-url:url=web-url', ], }, { id: 'act2id-rel', rel: ['act3id-rel'], cmdId: 'core__api@1.0', //'act2id', cmdName: '', // 'core__api', cmdOptions: {}, context: {}, lAttributes: [ 'undefined=act1id-rel__web-text:text', 'undefined=act1id-rel__web-url:url', ], rAttributes: [ 'act2id-rel__pipe-text:text=pipe-text', 'act2id-rel__pipe-url:url=pipe-url', ], }, { id: 'act3id-rel', rel: [], cmdId: 'core__ai@1.0', //'act3id', cmdName: '', // 'core__ai', cmdOptions: {}, context: {}, lAttributes: [ 'undefined=act1id-rel__web-text:text', 'undefined=act2id-rel__pipe-url:url', ], rAttributes: [ 'act3id-rel__pipe-text:text=pipe-text', 'act3id-rel__pipe-url:url=pipe-url', 'act3id-rel__pipe-version:number=pipe-version', ], }, ] export const selectAllViewsAsOutputExpected = () => [ { id: 'view1', label: 'Cards', layout: 'horizontal_line', elements: [ { name: 'act3id-rel__pipe-text:text', datatype: 'text', label: 'OUT ACT3 Pipe Text', component: 'CardDescription', }, { name: 'act1id-rel__web-url:url', datatype: 'url', label: 'Drafter | Product Url', component: 'CardDescription', }, { name: 'act1id-rel__web-text:text', datatype: 'text', label: 'Drafter | Product Text ', component: 'CardDescription', }, ], }, ]