UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,487 lines (1,486 loc) 187 kB
{ "type": "File", "start": 0, "end": 941, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 49, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 941, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 49, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 195, "end": 283, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 14, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 201, "end": 223, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 28 } }, "id": { "type": "Identifier", "start": 201, "end": 205, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 10 }, "identifierName": "depd" }, "name": "depd", "leadingComments": null }, "init": { "type": "CallExpression", "start": 208, "end": 223, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 28 } }, "callee": { "type": "Identifier", "start": 208, "end": 215, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 20 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 216, "end": 222, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 27 } }, "extra": { "rawValue": "depd", "raw": "'depd'" }, "value": "depd" } ] }, "leadingComments": null }, { "type": "VariableDeclarator", "start": 230, "end": 254, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 30 } }, "id": { "type": "Identifier", "start": 230, "end": 235, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 11 }, "identifierName": "debug" }, "name": "debug" }, "init": { "type": "CallExpression", "start": 238, "end": 254, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 30 } }, "callee": { "type": "Identifier", "start": 238, "end": 245, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 246, "end": 253, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 13, "column": 29 } }, "extra": { "rawValue": "debug", "raw": "'debug'" }, "value": "debug" } ] } }, { "type": "VariableDeclarator", "start": 261, "end": 282, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 27 } }, "id": { "type": "Identifier", "start": 261, "end": 262, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 265, "end": 282, "loc": { "start": { "line": 14, "column": 10 }, "end": { "line": 14, "column": 27 } }, "callee": { "type": "Identifier", "start": 265, "end": 272, "loc": { "start": { "line": 14, "column": 10 }, "end": { "line": 14, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 273, "end": 281, "loc": { "start": { "line": 14, "column": 18 }, "end": { "line": 14, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const", "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Sequelize module for debug and deprecation messages.\n * It require a `context` for which messages will be printed.\n *\n * @module logging\n * @private\n ", "start": 15, "end": 174, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 9, "column": 3 } } }, { "type": "CommentBlock", "value": " jshint -W030 ", "start": 176, "end": 194, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 18 } } } ] }, { "type": "ClassDeclaration", "start": 285, "end": 914, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 46, "column": 1 } }, "id": { "type": "Identifier", "start": 291, "end": 297, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 12 }, "identifierName": "Logger" }, "name": "Logger" }, "superClass": null, "body": { "type": "ClassBody", "start": 298, "end": 914, "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 46, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 302, "end": 514, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 26, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 302, "end": 313, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 17, "column": 13 }, "identifierName": "constructor" }, "name": "constructor" }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 314, "end": 320, "loc": { "start": { "line": 17, "column": 14 }, "end": { "line": 17, "column": 20 }, "identifierName": "config" }, "name": "config" } ], "body": { "type": "BlockStatement", "start": 322, "end": 514, "loc": { "start": { "line": 17, "column": 22 }, "end": { "line": 26, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 329, "end": 421, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 22, "column": 21 } }, "expression": { "type": "AssignmentExpression", "start": 329, "end": 420, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 22, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 329, "end": 340, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 15 } }, "object": { "type": "ThisExpression", "start": 329, "end": 333, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 8 } } }, "property": { "type": "Identifier", "start": 334, "end": 340, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 15 }, "identifierName": "config" }, "name": "config" }, "computed": false }, "right": { "type": "CallExpression", "start": 343, "end": 420, "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 22, "column": 20 } }, "callee": { "type": "MemberExpression", "start": 343, "end": 351, "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 26 } }, "object": { "type": "Identifier", "start": 343, "end": 344, "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 19 }, "identifierName": "_" }, "name": "_" }, "property": { "type": "Identifier", "start": 345, "end": 351, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 26 }, "identifierName": "extend" }, "name": "extend" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 352, "end": 405, "loc": { "start": { "line": 19, "column": 27 }, "end": { "line": 22, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 360, "end": 380, "loc": { "start": { "line": 20, "column": 6 }, "end": { "line": 20, "column": 26 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 360, "end": 367, "loc": { "start": { "line": 20, "column": 6 }, "end": { "line": 20, "column": 13 }, "identifierName": "context" }, "name": "context" }, "value": { "type": "StringLiteral", "start": 369, "end": 380, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 26 } }, "extra": { "rawValue": "sequelize", "raw": "'sequelize'" }, "value": "sequelize" } }, { "type": "ObjectProperty", "start": 388, "end": 399, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 21, "column": 17 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 388, "end": 393, "loc": { "start": { "line": 21, "column": 6 }, "end": { "line": 21, "column": 11 }, "identifierName": "debug" }, "name": "debug" }, "value": { "type": "BooleanLiteral", "start": 395, "end": 399, "loc": { "start": { "line": 21, "column": 13 }, "end": { "line": 21, "column": 17 } }, "value": true } } ] }, { "type": "LogicalExpression", "start": 407, "end": 419, "loc": { "start": { "line": 22, "column": 7 }, "end": { "line": 22, "column": 19 } }, "left": { "type": "Identifier", "start": 407, "end": 413, "loc": { "start": { "line": 22, "column": 7 }, "end": { "line": 22, "column": 13 }, "identifierName": "config" }, "name": "config" }, "operator": "||", "right": { "type": "ObjectExpression", "start": 417, "end": 419, "loc": { "start": { "line": 22, "column": 17 }, "end": { "line": 22, "column": 19 } }, "properties": [] } } ] } } }, { "type": "ExpressionStatement", "start": 427, "end": 465, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 427, "end": 464, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 427, "end": 436, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 13 } }, "object": { "type": "ThisExpression", "start": 427, "end": 431, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 8 } } }, "property": { "type": "Identifier", "start": 432, "end": 436, "loc": { "start": { "line": 24, "column": 9 }, "end": { "line": 24, "column": 13 }, "identifierName": "depd" }, "name": "depd" }, "computed": false }, "right": { "type": "CallExpression", "start": 439, "end": 464, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 41 } }, "callee": { "type": "Identifier", "start": 439, "end": 443, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 20 }, "identifierName": "depd" }, "name": "depd" }, "arguments": [ { "type": "MemberExpression", "start": 444, "end": 463, "loc": { "start": { "line": 24, "column": 21 }, "end": { "line": 24, "column": 40 } }, "object": { "type": "MemberExpression", "start": 444, "end": 455, "loc": { "start": { "line": 24, "column": 21 }, "end": { "line": 24, "column": 32 } }, "object": { "type": "ThisExpression", "start": 444, "end": 448, "loc": { "start": { "line": 24, "column": 21 }, "end": { "line": 24, "column": 25 } } }, "property": { "type": "Identifier", "start": 449, "end": 455, "loc": { "start": { "line": 24, "column": 26 }, "end": { "line": 24, "column": 32 }, "identifierName": "config" }, "name": "config" }, "computed": false }, "property": { "type": "Identifier", "start": 456, "end": 463, "loc": { "start": { "line": 24, "column": 33 }, "end": { "line": 24, "column": 40 }, "identifierName": "context" }, "name": "context" }, "computed": false } ] } } }, { "type": "ExpressionStatement", "start": 470, "end": 510, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 44 } }, "expression": { "type": "AssignmentExpression", "start": 470, "end": 509, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 43 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 470, "end": 480, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 14 } }, "object": { "type": "ThisExpression", "start": 470, "end": 474, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 8 } } }, "property": { "type": "Identifier", "start": 475, "end": 480, "loc": { "start": { "line": 25, "column": 9 }, "end": { "line": 25, "column": 14 }, "identifierName": "debug" }, "name": "debug" }, "computed": false }, "right": { "type": "CallExpression", "start": 483, "end": 509, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 43 } }, "callee": { "type": "Identifier", "start": 483, "end": 488, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 22 }, "identifierName": "debug" }, "name": "debug" }, "arguments": [ { "type": "MemberExpression", "start": 489, "end": 508, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 25, "column": 42 } }, "object": { "type": "MemberExpression", "start": 489, "end": 500, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 25, "column": 34 } }, "object": { "type": "ThisExpression", "start": 489, "end": 493, "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 25, "column": 27 } } }, "property": { "type": "Identifier", "start": 494, "end": 500, "loc": { "start": { "line": 25, "column": 28 }, "end": { "line": 25, "column": 34 }, "identifierName": "config" }, "name": "config" }, "computed": false }, "property": { "type": "Identifier", "start": 501, "end": 508, "loc": { "start": { "line": 25, "column": 35 }, "end": { "line": 25, "column": 42 }, "identifierName": "context" }, "name": "context" }, "computed": false } ] } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 518, "end": 566, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 30, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 518, "end": 527, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 28, "column": 11 }, "identifierName": "deprecate" }, "name": "deprecate" }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 528, "end": 535, "loc": { "start": { "line": 28, "column": 12 }, "end": { "line": 28, "column": 19 }, "identifierName": "message" }, "name": "message" } ], "body": { "type": "BlockStatement", "start": 537, "end": 566, "loc": { "start": { "line": 28, "column": 21 }, "end": { "line": 30, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 543, "end": 562, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 23 } }, "expression": { "type": "CallExpression", "start": 543, "end": 561, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 22 } }, "callee": { "type": "MemberExpression", "start": 543, "end": 552, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 13 } }, "object": { "type": "ThisExpression", "start": 543, "end": 547, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 8 } } }, "property": { "type": "Identifier", "start": 548, "end": 552, "loc": { "start": { "line": 29, "column": 9 }, "end": { "line": 29, "column": 13 }, "identifierName": "depd" }, "name": "depd" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 553, "end": 560, "loc": { "start": { "line": 29, "column": 14 }, "end": { "line": 29, "column": 21 }, "identifierName": "message" }, "name": "message" } ] } } ], "directives": [] } }, { "type": "ClassMethod", "start": 570, "end": 636, "loc": { "start": { "line": 32, "column": 2 }, "end": { "line": 34, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 570, "end": 575, "loc": { "start": { "line": 32, "column": 2 }, "end": { "line": 32, "column": 7 }, "identifierName": "debug" }, "name": "debug" }, "static": false, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 576, "end": 583, "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 15 }, "identifierName": "message" }, "name": "message" } ], "body": { "type": "BlockStatement", "start": 585, "end": 636, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 34, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 591, "end": 632, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 45 } }, "expression": { "type": "LogicalExpression", "start": 591, "end": 631, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 44 } }, "left": { "type": "MemberExpression", "start": 591, "end": 608, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 21 } }, "object": { "type": "MemberExpression", "start": 591, "end": 602, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 15 } }, "object": { "type": "ThisExpression", "start": 591, "end": 595, "loc": { "start": { "line": 33, "column": 4 }, "end": { "line": 33, "column": 8 } }