UNPKG

@axway-api-builder-ext/api-builder-plugin-fn-file

Version:
265 lines (263 loc) 9.21 kB
flow-nodes: file: name: File icon: file-icon.png description: Flow node to read and write files category: extension methods: readCVSFile: name: Read a CSV-File description: Flow node reads a CSV-File. Optionally filter for a specific entries, filter for fields you would like to get and additionally you can convert the fields into a Javascript-Object. parameters: filename: name: CSV-Filename description: Filename you would like to read. Must be absolute or relativ to the API-Builder directory. required: true initialType: string schema: type: string delimiter: name: Delimeter description: The delimeter of your CSV-File. Defaults to , required: false initialType: string group: Options schema: default: "," type: string filterValues: name: Filter values description: This value is used to filter entries in the configured filterColumn. This parameter is ignored, if filterColumn is not set. required: false initialType: string group: Options schema: oneOf: - type: string - type: array options: multilineWrapper: before: "[\n" after: "\n]" items: - type: string filterColumn: name: Filter column description: The CSV column name used to filter using the filterValue. This parameter is ignored, if filterValue is not set. required: false initialType: string group: Options schema: type: string uniqueResult: name: Unique result description: Turn this on if you require a unique result (exactly 1). If not unique or nothing is found the flow node fails. required: false initialType: boolean group: Options schema: default: false type: boolean resultColumns: name: Result columns description: "An array of CSV column names you want in the result. The column names are expected in the first line. Example: [\"columnA\", \"columnF\", \"columnT\"]" required: false initialType: array group: Options schema: type: array items: type: string options: multilineWrapper: before: "[\n" after: "\n]" quote: name: Quote description: Optional character surrounding a field. This is required, when the delimiter is used as part of a field; one character only required: false initialType: string group: Advanced schema: type: string default: Double quote comment: name: Comment description: "Treat all the characters after this one as a comment. E.g. using a #" required: false initialType: string group: Advanced schema: type: string columns: name: Columns description: Provide an array of column headers if your CSV has NO headers or you would like to have different property name in the result. required: false initialType: array group: Advanced schema: type: array items: type: string options: multilineWrapper: before: "[\n" after: "\n]" relax_column_count: name: Relax column count description: Discard inconsistent columns count. If a column is missing for a record a reduced dataset is returned. required: false initialType: boolean group: Advanced schema: type: boolean outputs: next: name: Next description: Successfully read the CSV-File context: $.content schema: type: object error: name: Error description: Error reading the CSV-File context: $.error schema: type: string writeFile: name: Write file description: Use this method to write content for instance from an attribute into a file. parameters: filename: name: Target filename description: The filename to write. required: true initialType: string schema: type: string data: name: Input data description: The data to write to the file required: true schema: type: object overwrite: name: Overwrite file description: This controls if you would like to overwrite existing files or not. Default to false. required: false group: Options initialType: boolean schema: default: false type: boolean dataEncoding: name: Data encoding description: Data encoding format. Defaults to UTF-8 required: false group: Options initialType: string schema: type: string enum: - utf8 - ucs2 - utf16le - latin1 - ascii - base64 - hex stringify: name: Stringify description: By default, if data is an Object, if will be converted into JSON. You may deactivate this option required: false group: Options initialType: boolean schema: default: true type: boolean outputs: next: name: Next description: The file has been successfully written. content contains the name of the file for reference. context: $.content schema: type: object error: name: Error description: The file couldn't be written. Error contains the error message. context: $.error schema: type: string readFile: name: Read file description: Reads a file into an attribute. parameters: filename: name: Source filename description: The filename to read. required: true initialType: string schema: type: string encoding: name: Data encoding description: Data encoding format. Defaults to UTF-8 required: false initialType: string schema: type: string enum: - utf8 - ucs2 - utf16le - latin1 - ascii - base64 - hex parseJson: name: Parse JSON description: Turn this option if you are reading s JSON-File and would like to parse it into a JS-Object. required: false initialType: boolean schema: default: false type: boolean notFoundFails: name: Not found fails description: Set this flag, if you would like to have this flow node failed (Error) if the file cannot be found. required: false initialType: boolean schema: default: false type: boolean limit: name: Max read limit description: Read the file up to a certain limit given in Bytes. required: false schema: type: number data: name: Data description: 'If you are using a dynamic filename that contains variables, you need to provide this data object, which is used to replace your variables. Example: ${conf.myFolder}/some/static/${filename}' required: false schema: type: object outputs: next: name: Next description: The file has been successfully read and returned into the given variable. context: $.fileContent schema: type: object notFound: name: Not found description: Indicates that the file could not be found context: $.result schema: type: object error: name: Error description: Error reading the file. context: $.error schema: type: object