UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,249 lines (1,248 loc) 122 kB
{ "type": "File", "start": 0, "end": 431, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 25, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 431, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 25, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 40, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 25 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 39, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 24 } }, "id": { "type": "Identifier", "start": 21, "end": 27, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 12 }, "identifierName": "stores" }, "name": "stores" }, "init": { "type": "NewExpression", "start": 30, "end": 39, "loc": { "start": { "line": 3, "column": 15 }, "end": { "line": 3, "column": 24 } }, "callee": { "type": "Identifier", "start": 34, "end": 37, "loc": { "start": { "line": 3, "column": 19 }, "end": { "line": 3, "column": 22 }, "identifierName": "Map" }, "name": "Map" }, "arguments": [] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 42, "end": 430, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 24, "column": 2 } }, "expression": { "type": "AssignmentExpression", "start": 42, "end": 429, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 24, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 42, "end": 56, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 14 } }, "object": { "type": "Identifier", "start": 42, "end": 48, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 6 }, "identifierName": "module" }, "name": "module" }, "property": { "type": "Identifier", "start": 49, "end": 56, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 14 }, "identifierName": "exports" }, "name": "exports" }, "computed": false }, "right": { "type": "ArrowFunctionExpression", "start": 59, "end": 429, "loc": { "start": { "line": 5, "column": 17 }, "end": { "line": 24, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 59, "end": 66, "loc": { "start": { "line": 5, "column": 17 }, "end": { "line": 5, "column": 24 }, "identifierName": "dialect" }, "name": "dialect" } ], "body": { "type": "BlockStatement", "start": 70, "end": 429, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 24, "column": 1 } }, "body": [ { "type": "IfStatement", "start": 75, "end": 142, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 9, "column": 3 } }, "test": { "type": "UnaryExpression", "start": 79, "end": 99, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 26 } }, "operator": "!", "prefix": true, "argument": { "type": "CallExpression", "start": 80, "end": 99, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 26 } }, "callee": { "type": "MemberExpression", "start": 80, "end": 90, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 17 } }, "object": { "type": "Identifier", "start": 80, "end": 86, "loc": { "start": { "line": 7, "column": 7 }, "end": { "line": 7, "column": 13 }, "identifierName": "stores" }, "name": "stores" }, "property": { "type": "Identifier", "start": 87, "end": 90, "loc": { "start": { "line": 7, "column": 14 }, "end": { "line": 7, "column": 17 }, "identifierName": "has" }, "name": "has" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 91, "end": 98, "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 7, "column": 25 }, "identifierName": "dialect" }, "name": "dialect" } ] }, "extra": { "parenthesizedArgument": false } }, "consequent": { "type": "BlockStatement", "start": 101, "end": 142, "loc": { "start": { "line": 7, "column": 28 }, "end": { "line": 9, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 107, "end": 138, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 35 } }, "expression": { "type": "CallExpression", "start": 107, "end": 137, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 107, "end": 117, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 14 } }, "object": { "type": "Identifier", "start": 107, "end": 113, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 10 }, "identifierName": "stores" }, "name": "stores" }, "property": { "type": "Identifier", "start": 114, "end": 117, "loc": { "start": { "line": 8, "column": 11 }, "end": { "line": 8, "column": 14 }, "identifierName": "set" }, "name": "set" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 118, "end": 125, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 8, "column": 22 }, "identifierName": "dialect" }, "name": "dialect" }, { "type": "NewExpression", "start": 127, "end": 136, "loc": { "start": { "line": 8, "column": 24 }, "end": { "line": 8, "column": 33 } }, "callee": { "type": "Identifier", "start": 131, "end": 134, "loc": { "start": { "line": 8, "column": 28 }, "end": { "line": 8, "column": 31 }, "identifierName": "Map" }, "name": "Map" }, "arguments": [] } ] } } ], "directives": [] }, "alternate": null }, { "type": "ReturnStatement", "start": 146, "end": 427, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 23, "column": 4 } }, "argument": { "type": "ObjectExpression", "start": 153, "end": 426, "loc": { "start": { "line": 11, "column": 9 }, "end": { "line": 23, "column": 3 } }, "properties": [ { "type": "ObjectMethod", "start": 159, "end": 209, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 14, "column": 5 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 159, "end": 164, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 9 }, "identifierName": "clear" }, "name": "clear" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 167, "end": 209, "loc": { "start": { "line": 12, "column": 12 }, "end": { "line": 14, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 175, "end": 203, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 34 } }, "expression": { "type": "CallExpression", "start": 175, "end": 202, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 33 } }, "callee": { "type": "MemberExpression", "start": 175, "end": 200, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 31 } }, "object": { "type": "CallExpression", "start": 175, "end": 194, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 25 } }, "callee": { "type": "MemberExpression", "start": 175, "end": 185, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 16 } }, "object": { "type": "Identifier", "start": 175, "end": 181, "loc": { "start": { "line": 13, "column": 6 }, "end": { "line": 13, "column": 12 }, "identifierName": "stores" }, "name": "stores" }, "property": { "type": "Identifier", "start": 182, "end": 185, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 16 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 186, "end": 193, "loc": { "start": { "line": 13, "column": 17 }, "end": { "line": 13, "column": 24 }, "identifierName": "dialect" }, "name": "dialect" } ] }, "property": { "type": "Identifier", "start": 195, "end": 200, "loc": { "start": { "line": 13, "column": 26 }, "end": { "line": 13, "column": 31 }, "identifierName": "clear" }, "name": "clear" }, "computed": false }, "arguments": [] } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 215, "end": 355, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 19, "column": 5 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 215, "end": 222, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 11 }, "identifierName": "refresh" }, "name": "refresh" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 223, "end": 231, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 20 }, "identifierName": "dataType" }, "name": "dataType" } ], "body": { "type": "BlockStatement", "start": 233, "end": 355, "loc": { "start": { "line": 15, "column": 22 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ForOfStatement", "start": 241, "end": 349, "loc": { "start": { "line": 16, "column": 6 }, "end": { "line": 18, "column": 7 } }, "left": { "type": "VariableDeclaration", "start": 246, "end": 256, "loc": { "start": { "line": 16, "column": 11 }, "end": { "line": 16, "column": 21 } }, "declarations": [ { "type": "VariableDeclarator", "start": 252, "end": 256, "loc": { "start": { "line": 16, "column": 17 }, "end": { "line": 16, "column": 21 } }, "id": { "type": "Identifier", "start": 252, "end": 256, "loc": { "start": { "line": 16, "column": 17 }, "end": { "line": 16, "column": 21 }, "identifierName": "type" }, "name": "type" }, "init": null } ], "kind": "const" }, "right": { "type": "MemberExpression", "start": 260, "end": 283, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 48 } }, "object": { "type": "MemberExpression", "start": 260, "end": 274, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 39 } }, "object": { "type": "Identifier", "start": 260, "end": 268, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 33 }, "identifierName": "dataType" }, "name": "dataType" }, "property": { "type": "Identifier", "start": 269, "end": 274, "loc": { "start": { "line": 16, "column": 34 }, "end": { "line": 16, "column": 39 }, "identifierName": "types" }, "name": "types" }, "computed": false }, "property": { "type": "Identifier", "start": 275, "end": 282, "loc": { "start": { "line": 16, "column": 40 }, "end": { "line": 16, "column": 47 }, "identifierName": "dialect" }, "name": "dialect" }, "computed": true }, "body": { "type": "BlockStatement", "start": 285, "end": 349, "loc": { "start": { "line": 16, "column": 50 }, "end": { "line": 18, "column": 7 } }, "body": [ { "type": "ExpressionStatement", "start": 295, "end": 341, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 54 } }, "expression": { "type": "CallExpression", "start": 295, "end": 340, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 53 } }, "callee": { "type": "MemberExpression", "start": 295, "end": 318, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 31 } }, "object": { "type": "CallExpression", "start": 295, "end": 314, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 27 } }, "callee": { "type": "MemberExpression", "start": 295, "end": 305, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 18 } }, "object": { "type": "Identifier", "start": 295, "end": 301, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 14 }, "identifierName": "stores" }, "name": "stores" }, "property": { "type": "Identifier", "start": 302, "end": 305, "loc": { "start": { "line": 17, "column": 15 }, "end": { "line": 17, "column": 18 }, "identifierName": "get" }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 306, "end": 313, "loc": { "start": { "line": 17, "column": 19 }, "end": { "line": 17, "column": 26 }, "identifierName": "dialect" }, "name": "dialect" } ] }, "property": { "type": "Identifier", "start": 315, "end": 318, "loc": { "start": { "line": 17, "column": 28 }, "end": { "line": 17, "column": 31 }, "identifierName": "set" }, "name": "set" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 319, "end": 323, "loc": { "start": { "line": 17, "column": 32 }, "end": { "line": 17, "column": 36 }, "identifierName": "type" }, "name": "type" }, { "type": "MemberExpression", "start": 325, "end": 339, "loc": { "start": { "line": 17, "column": 38 }, "end": { "line": 17, "column": 52 } }, "object": { "type": "Identifier", "start": 325, "end": 333, "loc": { "start": { "line": 17, "column": 38 }, "end": { "line": 17, "column": 46 }, "identifierName": "dataType" }, "name": "dataType" }, "property": { "type": "Identifier", "start": 334, "end": 339, "loc": { "start": { "line": 17, "column": 47 }, "end": { "line": 17, "column": 52 }, "identifierName": "parse" }, "name": "parse" }, "computed": false } ] } } ], "directives": [] } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 361, "end": 422, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 22, "column": 5 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 361, "end": 364, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 7 }, "identifierName": "get" }, "name": "get" }, "kind": "method", "id": null, "generator": false, "expression": false,