Allow to call externals APIs

hooks: {"on.insert":[objects],"on.update":[objects], "on.delete":[objects]}

object:

{
	"DataStoreEntities": {
		"EntityName": {
			"interface": {
				....
				,"hooks": {
					"on.insert": [
						{
							"code":"passw_and_auth",
							"name":"Assign Password and Send Email",
							"method":"POST",
							"url":"<https://api.bnext.es/cfi_bnext_partners/hooks/user.created>"
						}
					]
				},
			}
		}
	}
}

When a insert,update or delete of then call external APIs doing a POST with fields of the 'EntityName' in JSON format.

If the call is success or if it fails then it is shown in the CFO call logs:

"logs": [
        {
            "SYSLOG error_hook.on.update": {
                "0": [
                    "Error code returned: 400",
                    [
                        "HTTP/1.1 400 Bad Request",
                        "Access-Control-Allow-Origin: *",
                        "Access-Control-Allow-Methods: GET,POST,PUT,DELETE",
                        "Access-Control-Allow-Headers: Content-Type,Authorization,X-CloudFrameWork-AuthToken,X-CLOUDFRAMEWORK-SECURITY,X-DS-TOKEN,X-REST-TOKEN,X-EXTRA-INFO,X-WEB-KEY,X-SERVER-KEY,X-REST-USERNAME,X-REST-PASSWORD,X-APP-KEY",
                        "Access-Control-Allow-Credentials: true",
                        "Access-Control-Max-Age: 1000",
                        "Set-Cookie: PHPSESSID=5d8bfe18f70944dcccbb76a72b68ad09535a33ed; path=/",
                        "Expires: Thu, 19 Nov 1981 08:52:00 GMT",
                        "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0",
                        "Pragma: no-cache",
                        "Content-Type: application/json",
                        "X-Cloud-Trace-Context: dd126101838702b02fc5a4a26e0c4264;o=1",
                        "Date: Thu, 30 May 2019 02:26:35 GMT",
                        "Server: Google Frontend",
                        "Transfer-Encoding: chunked"
                    ],
                    "{\\"success\\":false,\\"status\\":400,\\"code\\":\\"params-error\\",\\"environment\\":\\"bnext\\",\\"security\\":\\"X-DS-TOKEN_integration\\",\\"user_privileges\\":[\\"bdata-admin\\",\\"directory-admin\\",\\"partners-admin\\"],\\"user_organizations\\":[\\"bnext\\",\\"growth_partners\\",\\"tempu\\"],\\"is_partner_admin\\":true,\\"errors\\":[\\"Wrong parameters. [user.updated is not implemented]\\"]}"
                ],
                "on.update": "passw_and_auth: <https://api.bnext.es/cfi_bnext_partners/hooks/user.updated>",
"logs": [
        {
            "SYSLOG ok_hook.on.update": {
                "on.update": "passw_and_auth: <https://api.bnext.es/cfi_bnext_partners/hooks/user.updated>",
                "return": {
                    "success": true,
                    "status": 200,
                    "code": "ok",
                    "environment": "bnext",
                    "security": "X-DS-TOKEN_cache",
                    "user_privileges": [
                        "bdata-admin",
                        "directory-admin",
                        "partners-admin"
                    ],
                    "user_organizations": [
                        "bnext",
                        "growth_partners",
                        "tempu"
                    ],
                    "is_partner_admin": true,
                    "logs": [
                        {
                            "mandrill": [
                                {
                                    "email": "[email protected]",
                                    "status": "sent",
                                    "_id": "b35f7a0b4a284e56af056abba181db8d",
                                    "reject_reason": null
                                }
                            ]
                        }
                    ]
                }
            }
        }