{
  "exec": {
    "steps": [
      {
        "name": "query",
        "module": "dbconnector",
        "action": "single",
        "options": {
          "connection": "authdb",
          "sql": {
            "type": "select",
            "columns": [
              {
                "table": "users",
                "column": "id"
              }
            ],
            "params": [],
            "table": {
              "name": "users"
            },
            "primary": "id",
            "joins": [],
            "wheres": {
              "condition": "AND",
              "rules": [
                {
                  "id": "users.email",
                  "field": "users.email",
                  "type": "string",
                  "operator": "equal",
                  "value": "admin@prelub.com",
                  "data": {
                    "table": "users",
                    "column": "email",
                    "type": "text",
                    "columnObj": {
                      "type": "string",
                      "maxLength": 255,
                      "primary": false,
                      "unique": false,
                      "nullable": true,
                      "name": "email"
                    }
                  },
                  "operation": "="
                }
              ],
              "conditional": null,
              "valid": true
            },
            "query": "select `id` from `users` where `users`.`email` = ?"
          }
        },
        "output": true,
        "meta": [
          {
            "type": "number",
            "name": "id"
          }
        ],
        "outputType": "object"
      },
      {
        "name": "",
        "module": "core",
        "action": "condition",
        "options": {
          "if": "{{!query}}",
          "then": {
            "steps": [
              {
                "name": "pwd",
                "module": "core",
                "action": "setvalue",
                "options": {
                  "key": "g_pwd",
                  "value": "P@$$w0rd"
                },
                "meta": [],
                "outputType": "text"
              },
              {
                "name": "hash",
                "module": "crypto",
                "action": "passwordHash",
                "options": {
                  "password": "{{pwd}}"
                },
                "outputType": "text",
                "metaData": {
                  "hashPassword": {
                    "name": "pwd",
                    "type": "text"
                  }
                },
                "output": true
              },
              {
                "name": "insert",
                "module": "dbupdater",
                "action": "insert",
                "options": {
                  "connection": "authdb",
                  "sql": {
                    "type": "insert",
                    "values": [
                      {
                        "table": "users",
                        "column": "pwd",
                        "type": "text",
                        "value": "{{hash}}"
                      },
                      {
                        "table": "users",
                        "column": "validated",
                        "type": "boolean",
                        "value": "{{true}}"
                      },
                      {
                        "table": "users",
                        "column": "firstname",
                        "type": "text",
                        "value": "System"
                      },
                      {
                        "table": "users",
                        "column": "lastname",
                        "type": "text",
                        "value": "Admin"
                      },
                      {
                        "table": "users",
                        "column": "email",
                        "type": "text",
                        "value": "admin@prelub.com"
                      }
                    ],
                    "table": "users",
                    "returning": "id",
                    "query": "insert into `users` (`email`, `firstname`, `lastname`, `pwd`, `validated`) values (?, ?, ?, ?, ?)",
                    "params": [
                      {
                        "name": ":P1",
                        "type": "expression",
                        "value": "{{hash}}",
                        "test": ""
                      },
                      {
                        "name": ":P2",
                        "type": "expression",
                        "value": "{{true}}",
                        "test": ""
                      }
                    ]
                  }
                },
                "meta": [
                  {
                    "name": "identity",
                    "type": "number"
                  },
                  {
                    "name": "affected",
                    "type": "number"
                  }
                ],
                "output": true
              },
              {
                "name": "insert1",
                "module": "dbupdater",
                "action": "insert",
                "options": {
                  "connection": "authdb",
                  "sql": {
                    "type": "insert",
                    "values": [
                      {
                        "table": "xuserrole",
                        "column": "userid",
                        "type": "number",
                        "value": "{{insert.identity}}",
                        "recid": 1
                      },
                      {
                        "table": "xuserrole",
                        "column": "roleid",
                        "type": "number",
                        "value": "1",
                        "recid": 2
                      }
                    ],
                    "table": "xuserrole",
                    "returning": "id",
                    "query": "insert into `xuserrole` (`roleid`, `userid`) values (?, ?)",
                    "params": [
                      {
                        "name": ":P1",
                        "type": "expression",
                        "value": "{{insert.identity}}",
                        "test": ""
                      }
                    ]
                  }
                },
                "meta": [
                  {
                    "name": "identity",
                    "type": "number"
                  },
                  {
                    "name": "affected",
                    "type": "number"
                  }
                ],
                "output": true
              }
            ]
          }
        },
        "outputType": "boolean",
        "metaData": {
          "condition": {
            "name": "query",
            "type": "object"
          }
        }
      }
    ]
  },
  "usedModules": {
    "argon2": "^0.30.2"
  }
}