UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,662 lines 3.15 MB
{ "type": "File", "start": 0, "end": 12551, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 368, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 12551, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 368, "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": 108, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 55 } }, "declarations": [ { "type": "VariableDeclarator", "start": 59, "end": 107, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 54 } }, "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": 107, "loc": { "start": { "line": 4, "column": 14 }, "end": { "line": 4, "column": 54 } }, "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": 106, "loc": { "start": { "line": 4, "column": 45 }, "end": { "line": 4, "column": 53 } }, "extra": { "rawValue": "sql:pg", "raw": "'sql:pg'" }, "value": "sql:pg" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 109, "end": 160, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 51 } }, "declarations": [ { "type": "VariableDeclarator", "start": 115, "end": 159, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 50 } }, "id": { "type": "Identifier", "start": 115, "end": 128, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 19 }, "identifierName": "AbstractQuery" }, "name": "AbstractQuery" }, "init": { "type": "CallExpression", "start": 131, "end": 159, "loc": { "start": { "line": 5, "column": 22 }, "end": { "line": 5, "column": 50 } }, "callee": { "type": "Identifier", "start": 131, "end": 138, "loc": { "start": { "line": 5, "column": 22 }, "end": { "line": 5, "column": 29 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 139, "end": 158, "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": 161, "end": 209, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 48 } }, "declarations": [ { "type": "VariableDeclarator", "start": 167, "end": 208, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 47 } }, "id": { "type": "Identifier", "start": 167, "end": 177, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 16 }, "identifierName": "QueryTypes" }, "name": "QueryTypes" }, "init": { "type": "CallExpression", "start": 180, "end": 208, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 6, "column": 47 } }, "callee": { "type": "Identifier", "start": 180, "end": 187, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 6, "column": 26 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 188, "end": 207, "loc": { "start": { "line": 6, "column": 27 }, "end": { "line": 6, "column": 46 } }, "extra": { "rawValue": "../../query-types", "raw": "'../../query-types'" }, "value": "../../query-types" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 210, "end": 251, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", "start": 216, "end": 250, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 40 } }, "id": { "type": "Identifier", "start": 216, "end": 223, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 13 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 226, "end": 250, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 40 } }, "callee": { "type": "Identifier", "start": 226, "end": 233, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 234, "end": 249, "loc": { "start": { "line": 7, "column": 24 }, "end": { "line": 7, "column": 39 } }, "extra": { "rawValue": "../../promise", "raw": "'../../promise'" }, "value": "../../promise" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 252, "end": 303, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 51 } }, "declarations": [ { "type": "VariableDeclarator", "start": 258, "end": 302, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 50 } }, "id": { "type": "Identifier", "start": 258, "end": 273, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 21 }, "identifierName": "sequelizeErrors" }, "name": "sequelizeErrors" }, "init": { "type": "CallExpression", "start": 276, "end": 302, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 50 } }, "callee": { "type": "Identifier", "start": 276, "end": 283, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 284, "end": 301, "loc": { "start": { "line": 8, "column": 32 }, "end": { "line": 8, "column": 49 } }, "extra": { "rawValue": "../../errors.js", "raw": "'../../errors.js'" }, "value": "../../errors.js" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 304, "end": 332, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 310, "end": 331, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 27 } }, "id": { "type": "Identifier", "start": 310, "end": 311, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 314, "end": 331, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 27 } }, "callee": { "type": "Identifier", "start": 314, "end": 321, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 322, "end": 330, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 9, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const" }, { "type": "ClassDeclaration", "start": 334, "end": 12462, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 362, "column": 1 } }, "id": { "type": "Identifier", "start": 340, "end": 345, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 11 }, "identifierName": "Query" }, "name": "Query" }, "superClass": { "type": "Identifier", "start": 354, "end": 367, "loc": { "start": { "line": 11, "column": 20 }, "end": { "line": 11, "column": 33 }, "identifierName": "AbstractQuery" }, "name": "AbstractQuery" }, "body": { "type": "ClassBody", "start": 368, "end": 12462, "loc": { "start": { "line": 11, "column": 34 }, "end": { "line": 362, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 372, "end": 708, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 25, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 372, "end": 383, "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": 384, "end": 390, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 20 }, "identifierName": "client" }, "name": "client" }, { "type": "Identifier", "start": 392, "end": 401, "loc": { "start": { "line": 12, "column": 22 }, "end": { "line": 12, "column": 31 }, "identifierName": "sequelize" }, "name": "sequelize" }, { "type": "Identifier", "start": 403, "end": 410, "loc": { "start": { "line": 12, "column": 33 }, "end": { "line": 12, "column": 40 }, "identifierName": "options" }, "name": "options" } ], "body": { "type": "BlockStatement", "start": 412, "end": 708, "loc": { "start": { "line": 12, "column": 42 }, "end": { "line": 25, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 418, "end": 426, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 12 } }, "expression": { "type": "CallExpression", "start": 418, "end": 425, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 11 } }, "callee": { "type": "Super", "start": 418, "end": 423, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 431, "end": 452, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 25 } }, "expression": { "type": "AssignmentExpression", "start": 431, "end": 451, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 431, "end": 442, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 15 } }, "object": { "type": "ThisExpression", "start": 431, "end": 435, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 8 } } }, "property": { "type": "Identifier", "start": 436, "end": 442, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 15 }, "identifierName": "client" }, "name": "client" }, "computed": false }, "right": { "type": "Identifier", "start": 445, "end": 451, "loc": { "start": { "line": 14, "column": 18 }, "end": { "line": 14, "column": 24 }, "identifierName": "client" }, "name": "client" } } }, { "type": "ExpressionStatement", "start": 457, "end": 484, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 457, "end": 483, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 457, "end": 471, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 18 } }, "object": { "type": "ThisExpression", "start": 457, "end": 461, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 8 } } }, "property": { "type": "Identifier", "start": 462, "end": 471, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 474, "end": 483, "loc": { "start": { "line": 15, "column": 21 }, "end": { "line": 15, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 489, "end": 522, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 37 } }, "expression": { "type": "AssignmentExpression", "start": 489, "end": 521, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 489, "end": 502, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 17 } }, "object": { "type": "ThisExpression", "start": 489, "end": 493, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 8 } } }, "property": { "type": "Identifier", "start": 494, "end": 502, "loc": { "start": { "line": 16, "column": 9 }, "end": { "line": 16, "column": 17 }, "identifierName": "instance" }, "name": "instance" }, "computed": false }, "right": { "type": "MemberExpression", "start": 505, "end": 521, "loc": { "start": { "line": 16, "column": 20 }, "end": { "line": 16, "column": 36 } }, "object": { "type": "Identifier", "start": 505, "end": 512, "loc": { "start": { "line": 16, "column": 20 }, "end": { "line": 16, "column": 27 }, "identifierName": "options" }, "name": "options" }, "property": { "type": "Identifier", "start": 513, "end": 521, "loc": { "start": { "line": 16, "column": 28 }, "end": { "line": 16, "column": 36 }, "identifierName": "instance" }, "name": "instance" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 527, "end": 554, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 527, "end": 553, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 527, "end": 537, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 14 } }, "object": { "type": "ThisExpression", "start": 527, "end": 531, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 } } }, "property": { "type": "Identifier", "start": 532, "end": 537, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 14 }, "identifierName": "model" }, "name": "model" }, "computed": false }, "right": { "type": "MemberExpression", "start": 540, "end": 553, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 30 } }, "object": { "type": "Identifier", "start": 540, "end": 547, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 24 }, "identifierName": "options" }, "name": "options" }, "property": { "type": "Identifier", "start": 548, "end": 553, "loc": { "start": { "line": 17, "column": 25 }, "end": { "line": 17, "column": 30 }, "identifierName": "model" }, "name": "model" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 559, "end": 672, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 22, "column": 22 } }, "expression": { "type": "AssignmentExpression", "start": 559, "end": 671, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 22, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 559, "end": 571, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 16 } }, "object": { "type": "ThisExpression", "start": 559, "end": 563, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } } }, "property": { "type": "Identifier", "start": 564, "end": 571, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 16 }, "identifierName": "options" }, "name": "options" }, "computed": false }, "right": { "type": "CallExpression", "start": 574, "end": 671, "loc": { "start": { "line": 18, "column": 19 }, "end": { "line": 22, "column": 21 } }, "callee": { "type": "MemberExpression", "start": 574, "end": 582, "loc": { "start": { "line": 18, "column": 19 }, "end": { "line": 18, "column": 27 } }, "object": { "type": "Identifier", "start": 574, "end": 575, "loc": { "start": { "line": 18, "column": 19 }, "end": { "line": 18, "column": 20 }, "identifierName": "_" }, "name": "_" }, "property": { "type": "Identifier", "start": 576, "end": 582, "loc": { "start": { "line": 18, "column": 21 }, "end": { "line": 18, "column": 27 }, "identifierName": "extend" }, "name": "extend" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 583, "end": 655, "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 22, "column": 5 } }, "propertie