sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,636 lines (1,635 loc) • 1.82 MB
JSON
{
"type": "File",
"start": 0,
"end": 8058,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 256,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 8058,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 256,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "VariableDeclaration",
"start": 15,
"end": 52,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 21,
"end": 51,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 21,
"end": 26,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 11
},
"identifierName": "Utils"
},
"name": "Utils"
},
"init": {
"type": "CallExpression",
"start": 29,
"end": 51,
"loc": {
"start": {
"line": 3,
"column": 14
},
"end": {
"line": 3,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 29,
"end": 36,
"loc": {
"start": {
"line": 3,
"column": 14
},
"end": {
"line": 3,
"column": 21
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 37,
"end": 50,
"loc": {
"start": {
"line": 3,
"column": 22
},
"end": {
"line": 3,
"column": 35
}
},
"extra": {
"rawValue": "../../utils",
"raw": "'../../utils'"
},
"value": "../../utils"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 53,
"end": 111,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 58
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 59,
"end": 110,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 57
}
},
"id": {
"type": "Identifier",
"start": 59,
"end": 64,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 11
},
"identifierName": "debug"
},
"name": "debug"
},
"init": {
"type": "CallExpression",
"start": 67,
"end": 110,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 57
}
},
"callee": {
"type": "MemberExpression",
"start": 67,
"end": 97,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 44
}
},
"object": {
"type": "CallExpression",
"start": 67,
"end": 84,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 31
}
},
"callee": {
"type": "MemberExpression",
"start": 67,
"end": 82,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 29
}
},
"object": {
"type": "Identifier",
"start": 67,
"end": 72,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 19
},
"identifierName": "Utils"
},
"name": "Utils"
},
"property": {
"type": "Identifier",
"start": 73,
"end": 82,
"loc": {
"start": {
"line": 4,
"column": 20
},
"end": {
"line": 4,
"column": 29
},
"identifierName": "getLogger"
},
"name": "getLogger"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 85,
"end": 97,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 44
},
"identifierName": "debugContext"
},
"name": "debugContext"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 98,
"end": 109,
"loc": {
"start": {
"line": 4,
"column": 45
},
"end": {
"line": 4,
"column": 56
}
},
"extra": {
"rawValue": "sql:mysql",
"raw": "'sql:mysql'"
},
"value": "sql:mysql"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 112,
"end": 163,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 51
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 118,
"end": 162,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 50
}
},
"id": {
"type": "Identifier",
"start": 118,
"end": 131,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 19
},
"identifierName": "AbstractQuery"
},
"name": "AbstractQuery"
},
"init": {
"type": "CallExpression",
"start": 134,
"end": 162,
"loc": {
"start": {
"line": 5,
"column": 22
},
"end": {
"line": 5,
"column": 50
}
},
"callee": {
"type": "Identifier",
"start": 134,
"end": 141,
"loc": {
"start": {
"line": 5,
"column": 22
},
"end": {
"line": 5,
"column": 29
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 142,
"end": 161,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 49
}
},
"extra": {
"rawValue": "../abstract/query",
"raw": "'../abstract/query'"
},
"value": "../abstract/query"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 164,
"end": 193,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 29
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 170,
"end": 192,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 28
}
},
"id": {
"type": "Identifier",
"start": 170,
"end": 174,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 10
},
"identifierName": "uuid"
},
"name": "uuid"
},
"init": {
"type": "CallExpression",
"start": 177,
"end": 192,
"loc": {
"start": {
"line": 6,
"column": 13
},
"end": {
"line": 6,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 177,
"end": 184,
"loc": {
"start": {
"line": 6,
"column": 13
},
"end": {
"line": 6,
"column": 20
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 185,
"end": 191,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 27
}
},
"extra": {
"rawValue": "uuid",
"raw": "'uuid'"
},
"value": "uuid"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 194,
"end": 245,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 51
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 200,
"end": 244,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 50
}
},
"id": {
"type": "Identifier",
"start": 200,
"end": 215,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 21
},
"identifierName": "sequelizeErrors"
},
"name": "sequelizeErrors"
},
"init": {
"type": "CallExpression",
"start": 218,
"end": 244,
"loc": {
"start": {
"line": 7,
"column": 24
},
"end": {
"line": 7,
"column": 50
}
},
"callee": {
"type": "Identifier",
"start": 218,
"end": 225,
"loc": {
"start": {
"line": 7,
"column": 24
},
"end": {
"line": 7,
"column": 31
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 226,
"end": 243,
"loc": {
"start": {
"line": 7,
"column": 32
},
"end": {
"line": 7,
"column": 49
}
},
"extra": {
"rawValue": "../../errors.js",
"raw": "'../../errors.js'"
},
"value": "../../errors.js"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 246,
"end": 274,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 252,
"end": 273,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 252,
"end": 253,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 7
},
"identifierName": "_"
},
"name": "_"
},
"init": {
"type": "CallExpression",
"start": 256,
"end": 273,
"loc": {
"start": {
"line": 8,
"column": 10
},
"end": {
"line": 8,
"column": 27
}
},
"callee": {
"type": "Identifier",
"start": 256,
"end": 263,
"loc": {
"start": {
"line": 8,
"column": 10
},
"end": {
"line": 8,
"column": 17
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 264,
"end": 272,
"loc": {
"start": {
"line": 8,
"column": 18
},
"end": {
"line": 8,
"column": 26
}
},
"extra": {
"rawValue": "lodash",
"raw": "'lodash'"
},
"value": "lodash"
}
]
}
}
],
"kind": "const"
},
{
"type": "ClassDeclaration",
"start": 276,
"end": 7970,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 251,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 282,
"end": 287,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 11
},
"identifierName": "Query"
},
"name": "Query"
},
"superClass": {
"type": "Identifier",
"start": 296,
"end": 309,
"loc": {
"start": {
"line": 10,
"column": 20
},
"end": {
"line": 10,
"column": 33
},
"identifierName": "AbstractQuery"
},
"name": "AbstractQuery"
},
"body": {
"type": "ClassBody",
"start": 310,
"end": 7970,
"loc": {
"start": {
"line": 10,
"column": 34
},
"end": {
"line": 251,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 314,
"end": 722,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 26,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 314,
"end": 325,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 326,
"end": 336,
"loc": {
"start": {
"line": 11,
"column": 14
},
"end": {
"line": 11,
"column": 24
},
"identifierName": "connection"
},
"name": "connection"
},
{
"type": "Identifier",
"start": 338,
"end": 347,
"loc": {
"start": {
"line": 11,
"column": 26
},
"end": {
"line": 11,
"column": 35
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
{
"type": "Identifier",
"start": 349,
"end": 356,
"loc": {
"start": {
"line": 11,
"column": 37
},
"end": {
"line": 11,
"column": 44
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 358,
"end": 722,
"loc": {
"start": {
"line": 11,
"column": 46
},
"end": {
"line": 26,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 364,
"end": 372,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 12
}
},
"expression": {
"type": "CallExpression",
"start": 364,
"end": 371,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 11
}
},
"callee": {
"type": "Super",
"start": 364,
"end": 369,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 9
}
}
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 377,
"end": 406,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 377,
"end": 405,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 377,
"end": 392,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 377,
"end": 381,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 382,
"end": 392,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 19
},
"identifierName": "connection"
},
"name": "connection"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 395,
"end": 405,
"loc": {
"start": {
"line": 13,
"column": 22
},
"end": {
"line": 13,
"column": 32
},
"identifierName": "connection"
},
"name": "connection"
}
}
},
{
"type": "ExpressionStatement",
"start": 411,
"end": 444,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 37
}
},
"expression": {
"type": "AssignmentExpression",
"start": 411,
"end": 443,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 36
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 411,
"end": 424,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 411,
"end": 415,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 416,
"end": 424,
"loc": {
"start": {
"line": 14,
"column": 9
},
"end": {
"line": 14,
"column": 17
},
"identifierName": "instance"
},
"name": "instance"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 427,
"end": 443,
"loc": {
"start": {
"line": 14,
"column": 20
},
"end": {
"line": 14,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 427,
"end": 434,
"loc": {
"start": {
"line": 14,
"column": 20
},
"end": {
"line": 14,
"column": 27
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 435,
"end": 443,
"loc": {
"start": {
"line": 14,
"column": 28
},
"end": {
"line": 14,
"column": 36
},
"identifierName": "instance"
},
"name": "instance"
},
"computed": false
}
}
},
{
"type": "ExpressionStatement",
"start": 449,
"end": 476,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 449,
"end": 475,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 449,
"end": 459,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 449,
"end": 453,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 454,
"end": 459,
"loc": {
"start": {
"line": 15,
"column": 9
},
"end": {
"line": 15,
"column": 14
},
"identifierName": "model"
},
"name": "model"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 462,
"end": 475,
"loc": {
"start": {
"line": 15,
"column": 17
},
"end": {
"line": 15,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 462,
"end": 469,
"loc": {
"start": {
"line": 15,
"column": 17
},
"end": {
"line": 15,
"column": 24
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 470,
"end": 475,
"loc": {
"start": {
"line": 15,
"column": 25
},
"end": {
"line": 15,
"column": 30
},
"identifierName": "model"
},
"name": "model"
},
"computed": false
}
}
},
{
"type": "ExpressionStatement",
"start": 481,
"end": 508,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 481,
"end": 507,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 481,
"end": 495,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 481,
"end": 485,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 486,
"end": 495,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 18
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 498,
"end": 507,
"loc": {
"start": {
"line": 16,
"column": 21
},
"end": {
"line": 16,
"column": 30
},
"identifierName": "sequelize"
},
"name": "sequelize"
}
}
},
{
"type": "ExpressionStatement",
"start": 513,
"end": 535,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 26
}
},
"expression": {
"type": "AssignmentExpression",
"start": 513,
"end": 534,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 25
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 513,
"end": 522,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 13
}
},
"object": {
"type": "ThisExpression",
"start": 513,
"end": 517,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 518,
"end": 522,
"loc": {
"start": {
"line": 17,
"column": 9
},
"end": {
"line": 17,
"column": 13
},
"identifierName": "uuid"
},
"name": "uuid"
},
"computed": false
},
"right": {
"type": "CallExpression",
"start": 525,
"end": 534,
"loc": {
"start": {
"line": 17,
"column": 16
},
"end": {
"line": 17,
"column": 25
}
},
"callee": {
"type": "MemberExpression",
"start": 525,
"end": 532,
"loc": {
"start": {
"line": 17,
"column": 16
},
"end": {
"line": 17,
"column": 23
}
},
"object": {
"type": "Identifier",
"start": 525,
"end": 529,
"loc": {
"start": {
"line": 17,
"column": 16
},
"end": {
"line": 17,
"column": 20
},
"identifierName": "uuid"
},
"name": "uuid"
},
"property": {
"type": "Identifier",
"start": 530,
"end": 532,
"loc": {
"start": {
"line": 17,
"column": 21
},
"end": {
"line": 17,
"column": 23
},
"identifierName": "v4"
},
"name": "v4"
},
"computed": false
},
"arguments": []
}
}
},
{
"type": "ExpressionStatement",
"start": 540,
"end": 686,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 23,
"column": 22
}
},
"expression": {
"type": "AssignmentExpression",
"start": 540,
"end": 685,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 23,
"column": 21
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 540,
"end": 552,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 540,
"end": 544,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 545,
"end": 552,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 16
},
"identifierName": "options"
},
"name": "options"
},
"computed": false
},
"right": {
"type": "CallExpression",
"start": 555,
"end": 685,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 23,
"column": 21