2022-07-24 08:25:01 -07:00
/* eslint-disable @typescript-eslint/no-unsafe-argument */
2023-07-31 02:00:48 -07:00
2019-07-13 10:50:41 -07:00
/* eslint-disable @typescript-eslint/no-use-before-define */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
2023-07-31 02:00:48 -07:00
2019-07-13 10:50:41 -07:00
/* eslint-disable prefer-spread */
2023-07-31 02:00:48 -07:00
2023-06-16 07:26:35 -07:00
import get from 'lodash/get' ;
import isEqual from 'lodash/isEqual' ;
2023-11-13 03:11:16 -08:00
import uniqBy from 'lodash/uniqBy' ;
2021-08-29 11:58:11 -07:00
2024-09-18 00:19:33 -07:00
import { SINGLE_EXECUTION_NODES } from './Constants' ;
import { ApplicationError } from './errors/application.error' ;
2024-06-25 04:53:31 -07:00
import { NodeConnectionType } from './Interfaces' ;
2023-01-27 05:56:56 -08:00
import type {
2023-11-13 03:11:16 -08:00
FieldType ,
2019-06-23 03:35:23 -07:00
IContextObject ,
2023-11-13 03:11:16 -08:00
IHttpRequestMethods ,
2019-06-23 03:35:23 -07:00
INode ,
2020-10-22 06:46:03 -07:00
INodeCredentialDescription ,
2019-06-23 03:35:23 -07:00
INodeIssueObjectProperty ,
2020-10-22 06:46:03 -07:00
INodeIssues ,
2022-09-21 06:44:45 -07:00
INodeParameterResourceLocator ,
2019-06-23 03:35:23 -07:00
INodeParameters ,
INodeProperties ,
INodePropertyCollection ,
2022-09-21 06:44:45 -07:00
INodePropertyMode ,
INodePropertyModeValidation ,
2023-11-13 03:11:16 -08:00
INodePropertyOptions ,
2022-09-21 06:44:45 -07:00
INodePropertyRegexValidation ,
2019-06-23 03:35:23 -07:00
INodeType ,
2019-07-13 10:50:41 -07:00
IParameterDependencies ,
2019-06-23 03:35:23 -07:00
IRunExecutionData ,
2023-11-13 03:11:16 -08:00
IVersionedNodeType ,
2019-06-23 03:35:23 -07:00
IWebhookData ,
2019-07-13 10:50:41 -07:00
IWorkflowExecuteAdditionalData ,
2019-06-23 03:35:23 -07:00
NodeParameterValue ,
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
ResourceMapperValue ,
2023-10-02 08:33:43 -07:00
INodeTypeDescription ,
2024-09-04 03:06:17 -07:00
INodeTypeBaseDescription ,
2023-10-02 08:33:43 -07:00
INodeOutputConfiguration ,
INodeInputConfiguration ,
2023-09-19 03:16:35 -07:00
GenericValue ,
2024-01-24 08:04:46 -08:00
DisplayCondition ,
2024-05-13 05:46:02 -07:00
NodeHint ,
2024-05-22 03:35:29 -07:00
INodeExecutionData ,
2019-06-23 03:35:23 -07:00
} from './Interfaces' ;
2024-09-18 00:19:33 -07:00
import { validateFilterParameter } from './NodeParameters/FilterParameter' ;
2023-12-13 05:45:22 -08:00
import {
isFilterValue ,
isResourceMapperValue ,
isValidResourceLocatorParameterValue ,
} from './type-guards' ;
2024-09-18 00:19:33 -07:00
import { validateFieldType } from './TypeValidation' ;
2022-10-21 08:24:58 -07:00
import { deepCopy } from './utils' ;
2023-11-13 03:11:16 -08:00
import type { Workflow } from './Workflow' ;
2019-12-31 12:19:37 -08:00
2022-08-19 03:45:04 -07:00
export const cronNodeOptions : INodePropertyCollection [ ] = [
{
name : 'item' ,
displayName : 'Item' ,
values : [
{
displayName : 'Mode' ,
name : 'mode' ,
type : 'options' ,
options : [
{
name : 'Every Minute' ,
value : 'everyMinute' ,
} ,
{
name : 'Every Hour' ,
value : 'everyHour' ,
} ,
{
name : 'Every Day' ,
value : 'everyDay' ,
} ,
{
name : 'Every Week' ,
value : 'everyWeek' ,
} ,
{
name : 'Every Month' ,
value : 'everyMonth' ,
} ,
{
name : 'Every X' ,
value : 'everyX' ,
} ,
{
name : 'Custom' ,
value : 'custom' ,
} ,
] ,
default : 'everyDay' ,
description : 'How often to trigger.' ,
} ,
{
displayName : 'Hour' ,
name : 'hour' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
maxValue : 23 ,
} ,
displayOptions : {
hide : {
mode : [ 'custom' , 'everyHour' , 'everyMinute' , 'everyX' ] ,
} ,
} ,
default : 14 ,
description : 'The hour of the day to trigger (24h format)' ,
} ,
{
displayName : 'Minute' ,
name : 'minute' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
maxValue : 59 ,
} ,
displayOptions : {
hide : {
mode : [ 'custom' , 'everyMinute' , 'everyX' ] ,
} ,
} ,
default : 0 ,
description : 'The minute of the day to trigger' ,
} ,
{
displayName : 'Day of Month' ,
name : 'dayOfMonth' ,
type : 'number' ,
displayOptions : {
show : {
mode : [ 'everyMonth' ] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 31 ,
} ,
default : 1 ,
description : 'The day of the month to trigger' ,
} ,
{
displayName : 'Weekday' ,
name : 'weekday' ,
type : 'options' ,
displayOptions : {
show : {
mode : [ 'everyWeek' ] ,
} ,
} ,
options : [
{
name : 'Monday' ,
value : '1' ,
} ,
{
name : 'Tuesday' ,
value : '2' ,
} ,
{
name : 'Wednesday' ,
value : '3' ,
} ,
{
name : 'Thursday' ,
value : '4' ,
} ,
{
name : 'Friday' ,
value : '5' ,
} ,
{
name : 'Saturday' ,
value : '6' ,
} ,
{
name : 'Sunday' ,
value : '0' ,
} ,
] ,
default : '1' ,
description : 'The weekday to trigger' ,
} ,
{
displayName : 'Cron Expression' ,
name : 'cronExpression' ,
type : 'string' ,
displayOptions : {
show : {
mode : [ 'custom' ] ,
} ,
} ,
default : '* * * * * *' ,
description :
'Use custom cron expression. Values and ranges as follows:<ul><li>Seconds: 0-59</li><li>Minutes: 0 - 59</li><li>Hours: 0 - 23</li><li>Day of Month: 1 - 31</li><li>Months: 0 - 11 (Jan - Dec)</li><li>Day of Week: 0 - 6 (Sun - Sat)</li></ul>' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
maxValue : 1000 ,
} ,
displayOptions : {
show : {
mode : [ 'everyX' ] ,
} ,
} ,
default : 2 ,
description : 'All how many X minutes/hours it should trigger' ,
} ,
{
displayName : 'Unit' ,
name : 'unit' ,
type : 'options' ,
displayOptions : {
show : {
mode : [ 'everyX' ] ,
} ,
} ,
options : [
{
name : 'Minutes' ,
value : 'minutes' ,
} ,
{
name : 'Hours' ,
value : 'hours' ,
} ,
] ,
default : 'hours' ,
description : 'If it should trigger all X minutes or hours' ,
} ,
] ,
} ,
] ;
2023-11-22 08:49:56 -08:00
const commonPollingParameters : INodeProperties [ ] = [
2023-02-08 09:57:43 -08:00
{
displayName : 'Poll Times' ,
name : 'pollTimes' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add Poll Time' ,
} ,
default : { item : [ { mode : 'everyMinute' } ] } ,
description : 'Time at which polling should occur' ,
placeholder : 'Add Poll Time' ,
options : cronNodeOptions ,
} ,
] ;
2024-09-30 06:42:37 -07:00
export const commonCORSParameters : INodeProperties [ ] = [
2023-11-22 08:49:56 -08:00
{
displayName : 'Allowed Origins (CORS)' ,
name : 'allowedOrigins' ,
type : 'string' ,
default : '*' ,
2024-03-28 01:46:39 -07:00
description :
'Comma-separated list of URLs allowed for cross-origin non-preflight requests. Use * (default) to allow all origins.' ,
2023-11-22 08:49:56 -08:00
} ,
] ;
2024-06-06 22:39:31 -07:00
const declarativeNodeOptionParameters : INodeProperties = {
displayName : 'Request Options' ,
name : 'requestOptions' ,
type : 'collection' ,
isNodeSetting : true ,
placeholder : 'Add Option' ,
default : { } ,
options : [
{
displayName : 'Batching' ,
name : 'batching' ,
placeholder : 'Add Batching' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : false ,
} ,
default : {
batch : { } ,
} ,
options : [
{
displayName : 'Batching' ,
name : 'batch' ,
values : [
{
displayName : 'Items per Batch' ,
name : 'batchSize' ,
type : 'number' ,
typeOptions : {
minValue : - 1 ,
} ,
default : 50 ,
description :
'Input will be split in batches to throttle requests. -1 for disabled. 0 will be treated as 1.' ,
} ,
{
displayName : 'Batch Interval (ms)' ,
name : 'batchInterval' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
} ,
default : 1000 ,
description : 'Time (in milliseconds) between each batch of requests. 0 for disabled.' ,
} ,
] ,
} ,
] ,
} ,
{
2024-12-02 05:56:14 -08:00
displayName : 'Ignore SSL Issues (Insecure)' ,
2024-06-06 22:39:31 -07:00
name : 'allowUnauthorizedCerts' ,
type : 'boolean' ,
noDataExpression : true ,
default : false ,
description :
'Whether to accept the response even if SSL certificate validation is not possible' ,
} ,
{
displayName : 'Proxy' ,
name : 'proxy' ,
type : 'string' ,
default : '' ,
placeholder : 'e.g. http://myproxy:3128' ,
description :
'HTTP proxy to use. If authentication is required it can be defined as follow: http://username:password@myproxy:3128' ,
} ,
{
displayName : 'Timeout' ,
name : 'timeout' ,
type : 'number' ,
typeOptions : {
minValue : 1 ,
} ,
default : 10000 ,
description :
'Time in ms to wait for the server to send response headers (and start the response body) before aborting the request' ,
} ,
] ,
} ;
2024-09-04 03:06:17 -07:00
/ * *
* Modifies the description of the passed in object , such that it can be used
* as an AI Agent Tool .
* Returns the modified item ( not copied )
* /
export function convertNodeToAiTool <
T extends object & { description : INodeTypeDescription | INodeTypeBaseDescription } ,
> ( item : T ) : T {
2024-10-02 04:31:22 -07:00
// quick helper function for type-guard down below
2024-09-04 03:06:17 -07:00
function isFullDescription ( obj : unknown ) : obj is INodeTypeDescription {
return typeof obj === 'object' && obj !== null && 'properties' in obj ;
}
if ( isFullDescription ( item . description ) ) {
item . description . name += 'Tool' ;
item . description . inputs = [ ] ;
item . description . outputs = [ NodeConnectionType . AiTool ] ;
2024-10-02 04:31:22 -07:00
item . description . displayName += ' Tool' ;
2024-09-04 03:06:17 -07:00
delete item . description . usableAsTool ;
2024-10-02 04:31:22 -07:00
const hasResource = item . description . properties . some ( ( prop ) = > prop . name === 'resource' ) ;
const hasOperation = item . description . properties . some ( ( prop ) = > prop . name === 'operation' ) ;
2024-09-04 03:06:17 -07:00
if ( ! item . description . properties . map ( ( prop ) = > prop . name ) . includes ( 'toolDescription' ) ) {
2024-10-02 04:31:22 -07:00
const descriptionType : INodeProperties = {
displayName : 'Tool Description' ,
name : 'descriptionType' ,
type : 'options' ,
noDataExpression : true ,
options : [
{
name : 'Set Automatically' ,
value : 'auto' ,
description : 'Automatically set based on resource and operation' ,
} ,
{
name : 'Set Manually' ,
value : 'manual' ,
description : 'Manually set the description' ,
} ,
] ,
default : 'auto' ,
} ;
2024-09-04 03:06:17 -07:00
const descProp : INodeProperties = {
displayName : 'Description' ,
name : 'toolDescription' ,
type : 'string' ,
default : item . description . description ,
required : true ,
typeOptions : { rows : 2 } ,
description :
'Explain to the LLM what this tool does, a good, specific description would allow LLMs to produce expected results much more often' ,
placeholder : ` e.g. ${ item . description . description } ` ,
} ;
2024-10-02 04:31:22 -07:00
const noticeProp : INodeProperties = {
2024-11-08 07:15:33 -08:00
displayName :
"Use the expression {{ $fromAI('placeholder_name') }} for any data to be filled by the model" ,
2024-10-02 04:31:22 -07:00
name : 'notice' ,
type : 'notice' ,
default : '' ,
} ;
2024-09-04 03:06:17 -07:00
item . description . properties . unshift ( descProp ) ;
2024-10-02 04:31:22 -07:00
// If node has resource or operation we can determine pre-populate tool description based on it
// so we add the descriptionType property as the first property
if ( hasResource || hasOperation ) {
item . description . properties . unshift ( descriptionType ) ;
descProp . displayOptions = {
show : {
descriptionType : [ 'manual' ] ,
} ,
} ;
}
item . description . properties . unshift ( noticeProp ) ;
2024-09-04 03:06:17 -07:00
}
}
2024-11-04 03:31:17 -08:00
const resources = item . description . codex ? . resources ? ? { } ;
2024-09-04 03:06:17 -07:00
item . description . codex = {
categories : [ 'AI' ] ,
subcategories : {
AI : [ 'Tools' ] ,
Tools : [ 'Other Tools' ] ,
} ,
2024-11-04 03:31:17 -08:00
resources ,
2024-09-04 03:06:17 -07:00
} ;
return item ;
}
2024-06-25 04:53:31 -07:00
/ * *
* Determines if the provided node type has any output types other than the main connection type .
* @param typeDescription The node ' s type description to check .
* /
export function isSubNodeType (
typeDescription : Pick < INodeTypeDescription , ' outputs ' > | null ,
) : boolean {
2024-07-16 23:25:16 -07:00
if ( ! typeDescription ? . outputs || typeof typeDescription . outputs === 'string' ) {
2024-06-25 04:53:31 -07:00
return false ;
}
const outputTypes = getConnectionTypes ( typeDescription . outputs ) ;
return outputTypes
? outputTypes . filter ( ( output ) = > output !== NodeConnectionType . Main ) . length > 0
: false ;
}
/** Augments additional `Request Options` property on declarative node-type */
2024-06-06 22:39:31 -07:00
export function applyDeclarativeNodeOptionParameters ( nodeType : INodeType ) : void {
2024-06-25 04:53:31 -07:00
if (
nodeType . execute ||
nodeType . trigger ||
nodeType . webhook ||
nodeType . description . polling ||
isSubNodeType ( nodeType . description )
) {
2024-06-06 22:39:31 -07:00
return ;
}
const parameters = nodeType . description . properties ;
if ( ! parameters ) {
return ;
}
// Was originally under "options" instead of "requestOptions" so the chance
// that that existed was quite high. With this name the chance is actually
// very low that it already exists but lets leave it in anyway to be sure.
const existingRequestOptionsIndex = parameters . findIndex (
( parameter ) = > parameter . name === 'requestOptions' ,
) ;
if ( existingRequestOptionsIndex !== - 1 ) {
parameters [ existingRequestOptionsIndex ] = {
. . . declarativeNodeOptionParameters ,
options : [
. . . ( declarativeNodeOptionParameters . options || [ ] ) ,
. . . ( parameters [ existingRequestOptionsIndex ] ? . options || [ ] ) ,
] ,
} ;
2024-06-24 08:49:59 -07:00
const options = parameters [ existingRequestOptionsIndex ] ? . options ;
if ( options ) {
options . sort ( ( a , b ) = > {
2024-06-06 22:39:31 -07:00
if ( 'displayName' in a && 'displayName' in b ) {
if ( a . displayName < b . displayName ) {
return - 1 ;
}
if ( a . displayName > b . displayName ) {
return 1 ;
}
}
return 0 ;
} ) ;
}
} else {
parameters . push ( declarativeNodeOptionParameters ) ;
}
return ;
}
2019-12-31 12:19:37 -08:00
/ * *
2023-02-08 09:57:43 -08:00
* Apply special parameters which should be added to nodeTypes depending on their type or configuration
2019-12-31 12:19:37 -08:00
* /
2023-02-08 09:57:43 -08:00
export function applySpecialNodeParameters ( nodeType : INodeType ) : void {
2023-11-22 08:49:56 -08:00
const { properties , polling , supportsCORS } = nodeType . description ;
if ( polling ) {
properties . unshift ( . . . commonPollingParameters ) ;
}
if ( nodeType . webhook && supportsCORS ) {
const optionsProperty = properties . find ( ( { name } ) = > name === 'options' ) ;
2024-03-28 01:46:39 -07:00
if ( optionsProperty )
optionsProperty . options = [
. . . commonCORSParameters ,
. . . ( optionsProperty . options as INodePropertyOptions [ ] ) ,
] ;
2023-11-22 08:49:56 -08:00
else properties . push ( . . . commonCORSParameters ) ;
2019-12-31 12:19:37 -08:00
}
2024-06-06 22:39:31 -07:00
applyDeclarativeNodeOptionParameters ( nodeType ) ;
2019-12-31 12:19:37 -08:00
}
2024-01-24 08:04:46 -08:00
const getPropertyValues = (
nodeValues : INodeParameters ,
propertyName : string ,
node : Pick < INode , ' typeVersion ' > | null ,
nodeValuesRoot : INodeParameters ,
) = > {
let value ;
if ( propertyName . charAt ( 0 ) === '/' ) {
// Get the value from the root of the node
value = get ( nodeValuesRoot , propertyName . slice ( 1 ) ) ;
} else if ( propertyName === '@version' ) {
value = node ? . typeVersion || 0 ;
} else {
// Get the value from current level
value = get ( nodeValues , propertyName ) ;
}
if ( value && typeof value === 'object' && '__rl' in value && value . __rl ) {
value = value . value ;
}
if ( ! Array . isArray ( value ) ) {
return [ value as NodeParameterValue ] ;
} else {
return value as NodeParameterValue [ ] ;
}
} ;
const checkConditions = (
conditions : Array < NodeParameterValue | DisplayCondition > ,
actualValues : NodeParameterValue [ ] ,
) = > {
return conditions . some ( ( condition ) = > {
if (
condition &&
typeof condition === 'object' &&
condition . _cnd &&
Object . keys ( condition ) . length === 1
) {
const [ key , targetValue ] = Object . entries ( condition . _cnd ) [ 0 ] ;
return actualValues . every ( ( propertyValue ) = > {
if ( key === 'eq' ) {
return isEqual ( propertyValue , targetValue ) ;
}
if ( key === 'not' ) {
return ! isEqual ( propertyValue , targetValue ) ;
}
if ( key === 'gte' ) {
return ( propertyValue as number ) >= targetValue ;
}
if ( key === 'lte' ) {
return ( propertyValue as number ) <= targetValue ;
}
if ( key === 'gt' ) {
return ( propertyValue as number ) > targetValue ;
}
if ( key === 'lt' ) {
return ( propertyValue as number ) < targetValue ;
}
if ( key === 'between' ) {
const { from , to } = targetValue as { from : number ; to : number } ;
return ( propertyValue as number ) >= from && ( propertyValue as number ) <= to ;
}
if ( key === 'includes' ) {
return ( propertyValue as string ) . includes ( targetValue ) ;
}
if ( key === 'startsWith' ) {
return ( propertyValue as string ) . startsWith ( targetValue ) ;
}
if ( key === 'endsWith' ) {
return ( propertyValue as string ) . endsWith ( targetValue ) ;
}
if ( key === 'regex' ) {
return new RegExp ( targetValue as string ) . test ( propertyValue as string ) ;
}
2024-07-16 23:25:16 -07:00
if ( key === 'exists' ) {
return propertyValue !== null && propertyValue !== undefined && propertyValue !== '' ;
}
2024-01-24 08:04:46 -08:00
return false ;
} ) ;
}
return actualValues . includes ( condition as NodeParameterValue ) ;
} ) ;
} ;
2019-06-23 03:35:23 -07:00
/ * *
* Returns if the parameter should be displayed or not
*
* @param { INodeParameters } nodeValues The data on the node which decides if the parameter
* should be displayed
* @param { ( INodeProperties | INodeCredentialDescription ) } parameter The parameter to check if it should be displayed
* @param { INodeParameters } [ nodeValuesRoot ] The root node - parameter - data
* /
export function displayParameter (
nodeValues : INodeParameters ,
parameter : INodeProperties | INodeCredentialDescription ,
2024-01-04 00:21:36 -08:00
node : Pick < INode , ' typeVersion ' > | null , // Allow null as it does also get used by credentials and they do not have versioning yet
2019-06-23 03:35:23 -07:00
nodeValuesRoot? : INodeParameters ,
2024-11-12 02:33:20 -08:00
displayKey : 'displayOptions' | 'disabledOptions' = 'displayOptions' ,
2019-06-23 03:35:23 -07:00
) {
2024-11-12 02:33:20 -08:00
if ( ! parameter [ displayKey ] ) {
2019-06-23 03:35:23 -07:00
return true ;
}
2024-11-12 02:33:20 -08:00
const { show , hide } = parameter [ displayKey ] ;
2024-01-24 08:04:46 -08:00
2019-06-23 03:35:23 -07:00
nodeValuesRoot = nodeValuesRoot || nodeValues ;
2024-01-24 08:04:46 -08:00
if ( show ) {
2019-06-23 03:35:23 -07:00
// All the defined rules have to match to display parameter
2024-01-24 08:04:46 -08:00
for ( const propertyName of Object . keys ( show ) ) {
const values = getPropertyValues ( nodeValues , propertyName , node , nodeValuesRoot ) ;
2020-05-08 10:49:57 -07:00
2021-05-15 15:51:14 -07:00
if ( values . some ( ( v ) = > typeof v === 'string' && v . charAt ( 0 ) === '=' ) ) {
return true ;
}
2024-01-24 08:04:46 -08:00
if ( values . length === 0 || ! checkConditions ( show [ propertyName ] ! , values ) ) {
2019-06-23 03:35:23 -07:00
return false ;
}
}
}
2024-01-24 08:04:46 -08:00
if ( hide ) {
2021-08-29 04:58:20 -07:00
// Any of the defined hide rules have to match to hide the parameter
2024-01-24 08:04:46 -08:00
for ( const propertyName of Object . keys ( hide ) ) {
const values = getPropertyValues ( nodeValues , propertyName , node , nodeValuesRoot ) ;
2020-05-08 10:49:57 -07:00
2024-01-24 08:04:46 -08:00
if ( values . length !== 0 && checkConditions ( hide [ propertyName ] ! , values ) ) {
2019-06-23 03:35:23 -07:00
return false ;
}
}
}
return true ;
}
/ * *
* Returns if the given parameter should be displayed or not considering the path
* to the properties
*
* @param { INodeParameters } nodeValues The data on the node which decides if the parameter
* should be displayed
* @param { ( INodeProperties | INodeCredentialDescription ) } parameter The parameter to check if it should be displayed
* @param { string } path The path to the property
* /
export function displayParameterPath (
nodeValues : INodeParameters ,
parameter : INodeProperties | INodeCredentialDescription ,
path : string ,
2024-01-04 00:21:36 -08:00
node : Pick < INode , ' typeVersion ' > | null ,
2024-11-12 02:33:20 -08:00
displayKey : 'displayOptions' | 'disabledOptions' = 'displayOptions' ,
2019-06-23 03:35:23 -07:00
) {
let resolvedNodeValues = nodeValues ;
if ( path !== '' ) {
resolvedNodeValues = get ( nodeValues , path ) as INodeParameters ;
}
// Get the root parameter data
let nodeValuesRoot = nodeValues ;
if ( path && path . split ( '.' ) . indexOf ( 'parameters' ) === 0 ) {
nodeValuesRoot = get ( nodeValues , 'parameters' ) as INodeParameters ;
}
2024-11-12 02:33:20 -08:00
return displayParameter ( resolvedNodeValues , parameter , node , nodeValuesRoot , displayKey ) ;
2019-06-23 03:35:23 -07:00
}
/ * *
* Returns the context data
*
* @param { IRunExecutionData } runExecutionData The run execution data
* @param { string } type The data type . "node" / "flow"
* @param { INode } [ node ] If type "node" is set the node to return the context of has to be supplied
* /
export function getContext (
runExecutionData : IRunExecutionData ,
type : string ,
node? : INode ,
) : IContextObject {
if ( runExecutionData . executionData === undefined ) {
// TODO: Should not happen leave it for test now
2023-11-30 03:46:45 -08:00
throw new ApplicationError ( '`executionData` is not initialized' ) ;
2019-06-23 03:35:23 -07:00
}
let key : string ;
if ( type === 'flow' ) {
key = 'flow' ;
} else if ( type === 'node' ) {
if ( node === undefined ) {
2023-11-30 03:46:45 -08:00
// @TODO: What does this mean?
throw new ApplicationError (
'The request data of context type "node" the node parameter has to be set!' ,
) ;
2019-06-23 03:35:23 -07:00
}
key = ` node: ${ node . name } ` ;
} else {
2023-11-30 03:46:45 -08:00
throw new ApplicationError ( 'Unknown context type. Only `flow` and `node` are supported.' , {
extra : { contextType : type } ,
} ) ;
2019-06-23 03:35:23 -07:00
}
if ( runExecutionData . executionData . contextData [ key ] === undefined ) {
runExecutionData . executionData . contextData [ key ] = { } ;
}
return runExecutionData . executionData . contextData [ key ] ;
}
2019-07-13 10:50:41 -07:00
/ * *
* Returns which parameters are dependent on which
*
* /
2022-11-23 07:20:28 -08:00
function getParameterDependencies ( nodePropertiesArray : INodeProperties [ ] ) : IParameterDependencies {
2019-07-13 10:50:41 -07:00
const dependencies : IParameterDependencies = { } ;
for ( const nodeProperties of nodePropertiesArray ) {
2022-09-09 07:34:50 -07:00
const { name , displayOptions } = nodeProperties ;
if ( ! dependencies [ name ] ) {
dependencies [ name ] = [ ] ;
2019-07-13 10:50:41 -07:00
}
2022-09-09 07:34:50 -07:00
if ( ! displayOptions ) {
2019-07-13 10:50:41 -07:00
// Does not have any dependencies
continue ;
}
2022-09-09 07:34:50 -07:00
for ( const displayRule of Object . values ( displayOptions ) ) {
for ( const parameterName of Object . keys ( displayRule ) ) {
if ( ! dependencies [ name ] . includes ( parameterName ) ) {
2022-04-28 10:04:09 -07:00
if ( parameterName . charAt ( 0 ) === '@' ) {
// Is a special parameter so can be skipped
continue ;
}
2022-09-09 07:34:50 -07:00
dependencies [ name ] . push ( parameterName ) ;
2019-07-13 10:50:41 -07:00
}
}
}
}
return dependencies ;
}
/ * *
* Returns in which order the parameters should be resolved
2021-08-29 04:58:20 -07:00
* to have the parameters available they depend on
2019-07-13 10:50:41 -07:00
*
* /
2023-03-06 08:33:32 -08:00
export function getParameterResolveOrder (
2021-08-29 04:58:20 -07:00
nodePropertiesArray : INodeProperties [ ] ,
parameterDependencies : IParameterDependencies ,
) : number [ ] {
2019-07-13 10:50:41 -07:00
const executionOrder : number [ ] = [ ] ;
2024-03-28 01:46:39 -07:00
const indexToResolve = Array . from ( { length : nodePropertiesArray.length } , ( _ , k ) = > k ) ;
2022-09-02 07:13:17 -07:00
const resolvedParameters : string [ ] = [ ] ;
2019-07-13 10:50:41 -07:00
let index : number ;
let property : INodeProperties ;
let lastIndexLength = indexToResolve . length ;
let lastIndexReduction = - 1 ;
2021-08-29 05:00:22 -07:00
let iterations = 0 ;
2019-07-13 10:50:41 -07:00
while ( indexToResolve . length !== 0 ) {
2021-08-29 05:00:22 -07:00
iterations += 1 ;
2019-07-13 10:50:41 -07:00
index = indexToResolve . shift ( ) as number ;
property = nodePropertiesArray [ index ] ;
if ( parameterDependencies [ property . name ] . length === 0 ) {
// Does not have any dependencies so simply add
executionOrder . push ( index ) ;
2022-09-02 07:13:17 -07:00
resolvedParameters . push ( property . name ) ;
2019-07-13 10:50:41 -07:00
continue ;
}
// Parameter has dependencies
for ( const dependency of parameterDependencies [ property . name ] ) {
2022-09-02 07:13:17 -07:00
if ( ! resolvedParameters . includes ( dependency ) ) {
2019-07-13 10:50:41 -07:00
if ( dependency . charAt ( 0 ) === '/' ) {
2022-09-02 07:13:17 -07:00
// Assume that root level dependencies are resolved
2019-07-13 10:50:41 -07:00
continue ;
}
2022-09-02 07:13:17 -07:00
// Dependencies for that parameter are still missing so
2019-07-13 10:50:41 -07:00
// try to add again later
indexToResolve . push ( index ) ;
continue ;
}
}
// All dependencies got found so add
executionOrder . push ( index ) ;
2022-09-02 07:13:17 -07:00
resolvedParameters . push ( property . name ) ;
2019-07-13 10:50:41 -07:00
if ( indexToResolve . length < lastIndexLength ) {
2021-08-29 05:00:22 -07:00
lastIndexReduction = iterations ;
2019-07-13 10:50:41 -07:00
}
2021-08-29 05:00:22 -07:00
if ( iterations > lastIndexReduction + nodePropertiesArray . length ) {
2023-11-30 03:46:45 -08:00
throw new ApplicationError (
2022-09-02 07:13:17 -07:00
'Could not resolve parameter dependencies. Max iterations reached! Hint: If `displayOptions` are specified in any child parameter of a parent `collection` or `fixedCollection`, remove the `displayOptions` from the child parameter.' ,
2021-08-29 04:58:20 -07:00
) ;
2019-07-13 10:50:41 -07:00
}
lastIndexLength = indexToResolve . length ;
}
return executionOrder ;
}
2019-06-23 03:35:23 -07:00
/ * *
* Returns the node parameter values . Depending on the settings it either just returns the none
* default values or it applies all the default values .
*
* @param { INodeProperties [ ] } nodePropertiesArray The properties which exist and their settings
* @param { INodeParameters } nodeValues The node parameter data
* @param { boolean } returnDefaults If default values get added or only none default values returned
* @param { boolean } returnNoneDisplayed If also values which should not be displayed should be returned
* @param { boolean } [ onlySimpleTypes = false ] If only simple types should be resolved
* @param { boolean } [ dataIsResolved = false ] If nodeValues are already fully resolved ( so that all default values got added already )
* @param { INodeParameters } [ nodeValuesRoot ] The root node - parameter - data
* /
2024-04-10 05:02:02 -07:00
// eslint-disable-next-line complexity
2019-07-13 10:50:41 -07:00
export function getNodeParameters (
nodePropertiesArray : INodeProperties [ ] ,
2023-11-13 03:28:55 -08:00
nodeValues : INodeParameters | null ,
2019-07-13 10:50:41 -07:00
returnDefaults : boolean ,
returnNoneDisplayed : boolean ,
2024-01-04 00:21:36 -08:00
node : Pick < INode , ' typeVersion ' > | null ,
2019-07-13 10:50:41 -07:00
onlySimpleTypes = false ,
dataIsResolved = false ,
nodeValuesRoot? : INodeParameters ,
parentType? : string ,
parameterDependencies? : IParameterDependencies ,
) : INodeParameters | null {
if ( parameterDependencies === undefined ) {
2022-11-23 07:20:28 -08:00
parameterDependencies = getParameterDependencies ( nodePropertiesArray ) ;
2019-07-13 10:50:41 -07:00
}
2019-07-12 11:58:52 -07:00
// Get the parameter names which get used multiple times as for this
// ones we have to always check which ones get displayed and which ones not
const duplicateParameterNames : string [ ] = [ ] ;
const parameterNames : string [ ] = [ ] ;
for ( const nodeProperties of nodePropertiesArray ) {
if ( parameterNames . includes ( nodeProperties . name ) ) {
if ( ! duplicateParameterNames . includes ( nodeProperties . name ) ) {
duplicateParameterNames . push ( nodeProperties . name ) ;
}
} else {
parameterNames . push ( nodeProperties . name ) ;
}
}
2019-06-23 03:35:23 -07:00
const nodeParameters : INodeParameters = { } ;
2019-07-13 10:50:41 -07:00
const nodeParametersFull : INodeParameters = { } ;
2019-06-23 03:35:23 -07:00
2019-07-13 10:50:41 -07:00
let nodeValuesDisplayCheck = nodeParametersFull ;
2019-06-23 03:35:23 -07:00
if ( ! dataIsResolved && ! returnNoneDisplayed ) {
2019-07-13 10:50:41 -07:00
nodeValuesDisplayCheck = getNodeParameters (
nodePropertiesArray ,
nodeValues ,
true ,
true ,
2022-04-28 10:04:09 -07:00
node ,
2019-07-13 10:50:41 -07:00
true ,
true ,
nodeValuesRoot ,
parentType ,
parameterDependencies ,
) as INodeParameters ;
2019-06-23 03:35:23 -07:00
}
nodeValuesRoot = nodeValuesRoot || nodeValuesDisplayCheck ;
2019-07-13 10:50:41 -07:00
// Go through the parameters in order of their dependencies
2023-11-13 03:28:55 -08:00
const parameterIterationOrderIndex = getParameterResolveOrder (
2021-08-29 04:58:20 -07:00
nodePropertiesArray ,
parameterDependencies ,
) ;
2019-07-13 10:50:41 -07:00
2023-11-13 03:28:55 -08:00
for ( const parameterIndex of parameterIterationOrderIndex ) {
2019-07-13 10:50:41 -07:00
const nodeProperties = nodePropertiesArray [ parameterIndex ] ;
2019-06-23 03:35:23 -07:00
if (
2023-11-13 03:28:55 -08:00
! nodeValues ||
( nodeValues [ nodeProperties . name ] === undefined &&
( ! returnDefaults || parentType === 'collection' ) )
2019-06-23 03:35:23 -07:00
) {
// The value is not defined so go to the next
continue ;
}
if (
! returnNoneDisplayed &&
2022-04-28 10:04:09 -07:00
! displayParameter ( nodeValuesDisplayCheck , nodeProperties , node , nodeValuesRoot )
2019-06-23 03:35:23 -07:00
) {
if ( ! returnNoneDisplayed || ! returnDefaults ) {
continue ;
}
}
if ( ! [ 'collection' , 'fixedCollection' ] . includes ( nodeProperties . type ) ) {
// Is a simple property so can be set as it is
2019-07-12 11:58:52 -07:00
if ( duplicateParameterNames . includes ( nodeProperties . name ) ) {
2022-04-28 10:04:09 -07:00
if ( ! displayParameter ( nodeValuesDisplayCheck , nodeProperties , node , nodeValuesRoot ) ) {
2019-07-12 11:58:52 -07:00
continue ;
}
}
2019-06-23 03:35:23 -07:00
if ( returnDefaults ) {
// Set also when it has the default value
2019-11-30 15:24:25 -08:00
if ( [ 'boolean' , 'number' , 'options' ] . includes ( nodeProperties . type ) ) {
// Boolean, numbers and options are special as false and 0 are valid values
2019-06-23 03:35:23 -07:00
// and should not be replaced with default value
nodeParameters [ nodeProperties . name ] =
nodeValues [ nodeProperties . name ] !== undefined
? nodeValues [ nodeProperties . name ]
: nodeProperties . default ;
2022-11-02 02:37:49 -07:00
} else if (
nodeProperties . type === 'resourceLocator' &&
typeof nodeProperties . default === 'object'
) {
nodeParameters [ nodeProperties . name ] =
nodeValues [ nodeProperties . name ] !== undefined
? nodeValues [ nodeProperties . name ]
: { __rl : true , . . . nodeProperties . default } ;
2019-06-23 03:35:23 -07:00
} else {
nodeParameters [ nodeProperties . name ] =
2023-08-02 04:19:01 -07:00
nodeValues [ nodeProperties . name ] ? ? nodeProperties . default ;
2019-06-23 03:35:23 -07:00
}
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2021-05-19 16:07:26 -07:00
} else if (
( nodeValues [ nodeProperties . name ] !== nodeProperties . default &&
typeof nodeValues [ nodeProperties . name ] !== 'object' ) ||
( typeof nodeValues [ nodeProperties . name ] === 'object' &&
! isEqual ( nodeValues [ nodeProperties . name ] , nodeProperties . default ) ) ||
( nodeValues [ nodeProperties . name ] !== undefined && parentType === 'collection' )
) {
2019-06-23 03:35:23 -07:00
// Set only if it is different to the default value
nodeParameters [ nodeProperties . name ] = nodeValues [ nodeProperties . name ] ;
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2019-06-23 03:35:23 -07:00
continue ;
}
}
if ( onlySimpleTypes ) {
// It is only supposed to resolve the simple types. So continue.
continue ;
}
// Is a complex property so check lower levels
let tempValue : INodeParameters | null ;
if ( nodeProperties . type === 'collection' ) {
// Is collection
if (
nodeProperties . typeOptions !== undefined &&
nodeProperties . typeOptions . multipleValues === true
) {
// Multiple can be set so will be an array
// Return directly the values like they are
if ( nodeValues [ nodeProperties . name ] !== undefined ) {
nodeParameters [ nodeProperties . name ] = nodeValues [ nodeProperties . name ] ;
} else if ( returnDefaults ) {
2021-05-19 16:44:27 -07:00
// Does not have values defined but defaults should be returned
2021-05-19 17:26:29 -07:00
if ( Array . isArray ( nodeProperties . default ) ) {
2022-10-21 08:24:58 -07:00
nodeParameters [ nodeProperties . name ] = deepCopy ( nodeProperties . default ) ;
2021-05-19 17:26:29 -07:00
} else {
// As it is probably wrong for many nodes, do we keep on returning an empty array if
// anything else than an array is set as default
nodeParameters [ nodeProperties . name ] = [ ] ;
}
2019-06-23 03:35:23 -07:00
}
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2019-06-23 03:35:23 -07:00
} else if ( nodeValues [ nodeProperties . name ] !== undefined ) {
// Has values defined so get them
const tempNodeParameters = getNodeParameters (
nodeProperties . options as INodeProperties [ ] ,
nodeValues [ nodeProperties . name ] as INodeParameters ,
returnDefaults ,
returnNoneDisplayed ,
2022-04-28 10:04:09 -07:00
node ,
2019-06-23 03:35:23 -07:00
false ,
false ,
nodeValuesRoot ,
nodeProperties . type ,
) ;
2021-08-29 11:58:11 -07:00
2019-06-23 03:35:23 -07:00
if ( tempNodeParameters !== null ) {
nodeParameters [ nodeProperties . name ] = tempNodeParameters ;
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2019-06-23 03:35:23 -07:00
}
} else if ( returnDefaults ) {
// Does not have values defined but defaults should be returned
2022-10-21 08:24:58 -07:00
nodeParameters [ nodeProperties . name ] = deepCopy ( nodeProperties . default ) ;
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2019-06-23 03:35:23 -07:00
}
} else if ( nodeProperties . type === 'fixedCollection' ) {
// Is fixedCollection
const collectionValues : INodeParameters = { } ;
let tempNodeParameters : INodeParameters ;
let tempNodePropertiesArray : INodeProperties [ ] ;
let nodePropertyOptions : INodePropertyCollection | undefined ;
let propertyValues = nodeValues [ nodeProperties . name ] ;
if ( returnDefaults ) {
if ( propertyValues === undefined ) {
2022-10-21 08:24:58 -07:00
propertyValues = deepCopy ( nodeProperties . default ) ;
2019-06-23 03:35:23 -07:00
}
}
2022-05-15 10:28:42 -07:00
if (
! returnDefaults &&
nodeProperties . typeOptions ? . multipleValues === false &&
propertyValues &&
Object . keys ( propertyValues ) . length === 0
) {
// For fixedCollections, which only allow one value, it is important to still return
// the empty object which indicates that a value got added, even if it does not have
// anything set. If that is not done, the value would get lost.
return nodeValues ;
}
2021-01-23 11:00:32 -08:00
// Iterate over all collections
2020-10-26 01:26:07 -07:00
for ( const itemName of Object . keys ( propertyValues || { } ) ) {
2019-06-23 03:35:23 -07:00
if (
nodeProperties . typeOptions !== undefined &&
nodeProperties . typeOptions . multipleValues === true
) {
// Multiple can be set so will be an array
const tempArrayValue : INodeParameters [ ] = [ ] ;
2021-01-23 11:00:32 -08:00
// Iterate over all items as it contains multiple ones
2019-06-23 03:35:23 -07:00
for ( const nodeValue of ( propertyValues as INodeParameters ) [
itemName
] as INodeParameters [ ] ) {
nodePropertyOptions = nodeProperties . options ! . find (
// eslint-disable-next-line @typescript-eslint/no-shadow
( nodePropertyOptions ) = > nodePropertyOptions . name === itemName ,
) as INodePropertyCollection ;
if ( nodePropertyOptions === undefined ) {
2023-11-30 03:46:45 -08:00
throw new ApplicationError ( 'Could not find property option' , {
extra : { propertyOption : itemName , property : nodeProperties.name } ,
} ) ;
2019-06-23 03:35:23 -07:00
}
tempNodePropertiesArray = nodePropertyOptions . values ! ;
tempValue = getNodeParameters (
tempNodePropertiesArray ,
nodeValue ,
returnDefaults ,
returnNoneDisplayed ,
2022-04-28 10:04:09 -07:00
node ,
2019-06-23 03:35:23 -07:00
false ,
false ,
nodeValuesRoot ,
nodeProperties . type ,
) ;
if ( tempValue !== null ) {
tempArrayValue . push ( tempValue ) ;
}
}
collectionValues [ itemName ] = tempArrayValue ;
} else {
// Only one can be set so is an object of objects
tempNodeParameters = { } ;
// Get the options of the current item
// eslint-disable-next-line @typescript-eslint/no-shadow
const nodePropertyOptions = nodeProperties . options ! . find (
( data ) = > data . name === itemName ,
) ;
if ( nodePropertyOptions !== undefined ) {
tempNodePropertiesArray = ( nodePropertyOptions as INodePropertyCollection ) . values ! ;
tempValue = getNodeParameters (
tempNodePropertiesArray ,
( nodeValues [ nodeProperties . name ] as INodeParameters ) [ itemName ] as INodeParameters ,
returnDefaults ,
returnNoneDisplayed ,
2022-04-28 10:04:09 -07:00
node ,
2019-06-23 03:35:23 -07:00
false ,
false ,
nodeValuesRoot ,
nodeProperties . type ,
) ;
if ( tempValue !== null ) {
Object . assign ( tempNodeParameters , tempValue ) ;
}
}
if ( Object . keys ( tempNodeParameters ) . length !== 0 ) {
collectionValues [ itemName ] = tempNodeParameters ;
}
}
}
2022-05-15 10:28:42 -07:00
if (
! returnDefaults &&
nodeProperties . typeOptions ? . multipleValues === false &&
collectionValues &&
Object . keys ( collectionValues ) . length === 0 &&
propertyValues &&
propertyValues ? . constructor . name === 'Object' &&
Object . keys ( propertyValues ) . length !== 0
) {
// For fixedCollections, which only allow one value, it is important to still return
// the object with an empty collection property which indicates that a value got added
// which contains all default values. If that is not done, the value would get lost.
const returnValue = { } as INodeParameters ;
Object . keys ( propertyValues || { } ) . forEach ( ( value ) = > {
returnValue [ value ] = { } ;
} ) ;
2022-06-11 09:12:04 -07:00
nodeParameters [ nodeProperties . name ] = returnValue ;
2022-05-15 10:28:42 -07:00
}
2019-06-23 03:35:23 -07:00
if ( Object . keys ( collectionValues ) . length !== 0 || returnDefaults ) {
// Set only if value got found
if ( returnDefaults ) {
// Set also when it has the default value
if ( collectionValues === undefined ) {
2022-10-21 08:24:58 -07:00
nodeParameters [ nodeProperties . name ] = deepCopy ( nodeProperties . default ) ;
2019-06-23 03:35:23 -07:00
} else {
nodeParameters [ nodeProperties . name ] = collectionValues ;
}
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2019-06-23 03:35:23 -07:00
} else if ( collectionValues !== nodeProperties . default ) {
// Set only if values got found and it is not the default
nodeParameters [ nodeProperties . name ] = collectionValues ;
2019-07-13 10:50:41 -07:00
nodeParametersFull [ nodeProperties . name ] = nodeParameters [ nodeProperties . name ] ;
2019-06-23 03:35:23 -07:00
}
}
}
}
return nodeParameters ;
}
/ * *
* Returns all the webhooks which should be created for the give node
* /
2021-08-21 05:11:32 -07:00
export function getNodeWebhooks (
workflow : Workflow ,
node : INode ,
additionalData : IWorkflowExecuteAdditionalData ,
2022-09-02 07:13:17 -07:00
ignoreRestartWebhooks = false ,
2021-08-21 05:11:32 -07:00
) : IWebhookData [ ] {
2019-06-23 03:35:23 -07:00
if ( node . disabled === true ) {
// Node is disabled so webhooks will also not be enabled
return [ ] ;
}
2022-11-30 03:16:19 -08:00
const nodeType = workflow . nodeTypes . getByNameAndVersion ( node . type , node . typeVersion ) ;
2019-06-23 03:35:23 -07:00
if ( nodeType . description . webhooks === undefined ) {
// Node does not have any webhooks so return
return [ ] ;
}
2020-05-03 08:55:14 -07:00
const workflowId = workflow . id || '__UNSAVED__' ;
2021-01-29 00:31:40 -08:00
const mode = 'internal' ;
2020-05-03 08:55:14 -07:00
2019-06-23 03:35:23 -07:00
const returnData : IWebhookData [ ] = [ ] ;
for ( const webhookDescription of nodeType . description . webhooks ) {
2022-09-02 07:13:17 -07:00
if ( ignoreRestartWebhooks && webhookDescription . restartWebhook === true ) {
2021-08-21 05:11:32 -07:00
continue ;
}
let nodeWebhookPath = workflow . expression . getSimpleParameterValue (
node ,
webhookDescription . path ,
mode ,
{ } ,
) ;
2019-06-23 03:35:23 -07:00
if ( nodeWebhookPath === undefined ) {
// TODO: Use a proper logger
2020-05-03 08:55:14 -07:00
console . error (
` No webhook path could be found for node " ${ node . name } " in workflow " ${ workflowId } ". ` ,
) ;
2019-06-23 03:35:23 -07:00
continue ;
}
2019-08-01 09:22:48 -07:00
nodeWebhookPath = nodeWebhookPath . toString ( ) ;
2021-02-09 00:14:40 -08:00
if ( nodeWebhookPath . startsWith ( '/' ) ) {
2019-06-23 03:35:23 -07:00
nodeWebhookPath = nodeWebhookPath . slice ( 1 ) ;
}
2021-02-09 00:14:40 -08:00
if ( nodeWebhookPath . endsWith ( '/' ) ) {
nodeWebhookPath = nodeWebhookPath . slice ( 0 , - 1 ) ;
}
2019-06-23 03:35:23 -07:00
2021-08-21 05:11:32 -07:00
const isFullPath : boolean = workflow . expression . getSimpleParameterValue (
node ,
webhookDescription . isFullPath ,
'internal' ,
{ } ,
2022-06-03 08:25:07 -07:00
undefined ,
2021-08-21 05:11:32 -07:00
false ,
) as boolean ;
const restartWebhook : boolean = workflow . expression . getSimpleParameterValue (
node ,
webhookDescription . restartWebhook ,
'internal' ,
{ } ,
2022-06-03 08:25:07 -07:00
undefined ,
2021-08-21 05:11:32 -07:00
false ,
) as boolean ;
const path = getNodeWebhookPath ( workflowId , node , nodeWebhookPath , isFullPath , restartWebhook ) ;
2019-06-23 03:35:23 -07:00
2024-04-23 22:46:16 -07:00
const webhookMethods = workflow . expression . getSimpleParameterValue (
2021-08-21 05:11:32 -07:00
node ,
webhookDescription . httpMethod ,
mode ,
{ } ,
2022-06-03 08:25:07 -07:00
undefined ,
2021-08-21 05:11:32 -07:00
'GET' ,
) ;
2019-06-23 03:35:23 -07:00
2024-04-23 22:46:16 -07:00
if ( webhookMethods === undefined ) {
2019-06-23 03:35:23 -07:00
// TODO: Use a proper logger
2020-05-03 08:55:14 -07:00
console . error (
` The webhook " ${ path } " for node " ${ node . name } " in workflow " ${ workflowId } " could not be added because the httpMethod is not defined. ` ,
) ;
2019-06-23 03:35:23 -07:00
continue ;
}
2021-01-23 11:00:32 -08:00
let webhookId : string | undefined ;
if ( ( path . startsWith ( ':' ) || path . includes ( '/:' ) ) && node . webhookId ) {
webhookId = node . webhookId ;
}
2024-04-23 22:46:16 -07:00
String ( webhookMethods )
. split ( ',' )
. forEach ( ( httpMethod ) = > {
if ( ! httpMethod ) return ;
returnData . push ( {
httpMethod : httpMethod.trim ( ) as IHttpRequestMethods ,
node : node.name ,
path ,
webhookDescription ,
workflowId ,
workflowExecuteAdditionalData : additionalData ,
webhookId ,
} ) ;
} ) ;
2019-06-23 03:35:23 -07:00
}
return returnData ;
}
/ * *
* Returns the webhook path
*
* /
2021-08-21 05:11:32 -07:00
export function getNodeWebhookPath (
workflowId : string ,
node : INode ,
path : string ,
isFullPath? : boolean ,
restartWebhook? : boolean ,
) : string {
2020-05-27 16:32:49 -07:00
let webhookPath = '' ;
2021-08-21 05:11:32 -07:00
if ( restartWebhook === true ) {
return path ;
}
if ( node . webhookId === undefined ) {
2020-05-27 16:32:49 -07:00
webhookPath = ` ${ workflowId } / ${ encodeURIComponent ( node . name . toLowerCase ( ) ) } / ${ path } ` ;
} else {
2020-06-10 06:39:15 -07:00
if ( isFullPath === true ) {
2020-05-27 16:32:49 -07:00
return path ;
}
2020-06-10 07:17:16 -07:00
webhookPath = ` ${ node . webhookId } / ${ path } ` ;
2020-05-27 16:32:49 -07:00
}
return webhookPath ;
2019-06-23 03:35:23 -07:00
}
/ * *
* Returns the webhook URL
*
* /
2020-06-10 06:39:15 -07:00
export function getNodeWebhookUrl (
baseUrl : string ,
workflowId : string ,
node : INode ,
path : string ,
isFullPath? : boolean ,
) : string {
2021-01-23 11:00:32 -08:00
if ( ( path . startsWith ( ':' ) || path . includes ( '/:' ) ) && node . webhookId ) {
// setting this to false to prefix the webhookId
isFullPath = false ;
}
if ( path . startsWith ( '/' ) ) {
path = path . slice ( 1 ) ;
}
2020-06-10 06:39:15 -07:00
return ` ${ baseUrl } / ${ getNodeWebhookPath ( workflowId , node , path , isFullPath ) } ` ;
2019-06-23 03:35:23 -07:00
}
2023-10-02 08:33:43 -07:00
export function getConnectionTypes (
2024-08-29 06:55:53 -07:00
connections : Array < NodeConnectionType | INodeInputConfiguration | INodeOutputConfiguration > ,
) : NodeConnectionType [ ] {
2023-10-02 08:33:43 -07:00
return connections
. map ( ( connection ) = > {
if ( typeof connection === 'string' ) {
return connection ;
}
return connection . type ;
} )
. filter ( ( connection ) = > connection !== undefined ) ;
}
export function getNodeInputs (
workflow : Workflow ,
node : INode ,
nodeTypeData : INodeTypeDescription ,
2024-08-29 06:55:53 -07:00
) : Array < NodeConnectionType | INodeInputConfiguration > {
2023-10-25 05:34:47 -07:00
if ( Array . isArray ( nodeTypeData ? . inputs ) ) {
2023-10-02 08:33:43 -07:00
return nodeTypeData . inputs ;
}
// Calculate the outputs dynamically
try {
return ( workflow . expression . getSimpleParameterValue (
node ,
nodeTypeData . inputs ,
'internal' ,
{ } ,
2024-08-29 06:55:53 -07:00
) || [ ] ) as NodeConnectionType [ ] ;
2023-10-02 08:33:43 -07:00
} catch ( e ) {
2024-03-11 02:34:59 -07:00
console . warn ( 'Could not calculate inputs dynamically for node: ' , node . name ) ;
return [ ] ;
2023-10-02 08:33:43 -07:00
}
}
2024-05-13 05:46:02 -07:00
export function getNodeHints (
workflow : Workflow ,
node : INode ,
nodeTypeData : INodeTypeDescription ,
2024-05-22 03:35:29 -07:00
nodeInputData ? : {
runExecutionData : IRunExecutionData | null ;
runIndex : number ;
connectionInputData : INodeExecutionData [ ] ;
} ,
2024-05-13 05:46:02 -07:00
) : NodeHint [ ] {
const hints : NodeHint [ ] = [ ] ;
if ( nodeTypeData ? . hints ? . length ) {
for ( const hint of nodeTypeData . hints ) {
if ( hint . displayCondition ) {
try {
2024-05-22 03:35:29 -07:00
let display ;
if ( nodeInputData === undefined ) {
display = ( workflow . expression . getSimpleParameterValue (
node ,
hint . displayCondition ,
'internal' ,
{ } ,
) || false ) as boolean ;
} else {
const { runExecutionData , runIndex , connectionInputData } = nodeInputData ;
display = workflow . expression . getParameterValue (
hint . displayCondition ,
runExecutionData ? ? null ,
runIndex ,
0 ,
node . name ,
connectionInputData ,
'manual' ,
{ } ,
) ;
}
if ( typeof display === 'string' && display . trim ( ) === 'true' ) {
display = true ;
}
2024-05-13 05:46:02 -07:00
if ( typeof display !== 'boolean' ) {
console . warn (
` Condition was not resolved as boolean in ' ${ node . name } ' node for hint: ` ,
hint . message ,
) ;
continue ;
}
if ( display ) {
hints . push ( hint ) ;
}
} catch ( e ) {
console . warn (
` Could not calculate display condition in ' ${ node . name } ' node for hint: ` ,
hint . message ,
) ;
}
} else {
hints . push ( hint ) ;
}
}
}
return hints ;
}
2023-10-02 08:33:43 -07:00
export function getNodeOutputs (
workflow : Workflow ,
node : INode ,
nodeTypeData : INodeTypeDescription ,
2024-08-29 06:55:53 -07:00
) : Array < NodeConnectionType | INodeOutputConfiguration > {
let outputs : Array < NodeConnectionType | INodeOutputConfiguration > = [ ] ;
2023-10-30 10:42:47 -07:00
2023-10-02 08:33:43 -07:00
if ( Array . isArray ( nodeTypeData . outputs ) ) {
2023-10-30 10:42:47 -07:00
outputs = nodeTypeData . outputs ;
} else {
// Calculate the outputs dynamically
try {
outputs = ( workflow . expression . getSimpleParameterValue (
node ,
nodeTypeData . outputs ,
'internal' ,
{ } ,
2024-08-29 06:55:53 -07:00
) || [ ] ) as NodeConnectionType [ ] ;
2023-10-30 10:42:47 -07:00
} catch ( e ) {
2024-03-11 02:34:59 -07:00
console . warn ( 'Could not calculate outputs dynamically for node: ' , node . name ) ;
2023-10-30 10:42:47 -07:00
}
2023-10-02 08:33:43 -07:00
}
2023-10-30 10:42:47 -07:00
if ( node . onError === 'continueErrorOutput' ) {
// Copy the data to make sure that we do not change the data of the
// node type and so change the displayNames for all nodes in the flow
outputs = deepCopy ( outputs ) ;
if ( outputs . length === 1 ) {
// Set the displayName to "Success"
if ( typeof outputs [ 0 ] === 'string' ) {
outputs [ 0 ] = {
type : outputs [ 0 ] ,
} ;
}
outputs [ 0 ] . displayName = 'Success' ;
}
return [
. . . outputs ,
{
category : 'error' ,
2024-08-29 06:55:53 -07:00
type : NodeConnectionType . Main ,
2023-10-30 10:42:47 -07:00
displayName : 'Error' ,
} ,
] ;
2023-10-02 08:33:43 -07:00
}
2023-10-30 10:42:47 -07:00
return outputs ;
2023-10-02 08:33:43 -07:00
}
2019-06-23 03:35:23 -07:00
/ * *
* Returns all the parameter - issues of the node
*
* @param { INodeProperties [ ] } nodePropertiesArray The properties of the node
* @param { INode } node The data of the node
* /
export function getNodeParametersIssues (
nodePropertiesArray : INodeProperties [ ] ,
node : INode ,
2022-07-20 08:50:39 -07:00
pinDataNodeNames? : string [ ] ,
2019-06-23 03:35:23 -07:00
) : INodeIssues | null {
const foundIssues : INodeIssues = { } ;
let propertyIssues : INodeIssues ;
2022-07-20 08:50:39 -07:00
if ( node . disabled === true || pinDataNodeNames ? . includes ( node . name ) ) {
// Ignore issues on disabled and pindata nodes
2019-07-07 10:17:34 -07:00
return null ;
}
2019-06-23 03:35:23 -07:00
for ( const nodeProperty of nodePropertiesArray ) {
2022-04-28 10:04:09 -07:00
propertyIssues = getParameterIssues ( nodeProperty , node . parameters , '' , node ) ;
2019-06-23 03:35:23 -07:00
mergeIssues ( foundIssues , propertyIssues ) ;
}
if ( Object . keys ( foundIssues ) . length === 0 ) {
return null ;
}
return foundIssues ;
}
/ * *
* Returns the issues of the node as string
*
* @param { INodeIssues } issues The issues of the node
* @param { INode } node The node
* /
export function nodeIssuesToString ( issues : INodeIssues , node? : INode ) : string [ ] {
const nodeIssues = [ ] ;
if ( issues . execution !== undefined ) {
2022-12-29 03:20:43 -08:00
nodeIssues . push ( 'Execution Error.' ) ;
2019-06-23 03:35:23 -07:00
}
2023-10-02 08:33:43 -07:00
const objectProperties = [ 'parameters' , 'credentials' , 'input' ] ;
2019-06-23 03:35:23 -07:00
let issueText : string ;
let parameterName : string ;
for ( const propertyName of objectProperties ) {
if ( issues [ propertyName ] !== undefined ) {
for ( parameterName of Object . keys ( issues [ propertyName ] as object ) ) {
for ( issueText of ( issues [ propertyName ] as INodeIssueObjectProperty ) [ parameterName ] ) {
nodeIssues . push ( issueText ) ;
}
}
}
}
if ( issues . typeUnknown !== undefined ) {
if ( node !== undefined ) {
nodeIssues . push ( ` Node Type " ${ node . type } " is not known. ` ) ;
} else {
2022-12-29 03:20:43 -08:00
nodeIssues . push ( 'Node Type is not known.' ) ;
2019-06-23 03:35:23 -07:00
}
}
return nodeIssues ;
}
2022-09-21 06:44:45 -07:00
/ *
* Validates resource locator node parameters based on validation ruled defined in each parameter mode
*
* /
export const validateResourceLocatorParameter = (
value : INodeParameterResourceLocator ,
parameterMode : INodePropertyMode ,
) : string [ ] = > {
const valueToValidate = value ? . value ? . toString ( ) || '' ;
if ( valueToValidate . startsWith ( '=' ) ) {
return [ ] ;
}
const validationErrors : string [ ] = [ ] ;
// Each mode can have multiple validations specified
if ( parameterMode . validation ) {
for ( const validation of parameterMode . validation ) {
if ( validation && ( validation as INodePropertyModeValidation ) . type === 'regex' ) {
const regexValidation = validation as INodePropertyRegexValidation ;
const regex = new RegExp ( ` ^ ${ regexValidation . properties . regex } $ ` ) ;
if ( ! regex . test ( valueToValidate ) ) {
validationErrors . push ( regexValidation . properties . errorMessage ) ;
}
}
}
}
return validationErrors ;
} ;
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
/ *
* Validates resource mapper values based on service schema
*
* /
export const validateResourceMapperParameter = (
nodeProperties : INodeProperties ,
value : ResourceMapperValue ,
skipRequiredCheck = false ,
) : Record < string , string [ ] > = > {
2024-01-05 03:37:33 -08:00
// No issues to raise in automatic mapping mode, no user input to validate
if ( value . mappingMode === 'autoMapInputData' ) {
return { } ;
}
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
const issues : Record < string , string [ ] > = { } ;
let fieldWordSingular =
nodeProperties . typeOptions ? . resourceMapper ? . fieldWords ? . singular || 'Field' ;
fieldWordSingular = fieldWordSingular . charAt ( 0 ) . toUpperCase ( ) + fieldWordSingular . slice ( 1 ) ;
value . schema . forEach ( ( field ) = > {
const fieldValue = value . value ? value . value [ field . id ] : null ;
const key = ` ${ nodeProperties . name } . ${ field . id } ` ;
const fieldErrors : string [ ] = [ ] ;
if ( field . required && ! skipRequiredCheck ) {
2023-07-31 02:00:48 -07:00
if ( value . value === null || fieldValue === undefined ) {
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
const error = ` ${ fieldWordSingular } " ${ field . id } " is required ` ;
fieldErrors . push ( error ) ;
}
}
if ( ! fieldValue ? . toString ( ) . startsWith ( '=' ) && field . type ) {
2023-12-13 05:45:22 -08:00
const validationResult = validateFieldType ( field . id , fieldValue , field . type , {
valueOptions : field.options ,
} ) ;
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
if ( ! validationResult . valid && validationResult . errorMessage ) {
fieldErrors . push ( validationResult . errorMessage ) ;
}
}
if ( fieldErrors . length > 0 ) {
issues [ key ] = fieldErrors ;
}
} ) ;
return issues ;
} ;
2023-09-19 03:16:35 -07:00
export const validateParameter = (
nodeProperties : INodeProperties ,
value : GenericValue ,
type : FieldType ,
) : string | undefined = > {
const nodeName = nodeProperties . name ;
const options = type === 'options' ? nodeProperties.options : undefined ;
if ( ! value ? . toString ( ) . startsWith ( '=' ) ) {
2023-12-13 05:45:22 -08:00
const validationResult = validateFieldType ( nodeName , value , type , {
valueOptions : options as INodePropertyOptions [ ] ,
} ) ;
2023-09-19 03:16:35 -07:00
if ( ! validationResult . valid && validationResult . errorMessage ) {
return validationResult . errorMessage ;
}
}
return undefined ;
} ;
2019-06-23 03:35:23 -07:00
/ * *
* Adds an issue if the parameter is not defined
*
* @param { INodeIssues } foundIssues The already found issues
* @param { INodeProperties } nodeProperties The properties of the node
* @param { NodeParameterValue } value The value of the parameter
* /
export function addToIssuesIfMissing (
foundIssues : INodeIssues ,
nodeProperties : INodeProperties ,
2022-09-21 06:44:45 -07:00
value : NodeParameterValue | INodeParameterResourceLocator ,
2019-06-23 03:35:23 -07:00
) {
// TODO: Check what it really has when undefined
if (
( nodeProperties . type === 'string' && ( value === '' || value === undefined ) ) ||
( nodeProperties . type === 'multiOptions' && Array . isArray ( value ) && value . length === 0 ) ||
2022-06-20 12:39:24 -07:00
( nodeProperties . type === 'dateTime' && value === undefined ) ||
2022-09-21 06:44:45 -07:00
( nodeProperties . type === 'options' && ( value === '' || value === undefined ) ) ||
2024-08-22 07:59:12 -07:00
( ( nodeProperties . type === 'resourceLocator' || nodeProperties . type === 'workflowSelector' ) &&
2022-11-16 00:21:30 -08:00
! isValidResourceLocatorParameterValue ( value as INodeParameterResourceLocator ) )
2019-06-23 03:35:23 -07:00
) {
2022-09-02 07:13:17 -07:00
// Parameter is required but empty
2019-06-23 03:35:23 -07:00
if ( foundIssues . parameters === undefined ) {
foundIssues . parameters = { } ;
}
if ( foundIssues . parameters [ nodeProperties . name ] === undefined ) {
foundIssues . parameters [ nodeProperties . name ] = [ ] ;
}
foundIssues . parameters [ nodeProperties . name ] . push (
` Parameter " ${ nodeProperties . displayName } " is required. ` ,
) ;
}
}
/ * *
* Returns the parameter value
*
* @param { INodeParameters } nodeValues The values of the node
* @param { string } parameterName The name of the parameter to return the value of
* @param { string } path The path to the properties
* /
export function getParameterValueByPath (
nodeValues : INodeParameters ,
parameterName : string ,
path : string ,
) {
2020-10-22 09:00:28 -07:00
return get ( nodeValues , path ? ` ${ path } . ${ parameterName } ` : parameterName ) ;
2019-06-23 03:35:23 -07:00
}
2022-09-21 06:44:45 -07:00
function isINodeParameterResourceLocator ( value : unknown ) : value is INodeParameterResourceLocator {
return typeof value === 'object' && value !== null && 'value' in value && 'mode' in value ;
}
2019-06-23 03:35:23 -07:00
/ * *
* Returns all the issues with the given node - values
*
* @param { INodeProperties } nodeProperties The properties of the node
* @param { INodeParameters } nodeValues The values of the node
* @param { string } path The path to the properties
* /
2024-04-10 05:02:02 -07:00
// eslint-disable-next-line complexity
2019-06-23 03:35:23 -07:00
export function getParameterIssues (
nodeProperties : INodeProperties ,
nodeValues : INodeParameters ,
path : string ,
2022-04-28 10:04:09 -07:00
node : INode ,
2019-06-23 03:35:23 -07:00
) : INodeIssues {
const foundIssues : INodeIssues = { } ;
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
const isDisplayed = displayParameterPath ( nodeValues , nodeProperties , path , node ) ;
2019-06-23 03:35:23 -07:00
if ( nodeProperties . required === true ) {
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
if ( isDisplayed ) {
2022-09-21 06:44:45 -07:00
const value = getParameterValueByPath ( nodeValues , nodeProperties . name , path ) ;
2019-06-23 03:35:23 -07:00
if (
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
nodeProperties . typeOptions !== undefined &&
nodeProperties . typeOptions . multipleValues !== undefined
) {
// Multiple can be set so will be an array
if ( Array . isArray ( value ) ) {
for ( const singleValue of value as NodeParameterValue [ ] ) {
addToIssuesIfMissing ( foundIssues , nodeProperties , singleValue ) ;
}
}
} else {
// Only one can be set so will be a single value
addToIssuesIfMissing ( foundIssues , nodeProperties , value as NodeParameterValue ) ;
}
}
}
2024-08-22 07:59:12 -07:00
if (
( nodeProperties . type === 'resourceLocator' || nodeProperties . type === 'workflowSelector' ) &&
isDisplayed
) {
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
const value = getParameterValueByPath ( nodeValues , nodeProperties . name , path ) ;
if ( isINodeParameterResourceLocator ( value ) ) {
const mode = nodeProperties . modes ? . find ( ( option ) = > option . name === value . mode ) ;
if ( mode ) {
const errors = validateResourceLocatorParameter ( value , mode ) ;
errors . forEach ( ( error ) = > {
if ( foundIssues . parameters === undefined ) {
foundIssues . parameters = { } ;
}
if ( foundIssues . parameters [ nodeProperties . name ] === undefined ) {
foundIssues . parameters [ nodeProperties . name ] = [ ] ;
}
2022-09-21 06:44:45 -07:00
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
foundIssues . parameters [ nodeProperties . name ] . push ( error ) ;
} ) ;
}
}
} else if ( nodeProperties . type === 'resourceMapper' && isDisplayed ) {
const skipRequiredCheck = nodeProperties . typeOptions ? . resourceMapper ? . mode !== 'add' ;
const value = getParameterValueByPath ( nodeValues , nodeProperties . name , path ) ;
if ( isResourceMapperValue ( value ) ) {
const issues = validateResourceMapperParameter ( nodeProperties , value , skipRequiredCheck ) ;
if ( Object . keys ( issues ) . length > 0 ) {
if ( foundIssues . parameters === undefined ) {
foundIssues . parameters = { } ;
}
if ( foundIssues . parameters [ nodeProperties . name ] === undefined ) {
foundIssues . parameters [ nodeProperties . name ] = [ ] ;
2022-09-21 06:44:45 -07:00
}
feat(editor): Implement Resource Mapper component (#6207)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* feat(Google Sheets Node): Implement Resource mapper in Google Sheets node (#5752)
* ✨ Added initial resource mapping support in google sheets node
* ✨ Wired mapping API endpoint with node-specific logic for fetching mapping fields
* ✨ Implementing mapping fields logic for google sheets
* ✨ Updating Google Sheets execute methods to support resource mapper fields
* 🚧 Added initial version of `ResourceLocator` component
* 👌 Added `update` mode to resource mapper modes
* 👌 Addressing PR feedback
* 👌 Removing leftover const reference
* 👕 Fixing lint errors
* :zap: singlton for conections
* :zap: credentials test fix, clean up
* feat(Postgres Node): Add resource mapper to new version of Postgres node (#5814)
* :zap: scaffolding
* :zap: finished scaffolding
* :zap: renamed types
* :zap: updated subtitle
* :zap: renamed functions file, UI updates
* :zap: query parameters fixes, ui updates, refactoring
* :zap: fixes for credentials test, setup for error parsing
* :zap: rlc for schema and table, error handling tweaks
* :zap: delete operation, new options
* :zap: columns loader
* :zap: linter fixes
* :zap: where clauses setup
* :zap: logic for processing where clauses
* :zap: select operation
* :zap: refactoring
* :zap: data mode for insert and update, wip
* :zap: data mapping, insert update, skip on conflict option
* :zap: select columns with spaces fix
* :zap: update operation update, wip
* :zap: finished update operation
* :zap: upsert operation
* :zap: ui fixes
* Copy updates.
* Copy updates.
* :zap: option to convert empty strings to nulls, schema checks
* :zap: UI requested updates
* :zap: ssh setup WIP
* :zap: fixes, ssh WIP
* :zap: ssh fixes, credentials
* :zap: credentials testing update
* :zap: uncaught error fix
* :zap: clean up
* :zap: address in use fix
* :zap: improved error message
* :zap: tests setup
* :zap: unit tests wip
* :zap: config files clean up
* :zap: utils unit tests
* :zap: refactoring
* :zap: setup for testing operations, tests for deleteTable operation
* :zap: executeQuery and insert operations tests
* :zap: select, update, upsert operations tests
* :zap: runQueries tests setup
* :zap: hint to query
* Copy updates.
* :zap: ui fixes
* :zap: clean up
* :zap: error message update
* :zap: ui update
* Minor tweaks to query params decription.
* ✨ Updated Postgres node to use resource mapper component
* ✨ Implemented postgres <-> resource mapper type mapping
* ✨ Updated Postgres node execution to use resource mapper fields in v3
* 🔥 Removing unused import
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
* feat(core): Resource editor componend P0 (#5970)
* ✨ Added inital value of mapping mode dropdown
* ✨ Finished mapping mode selector
* ✨ Finished implementing mapping mode selector
* ✨ Implemented 'Columns to match on' dropdown
* ✨ Implemented `loadOptionsDependOn` support in resource mapper
* ✨ Implemented initial version of mapping fields
* ✨ Implementing dependant fields watcher in new component setup
* ✨ Generating correct resource mapper field types. Added `supportAutoMap` to node specification and UI. Not showing fields with `display=false`. Pre-selecting matching columns if it's the only one
* ✨ Handling matching columns correctly in UI
* ✨ Saving and loading resourceMapper values in component
* ✨ Implemented proper data saving and loading
* ✨ ResourceMapper component refactor, fixing value save/load
* ✨ Refactoring MatchingColumnSelect component. Updating Sheets node to use single key match and Postgres to use multi key
* ✨ Updated Google Sheets node to work with the new UI
* ✨ Updating Postgres Node to work with new UI
* ✨ Additional loading indicator that shown if there is no mapping mode selector
* ✨ Removing hard-coded values, fixing matching columns ordering, refactoring
* ✨ Updating field names in nodes
* ✨ Fixing minor UI issues
* ✨ Implemented matching fields filter logic
* ✨ Moving loading label outside of fields list
* ✅ Added initial unit tests for resource mapper
* ✅ Finished default rendering test
* ✅ Test refactoring
* ✅ Finished unit tests
* 🔨 Updating the way i18n is used in resource mapper components
* ✔️ Fixing value to match on logic for postgres node
* ✨ Hiding mapping fields when auto-map mode is selected
* ✨ Syncing selected mapping mode between components
* ✨ Fixing dateTime input rendering and adding update check to Postgres node
* ✨ Properly handling database connections. Sending null for empty string values.
* 💄 Updated wording in the error message for non-existing rows
* ✨ Fixing issues with selected matching values
* ✔️ Updating unit tests after matching logic update
* ✨ Updating matching columns when new fields are loaded
* ✨ Defaulting to null for empty parameter values
* ✨ Allowing zero as valid value for number imputs
* ✨ Updated list of types that use datepicker as widger
* ✨ Using text inputs for time types
* ✨ Initial mapping field rework
* ✨ Added new component for mapping fields, moved bit of logic from root component to matching selector, fixing some lint errors
* ✨ Added tooltip for columns that cannot be deleted
* ✨ Saving deleted values in parameter value
* ✨ Implemented control to add/remove mapping fields
* ✨ Syncing field list with add field dropdown when changing dependent values
* ✨ Not showing removed fields in matching columns selector. Updating wording in matching columns selector description
* ✨ Implementing disabled states for add/remove all fields options
* ✨ Saving removed columns separately, updating copy
* ✨ Implemented resource mapper values validation
* ✨ Updated validation logic and error input styling
* ✨ Validating resource mapper fields when new nodes are added
* ✨ Using node field words in validation, refactoring resource mapper component
* ✨ Implemented schema syncing and add/remove all fields
* ✨ Implemented custom parameter actions
* ✨ Implemented loading indicator in parameter options
* 🔨 Removing unnecessary constants and vue props
* ✨ Handling default values properly
* ✨ Fixing validation logic
* 👕 Fixing lint errors
* ⚡ Fixing type issues
* ⚡ Not showing fields by default if `addAllFields` is set to `false`
* ✨ Implemented field type validation in resource mapper
* ✨ Updated casing in copy, removed all/remove all option from bottom menu
* ✨ Added auto mapping mode notice
* ✨ Added support for more types in validation
* ✨ Added support for enumerated values
* ✨ Fixing imports after merging
* ✨ Not showing removed fields in matching columns selector. Refactoring validation logic.
* 👕 Fixing imports
* ✔️ Updating unit tests
* ✅ Added resource mapper schema tests
* ⚡ Removing `match` from resource mapper field definition, fixing matching columns loading
* ⚡ Fixed schema merging
* :zap: update operation return data fix
* :zap: review
* 🐛 Added missing import
* 💄 Updating parameter actions icon based on the ui review
* 💄 Updating word capitalisation in tooltips
* 💄 Added empty state to mapping fields list
* 💄 Removing asterisk from fields, updating tooltips for matching fields
* ⚡ Preventing matching fields from being removed by 'Remove All option'
* ⚡ Not showing hidden fields in the `Add field` dropdown
* ⚡ Added support for custom matching columns labels
* :zap: query optimization
* :zap: fix
* ⚡ Optimizing Postgres node enumeration logic
* ⚡ Added empty state for matching columns
* ⚡ Only fully loading fields if there is no schema fetched
* ⚡ Hiding mapping fields if there is no matching columns available in the schema
* ✔️ Fixing minor issues
* ✨ Implemented runtime type validation
* 🔨 Refactoring validation logic
* ✨ Implemented required check, added more custom messages
* ✨ Skipping boolean type in required check
* Type check improvements
* ✨ Only reloading fields if dependent values actually change
* ✨ Adding item index to validation error title
* ✨ Updating Postgres fetching logic, using resource mapper mode to determine if a field can be deleted
* ✨ Resetting field values when adding them via the addAll option
* ⚡ Using minor version (2.2) for new Postgres node
* ⚡ Implemented proper date validation and type casting
* 👕 Consolidating typing
* ✅ Added unit tests for type validations
* 👌 Addressing front-end review comments
* ⚡ More refactoring to address review changes
* ⚡ Updating leftover props
* ⚡ Added fallback for ISO dates with invalid timezones
* Added timestamp to datetime test cases
* ⚡ Reseting matching columns if operation changes
* ⚡ Not forcing auto-increment fields to be filled in in Postgres node. Handling null values
* 💄 Added a custom message for invalid dates
* ⚡ Better handling of JSON values
* ⚡ Updating codemirror readonly stauts based on component property, handling objects in json validation
* Deleting leftover console.log
* ⚡ Better time validation
* ⚡ Fixing build error after merging
* 👕 Fixing lint error
* ⚡ Updating node configuration values
* ⚡ Handling postgres arrays better
* ⚡ Handling SQL array syntax
* ⚡ Updating time validation rules to include timezone
* ⚡ Sending expressions that resolve to `null` or `undefined` by the resource mapper to delete cell content in Google Sheets
* ⚡ Allowing removed fields to be selected for match
* ⚡ Updated the query for fetching unique columns and primary keys
* ⚡ Optimizing the unique query
* ⚡ Setting timezone to all parsed dates
* ⚡ Addressing PR review feedback
* ⚡ Configuring Sheets node for production, minor vue component update
* New cases added to the TypeValidation test.
* ✅ Tweaking validation rules for arrays/objects and updating test cases
---------
Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
2023-05-31 02:56:09 -07:00
foundIssues . parameters = { . . . foundIssues . parameters , . . . issues } ;
2022-09-21 06:44:45 -07:00
}
}
2023-12-13 05:45:22 -08:00
} else if ( nodeProperties . type === 'filter' && isDisplayed ) {
const value = getParameterValueByPath ( nodeValues , nodeProperties . name , path ) ;
if ( isFilterValue ( value ) ) {
const issues = validateFilterParameter ( nodeProperties , value ) ;
if ( Object . keys ( issues ) . length > 0 ) {
foundIssues . parameters = { . . . foundIssues . parameters , . . . issues } ;
}
}
2023-09-19 03:16:35 -07:00
} else if ( nodeProperties . validateType ) {
const value = getParameterValueByPath ( nodeValues , nodeProperties . name , path ) ;
const error = validateParameter ( nodeProperties , value , nodeProperties . validateType ) ;
if ( error ) {
if ( foundIssues . parameters === undefined ) {
foundIssues . parameters = { } ;
}
if ( foundIssues . parameters [ nodeProperties . name ] === undefined ) {
foundIssues . parameters [ nodeProperties . name ] = [ ] ;
}
foundIssues . parameters [ nodeProperties . name ] . push ( error ) ;
}
2022-09-21 06:44:45 -07:00
}
2019-06-23 03:35:23 -07:00
// Check if there are any child parameters
if ( nodeProperties . options === undefined ) {
// There are none so nothing else to check
return foundIssues ;
}
// Check the child parameters
// Important:
// Checks the child properties only if the property is defined on current level.
// That means that the required flag works only for the current level only. If
// it is set on a lower level it means that the property is only required in case
// the parent property got set.
let basePath = path ? ` ${ path } . ` : '' ;
const checkChildNodeProperties : Array < {
basePath : string ;
data : INodeProperties ;
} > = [ ] ;
// Collect all the properties to check
if ( nodeProperties . type === 'collection' ) {
for ( const option of nodeProperties . options ) {
checkChildNodeProperties . push ( {
basePath ,
data : option as INodeProperties ,
} ) ;
}
} else if ( nodeProperties . type === 'fixedCollection' ) {
basePath = basePath ? ` ${ basePath } . ` : ` ${ nodeProperties . name } . ` ;
let propertyOptions : INodePropertyCollection ;
for ( propertyOptions of nodeProperties . options as INodePropertyCollection [ ] ) {
// Check if the option got set and if not skip it
2022-09-21 06:44:45 -07:00
const value = getParameterValueByPath (
nodeValues ,
propertyOptions . name ,
basePath . slice ( 0 , - 1 ) ,
) ;
2019-06-23 03:35:23 -07:00
if ( value === undefined ) {
continue ;
}
if (
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
nodeProperties . typeOptions !== undefined &&
nodeProperties . typeOptions . multipleValues !== undefined
) {
// Multiple can be set so will be an array of objects
if ( Array . isArray ( value ) ) {
for ( let i = 0 ; i < ( value as INodeParameters [ ] ) . length ; i ++ ) {
for ( const option of propertyOptions . values ) {
checkChildNodeProperties . push ( {
basePath : ` ${ basePath } ${ propertyOptions . name } [ ${ i } ] ` ,
data : option ,
} ) ;
}
}
}
} else {
// Only one can be set so will be an object
for ( const option of propertyOptions . values ) {
checkChildNodeProperties . push ( {
basePath : basePath + propertyOptions . name ,
data : option ,
} ) ;
}
}
}
} else {
// For all other types there is nothing to check so return
return foundIssues ;
}
let propertyIssues ;
for ( const optionData of checkChildNodeProperties ) {
2022-04-28 10:04:09 -07:00
propertyIssues = getParameterIssues ( optionData . data , nodeValues , optionData . basePath , node ) ;
2019-06-23 03:35:23 -07:00
mergeIssues ( foundIssues , propertyIssues ) ;
}
return foundIssues ;
}
/ * *
* Merges multiple NodeIssues together
*
* @param { INodeIssues } destination The issues to merge into
* @param { ( INodeIssues | null ) } source The issues to merge
* /
export function mergeIssues ( destination : INodeIssues , source : INodeIssues | null ) {
if ( source === null ) {
// Nothing to merge
return ;
}
if ( source . execution === true ) {
destination . execution = true ;
}
const objectProperties = [ 'parameters' , 'credentials' ] ;
let destinationProperty : INodeIssueObjectProperty ;
for ( const propertyName of objectProperties ) {
if ( source [ propertyName ] !== undefined ) {
if ( destination [ propertyName ] === undefined ) {
destination [ propertyName ] = { } ;
}
let parameterName : string ;
for ( parameterName of Object . keys ( source [ propertyName ] as INodeIssueObjectProperty ) ) {
destinationProperty = destination [ propertyName ] as INodeIssueObjectProperty ;
if ( destinationProperty [ parameterName ] === undefined ) {
destinationProperty [ parameterName ] = [ ] ;
}
destinationProperty [ parameterName ] . push . apply (
destinationProperty [ parameterName ] ,
( source [ propertyName ] as INodeIssueObjectProperty ) [ parameterName ] ,
) ;
}
}
}
if ( source . typeUnknown === true ) {
destination . typeUnknown = true ;
}
}
2020-05-16 10:05:40 -07:00
/ * *
* Merges the given node properties
*
* /
export function mergeNodeProperties (
mainProperties : INodeProperties [ ] ,
addProperties : INodeProperties [ ] ,
) : void {
let existingIndex : number ;
for ( const property of addProperties ) {
2023-07-26 08:56:59 -07:00
if ( property . doNotInherit ) continue ;
2020-05-16 10:05:40 -07:00
existingIndex = mainProperties . findIndex ( ( element ) = > element . name === property . name ) ;
if ( existingIndex === - 1 ) {
// Property does not exist yet, so add
mainProperties . push ( property ) ;
} else {
// Property exists already, so overwrite
mainProperties [ existingIndex ] = property ;
}
}
}
2021-09-21 10:38:24 -07:00
2021-11-15 02:19:43 -08:00
export function getVersionedNodeType (
2022-10-25 12:33:12 -07:00
object : IVersionedNodeType | INodeType ,
2021-09-21 10:38:24 -07:00
version? : number ,
) : INodeType {
2023-02-10 09:33:04 -08:00
if ( 'nodeVersions' in object ) {
return object . getNodeType ( version ) ;
2021-09-21 10:38:24 -07:00
}
2023-02-10 09:33:04 -08:00
return object ;
2021-09-21 10:38:24 -07:00
}
2022-10-25 12:33:12 -07:00
export function getVersionedNodeTypeAll ( object : IVersionedNodeType | INodeType ) : INodeType [ ] {
2023-02-10 09:33:04 -08:00
if ( 'nodeVersions' in object ) {
2023-11-13 03:11:16 -08:00
return uniqBy (
Object . values ( object . nodeVersions )
. map ( ( element ) = > {
element . description . name = object . description . name ;
2023-12-08 02:40:05 -08:00
element . description . codex = object . description . codex ;
2023-11-13 03:11:16 -08:00
return element ;
} )
. reverse ( ) ,
( node ) = > {
const { version } = node . description ;
return Array . isArray ( version ) ? version . join ( ',' ) : version . toString ( ) ;
} ,
) ;
2021-09-21 10:38:24 -07:00
}
2023-02-10 09:33:04 -08:00
return [ object ] ;
2021-09-21 10:38:24 -07:00
}
2023-11-13 03:11:16 -08:00
export function getCredentialsForNode (
object : IVersionedNodeType | INodeType ,
) : INodeCredentialDescription [ ] {
if ( 'nodeVersions' in object ) {
return uniqBy (
Object . values ( object . nodeVersions ) . flatMap (
( version ) = > version . description . credentials ? ? [ ] ,
) ,
'name' ,
) ;
}
return object . description . credentials ? ? [ ] ;
}
2024-06-04 00:18:17 -07:00
export function isSingleExecution ( type : string , parameters : INodeParameters ) : boolean {
const singleExecutionCase = SINGLE_EXECUTION_NODES [ type ] ;
if ( singleExecutionCase ) {
for ( const parameter of Object . keys ( singleExecutionCase ) ) {
if ( ! singleExecutionCase [ parameter ] . includes ( parameters [ parameter ] as NodeParameterValue ) ) {
return false ;
}
}
return true ;
}
return false ;
}