UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,705 lines (1,704 loc) 4.08 MB
{ "type": "File", "start": 0, "end": 14816, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 403, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 14816, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 403, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 43, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 42, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 27 } }, "id": { "type": "Identifier", "start": 21, "end": 22, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 25, "end": 42, "loc": { "start": { "line": 3, "column": 10 }, "end": { "line": 3, "column": 27 } }, "callee": { "type": "Identifier", "start": 25, "end": 32, "loc": { "start": { "line": 3, "column": 10 }, "end": { "line": 3, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 33, "end": 41, "loc": { "start": { "line": 3, "column": 18 }, "end": { "line": 3, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 44, "end": 81, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 50, "end": 80, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 36 } }, "id": { "type": "Identifier", "start": 50, "end": 55, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 11 }, "identifierName": "Utils" }, "name": "Utils" }, "init": { "type": "CallExpression", "start": 58, "end": 80, "loc": { "start": { "line": 4, "column": 14 }, "end": { "line": 4, "column": 36 } }, "callee": { "type": "Identifier", "start": 58, "end": 65, "loc": { "start": { "line": 4, "column": 14 }, "end": { "line": 4, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 66, "end": 79, "loc": { "start": { "line": 4, "column": 22 }, "end": { "line": 4, "column": 35 } }, "extra": { "rawValue": "../../utils", "raw": "'../../utils'" }, "value": "../../utils" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 82, "end": 141, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 59 } }, "declarations": [ { "type": "VariableDeclarator", "start": 88, "end": 140, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 58 } }, "id": { "type": "Identifier", "start": 88, "end": 93, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 11 }, "identifierName": "debug" }, "name": "debug" }, "init": { "type": "CallExpression", "start": 96, "end": 140, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 58 } }, "callee": { "type": "MemberExpression", "start": 96, "end": 126, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 44 } }, "object": { "type": "CallExpression", "start": 96, "end": 113, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 31 } }, "callee": { "type": "MemberExpression", "start": 96, "end": 111, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 29 } }, "object": { "type": "Identifier", "start": 96, "end": 101, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 19 }, "identifierName": "Utils" }, "name": "Utils" }, "property": { "type": "Identifier", "start": 102, "end": 111, "loc": { "start": { "line": 5, "column": 20 }, "end": { "line": 5, "column": 29 }, "identifierName": "getLogger" }, "name": "getLogger" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 114, "end": 126, "loc": { "start": { "line": 5, "column": 32 }, "end": { "line": 5, "column": 44 }, "identifierName": "debugContext" }, "name": "debugContext" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 127, "end": 139, "loc": { "start": { "line": 5, "column": 45 }, "end": { "line": 5, "column": 57 } }, "extra": { "rawValue": "sql:sqlite", "raw": "'sql:sqlite'" }, "value": "sql:sqlite" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 142, "end": 183, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", "start": 148, "end": 182, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 40 } }, "id": { "type": "Identifier", "start": 148, "end": 155, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 13 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 158, "end": 182, "loc": { "start": { "line": 6, "column": 16 }, "end": { "line": 6, "column": 40 } }, "callee": { "type": "Identifier", "start": 158, "end": 165, "loc": { "start": { "line": 6, "column": 16 }, "end": { "line": 6, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 166, "end": 181, "loc": { "start": { "line": 6, "column": 24 }, "end": { "line": 6, "column": 39 } }, "extra": { "rawValue": "../../promise", "raw": "'../../promise'" }, "value": "../../promise" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 184, "end": 235, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 51 } }, "declarations": [ { "type": "VariableDeclarator", "start": 190, "end": 234, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 50 } }, "id": { "type": "Identifier", "start": 190, "end": 203, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 19 }, "identifierName": "AbstractQuery" }, "name": "AbstractQuery" }, "init": { "type": "CallExpression", "start": 206, "end": 234, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 50 } }, "callee": { "type": "Identifier", "start": 206, "end": 213, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 29 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 214, "end": 233, "loc": { "start": { "line": 7, "column": 30 }, "end": { "line": 7, "column": 49 } }, "extra": { "rawValue": "../abstract/query", "raw": "'../abstract/query'" }, "value": "../abstract/query" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 236, "end": 284, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 48 } }, "declarations": [ { "type": "VariableDeclarator", "start": 242, "end": 283, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 47 } }, "id": { "type": "Identifier", "start": 242, "end": 252, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 16 }, "identifierName": "QueryTypes" }, "name": "QueryTypes" }, "init": { "type": "CallExpression", "start": 255, "end": 283, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 47 } }, "callee": { "type": "Identifier", "start": 255, "end": 262, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 26 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 263, "end": 282, "loc": { "start": { "line": 8, "column": 27 }, "end": { "line": 8, "column": 46 } }, "extra": { "rawValue": "../../query-types", "raw": "'../../query-types'" }, "value": "../../query-types" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 285, "end": 336, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 51 } }, "declarations": [ { "type": "VariableDeclarator", "start": 291, "end": 335, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 50 } }, "id": { "type": "Identifier", "start": 291, "end": 306, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 21 }, "identifierName": "sequelizeErrors" }, "name": "sequelizeErrors" }, "init": { "type": "CallExpression", "start": 309, "end": 335, "loc": { "start": { "line": 9, "column": 24 }, "end": { "line": 9, "column": 50 } }, "callee": { "type": "Identifier", "start": 309, "end": 316, "loc": { "start": { "line": 9, "column": 24 }, "end": { "line": 9, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 317, "end": 334, "loc": { "start": { "line": 9, "column": 32 }, "end": { "line": 9, "column": 49 } }, "extra": { "rawValue": "../../errors.js", "raw": "'../../errors.js'" }, "value": "../../errors.js" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 337, "end": 393, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 56 } }, "declarations": [ { "type": "VariableDeclarator", "start": 343, "end": 392, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 55 } }, "id": { "type": "Identifier", "start": 343, "end": 354, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 17 }, "identifierName": "parserStore" }, "name": "parserStore" }, "init": { "type": "CallExpression", "start": 357, "end": 392, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 55 } }, "callee": { "type": "CallExpression", "start": 357, "end": 382, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 45 } }, "callee": { "type": "Identifier", "start": 357, "end": 364, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 27 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 365, "end": 381, "loc": { "start": { "line": 10, "column": 28 }, "end": { "line": 10, "column": 44 } }, "extra": { "rawValue": "../parserStore", "raw": "'../parserStore'" }, "value": "../parserStore" } ] }, "arguments": [ { "type": "StringLiteral", "start": 383, "end": 391, "loc": { "start": { "line": 10, "column": 46 }, "end": { "line": 10, "column": 54 } }, "extra": { "rawValue": "sqlite", "raw": "'sqlite'" }, "value": "sqlite" } ] } } ], "kind": "const" }, { "type": "ClassDeclaration", "start": 395, "end": 14728, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 398, "column": 1 } }, "id": { "type": "Identifier", "start": 401, "end": 406, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 11 }, "identifierName": "Query" }, "name": "Query" }, "superClass": { "type": "Identifier", "start": 415, "end": 428, "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 33 }, "identifierName": "AbstractQuery" }, "name": "AbstractQuery" }, "body": { "type": "ClassBody", "start": 429, "end": 14728, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 398, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 434, "end": 776, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 27, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 434, "end": 445, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 14, "column": 13 }, "identifierName": "constructor" }, "name": "constructor" }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 446, "end": 454, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 22 }, "identifierName": "database" }, "name": "database" }, { "type": "Identifier", "start": 456, "end": 465, "loc": { "start": { "line": 14, "column": 24 }, "end": { "line": 14, "column": 33 }, "identifierName": "sequelize" }, "name": "sequelize" }, { "type": "Identifier", "start": 467, "end": 474, "loc": { "start": { "line": 14, "column": 35 }, "end": { "line": 14, "column": 42 }, "identifierName": "options" }, "name": "options" } ], "body": { "type": "BlockStatement", "start": 476, "end": 776, "loc": { "start": { "line": 14, "column": 44 }, "end": { "line": 27, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 482, "end": 490, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 12 } }, "expression": { "type": "CallExpression", "start": 482, "end": 489, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 11 } }, "callee": { "type": "Super", "start": 482, "end": 487, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 9 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 495, "end": 520, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 29 } }, "expression": { "type": "AssignmentExpression", "start": 495, "end": 519, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 495, "end": 508, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 17 } }, "object": { "type": "ThisExpression", "start": 495, "end": 499, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 8 } } }, "property": { "type": "Identifier", "start": 500, "end": 508, "loc": { "start": { "line": 16, "column": 9 }, "end": { "line": 16, "column": 17 }, "identifierName": "database" }, "name": "database" }, "computed": false }, "right": { "type": "Identifier", "start": 511, "end": 519, "loc": { "start": { "line": 16, "column": 20 }, "end": { "line": 16, "column": 28 }, "identifierName": "database" }, "name": "database" } } }, { "type": "ExpressionStatement", "start": 525, "end": 552, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 525, "end": 551, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 525, "end": 539, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 18 } }, "object": { "type": "ThisExpression", "start": 525, "end": 529, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 } } }, "property": { "type": "Identifier", "start": 530, "end": 539, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 542, "end": 551, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 557, "end": 590, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 37 } }, "expression": { "type": "AssignmentExpression", "start": 557, "end": 589, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 557, "end": 570, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 17 } }, "object": { "type": "ThisExpression", "start": 557, "end": 561, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } } }, "property": { "type": "Identifier", "start": 562, "end": 570, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 17 }, "identifierName": "instance" }, "name": "instance" }, "computed": false }, "right": { "type": "MemberExpression", "start": 573, "end": 589, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 36 } }, "object": { "type": "Identifier", "start": 573, "end": 580, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 27 }, "identifierName": "options" }, "name": "options" }, "property": { "type": "Identifier", "start": 581, "end": 589, "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 18, "column": 36 }, "identifierName": "instance" }, "name": "instance" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 595, "end": 622, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 595, "end": 621, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 595, "end": 605, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 14 } }, "object": { "type": "ThisExpression", "start": 595, "end": 599, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 8 } } }, "property": { "type": "Identifier", "start": 600, "end": 605, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 14 }, "identifierName": "model" }, "name": "model" }, "computed": false }, "right": { "type": "MemberExpression", "start": 608, "end": 621, "loc": { "start": { "line": 19, "column": 17 }, "end": { "line": 19, "column": 30 } }, "object": { "type": "Identifier", "start": 608, "end": 615, "loc": { "start": { "line": 19, "column": 17 }, "end": { "line": 19, "column": 24 }, "identifierName": "options" }, "name": "options" }, "property": { "type": "Identifier", "start": 616, "end": 621, "loc": { "start": { "line": 19, "column": 25 }, "end": { "line": 19, "column": 30 }, "identifierName": "model" }, "name": "model" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 627, "end": 740, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 24, "column": 22 } }, "expression": { "type": "AssignmentExpression", "start": 627, "end": 739, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 24, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 627, "end": 639, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 16 } }, "object": { "type": "ThisExpression", "start": 627, "end": 631, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 8 } } },