UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,715 lines 960 kB
{ "type": "File", "start": 0, "end": 4929, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 156, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 4929, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 156, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 91, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 76 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 90, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 75 } }, "id": { "type": "Identifier", "start": 21, "end": 46, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 31 }, "identifierName": "AbstractConnectionManager" }, "name": "AbstractConnectionManager" }, "init": { "type": "CallExpression", "start": 49, "end": 90, "loc": { "start": { "line": 3, "column": 34 }, "end": { "line": 3, "column": 75 } }, "callee": { "type": "Identifier", "start": 49, "end": 56, "loc": { "start": { "line": 3, "column": 34 }, "end": { "line": 3, "column": 41 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 57, "end": 89, "loc": { "start": { "line": 3, "column": 42 }, "end": { "line": 3, "column": 74 } }, "extra": { "rawValue": "../abstract/connection-manager", "raw": "'../abstract/connection-manager'" }, "value": "../abstract/connection-manager" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 92, "end": 140, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 48 } }, "declarations": [ { "type": "VariableDeclarator", "start": 98, "end": 139, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 47 } }, "id": { "type": "Identifier", "start": 98, "end": 110, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 18 }, "identifierName": "ResourceLock" }, "name": "ResourceLock" }, "init": { "type": "CallExpression", "start": 113, "end": 139, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 47 } }, "callee": { "type": "Identifier", "start": 113, "end": 120, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 28 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 121, "end": 138, "loc": { "start": { "line": 4, "column": 29 }, "end": { "line": 4, "column": 46 } }, "extra": { "rawValue": "./resource-lock", "raw": "'./resource-lock'" }, "value": "./resource-lock" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 141, "end": 182, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", "start": 147, "end": 181, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 40 } }, "id": { "type": "Identifier", "start": 147, "end": 154, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 13 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 157, "end": 181, "loc": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 40 } }, "callee": { "type": "Identifier", "start": 157, "end": 164, "loc": { "start": { "line": 5, "column": 16 }, "end": { "line": 5, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 165, "end": 180, "loc": { "start": { "line": 5, "column": 24 }, "end": { "line": 5, "column": 39 } }, "extra": { "rawValue": "../../promise", "raw": "'../../promise'" }, "value": "../../promise" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 183, "end": 220, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 189, "end": 219, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 36 } }, "id": { "type": "Identifier", "start": 189, "end": 194, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 11 }, "identifierName": "Utils" }, "name": "Utils" }, "init": { "type": "CallExpression", "start": 197, "end": 219, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 36 } }, "callee": { "type": "Identifier", "start": 197, "end": 204, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 205, "end": 218, "loc": { "start": { "line": 6, "column": 22 }, "end": { "line": 6, "column": 35 } }, "extra": { "rawValue": "../../utils", "raw": "'../../utils'" }, "value": "../../utils" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 221, "end": 286, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 65 } }, "declarations": [ { "type": "VariableDeclarator", "start": 227, "end": 285, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 64 } }, "id": { "type": "Identifier", "start": 227, "end": 232, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 11 }, "identifierName": "debug" }, "name": "debug" }, "init": { "type": "CallExpression", "start": 235, "end": 285, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 64 } }, "callee": { "type": "MemberExpression", "start": 235, "end": 265, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 44 } }, "object": { "type": "CallExpression", "start": 235, "end": 252, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 31 } }, "callee": { "type": "MemberExpression", "start": 235, "end": 250, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 29 } }, "object": { "type": "Identifier", "start": 235, "end": 240, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 19 }, "identifierName": "Utils" }, "name": "Utils" }, "property": { "type": "Identifier", "start": 241, "end": 250, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 29 }, "identifierName": "getLogger" }, "name": "getLogger" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 253, "end": 265, "loc": { "start": { "line": 7, "column": 32 }, "end": { "line": 7, "column": 44 }, "identifierName": "debugContext" }, "name": "debugContext" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 266, "end": 284, "loc": { "start": { "line": 7, "column": 45 }, "end": { "line": 7, "column": 63 } }, "extra": { "rawValue": "connection:mssql", "raw": "'connection:mssql'" }, "value": "connection:mssql" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 287, "end": 367, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 80 } }, "declarations": [ { "type": "VariableDeclarator", "start": 293, "end": 366, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 79 } }, "id": { "type": "Identifier", "start": 293, "end": 305, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 18 }, "identifierName": "debugTedious" }, "name": "debugTedious" }, "init": { "type": "CallExpression", "start": 308, "end": 366, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 79 } }, "callee": { "type": "MemberExpression", "start": 308, "end": 338, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 51 } }, "object": { "type": "CallExpression", "start": 308, "end": 325, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 38 } }, "callee": { "type": "MemberExpression", "start": 308, "end": 323, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 36 } }, "object": { "type": "Identifier", "start": 308, "end": 313, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 26 }, "identifierName": "Utils" }, "name": "Utils" }, "property": { "type": "Identifier", "start": 314, "end": 323, "loc": { "start": { "line": 8, "column": 27 }, "end": { "line": 8, "column": 36 }, "identifierName": "getLogger" }, "name": "getLogger" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 326, "end": 338, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 51 }, "identifierName": "debugContext" }, "name": "debugContext" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 339, "end": 365, "loc": { "start": { "line": 8, "column": 52 }, "end": { "line": 8, "column": 78 } }, "extra": { "rawValue": "connection:mssql:tedious", "raw": "'connection:mssql:tedious'" }, "value": "connection:mssql:tedious" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 368, "end": 416, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 48 } }, "declarations": [ { "type": "VariableDeclarator", "start": 374, "end": 415, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 47 } }, "id": { "type": "Identifier", "start": 374, "end": 389, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 21 }, "identifierName": "sequelizeErrors" }, "name": "sequelizeErrors" }, "init": { "type": "CallExpression", "start": 392, "end": 415, "loc": { "start": { "line": 9, "column": 24 }, "end": { "line": 9, "column": 47 } }, "callee": { "type": "Identifier", "start": 392, "end": 399, "loc": { "start": { "line": 9, "column": 24 }, "end": { "line": 9, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 400, "end": 414, "loc": { "start": { "line": 9, "column": 32 }, "end": { "line": 9, "column": 46 } }, "extra": { "rawValue": "../../errors", "raw": "'../../errors'" }, "value": "../../errors" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 417, "end": 472, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 55 } }, "declarations": [ { "type": "VariableDeclarator", "start": 423, "end": 471, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 54 } }, "id": { "type": "Identifier", "start": 423, "end": 434, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 17 }, "identifierName": "parserStore" }, "name": "parserStore" }, "init": { "type": "CallExpression", "start": 437, "end": 471, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 54 } }, "callee": { "type": "CallExpression", "start": 437, "end": 462, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 45 } }, "callee": { "type": "Identifier", "start": 437, "end": 444, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 27 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 445, "end": 461, "loc": { "start": { "line": 10, "column": 28 }, "end": { "line": 10, "column": 44 } }, "extra": { "rawValue": "../parserStore", "raw": "'../parserStore'" }, "value": "../parserStore" } ] }, "arguments": [ { "type": "StringLiteral", "start": 463, "end": 470, "loc": { "start": { "line": 10, "column": 46 }, "end": { "line": 10, "column": 53 } }, "extra": { "rawValue": "mssql", "raw": "'mssql'" }, "value": "mssql" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 473, "end": 501, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 479, "end": 500, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 27 } }, "id": { "type": "Identifier", "start": 479, "end": 480, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 483, "end": 500, "loc": { "start": { "line": 11, "column": 10 }, "end": { "line": 11, "column": 27 } }, "callee": { "type": "Identifier", "start": 483, "end": 490, "loc": { "start": { "line": 11, "column": 10 }, "end": { "line": 11, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 491, "end": 499, "loc": { "start": { "line": 11, "column": 18 }, "end": { "line": 11, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const" }, { "type": "ClassDeclaration", "start": 503, "end": 4793, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 151, "column": 1 } }, "id": { "type": "Identifier", "start": 509, "end": 526, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 23 }, "identifierName": "ConnectionManager" }, "name": "ConnectionManager" }, "superClass": { "type": "Identifier", "start": 535, "end": 560, "loc": { "start": { "line": 13, "column": 32 }, "end": { "line": 13, "column": 57 }, "identifierName": "AbstractConnectionManager" }, "name": "AbstractConnectionManager" }, "body": { "type": "ClassBody", "start": 561, "end": 4793, "loc": { "start": { "line": 13, "column": 58 }, "end": { "line": 151, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 565, "end": 1083, "loc": { "start": { "line": 14, "column": 2 }, "end": { "line": 31, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 565, "end": 576, "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": 577, "end": 584, "loc": { "start": { "line": 14, "column": 14 }, "end": { "line": 14, "column": 21 }, "identifierName": "dialect" }, "name": "dialect" }, { "type": "Identifier", "start": 586, "end": 595, "loc": { "start": { "line": 14, "column": 23 }, "end": { "line": 14, "column": 32 }, "identifierName": "sequelize" }, "name": "sequelize" } ], "body": { "type": "BlockStatement", "start": 597, "end": 1083, "loc": { "start": { "line": 14, "column": 34 }, "end": { "line": 31, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 603, "end": 629, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 30 } }, "expression": { "type": "CallExpression", "start": 603, "end": 628, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 29 } }, "callee": { "type": "Super", "start": 603, "end": 608, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 609, "end": 616, "loc": { "start": { "line": 15, "column": 10 }, "end": { "line": 15, "column": 17 }, "identifierName": "dialect" }, "name": "dialect" }, { "type": "Identifier", "start": 618, "end": 627, "loc": { "start": { "line": 15, "column": 19 }, "end": { "line": 15, "column": 28 }, "identifierName": "sequelize" }, "name": "sequelize" } ] } }, { "type": "ExpressionStatement", "start": 635, "end": 662, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 635, "end": 661, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 635, "end": 649, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 18 } }, "object": { "type": "ThisExpression", "start": 635, "end": 639, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 } } }, "property": { "type": "Identifier", "start": 640, "end": 649, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 652, "end": 661, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 667, "end": 731, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 68 } }, "expression": { "type": "AssignmentExpression", "start": 667, "end": 730, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 67 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 667, "end": 693, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 30 } }, "object": { "type": "MemberExpression", "start": 667, "end": 688, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 25 } }, "object": { "type": "MemberExpression", "start": 667, "end": 681, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 18 } }, "object": { "type": "ThisExpression", "start": 667, "end": 671, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 8 } } }, "property": { "type": "Identifier", "start": 672, "end": 681, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "property": { "type": "Identifier", "start": 682, "end": 688, "loc": { "start": { "line": 18, "column": 19 }, "end": { "line": 18, "column": 25 }, "identifierName": "config" }, "name": "config" }, "computed": false }, "property": { "type": "Identifier", "start": 689, "end": 693, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 18, "column": 30 }, "identifierName": "port" }, "name": "port" }, "computed": false }, "right": { "type": "LogicalExpression", "start": 696, "end": 730, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 67 } }, "left": { "type": "MemberExpression", "start": 696, "end": 722, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 59 } }, "object": { "type": "MemberExpression", "start": 696, "end": 717, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 54 } }, "object": { "type": "MemberExpression", "start": 696, "end": 710, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 47 } }, "object": { "type": "ThisExpression", "start": 696, "end": 700, "loc": { "start": { "line": 18, "column": 33 }, "end": { "line": 18, "column": 37 } } }, "property": { "type": "Identifier", "start": 701, "end": 710, "loc