UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,938 lines 4.81 MB
{ "type": "File", "start": 0, "end": 48696, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1248, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 48696, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1248, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 42, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 41, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 26 } }, "id": { "type": "Identifier", "start": 21, "end": 24, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 9 }, "identifierName": "url" }, "name": "url" }, "init": { "type": "CallExpression", "start": 27, "end": 41, "loc": { "start": { "line": 3, "column": 12 }, "end": { "line": 3, "column": 26 } }, "callee": { "type": "Identifier", "start": 27, "end": 34, "loc": { "start": { "line": 3, "column": 12 }, "end": { "line": 3, "column": 19 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 35, "end": 40, "loc": { "start": { "line": 3, "column": 20 }, "end": { "line": 3, "column": 25 } }, "extra": { "rawValue": "url", "raw": "'url'" }, "value": "url" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 43, "end": 72, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", "start": 49, "end": 71, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 28 } }, "id": { "type": "Identifier", "start": 49, "end": 53, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 10 }, "identifierName": "Path" }, "name": "Path" }, "init": { "type": "CallExpression", "start": 56, "end": 71, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 28 } }, "callee": { "type": "Identifier", "start": 56, "end": 63, "loc": { "start": { "line": 4, "column": 13 }, "end": { "line": 4, "column": 20 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 64, "end": 70, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 27 } }, "extra": { "rawValue": "path", "raw": "'path'" }, "value": "path" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 73, "end": 116, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 43 } }, "declarations": [ { "type": "VariableDeclarator", "start": 79, "end": 115, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 42 } }, "id": { "type": "Identifier", "start": 79, "end": 84, "loc": { "start": { "line": 5, "column": 6 }, "end": { "line": 5, "column": 11 }, "identifierName": "retry" }, "name": "retry" }, "init": { "type": "CallExpression", "start": 87, "end": 115, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 42 } }, "callee": { "type": "Identifier", "start": 87, "end": 94, "loc": { "start": { "line": 5, "column": 14 }, "end": { "line": 5, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 95, "end": 114, "loc": { "start": { "line": 5, "column": 22 }, "end": { "line": 5, "column": 41 } }, "extra": { "rawValue": "retry-as-promised", "raw": "'retry-as-promised'" }, "value": "retry-as-promised" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 117, "end": 161, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 44 } }, "declarations": [ { "type": "VariableDeclarator", "start": 123, "end": 160, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 43 } }, "id": { "type": "Identifier", "start": 123, "end": 134, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 17 }, "identifierName": "clsBluebird" }, "name": "clsBluebird" }, "init": { "type": "CallExpression", "start": 137, "end": 160, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 43 } }, "callee": { "type": "Identifier", "start": 137, "end": 144, "loc": { "start": { "line": 6, "column": 20 }, "end": { "line": 6, "column": 27 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 145, "end": 159, "loc": { "start": { "line": 6, "column": 28 }, "end": { "line": 6, "column": 42 } }, "extra": { "rawValue": "cls-bluebird", "raw": "'cls-bluebird'" }, "value": "cls-bluebird" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 162, "end": 195, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 7, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 168, "end": 194, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 32 } }, "id": { "type": "Identifier", "start": 168, "end": 173, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 11 }, "identifierName": "Utils" }, "name": "Utils" }, "init": { "type": "CallExpression", "start": 176, "end": 194, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 32 } }, "callee": { "type": "Identifier", "start": 176, "end": 183, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 184, "end": 193, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 31 } }, "extra": { "rawValue": "./utils", "raw": "'./utils'" }, "value": "./utils" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 196, "end": 229, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 8, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 202, "end": 228, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 32 } }, "id": { "type": "Identifier", "start": 202, "end": 207, "loc": { "start": { "line": 8, "column": 6 }, "end": { "line": 8, "column": 11 }, "identifierName": "Model" }, "name": "Model" }, "init": { "type": "CallExpression", "start": 210, "end": 228, "loc": { "start": { "line": 8, "column": 14 }, "end": { "line": 8, "column": 32 } }, "callee": { "type": "Identifier", "start": 210, "end": 217, "loc": { "start": { "line": 8, "column": 14 }, "end": { "line": 8, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 218, "end": 227, "loc": { "start": { "line": 8, "column": 22 }, "end": { "line": 8, "column": 31 } }, "extra": { "rawValue": "./model", "raw": "'./model'" }, "value": "./model" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 230, "end": 272, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 9, "column": 42 } }, "declarations": [ { "type": "VariableDeclarator", "start": 236, "end": 271, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 41 } }, "id": { "type": "Identifier", "start": 236, "end": 245, "loc": { "start": { "line": 9, "column": 6 }, "end": { "line": 9, "column": 15 }, "identifierName": "DataTypes" }, "name": "DataTypes" }, "init": { "type": "CallExpression", "start": 248, "end": 271, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 9, "column": 41 } }, "callee": { "type": "Identifier", "start": 248, "end": 255, "loc": { "start": { "line": 9, "column": 18 }, "end": { "line": 9, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 256, "end": 270, "loc": { "start": { "line": 9, "column": 26 }, "end": { "line": 9, "column": 40 } }, "extra": { "rawValue": "./data-types", "raw": "'./data-types'" }, "value": "./data-types" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 273, "end": 316, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 43 } }, "declarations": [ { "type": "VariableDeclarator", "start": 279, "end": 315, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 42 } }, "id": { "type": "Identifier", "start": 279, "end": 289, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 16 }, "identifierName": "Deferrable" }, "name": "Deferrable" }, "init": { "type": "CallExpression", "start": 292, "end": 315, "loc": { "start": { "line": 10, "column": 19 }, "end": { "line": 10, "column": 42 } }, "callee": { "type": "Identifier", "start": 292, "end": 299, "loc": { "start": { "line": 10, "column": 19 }, "end": { "line": 10, "column": 26 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 300, "end": 314, "loc": { "start": { "line": 10, "column": 27 }, "end": { "line": 10, "column": 41 } }, "extra": { "rawValue": "./deferrable", "raw": "'./deferrable'" }, "value": "./deferrable" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 317, "end": 365, "loc": { "start": { "line": 11, "column": 0 }, "end": { "line": 11, "column": 48 } }, "declarations": [ { "type": "VariableDeclarator", "start": 323, "end": 364, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 47 } }, "id": { "type": "Identifier", "start": 323, "end": 335, "loc": { "start": { "line": 11, "column": 6 }, "end": { "line": 11, "column": 18 }, "identifierName": "ModelManager" }, "name": "ModelManager" }, "init": { "type": "CallExpression", "start": 338, "end": 364, "loc": { "start": { "line": 11, "column": 21 }, "end": { "line": 11, "column": 47 } }, "callee": { "type": "Identifier", "start": 338, "end": 345, "loc": { "start": { "line": 11, "column": 21 }, "end": { "line": 11, "column": 28 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 346, "end": 363, "loc": { "start": { "line": 11, "column": 29 }, "end": { "line": 11, "column": 46 } }, "extra": { "rawValue": "./model-manager", "raw": "'./model-manager'" }, "value": "./model-manager" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 366, "end": 418, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 12, "column": 52 } }, "declarations": [ { "type": "VariableDeclarator", "start": 372, "end": 417, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 51 } }, "id": { "type": "Identifier", "start": 372, "end": 386, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 20 }, "identifierName": "QueryInterface" }, "name": "QueryInterface" }, "init": { "type": "CallExpression", "start": 389, "end": 417, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 51 } }, "callee": { "type": "Identifier", "start": 389, "end": 396, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 30 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 397, "end": 416, "loc": { "start": { "line": 12, "column": 31 }, "end": { "line": 12, "column": 50 } }, "extra": { "rawValue": "./query-interface", "raw": "'./query-interface'" }, "value": "./query-interface" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 419, "end": 464, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 13, "column": 45 } }, "declarations": [ { "type": "VariableDeclarator", "start": 425, "end": 463, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 44 } }, "id": { "type": "Identifier", "start": 425, "end": 436, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 17 }, "identifierName": "Transaction" }, "name": "Transaction" }, "init": { "type": "CallExpression", "start": 439, "end": 463, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 44 } }, "callee": { "type": "Identifier", "start": 439, "end": 446, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 27 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 447, "end": 462, "loc": { "start": { "line": 13, "column": 28 }, "end": { "line": 13, "column": 43 } }, "extra": { "rawValue": "./transaction", "raw": "'./transaction'" }, "value": "./transaction" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 465, "end": 509, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 44 } }, "declarations": [ { "type": "VariableDeclarator", "start": 471, "end": 508, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 43 } }, "id": { "type": "Identifier", "start": 471, "end": 481, "loc": { "start": { "line": 14, "column": 6 }, "end": { "line": 14, "column": 16 }, "identifierName": "QueryTypes" }, "name": "QueryTypes" }, "init": { "type": "CallExpression", "start": 484, "end": 508, "loc": { "start": { "line": 14, "column": 19 }, "end": { "line": 14, "column": 43 } }, "callee": { "type": "Identifier", "start": 484, "end": 491, "loc": { "start": { "line": 14, "column": 19 }, "end": { "line": 14, "column": 26 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 492, "end": 507, "loc": { "start": { "line": 14, "column": 27 }, "end": { "line": 14, "column": 42 } }, "extra": { "rawValue": "./query-types", "raw": "'./query-types'" }, "value": "./query-types" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 510, "end": 554, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 15, "column": 44 } }, "declarations": [ { "type": "VariableDeclarator", "start": 516, "end": 553, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 43 } }, "id": { "type": "Identifier", "start": 516, "end": 531, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 21 }, "identifierName": "sequelizeErrors" }, "name": "sequelizeErrors" }, "init": { "type": "CallExpression", "start": 534, "end": 553, "loc": { "start": { "line": 15, "column": 24 }, "end": { "line": 15, "column": 43 } }, "callee": { "type": "Identifier", "start": 534, "end": 541, "loc": { "start": { "line": 15, "column": 24 }, "end": { "line": 15, "column": 31 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 542, "end": 552, "loc": { "start": { "line": 15, "column": 32 }, "end": { "line": 15, "column": 42 } }, "extra": { "rawValue": "./errors", "raw": "'./errors'" }, "value": "./errors" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 555, "end": 592, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 561, "end": 591, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 36 } }, "id": { "type": "Identifier", "start": 561, "end": 568, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 13 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 571, "end": 591, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 36 } }, "callee": { "type": "Identifier", "start": 571, "end": 578, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 23 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 579, "end": 590, "loc": { "start": { "line": 16, "column": 24 }, "end": { "line": 16, "column": 35 } }, "extra": { "rawValue": "./promise", "raw": "'./promise'" }, "value": "./promise" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 593, "end": 626, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 17, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 599, "end": 625, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 32 } }, "id": { "type": "Identifier", "start": 599, "end": 604, "loc": { "start": { "line": 17, "column": 6 }, "end": { "line": 17, "column": 11 }, "identifierName": "Hooks" }, "name": "Hooks" }, "init": { "type": "CallExpression", "start": 607, "end": 625, "loc": { "start": { "line": 17, "column": 14 }, "end": { "line": 17, "column": 32 } }, "callee": { "type": "Identifier", "start": 607, "end": 614, "loc": { "start": { "line": 17, "column": 14 }, "end": { "line": 17, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 615, "end": 624, "loc": { "start": { "line": 17, "column": 22 }, "end": { "line": 17, "column": 31 } }, "extra": { "rawValue": "./hooks", "raw": "'./hooks'" }, "value": "./hooks" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 627, "end": 679, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 52 } }, "declarations": [ { "type": "VariableDeclarator", "start": 633, "end": 678, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 51 } }, "id": { "type": "Identifier", "start": 633, "end": 644, "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 17 }, "identifierName": "Association" }, "name": "Association" }, "init": { "type": "CallExpression", "start": 647, "end": 678, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 51 } }, "callee": { "type": "Identifier", "start": 647, "end": 654, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 27 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 655, "end": 677, "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 18, "column": 50 } }, "extra": { "rawValue": "./associations/index", "raw": "'./associations/index'" }, "value": "./associations/index" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 680, "end": 744, "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 19, "column": 64 } }, "declarations": [ { "type": "VariableDeclarator", "start": 686, "end": 743, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 63 } }, "id": { "type": "Identifier", "start": 686, "end": 695, "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 15 }, "identifierName": "Validator" }, "name": "Validator" }, "init": { "type": "MemberExpression", "start": 698, "end": 743, "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 63 } }, "object": { "type": "CallExpression", "start": 698, "end": 733, "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 53 } }, "callee": { "type": "Identifier", "start": 698, "end": 705, "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 25 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 706, "end": 732, "loc": { "start": { "line": 19, "column": 26 }, "end": { "line": 19, "column": 52 } }, "extra": { "rawValue": "./utils/validator-extras", "raw": "'./utils/validator-extras'" }, "value": "./utils/validator-extras" } ] }, "property": { "type": "Identifier", "start": 734, "end": 743, "loc": { "start": { "line": 19, "column": 54 }, "end": { "line": 19, "column": 63 }, "identifierName": "validator" }, "name": "validator" }, "computed": false } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 745, "end": 773, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 20, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 751, "end": 772, "loc": { "start": { "line": 20, "column": 6 }, "end": { "line": 20, "column": 27 } }, "id": { "type": "Identifier", "start": 751, "end": 752, "loc": { "start": { "line": 20, "column": 6 }, "end": { "line": 20, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 755, "end": 772, "loc": { "start": { "line": 20, "column": 10 }, "end": { "line": 20, "column": 27 } }, "callee": { "type": "Identifier", "start": 755, "end": 762, "loc": { "start": { "line": 20, "column": 10 }, "end": { "line": 20, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 763, "end": 771, "loc": { "start": { "line": 20, "column": 18 }, "end": { "line": 20, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const", "trailingComments": [ { "type": "CommentBlock", "value": "*\n * This is the main class, the entry point to sequelize. To use it, you just need to import sequelize:\n *\n * ```js\n * const Sequelize = require('sequelize');\n * ```\n *\n * In addition to sequelize, the connection library for the dialect you want to use should also be installed in your project. You