export const pusherYaml = () => `pushers: - id: "||VARIABLE_KEY_id||" name: "||VARIABLE_KEY_name||" description: options: [] beforePushSteps: [] pushSteps: - key: CHECK_EXISTS name: Check Exists description: "" connectorId: "||VARIABLE_KEY_connectorId||" displayType: API arguments: {} data: url: "" type: REST method: GET anonymous: false headers: "Content-Type": ["application/json"] queries: {} body: acceptHttpStatuses: success: parser: regex expression: 2\\d{2} responseFilters: jsonata: id: acceptedStatuses: - success expression: |- $.id next: |- {{ if (__this.arguments.mapping_only != "1") "" else if (pusher.current.CHECK_EXISTS?.id | string.size) > 0 "UPDATE" else "CREATE" end }} - key: CREATE name: Create description: connectorId: "||VARIABLE_KEY_connectorId||" displayType: API next: arguments: data: url: "" type: REST method: POST anonymous: false headers: "Content-Type": ["application/json"] "Accept": ["application/json"] queries: body: |- { "name": "{{item.name | hexasync.string.escape_json}} } acceptHttpStatuses: success: parser: regex expression: 2\\d{2} responseFilters: jsonata: id: acceptedStatuses: - success expression: |- $.id - key: UPDATE name: Update description: connectorId: "||VARIABLE_KEY_connectorId||" displayType: API next: arguments: data: url: "" type: REST method: PUT anonymous: false headers: "Content-Type": ["application/json"] "Accept": ["application/json"] queries: body: |- { "name": "{{item.name | hexasync.string.escape_json}} } acceptHttpStatuses: success: parser: regex expression: 2\\d{2} responseFilters: jsonata: id: acceptedStatuses: - success expression: |- $.id afterPushSteps: [] responseFilters: # we can use jsonpath or scriban here scriban: id: expression: |- {{ if (pusher.current.CHECK_EXISTS?.id | string.size) > 0 pusher.current.CHECK_EXISTS.id else if (pusher.current.CREATE?.id | string.size) > 0 pusher.current.CREATE.id else if (pusher.current.UPDATE?.id | string.size) > 0 pusher.current.UPDATE.id else item.__destination_id end }} isSuccess: expression: |- {{ if (pusher.current.CREATE?.id | string.size) > 0 true else if (pusher.current.UPDATE?.id | string.size) > 0 true else if (pusher.current.CHECK_EXISTS?.id | string.size) > 0 true else (item.__destination_id | string.size ) > 0 end }} message: expression: |- {{ [pusher.current.CREATE?.message, pusher.current.UPDATE?.message, pusher.current.CHECK_EXISTS?.message] | array.join "\\r\\n" }} `;