UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,485 lines (1,484 loc) 516 kB
{ "type": "File", "start": 0, "end": 2390, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 94, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2390, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 94, "column": 0 } }, "sourceType": "module", "body": [ { "type": "VariableDeclaration", "start": 15, "end": 43, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 28 } }, "declarations": [ { "type": "VariableDeclarator", "start": 21, "end": 42, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 27 } }, "id": { "type": "Identifier", "start": 21, "end": 22, "loc": { "start": { "line": 3, "column": 6 }, "end": { "line": 3, "column": 7 }, "identifierName": "_" }, "name": "_" }, "init": { "type": "CallExpression", "start": 25, "end": 42, "loc": { "start": { "line": 3, "column": 10 }, "end": { "line": 3, "column": 27 } }, "callee": { "type": "Identifier", "start": 25, "end": 32, "loc": { "start": { "line": 3, "column": 10 }, "end": { "line": 3, "column": 17 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 33, "end": 41, "loc": { "start": { "line": 3, "column": 18 }, "end": { "line": 3, "column": 26 } }, "extra": { "rawValue": "lodash", "raw": "'lodash'" }, "value": "lodash" } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 44, "end": 96, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 52 } }, "declarations": [ { "type": "VariableDeclarator", "start": 50, "end": 95, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 51 } }, "id": { "type": "Identifier", "start": 50, "end": 59, "loc": { "start": { "line": 4, "column": 6 }, "end": { "line": 4, "column": 15 }, "identifierName": "validator" }, "name": "validator" }, "init": { "type": "CallExpression", "start": 62, "end": 95, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 51 } }, "callee": { "type": "MemberExpression", "start": 62, "end": 73, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 29 } }, "object": { "type": "Identifier", "start": 62, "end": 63, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 19 }, "identifierName": "_" }, "name": "_" }, "property": { "type": "Identifier", "start": 64, "end": 73, "loc": { "start": { "line": 4, "column": 20 }, "end": { "line": 4, "column": 29 }, "identifierName": "cloneDeep" }, "name": "cloneDeep" }, "computed": false }, "arguments": [ { "type": "CallExpression", "start": 74, "end": 94, "loc": { "start": { "line": 4, "column": 30 }, "end": { "line": 4, "column": 50 } }, "callee": { "type": "Identifier", "start": 74, "end": 81, "loc": { "start": { "line": 4, "column": 30 }, "end": { "line": 4, "column": 37 }, "identifierName": "require" }, "name": "require" }, "arguments": [ { "type": "StringLiteral", "start": 82, "end": 93, "loc": { "start": { "line": 4, "column": 38 }, "end": { "line": 4, "column": 49 } }, "extra": { "rawValue": "validator", "raw": "'validator'" }, "value": "validator" } ] } ] } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 98, "end": 1486, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 63, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 104, "end": 1485, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 63, "column": 1 } }, "id": { "type": "Identifier", "start": 104, "end": 114, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 16 }, "identifierName": "extensions" }, "name": "extensions" }, "init": { "type": "ObjectExpression", "start": 117, "end": 1485, "loc": { "start": { "line": 6, "column": 19 }, "end": { "line": 63, "column": 1 } }, "properties": [ { "type": "ObjectMethod", "start": 121, "end": 182, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 11, "column": 3 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 121, "end": 127, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 8 }, "identifierName": "extend" }, "name": "extend" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 128, "end": 132, "loc": { "start": { "line": 7, "column": 9 }, "end": { "line": 7, "column": 13 }, "identifierName": "name" }, "name": "name" }, { "type": "Identifier", "start": 134, "end": 136, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 17 }, "identifierName": "fn" }, "name": "fn" } ], "body": { "type": "BlockStatement", "start": 138, "end": 182, "loc": { "start": { "line": 7, "column": 19 }, "end": { "line": 11, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 144, "end": 160, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 20 } }, "expression": { "type": "AssignmentExpression", "start": 144, "end": 159, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 19 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 144, "end": 154, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 14 } }, "object": { "type": "ThisExpression", "start": 144, "end": 148, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 8 } } }, "property": { "type": "Identifier", "start": 149, "end": 153, "loc": { "start": { "line": 8, "column": 9 }, "end": { "line": 8, "column": 13 }, "identifierName": "name" }, "name": "name" }, "computed": true }, "right": { "type": "Identifier", "start": 157, "end": 159, "loc": { "start": { "line": 8, "column": 17 }, "end": { "line": 8, "column": 19 }, "identifierName": "fn" }, "name": "fn" } } }, { "type": "ReturnStatement", "start": 166, "end": 178, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 16 } }, "argument": { "type": "ThisExpression", "start": 173, "end": 177, "loc": { "start": { "line": 10, "column": 11 }, "end": { "line": 10, "column": 15 } } } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 186, "end": 245, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 14, "column": 3 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 186, "end": 194, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 10 }, "identifierName": "notEmpty" }, "name": "notEmpty" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 195, "end": 198, "loc": { "start": { "line": 12, "column": 11 }, "end": { "line": 12, "column": 14 }, "identifierName": "str" }, "name": "str" } ], "body": { "type": "BlockStatement", "start": 200, "end": 245, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 14, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 206, "end": 241, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 39 } }, "argument": { "type": "UnaryExpression", "start": 213, "end": 240, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 38 } }, "operator": "!", "prefix": true, "argument": { "type": "CallExpression", "start": 214, "end": 240, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 38 } }, "callee": { "type": "MemberExpression", "start": 214, "end": 223, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 21 } }, "object": { "type": "Identifier", "start": 214, "end": 217, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 15 }, "identifierName": "str" }, "name": "str" }, "property": { "type": "Identifier", "start": 218, "end": 223, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 21 }, "identifierName": "match" }, "name": "match" }, "computed": false }, "arguments": [ { "type": "RegExpLiteral", "start": 224, "end": 239, "loc": { "start": { "line": 13, "column": 22 }, "end": { "line": 13, "column": 37 } }, "extra": { "raw": "/^[\\s\\t\\r\\n]*$/" }, "pattern": "^[\\s\\t\\r\\n]*$", "flags": "" } ] }, "extra": { "parenthesizedArgument": false } } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 249, "end": 314, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 17, "column": 3 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 249, "end": 252, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 15, "column": 5 }, "identifierName": "len" }, "name": "len" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 253, "end": 256, "loc": { "start": { "line": 15, "column": 6 }, "end": { "line": 15, "column": 9 }, "identifierName": "str" }, "name": "str" }, { "type": "Identifier", "start": 258, "end": 261, "loc": { "start": { "line": 15, "column": 11 }, "end": { "line": 15, "column": 14 }, "identifierName": "min" }, "name": "min" }, { "type": "Identifier", "start": 263, "end": 266, "loc": { "start": { "line": 15, "column": 16 }, "end": { "line": 15, "column": 19 }, "identifierName": "max" }, "name": "max" } ], "body": { "type": "BlockStatement", "start": 268, "end": 314, "loc": { "start": { "line": 15, "column": 21 }, "end": { "line": 17, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 274, "end": 310, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 40 } }, "argument": { "type": "CallExpression", "start": 281, "end": 309, "loc": { "start": { "line": 16, "column": 11 }, "end": { "line": 16, "column": 39 } }, "callee": { "type": "MemberExpression", "start": 281, "end": 294, "loc": { "start": { "line": 16, "column": 11 }, "end": { "line": 16, "column": 24 } }, "object": { "type": "ThisExpression", "start": 281, "end": 285, "loc": { "start": { "line": 16, "column": 11 }, "end": { "line": 16, "column": 15 } } }, "property": { "type": "Identifier", "start": 286, "end": 294, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 24 }, "identifierName": "isLength" }, "name": "isLength" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 295, "end": 298, "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 28 }, "identifierName": "str" }, "name": "str" }, { "type": "Identifier", "start": 300, "end": 303, "loc": { "start": { "line": 16, "column": 30 }, "end": { "line": 16, "column": 33 }, "identifierName": "min" }, "name": "min" }, { "type": "Identifier", "start": 305, "end": 308, "loc": { "start": { "line": 16, "column": 35 }, "end": { "line": 16, "column": 38 }, "identifierName": "max" }, "name": "max" } ] } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 318, "end": 362, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 20, "column": 3 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 318, "end": 323, "loc": { "start": { "line": 18, "column": 2 }, "end": { "line": 18, "column": 7 }, "identifierName": "isUrl" }, "name": "isUrl" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 324, "end": 327, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 11 }, "identifierName": "str" }, "name": "str" } ], "body": { "type": "BlockStatement", "start": 329, "end": 362, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 335, "end": 358, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 27 } }, "argument": { "type": "CallExpression", "start": 342, "end": 357, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 26 } }, "callee": { "type": "MemberExpression", "start": 342, "end": 352, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 21 } }, "object": { "type": "ThisExpression", "start": 342, "end": 346, "loc": { "start": { "line": 19, "column": 11 }, "end": { "line": 19, "column": 15 } } }, "property": { "type": "Identifier", "start": 347, "end": 352, "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 21 }, "identifierName": "isURL" }, "name": "isURL" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 353, "end": 356, "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 25 }, "identifierName": "str" }, "name": "str" } ] } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 366, "end": 413, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 23, "column": 3 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 366, "end": 372, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 21, "column": 8 }, "identifierName": "isIPv6" }, "name": "isIPv6" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 373, "end": 376, "loc": { "start": { "line": 21, "column": 9 }, "end": { "line": 21, "column": 12 }, "identifierName": "str" }, "name": "str" } ], "body": { "type": "BlockStatement", "start": 378, "end": 413, "loc": { "start": { "line": 21, "column": 14 }, "end": { "line": 23, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 384, "end": 409, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 29 } }, "argument": { "type": "CallExpression", "start": 391, "end": 408, "loc": { "start": { "line": 22, "column": 11 }, "end": { "line": 22, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 391, "end": 400, "loc": { "start": { "line": 22, "column": 11 }, "end": { "line": 22, "column": 20 } }, "object": { "type": "ThisExpression", "start": 391, "end": 395, "loc": { "start": { "line": 22, "column": 11 }, "end": { "line": 22, "column": 15 } } }, "property": { "type": "Identifier", "start": 396, "end": 400, "loc": { "start": { "line": 22, "column": 16 }, "end": { "line": 22, "column": 20 }, "identifierName": "isIP" }, "name": "isIP" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 401, "end": 404, "loc": { "start": { "line": 22, "column": 21 }, "end": { "line": 22, "column": 24 }, "identifierName": "str" }, "name": "str" }, { "type": "NumericLiteral", "start": 406, "end": 407, "loc": { "start": { "line": 22, "column": 26 }, "end": { "line": 22, "column": 27 } }, "extra": { "rawValue": 6, "raw": "6" }, "value": 6 } ] } } ], "directives": [] } }, { "type": "ObjectMethod", "start": 417, "end": 464, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 26, "column": 3 } }, "method": true, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 417, "end": 423, "loc": { "start": { "line": 24, "column": 2 }, "end": { "line": 24, "column": 8 }, "identifierName": "isIPv4" }, "name": "isIPv4" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 424, "end": 427, "loc": { "start": { "line": 24, "column": 9 }, "end": { "line": 24, "column": 12 }, "identifierName": "str" }, "name": "str" } ], "body": { "type": "BlockStatement", "start": 429, "end": 464, "loc": { "start": { "line": 24, "column": 14 }, "end": { "line": 26, "column": 3 } }, "body": [ { "type": "ReturnStatement", "start": 435, "end": 460, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 25, "column": 29 } }, "argument": { "type": "CallExpression",