sequelize
Version:
Multi dialect ORM for Node.JS/io.js
1,628 lines • 5.73 MB
JSON
{
"type": "File",
"start": 0,
"end": 30495,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 896,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 30495,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 896,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "VariableDeclaration",
"start": 34,
"end": 71,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 40,
"end": 70,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 40,
"end": 45,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 11
},
"identifierName": "Utils"
},
"name": "Utils",
"leadingComments": null
},
"init": {
"type": "CallExpression",
"start": 48,
"end": 70,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 48,
"end": 55,
"loc": {
"start": {
"line": 4,
"column": 14
},
"end": {
"line": 4,
"column": 21
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 56,
"end": 69,
"loc": {
"start": {
"line": 4,
"column": 22
},
"end": {
"line": 4,
"column": 35
}
},
"extra": {
"rawValue": "../../utils",
"raw": "'../../utils'"
},
"value": "../../utils"
}
]
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentBlock",
"value": " jshint -W110 ",
"start": 15,
"end": 33,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 18
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 72,
"end": 101,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 29
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 78,
"end": 100,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 28
}
},
"id": {
"type": "Identifier",
"start": 78,
"end": 82,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 10
},
"identifierName": "util"
},
"name": "util"
},
"init": {
"type": "CallExpression",
"start": 85,
"end": 100,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 5,
"column": 28
}
},
"callee": {
"type": "Identifier",
"start": 85,
"end": 92,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 5,
"column": 20
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 93,
"end": 99,
"loc": {
"start": {
"line": 5,
"column": 21
},
"end": {
"line": 5,
"column": 27
}
},
"extra": {
"rawValue": "util",
"raw": "'util'"
},
"value": "util"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 102,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 46
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 108,
"end": 147,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 45
}
},
"id": {
"type": "Identifier",
"start": 108,
"end": 117,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 15
},
"identifierName": "DataTypes"
},
"name": "DataTypes"
},
"init": {
"type": "CallExpression",
"start": 120,
"end": 147,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 45
}
},
"callee": {
"type": "Identifier",
"start": 120,
"end": 127,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 25
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 128,
"end": 146,
"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": 149,
"end": 219,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 7,
"column": 70
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 155,
"end": 218,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 69
}
},
"id": {
"type": "Identifier",
"start": 155,
"end": 177,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 28
},
"identifierName": "AbstractQueryGenerator"
},
"name": "AbstractQueryGenerator"
},
"init": {
"type": "CallExpression",
"start": 180,
"end": 218,
"loc": {
"start": {
"line": 7,
"column": 31
},
"end": {
"line": 7,
"column": 69
}
},
"callee": {
"type": "Identifier",
"start": 180,
"end": 187,
"loc": {
"start": {
"line": 7,
"column": 31
},
"end": {
"line": 7,
"column": 38
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 188,
"end": 217,
"loc": {
"start": {
"line": 7,
"column": 39
},
"end": {
"line": 7,
"column": 68
}
},
"extra": {
"rawValue": "../abstract/query-generator",
"raw": "'../abstract/query-generator'"
},
"value": "../abstract/query-generator"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 220,
"end": 253,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 33
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 226,
"end": 252,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 32
}
},
"id": {
"type": "Identifier",
"start": 226,
"end": 232,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "semver"
},
"name": "semver"
},
"init": {
"type": "CallExpression",
"start": 235,
"end": 252,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 32
}
},
"callee": {
"type": "Identifier",
"start": 235,
"end": 242,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 22
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 243,
"end": 251,
"loc": {
"start": {
"line": 8,
"column": 23
},
"end": {
"line": 8,
"column": 31
}
},
"extra": {
"rawValue": "semver",
"raw": "'semver'"
},
"value": "semver"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 254,
"end": 282,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 28
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 260,
"end": 281,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 27
}
},
"id": {
"type": "Identifier",
"start": 260,
"end": 261,
"loc": {
"start": {
"line": 9,
"column": 6
},
"end": {
"line": 9,
"column": 7
},
"identifierName": "_"
},
"name": "_"
},
"init": {
"type": "CallExpression",
"start": 264,
"end": 281,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 27
}
},
"callee": {
"type": "Identifier",
"start": 264,
"end": 271,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 17
},
"identifierName": "require"
},
"name": "require"
},
"arguments": [
{
"type": "StringLiteral",
"start": 272,
"end": 280,
"loc": {
"start": {
"line": 9,
"column": 18
},
"end": {
"line": 9,
"column": 26
}
},
"extra": {
"rawValue": "lodash",
"raw": "'lodash'"
},
"value": "lodash"
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 284,
"end": 30460,
"loc": {
"start": {
"line": 11,
"column": 0
},
"end": {
"line": 893,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 290,
"end": 30459,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 893,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 290,
"end": 304,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 20
},
"identifierName": "QueryGenerator"
},
"name": "QueryGenerator"
},
"init": {
"type": "ObjectExpression",
"start": 307,
"end": 30459,
"loc": {
"start": {
"line": 11,
"column": 23
},
"end": {
"line": 893,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 337,
"end": 370,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 35
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 337,
"end": 346,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 11
},
"identifierName": "__proto__"
},
"name": "__proto__",
"leadingComments": null
},
"value": {
"type": "Identifier",
"start": 348,
"end": 370,
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 35
},
"identifierName": "AbstractQueryGenerator"
},
"name": "AbstractQueryGenerator"
},
"leadingComments": [
{
"type": "CommentBlock",
"value": " jshint proto:true ",
"start": 311,
"end": 334,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 25
}
}
}
]
},
{
"type": "ObjectProperty",
"start": 374,
"end": 385,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 374,
"end": 381,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 9
},
"identifierName": "options"
},
"name": "options"
},
"value": {
"type": "ObjectExpression",
"start": 383,
"end": 385,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 13
}
},
"properties": []
}
},
{
"type": "ObjectProperty",
"start": 389,
"end": 408,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 21
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 389,
"end": 396,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 9
},
"identifierName": "dialect"
},
"name": "dialect"
},
"value": {
"type": "StringLiteral",
"start": 398,
"end": 408,
"loc": {
"start": {
"line": 15,
"column": 11
},
"end": {
"line": 15,
"column": 21
}
},
"extra": {
"rawValue": "postgres",
"raw": "'postgres'"
},
"value": "postgres"
}
},
{
"type": "ObjectMethod",
"start": 413,
"end": 492,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 19,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 413,
"end": 426,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 15
},
"identifierName": "setSearchPath"
},
"name": "setSearchPath"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 427,
"end": 437,
"loc": {
"start": {
"line": 17,
"column": 16
},
"end": {
"line": 17,
"column": 26
},
"identifierName": "searchPath"
},
"name": "searchPath"
}
],
"body": {
"type": "BlockStatement",
"start": 439,
"end": 492,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 19,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 445,
"end": 488,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 47
}
},
"argument": {
"type": "TemplateLiteral",
"start": 452,
"end": 487,
"loc": {
"start": {
"line": 18,
"column": 11
},
"end": {
"line": 18,
"column": 46
}
},
"expressions": [
{
"type": "Identifier",
"start": 474,
"end": 484,
"loc": {
"start": {
"line": 18,
"column": 33
},
"end": {
"line": 18,
"column": 43
},
"identifierName": "searchPath"
},
"name": "searchPath"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 453,
"end": 472,
"loc": {
"start": {
"line": 18,
"column": 12
},
"end": {
"line": 18,
"column": 31
}
},
"value": {
"raw": "SET search_path to ",
"cooked": "SET search_path to "
},
"tail": false
},
{
"type": "TemplateElement",
"start": 485,
"end": 486,
"loc": {
"start": {
"line": 18,
"column": 44
},
"end": {
"line": 18,
"column": 45
}
},
"value": {
"raw": ";",
"cooked": ";"
},
"tail": true
}
]
}
}
],
"directives": []
}
},
{
"type": "ObjectMethod",
"start": 497,
"end": 562,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 23,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 497,
"end": 509,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 14
},
"identifierName": "createSchema"
},
"name": "createSchema"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 510,
"end": 516,
"loc": {
"start": {
"line": 21,
"column": 15
},
"end": {
"line": 21,
"column": 21
},
"identifierName": "schema"
},
"name": "schema"
}
],
"body": {
"type": "BlockStatement",
"start": 518,
"end": 562,
"loc": {
"start": {
"line": 21,
"column": 23
},
"end": {
"line": 23,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 524,
"end": 558,
"loc": {
"start": {
"line": 22,
"column": 4
},
"end": {
"line": 22,
"column": 38
}
},
"argument": {
"type": "TemplateLiteral",
"start": 531,
"end": 557,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 37
}
},
"expressions": [
{
"type": "Identifier",
"start": 548,
"end": 554,
"loc": {
"start": {
"line": 22,
"column": 28
},
"end": {
"line": 22,
"column": 34
},
"identifierName": "schema"
},
"name": "schema"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 532,
"end": 546,
"loc": {
"start": {
"line": 22,
"column": 12
},
"end": {
"line": 22,
"column": 26
}
},
"value": {
"raw": "CREATE SCHEMA ",
"cooked": "CREATE SCHEMA "
},
"tail": false
},
{
"type": "TemplateElement",
"start": 555,
"end": 556,
"loc": {
"start": {
"line": 22,
"column": 35
},
"end": {
"line": 22,
"column": 36
}
},
"value": {
"raw": ";",
"cooked": ";"
},
"tail": true
}
]
}
}
],
"directives": []
}
},
{
"type": "ObjectMethod",
"start": 567,
"end": 646,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 27,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 567,
"end": 577,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 12
},
"identifierName": "dropSchema"
},
"name": "dropSchema"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 578,
"end": 584,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 19
},
"identifierName": "schema"
},
"name": "schema"
}
],
"body": {
"type": "BlockStatement",
"start": 586,
"end": 646,
"loc": {
"start": {
"line": 25,
"column": 21
},
"end": {
"line": 27,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 592,
"end": 642,
"loc": {
"start": {
"line": 26,
"column": 4
},
"end": {
"line": 26,
"column": 54
}
},
"argument": {
"type": "TemplateLiteral",
"start": 599,
"end": 641,
"loc": {
"start": {
"line": 26,
"column": 11
},
"end": {
"line": 26,
"column": 53
}
},
"expressions": [
{
"type": "Identifier",
"start": 624,
"end": 630,
"loc": {
"start": {
"line": 26,
"column": 36
},
"end": {
"line": 26,
"column": 42
},
"identifierName": "schema"
},
"name": "schema"
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 600,
"end": 622,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 34
}
},
"value": {
"raw": "DROP SCHEMA IF EXISTS ",
"cooked": "DROP SCHEMA IF EXISTS "
},
"tail": false
},
{
"type": "TemplateElement",
"start": 631,
"end": 640,
"loc": {
"start": {
"line": 26,
"column": 43
},
"end": {
"line": 26,
"column": 52
}
},
"value": {
"raw": " CASCADE;",
"cooked": " CASCADE;"
},
"tail": true
}
]
}
}
],
"directives": []
}
},
{
"type": "ObjectMethod",
"start": 651,
"end": 839,
"loc": {
"start": {
"line": 29,
"column": 2
},
"end": {
"line": 31,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 651,
"end": 667,
"loc": {
"start": {
"line": 29,
"column": 2
},
"end": {
"line": 29,
"column": 18
},
"identifierName": "showSchemasQuery"
},
"name": "showSchemasQuery"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 670,
"end": 839,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 31,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 676,
"end": 835,
"loc": {
"start": {
"line": 30,
"column": 4
},
"end": {
"line": 30,
"column": 163
}
},
"argument": {
"type": "StringLiteral",
"start": 683,
"end": 834,
"loc": {
"start": {
"line": 30,
"column": 11
},
"end": {
"line": 30,
"column": 162
}
},
"extra": {
"rawValue": "SELECT schema_name FROM information_schema.schemata WHERE schema_name <> 'information_schema' AND schema_name != 'public' AND schema_name !~ E'^pg_';",
"raw": "\"SELECT schema_name FROM information_schema.schemata WHERE schema_name <> 'information_schema' AND schema_name != 'public' AND schema_name !~ E'^pg_';\""
},
"value": "SELECT schema_name FROM information_schema.schemata WHERE schema_name <> 'information_schema' AND schema_name != 'public' AND schema_name !~ E'^pg_';"
}
}
],
"directives": []
}
},
{
"type": "ObjectMethod",
"start": 844,
"end": 898,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 35,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 844,
"end": 856,
"loc": {
"start": {
"line": 33,
"column": 2
},
"end": {
"line": 33,
"column": 14
},
"identifierName": "versionQuery"
},
"name": "versionQuery"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 859,
"end": 898,
"loc": {
"start": {
"line": 33,
"column": 17
},
"end": {
"line": 35,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 865,
"end": 894,
"loc": {
"start": {
"line": 34,
"column": 4
},
"end": {
"line": 34,
"column": 33
}
},
"argument": {
"type": "StringLiteral",
"start": 872,
"end": 893,
"loc": {
"start": {
"line": 34,
"column": 11
},
"end": {
"line": 34,
"column": 32
}
},
"extra": {
"rawValue": "SHOW SERVER_VERSION",
"raw": "'SHOW SERVER_VERSION'"
},
"value": "SHOW SERVER_VERSION"
}
}
],
"directives": []
}
},
{
"type": "ObjectMethod",
"start": 903,
"end": 2816,
"loc": {
"start": {
"line": 37,
"column": 2
},
"end": {
"line": 89,
"column": 3
}
},
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 903,
"end": 919,
"loc": {
"start": {
"line":