{
  "operations": [
    {
      "name": "create",
      "params": [
        "sObjectName",
        "records"
      ],
      "docs": {
        "description": "Create one or more new sObject records. Relationships in the record should be nested and not use dot-notation syntax",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "create(\"Account\", { Name: \"My Account #1\" });",
            "caption": "Single record creation"
          },
          {
            "title": "example",
            "description": "create(\"Account\",[{ Name: \"My Account #1\" }, { Name: \"My Account #2\" }]);",
            "caption": "Multiple records creation"
          },
          {
            "title": "example",
            "description": "create(\"Account\",\n  $.data.map((account) => ({\n    Name: account.label\n  })\n));",
            "caption": "Create records from data on state"
          },
          {
            "title": "example",
            "description": "create(\"Account\", {\n  Name: \"My Account #1\" ,\n  \"Project__r\": {\n    \"Metrics_ID__c\": \"jfh5LAnxu1i4na\"\n  }\n});",
            "caption": "Update a record with a relationship"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "API name of the sObject.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "param",
            "description": "Field attributes for the new record, or an array of field attributes.",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "Object"
                },
                {
                  "type": "TypeApplication",
                  "expression": {
                    "type": "NameExpression",
                    "name": "Array"
                  },
                  "applications": [
                    {
                      "type": "NameExpression",
                      "name": "Object"
                    }
                  ]
                }
              ]
            },
            "name": "records"
          },
          {
            "title": "state",
            "description": "{SalesforceResultState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "describe",
      "params": [
        "sObjectName"
      ],
      "docs": {
        "description": "Fetches and logs metadata for an sObject and pushes the result to `state.data`.\nIf `sObjectName` is not specified, it will print the total number of all available sObjects and push the result to `state.data`.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "describe()",
            "caption": "Fetch metadata for all available sObjects"
          },
          {
            "title": "example",
            "description": "describe('Account')",
            "caption": "Fetch metadata for Account sObject"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "The API name of the sObject. If omitted, fetches metadata for all sObjects.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "state",
            "description": "{SalesforceState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "destroy",
      "params": [
        "sObjectName",
        "ids",
        "options"
      ],
      "docs": {
        "description": "Delete records of an sObject.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "destroy(\"Account\", \"001XXXXXXXXXXXXXXX\");",
            "caption": "Delete a single record"
          },
          {
            "title": "example",
            "description": "destroy(\"Account\", [\"001XXXXXXXXXXXXXXX\", \"001YYYYYYYYYYYYYYY\"], {\n  failOnError: true,\n});",
            "caption": "Allow operation to fail if any record fails to delete"
          },
          {
            "title": "example",
            "description": "fn((state) => {\n  state.data = [\"001XXXXXXXXXXXXXXX\", \"001YYYYYYYYYYYYYYY\"];\n  return state;\n});\ndestroy(\"Account\", $.data);",
            "caption": "Using a state variable"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "API name of the sObject.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "param",
            "description": "ID or array of IDs of records to delete",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "string"
                },
                {
                  "type": "TypeApplication",
                  "expression": {
                    "type": "NameExpression",
                    "name": "Array"
                  },
                  "applications": [
                    {
                      "type": "NameExpression",
                      "name": "string"
                    }
                  ]
                }
              ]
            },
            "name": "ids"
          },
          {
            "title": "param",
            "description": "Options for the destroy delete operation.",
            "type": {
              "type": "OptionalType",
              "expression": {
                "type": "NameExpression",
                "name": "object"
              }
            },
            "name": "options"
          },
          {
            "title": "param",
            "description": "If true, the operation will fail if any record fails to delete.",
            "type": {
              "type": "OptionalType",
              "expression": {
                "type": "NameExpression",
                "name": "boolean"
              }
            },
            "name": "options.failOnError",
            "default": "false"
          },
          {
            "title": "state",
            "description": "{SalesforceResultState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": false
    },
    {
      "name": "insert",
      "params": [
        "sObjectName",
        "records"
      ],
      "docs": {
        "description": "Alias for \"create(sObjectName, records)\".",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "insert(\"Account\", { Name: \"My Account #1\" });",
            "caption": "Single record creation"
          },
          {
            "title": "example",
            "description": "insert(\"Account\",[{ Name: \"My Account #1\" }, { Name: \"My Account #2\" }]);",
            "caption": "Multiple records creation"
          },
          {
            "title": "example",
            "description": "fn((state) => {\n  state.data = [{ Name: \"My Account #1\" }, { Name: \"My Account #2\" }];\n  return state;\n});\ninsert(\"Account\", $.data);",
            "caption": "Using a state variable"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "API name of the sObject.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "param",
            "description": "Field attributes for the new record, or an array of field attributes.",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "Object"
                },
                {
                  "type": "TypeApplication",
                  "expression": {
                    "type": "NameExpression",
                    "name": "Array"
                  },
                  "applications": [
                    {
                      "type": "NameExpression",
                      "name": "Object"
                    }
                  ]
                }
              ]
            },
            "name": "records"
          },
          {
            "title": "state",
            "description": "{SalesforceState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "query",
      "params": [
        "query",
        "options"
      ],
      "docs": {
        "description": "Executes an SOQL (Salesforce Object Query Language) query to retrieve records from Salesforce.\nNote that in an event of a query error, error logs will be printed but the operation will not throw the error.\n\nThe Salesforce query API is subject to rate limits, {@link https://sforce.co/3W9zyaQ learn more here}.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "query('SELECT Id FROM Patient__c', { limit: Infinity });",
            "caption": "Run a query and download all matching records"
          },
          {
            "title": "example",
            "description": "query('SELECT Id From Account Limit 10');",
            "caption": "Run a query and limit records"
          },
          {
            "title": "example",
            "description": "query(state => `SELECT Id FROM Patient__c WHERE Health_ID__c = '${state.data.healthId}'`);",
            "caption": "Query patients by Health ID"
          },
          {
            "title": "example",
            "description": "query(`SELECT Id FROM Patient__c WHERE Health_ID__c = '${$.data.healthId}'`);",
            "caption": "Query patients by Health ID using a lazy state reference"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "A SOQL query string. Must be less than 4000 characters in WHERE clause",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "query"
          },
          {
            "title": "param",
            "description": "Query options",
            "type": {
              "type": "OptionalType",
              "expression": {
                "type": "NameExpression",
                "name": "object"
              }
            },
            "name": "options"
          },
          {
            "title": "param",
            "description": "Maximum number of records to fetch. If `limit: Infinity` is passed, all records will be fetched.",
            "type": {
              "type": "OptionalType",
              "expression": {
                "type": "NameExpression",
                "name": "number"
              }
            },
            "name": "options.limit",
            "default": "10000"
          },
          {
            "title": "state",
            "description": "{SalesforceState}"
          },
          {
            "title": "state",
            "description": "{Array} data - Array of result objects"
          },
          {
            "title": "state",
            "description": "{Object} response - An object of result metadata.\n                    <code>{ done, totalSize, nextRecordsUrl?: string }</code>\n                    where nextRecordsUrl is only present when done is false"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": false
    },
    {
      "name": "upsert",
      "params": [
        "sObjectName",
        "externalId",
        "records"
      ],
      "docs": {
        "description": "Create a new sObject record, or updates it if it already exists. Relationships in the record should be nested and not use dot-notation syntax",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "upsert(\"UpsertTable__c\", \"ExtId__c\", { Name: \"Record #1\", ExtId__c : 'ID-0000001' });",
            "caption": "Single record upsert"
          },
          {
            "title": "example",
            "description": "upsert(\"UpsertTable__c\", \"ExtId__c\", [\n  { Name: \"Record #1\", ExtId__c : 'ID-0000001' },\n  { Name: \"Record #2\", ExtId__c : 'ID-0000002' },\n]);",
            "caption": "Multiple record upsert"
          },
          {
            "title": "example",
            "description": "upsert(\"UpsertTable__c\", {\n  Name: \"Record #1\",\n  \"Project__r\": {\n    \"Metrics_ID__c\": \"jfh5LAnxu1i4na\"\n  }\n});",
            "caption": "Update a record with a relationship"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "API name of the sObject.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "magic",
            "description": "sObjectName - $.children[?(!@.meta.system)].name"
          },
          {
            "title": "param",
            "description": "The external ID of the sObject.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "externalId"
          },
          {
            "title": "magic",
            "description": "externalId - $.children[?(@.name==\"{{args.sObject}}\")].children[?(@.meta.externalId)].name"
          },
          {
            "title": "param",
            "description": "Field attributes for the records to upsert, or an array of field attributes.",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "Object"
                },
                {
                  "type": "TypeApplication",
                  "expression": {
                    "type": "NameExpression",
                    "name": "Array"
                  },
                  "applications": [
                    {
                      "type": "NameExpression",
                      "name": "Object"
                    }
                  ]
                }
              ]
            },
            "name": "records"
          },
          {
            "title": "magic",
            "description": "records - $.children[?(@.name==\"{{args.sObject}}\")].children[?(!@.meta.externalId)]"
          },
          {
            "title": "state",
            "description": "{SalesforceState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "update",
      "params": [
        "sObjectName",
        "records"
      ],
      "docs": {
        "description": "Update an sObject record or records. Relationships in the record should be nested and not use dot-notation syntax",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "update(\"Account\", {\n  Id: \"0010500000fxbcuAAA\",\n  Name: \"Updated Account #1\",\n});",
            "caption": "Single record update"
          },
          {
            "title": "example",
            "description": "update(\"Account\", [\n  { Id: \"0010500000fxbcuAAA\", Name: \"Updated Account #1\" },\n  { Id: \"0010500000fxbcvAAA\", Name: \"Updated Account #2\" },\n]);",
            "caption": "Multiple records update"
          },
          {
            "title": "example",
            "description": "update(\"Account\", {\n  Id: \"0010500000fxbcuAAA\",\n  \"Project__r\": {\n    \"Metrics_ID__c\": \"jfh5LAnxu1i4na\"\n  }\n});",
            "caption": "Update a record with a relationship"
          },
          {
            "title": "param",
            "description": "API name of the sObject.",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "param",
            "description": "Field attributes for the new object.",
            "type": {
              "type": "UnionType",
              "elements": [
                {
                  "type": "NameExpression",
                  "name": "object"
                },
                {
                  "type": "TypeApplication",
                  "expression": {
                    "type": "NameExpression",
                    "name": "Array"
                  },
                  "applications": [
                    {
                      "type": "NameExpression",
                      "name": "object"
                    }
                  ]
                }
              ]
            },
            "name": "records"
          },
          {
            "title": "state",
            "description": "{SalesforceResultState}"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "name": "retrieve",
      "params": [
        "sObjectName",
        "id"
      ],
      "docs": {
        "description": "Retrieves a Salesforce sObject(s).",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "example",
            "description": "retrieve('ContentVersion', '0684K0000020Au7QAE/VersionData');",
            "caption": "Retrieve a specific ContentVersion record"
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "param",
            "description": "The sObject to retrieve",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "sObjectName"
          },
          {
            "title": "param",
            "description": "The id of the record",
            "type": {
              "type": "NameExpression",
              "name": "string"
            },
            "name": "id"
          },
          {
            "title": "state",
            "description": "{SalesforceState}"
          },
          {
            "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": "jsonValue",
      "params": [
        "obj",
        "path"
      ],
      "docs": {
        "description": "Picks out a single value from a JSON object.\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": "jsonValue({ a:1 }, 'a')"
          },
          {
            "title": "param",
            "description": "A valid JSON object.",
            "type": {
              "type": "NameExpression",
              "name": "object"
            },
            "name": "obj"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in given JSON object.",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "path"
          },
          {
            "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": "source",
      "params": [
        "path"
      ],
      "docs": {
        "description": "Picks out a value from source data.\nWill return whatever JSONPath returns, which will always be an array.\nIf you need a single value use `sourceValue` instead.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "source('$.key')"
          },
          {
            "title": "param",
            "description": "JSONPath referencing a point in `state`.",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "path"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "TypeApplication",
              "expression": {
                "type": "NameExpression",
                "name": "Array"
              },
              "applications": [
                {
                  "type": "UnionType",
                  "elements": [
                    {
                      "type": "NameExpression",
                      "name": "String"
                    },
                    {
                      "type": "NameExpression",
                      "name": "Object"
                    }
                  ]
                }
              ]
            }
          }
        ]
      },
      "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": "referencePath",
      "params": [
        "path"
      ],
      "docs": {
        "description": "Ensures a path points at references.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "referencePath('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": "string"
            }
          }
        ]
      },
      "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": "join",
      "params": [
        "targetPath",
        "sourcePath",
        "targetKey"
      ],
      "docs": {
        "description": "Adds data from a target object",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "join('$.key','$.data','newKey')"
          },
          {
            "title": "param",
            "description": "Target path",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "targetPath"
          },
          {
            "title": "param",
            "description": "Source path",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "sourcePath"
          },
          {
            "title": "param",
            "description": "Target Key",
            "type": {
              "type": "NameExpression",
              "name": "String"
            },
            "name": "targetKey"
          },
          {
            "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": "index",
      "params": [],
      "docs": {
        "description": "Returns the index of the current array being iterated.\nTo be used with `each` as a data source.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "index()"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "DataSource"
            }
          }
        ]
      },
      "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": "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": "log",
      "params": [
        "args"
      ],
      "docs": {
        "description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.",
        "tags": [
          {
            "title": "public",
            "description": null,
            "type": null
          },
          {
            "title": "function",
            "description": null,
            "name": null
          },
          {
            "title": "example",
            "description": "log('Patient List::', $.patients);",
            "caption": "Log values from state"
          },
          {
            "title": "example",
            "description": "fn((state) => {\n  console.log(state.data);\n  return state;\n})",
            "caption": "Use console.log inside a callback or fn block"
          },
          {
            "title": "param",
            "description": "A value or message to display in the logs",
            "type": {
              "type": "NameExpression",
              "name": "any"
            },
            "name": "args"
          },
          {
            "title": "returns",
            "description": null,
            "type": {
              "type": "NameExpression",
              "name": "Operation"
            }
          }
        ]
      },
      "valid": true
    },
    {
      "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
    }
  ]
}