sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,600 lines (1,599 loc) • 1.25 MB
JSON
{
"type": "File",
"start": 0,
"end": 10053,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 363,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 10053,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 363,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ClassDeclaration",
"start": 427,
"end": 628,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 17,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 433,
"end": 442,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 15
},
"identifierName": "BaseError"
},
"name": "BaseError",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 451,
"end": 456,
"loc": {
"start": {
"line": 10,
"column": 24
},
"end": {
"line": 10,
"column": 29
},
"identifierName": "Error"
},
"name": "Error"
},
"body": {
"type": "ClassBody",
"start": 457,
"end": 628,
"loc": {
"start": {
"line": 10,
"column": 30
},
"end": {
"line": 17,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 461,
"end": 626,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 16,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 461,
"end": 472,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 473,
"end": 480,
"loc": {
"start": {
"line": 11,
"column": 14
},
"end": {
"line": 11,
"column": 21
},
"identifierName": "message"
},
"name": "message"
}
],
"body": {
"type": "BlockStatement",
"start": 482,
"end": 626,
"loc": {
"start": {
"line": 11,
"column": 23
},
"end": {
"line": 16,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 488,
"end": 503,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 19
}
},
"expression": {
"type": "CallExpression",
"start": 488,
"end": 502,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 18
}
},
"callee": {
"type": "Super",
"start": 488,
"end": 493,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 494,
"end": 501,
"loc": {
"start": {
"line": 12,
"column": 10
},
"end": {
"line": 12,
"column": 17
},
"identifierName": "message"
},
"name": "message"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 508,
"end": 541,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 37
}
},
"expression": {
"type": "AssignmentExpression",
"start": 508,
"end": 540,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 36
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 508,
"end": 517,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 13
}
},
"object": {
"type": "ThisExpression",
"start": 508,
"end": 512,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 513,
"end": 517,
"loc": {
"start": {
"line": 13,
"column": 9
},
"end": {
"line": 13,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
"right": {
"type": "StringLiteral",
"start": 520,
"end": 540,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 36
}
},
"extra": {
"rawValue": "SequelizeBaseError",
"raw": "'SequelizeBaseError'"
},
"value": "SequelizeBaseError"
}
}
},
{
"type": "ExpressionStatement",
"start": 546,
"end": 569,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 27
}
},
"expression": {
"type": "AssignmentExpression",
"start": 546,
"end": 568,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 26
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 546,
"end": 558,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 546,
"end": 550,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 551,
"end": 558,
"loc": {
"start": {
"line": 14,
"column": 9
},
"end": {
"line": 14,
"column": 16
},
"identifierName": "message"
},
"name": "message"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 561,
"end": 568,
"loc": {
"start": {
"line": 14,
"column": 19
},
"end": {
"line": 14,
"column": 26
},
"identifierName": "message"
},
"name": "message"
}
}
},
{
"type": "ExpressionStatement",
"start": 574,
"end": 622,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 52
}
},
"expression": {
"type": "CallExpression",
"start": 574,
"end": 621,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 51
}
},
"callee": {
"type": "MemberExpression",
"start": 574,
"end": 597,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 574,
"end": 579,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 9
},
"identifierName": "Error"
},
"name": "Error"
},
"property": {
"type": "Identifier",
"start": 580,
"end": 597,
"loc": {
"start": {
"line": 15,
"column": 10
},
"end": {
"line": 15,
"column": 27
},
"identifierName": "captureStackTrace"
},
"name": "captureStackTrace"
},
"computed": false
},
"arguments": [
{
"type": "ThisExpression",
"start": 598,
"end": 602,
"loc": {
"start": {
"line": 15,
"column": 28
},
"end": {
"line": 15,
"column": 32
}
}
},
{
"type": "MemberExpression",
"start": 604,
"end": 620,
"loc": {
"start": {
"line": 15,
"column": 34
},
"end": {
"line": 15,
"column": 50
}
},
"object": {
"type": "ThisExpression",
"start": 604,
"end": 608,
"loc": {
"start": {
"line": 15,
"column": 34
},
"end": {
"line": 15,
"column": 38
}
}
},
"property": {
"type": "Identifier",
"start": 609,
"end": 620,
"loc": {
"start": {
"line": 15,
"column": 39
},
"end": {
"line": 15,
"column": 50
},
"identifierName": "constructor"
},
"name": "constructor"
},
"computed": false
}
]
}
}
],
"directives": []
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Sequelize provides a host of custom error classes, to allow you to do easier debugging. All of these errors are exposed on the sequelize object and the sequelize constructor.\n * All sequelize errors inherit from the base JS error object.\n *\n * This means that errors can be accessed using `Sequelize.ValidationError` or `sequelize.ValidationError`\n * The Base Error all Sequelize Errors inherit from.\n ",
"start": 15,
"end": 426,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 9,
"column": 3
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 629,
"end": 659,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 18,
"column": 30
}
},
"expression": {
"type": "AssignmentExpression",
"start": 629,
"end": 658,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 18,
"column": 29
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 629,
"end": 646,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 18,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 629,
"end": 636,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 18,
"column": 7
},
"identifierName": "exports"
},
"name": "exports"
},
"property": {
"type": "Identifier",
"start": 637,
"end": 646,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 17
},
"identifierName": "BaseError"
},
"name": "BaseError"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 649,
"end": 658,
"loc": {
"start": {
"line": 18,
"column": 20
},
"end": {
"line": 18,
"column": 29
},
"identifierName": "BaseError"
},
"name": "BaseError"
}
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Scope Error. Thrown when the sequelize cannot query the specified scope.\n ",
"start": 661,
"end": 744,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 22,
"column": 3
}
}
}
]
},
{
"type": "ClassDeclaration",
"start": 745,
"end": 878,
"loc": {
"start": {
"line": 23,
"column": 0
},
"end": {
"line": 28,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 751,
"end": 770,
"loc": {
"start": {
"line": 23,
"column": 6
},
"end": {
"line": 23,
"column": 25
},
"identifierName": "SequelizeScopeError"
},
"name": "SequelizeScopeError",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 779,
"end": 788,
"loc": {
"start": {
"line": 23,
"column": 34
},
"end": {
"line": 23,
"column": 43
},
"identifierName": "BaseError"
},
"name": "BaseError"
},
"body": {
"type": "ClassBody",
"start": 789,
"end": 878,
"loc": {
"start": {
"line": 23,
"column": 44
},
"end": {
"line": 28,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 793,
"end": 876,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 27,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 793,
"end": 804,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 24,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 805,
"end": 811,
"loc": {
"start": {
"line": 24,
"column": 14
},
"end": {
"line": 24,
"column": 20
},
"identifierName": "parent"
},
"name": "parent"
}
],
"body": {
"type": "BlockStatement",
"start": 813,
"end": 876,
"loc": {
"start": {
"line": 24,
"column": 22
},
"end": {
"line": 27,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 819,
"end": 833,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 18
}
},
"expression": {
"type": "CallExpression",
"start": 819,
"end": 832,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 17
}
},
"callee": {
"type": "Super",
"start": 819,
"end": 824,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 825,
"end": 831,
"loc": {
"start": {
"line": 25,
"column": 10
},
"end": {
"line": 25,
"column": 16
},
"identifierName": "parent"
},
"name": "parent"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 838,
"end": 872,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 38
}
},
"expression": {
"type": "AssignmentExpression",
"start": 838,
"end": 871,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 37
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 838,
"end": 847,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 13
}
},
"object": {
"type": "ThisExpression",
"start": 838,
"end": 842,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 843,
"end": 847,
"loc": {
"start": {
"line": 26,
"column": 9
},
"end": {
"line": 26,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
"right": {
"type": "StringLiteral",
"start": 850,
"end": 871,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 37
}
},
"extra": {
"rawValue": "SequelizeScopeError",
"raw": "'SequelizeScopeError'"
},
"value": "SequelizeScopeError"
}
}
}
],
"directives": []
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Scope Error. Thrown when the sequelize cannot query the specified scope.\n ",
"start": 661,
"end": 744,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 22,
"column": 3
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 879,
"end": 929,
"loc": {
"start": {
"line": 29,
"column": 0
},
"end": {
"line": 29,
"column": 50
}
},
"expression": {
"type": "AssignmentExpression",
"start": 879,
"end": 928,
"loc": {
"start": {
"line": 29,
"column": 0
},
"end": {
"line": 29,
"column": 49
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 879,
"end": 906,
"loc": {
"start": {
"line": 29,
"column": 0
},
"end": {
"line": 29,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 879,
"end": 886,
"loc": {
"start": {
"line": 29,
"column": 0
},
"end": {
"line": 29,
"column": 7
},
"identifierName": "exports"
},
"name": "exports"
},
"property": {
"type": "Identifier",
"start": 887,
"end": 906,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 27
},
"identifierName": "SequelizeScopeError"
},
"name": "SequelizeScopeError"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 909,
"end": 928,
"loc": {
"start": {
"line": 29,
"column": 30
},
"end": {
"line": 29,
"column": 49
},
"identifierName": "SequelizeScopeError"
},
"name": "SequelizeScopeError"
}
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Validation Error. Thrown when the sequelize validation has failed. The error contains an `errors` property,\n * which is an array with 1 or more ValidationErrorItems, one for each validation that failed.\n *\n * @param {string} message Error message\n * @param {Array} [errors] Array of ValidationErrorItem objects describing the validation errors\n *\n * @property errors An array of ValidationErrorItems\n ",
"start": 931,
"end": 1341,
"loc": {
"start": {
"line": 31,
"column": 0
},
"end": {
"line": 39,
"column": 3
}
}
}
]
},
{
"type": "ClassDeclaration",
"start": 1342,
"end": 2366,
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 75,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 1348,
"end": 1363,
"loc": {
"start": {
"line": 40,
"column": 6
},
"end": {
"line": 40,
"column": 21
},
"identifierName": "ValidationError"
},
"name": "ValidationError",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 1372,
"end": 1381,
"loc": {
"start": {
"line": 40,
"column": 30
},
"end": {
"line": 40,
"column": 39
},
"identifierName": "BaseError"
},
"name": "BaseError"
},
"body": {
"type": "ClassBody",
"start": 1382,
"end": 2366,
"loc": {
"start": {
"line": 40,
"column": 40
},
"end": {
"line": 75,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 1386,
"end": 1954,
"loc": {
"start": {
"line": 41,
"column": 2
},
"end": {
"line": 59,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 1386,
"end": 1397,
"loc": {
"start": {
"line": 41,
"column": 2
},
"end": {
"line": 41,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1398,
"end": 1405,
"loc": {
"start": {
"line": 41,
"column": 14
},
"end": {
"line": 41,
"column": 21
},
"identifierName": "message"
},
"name": "message"
},
{
"type": "Identifier",
"start": 1407,
"end": 1413,
"loc": {
"start": {
"line": 41,
"column": 23
},
"end": {
"line": 41,
"column": 29
},
"identifierName": "errors"
},
"name": "errors"
}
],
"body": {
"type": "BlockStatement",
"start": 1415,
"end": 1954,
"loc": {
"start": {
"line": 41,
"column": 31
},
"end": {
"line": 59,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 1421,
"end": 1436,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 19
}
},
"expression": {
"type": "CallExpression",
"start": 1421,
"end": 1435,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 18
}
},
"callee": {
"type": "Super",
"start": 1421,
"end": 1426,
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 9
}
}
},
"arguments": [
{
"type": "Identifier",
"start": 1427,
"end": 1434,
"loc": {
"start": {
"line": 42,
"column": 10
},
"end": {
"line": 42,
"column": 17
},
"identifierName": "message"
},
"name": "message"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 1441,
"end": 1480,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 43
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1441,
"end": 1479,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 42
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1441,
"end": 1450,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 13
}
},
"object": {
"type": "ThisExpression",
"start": 1441,
"end": 1445,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 1446,
"end": 1450,
"loc": {
"start": {
"line": 43,
"column": 9
},
"end": {
"line": 43,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
"right": {
"type": "StringLiteral",
"start": 1453,
"end": 1479,
"loc": {
"start": {
"line": 43,
"column": 16
},
"end": {
"line": 43,
"column": 42
}
},
"extra": {
"rawValue": "SequelizeValidationError",
"raw": "'SequelizeValidationError'"
},
"value": "SequelizeValidationError"
}
}
},
{
"type": "ExpressionStatement",
"start": 1485,
"end": 1519,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 38
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1485,
"end": 1518,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 37
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1485,
"end": 1497,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 1485,
"end": 1489,
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 1490,
"end": 1497,
"loc": {
"start": {
"line": 44,
"column": 9
},
"end": {
"line": 44,
"column": 16
},
"identifierName": "message"
},
"name": "message"
},
"computed": false
},
"right": {
"type": "StringLiteral",
"start": 1500,
"end": 1518,
"loc": {
"start": {
"line": 44,
"column": 19
},
"end": {
"line": 44,
"column": 37
}
},
"extra": {
"rawValue": "Validation Error",
"raw": "'Validation Error'"
},
"value": "Validation Error"
}
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n *\n * @type {ValidationErrorItem[]}\n ",
"start": 1524,
"end": 1579,
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 48,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 1584,
"end": 1611,
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 49,
"column": 31
}
},
"expression": {