UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,928 lines (1,927 loc) 4.15 MB
{ "type": "File", "start": 0, "end": 26421, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 849, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 26421, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 849, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 33, "end": 62, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", "start": 39, "end": 61, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 28 } }, "id": { "type": "Identifier", "start": 39, "end": 43, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 10 }, "identifierName": "util" }, "name": "util", "leadingComments": null }, "init": { "type": "CallExpression", "start": 46, "end": 61, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 28 } }, "callee": { "type": "Identifier", "start": 46, "end": 53, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 20 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 54, "end": 60, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 27 } }, "extra": { "rawValue": "util", "raw": "'util'" }, "value": "util" } ] }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentBlock", "value": "jshint -W110 ", "start": 14, "end": 31, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 17 } } } ] }, { "type": "VariableDeclaration", "start": 63, "end": 108, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 45 } }, "declarations": [ { "type": "VariableDeclarator", "start": 69, "end": 107, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 44 } }, "id": { "type": "Identifier", "start": 69, "end": 77, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 14 }, "identifierName": "inherits" }, "name": "inherits" }, "init": { "type": "CallExpression", "start": 80, "end": 107, "loc": { "start": { "line": 5, "column": 17 }, "end": { "line": 5, "column": 44 } }, "callee": { "type": "Identifier", "start": 80, "end": 87, "loc": { "start": { "line": 5, "column": 17 }, "end": { "line": 5, "column": 24 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 88, "end": 106, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 43 } }, "extra": { "rawValue": "./utils/inherits", "raw": "'./utils/inherits'" }, "value": "./utils/inherits" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 109, "end": 137, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 115, "end": 136, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 27 } }, "id": { "type": "Identifier", "start": 115, "end": 116, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 119, "end": 136, "loc": { "start": { "line": 6, "column": 10 }, "end": { "line": 6, "column": 27 } }, "callee": { "type": "Identifier", "start": 119, "end": 126, "loc": { "start": { "line": 6, "column": 10 }, "end": { "line": 6, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 127, "end": 135, "loc": { "start": { "line": 6, "column": 18 }, "end": { "line": 6, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 138, "end": 184, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 46 } }, "declarations": [ { "type": "VariableDeclarator", "start": 144, "end": 183, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 45 } }, "id": { "type": "Identifier", "start": 144, "end": 147, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 9 }, "identifierName": "Wkt" }, "name": "Wkt" }, "init": { "type": "CallExpression", "start": 150, "end": 183, "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 45 } }, "callee": { "type": "Identifier", "start": 150, "end": 157, "loc": { "start": { "line": 7, "column": 12 }, "end": { "line": 7, "column": 19 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 158, "end": 182, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 44 } }, "extra": { "rawValue": "terraformer-wkt-parser", "raw": "'terraformer-wkt-parser'" }, "value": "terraformer-wkt-parser" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 185, "end": 229, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 44 } }, "declarations": [ { "type": "VariableDeclarator", "start": 191, "end": 228, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 43 } }, "id": { "type": "Identifier", "start": 191, "end": 206, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 21 }, "identifierName": "sequelizeErrors" }, "name": "sequelizeErrors" }, "init": { "type": "CallExpression", "start": 209, "end": 228, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 43 } }, "callee": { "type": "Identifier", "start": 209, "end": 216, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 217, "end": 227, "loc": { "start": { "line": 8, "column": 32 }, "end": { "line": 8, "column": 42 } }, "extra": { "rawValue": "./errors", "raw": "'./errors'" }, "value": "./errors" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 230, "end": 250, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", "start": 236, "end": 249, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 19 } }, "id": { "type": "Identifier", "start": 236, "end": 244, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 14 }, "identifierName": "warnings" }, "name": "warnings" }, "init": { "type": "ObjectExpression", "start": 247, "end": 249, "loc": { "start": { "line": 9, "column": 17 }, "end": { "line": 9, "column": 19 } }, "properties": [] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 251, "end": 315, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 64 } }, "declarations": [ { "type": "VariableDeclarator", "start": 257, "end": 314, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 63 } }, "id": { "type": "Identifier", "start": 257, "end": 266, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 15 }, "identifierName": "Validator" }, "name": "Validator" }, "init": { "type": "MemberExpression", "start": 269, "end": 314, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 63 } }, "object": { "type": "CallExpression", "start": 269, "end": 304, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 53 } }, "callee": { "type": "Identifier", "start": 269, "end": 276, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 277, "end": 303, "loc": { "start": { "line": 10, "column": 26 }, "end": { "line": 10, "column": 52 } }, "extra": { "rawValue": "./utils/validator-extras", "raw": "'./utils/validator-extras'" }, "value": "./utils/validator-extras" } ] }, "property": { "type": "Identifier", "start": 305, "end": 314, "loc": { "start": { "line": 10, "column": 54 }, "end": { "line": 10, "column": 63 }, "identifierName": "validator" }, "name": "validator" }, "computed": false } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 316, "end": 360, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 44 } }, "declarations": [ { "type": "VariableDeclarator", "start": 322, "end": 359, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 43 } }, "id": { "type": "Identifier", "start": 322, "end": 330, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 14 }, "identifierName": "momentTz" }, "name": "momentTz" }, "init": { "type": "CallExpression", "start": 333, "end": 359, "loc": { "start": { "line": 11, "column": 17 }, "end": { "line": 11, "column": 43 } }, "callee": { "type": "Identifier", "start": 333, "end": 340, "loc": { "start": { "line": 11, "column": 17 }, "end": { "line": 11, "column": 24 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 341, "end": 358, "loc": { "start": { "line": 11, "column": 25 }, "end": { "line": 11, "column": 42 } }, "extra": { "rawValue": "moment-timezone", "raw": "'moment-timezone'" }, "value": "moment-timezone" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 361, "end": 394, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 367, "end": 393, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 32 } }, "id": { "type": "Identifier", "start": 367, "end": 373, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 12 }, "identifierName": "moment" }, "name": "moment" }, "init": { "type": "CallExpression", "start": 376, "end": 393, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 32 } }, "callee": { "type": "Identifier", "start": 376, "end": 383, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 22 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 384, "end": 392, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 31 } }, "extra": { "rawValue": "moment", "raw": "'moment'" }, "value": "moment" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 395, "end": 428, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 401, "end": 427, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 32 } }, "id": { "type": "Identifier", "start": 401, "end": 406, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 11 }, "identifierName": "Utils" }, "name": "Utils" }, "init": { "type": "CallExpression", "start": 409, "end": 427, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 32 } }, "callee": { "type": "Identifier", "start": 409, "end": 416, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 417, "end": 426, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 13, "column": 31 } }, "extra": { "rawValue": "./utils", "raw": "'./utils'" }, "value": "./utils" } ] } } ], "kind": "const" }, { "type": "FunctionDeclaration", "start": 430, "end": 452, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 22 } }, "id": { "type": "Identifier", "start": 439, "end": 447, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 17 }, "identifierName": "ABSTRACT" }, "name": "ABSTRACT" }, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 450, "end": 452, "loc": { "start": { "line": 15, "column": 20 }, "end": { "line": 15, "column": 22 } }, "body": [], "directives": [] } }, { "type": "ExpressionStatement", "start": 454, "end": 491, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 37 } }, "expression": { "type": "AssignmentExpression", "start": 454, "end": 490, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 36 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 454, "end": 485, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 31 } }, "object": { "type": "MemberExpression", "start": 454, "end": 472, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 18 } }, "object": { "type": "Identifier", "start": 454, "end": 462, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 8 }, "identifierName": "ABSTRACT" }, "name": "ABSTRACT" }, "property": { "type": "Identifier", "start": 463, "end": 472, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 18 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 473, "end": 485, "loc": { "start": { "line": 17, "column": 19 }, "end": { "line": 17, "column": 31 }, "identifierName": "dialectTypes" }, "name": "dialectTypes" }, "computed": false }, "right": { "type": "StringLiteral", "start": 488, "end": 490, "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 36 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" } } }, { "type": "ExpressionStatement", "start": 493, "end": 584, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 21, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 493, "end": 583, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 21, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 493, "end": 520, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 27 } }, "object": { "type": "MemberExpression", "start": 493, "end": 511, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 18 } }, "object": { "type": "Identifier", "start": 493, "end": 501, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 8 }, "identifierName": "ABSTRACT" }, "name": "ABSTRACT" }, "property": { "type": "Identifier", "start": 502, "end": 511, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 18 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 512, "end": 520, "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 27 }, "identifierName": "toString" }, "name": "toString" }, "computed": false }, "right": { "type": "FunctionExpression", "start": 523, "end": 583, "loc": { "start": { "line": 19, "column": 30 }, "end": { "line": 21, "column": 1 } }, "id": { "type": "Identifier", "start": 512, "end": 520, "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 27 }, "identifierName": "toString" }, "name": "toString" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 541, "end": 548, "loc": { "start": { "line": 19, "column": 48 }, "end": { "line": 19, "column": 55 }, "identifierName": "options" }, "name": "options" } ], "body": { "type": "BlockStatement", "start": 550, "end": 583, "loc": { "start": { "line": 19, "column": 57 }, "end": { "line": 21, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 554, "end": 581, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 20, "column": 29 } }, "argument": { "type": "CallExpression", "start": 561, "end": 580, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 561, "end": 571, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 19 } }, "object": { "type": "ThisExpression", "start": 561, "end": 565, "loc": { "start": { "line": 20, "column": 9 }, "end": { "line": 20, "column": 13 } } }, "property": { "type": "Identifier", "start": 566, "end": 571, "loc": { "start": { "line": 20, "column": 14 }, "end": { "line": 20, "column": 19 }, "identifierName": "toSql" }, "name": "toSql" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 572, "end": 579, "loc": { "start": { "line": 20, "column": 20 }, "end": { "line": 20, "column": 27 }, "identifierName": "options" }, "name": "options" } ] } } ], "directives": [] } } } }, { "type": "ExpressionStatement", "start": 585, "end": 652, "loc": { "start": { "line": 22, "column": 0 }, "end": { "line": 24, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 585, "end": 651, "loc": { "start": { "line": 22, "column": 0 }, "end": { "line": 24, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 585, "end": 609, "loc": { "start": { "line": 22, "column": 0 }, "end": { "line": 22, "column": 24 } }, "object": { "type": "MemberExpression", "start": 585, "end": 603, "loc": { "start": { "line": 22, "column": 0 }, "end": { "line": 22, "column": 18 } }, "object": { "type": "Identifier", "start": 585, "end": 593, "loc": { "start": { "line": 22, "column": 0 }, "end": { "line": 22, "column": 8 }, "identifierName": "ABSTRACT" }, "name": "ABSTRACT" }, "property": { "type": "Identifier", "start": 594, "end": 603, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 22, "column": 18 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 604, "end": 609, "loc": { "start": { "line": 22, "column": 19 }, "end": { "line": 22, "column": 24 }, "identifierName": "toSql" }, "name": "toSql" }, "computed": false }, "right": { "type": "FunctionExpression", "start": 612, "end": 651, "loc": { "start": { "line": 22, "column": 27 }, "end": { "line": 24, "column": 1 } }, "id": { "type": "Identifier", "start": 604, "end": 609, "loc": { "start": { "line": 22, "column": 19 }, "end": { "line": 22, "column": 24 }, "identifierName": "toSql" }, "name": "toSql" }, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 629, "end": 651, "loc": { "start": { "line": 22, "column": 44 }, "end": { "line": 24, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 633, "end": 649, "loc": { "start": { "line": 23, "column": 2 }, "end": { "line": 23, "column": 18 } }, "argument": { "type": "MemberExpression", "start": 640, "end": 648, "loc": { "start": { "line": 23, "column": 9 }, "end": { "line": 23, "column": 17 } }, "object": { "type": "ThisExpression", "start": 640, "end": 644, "loc": { "start": { "line": 23, "column": 9 }, "end": { "line": 23, "column": 13 } } }, "property": { "type": "Identifier", "start": 645, "end": 648, "loc": { "start": { "line": 23, "column": 14 }, "end": { "line": 23, "column": 17 }, "identifierName": "key" }, "name": "key" }, "computed": false } } ], "directives": [] } } } }, { "type": "ExpressionStatement", "start": 653, "end": 806, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 30, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 653, "end": 805, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 30, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 653, "end": 666, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 13 } }, "object": { "type": "Identifier", "start": 653, "end": 661, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 8 }, "identifierName": "ABSTRACT" }, "name": "ABSTRACT" }, "property": { "type": "Identifier", "start": 662, "end": 666, "loc": { "start": { "line": 25, "column": 9 }, "end": { "line": 25, "column": 13 }, "identifierName": "warn" }, "name": "warn" }, "computed": false }, "right": { "type": "FunctionExpression", "start": 669, "end": 805, "loc": { "start": { "line": 25, "column": 16 }, "end": { "line": 30, "column": 1 } }, "id": { "type": "Identifier", "start": 662, "end": 666, "loc": { "start": { "line": 25, "column": 9 }, "end": { "line": 25, "column": 13 }, "identifierName": "warn" }, "name": "warn" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 683, "end": 687, "loc": { "start": { "line": 25, "column": 30 }, "end": { "line": 25, "column": 34 }, "identifierName": "link" }, "name": "link" }, { "type": "Identifier", "start": 689, "end": 693, "loc": { "start": { "line": 25, "column": 36 }, "end": {