UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,595 lines (1,594 loc) 317 kB
{ "type": "File", "start": 0, "end": 1781, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 66, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1781, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 66, "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": 293, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 55 } }, "declarations": [ { "type": "VariableDeclarator", "start": 244, "end": 292, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 54 } }, "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": 292, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 54 } }, "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": 292, "loc": { "start": { "line": 8, "column": 46 }, "end": { "line": 8, "column": 54 }, "identifierName": "postgres" }, "name": "postgres" }, "computed": false } } ], "kind": "const" }, { "type": "ClassDeclaration", "start": 295, "end": 626, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 301, "end": 316, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 21 }, "identifierName": "PostgresDialect" }, "name": "PostgresDialect" }, "superClass": { "type": "Identifier", "start": 325, "end": 340, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 45 }, "identifierName": "AbstractDialect" }, "name": "AbstractDialect" }, "body": { "type": "ClassBody", "start": 341, "end": 626, "loc": { "start": { "line": 10, "column": 46 }, "end": { "line": 21, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 345, "end": 624, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 20, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 345, "end": 356, "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": 357, "end": 366, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 23 }, "identifierName": "sequelize" }, "name": "sequelize" } ], "body": { "type": "BlockStatement", "start": 368, "end": 624, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 374, "end": 382, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 12 } }, "expression": { "type": "CallExpression", "start": 374, "end": 381, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 11 } }, "callee": { "type": "Super", "start": 374, "end": 379, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 9 } } }, "arguments": [] } }, { "type": "ExpressionStatement", "start": 387, "end": 414, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 387, "end": 413, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 387, "end": 401, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 18 } }, "object": { "type": "ThisExpression", "start": 387, "end": 391, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 8 } } }, "property": { "type": "Identifier", "start": 392, "end": 401, "loc": { "start": { "line": 13, "column": 9 }, "end": { "line": 13, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 404, "end": 413, "loc": { "start": { "line": 13, "column": 21 }, "end": { "line": 13, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 419, "end": 483, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 68 } }, "expression": { "type": "AssignmentExpression", "start": 419, "end": 482, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 67 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 419, "end": 441, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 26 } }, "object": { "type": "ThisExpression", "start": 419, "end": 423, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 8 } } }, "property": { "type": "Identifier", "start": 424, "end": 441, "loc": { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 26 }, "identifierName": "connectionManager" }, "name": "connectionManager" }, "computed": false }, "right": { "type": "NewExpression", "start": 444, "end": 482, "loc": { "start": { "line": 14, "column": 29 }, "end": { "line": 14, "column": 67 } }, "callee": { "type": "Identifier", "start": 448, "end": 465, "loc": { "start": { "line": 14, "column": 33 }, "end": { "line": 14, "column": 50 }, "identifierName": "ConnectionManager" }, "name": "ConnectionManager" }, "arguments": [ { "type": "ThisExpression", "start": 466, "end": 470, "loc": { "start": { "line": 14, "column": 51 }, "end": { "line": 14, "column": 55 } } }, { "type": "Identifier", "start": 472, "end": 481, "loc": { "start": { "line": 14, "column": 57 }, "end": { "line": 14, "column": 66 }, "identifierName": "sequelize" }, "name": "sequelize" } ] } } }, { "type": "ExpressionStatement", "start": 488, "end": 620, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 19, "column": 7 } }, "expression": { "type": "AssignmentExpression", "start": 488, "end": 619, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 19, "column": 6 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 488, "end": 507, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 23 } }, "object": { "type": "ThisExpression", "start": 488, "end": 492, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 8 } } }, "property": { "type": "Identifier", "start": 493, "end": 507, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 23 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, "computed": false }, "right": { "type": "CallExpression", "start": 510, "end": 619, "loc": { "start": { "line": 15, "column": 26 }, "end": { "line": 19, "column": 6 } }, "callee": { "type": "MemberExpression", "start": 510, "end": 518, "loc": { "start": { "line": 15, "column": 26 }, "end": { "line": 15, "column": 34 } }, "object": { "type": "Identifier", "start": 510, "end": 511, "loc": { "start": { "line": 15, "column": 26 }, "end": { "line": 15, "column": 27 }, "identifierName": "_" }, "name": "_" }, "property": { "type": "Identifier", "start": 512, "end": 518, "loc": { "start": { "line": 15, "column": 28 }, "end": { "line": 15, "column": 34 }, "identifierName": "extend" }, "name": "extend" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 519, "end": 521, "loc": { "start": { "line": 15, "column": 35 }, "end": { "line": 15, "column": 37 } }, "properties": [] }, { "type": "Identifier", "start": 523, "end": 537, "loc": { "start": { "line": 15, "column": 39 }, "end": { "line": 15, "column": 53 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, { "type": "ObjectExpression", "start": 539, "end": 618, "loc": { "start": { "line": 15, "column": 55 }, "end": { "line": 19, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 547, "end": 573, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 547, "end": 554, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 13 }, "identifierName": "options" }, "name": "options" }, "value": { "type": "MemberExpression", "start": 556, "end": 573, "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 32 } }, "object": { "type": "Identifier", "start": 556, "end": 565, "loc": { "start": { "line": 16, "column": 15 }, "end": { "line": 16, "column": 24 }, "identifierName": "sequelize" }, "name": "sequelize" }, "property": { "type": "Identifier", "start": 566, "end": 573, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 32 }, "identifierName": "options" }, "name": "options" }, "computed": false } }, { "type": "ObjectProperty", "start": 581, "end": 595, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 20 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 581, "end": 589, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 14 }, "identifierName": "_dialect" }, "name": "_dialect" }, "value": { "type": "ThisExpression", "start": 591, "end": 595, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 20 } } } }, { "type": "ObjectProperty", "start": 603, "end": 612, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 603, "end": 612, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 }, "identifierName": "sequelize" }, "name": "sequelize" }, "value": { "type": "Identifier", "start": 603, "end": 612, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 15 }, "identifierName": "sequelize" }, "name": "sequelize" }, "extra": { "shorthand": true } } ] } ] } } } ], "directives": [] } } ] } }, { "type": "ExpressionStatement", "start": 628, "end": 1259, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 53, "column": 3 } }, "expression": { "type": "AssignmentExpression", "start": 628, "end": 1258, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 53, "column": 2 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 628, "end": 662, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 34 } }, "object": { "type": "MemberExpression", "start": 628, "end": 653, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 25 } }, "object": { "type": "Identifier", "start": 628, "end": 643, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 23, "column": 15 }, "identifierName": "PostgresDialect" }, "name": "PostgresDialect" }, "property": { "type": "Identifier", "start": 644, "end": 653, "loc": { "start": { "line": 23, "column": 16 }, "end": { "line": 23, "column": 25 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false