UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,788 lines 99.2 kB
{ "type": "File", "start": 0, "end": 462, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 26, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 462, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 26, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 54, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 39 } }, "declarations": [ { "type": "VariableDeclarator", "start": 19, "end": 53, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 38 } }, "id": { "type": "Identifier", "start": 19, "end": 26, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 11 }, "identifierName": "Promise" }, "name": "Promise" }, "init": { "type": "CallExpression", "start": 29, "end": 53, "loc": { "start": { "line": 3, "column": 14 }, "end": { "line": 3, "column": 38 } }, "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": 52, "loc": { "start": { "line": 3, "column": 22 }, "end": { "line": 3, "column": 37 } }, "extra": { "rawValue": "../../promise", "raw": "'../../promise'" }, "value": "../../promise" } ] } } ], "kind": "var" }, { "type": "FunctionDeclaration", "start": 56, "end": 164, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 8, "column": 1 } }, "id": { "type": "Identifier", "start": 65, "end": 77, "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 21 }, "identifierName": "ResourceLock" }, "name": "ResourceLock" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 78, "end": 86, "loc": { "start": { "line": 5, "column": 22 }, "end": { "line": 5, "column": 30 }, "identifierName": "resource" }, "name": "resource" } ], "body": { "type": "BlockStatement", "start": 88, "end": 164, "loc": { "start": { "line": 5, "column": 32 }, "end": { "line": 8, "column": 1 } }, "body": [ { "type": "ExpressionStatement", "start": 92, "end": 117, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 92, "end": 116, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 92, "end": 105, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 15 } }, "object": { "type": "ThisExpression", "start": 92, "end": 96, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 6 } } }, "property": { "type": "Identifier", "start": 97, "end": 105, "loc": { "start": { "line": 6, "column": 7 }, "end": { "line": 6, "column": 15 }, "identifierName": "resource" }, "name": "resource" }, "computed": false }, "right": { "type": "Identifier", "start": 108, "end": 116, "loc": { "start": { "line": 6, "column": 18 }, "end": { "line": 6, "column": 26 }, "identifierName": "resource" }, "name": "resource" } } }, { "type": "ExpressionStatement", "start": 120, "end": 162, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 44 } }, "expression": { "type": "AssignmentExpression", "start": 120, "end": 161, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 43 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 120, "end": 133, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 15 } }, "object": { "type": "ThisExpression", "start": 120, "end": 124, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 6 } } }, "property": { "type": "Identifier", "start": 125, "end": 133, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 15 }, "identifierName": "previous" }, "name": "previous" }, "computed": false }, "right": { "type": "CallExpression", "start": 136, "end": 161, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 43 } }, "callee": { "type": "MemberExpression", "start": 136, "end": 151, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 33 } }, "object": { "type": "Identifier", "start": 136, "end": 143, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 25 }, "identifierName": "Promise" }, "name": "Promise" }, "property": { "type": "Identifier", "start": 144, "end": 151, "loc": { "start": { "line": 7, "column": 26 }, "end": { "line": 7, "column": 33 }, "identifierName": "resolve" }, "name": "resolve" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 152, "end": 160, "loc": { "start": { "line": 7, "column": 34 }, "end": { "line": 7, "column": 42 }, "identifierName": "resource" }, "name": "resource" } ] } } } ], "directives": [] } }, { "type": "ExpressionStatement", "start": 166, "end": 237, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 12, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 166, "end": 236, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 12, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 166, "end": 195, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 29 } }, "object": { "type": "MemberExpression", "start": 166, "end": 188, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 22 } }, "object": { "type": "Identifier", "start": 166, "end": 178, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 10, "column": 12 }, "identifierName": "ResourceLock" }, "name": "ResourceLock" }, "property": { "type": "Identifier", "start": 179, "end": 188, "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 22 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 189, "end": 195, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 29 }, "identifierName": "unwrap" }, "name": "unwrap" }, "computed": false }, "right": { "type": "FunctionExpression", "start": 198, "end": 236, "loc": { "start": { "line": 10, "column": 32 }, "end": { "line": 12, "column": 1 } }, "id": { "type": "Identifier", "start": 189, "end": 195, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 29 }, "identifierName": "unwrap" }, "name": "unwrap" }, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 209, "end": 236, "loc": { "start": { "line": 10, "column": 43 }, "end": { "line": 12, "column": 1 } }, "body": [ { "type": "ReturnStatement", "start": 213, "end": 234, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 23 } }, "argument": { "type": "MemberExpression", "start": 220, "end": 233, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 22 } }, "object": { "type": "ThisExpression", "start": 220, "end": 224, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 11, "column": 13 } } }, "property": { "type": "Identifier", "start": 225, "end": 233, "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 22 }, "identifierName": "resource" }, "name": "resource" }, "computed": false } } ], "directives": [] } } } }, { "type": "ExpressionStatement", "start": 239, "end": 429, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 23, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 239, "end": 428, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 23, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 239, "end": 266, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 27 } }, "object": { "type": "MemberExpression", "start": 239, "end": 261, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 22 } }, "object": { "type": "Identifier", "start": 239, "end": 251, "loc": { "start": { "line": 14, "column": 0 }, "end": { "line": 14, "column": 12 }, "identifierName": "ResourceLock" }, "name": "ResourceLock" }, "property": { "type": "Identifier", "start": 252, "end": 261, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 22 }, "identifierName": "prototype" }, "name": "prototype" }, "computed": false }, "property": { "type": "Identifier", "start": 262, "end": 266, "loc": { "start": { "line": 14, "column": 23 }, "end": { "line": 14, "column": 27 }, "identifierName": "lock" }, "name": "lock" }, "computed": false }, "right": { "type": "FunctionExpression", "start": 269, "end": 428, "loc": { "start": { "line": 14, "column": 30 }, "end": { "line": 23, "column": 1 } }, "id": { "type": "Identifier", "start": 262, "end": 266, "loc": { "start": { "line": 14, "column": 23 }, "end": { "line": 14, "column": 27 }, "identifierName": "lock" }, "name": "lock" }, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 280, "end": 428, "loc": { "start": { "line": 14, "column": 41 }, "end": { "line": 23, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 284, "end": 309, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 288, "end": 308, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 26 } }, "id": { "type": "Identifier", "start": 288, "end": 292, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 10 }, "identifierName": "lock" }, "name": "lock" }, "init": { "type": "MemberExpression", "start": 295, "end": 308, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 26 } }, "object": { "type": "ThisExpression", "start": 295, "end": 299, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 17 } } }, "property": { "type": "Identifier", "start": 300, "end": 308, "loc": { "start": { "line": 15, "column": 18 }, "end": { "line": 15, "column": 26 }, "identifierName": "previous" }, "name": "previous" }, "computed": false } } ], "kind": "var" }, { "type": "VariableDeclaration", "start": 312, "end": 324, "loc": { "start": { "line": 16, "column": 2 }, "end": { "line": 16, "column": 14 } }, "declarations": [ { "type": "VariableDeclarator", "start": 316, "end": 323, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 13 } }, "id": { "type": "Identifier", "start": 316, "end": 323, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 16, "column": 13 }, "identifierName": "resolve" }, "name": "resolve" }, "init": null } ], "kind": "var" }, { "type": "ExpressionStatement", "start": 328, "end": 392, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 5 } }, "expression": { "type": "AssignmentExpression", "start": 328, "end": 391, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 4 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 328, "end": 341, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 15 } }, "object": { "type": "ThisExpression", "start": 328, "end": 332, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 6 } } }, "property": { "type": "Identifier", "start": 333, "end": 341, "loc": { "start": { "line": 18, "column": 7 }, "end": { "line": 18, "column": 15 }, "identifierName": "previous" }, "name": "previous" }, "computed": false }, "right": { "type": "NewExpression", "start": 344, "end": 391, "loc": { "start": { "line": 18, "column": 18 }, "end": { "line": 20, "column": 4 } }, "callee": { "type": "Identifier", "start": 348, "end": 355, "loc": { "start": { "line": 18, "column": 22 }, "end": { "line": 18, "column": 29 }, "identifierName": "Promise" }, "name": "Promise" }, "arguments": [ { "type": "FunctionExpression", "start": 356, "end": 390, "loc": { "start": { "line": 18, "column": 30 }, "end": { "line": 20, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 365, "end": 366, "loc": { "start": { "line": 18, "column": 39 }, "end": { "line": 18, "column": 40 }, "identifierName": "r" }, "name": "r" } ], "body": { "type": "BlockStatement", "start": 368, "end": 390, "loc": { "start": { "line": 18, "column": 42 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 374, "end": 386, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 16 } }, "expression": { "type": "AssignmentExpression", "start": 374, "end": 385, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 15 } }, "operator": "=", "left": { "type": "Identifier", "start": 374, "end": 381, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 11 }, "identifierName": "resolve" }, "name": "resolve" }, "right": { "type": "Identifier", "start": 384, "end": 385, "loc": { "start": { "line": 19, "column": 14 }, "end": { "line": 19, "column": 15 }, "identifierName": "r" }, "name": "r" } } } ], "directives": [] } } ] } } }, { "type": "ReturnStatement", "start": 396, "end": 426, "loc": { "start": { "line": 22, "column": 2 }, "end": { "line": 22, "column": 32 } }, "argument": { "type": "CallExpression", "start": 403, "end": 425, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 22, "column": 31 } }, "callee": { "type": "MemberExpression", "start": 403, "end": 416, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 22, "column": 22 } }, "object": { "type": "Identifier", "start": 403, "end": 407, "loc": { "start": { "line": 22, "column": 9 }, "end": { "line": 22, "column": 13 }, "identifierName": "lock" }, "name": "lock" }, "property": { "type": "Identifier", "start": 408, "end": 416, "loc": { "start": { "line": 22, "column": 14 }, "end": { "line": 22, "column": 22 }, "identifierName": "disposer" }, "name": "disposer" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 417, "end": 424, "loc": { "start": { "line": 22, "column": 23 }, "end": { "line": 22, "column": 30 }, "identifierName": "resolve" }, "name": "resolve" } ] } } ], "directives": [] } } } }, { "type": "ExpressionStatement", "start": 431, "end": 461, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 30 } }, "expression": { "type": "AssignmentExpression", "start": 431, "end": 460, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 431, "end": 445, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 14 } }, "object": { "type": "Identifier", "start": 431, "end": 437, "loc": { "start": { "line": 25, "column": 0 }, "end": { "line": 25, "column": 6 }, "identifierName": "module" }, "name": "module" }, "property": { "type": "Identifier", "start": 438, "end": 445, "loc": { "start": { "line": 25, "column": 7 }, "end": { "line": 25, "column": 14 }, "identifierName": "exports" }, "name": "exports" }, "computed": false }, "right": { "type": "Identifier", "start": 448, "end": 460, "loc": { "start": { "line": 25, "column": 17 }, "end": { "line": 25, "column": 29 }, "identifierName": "ResourceLock" }, "name": "ResourceLock" } } } ], "directives": [ { "type": "Directive", "start": 0, "end": 13, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 13 } }, "value": { "type": "DirectiveLiteral", "start": 0, "end": 12, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 12 } }, "value": "use strict", "extra": { "raw": "'use strict'", "rawValue": "use strict" } } } ] }, "comments": [], "tokens": [ { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "use strict", "start": 0, "end": 12, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 12 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 12, "end": 13, "loc": { "start": { "line": 1, "column": 12 }, "end": { "line": 1, "column": 13 } } }, { "type": { "label": "var", "keyword": "var", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "var", "start": 15, "end": 18, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Promise", "start": 19, "end": 26, "loc": { "start": { "line": 3, "column": 4 }, "end": { "line": 3, "column": 11 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 27, "end": 28, "loc": { "start": { "line": 3, "column": 12 }, "end": { "line": 3, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "require", "start": 29, "end": 36, "loc": { "start": { "line": 3, "column": 14 }, "end": { "line": 3, "column": 21 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 36, "end": 37, "loc": { "start": { "line": 3, "column": 21 }, "end": { "line": 3, "column": 22 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "../../promise", "start": 37, "end": 52, "loc": { "start": { "line": 3, "column": 22 }, "end": { "line": 3, "column": 37 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 52, "end": 53, "loc": { "start": { "line": 3, "column": 37 }, "end": { "line": 3, "column": 38 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 53, "end": 54, "loc": { "start": { "line": 3, "column": 38 }, "end": { "line": 3, "column": 39 } } }, { "type": { "label": "function", "keyword": "function", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "function", "start": 56, "end": 64, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 8 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ResourceL