Skip to content

Commit

Permalink
[zapier] Zapier generator minor fix (#16845)
Browse files Browse the repository at this point in the history
* fixed childMapping method

* updated samples

* fixed deps
  • Loading branch information
emajo committed Oct 18, 2023
1 parent d642141 commit 77687a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -22,6 +22,6 @@
},
"private": true,
"zapier": {
"convertedByCLIVersion": "14.1.1"
"convertedByCLIVersion": "15.4.1"
}
}
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/zapier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -22,6 +22,6 @@
},
"private": true,
"zapier": {
"convertedByCLIVersion": "14.1.1"
"convertedByCLIVersion": "15.4.1"
}
}
4 changes: 2 additions & 2 deletions samples/client/petstore/zapier/utils/utils.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down

0 comments on commit 77687a8

Please sign in to comment.