sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,705 lines (1,704 loc) • 2.18 MB
JSON
{
"type": "File",
"start": 0,
"end": 9573,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 320,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 9573,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 320,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "VariableDeclaration",
"start": 15,
"end": 55,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 40
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 21,
"end": 54,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 39
}
},
"id": {
"type": "Identifier",
"start": 21,
"end": 28,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 13
},
"identifierName": "Pooling"
},
"name": "Pooling"
},
"init": {
"type": "CallExpression",
"start": 31,
"end": 54,
"loc": {
"start": {
"line": 3,
"column": 16
},
"end": {
"line": 3,
"column": 39
}
},
"callee": {
"type": "Identifier",
"start": 31,
"end": 38,
"loc": {
"start": {
"line": 3,
"column": 16
},
"end": {
"line": 3,
"column": 23
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 39,
"end": 53,
"loc": {
"start": {
"line": 3,
"column": 24
},
"end": {
"line": 3,
"column": 38
}
},
"extra": {
"rawValue": "generic-pool",
"raw": "'generic-pool'"
},
"value": "generic-pool"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 56,
"end": 97,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 41
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 62,
"end": 96,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 40
}
},
"id": {
"type": "Identifier",
"start": 62,
"end": 69,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 13
},
"identifierName": "Promise"
},
"name": "Promise"
},
"init": {
"type": "CallExpression",
"start": 72,
"end": 96,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 40
}
},
"callee": {
"type": "Identifier",
"start": 72,
"end": 79,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 23
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 80,
"end": 95,
"loc": {
"start": {
"line": 4,
"column": 24
},
"end": {
"line": 4,
"column": 39
}
},
"extra": {
"rawValue": "../../promise",
"raw": "'../../promise'"
},
"value": "../../promise"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 98,
"end": 126,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 104,
"end": 125,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 104,
"end": 105,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 7
},
"identifierName": "_"
},
"name": "_"
},
"init": {
"type": "CallExpression",
"start": 108,
"end": 125,
"loc": {
"start": {
"line": 5,
"column": 10
},
"end": {
"line": 5,
"column": 27
}
},
"callee": {
"type": "Identifier",
"start": 108,
"end": 115,
"loc": {
"start": {
"line": 5,
"column": 10
},
"end": {
"line": 5,
"column": 17
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 116,
"end": 124,
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 26
}
},
"extra": {
"rawValue": "lodash",
"raw": "'lodash'"
},
"value": "lodash"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 127,
"end": 164,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 133,
"end": 163,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 133,
"end": 138,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 11
},
"identifierName": "Utils"
},
"name": "Utils"
},
"init": {
"type": "CallExpression",
"start": 141,
"end": 163,
"loc": {
"start": {
"line": 6,
"column": 14
},
"end": {
"line": 6,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 141,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 14
},
"end": {
"line": 6,
"column": 21
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 149,
"end": 162,
"loc": {
"start": {
"line": 6,
"column": 22
},
"end": {
"line": 6,
"column": 35
}
},
"extra": {
"rawValue": "../../utils",
"raw": "'../../utils'"
},
"value": "../../utils"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 165,
"end": 218,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 53
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 171,
"end": 217,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 52
}
},
"id": {
"type": "Identifier",
"start": 171,
"end": 176,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 11
},
"identifierName": "debug"
},
"name": "debug"
},
"init": {
"type": "CallExpression",
"start": 179,
"end": 217,
"loc": {
"start": {
"line": 7,
"column": 14
},
"end": {
"line": 7,
"column": 52
}
},
"callee": {
"type": "MemberExpression",
"start": 179,
"end": 209,
"loc": {
"start": {
"line": 7,
"column": 14
},
"end": {
"line": 7,
"column": 44
}
},
"object": {
"type": "CallExpression",
"start": 179,
"end": 196,
"loc": {
"start": {
"line": 7,
"column": 14
},
"end": {
"line": 7,
"column": 31
}
},
"callee": {
"type": "MemberExpression",
"start": 179,
"end": 194,
"loc": {
"start": {
"line": 7,
"column": 14
},
"end": {
"line": 7,
"column": 29
}
},
"object": {
"type": "Identifier",
"start": 179,
"end": 184,
"loc": {
"start": {
"line": 7,
"column": 14
},
"end": {
"line": 7,
"column": 19
},
"identifierName": "Utils"
},
"name": "Utils"
},
"property": {
"type": "Identifier",
"start": 185,
"end": 194,
"loc": {
"start": {
"line": 7,
"column": 20
},
"end": {
"line": 7,
"column": 29
},
"identifierName": "getLogger"
},
"name": "getLogger"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 197,
"end": 209,
"loc": {
"start": {
"line": 7,
"column": 32
},
"end": {
"line": 7,
"column": 44
},
"identifierName": "debugContext"
},
"name": "debugContext"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 210,
"end": 216,
"loc": {
"start": {
"line": 7,
"column": 45
},
"end": {
"line": 7,
"column": 51
}
},
"extra": {
"rawValue": "pool",
"raw": "'pool'"
},
"value": "pool"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 219,
"end": 252,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 225,
"end": 251,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 225,
"end": 231,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "semver"
},
"name": "semver"
},
"init": {
"type": "CallExpression",
"start": 234,
"end": 251,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 234,
"end": 241,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 22
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 242,
"end": 250,
"loc": {
"start": {
"line": 8,
"column": 23
},
"end": {
"line": 8,
"column": 31
}
},
"extra": {
"rawValue": "semver",
"raw": "'semver'"
},
"value": "semver"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 253,
"end": 286,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 259,
"end": 285,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 259,
"end": 265,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 12
},
"identifierName": "timers"
},
"name": "timers"
},
"init": {
"type": "CallExpression",
"start": 268,
"end": 285,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 268,
"end": 275,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 22
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 276,
"end": 284,
"loc": {
"start": {
"line": 9,
"column": 23
},
"end": {
"line": 9,
"column": 31
}
},
"extra": {
"rawValue": "timers",
"raw": "'timers'"
},
"value": "timers"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 288,
"end": 400,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 17,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 294,
"end": 399,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 17,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 294,
"end": 314,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 26
},
"identifierName": "defaultPoolingConfig"
},
"name": "defaultPoolingConfig"
},
"init": {
"type": "ObjectExpression",
"start": 317,
"end": 399,
"loc": {
"start": {
"line": 11,
"column": 29
},
"end": {
"line": 17,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 321,
"end": 327,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 8
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 321,
"end": 324,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 5
},
"identifierName": "max"
},
"name": "max"
},
"value": {
"type": "NumericLiteral",
"start": 326,
"end": 327,
"loc": {
"start": {
"line": 12,
"column": 7
},
"end": {
"line": 12,
"column": 8
}
},
"extra": {
"rawValue": 5,
"raw": "5"
},
"value": 5
}
},
{
"type": "ObjectProperty",
"start": 331,
"end": 337,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 8
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 331,
"end": 334,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 5
},
"identifierName": "min"
},
"name": "min"
},
"value": {
"type": "NumericLiteral",
"start": 336,
"end": 337,
"loc": {
"start": {
"line": 13,
"column": 7
},
"end": {
"line": 13,
"column": 8
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "ObjectProperty",
"start": 341,
"end": 352,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 341,
"end": 345,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 6
},
"identifierName": "idle"
},
"name": "idle"
},
"value": {
"type": "NumericLiteral",
"start": 347,
"end": 352,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 13
}
},
"extra": {
"rawValue": 10000,
"raw": "10000"
},
"value": 10000
}
},
{
"type": "ObjectProperty",
"start": 356,
"end": 370,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 16
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 356,
"end": 363,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 9
},
"identifierName": "acquire"
},
"name": "acquire"
},
"value": {
"type": "NumericLiteral",
"start": 365,
"end": 370,
"loc": {
"start": {
"line": 15,
"column": 11
},
"end": {
"line": 15,
"column": 16
}
},
"extra": {
"rawValue": 10000,
"raw": "10000"
},
"value": 10000
}
},
{
"type": "ObjectProperty",
"start": 374,
"end": 397,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 25
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 374,
"end": 391,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 19
},
"identifierName": "handleDisconnects"
},
"name": "handleDisconnects"
},
"value": {
"type": "BooleanLiteral",
"start": 393,
"end": 397,
"loc": {
"start": {
"line": 16,
"column": 21
},
"end": {
"line": 16,
"column": 25
}
},
"value": true
}
}
]
}
}
],
"kind": "const"
},
{
"type": "ClassDeclaration",
"start": 402,
"end": 9437,
"loc": {
"start": {
"line": 19,
"column": 0
},
"end": {
"line": 315,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 408,
"end": 425,
"loc": {
"start": {
"line": 19,
"column": 6
},
"end": {
"line": 19,
"column": 23
},
"identifierName": "ConnectionManager"
},
"name": "ConnectionManager"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 426,
"end": 9437,
"loc": {
"start": {
"line": 19,
"column": 24
},
"end": {
"line": 315,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 430,
"end": 1175,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 45,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 430,
"end": 441,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 442,
"end": 449,
"loc": {
"start": {
"line": 20,
"column": 14
},
"end": {
"line": 20,
"column": 21
},
"identifierName": "dialect"
},
"name": "dialect"
},
{
"type": "Identifier",
"start": 451,
"end": 460,
"loc": {
"start": {
"line": 20,
"column": 23
},
"end": {
"line": 20,
"column": 32
},
"identifierName": "sequelize"
},
"name": "sequelize"
}
],
"body": {
"type": "BlockStatement",
"start": 462,
"end": 1175,
"loc": {
"start": {
"line": 20,
"column": 34
},
"end": {
"line": 45,
"column": 3
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 468,
"end": 513,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 49
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 474,
"end": 512,
"loc": {
"start": {
"line": 21,
"column": 10
},
"end": {
"line": 21,
"column": 48
}
},
"id": {
"type": "Identifier",
"start": 474,
"end": 480,
"loc": {
"start": {
"line": 21,
"column": 10
},
"end": {
"line": 21,
"column": 16
},
"identifierName": "config"
},
"name": "config"
},
"init": {
"type": "CallExpression",
"start": 483,
"end": 512,
"loc": {
"start": {
"line": 21,
"column": 19
},
"end": {
"line": 21,
"column": 48
}
},
"callee": {
"type": "MemberExpression",
"start": 483,
"end": 494,
"loc": {
"start": {
"line": 21,
"column": 19
},
"end": {
"line": 21,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 483,
"end": 484,
"loc": {
"start": {
"line": 21,
"column": 19
},
"end": {
"line": 21,
"column": 20
},
"identifierName": "_"
},
"name": "_"
},
"property": {
"type": "Identifier",
"start": 485,
"end": 494,
"loc": {
"start": {
"line": 21,
"column": 21
},
"end": {
"line": 21,
"column": 30
},
"identifierName": "cloneDeep"
},
"name": "cloneDeep"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 495,
"end": 511,
"loc": {
"start": {
"line": 21,
"column": 31
},
"end": {
"line": 21,
"column": 47
}
},
"object": {
"type": "Identifier",
"start": 495,
"end": 504,
"loc": {
"start": {
"line": 21,
"column": 31
},
"end": {
"line": 21,
"column": 40
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
"property": {
"type": "Identifier",
"start": 505,
"end": 511,
"loc": {
"start": {
"line": 21,
"column": 41
},
"end": {
"line": 21,
"column": 47
},
"identifierName": "config"
},
"name": "config"
},
"computed": false
}
]
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 519,
"end": 546,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 23,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 519,
"end": 545,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 23,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 519,
"end": 533,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 23,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 519,
"end": 523,
"loc": {
"start": {
"line": 23,
"column": 4
},
"end": {
"line": 23,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 524,
"end": 533,
"loc": {
"start": {
"line": 23,
"column": 9
},
"end": {
"line": 23,
"column": 18
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 536,
"end": 545,
"loc": {
"start": {
"line": 23,
"column": 21
},
"end": {
"line": 23,
"column": 30
},
"identifierName": "sequelize"
},
"name": "sequelize"
}
}
},
{
"type": "ExpressionStatement",
"start": 551,
"end": 572,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 25
}
},
"expression": {
"type": "AssignmentExpression",
"start": 551,
"end": 571,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 24
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 551,
"end": 562,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 15
}
},
"object": {
"type": "ThisExpression",
"start": 551,
"end": 555,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 556,
"end": 562,
"loc": {
"start": {
"line": 24,
"column": 9
},
"end": {
"line": 24,
"column": 15
},
"identifierName": "config"
},
"name": "config"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 565,
"end": 571,
"loc": {
"start": {
"line": 24,
"column": 18
},
"end": {
"line": 24,
"column": 24
},
"identifierName": "config"
},
"name": "config"
}
}
},
{
"type": "ExpressionStatement",
"start": 577,
"end": 600,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 577,
"end": 599,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",