[zapier] Zapier generator minor fix (#16845)

* fixed childMapping method

* updated samples

* fixed deps
This commit is contained in:
Emanuele Saccomandi 2023-10-18 15:47:18 +02:00 committed by GitHub
parent d6421411c9
commit 77687a8ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@
},
"dependencies": {
"lodash": "^4.17.21",
"zapier-platform-core": "15.0.1",
"zapier-platform-core": "15.4.1",
"form-data": "2.1.4"
},
"devDependencies": {
@ -22,6 +22,6 @@
},
"private": true,
"zapier": {
"convertedByCLIVersion": "14.1.1"
"convertedByCLIVersion": "15.4.1"
}
}

View File

@ -1,14 +1,14 @@
const _ = require('lodash')
const replacePathParameters = (url) => url.replace(/{([^{}]+)}/g, (keyExpr, key) => `{{bundle.inputData.${key}}}`)
const childMapping = (objectsArray, prefix, model) => objectsArray.map(object => model.mapping({inputData: object}, prefix))
const childMapping = (objectsArray, prefix, model) => objectsArray ? objectsArray.map(object => model.mapping({inputData: object}, prefix)) : undefined
const removeIfEmpty = (obj) => _.isEmpty(JSON.parse(JSON.stringify(obj))) ? undefined : obj
const buildKeyAndLabel = (prefix, isInput = true, isArrayChild = false) => {
const keyPrefix = !_.isEmpty(prefix) && (!isArrayChild || isInput) ? `${prefix}${isInput ? '.' : '__'}` : prefix
const labelPrefix = !_.isEmpty(keyPrefix) ? keyPrefix.replaceAll('__', '.') : ''
return {
keyPrefix: keyPrefix,
labelPrefix:labelPrefix,
labelPrefix: labelPrefix,
}
}
const isSearchAction = (key) => {

View File

@ -13,7 +13,7 @@
},
"dependencies": {
"lodash": "^4.17.21",
"zapier-platform-core": "15.0.1",
"zapier-platform-core": "15.4.1",
"form-data": "2.1.4"
},
"devDependencies": {
@ -22,6 +22,6 @@
},
"private": true,
"zapier": {
"convertedByCLIVersion": "14.1.1"
"convertedByCLIVersion": "15.4.1"
}
}

View File

@ -1,14 +1,14 @@
const _ = require('lodash')
const replacePathParameters = (url) => url.replace(/{([^{}]+)}/g, (keyExpr, key) => `{{bundle.inputData.${key}}}`)
const childMapping = (objectsArray, prefix, model) => objectsArray.map(object => model.mapping({inputData: object}, prefix))
const childMapping = (objectsArray, prefix, model) => objectsArray ? objectsArray.map(object => model.mapping({inputData: object}, prefix)) : undefined
const removeIfEmpty = (obj) => _.isEmpty(JSON.parse(JSON.stringify(obj))) ? undefined : obj
const buildKeyAndLabel = (prefix, isInput = true, isArrayChild = false) => {
const keyPrefix = !_.isEmpty(prefix) && (!isArrayChild || isInput) ? `${prefix}${isInput ? '.' : '__'}` : prefix
const labelPrefix = !_.isEmpty(keyPrefix) ? keyPrefix.replaceAll('__', '.') : ''
return {
keyPrefix: keyPrefix,
labelPrefix:labelPrefix,
labelPrefix: labelPrefix,
}
}
const isSearchAction = (key) => {