sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,760 lines (1,759 loc) • 17.5 MB
JSON
{
"type": "File",
"start": 0,
"end": 79556,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2276,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 79556,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2276,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "VariableDeclaration",
"start": 15,
"end": 52,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 21,
"end": 51,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 36
}
},
"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": 51,
"loc": {
"start": {
"line": 3,
"column": 14
},
"end": {
"line": 3,
"column": 36
}
},
"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": 50,
"loc": {
"start": {
"line": 3,
"column": 22
},
"end": {
"line": 3,
"column": 35
}
},
"extra": {
"rawValue": "../../utils",
"raw": "'../../utils'"
},
"value": "../../utils"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 53,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 46
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 59,
"end": 98,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 45
}
},
"id": {
"type": "Identifier",
"start": 59,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 15
},
"identifierName": "SqlString"
},
"name": "SqlString"
},
"init": {
"type": "CallExpression",
"start": 71,
"end": 98,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 45
}
},
"callee": {
"type": "Identifier",
"start": 71,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 25
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 79,
"end": 97,
"loc": {
"start": {
"line": 4,
"column": 26
},
"end": {
"line": 4,
"column": 44
}
},
"extra": {
"rawValue": "../../sql-string",
"raw": "'../../sql-string'"
},
"value": "../../sql-string"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 100,
"end": 137,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 106,
"end": 136,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 106,
"end": 111,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 11
},
"identifierName": "Model"
},
"name": "Model"
},
"init": {
"type": "CallExpression",
"start": 114,
"end": 136,
"loc": {
"start": {
"line": 5,
"column": 14
},
"end": {
"line": 5,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 114,
"end": 121,
"loc": {
"start": {
"line": 5,
"column": 14
},
"end": {
"line": 5,
"column": 21
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 122,
"end": 135,
"loc": {
"start": {
"line": 5,
"column": 22
},
"end": {
"line": 5,
"column": 35
}
},
"extra": {
"rawValue": "../../model",
"raw": "'../../model'"
},
"value": "../../model"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 138,
"end": 184,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 46
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 144,
"end": 183,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 45
}
},
"id": {
"type": "Identifier",
"start": 144,
"end": 153,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 15
},
"identifierName": "DataTypes"
},
"name": "DataTypes"
},
"init": {
"type": "CallExpression",
"start": 156,
"end": 183,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 45
}
},
"callee": {
"type": "Identifier",
"start": 156,
"end": 163,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 25
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 164,
"end": 182,
"loc": {
"start": {
"line": 6,
"column": 26
},
"end": {
"line": 6,
"column": 44
}
},
"extra": {
"rawValue": "../../data-types",
"raw": "'../../data-types'"
},
"value": "../../data-types"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 185,
"end": 214,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 29
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 191,
"end": 213,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 28
}
},
"id": {
"type": "Identifier",
"start": 191,
"end": 195,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 10
},
"identifierName": "util"
},
"name": "util"
},
"init": {
"type": "CallExpression",
"start": 198,
"end": 213,
"loc": {
"start": {
"line": 7,
"column": 13
},
"end": {
"line": 7,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 198,
"end": 205,
"loc": {
"start": {
"line": 7,
"column": 13
},
"end": {
"line": 7,
"column": 20
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 206,
"end": 212,
"loc": {
"start": {
"line": 7,
"column": 21
},
"end": {
"line": 7,
"column": 27
}
},
"extra": {
"rawValue": "util",
"raw": "'util'"
},
"value": "util"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 215,
"end": 243,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 221,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 221,
"end": 222,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 7
},
"identifierName": "_"
},
"name": "_"
},
"init": {
"type": "CallExpression",
"start": 225,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 10
},
"end": {
"line": 8,
"column": 27
}
},
"callee": {
"type": "Identifier",
"start": 225,
"end": 232,
"loc": {
"start": {
"line": 8,
"column": 10
},
"end": {
"line": 8,
"column": 17
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 233,
"end": 241,
"loc": {
"start": {
"line": 8,
"column": 18
},
"end": {
"line": 8,
"column": 26
}
},
"extra": {
"rawValue": "lodash",
"raw": "'lodash'"
},
"value": "lodash"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 244,
"end": 277,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 250,
"end": 276,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 250,
"end": 256,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 12
},
"identifierName": "Dottie"
},
"name": "Dottie"
},
"init": {
"type": "CallExpression",
"start": 259,
"end": 276,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 259,
"end": 266,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 22
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 267,
"end": 275,
"loc": {
"start": {
"line": 9,
"column": 23
},
"end": {
"line": 9,
"column": 31
}
},
"extra": {
"rawValue": "dottie",
"raw": "'dottie'"
},
"value": "dottie"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 278,
"end": 337,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 59
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 284,
"end": 336,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 58
}
},
"id": {
"type": "Identifier",
"start": 284,
"end": 293,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 15
},
"identifierName": "BelongsTo"
},
"name": "BelongsTo"
},
"init": {
"type": "CallExpression",
"start": 296,
"end": 336,
"loc": {
"start": {
"line": 10,
"column": 18
},
"end": {
"line": 10,
"column": 58
}
},
"callee": {
"type": "Identifier",
"start": 296,
"end": 303,
"loc": {
"start": {
"line": 10,
"column": 18
},
"end": {
"line": 10,
"column": 25
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 304,
"end": 335,
"loc": {
"start": {
"line": 10,
"column": 26
},
"end": {
"line": 10,
"column": 57
}
},
"extra": {
"rawValue": "../../associations/belongs-to",
"raw": "'../../associations/belongs-to'"
},
"value": "../../associations/belongs-to"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 338,
"end": 406,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 11,
"column": 68
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 344,
"end": 405,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 67
}
},
"id": {
"type": "Identifier",
"start": 344,
"end": 357,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 19
},
"identifierName": "BelongsToMany"
},
"name": "BelongsToMany"
},
"init": {
"type": "CallExpression",
"start": 360,
"end": 405,
"loc": {
"start": {
"line": 11,
"column": 22
},
"end": {
"line": 11,
"column": 67
}
},
"callee": {
"type": "Identifier",
"start": 360,
"end": 367,
"loc": {
"start": {
"line": 11,
"column": 22
},
"end": {
"line": 11,
"column": 29
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 368,
"end": 404,
"loc": {
"start": {
"line": 11,
"column": 30
},
"end": {
"line": 11,
"column": 66
}
},
"extra": {
"rawValue": "../../associations/belongs-to-many",
"raw": "'../../associations/belongs-to-many'"
},
"value": "../../associations/belongs-to-many"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 407,
"end": 462,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 12,
"column": 55
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 413,
"end": 461,
"loc": {
"start": {
"line": 12,
"column": 6
},
"end": {
"line": 12,
"column": 54
}
},
"id": {
"type": "Identifier",
"start": 413,
"end": 420,
"loc": {
"start": {
"line": 12,
"column": 6
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "HasMany"
},
"name": "HasMany"
},
"init": {
"type": "CallExpression",
"start": 423,
"end": 461,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 54
}
},
"callee": {
"type": "Identifier",
"start": 423,
"end": 430,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 23
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 431,
"end": 460,
"loc": {
"start": {
"line": 12,
"column": 24
},
"end": {
"line": 12,
"column": 53
}
},
"extra": {
"rawValue": "../../associations/has-many",
"raw": "'../../associations/has-many'"
},
"value": "../../associations/has-many"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 463,
"end": 492,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 13,
"column": 29
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 469,
"end": 491,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 28
}
},
"id": {
"type": "Identifier",
"start": 469,
"end": 473,
"loc": {
"start": {
"line": 13,
"column": 6
},
"end": {
"line": 13,
"column": 10
},
"identifierName": "uuid"
},
"name": "uuid"
},
"init": {
"type": "CallExpression",
"start": 476,
"end": 491,
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 476,
"end": 483,
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 20
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 484,
"end": 490,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 27
}
},
"extra": {
"rawValue": "uuid",
"raw": "'uuid'"
},
"value": "uuid"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 493,
"end": 526,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 14,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 499,
"end": 525,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 499,
"end": 505,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 12
},
"identifierName": "semver"
},
"name": "semver"
},
"init": {
"type": "CallExpression",
"start": 508,
"end": 525,
"loc": {
"start": {
"line": 14,
"column": 15
},
"end": {
"line": 14,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 508,
"end": 515,
"loc": {
"start": {
"line": 14,
"column": 15
},
"end": {
"line": 14,
"column": 22
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 516,
"end": 524,
"loc": {
"start": {
"line": 14,
"column": 23
},
"end": {
"line": 14,
"column": 31
}
},
"extra": {
"rawValue": "semver",
"raw": "'semver'"
},
"value": "semver"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 528,
"end": 79521,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 2273,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 534,
"end": 79520,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 2273,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 534,
"end": 548,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 16,
"column": 20
},
"identifierName": "QueryGenerator"
},
"name": "QueryGenerator"
},
"init": {
"type": "ObjectExpression",
"start": 551,
"end": 79520,
"loc": {
"start": {
"line": 16,
"column": 23
},
"end": {
"line": 2273,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 555,
"end": 566,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 555,
"end": 562,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 9
},
"identifierName": "options"
},
"name": "options"
},
"value": {
"type": "ObjectExpression",
"start": 564,
"end": 566,
"loc": {
"start": {
"line": 17,
"column": 11
},
"end": {
"line": 17,
"column": 13
}
},
"properties": []
}
},
{
"type": "ObjectMethod",
"start": 571,
"end": 904,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 27,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 571,
"end": 590,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 19,
"column": 21
},
"identifierName": "extractTableDetails"
},
"name": "extractTableDetails"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 591,
"end": 600,
"loc": {
"start": {
"line": 19,
"column": 22
},
"end": {
"line": 19,
"column": 31
},
"identifierName": "tableName"
},
"name": "tableName"
},
{
"type": "Identifier",
"start": 602,
"end": 609,
"loc": {
"start": {
"line": 19,
"column": 33
},
"end": {
"line": 19,
"column": 40
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 611,
"end": 904,
"loc": {
"start": {
"line": 19,
"column": 42
},
"end": {
"line": 27,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 617,
"end": 641,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 28
}
},
"expression": {
"type": "AssignmentExpression",
"start": 617,
"end": 640,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 27
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 617,
"end": 624,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 11
},
"identifierName": "options"
},
"name": "options"
},
"right": {
"type": "LogicalExpression",
"start": 627,
"end": 640,
"loc": {
"start": {
"line": 20,
"column": 14
},
"end": {
"line": 20,
"column": 27
}
},
"left": {
"type": "Identifier",
"start": 627,
"end": 634,
"loc": {
"start": {
"line": 20,
"column": 14
},
"end": {
"line": 20,
"column": 21
},
"identifierName": "options"
},
"name": "options"
},
"operator": "||",
"right": {
"type": "ObjectExpression",
"start": 638,
"end": 640,
"loc": {
"start": {
"line": 20,
"column": 25
},
"end": {
"line": 20,
"column": 27
}
},
"properties": []
}
}
}
},
{
"type": "ExpressionStatement",
"start": 646,
"end": 674,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 32
}
},
"expression": {
"type": "AssignmentExpression",
"start": 646,
"end": 673,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 31
}
},
"operator": "=",
"left": {
"type": "Identifier",
"start": 646,
"end": 655,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 13
},
"identifierName": "tableName"
},
"name": "tableName"
},
"right": {
"type": "LogicalExpression",
"start": 658,
"end": 673,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 21,
"column": 31
}
},
"left": {
"type": "Identifier",
"start": 658,
"end": 667,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 21,
"column": 25
},
"identifierName": "tableName"
},
"name": "tableName"
},
"operator": "||",
"right": {
"type": "ObjectExpression",
"start": 671,
"end": 673,
"loc": {
"start": {
"line": 21,
"column": 29
},
"end": {
"line": 21,
"column": 31
}
},
"properties": []
}
}
}
},
{
"type": "ReturnStatement",
"start": 679,
"end": 900,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 26,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 686,
"end": 899,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 26,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 694,
"end": 748,
"loc": {
"start": {
"line": 23,
"column": 6
},
"end": {
"line": 23,
"column": 60
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 694,
"end": 700,
"loc": {
"start": {
"line": 23,
"column": 6
},
"end": {
"line": 23,
"column": 12
},
"identifierName": "schema"
},
"name": "schema"
},
"value": {
"type": "LogicalExpression",
"start": 702,
"end": 748,
"loc": {
"start": {
"line": 23,
"column": 14
},
"end": {
"line": 23,
"column": 60
}
},
"left": {
"type": "LogicalExpression",
"start": 702,
"end": 736,
"loc": {
"start": {
"line": 23,
"column": 14