UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,940 lines 2.74 MB
{ "type": "File", "start": 0, "end": 14478, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 532, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 14478, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 532, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 57, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 42 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 56, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 41 } }, "id": { "type": "Identifier", "start": 21, "end": 30, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 15 }, "identifierName": "DataTypes" }, "name": "DataTypes" }, "init": { "type": "CallExpression", "start": 33, "end": 56, "loc": { "start": { "line": 3, "column": 18 }, "end": { "line": 3, "column": 41 } }, "callee": { "type": "Identifier", "start": 33, "end": 40, "loc": { "start": { "line": 3, "column": 18 }, "end": { "line": 3, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 41, "end": 55, "loc": { "start": { "line": 3, "column": 26 }, "end": { "line": 3, "column": 40 } }, "extra": { "rawValue": "./data-types", "raw": "'./data-types'" }, "value": "./data-types" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 58, "end": 100, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 42 } }, "declarations": [ { "type": "VariableDeclarator", "start": 64, "end": 99, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 41 } }, "id": { "type": "Identifier", "start": 64, "end": 73, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 15 }, "identifierName": "SqlString" }, "name": "SqlString" }, "init": { "type": "CallExpression", "start": 76, "end": 99, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 41 } }, "callee": { "type": "Identifier", "start": 76, "end": 83, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 84, "end": 98, "loc": { "start": { "line": 4, "column": 26 }, "end": { "line": 4, "column": 40 } }, "extra": { "rawValue": "./sql-string", "raw": "'./sql-string'" }, "value": "./sql-string" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 101, "end": 144, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 43 } }, "declarations": [ { "type": "VariableDeclarator", "start": 107, "end": 143, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 42 } }, "id": { "type": "Identifier", "start": 107, "end": 108, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 111, "end": 143, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 42 } }, "callee": { "type": "MemberExpression", "start": 111, "end": 141, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 40 } }, "object": { "type": "CallExpression", "start": 111, "end": 128, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 27 } }, "callee": { "type": "Identifier", "start": 111, "end": 118, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 119, "end": 127, "loc": { "start": { "line": 5, "column": 18 }, "end": { "line": 5, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] }, "property": { "type": "Identifier", "start": 129, "end": 141, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 5, "column": 40 }, "identifierName": "runInContext" }, "name": "runInContext" }, "computed": false }, "arguments": [] } } ], "kind": "const", "trailingComments": [ { "type": "CommentLine", "value": " Prevent anyone messing with template settings by creating a fresh copy", "start": 145, "end": 218, "loc": { "start": { "line": 5, "column": 44 }, "end": { "line": 5, "column": 117 } } } ] }, { "type": "VariableDeclaration", "start": 219, "end": 285, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 66 } }, "declarations": [ { "type": "VariableDeclarator", "start": 225, "end": 284, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 65 } }, "id": { "type": "Identifier", "start": 225, "end": 243, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 24 }, "identifierName": "parameterValidator" }, "name": "parameterValidator", "leadingComments": null }, "init": { "type": "CallExpression", "start": 246, "end": 284, "loc": { "start": { "line": 6, "column": 27 }, "end": { "line": 6, "column": 65 } }, "callee": { "type": "Identifier", "start": 246, "end": 253, "loc": { "start": { "line": 6, "column": 27 }, "end": { "line": 6, "column": 34 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 254, "end": 283, "loc": { "start": { "line": 6, "column": 35 }, "end": { "line": 6, "column": 64 } }, "extra": { "rawValue": "./utils/parameter-validator", "raw": "'./utils/parameter-validator'" }, "value": "./utils/parameter-validator" } ] }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentLine", "value": " Prevent anyone messing with template settings by creating a fresh copy", "start": 145, "end": 218, "loc": { "start": { "line": 5, "column": 44 }, "end": { "line": 5, "column": 117 } } } ] }, { "type": "VariableDeclaration", "start": 286, "end": 327, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", "start": 292, "end": 326, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 40 } }, "id": { "type": "Identifier", "start": 292, "end": 298, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 12 }, "identifierName": "Logger" }, "name": "Logger" }, "init": { "type": "CallExpression", "start": 301, "end": 326, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 40 } }, "callee": { "type": "Identifier", "start": 301, "end": 308, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 22 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 309, "end": 325, "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 39 } }, "extra": { "rawValue": "./utils/logger", "raw": "'./utils/logger'" }, "value": "./utils/logger" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 328, "end": 357, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", "start": 334, "end": 356, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 28 } }, "id": { "type": "Identifier", "start": 334, "end": 338, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 10 }, "identifierName": "uuid" }, "name": "uuid" }, "init": { "type": "CallExpression", "start": 341, "end": 356, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 28 } }, "callee": { "type": "Identifier", "start": 341, "end": 348, "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 20 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 349, "end": 355, "loc": { "start": { "line": 8, "column": 21 }, "end": { "line": 8, "column": 27 } }, "extra": { "rawValue": "uuid", "raw": "'uuid'" }, "value": "uuid" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 358, "end": 395, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 364, "end": 394, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 36 } }, "id": { "type": "Identifier", "start": 364, "end": 371, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 13 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 374, "end": 394, "loc": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 36 } }, "callee": { "type": "Identifier", "start": 374, "end": 381, "loc": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 382, "end": 393, "loc": { "start": { "line": 9, "column": 24 }, "end": { "line": 9, "column": 35 } }, "extra": { "rawValue": "./promise", "raw": "'./promise'" }, "value": "./promise" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 396, "end": 447, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 51 } }, "declarations": [ { "type": "VariableDeclarator", "start": 402, "end": 446, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 50 } }, "id": { "type": "Identifier", "start": 402, "end": 412, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 16 }, "identifierName": "primitives" }, "name": "primitives" }, "init": { "type": "ArrayExpression", "start": 415, "end": 446, "loc": { "start": { "line": 10, "column": 19 }, "end": { "line": 10, "column": 50 } }, "elements": [ { "type": "StringLiteral", "start": 416, "end": 424, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 28 } }, "extra": { "rawValue": "string", "raw": "'string'" }, "value": "string" }, { "type": "StringLiteral", "start": 426, "end": 434, "loc": { "start": { "line": 10, "column": 30 }, "end": { "line": 10, "column": 38 } }, "extra": { "rawValue": "number", "raw": "'number'" }, "value": "number" }, { "type": "StringLiteral", "start": 436, "end": 445, "loc": { "start": { "line": 10, "column": 40 }, "end": { "line": 10, "column": 49 } }, "extra": { "rawValue": "boolean", "raw": "'boolean'" }, "value": "boolean" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 449, "end": 488, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 39 } }, "declarations": [ { "type": "VariableDeclarator", "start": 453, "end": 487, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 38 } }, "id": { "type": "Identifier", "start": 453, "end": 463, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 14 }, "identifierName": "inflection" }, "name": "inflection" }, "init": { "type": "CallExpression", "start": 466, "end": 487, "loc": { "start": { "line": 12, "column": 17 }, "end": { "line": 12, "column": 38 } }, "callee": { "type": "Identifier", "start": 466, "end": 473, "loc": { "start": { "line": 12, "column": 17 }, "end": { "line": 12, "column": 24 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 474, "end": 486, "loc": { "start": { "line": 12, "column": 25 }, "end": { "line": 12, "column": 37 } }, "extra": { "rawValue": "inflection", "raw": "'inflection'" }, "value": "inflection" } ] } } ], "kind": "let" }, { "type": "VariableDeclaration", "start": 489, "end": 517, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 495, "end": 516, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 27 } }, "id": { "type": "Identifier", "start": 495, "end": 501, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 12 }, "identifierName": "logger" }, "name": "logger" }, "init": { "type": "NewExpression", "start": 504, "end": 516, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 27 } }, "callee": { "type": "Identifier", "start": 508, "end": 514, "loc": { "start": { "line": 13, "column": 19 }, "end": { "line": 13, "column": 25 }, "identifierName": "Logger" }, "name": "Logger" }, "arguments": [] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 519, "end": 545, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 26 } }, "expression": { "type": "AssignmentExpression", "start": 519, "end": 544, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 519, "end": 534, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 15 } }, "object": { "type": "Identifier", "start": 519, "end": 526, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 7 }, "identifierName": "exports" }, "name": "exports" }, "property": { "type": "Identifier", "start": 527, "end": 534, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 15 }, "identifierName": "Promise" }, "name": "Promise" }, "computed": false }, "right": { "type": "Identifier", "start": 537, "end": 544, "loc": { "start": { "line": 15, "column": 18 }, "end": { "line": 15, "column": 25 }, "identifierName": "Promise" }, "name": "Promise" } } }, { "type": "ExpressionStatement", "start": 546, "end": 560, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 14 } }, "expression": { "type": "AssignmentExpression", "start": 546, "end": 559, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 13 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 546, "end": 555, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 9 } }, "object": { "type": "Identifier", "start": 546, "end": 553, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 7 }, "identifierName": "exports" }, "name": "exports" }, "property": { "type": "Identifier", "start": 554, "end": 555, "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 9 }, "identifierName": "_" }, "name": "_" }, "computed": false }, "right": { "type": "Identifier", "start": 558, "end": 559, "loc": { "start": { "line": 16, "column": 12 }, "end": { "line": 16, "column": 13 }, "identifierName": "_" }, "name": "_" } } }, { "type": "ExpressionStatement", "start": 561, "end": 603, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 42 } }, "expression": { "type": "AssignmentExpression", "start": 561, "end": 602, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 41 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 561, "end": 574, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 13 } }, "object": { "type": "Identifier", "start": 561, "end": 568, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 7 }, "identifierName": "exports" }, "name": "exports" }, "property": { "type": "Identifier", "start": 569, "end": 574, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 13 }, "identifierName": "debug" }, "name": "debug" }, "computed": false }, "right": { "type": "CallExpression", "start": 577, "end": 602, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 41 } }, "callee": { "type": "MemberExpression", "start": 577, "end": 594, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 33 } }, "object": { "type": "MemberExpression", "start": 577, "end": 589, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 28 } }, "object": { "type": "Identifier", "start": 577, "end": 583, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 22 }, "identifierName": "logger" }, "name": "logger" }, "property": { "type": "Identifier", "start": 584, "end": 589, "loc": { "start": { "line": 17, "column": 23 }, "end": { "line": 17, "column": 28 }, "identifierName": "debug" }, "name": "debug" }, "computed": false }, "property": { "type": "Identifier", "start": 590, "end": 594, "loc": { "start": { "line": 17, "column": 29 }, "end": { "line": 17, "column": 33 }, "identifierName": "bind" }, "name": "bind" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 595, "end": 601, "loc": { "start": { "line": 17, "column": 34 }, "end": { "line": 17, "column": 40 }, "identifierName": "logger" }, "name": "logger" } ] } } }, { "type": "ExpressionStatement", "start": 604, "end": 654, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 50 } }, "expression": { "type": "AssignmentExpression", "start": 604, "end": 653, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 49 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 604, "end": 621, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 17 } }, "object": { "type": "Identifier", "start": 604, "end": 611, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 7 }, "identifierName": "exports" }, "name": "exports" }, "property": { "type": "Identifier", "start": 612, "end": 621, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 17 }, "identifierName": "deprecate" }, "name": "deprecate" }, "computed": false }, "right": { "type": "CallExpression", "start": 624, "end": 653, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 49 } }, "callee": { "type": "MemberExpression", "start": 624, "end": 645, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 41 } }, "object": { "type": "MemberExpression", "start": 624, "end": 640, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 36 } }, "object": { "type": "Identifier", "start": 624, "end": 630, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 26 }, "identifierName": "logger" }, "name": "logger" }, "property": { "type": "Identifier", "start": 631, "end": 640, "loc": { "start": { "line": 18, "column": 27 }, "end": { "line": 18, "column": 36 }, "identifierName": "deprecate" }, "name": "deprecate" }, "computed": false }, "property": { "type": "Identifier", "start": 641, "end": 645, "loc": { "start": { "line": 18, "column": 37 }, "end": { "line": 18, "column": 41 }, "identifierName": "bind" }, "name": "bind" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 646, "end": 652, "loc": { "start": { "line": 18, "column": 42 }, "end": { "line": 18, "column": 48 }, "identifierName": "logger" }, "name": "logger" } ] } } }, { "type": "ExpressionStatement", "start": 655, "end": 695, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 40 } }, "expression": { "type": "AssignmentExpression", "start": 655, "end": 694, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 39 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 655, "end": 667, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 12 } }, "object": { "type": "Identifier", "start": 655, "end": 662, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 7 }, "identifierName": "exports" }, "name": "exports" }, "property": { "type": "Identifier", "start": 663, "end": 667, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 12 }, "identifierName": "warn" }, "name": "warn" }, "computed": false }, "right": { "type": "CallExpression", "start": 670, "end": 694, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 39 } }, "callee": { "type": "MemberExpression", "start": 670, "end": 686, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 31 } }, "object": { "type": "MemberExpression", "start": 670, "end": 681, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 26 } }, "object": { "type": "Identifier", "start": 670, "end": 676, "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 19, "column": 21 }, "identifierName": "logger" }, "name": "logger" }, "property": { "type": "Identifier", "start": 677, "end": 681, "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 26 }, "identifierName": "warn" }, "name": "warn" }, "computed": false }, "property": { "type": "Identifier", "start": 682, "end": 686, "loc": { "start": { "line": 19, "column": 27 }, "end": { "line": 19, "column": 31 }, "identifierName": "bind" }, "name": "bind" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 687, "end": 693, "loc": { "start": { "line": 19, "column": 32 }, "end": { "line": 19, "colu