UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,596 lines (1,595 loc) 263 kB
{ "type": "File", "start": 0, "end": 1510, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 52, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1510, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 52, "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": 91, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 47 } }, "declarations": [ { "type": "VariableDeclarator", "start": 50, "end": 90, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 46 } }, "id": { "type": "Identifier", "start": 50, "end": 65, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 21 }, "identifierName": "AbstractDialect" }, "name": "AbstractDialect" }, "init": { "type": "CallExpression", "start": 68, "end": 90, "loc": { "start": { "line": 4, "column": 24 }, "end": { "line": 4, "column": 46 } }, "callee": { "type": "Identifier", "start": 68, "end": 75, "loc": { "start": { "line": 4, "column": 24 }, "end": { "line": 4, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 76, "end": 89, "loc": { "start": { "line": 4, "column": 32 }, "end": { "line": 4, "column": 45 } }, "extra": { "rawValue": "../abstract", "raw": "'../abstract'" }, "value": "../abstract" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 92, "end": 150, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 58 } }, "declarations": [ { "type": "VariableDeclarator", "start": 98, "end": 149, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 57 } }, "id": { "type": "Identifier", "start": 98, "end": 115, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 23 }, "identifierName": "ConnectionManager" }, "name": "ConnectionManager" }, "init": { "type": "CallExpression", "start": 118, "end": 149, "loc": { "start": { "line": 5, "column": 26 }, "end": { "line": 5, "column": 57 } }, "callee": { "type": "Identifier", "start": 118, "end": 125, "loc": { "start": { "line": 5, "column": 26 }, "end": { "line": 5, "column": 33 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 126, "end": 148, "loc": { "start": { "line": 5, "column": 34 }, "end": { "line": 5, "column": 56 } }, "extra": { "rawValue": "./connection-manager", "raw": "'./connection-manager'" }, "value": "./connection-manager" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 151, "end": 184, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 157, "end": 183, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 32 } }, "id": { "type": "Identifier", "start": 157, "end": 162, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 11 }, "identifierName": "Query" }, "name": "Query" }, "init": { "type": "CallExpression", "start": 165, "end": 183, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 32 } }, "callee": { "type": "Identifier", "start": 165, "end": 172, "loc": { "start": { "line": 6, "column": 14 }, "end": { "line": 6, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 173, "end": 182, "loc": { "start": { "line": 6, "column": 22 }, "end": { "line": 6, "column": 31 } }, "extra": { "rawValue": "./query", "raw": "'./query'" }, "value": "./query" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 185, "end": 237, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 52 } }, "declarations": [ { "type": "VariableDeclarator", "start": 191, "end": 236, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 51 } }, "id": { "type": "Identifier", "start": 191, "end": 205, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 20 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, "init": { "type": "CallExpression", "start": 208, "end": 236, "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 51 } }, "callee": { "type": "Identifier", "start": 208, "end": 215, "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 30 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 216, "end": 235, "loc": { "start": { "line": 7, "column": 31 }, "end": { "line": 7, "column": 50 } }, "extra": { "rawValue": "./query-generator", "raw": "'./query-generator'" }, "value": "./query-generator" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 238, "end": 291, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 53 } }, "declarations": [ { "type": "VariableDeclarator", "start": 244, "end": 290, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 52 } }, "id": { "type": "Identifier", "start": 244, "end": 253, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 15 }, "identifierName": "DataTypes" }, "name": "DataTypes" }, "init": { "type": "MemberExpression", "start": 256, "end": 290, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 52 } }, "object": { "type": "CallExpression", "start": 256, "end": 283, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 45 } }, "callee": { "type": "Identifier", "start": 256, "end": 263, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 264, "end": 282, "loc": { "start": { "line": 8, "column": 26 }, "end": { "line": 8, "column": 44 } }, "extra": { "rawValue": "../../data-types", "raw": "'../../data-types'" }, "value": "../../data-types" } ] }, "property": { "type": "Identifier", "start": 284, "end": 290, "loc": { "start": { "line": 8, "column": 46 }, "end": { "line": 8, "column": 52 }, "identifierName": "sqlite" }, "name": "sqlite" }, "computed": false } } ], "kind": "const" }, { "type": "ClassDeclaration", "start": 293, "end": 622, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 299, "end": 312, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 19 }, "identifierName": "SqliteDialect" }, "name": "SqliteDialect" }, "superClass": { "type": "Identifier", "start": 321, "end": 336, "loc": { "start": { "line": 10, "column": 28 }, "end": { "line": 10, "column": 43 }, "identifierName": "AbstractDialect" }, "name": "AbstractDialect" }, "body": { "type": "ClassBody", "start": 337, "end": 622, "loc": { "start": { "line": 10, "column": 44 }, "end": { "line": 21, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 341, "end": 620, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 20, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 341, "end": 352, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 13 }, "identifierName": "constructor" }, "name": "constructor" }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 353, "end": 362, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 23 }, "identifierName": "sequelize" }, "name": "sequelize" } ], "body": { "type": "BlockStatement", "start": 364, "end": 620, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 370, "end": 378, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 12 } }, "expression": { "type": "CallExpression", "start": 370, "end": 377, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 11 } }, "callee": { "type": "Super", "start": 370, "end": 375, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 9 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 383, "end": 410, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 383, "end": 409, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 383, "end": 397, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 18 } }, "object": { "type": "ThisExpression", "start": 383, "end": 387, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 8 } } }, "property": { "type": "Identifier", "start": 388, "end": 397, "loc": { "start": { "line": 13, "column": 9 }, "end": { "line": 13, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 400, "end": 409, "loc": { "start": { "line": 13, "column": 21 }, "end": { "line": 13, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 415, "end": 479, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 68 } }, "expression": { "type": "AssignmentExpression", "start": 415, "end": 478, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 67 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 415, "end": 437, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 26 } }, "object": { "type": "ThisExpression", "start": 415, "end": 419, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 8 } } }, "property": { "type": "Identifier", "start": 420, "end": 437, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 26 }, "identifierName": "connectionManager" }, "name": "connectionManager" }, "computed": false }, "right": { "type": "NewExpression", "start": 440, "end": 478, "loc": { "start": { "line": 14, "column": 29 }, "end": { "line": 14, "column": 67 } }, "callee": { "type": "Identifier", "start": 444, "end": 461, "loc": { "start": { "line": 14, "column": 33 }, "end": { "line": 14, "column": 50 }, "identifierName": "ConnectionManager" }, "name": "ConnectionManager" }, "arguments": [ { "type": "ThisExpression", "start": 462, "end": 466, "loc": { "start": { "line": 14, "column": 51 }, "end": { "line": 14, "column": 55 } } }, { "type": "Identifier", "start": 468, "end": 477, "loc": { "start": { "line": 14, "column": 57 }, "end": { "line": 14, "column": 66 }, "identifierName": "sequelize" }, "name": "sequelize" } ] } } }, { "type": "ExpressionStatement", "start": 484, "end": 616, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 19, "column": 7 } }, "expression": { "type": "AssignmentExpression", "start": 484, "end": 615, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 19, "column": 6 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 484, "end": 503, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 23 } }, "object": { "type": "ThisExpression", "start": 484, "end": 488, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 8 } } }, "property": { "type": "Identifier", "start": 489, "end": 503, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 23 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, "computed": false }, "right": { "type": "CallExpression", "start": 506, "end": 615, "loc": { "start": { "line": 15, "column": 26 }, "end": { "line": 19, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 506, "end": 514, "loc": { "start": { "line": 15, "column": 26 }, "end": { "line": 15, "column": 34 } }, "object": { "type": "Identifier", "start": 506, "end": 507, "loc": { "start": { "line": 15, "column": 26 }, "end": { "line": 15, "column": 27 }, "identifierName": "_" }, "name": "_" }, "property": { "type": "Identifier", "start": 508, "end": 514, "loc": { "start": { "line": 15, "column": 28 }, "end": { "line": 15, "column": 34 }, "identifierName": "extend" }, "name": "extend" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 515, "end": 517, "loc": { "start": { "line": 15, "column": 35 }, "end": { "line": 15, "column": 37 } }, "properties": [] }, { "type": "Identifier", "start": 519, "end": 533, "loc": { "start": { "line": 15, "column": 39 }, "end": { "line": 15, "column": 53 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, { "type": "ObjectExpression", "start": 535, "end": 614, "loc": { "start": { "line": 15, "column": 55 }, "end": { "line": 19, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 543, "end": 569, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 543, "end": 550, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 13 }, "identifierName": "options" }, "name": "options" }, "value": { "type": "MemberExpression", "start": 552, "end": 569, "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 32 } }, "object": { "type": "Identifier", "start": 552, "end": 561, "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 24 }, "identifierName": "sequelize" }, "name": "sequelize" }, "property": { "type": "Identifier", "start": 562, "end": 569, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 32 }, "identifierName": "options" }, "name": "options" }, "computed": false } }, { "type": "ObjectProperty", "start": 577, "end": 591, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 577, "end": 585, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 14 }, "identifierName": "_dialect" }, "name": "_dialect" }, "value": { "type": "ThisExpression", "start": 587, "end": 591, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 20 } } } }, { "type": "ObjectProperty", "start": 599, "end": 608, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 599, "end": 608, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 }, "identifierName": "sequelize" }, "name": "sequelize" }, "value": { "type": "Identifier", "start": 599, "end": 608, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 }, "identifierName": "sequelize" }, "name": "sequelize" }, "extra": { "shorthand": true } } ] } ] } } } ], "directives": [] } } ] } }, { "type": "ExpressionStatement", "start": 624, "end": 1014, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 39, "column": 3 } }, "expression": { "type": "AssignmentExpression", "start": 624, "end": 1013, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 39, "column": 2 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 624, "end": 656, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 32 } }, "object": { "type": "MemberExpression", "start": 624, "end": 647, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 23 } }, "object": { "type": "Identifier", "start": 624, "end": 637, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 13 }, "identifierName": "SqliteDialect" }, "name": "SqliteDialect" }, "property": { "type": "Identifier", "start": 638, "end": 647, "loc": { "start": { "line": 23, "column": 14 }, "end": { "line": 23, "column": 23 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false },