UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,326 lines (1,325 loc) 936 kB
{ "type": "File", "start": 0, "end": 7454, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 282, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 7454, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 282, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 48, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 47, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 32 } }, "id": { "type": "Identifier", "start": 21, "end": 26, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 11 }, "identifierName": "Utils" }, "name": "Utils" }, "init": { "type": "CallExpression", "start": 29, "end": 47, "loc": { "start": { "line": 3, "column": 14 }, "end": { "line": 3, "column": 32 } }, "callee": { "type": "Identifier", "start": 29, "end": 36, "loc": { "start": { "line": 3, "column": 14 }, "end": { "line": 3, "column": 21 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 37, "end": 46, "loc": { "start": { "line": 3, "column": 22 }, "end": { "line": 3, "column": 31 } }, "extra": { "rawValue": "./utils", "raw": "'./utils'" }, "value": "./utils" } ] } } ], "kind": "const", "trailingComments": [ { "type": "CommentBlock", "value": "*\n * The transaction object is used to identify a running transaction. It is created by calling `Sequelize.transaction()`.\n *\n * To run a query under a transaction, you should pass the transaction in the options object..\n *\n * @see {@link Sequelize.transaction}\n ", "start": 50, "end": 317, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 11, "column": 3 } } } ] }, { "type": "ClassDeclaration", "start": 318, "end": 7342, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 277, "column": 1 } }, "id": { "type": "Identifier", "start": 324, "end": 335, "loc": { "start": { "line": 12, "column": 6 }, "end": { "line": 12, "column": 17 }, "identifierName": "Transaction" }, "name": "Transaction", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 336, "end": 7342, "loc": { "start": { "line": 12, "column": 18 }, "end": { "line": 277, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 827, "end": 1766, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 47, "column": 3 } }, "computed": false, "key": { "type": "Identifier", "start": 827, "end": 838, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 21, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "static": false, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 839, "end": 848, "loc": { "start": { "line": 21, "column": 14 }, "end": { "line": 21, "column": 23 }, "identifierName": "sequelize" }, "name": "sequelize" }, { "type": "Identifier", "start": 850, "end": 857, "loc": { "start": { "line": 21, "column": 25 }, "end": { "line": 21, "column": 32 }, "identifierName": "options" }, "name": "options" } ], "body": { "type": "BlockStatement", "start": 859, "end": 1766, "loc": { "start": { "line": 21, "column": 34 }, "end": { "line": 47, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 865, "end": 892, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 31 } }, "expression": { "type": "AssignmentExpression", "start": 865, "end": 891, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 30 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 865, "end": 879, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 18 } }, "object": { "type": "ThisExpression", "start": 865, "end": 869, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 8 } } }, "property": { "type": "Identifier", "start": 870, "end": 879, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 22, "column": 18 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "right": { "type": "Identifier", "start": 882, "end": 891, "loc": { "start": { "line": 22, "column": 21 }, "end": { "line": 22, "column": 30 }, "identifierName": "sequelize" }, "name": "sequelize" } } }, { "type": "ExpressionStatement", "start": 897, "end": 918, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 25 } }, "expression": { "type": "AssignmentExpression", "start": 897, "end": 917, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 897, "end": 912, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 19 } }, "object": { "type": "ThisExpression", "start": 897, "end": 901, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 8 } } }, "property": { "type": "Identifier", "start": 902, "end": 912, "loc": { "start": { "line": 23, "column": 9 }, "end": { "line": 23, "column": 19 }, "identifierName": "savepoints" }, "name": "savepoints" }, "computed": false }, "right": { "type": "ArrayExpression", "start": 915, "end": 917, "loc": { "start": { "line": 23, "column": 22 }, "end": { "line": 23, "column": 24 } }, "elements": [] } }, "trailingComments": [ { "type": "CommentLine", "value": " get dialect specific transaction options", "start": 924, "end": 967, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 47 } } } ] }, { "type": "VariableDeclaration", "start": 972, "end": 1051, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 83 } }, "declarations": [ { "type": "VariableDeclarator", "start": 978, "end": 1050, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 82 } }, "id": { "type": "Identifier", "start": 978, "end": 996, "loc": { "start": { "line": 26, "column": 10 }, "end": { "line": 26, "column": 28 }, "identifierName": "transactionOptions" }, "name": "transactionOptions", "leadingComments": null }, "init": { "type": "LogicalExpression", "start": 999, "end": 1050, "loc": { "start": { "line": 26, "column": 31 }, "end": { "line": 26, "column": 82 } }, "left": { "type": "MemberExpression", "start": 999, "end": 1044, "loc": { "start": { "line": 26, "column": 31 }, "end": { "line": 26, "column": 76 } }, "object": { "type": "MemberExpression", "start": 999, "end": 1025, "loc": { "start": { "line": 26, "column": 31 }, "end": { "line": 26, "column": 57 } }, "object": { "type": "MemberExpression", "start": 999, "end": 1016, "loc": { "start": { "line": 26, "column": 31 }, "end": { "line": 26, "column": 48 } }, "object": { "type": "Identifier", "start": 999, "end": 1008, "loc": { "start": { "line": 26, "column": 31 }, "end": { "line": 26, "column": 40 }, "identifierName": "sequelize" }, "name": "sequelize" }, "property": { "type": "Identifier", "start": 1009, "end": 1016, "loc": { "start": { "line": 26, "column": 41 }, "end": { "line": 26, "column": 48 }, "identifierName": "dialect" }, "name": "dialect" }, "computed": false }, "property": { "type": "Identifier", "start": 1017, "end": 1025, "loc": { "start": { "line": 26, "column": 49 }, "end": { "line": 26, "column": 57 }, "identifierName": "supports" }, "name": "supports" }, "computed": false }, "property": { "type": "Identifier", "start": 1026, "end": 1044, "loc": { "start": { "line": 26, "column": 58 }, "end": { "line": 26, "column": 76 }, "identifierName": "transactionOptions" }, "name": "transactionOptions" }, "computed": false }, "operator": "||", "right": { "type": "ObjectExpression", "start": 1048, "end": 1050, "loc": { "start": { "line": 26, "column": 80 }, "end": { "line": 26, "column": 82 } }, "properties": [] } }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentLine", "value": " get dialect specific transaction options", "start": 924, "end": 967, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 47 } } } ] }, { "type": "VariableDeclaration", "start": 1056, "end": 1146, "loc": { "start": { "line": 27, "column": 4 }, "end": { "line": 27, "column": 94 } }, "declarations": [ { "type": "VariableDeclarator", "start": 1062, "end": 1145, "loc": { "start": { "line": 27, "column": 10 }, "end": { "line": 27, "column": 93 } }, "id": { "type": "Identifier", "start": 1062, "end": 1083, "loc": { "start": { "line": 27, "column": 10 }, "end": { "line": 27, "column": 31 }, "identifierName": "generateTransactionId" }, "name": "generateTransactionId" }, "init": { "type": "MemberExpression", "start": 1086, "end": 1145, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 27, "column": 93 } }, "object": { "type": "MemberExpression", "start": 1086, "end": 1123, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 27, "column": 71 } }, "object": { "type": "MemberExpression", "start": 1086, "end": 1108, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 27, "column": 56 } }, "object": { "type": "MemberExpression", "start": 1086, "end": 1100, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 27, "column": 48 } }, "object": { "type": "ThisExpression", "start": 1086, "end": 1090, "loc": { "start": { "line": 27, "column": 34 }, "end": { "line": 27, "column": 38 } } }, "property": { "type": "Identifier", "start": 1091, "end": 1100, "loc": { "start": { "line": 27, "column": 39 }, "end": { "line": 27, "column": 48 }, "identifierName": "sequelize" }, "name": "sequelize" }, "computed": false }, "property": { "type": "Identifier", "start": 1101, "end": 1108, "loc": { "start": { "line": 27, "column": 49 }, "end": { "line": 27, "column": 56 }, "identifierName": "dialect" }, "name": "dialect" }, "computed": false }, "property": { "type": "Identifier", "start": 1109, "end": 1123, "loc": { "start": { "line": 27, "column": 57 }, "end": { "line": 27, "column": 71 }, "identifierName": "QueryGenerator" }, "name": "QueryGenerator" }, "computed": false }, "property": { "type": "Identifier", "start": 1124, "end": 1145, "loc": { "start": { "line": 27, "column": 72 }, "end": { "line": 27, "column": 93 }, "identifierName": "generateTransactionId" }, "name": "generateTransactionId" }, "computed": false } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 1152, "end": 1365, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 33, "column": 22 } }, "expression": { "type": "AssignmentExpression", "start": 1152, "end": 1364, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 33, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 1152, "end": 1164, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 16 } }, "object": { "type": "ThisExpression", "start": 1152, "end": 1156, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 8 } } }, "property": { "type": "Identifier", "start": 1157, "end": 1164, "loc": { "start": { "line": 29, "column": 9 }, "end": { "line": 29, "column": 16 }, "identifierName": "options" }, "name": "options" }, "computed": false }, "right": { "type": "CallExpression", "start": 1167, "end": 1364, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 33, "column": 21 } }, "callee": { "type": "MemberExpression", "start": 1167, "end": 1181, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 33 } }, "object": { "type": "MemberExpression", "start": 1167, "end": 1174, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 26 } }, "object": { "type": "Identifier", "start": 1167, "end": 1172, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 24 }, "identifierName": "Utils" }, "name": "Utils" }, "property": { "type": "Identifier", "start": 1173, "end": 1174, "loc": { "start": { "line": 29, "column": 25 }, "end": { "line": 29, "column": 26 }, "identifierName": "_" }, "name": "_" }, "computed": false }, "property": { "type": "Identifier", "start": 1175, "end": 1181, "loc": { "start": { "line": 29, "column": 27 }, "end": { "line": 29, "column": 33 }, "identifierName": "extend" }, "name": "extend" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 1182, "end": 1348, "loc": { "start": { "line": 29, "column": 34 }, "end": { "line": 33, "column": 5 } }, "properties": [ { "type": "ObjectProperty", "start": 1190, "end": 1239, "loc": { "start": { "line": 30, "column": 6 }, "end": { "line": 30, "column": 55 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1190, "end": 1200, "loc": { "start": { "line": 30, "column": 6 }, "end": { "line": 30, "column": 16 }, "identifierName": "autocommit" }, "name": "autocommit" }, "value": { "type": "LogicalExpression", "start": 1202, "end": 1239, "loc": { "start": { "line": 30, "column": 18 }, "end": { "line": 30, "column": 55 } }, "left": { "type": "MemberExpression", "start": 1202, "end": 1231, "loc": { "start": { "line": 30, "column": 18 }, "end": { "line": 30, "column": 47 } }, "object": { "type": "Identifier", "start": 1202, "end": 1220, "loc": { "start": { "line": 30, "column": 18 }, "end": { "line": 30, "column": 36 }, "identifierName": "transactionOptions" }, "name": "transactionOptions" }, "property": { "type": "Identifier", "start": 1221, "end": 1231, "loc": { "start": { "line": 30, "column": 37 }, "end": { "line": 30, "column": 47 }, "identifierName": "autocommit" }, "name": "autocommit" }, "computed": false }, "operator": "||", "right": { "type": "NullLiteral", "start": 1235, "end": 1239, "loc": { "start": { "line": 30, "column": 51 }, "end": { "line": 30, "column": 55 } } } } }, { "type": "ObjectProperty", "start": 1247, "end": 1286, "loc": { "start": { "line": 31, "column": 6 }, "end": { "line": 31, "column": 45 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 1247, "end": 1251, "loc": { "start": { "line": 31, "column": 6 }, "end": { "line": 31, "column": 10 }, "identifierName": "type" }, "name": "type" }, "value": { "type": "MemberExpression", "start": 1253, "end": 1286, "loc": { "start": { "line": 31, "column": 12 }, "end": { "line": 31, "column": 45 } }, "object": { "type": "MemberExpression", "start": 1253, "end": 1270, "loc": { "start": { "line": 31, "column": 12 }, "end": { "line": 31, "column": 29 } }, "object": { "type": "Identifier", "start": 1253, "end": 1262, "loc": { "start": { "line": 31, "column": 12 }, "end": { "line": 31, "column": 21 }, "identifierName": "sequelize" }, "name": "sequelize" }, "property": { "type": "Identifier", "start": 1263, "end": 1270, "loc": { "start": { "line": 31, "column": 22 }, "end": { "line": 31, "column": 29 }, "identifierName": "options" }, "name": "options" }, "computed": false }, "property": { "type": "Identifier", "start": 1271, "end": 1286, "loc": { "start": { "line": 31,