UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,627 lines (1,626 loc) 478 kB
{ "type": "File", "start": 0, "end": 2038, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2038, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 77, "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": "FunctionDeclaration", "start": 45, "end": 274, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 13, "column": 1 } }, "id": { "type": "Identifier", "start": 54, "end": 73, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 28 }, "identifierName": "stringifyRangeBound" }, "name": "stringifyRangeBound" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 74, "end": 79, "loc": { "start": { "line": 5, "column": 29 }, "end": { "line": 5, "column": 34 }, "identifierName": "bound" }, "name": "bound" } ], "body": { "type": "BlockStatement", "start": 81, "end": 274, "loc": { "start": { "line": 5, "column": 36 }, "end": { "line": 13, "column": 1 } }, "body": [ { "type": "IfStatement", "start": 85, "end": 272, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 12, "column": 3 } }, "test": { "type": "BinaryExpression", "start": 89, "end": 103, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 20 } }, "left": { "type": "Identifier", "start": 89, "end": 94, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 11 }, "identifierName": "bound" }, "name": "bound" }, "operator": "===", "right": { "type": "NullLiteral", "start": 99, "end": 103, "loc": { "start": { "line": 6, "column": 16 }, "end": { "line": 6, "column": 20 } } } }, "consequent": { "type": "BlockStatement", "start": 105, "end": 126, "loc": { "start": { "line": 6, "column": 22 }, "end": { "line": 8, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 111, "end": 122, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 15 } }, "argument": { "type": "StringLiteral", "start": 118, "end": 120, "loc": { "start": { "line": 7, "column": 11 }, "end": { "line": 7, "column": 13 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" } } ], "directives": [] }, "alternate": { "type": "IfStatement", "start": 132, "end": 272, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 12, "column": 3 } }, "test": { "type": "LogicalExpression", "start": 136, "end": 177, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 54 } }, "left": { "type": "BinaryExpression", "start": 136, "end": 154, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 31 } }, "left": { "type": "Identifier", "start": 136, "end": 141, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 18 }, "identifierName": "bound" }, "name": "bound" }, "operator": "===", "right": { "type": "Identifier", "start": 146, "end": 154, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 31 }, "identifierName": "Infinity" }, "name": "Infinity" } }, "operator": "||", "right": { "type": "BinaryExpression", "start": 158, "end": 177, "loc": { "start": { "line": 8, "column": 35 }, "end": { "line": 8, "column": 54 } }, "left": { "type": "Identifier", "start": 158, "end": 163, "loc": { "start": { "line": 8, "column": 35 }, "end": { "line": 8, "column": 40 }, "identifierName": "bound" }, "name": "bound" }, "operator": "===", "right": { "type": "UnaryExpression", "start": 168, "end": 177, "loc": { "start": { "line": 8, "column": 45 }, "end": { "line": 8, "column": 54 } }, "operator": "-", "prefix": true, "argument": { "type": "Identifier", "start": 169, "end": 177, "loc": { "start": { "line": 8, "column": 46 }, "end": { "line": 8, "column": 54 }, "identifierName": "Infinity" }, "name": "Infinity" }, "extra": { "parenthesizedArgument": false } } } }, "consequent": { "type": "BlockStatement", "start": 179, "end": 227, "loc": { "start": { "line": 8, "column": 56 }, "end": { "line": 10, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 185, "end": 223, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 42 } }, "argument": { "type": "CallExpression", "start": 192, "end": 222, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 192, "end": 220, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 39 } }, "object": { "type": "CallExpression", "start": 192, "end": 208, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 27 } }, "callee": { "type": "MemberExpression", "start": 192, "end": 206, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 25 } }, "object": { "type": "Identifier", "start": 192, "end": 197, "loc": { "start": { "line": 9, "column": 11 }, "end": { "line": 9, "column": 16 }, "identifierName": "bound" }, "name": "bound" }, "property": { "type": "Identifier", "start": 198, "end": 206, "loc": { "start": { "line": 9, "column": 17 }, "end": { "line": 9, "column": 25 }, "identifierName": "toString" }, "name": "toString" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 209, "end": 220, "loc": { "start": { "line": 9, "column": 28 }, "end": { "line": 9, "column": 39 }, "identifierName": "toLowerCase" }, "name": "toLowerCase" }, "computed": false }, "arguments": [] } } ], "directives": [] }, "alternate": { "type": "BlockStatement", "start": 233, "end": 272, "loc": { "start": { "line": 10, "column": 9 }, "end": { "line": 12, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 239, "end": 268, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 33 } }, "argument": { "type": "CallExpression", "start": 246, "end": 267, "loc": { "start": { "line": 11, "column": 11 }, "end": { "line": 11, "column": 32 } }, "callee": { "type": "MemberExpression", "start": 246, "end": 260, "loc": { "start": { "line": 11, "column": 11 }, "end": { "line": 11, "column": 25 } }, "object": { "type": "Identifier", "start": 246, "end": 250, "loc": { "start": { "line": 11, "column": 11 }, "end": { "line": 11, "column": 15 }, "identifierName": "JSON" }, "name": "JSON" }, "property": { "type": "Identifier", "start": 251, "end": 260, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 25 }, "identifierName": "stringify" }, "name": "stringify" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 261, "end": 266, "loc": { "start": { "line": 11, "column": 26 }, "end": { "line": 11, "column": 31 }, "identifierName": "bound" }, "name": "bound" } ] } } ], "directives": [] } } } ], "directives": [] } }, { "type": "FunctionDeclaration", "start": 276, "end": 517, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 25, "column": 1 } }, "id": { "type": "Identifier", "start": 285, "end": 300, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 24 }, "identifierName": "parseRangeBound" }, "name": "parseRangeBound" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 301, "end": 306, "loc": { "start": { "line": 15, "column": 25 }, "end": { "line": 15, "column": 30 }, "identifierName": "bound" }, "name": "bound" }, { "type": "Identifier", "start": 308, "end": 317, "loc": { "start": { "line": 15, "column": 32 }, "end": { "line": 15, "column": 41 }, "identifierName": "parseType" }, "name": "parseType" } ], "body": { "type": "BlockStatement", "start": 319, "end": 517, "loc": { "start": { "line": 15, "column": 43 }, "end": { "line": 25, "column": 1 } }, "body": [ { "type": "IfStatement", "start": 323, "end": 515, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 24, "column": 3 } }, "test": { "type": "UnaryExpression", "start": 327, "end": 333, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 12 } }, "operator": "!", "prefix": true, "argument": { "type": "Identifier", "start": 328, "end": 333, "loc": { "start": { "line": 16, "column": 7 }, "end": { "line": 16, "column": 12 }, "identifierName": "bound" }, "name": "bound" }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 335, "end": 357, "loc": { "start": { "line": 16, "column": 14 }, "end": { "line": 18, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 341, "end": 353, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 16 } }, "argument": { "type": "NullLiteral", "start": 348, "end": 352, "loc": { "start": { "line": 17, "column": 11 }, "end": { "line": 17, "column": 15 } } } } ], "directives": [] }, "alternate": { "type": "IfStatement", "start": 363, "end": 515, "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 24, "column": 3 } }, "test": { "type": "BinaryExpression", "start": 367, "end": 387, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 33 } }, "left": { "type": "Identifier", "start": 367, "end": 372, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 18 }, "identifierName": "bound" }, "name": "bound" }, "operator": "===", "right": { "type": "StringLiteral", "start": 377, "end": 387, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 33 } }, "extra": { "rawValue": "infinity", "raw": "'infinity'" }, "value": "infinity" } }, "consequent": { "type": "BlockStatement", "start": 389, "end": 415, "loc": { "start": { "line": 18, "column": 35 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 395, "end": 411, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 20 } }, "argument": { "type": "Identifier", "start": 402, "end": 410, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 19 }, "identifierName": "Infinity" }, "name": "Infinity" } } ], "directives": [] }, "alternate": { "type": "IfStatement", "start": 421, "end": 515, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 24, "column": 3 } }, "test": { "type": "BinaryExpression", "start": 425, "end": 446, "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 34 } }, "left": { "type": "Identifier", "start": 425, "end": 430, "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 18 }, "identifierName": "bound" }, "name": "bound" }, "operator": "===", "right": { "type": "StringLiteral", "start": 435, "end": 446, "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 34 } }, "extra": { "rawValue": "-infinity", "raw": "'-infinity'" }, "value": "-infinity" } }, "consequent": { "type": "BlockStatement", "start": 448, "end": 475, "loc": { "start": { "line": 20, "column": 36 }, "end": { "line": 22, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 454, "end": 471, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 21 } }, "argument": { "type": "UnaryExpression", "start": 461, "end": 470, "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 20 } }, "operator": "-", "prefix": true, "argument": { "type": "Identifier", "start": 462, "end": 470, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 20 }, "identifierName": "Infinity" }, "name": "Infinity" }, "extra": { "parenthesizedArgument": false } } } ], "directives": [] }, "alternate": { "type": "BlockStatement", "start": 481, "end": 515, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 24, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 487, "end": 511, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 28 } }, "argument": { "type": "CallExpression", "start": 494, "end": 510, "loc": { "start": { "line": 23, "column": 11 }, "end": { "line": 23, "column": 27 } }, "callee": { "type": "Identifier", "start": 494, "end": 503, "loc": { "start": { "line": 23, "column": 11 }, "end": { "line": 23, "column": 20 }, "identifierName": "parseType" }, "name": "parseType" }, "arguments": [ { "type": "Identifier", "start": 504, "end": 509, "loc": { "start": { "line": 23, "column": 21 }, "end": { "line": 23, "column": 26 }, "identifierName": "bound" }, "name": "bound" } ] } } ], "directives": [] } } } } ], "directives": [] } }, { "type": "FunctionDeclaration", "start": 519, "end": 1534, "loc": { "start": { "line": 27, "column": 0 }, "end": { "line": 53, "column": 1 } }, "id": { "type": "Identifier", "start": 528, "end": 537, "loc": { "start": { "line": 27, "column": 9 }, "end": { "line": 27, "column": 18 }, "identifierName": "stringify" }, "name": "stringify" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 538, "end": 542, "loc": { "start": { "line": 27, "column": 19 }, "end": { "line": 27, "column": 23 }, "identifierName": "data" }, "name": "data" } ], "body": { "type": "BlockStatement", "start": 544, "end": 1534, "loc": { "start": { "line": 27, "column": 25 }, "end": { "line": 53, "column": 1 } }, "body": [ { "type": "IfStatement", "start": 548, "end": 579, "loc": { "start": { "line": 28, "column": 2 }, "end": { "line": 28, "column": 33 } }, "test": { "type": "BinaryExpression", "start": 552, "end": 565, "loc": { "start": { "line": 28, "column": 6 }, "end": { "line": 28, "column": 19 } }, "left": { "type": "Identifier", "start": 552, "end": 556, "loc": { "start": { "line": 28, "column": 6 }, "end": { "line": 28, "column": 10 }, "identifierName": "data" }, "name": "data" }, "operator": "===", "right": { "type": "NullLiteral", "start": 561, "end": 565, "loc": { "start": { "line": 28, "column": 15 }, "end": { "line": 28, "column": 19 } } } }, "consequent": { "type": "ReturnStatement", "start": 567, "end": 579, "loc": { "start": { "line": 28, "column": 21 }, "end": { "line": 28, "column": 33 } }, "argument": { "type": "NullLiteral", "start": 574, "end": 578, "loc": { "start": { "line": 28, "column": 28 }, "end": { "line": 28, "column": 32 } } } }, "alternate": null }, { "type": "IfStatement", "start": 583, "end": 647, "loc": { "start": { "line": 30, "column": 2 }, "end": { "line": 30, "column": 66 } }, "test": { "type": "UnaryExpression", "start": 587, "end": 603, "loc": { "start": { "line": 30, "column": 6 }, "end": { "line": 30, "column": 22 } }, "operator": "!", "prefix": true, "argument": { "type": "CallExpression", "start": 588, "end": 603, "loc": { "start": { "line": 30, "column": 7 }, "end": { "line": 30, "column": 22 } }, "callee": { "type": "MemberExpression", "start": 588, "end": 597, "loc": { "start": { "line": 30, "column": 7 }, "end": { "line": 30, "column": 16 } }, "object": { "type": "Identifier", "start": 588, "end": 589, "loc": { "start": { "line": 30, "column": 7 }, "end": { "line": 30, "column": 8 }, "identifierName": "_" }, "name": "_" }, "property": { "type": "Identifier", "start": 590, "end": 597, "loc": { "start": { "line": 30, "column": 9 }, "end": { "line": 30, "column": 16 }, "identifierName": "isArray" }, "name": "isArray" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 598, "end": 602, "loc": { "start": { "line": 30, "column": 17 }, "end": { "line": 30, "column": 21 }, "identifierName": "data" }, "name": "data" } ] }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "ThrowStatement", "start": 605, "end": 647, "loc": { "start": { "line": 30, "column": 24 }, "end": { "line": 30, "column": 66 } }, "argument": { "type": "NewExpression", "start": 611, "end": 646, "loc": { "start": { "line": 30, "column": 30 }, "end": { "line": 30, "column": 65 } }, "callee": { "type": "Identifier", "start": 615, "end": 620, "loc": { "start": { "line": 30, "column": 34 }, "end": { "line": 30, "column": 39 }, "identifierName": "Error" }, "name": "Error" }, "arguments": [ { "type": "StringLiteral", "start": 621, "end": 645, "loc": { "start": { "line": 30, "column": 40 }, "end": { "line": 30, "column": 64 } }, "extra": { "rawValue": "range must be an array", "raw": "'range must be an array'" }, "value": "range must be an array" } ] } }, "alternate": null }, { "type": "IfStatement", "start": 650, "end": 683, "loc": { "start": { "line": 31, "column": 2