sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,702 lines • 6.55 MB
JSON
{
"type": "File",
"start": 0,
"end": 30926,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 924,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 30926,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 924,
"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"
},
{
"type": "VariableDeclaration",
"start": 49,
"end": 77,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 55,
"end": 76,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 55,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 7
},
"identifierName": "_"
},
"name": "_"
},
"init": {
"type": "CallExpression",
"start": 59,
"end": 76,
"loc": {
"start": {
"line": 4,
"column": 10
},
"end": {
"line": 4,
"column": 27
}
},
"callee": {
"type": "Identifier",
"start": 59,
"end": 66,
"loc": {
"start": {
"line": 4,
"column": 10
},
"end": {
"line": 4,
"column": 17
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 67,
"end": 75,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 26
}
},
"extra": {
"rawValue": "lodash",
"raw": "'lodash'"
},
"value": "lodash"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 78,
"end": 120,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 42
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 84,
"end": 119,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 41
}
},
"id": {
"type": "Identifier",
"start": 84,
"end": 93,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 15
},
"identifierName": "DataTypes"
},
"name": "DataTypes"
},
"init": {
"type": "CallExpression",
"start": 96,
"end": 119,
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 41
}
},
"callee": {
"type": "Identifier",
"start": 96,
"end": 103,
"loc": {
"start": {
"line": 5,
"column": 18
},
"end": {
"line": 5,
"column": 25
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 104,
"end": 118,
"loc": {
"start": {
"line": 5,
"column": 26
},
"end": {
"line": 5,
"column": 40
}
},
"extra": {
"rawValue": "./data-types",
"raw": "'./data-types'"
},
"value": "./data-types"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 121,
"end": 195,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 74
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 127,
"end": 194,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 73
}
},
"id": {
"type": "Identifier",
"start": 127,
"end": 147,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 26
},
"identifierName": "SQLiteQueryInterface"
},
"name": "SQLiteQueryInterface"
},
"init": {
"type": "CallExpression",
"start": 150,
"end": 194,
"loc": {
"start": {
"line": 6,
"column": 29
},
"end": {
"line": 6,
"column": 73
}
},
"callee": {
"type": "Identifier",
"start": 150,
"end": 157,
"loc": {
"start": {
"line": 6,
"column": 29
},
"end": {
"line": 6,
"column": 36
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 158,
"end": 193,
"loc": {
"start": {
"line": 6,
"column": 37
},
"end": {
"line": 6,
"column": 72
}
},
"extra": {
"rawValue": "./dialects/sqlite/query-interface",
"raw": "'./dialects/sqlite/query-interface'"
},
"value": "./dialects/sqlite/query-interface"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 196,
"end": 269,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 73
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 202,
"end": 268,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 72
}
},
"id": {
"type": "Identifier",
"start": 202,
"end": 222,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 26
},
"identifierName": "MSSSQLQueryInterface"
},
"name": "MSSSQLQueryInterface"
},
"init": {
"type": "CallExpression",
"start": 225,
"end": 268,
"loc": {
"start": {
"line": 7,
"column": 29
},
"end": {
"line": 7,
"column": 72
}
},
"callee": {
"type": "Identifier",
"start": 225,
"end": 232,
"loc": {
"start": {
"line": 7,
"column": 29
},
"end": {
"line": 7,
"column": 36
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 233,
"end": 267,
"loc": {
"start": {
"line": 7,
"column": 37
},
"end": {
"line": 7,
"column": 71
}
},
"extra": {
"rawValue": "./dialects/mssql/query-interface",
"raw": "'./dialects/mssql/query-interface'"
},
"value": "./dialects/mssql/query-interface"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 270,
"end": 342,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 72
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 276,
"end": 341,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 71
}
},
"id": {
"type": "Identifier",
"start": 276,
"end": 295,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 25
},
"identifierName": "MySQLQueryInterface"
},
"name": "MySQLQueryInterface"
},
"init": {
"type": "CallExpression",
"start": 298,
"end": 341,
"loc": {
"start": {
"line": 8,
"column": 28
},
"end": {
"line": 8,
"column": 71
}
},
"callee": {
"type": "Identifier",
"start": 298,
"end": 305,
"loc": {
"start": {
"line": 8,
"column": 28
},
"end": {
"line": 8,
"column": 35
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 306,
"end": 340,
"loc": {
"start": {
"line": 8,
"column": 36
},
"end": {
"line": 8,
"column": 70
}
},
"extra": {
"rawValue": "./dialects/mysql/query-interface",
"raw": "'./dialects/mysql/query-interface'"
},
"value": "./dialects/mysql/query-interface"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 343,
"end": 388,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 45
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 349,
"end": 387,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 44
}
},
"id": {
"type": "Identifier",
"start": 349,
"end": 360,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 17
},
"identifierName": "Transaction"
},
"name": "Transaction"
},
"init": {
"type": "CallExpression",
"start": 363,
"end": 387,
"loc": {
"start": {
"line": 9,
"column": 20
},
"end": {
"line": 9,
"column": 44
}
},
"callee": {
"type": "Identifier",
"start": 363,
"end": 370,
"loc": {
"start": {
"line": 9,
"column": 20
},
"end": {
"line": 9,
"column": 27
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 371,
"end": 386,
"loc": {
"start": {
"line": 9,
"column": 28
},
"end": {
"line": 9,
"column": 43
}
},
"extra": {
"rawValue": "./transaction",
"raw": "'./transaction'"
},
"value": "./transaction"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 389,
"end": 426,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 395,
"end": 425,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 395,
"end": 402,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 13
},
"identifierName": "Promise"
},
"name": "Promise"
},
"init": {
"type": "CallExpression",
"start": 405,
"end": 425,
"loc": {
"start": {
"line": 10,
"column": 16
},
"end": {
"line": 10,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 405,
"end": 412,
"loc": {
"start": {
"line": 10,
"column": 16
},
"end": {
"line": 10,
"column": 23
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 413,
"end": 424,
"loc": {
"start": {
"line": 10,
"column": 24
},
"end": {
"line": 10,
"column": 35
}
},
"extra": {
"rawValue": "./promise",
"raw": "'./promise'"
},
"value": "./promise"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 427,
"end": 471,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 11,
"column": 44
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 433,
"end": 470,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 43
}
},
"id": {
"type": "Identifier",
"start": 433,
"end": 443,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 16
},
"identifierName": "QueryTypes"
},
"name": "QueryTypes"
},
"init": {
"type": "CallExpression",
"start": 446,
"end": 470,
"loc": {
"start": {
"line": 11,
"column": 19
},
"end": {
"line": 11,
"column": 43
}
},
"callee": {
"type": "Identifier",
"start": 446,
"end": 453,
"loc": {
"start": {
"line": 11,
"column": 19
},
"end": {
"line": 11,
"column": 26
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 454,
"end": 469,
"loc": {
"start": {
"line": 11,
"column": 27
},
"end": {
"line": 11,
"column": 42
}
},
"extra": {
"rawValue": "./query-types",
"raw": "'./query-types'"
},
"value": "./query-types"
}
]
}
}
],
"kind": "const",
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * The interface that Sequelize uses to talk to all databases\n * @class QueryInterface\n * @private\n ",
"start": 473,
"end": 579,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 17,
"column": 3
}
}
}
]
},
{
"type": "ClassDeclaration",
"start": 580,
"end": 30802,
"loc": {
"start": {
"line": 18,
"column": 0
},
"end": {
"line": 919,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 586,
"end": 600,
"loc": {
"start": {
"line": 18,
"column": 6
},
"end": {
"line": 18,
"column": 20
},
"identifierName": "QueryInterface"
},
"name": "QueryInterface",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 601,
"end": 30802,
"loc": {
"start": {
"line": 18,
"column": 21
},
"end": {
"line": 919,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 605,
"end": 730,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 22,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 605,
"end": 616,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 19,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor"
},
"static": false,
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 617,
"end": 626,
"loc": {
"start": {
"line": 19,
"column": 14
},
"end": {
"line": 19,
"column": 23
},
"identifierName": "sequelize"
},
"name": "sequelize"
}
],
"body": {
"type": "BlockStatement",
"start": 628,
"end": 730,
"loc": {
"start": {
"line": 19,
"column": 25
},
"end": {
"line": 22,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 634,
"end": 661,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 31
}
},
"expression": {
"type": "AssignmentExpression",
"start": 634,
"end": 660,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 30
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 634,
"end": 648,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 634,
"end": 638,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 639,
"end": 648,
"loc": {
"start": {
"line": 20,
"column": 9
},
"end": {
"line": 20,
"column": 18
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 651,
"end": 660,
"loc": {
"start": {
"line": 20,
"column": 21
},
"end": {
"line": 20,
"column": 30
},
"identifierName": "sequelize"
},
"name": "sequelize"
}
}
},
{
"type": "ExpressionStatement",
"start": 666,
"end": 726,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 64
}
},
"expression": {
"type": "AssignmentExpression",
"start": 666,
"end": 725,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 63
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 666,
"end": 685,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 23
}
},
"object": {
"type": "ThisExpression",
"start": 666,
"end": 670,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 8
}
}
},
"property": {
"type": "Identifier",
"start": 671,
"end": 685,
"loc": {
"start": {
"line": 21,
"column": 9
},
"end": {
"line": 21,
"column": 23
},
"identifierName": "QueryGenerator"
},
"name": "QueryGenerator"
},
"computed": false
},
"right": {
"type": "MemberExpression",
"start": 688,
"end": 725,
"loc": {
"start": {
"line": 21,
"column": 26
},
"end": {
"line": 21,
"column": 63
}
},
"object": {
"type": "MemberExpression",
"start": 688,
"end": 710,
"loc": {
"start": {
"line": 21,
"column": 26
},
"end": {
"line": 21,
"column": 48
}
},
"object": {
"type": "MemberExpression",
"start": 688,
"end": 702,
"loc": {
"start": {
"line": 21,
"column": 26
},
"end": {
"line": 21,
"column": 40
}
},
"object": {
"type": "ThisExpression",
"start": 688,
"end": 692,
"loc": {
"start": {
"line": 21,
"column": 26
},
"end": {
"line": 21,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"start": 693,
"end": 702,
"loc": {
"start": {
"line": 21,
"column": 31
},
"end": {
"line": 21,
"column": 40
},
"identifierName": "sequelize"
},
"name": "sequelize"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 703,
"end": 710,
"loc": {
"start": {
"line": 21,
"column": 41
},
"end": {
"line": 21,
"column": 48
},
"identifierName": "dialect"
},
"name": "dialect"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 711,
"end": 725,
"loc": {
"start": {
"line": 21,
"column": 49
},
"end": {
"line": 21,
"column": 63
},
"identifierName": "QueryGenerator"
},
"name": "QueryGenerator"
},
"computed": false
}
}
}
],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 734,
"end": 903,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 28,
"column": 3
}
},
"computed": false,
"key": {
"type": "Identifier",
"start": 734,
"end": 746,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 24,
"column": 14
},
"identifierName": "createSchema"
},
"name": "createSchema"
},
"static": false,
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 747,
"end": 753,
"loc": {
"start": {
"line": 24,
"column": 15
},
"end": {
"line": 24,
"column": 21
},
"identifierName": "schema"
},
"name": "schema"
},
{
"type": "Identifier",
"start": 755,
"end": 762,
"loc": {
"start": {
"line": 24,
"column": 23
},
"end": {
"line": 24,
"column": 30
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 764,
"end": 903,
"loc": {
"start": {
"line": 24,
"column": 32
},
"end": {
"line": 28,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 770,
"end": 794,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 28
}
},
"expression": {
"type": "AssignmentExpression",
"start": 770,
"end": 793,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 27
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 770,
"end": 777,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 25,
"column": 11
},
"identifierName": "options"
},
"name": "options"
},
"right": {
"type": "LogicalExpression",
"start": 780,
"end": 793,
"loc": {
"start": {
"line": 25,
"column": 14
},
"end": {
"line": 25,
"column": 27
}
},
"left": {
"type": "Identifier",
"start": 780,
"end": 787,
"loc": {
"start": {
"line": 25,
"column": 14
},
"end": {
"line": 25,
"column": 21
},
"identifierName": "options"
},
"name": "options"
},
"operator": "||",
"right": {
"type": "ObjectExpression",
"start": 791,
"end": 793,
"loc": {
"start": {
"line": 25,
"column": 25
},
"end": {
"line": 25,
"column": 27
}
},
"properties": []
}
}
}
},
{
"type": "VariableDeclaration",
"start": 799,
"end": 852,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 57
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 805,
"end": 851,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 56
}
},
"id": {
"type": "Identifier",
"start": 805,
"end": 808,
"loc": {
"start": {
"line": 26,
"column": 10
},
"end": {
"line": 26,
"column": 13
},
"identifierName": "sql"
},
"name": "sql"
},
"init": {
"type": "CallExpression",
"start": 811,
"end": 851,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 56
}
},
"callee": {
"type": "MemberExpression",
"start": 811,
"end": 843,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 48
}
},
"object": {
"type": "MemberExpression",
"start": 811,
"end": 830,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 35
}
},
"object": {
"type": "ThisExpression",
"start": 811,
"end": 815,
"loc": {
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 20
}
}
},
"property": {
"type": "Identifier",
"start": 816,
"end": 830,
"loc": {
"start": {
"line": 26,
"column": 21
},
"end": {
"line": 26,
"column": 35
},
"identifierName": "QueryGenerator"
},
"name": "QueryGe