UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,660 lines 736 kB
{ "type": "File", "start": 0, "end": 3715, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 101, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 3715, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 101, "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": 133, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", "start": 98, "end": 132, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 40 } }, "id": { "type": "Identifier", "start": 98, "end": 105, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 13 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 108, "end": 132, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 40 } }, "callee": { "type": "Identifier", "start": 108, "end": 115, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 116, "end": 131, "loc": { "start": { "line": 4, "column": 24 }, "end": { "line": 4, "column": 39 } }, "extra": { "rawValue": "../../promise", "raw": "'../../promise'" }, "value": "../../promise" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 134, "end": 171, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 140, "end": 170, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 36 } }, "id": { "type": "Identifier", "start": 140, "end": 145, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 11 }, "identifierName": "Utils" }, "name": "Utils" }, "init": { "type": "CallExpression", "start": 148, "end": 170, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 36 } }, "callee": { "type": "Identifier", "start": 148, "end": 155, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 156, "end": 169, "loc": { "start": { "line": 5, "column": 22 }, "end": { "line": 5, "column": 35 } }, "extra": { "rawValue": "../../utils", "raw": "'../../utils'" }, "value": "../../utils" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 172, "end": 238, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 66 } }, "declarations": [ { "type": "VariableDeclarator", "start": 178, "end": 237, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 65 } }, "id": { "type": "Identifier", "start": 178, "end": 183, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 11 }, "identifierName": "debug" }, "name": "debug" }, "init": { "type": "CallExpression", "start": 186, "end": 237, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 65 } }, "callee": { "type": "MemberExpression", "start": 186, "end": 216, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 44 } }, "object": { "type": "CallExpression", "start": 186, "end": 203, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 31 } }, "callee": { "type": "MemberExpression", "start": 186, "end": 201, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 29 } }, "object": { "type": "Identifier", "start": 186, "end": 191, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 19 }, "identifierName": "Utils" }, "name": "Utils" }, "property": { "type": "Identifier", "start": 192, "end": 201, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 29 }, "identifierName": "getLogger" }, "name": "getLogger" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 204, "end": 216, "loc": { "start": { "line": 6, "column": 32 }, "end": { "line": 6, "column": 44 }, "identifierName": "debugContext" }, "name": "debugContext" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 217, "end": 236, "loc": { "start": { "line": 6, "column": 45 }, "end": { "line": 6, "column": 64 } }, "extra": { "rawValue": "connection:sqlite", "raw": "'connection:sqlite'" }, "value": "connection:sqlite" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 239, "end": 292, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 53 } }, "declarations": [ { "type": "VariableDeclarator", "start": 245, "end": 291, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 52 } }, "id": { "type": "Identifier", "start": 245, "end": 254, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 15 }, "identifierName": "dataTypes" }, "name": "dataTypes" }, "init": { "type": "MemberExpression", "start": 257, "end": 291, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 52 } }, "object": { "type": "CallExpression", "start": 257, "end": 284, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 45 } }, "callee": { "type": "Identifier", "start": 257, "end": 264, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 265, "end": 283, "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 44 } }, "extra": { "rawValue": "../../data-types", "raw": "'../../data-types'" }, "value": "../../data-types" } ] }, "property": { "type": "Identifier", "start": 285, "end": 291, "loc": { "start": { "line": 7, "column": 46 }, "end": { "line": 7, "column": 52 }, "identifierName": "sqlite" }, "name": "sqlite" }, "computed": false } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 293, "end": 341, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 48 } }, "declarations": [ { "type": "VariableDeclarator", "start": 299, "end": 340, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 47 } }, "id": { "type": "Identifier", "start": 299, "end": 314, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 21 }, "identifierName": "sequelizeErrors" }, "name": "sequelizeErrors" }, "init": { "type": "CallExpression", "start": 317, "end": 340, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 47 } }, "callee": { "type": "Identifier", "start": 317, "end": 324, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 325, "end": 339, "loc": { "start": { "line": 8, "column": 32 }, "end": { "line": 8, "column": 46 } }, "extra": { "rawValue": "../../errors", "raw": "'../../errors'" }, "value": "../../errors" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 342, "end": 398, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 56 } }, "declarations": [ { "type": "VariableDeclarator", "start": 348, "end": 397, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 55 } }, "id": { "type": "Identifier", "start": 348, "end": 359, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 17 }, "identifierName": "parserStore" }, "name": "parserStore" }, "init": { "type": "CallExpression", "start": 362, "end": 397, "loc": { "start": { "line": 9, "column": 20 }, "end": { "line": 9, "column": 55 } }, "callee": { "type": "CallExpression", "start": 362, "end": 387, "loc": { "start": { "line": 9, "column": 20 }, "end": { "line": 9, "column": 45 } }, "callee": { "type": "Identifier", "start": 362, "end": 369, "loc": { "start": { "line": 9, "column": 20 }, "end": { "line": 9, "column": 27 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 370, "end": 386, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 44 } }, "extra": { "rawValue": "../parserStore", "raw": "'../parserStore'" }, "value": "../parserStore" } ] }, "arguments": [ { "type": "StringLiteral", "start": 388, "end": 396, "loc": { "start": { "line": 9, "column": 46 }, "end": { "line": 9, "column": 54 } }, "extra": { "rawValue": "sqlite", "raw": "'sqlite'" }, "value": "sqlite" } ] } } ], "kind": "const" }, { "type": "ClassDeclaration", "start": 400, "end": 3578, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 95, "column": 1 } }, "id": { "type": "Identifier", "start": 406, "end": 423, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 23 }, "identifierName": "ConnectionManager" }, "name": "ConnectionManager" }, "superClass": { "type": "Identifier", "start": 432, "end": 457, "loc": { "start": { "line": 11, "column": 32 }, "end": { "line": 11, "column": 57 }, "identifierName": "AbstractConnectionManager" }, "name": "AbstractConnectionManager" }, "body": { "type": "ClassBody", "start": 458, "end": 3578, "loc": { "start": { "line": 11, "column": 58 }, "end": { "line": 95, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 462, "end": 1317, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 37, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 462, "end": 473, "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": 474, "end": 481, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 21 }, "identifierName": "dialect" }, "name": "dialect" }, { "type": "Identifier", "start": 483, "end": 492, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 32 }, "identifierName": "sequelize" }, "name": "sequelize" } ], "body": { "type": "BlockStatement", "start": 494, "end": 1317, "loc": { "start": { "line": 12, "column": 34 }, "end": { "line": 37, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 500, "end": 526, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", "start": 500, "end": 525, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 29 } }, "callee": { "type": "Super", "start": 500, "end": 505, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "Identifier", "start": 506, "end": 513, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 17 }, "identifierName": "dialect" }, "name": "dialect" }, { "type": "Identifier", "start": 515, "end": 524, "loc": { "start": { "line": 13, "column": 19 }, "end": { "line": 13, "column": 28 }, "identifierName": "sequelize" }, "name": "sequelize" } ] } }, { "type": "ExpressionStatement", "start": 531, "end": 558, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 531, "end": 557, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 531, "end": 545, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 18 } }, "object": { "type": "ThisExpression", "start": 531, "end": 535, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 8 } } }, "property": { "type": "Identifier", "start": 536, "end": 545, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 548, "end": 557, "loc": { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 563, "end": 594, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 35 } }, "expression": { "type": "AssignmentExpression", "start": 563, "end": 593, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 34 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 563, "end": 574, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 15 } }, "object": { "type": "ThisExpression", "start": 563, "end": 567, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 8 } } }, "property": { "type": "Identifier", "start": 568, "end": 574, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 15 }, "identifierName": "config" }, "name": "config" }, "computed": false }, "right": { "type": "MemberExpression", "start": 577, "end": 593, "loc": { "start": { "line": 15, "column": 18 }, "end": { "line": 15, "column": 34 } }, "object": { "type": "Identifier", "start": 577, "end": 586, "loc": { "start": { "line": 15, "column": 18 }, "end": { "line": 15, "column": 27 }, "identifierName": "sequelize" }, "name": "sequelize" }, "property": { "type": "Identifier", "start": 587, "end": 593, "loc": { "start": { "line": 15, "column": 28 }, "end": { "line": 15, "column": 34 }, "identifierName": "config" }, "name": "config" }, "computed": false } } }, { "type": "ExpressionStatement", "start": 599, "end": 622, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 599, "end": 621, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 599, "end": 611, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 16 } }, "object": { "type": "ThisExpression", "start": 599, "end": 603, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 8 } } }, "property": { "type": "Identifier", "start": 604, "end": 611, "loc": { "start": { "line": 16, "column": 9 }, "end": { "line": 16, "column": 16 }, "identifierName": "dialect" }, "name": "dialect" }, "computed": false }, "right": { "type": "Identifier", "start": 614, "end": 621, "loc": { "start": { "line": 16, "column": 19 }, "end": { "line": 16, "column": 26 }, "identifierName": "dialect" }, "name": "dialect" } } }, { "type": "ExpressionStatement", "start": 627, "end": 677, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 54 } }, "expression": { "type": "AssignmentExpression", "start": 627, "end": 676, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 53 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 627, "end": 643, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 20 } }, "object": { "type": "ThisExpression", "start": 627, "end": 631, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 } } }, "property": { "type": "Identifier", "start": 632, "end": 643, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 20 }, "identifierName": "dialectName" }, "name": "dialectName" }, "computed": false }, "right": { "type": "MemberExpression", "start": 646, "end": 676, "loc": { "start": { "line": 17, "column": 23 }, "end": { "line": 17, "column": 53 } }, "object": { "type": "MemberExpression", "start": 646, "end": 668, "loc": { "start": { "line": 17, "column": 23 }, "end": { "line": 17, "column": 45 } }, "object": { "type": "MemberExpression", "start": 646, "end": 660, "loc": { "start": { "line": 17, "column": 23 }, "end": { "line": 17, "column": 37 } }, "object": { "type": "ThisExpression", "start": 646, "end": 650, "loc": { "start": { "line": 17, "column": 23 }, "end": { "line": 17, "column": 27 } } }, "property": { "type": "Identifier", "start": 651, "end": 660, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 37 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "property": { "type": "Identifier", "start": 661, "end": 668, "loc": { "start": { "line": 17, "column": 38 }, "end": { "line": 17, "column": 45 }, "identifierName": "options" }, "name": "options" }, "computed": false }, "property": { "type": "Identifier", "start": 669, "end": 676, "loc": { "start": { "line": 17, "column": 46 }, "end": { "line": 17, "column": 53 }, "identifierName": "dialect" }, "name": "dialect" }, "computed": false } } }, { "type": "ExpressionStatement", "star