sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,670 lines (1,669 loc) • 2.49 MB
JSON
{
"type": "File",
"start": 0,
"end": 11513,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 335,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 11513,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 335,
"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:mssql",
"raw": "'sql:mssql'"
},
"value": "sql:mssql"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 112,
"end": 153,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 41
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 118,
"end": 152,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 40
}
},
"id": {
"type": "Identifier",
"start": 118,
"end": 125,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 13
},
"identifierName": "Promise"
},
"name": "Promise"
},
"init": {
"type": "CallExpression",
"start": 128,
"end": 152,
"loc": {
"start": {
"line": 5,
"column": 16
},
"end": {
"line": 5,
"column": 40
}
},
"callee": {
"type": "Identifier",
"start": 128,
"end": 135,
"loc": {
"start": {
"line": 5,
"column": 16
},
"end": {
"line": 5,
"column": 23
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 136,
"end": 151,
"loc": {
"start": {
"line": 5,
"column": 24
},
"end": {
"line": 5,
"column": 39
}
},
"extra": {
"rawValue": "../../promise",
"raw": "'../../promise'"
},
"value": "../../promise"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 154,
"end": 205,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 51
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 160,
"end": 204,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 50
}
},
"id": {
"type": "Identifier",
"start": 160,
"end": 173,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 19
},
"identifierName": "AbstractQuery"
},
"name": "AbstractQuery"
},
"init": {
"type": "CallExpression",
"start": 176,
"end": 204,
"loc": {
"start": {
"line": 6,
"column": 22
},
"end": {
"line": 6,
"column": 50
}
},
"callee": {
"type": "Identifier",
"start": 176,
"end": 183,
"loc": {
"start": {
"line": 6,
"column": 22
},
"end": {
"line": 6,
"column": 29
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 184,
"end": 203,
"loc": {
"start": {
"line": 6,
"column": 30
},
"end": {
"line": 6,
"column": 49
}
},
"extra": {
"rawValue": "../abstract/query",
"raw": "'../abstract/query'"
},
"value": "../abstract/query"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 206,
"end": 257,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 51
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 212,
"end": 256,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 50
}
},
"id": {
"type": "Identifier",
"start": 212,
"end": 227,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 21
},
"identifierName": "sequelizeErrors"
},
"name": "sequelizeErrors"
},
"init": {
"type": "CallExpression",
"start": 230,
"end": 256,
"loc": {
"start": {
"line": 7,
"column": 24
},
"end": {
"line": 7,
"column": 50
}
},
"callee": {
"type": "Identifier",
"start": 230,
"end": 237,
"loc": {
"start": {
"line": 7,
"column": 24
},
"end": {
"line": 7,
"column": 31
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 238,
"end": 255,
"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": 258,
"end": 313,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 55
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 264,
"end": 312,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 54
}
},
"id": {
"type": "Identifier",
"start": 264,
"end": 275,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 17
},
"identifierName": "parserStore"
},
"name": "parserStore"
},
"init": {
"type": "CallExpression",
"start": 278,
"end": 312,
"loc": {
"start": {
"line": 8,
"column": 20
},
"end": {
"line": 8,
"column": 54
}
},
"callee": {
"type": "CallExpression",
"start": 278,
"end": 303,
"loc": {
"start": {
"line": 8,
"column": 20
},
"end": {
"line": 8,
"column": 45
}
},
"callee": {
"type": "Identifier",
"start": 278,
"end": 285,
"loc": {
"start": {
"line": 8,
"column": 20
},
"end": {
"line": 8,
"column": 27
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 286,
"end": 302,
"loc": {
"start": {
"line": 8,
"column": 28
},
"end": {
"line": 8,
"column": 44
}
},
"extra": {
"rawValue": "../parserStore",
"raw": "'../parserStore'"
},
"value": "../parserStore"
}
]
},
"arguments": [
{
"type": "StringLiteral",
"start": 304,
"end": 311,
"loc": {
"start": {
"line": 8,
"column": 46
},
"end": {
"line": 8,
"column": 53
}
},
"extra": {
"rawValue": "mssql",
"raw": "'mssql'"
},
"value": "mssql"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 314,
"end": 342,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 320,
"end": 341,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 320,
"end": 321,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 7
},
"identifierName": "_"
},
"name": "_"
},
"init": {
"type": "CallExpression",
"start": 324,
"end": 341,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 27
}
},
"callee": {
"type": "Identifier",
"start": 324,
"end": 331,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 17
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 332,
"end": 340,
"loc": {
"start": {
"line": 9,
"column": 18
},
"end": {
"line": 9,
"column": 26
}
},
"extra": {
"rawValue": "lodash",
"raw": "'lodash'"
},
"value": "lodash"
}
]
}
}
],
"kind": "const"
},
{
"type": "ClassDeclaration",
"start": 344,
"end": 11425,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 330,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 350,
"end": 355,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 11
},
"identifierName": "Query"
},
"name": "Query"
},
"superClass": {
"type": "Identifier",
"start": 364,
"end": 377,
"loc": {
"start": {
"line": 11,
"column": 20
},
"end": {
"line": 11,
"column": 33
},
"identifierName": "AbstractQuery"
},
"name": "AbstractQuery"
},
"body": {
"type": "ClassBody",
"start": 378,
"end": 11425,
"loc": {
"start": {
"line": 11,
"column": 34
},
"end": {
"line": 330,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 382,
"end": 736,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 25,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 382,
"end": 393,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 394,
"end": 404,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 24
},
"identifierName": "connection"
},
"name": "connection"
},
{
"type": "Identifier",
"start": 406,
"end": 415,
"loc": {
"start": {
"line": 12,
"column": 26
},
"end": {
"line": 12,
"column": 35
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
{
"type": "Identifier",
"start": 417,
"end": 424,
"loc": {
"start": {
"line": 12,
"column": 37
},
"end": {
"line": 12,
"column": 44
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 426,
"end": 736,
"loc": {
"start": {
"line": 12,
"column": 46
},
"end": {
"line": 25,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 432,
"end": 440,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 12
}
},
"expression": {
"type": "CallExpression",
"start": 432,
"end": 439,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 11
}
},
"callee": {
"type": "Super",
"start": 432,
"end": 437,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 445,
"end": 474,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 33
}
},
"expression": {
"type": "AssignmentExpression",
"start": 445,
"end": 473,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 32
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 445,
"end": 460,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 19
}
},
"object": {
"type": "ThisExpression",
"start": 445,
"end": 449,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 450,
"end": 460,
"loc": {
"start": {
"line": 14,
"column": 9
},
"end": {
"line": 14,
"column": 19
},
"identifierName": "connection"
},
"name": "connection"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 463,
"end": 473,
"loc": {
"start": {
"line": 14,
"column": 22
},
"end": {
"line": 14,
"column": 32
},
"identifierName": "connection"
},
"name": "connection"
}
}
},
{
"type": "ExpressionStatement",
"start": 479,
"end": 512,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 37
}
},
"expression": {
"type": "AssignmentExpression",
"start": 479,
"end": 511,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 36
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 479,
"end": 492,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 17
}
},
"object": {
"type": "ThisExpression",
"start": 479,
"end": 483,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 484,
"end": 492,
"loc": {
"start": {
"line": 15,
"column": 9
},
"end": {
"line": 15,
"column": 17
},
"identifierName": "instance"
},
"name": "instance"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 495,
"end": 511,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 36
}
},
"object": {
"type": "Identifier",
"start": 495,
"end": 502,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 27
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 503,
"end": 511,
"loc": {
"start": {
"line": 15,
"column": 28
},
"end": {
"line": 15,
"column": 36
},
"identifierName": "instance"
},
"name": "instance"
},
"computed": false
}
}
},
{
"type": "ExpressionStatement",
"start": 517,
"end": 544,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 517,
"end": 543,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 517,
"end": 527,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 517,
"end": 521,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 522,
"end": 527,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 14
},
"identifierName": "model"
},
"name": "model"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 530,
"end": 543,
"loc": {
"start": {
"line": 16,
"column": 17
},
"end": {
"line": 16,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 530,
"end": 537,
"loc": {
"start": {
"line": 16,
"column": 17
},
"end": {
"line": 16,
"column": 24
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 538,
"end": 543,
"loc": {
"start": {
"line": 16,
"column": 25
},
"end": {
"line": 16,
"column": 30
},
"identifierName": "model"
},
"name": "model"
},
"computed": false
}
}
},
{
"type": "ExpressionStatement",
"start": 549,
"end": 576,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 549,
"end": 575,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 549,
"end": 563,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 549,
"end": 553,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 554,
"end": 563,
"loc": {
"start": {
"line": 17,
"column": 9
},
"end": {
"line": 17,
"column": 18
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 566,
"end": 575,
"loc": {
"start": {
"line": 17,
"column": 21
},
"end": {
"line": 17,
"column": 30
},
"identifierName": "sequelize"
},
"name": "sequelize"
}
}
},
{
"type": "ExpressionStatement",
"start": 581,
"end": 700,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 22,
"column": 22
}
},
"expression": {
"type": "AssignmentExpression",
"start": 581,
"end": 699,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 22,
"column": 21
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 581,
"end": 593,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 581,
"end": 585,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 586,
"end": 593,
"loc": {
"start": {
"line": 18,
"column": 9
},
"end": {
"line": 18,
"column": 16
},
"identifierName": "options"
},
"name": "options"
},
"computed": false
},
"right": {
"type": "CallExpression",
"start": 596,
"end": 699,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 22,
"column": 21
}
},
"callee": {
"type": "MemberExpression",
"start": 596,
"end": 610,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 18,
"column": 33
}
},
"object": {
"type": "MemberExpression",
"start": 596,
"end": 603,
"loc": {
"start": {
"line": 18,
"column": 19
},
"end": {
"line": 18,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 596,
"end": 601,
"loc": {
"start": {
"line": 18,
"column": 19