{
  "operations": [
    {
      "name": "request",
      "params": [
        "method",
        "path",
        "options"
      ],
      "docs": {
        "description": "Make a HTTP request. If `configuration.baseUrl` is set, paths must be relative.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "request('GET', '/patient', {\n  query: { foo: 'bar', a: 1 },\n});",
            "caption": "Make a GET request"
          },
          {
            "title": "example",
            "description": "request('POST', '/todos', {\n  body:{\n    \"userId\": 1,\n    \"title\": \"delectus aut autem\",\n    \"completed\": false\n  },\n});",
            "caption": "Make a POST request with a body"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "The HTTP method to use.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "method"
          },
          {
            "title": "param",
            "description": "Path to resource. Can be an absolute URL if baseURL is NOT set on `state.configuration`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "Body, Query, Headers and Authentication parameters",
            "type": {
              "type": "NameExpression",
              "name": "RequestOptions"
            },
            "name": "options"
          },
          {
            "title": "state",
            "description": "{HttpState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "get",
      "params": [
        "path",
        "options"
      ],
      "docs": {
        "description": "Make a GET request. If `configuration.baseUrl` is set, paths must be relative.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "get('/patient', {\n  query: { foo: 'bar', a: 1 },\n});",
            "caption": "GET request with query parameters and custom headers"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "Path to resource. Can be an absolute URL if baseURL is NOT set on `state.configuration`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "Body, Query, Headers and Authentication parameters",
            "type": {
              "type": "NameExpression",
              "name": "RequestOptions"
            },
            "name": "options"
          },
          {
            "title": "state",
            "description": "{HttpState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "post",
      "params": [
        "path",
        "data",
        "options"
      ],
      "docs": {
        "description": "Make a POST request. If `configuration.baseUrl` is set, paths must be relative.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "post('/patient', $.data);",
            "caption": "POST a resource with from state"
          },
          {
            "title": "example",
            "description": "post('/patient', $.data, {\n  headers: { 'content-type': 'application/fhir+json' },\n});",
            "caption": "POST a resource with custom headers"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "Path to resource. Can be an absolute URL if baseURL is NOT set on `state.configuration`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "Body data to append to the request. JSON will be converted to a string.",
            "type": {
              "type": "NameExpression",
              "name": "object"
            },
            "name": "data"
          },
          {
            "title": "param",
            "description": "Query, Headers and Authentication parameters",
            "type": {
              "type": "NameExpression",
              "name": "RequestOptions"
            },
            "name": "options"
          },
          {
            "title": "state",
            "description": "{HttpState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "put",
      "params": [
        "path",
        "data",
        "options"
      ],
      "docs": {
        "description": "Make a PUT request. If `configuration.baseUrl` is set, paths must be relative.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "put('/patient', $.data);",
            "caption": "PUT a resource from state"
          },
          {
            "title": "example",
            "description": "put('/patient', $.data, {\n  headers: { 'content-type': 'application/fhir+json' },\n})",
            "caption": "PUT a resource with custom headers"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "Path to resource. Can be an absolute URL if baseURL is NOT set on `state.configuration`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "Body data to append to the request. JSON will be converted to a string.",
            "type": {
              "type": "NameExpression",
              "name": "object"
            },
            "name": "data"
          },
          {
            "title": "param",
            "description": "Query, Headers and Auth parameters",
            "type": {
              "type": "NameExpression",
              "name": "RequestOptions"
            },
            "name": "options"
          },
          {
            "title": "state",
            "description": "{HttpState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "patch",
      "params": [
        "path",
        "data",
        "options"
      ],
      "docs": {
        "description": "Make a PATCH request. If `configuration.baseUrl` is set, paths must be relative.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "patch('/patient', $.data);",
            "caption": "PATCH a resource from state"
          },
          {
            "title": "example",
            "description": "patch('/patient', $.data, {\n  headers: { 'content-type': 'application/fhir+json' },\n});",
            "caption": "PATCH a resource with custom headers"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "Path to resource. Can be an absolute URL if baseURL is NOT set on `state.configuration`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "Body data to append to the request. JSON will be converted to a string.",
            "type": {
              "type": "NameExpression",
              "name": "object"
            },
            "name": "data"
          },
          {
            "title": "param",
            "description": "Query, Headers and Auth parameters",
            "type": {
              "type": "NameExpression",
              "name": "RequestOptions"
            },
            "name": "options"
          },
          {
            "title": "state",
            "description": "{HttpState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "del",
      "params": [
        "path",
        "options"
      ],
      "docs": {
        "description": "Make a DELETE request. If `configuration.baseUrl` is set, paths must be relative.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "del(`/myendpoint/${$.data.id}`);",
            "caption": "DELETE a resource by ID"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "Path to resource. Can be an absolute URL if baseURL is NOT set on `state.configuration`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "Query, Headers and Auth parameters",
            "type": {
              "type": "NameExpression",
              "name": "RequestOptions"
            },
            "name": "options"
          },
          {
            "title": "state",
            "description": "{HttpState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "parseXML",
      "params": [
        "data",
        "script"
      ],
      "docs": {
        "description": "Parse XML with the Cheerio parser",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "parseXML(\n  (state) => state.response,\n  ($) => {\n    return $(\"table[class=your_table]\").parsetable(true, true, true);\n  }\n);",
            "caption": "Parse XML from state.response"
          },
          {
            "title": "example",
            "description": "parseXML(\n  (state) => state.response,\n  ($) => $(\"table[class=your_table]\").parsetable(true, true, true)\n).then((next) => ({ ...next, results: next.data.data }));",
            "caption": "Using parseXML with a callback to extract data"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "Body string to be parsed",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "data"
          },
          {
            "title": "param",
            "description": "script for extracting data",
            "type": {
              "type": "NameExpression",
              "name": "function"
            },
            "name": "script"
          },
          {
            "title": "state",
            "description": "data - the parsed XML as a JSON object"
          },
          {
            "title": "state",
            "description": "references - an array of all previous data objects used in the Job"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    }
  ],
  "exports": [],
  "common": [
    {
      "name": "fn",
      "params": [
        "func"
      ],
      "docs": {
        "description": "Creates a custom step (or operation) for more flexible job writing.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "fn(state => {\n  // do some things to state\n  return state;\n});"
          },
          {
            "title": "param",
            "description": "is the function",
            "type": {
              "type": "NameExpression",
              "name": "Function"
            },
            "name": "func"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "fnIf",
      "params": [
        "condition",
        "operation"
      ],
      "docs": {
        "description": "Execute a function only when the condition returns true",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
          },
          {
            "title": "param",
            "description": "The condition that returns true",
            "type": {
              "type": "NameExpression",
              "name": "Boolean"
            },
            "name": "condition"
          },
          {
            "title": "param",
            "description": "The operation needed to be executed.",
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            },
            "name": "operation"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "sourceValue",
      "params": [
        "path"
      ],
      "docs": {
        "description": "Picks out a single value from source data.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "sourceValue('$.key')"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in `state`.",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "path"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "dataPath",
      "params": [
        "path"
      ],
      "docs": {
        "description": "Ensures a path points at the data.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "dataPath('key')"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in `data`.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "path"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "string"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "dataValue",
      "params": [
        "path"
      ],
      "docs": {
        "description": "Picks out a single value from the source data object—usually `state.data`.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "dataValue('key')"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in `data`.",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "path"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "lastReferenceValue",
      "params": [
        "path"
      ],
      "docs": {
        "description": "Picks out the last reference value from source data.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "lastReferenceValue('key')"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in `references`.",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "path"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "each",
      "params": [
        "dataSource",
        "operation"
      ],
      "docs": {
        "description": "Iterates over an array of items and invokes an operation upon each one, where the state\nobject is _scoped_ so that state.data is the item under iteration.\nThe rest of the state object is untouched and can be referenced as usual.\nYou can pass an array directly, or use lazy state or a JSONPath string to\nreference a slice of state.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "each(\n  $.data,\n  // Inside the callback operation, `$.data` is scoped to the item under iteration\n  insert(\"patient\", {\n    patient_name: $.data.properties.case_name,\n    patient_id: $.data.case_id,\n  })\n);",
            "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
          },
          {
            "title": "example",
            "description": "each(\n  $.data,\n  insert(\"patient\", (state) => ({\n    patient_id: state.data.case_id,\n    ...state.data\n  }))\n);",
            "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
          },
          {
            "title": "example",
            "description": "each(\n  \"$.data[*]\",\n  insert(\"patient\", (state) => ({\n    patient_name: state.data.properties.case_name,\n    patient_id: state.data.case_id,\n  }))\n);",
            "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in `state`.",
            "type": {
              "type": "NameExpression",
              "name": "DataSource"
            },
            "name": "dataSource"
          },
          {
            "title": "param",
            "description": "The operation needed to be repeated.",
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            },
            "name": "operation"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "combine",
      "params": [
        "operations"
      ],
      "docs": {
        "description": "Combines two operations into one",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "combine(\n  create('foo'),\n  delete('bar')\n)"
          },
          {
            "title": "param",
            "description": "Operations to be performed.",
            "type": {
              "type": "NameExpression",
              "name": "Operations"
            },
            "name": "operations"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "field",
      "params": [
        "key",
        "value"
      ],
      "docs": {
        "description": "Returns a key, value pair in an array.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "field('destination_field_name__c', 'value')"
          },
          {
            "title": "param",
            "description": "Name of the field",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "key"
          },
          {
            "title": "param",
            "description": "The value itself or a sourceable operation.",
            "type": {
              "type": "NameExpression",
              "name": "Value"
            },
            "name": "value"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Field"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "fields",
      "params": [
        "fields"
      ],
      "docs": {
        "description": "Zips key value pairs into an object.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "fields(list_of_fields)"
          },
          {
            "title": "param",
            "description": "a list of fields",
            "type": {
              "type": "NameExpression",
              "name": "Fields"
            },
            "name": "fields"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Object"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "merge",
      "params": [
        "dataSource",
        "fields"
      ],
      "docs": {
        "description": "Merges fields into each item in an array.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "merge(\n  \"$.books[*]\",\n  fields(\n    field( \"publisher\", sourceValue(\"$.publisher\") )\n  )\n)"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "param",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "DataSource"
            },
            "name": "dataSource"
          },
          {
            "title": "param",
            "description": "Group of fields to merge in.",
            "type": {
              "type": "NameExpression",
              "name": "Object"
            },
            "name": "fields"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "DataSource"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "group",
      "params": [
        "arrayOfObjects",
        "keyPath",
        "callback"
      ],
      "docs": {
        "description": "Groups an array of objects by a specified key path.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "const users = [\n  { name: 'Alice', age: 25, city: 'New York' },\n  { name: 'Bob', age: 30, city: 'San Francisco' },\n  { name: 'Charlie', age: 25, city: 'New York' },\n  { name: 'David', age: 30, city: 'San Francisco' }\n];\ngroup(users, 'city');\n// state is { data: { 'New York': [/Alice, Charlie/], 'San Francisco': [ /Bob, David / ] }"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "param",
            "description": "The array of objects to be grouped.",
            "type": {
              "type": "TypeApplication",
              "expression": {
                "type": "NameExpression",
                "name": "Array"
              },
              "applications": [
                {
                  "type": "NameExpression",
                  "name": "Object"
                }
              ]
            },
            "name": "arrayOfObjects"
          },
          {
            "title": "param",
            "description": "The key path to group by.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "keyPath"
          },
          {
            "title": "param",
            "description": "(Optional) Callback function",
            "type": {
              "type": "NameExpression",
              "name": "function"
            },
            "name": "callback"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "arrayToString",
      "params": [
        "arr",
        "separator"
      ],
      "docs": {
        "description": "Turns an array into a string, separated by X.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "field(\"destination_string__c\", function(state) {\n  return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
          },
          {
            "title": "param",
            "description": "Array of toString'able primatives.",
            "type": {
              "type": "NameExpression",
              "name": "array"
            },
            "name": "arr"
          },
          {
            "title": "param",
            "description": "Separator string.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "separator"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "string"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "toArray",
      "params": [
        "arg"
      ],
      "docs": {
        "description": "Ensures primitive data types are wrapped in an array.\nDoes not affect array objects.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "each(function(state) {\n  return toArray( dataValue(\"path_of_array\")(state) )\n}, ...)"
          },
          {
            "title": "param",
            "description": "Data required to be in an array",
            "type": {
              "type": "NameExpression",
              "name": "any"
            },
            "name": "arg"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "array"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "humanProper",
      "params": [
        "str"
      ],
      "docs": {
        "description": "Substitutes underscores for spaces and proper-cases a string",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "field(\"destination_string__c\", humanProper(state.data.path_to_string))"
          },
          {
            "title": "param",
            "description": "String that needs converting",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "str"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "string"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "splitKeys",
      "params": [
        "obj",
        "keys"
      ],
      "docs": {
        "description": "Splits an object into two objects based on a list of keys.\nThe first object contains the keys that are not in the list,\nand the second contains the keys that are.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "The object to split.",
            "type": {
              "type": "NameExpression",
              "name": "Object"
            },
            "name": "obj"
          },
          {
            "title": "param",
            "description": "List of keys to split on.",
            "type": {
              "type": "TypeApplication",
              "expression": {
                "type": "NameExpression",
                "name": "Array"
              },
              "applications": [
                {
                  "type": "NameExpression",
                  "name": "string"
                }
              ]
            },
            "name": "keys"
          },
          {
            "title": "returns",
            "description": "Tuple of objects, first object contains keys not in list, second contains keys that are.",
            "type": {
              "type": "TypeApplication",
              "expression": {
                "type": "NameExpression",
                "name": "Array"
              },
              "applications": [
                {
                  "type": "NameExpression",
                  "name": "Object"
                }
              ]
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "scrubEmojis",
      "params": [
        "text",
        "replacementChars"
      ],
      "docs": {
        "description": "Replaces emojis in a string.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "scrubEmojis('Dove🕊️⭐ 29')"
          },
          {
            "title": "param",
            "description": "String that needs to be cleaned",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "text"
          },
          {
            "title": "param",
            "description": "Characters that replace the emojis",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "replacementChars"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "string"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "chunk",
      "params": [
        "array",
        "chunkSize"
      ],
      "docs": {
        "description": "Chunks an array into an array of arrays, each with no more than a certain size.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "chunk([1,2,3,4,5], 2)"
          },
          {
            "title": "param",
            "description": "Array to be chunked",
            "type": {
              "type": "NameExpression",
              "name": "Object"
            },
            "name": "array"
          },
          {
            "title": "param",
            "description": "The maxiumum size of each chunks",
            "type": {
              "type": "NameExpression",
              "name": "Integer"
            },
            "name": "chunkSize"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Object"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "parseCsv",
      "params": [
        "csvData",
        "parsingOptions",
        "callback"
      ],
      "docs": {
        "description": "Takes a CSV file string or stream and parsing options as input, and returns a promise that\nresolves to the parsed CSV data as an array of objects.\nOptions for `parsingOptions` include:\n- `delimiter` {string/Buffer/[string/Buffer]} - Defines the character(s) used to delineate the fields inside a record. Default: `','`\n- `quote` {string/Buffer/[string/Buffer]} - Defines the characters used to surround a field. Default: `'\"'`\n- `escape` {Buffer/string/null/boolean} - Set the escape character as one character/byte only. Default: `\"`\n- `columns` {boolean / array / function} - Generates record in the form of object literals. Default: `true`\n- `bom` {boolean} - Strips the {@link https://en.wikipedia.org/wiki/Byte_order_mark byte order mark (BOM)} from the input string or buffer. Default: `true`\n- `trim` {boolean} - Ignore whitespace characters immediately around the `delimiter`. Default: `true`\n- `ltrim` {boolean} - Ignore whitespace characters from the left side of a CSV field. Default: `true`\n- `rtrim` {boolean} - Ignore whitespace characters from the right side of a CSV field. Default: `true`\n- `chunkSize` {number} - The size of each chunk of CSV data. Default: `Infinity`\n- `skip_empty_lines` {boolean} - Ignore empty lines in the CSV file. Default: `true`",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "A CSV string or a readable stream",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "String"
                },
                {
                  "type": "NameExpression",
                  "name": "Stream"
                }
              ]
            },
            "name": "csvData"
          },
          {
            "title": "param",
            "description": "Optional. Parsing options for converting CSV to JSON.",
            "type": {
              "type": "OptionalType",
              "expression": {
                "type": "NameExpression",
                "name": "Object"
              }
            },
            "name": "parsingOptions"
          },
          {
            "title": "param",
            "description": "(Optional) callback function. If used it will be called state and an array of rows.",
            "type": {
              "type": "OptionalType",
              "expression": {
                "type": "NameExpression",
                "name": "function"
              }
            },
            "name": "callback"
          },
          {
            "title": "returns",
            "description": "The function returns a Promise that resolves to the result of parsing a CSV `stringOrStream`.",
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "cursor",
      "params": [
        "value",
        "options"
      ],
      "docs": {
        "description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones\nare not yet supported.\nYou can provide a formatter to customise the final cursor value, which is useful for normalising\ndifferent inputs. The custom formatter runs after natural language date conversion.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "cursor($.cursor, { defaultValue: 'today' })",
            "caption": "Use a cursor from state if present, or else use the default value"
          },
          {
            "title": "example",
            "description": "cursor(22)",
            "caption": "Use a pagination cursor"
          },
          {
            "title": "param",
            "description": "the cursor value. Usually an ISO date, natural language date, or page number",
            "type": {
              "type": "NameExpression",
              "name": "any"
            },
            "name": "value"
          },
          {
            "title": "param",
            "description": "options to control the cursor.",
            "type": {
              "type": "NameExpression",
              "name": "object"
            },
            "name": "options"
          },
          {
            "title": "param",
            "description": "set the cursor key. Will persist through the whole run.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "options.key"
          },
          {
            "title": "param",
            "description": "the value to use if value is falsy",
            "type": {
              "type": "NameExpression",
              "name": "any"
            },
            "name": "options.defaultValue"
          },
          {
            "title": "param",
            "description": "custom formatter for the final cursor value",
            "type": {
              "type": "NameExpression",
              "name": "Function"
            },
            "name": "options.format"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": false
    },
    {
      "name": "as",
      "params": [
        "key",
        "operation"
      ],
      "docs": {
        "description": "Run an operation and save the result to a custom key in state instead of overwriting state.data.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "as('cceData', collections.get('cce-data-dhis2', { key: `*:*:${$.syncedAt}*` }));",
            "caption": "Fetch cce-data from collections and store them under state.cceData"
          },
          {
            "title": "param",
            "description": "The state key to assign the result of the operation to.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "key"
          },
          {
            "title": "param",
            "description": " An operation that returns a new state object with a `data` property",
            "type": {
              "type": "NameExpression",
              "name": "function"
            },
            "name": "operation"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "map",
      "params": {},
      "docs": {
        "description": "Iterates over a collection of items and returns a new array of mapped values,\nlike Javascript's `Array.map()` function.\n\nEach item in the source array will be passed into the callback function. The returned value\nwill be added to the new array. The callback is passed the original item, the current index\nin the source array (ie, the nth item number), and the state object.\n\nWrites a new array to `state.data` with transformed values.c array.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "map($.items', (data, index, state) => {\n  return {\n    id: index + 1,\n    name: data.name,\n    createdAt: state.cursor,\n  };\n});",
            "caption": "Transform an array of items in state"
          },
          {
            "title": "example",
            "description": "map($.items, async (data, index, state) => {\n  const userInfo = await fetchUserInfo(data.userId);\n  return {\n    id: index + 1,\n    name: data.name,\n    extra: userInfo,\n  };\n});",
            "caption": "Map items asynchronously (e.g. fetch extra info)"
          },
          {
            "title": "param",
            "description": "An array of items or a a JSONPath string which points to an array of items.",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "string"
                },
                {
                  "type": "NameExpression",
                  "name": "Array"
                }
              ]
            },
            "name": "path"
          },
          {
            "title": "param",
            "description": "The mapping function, invoked with `(data, index, state)` for each item in the array.",
            "type": {
              "type": "NameExpression",
              "name": "function"
            },
            "name": "callback"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "State"
            }
          }
        ]
      },
      "valid": false
    }
  ]
}