mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,494 lines (1,493 loc) • 79.9 kB
JSON
{
"type": "File",
"start": 0,
"end": 831,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 32,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 831,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 32,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 30,
"end": 830,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 31,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 45,
"end": 830,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 31,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 51,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 38
},
"identifierName": "MdSeedRunnerError"
},
"name": "MdSeedRunnerError",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 77,
"end": 82,
"loc": {
"start": {
"line": 4,
"column": 47
},
"end": {
"line": 4,
"column": 52
},
"identifierName": "Error"
},
"name": "Error"
},
"body": {
"type": "ClassBody",
"start": 83,
"end": 830,
"loc": {
"start": {
"line": 4,
"column": 53
},
"end": {
"line": 31,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 395,
"end": 828,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 30,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 395,
"end": 406,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 13
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 407,
"end": 451,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 58
}
},
"left": {
"type": "ObjectPattern",
"start": 407,
"end": 446,
"loc": {
"start": {
"line": 12,
"column": 14
},
"end": {
"line": 12,
"column": 53
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 409,
"end": 418,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 25
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 409,
"end": 413,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "type"
},
"name": "type"
},
"value": {
"type": "AssignmentPattern",
"start": 409,
"end": 418,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 25
}
},
"left": {
"type": "Identifier",
"start": 409,
"end": 413,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 20
},
"identifierName": "type"
},
"name": "type"
},
"right": {
"type": "StringLiteral",
"start": 416,
"end": 418,
"loc": {
"start": {
"line": 12,
"column": 23
},
"end": {
"line": 12,
"column": 25
}
},
"extra": {
"rawValue": "",
"raw": "''"
},
"value": ""
}
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 420,
"end": 432,
"loc": {
"start": {
"line": 12,
"column": 27
},
"end": {
"line": 12,
"column": 39
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 420,
"end": 427,
"loc": {
"start": {
"line": 12,
"column": 27
},
"end": {
"line": 12,
"column": 34
},
"identifierName": "payload"
},
"name": "payload"
},
"value": {
"type": "AssignmentPattern",
"start": 420,
"end": 432,
"loc": {
"start": {
"line": 12,
"column": 27
},
"end": {
"line": 12,
"column": 39
}
},
"left": {
"type": "Identifier",
"start": 420,
"end": 427,
"loc": {
"start": {
"line": 12,
"column": 27
},
"end": {
"line": 12,
"column": 34
},
"identifierName": "payload"
},
"name": "payload"
},
"right": {
"type": "ObjectExpression",
"start": 430,
"end": 432,
"loc": {
"start": {
"line": 12,
"column": 37
},
"end": {
"line": 12,
"column": 39
}
},
"properties": []
}
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 434,
"end": 444,
"loc": {
"start": {
"line": 12,
"column": 41
},
"end": {
"line": 12,
"column": 51
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 434,
"end": 439,
"loc": {
"start": {
"line": 12,
"column": 41
},
"end": {
"line": 12,
"column": 46
},
"identifierName": "error"
},
"name": "error"
},
"value": {
"type": "AssignmentPattern",
"start": 434,
"end": 444,
"loc": {
"start": {
"line": 12,
"column": 41
},
"end": {
"line": 12,
"column": 51
}
},
"left": {
"type": "Identifier",
"start": 434,
"end": 439,
"loc": {
"start": {
"line": 12,
"column": 41
},
"end": {
"line": 12,
"column": 46
},
"identifierName": "error"
},
"name": "error"
},
"right": {
"type": "ObjectExpression",
"start": 442,
"end": 444,
"loc": {
"start": {
"line": 12,
"column": 49
},
"end": {
"line": 12,
"column": 51
}
},
"properties": []
}
},
"extra": {
"shorthand": true
}
}
]
},
"right": {
"type": "ObjectExpression",
"start": 449,
"end": 451,
"loc": {
"start": {
"line": 12,
"column": 56
},
"end": {
"line": 12,
"column": 58
}
},
"properties": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 453,
"end": 828,
"loc": {
"start": {
"line": 12,
"column": 60
},
"end": {
"line": 30,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 459,
"end": 503,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 48
}
},
"expression": {
"type": "CallExpression",
"start": 459,
"end": 502,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 47
}
},
"callee": {
"type": "Super",
"start": 459,
"end": 464,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 9
}
}
},
"arguments": [
{
"type": "LogicalExpression",
"start": 465,
"end": 501,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 46
}
},
"left": {
"type": "MemberExpression",
"start": 465,
"end": 478,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 23
}
},
"object": {
"type": "Identifier",
"start": 465,
"end": 470,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 15
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 471,
"end": 478,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 23
},
"identifierName": "message"
},
"name": "message"
},
"computed": false
},
"operator": "||",
"right": {
"type": "StringLiteral",
"start": 482,
"end": 501,
"loc": {
"start": {
"line": 13,
"column": 27
},
"end": {
"line": 13,
"column": 46
}
},
"extra": {
"rawValue": "MdSeedRunnerError",
"raw": "'MdSeedRunnerError'"
},
"value": "MdSeedRunnerError"
}
}
]
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Error name.\n * @type {String}\n ",
"start": 509,
"end": 561,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 18,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 566,
"end": 598,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 36
}
},
"expression": {
"type": "AssignmentExpression",
"start": 566,
"end": 597,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 35
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 566,
"end": 575,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 13
}
},
"object": {
"type": "ThisExpression",
"start": 566,
"end": 570,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 571,
"end": 575,
"loc": {
"start": {
"line": 19,
"column": 9
},
"end": {
"line": 19,
"column": 13
},
"identifierName": "name"
},
"name": "name"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "StringLiteral",
"start": 578,
"end": 597,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 35
}
},
"extra": {
"rawValue": "MdSeedRunnerError",
"raw": "'MdSeedRunnerError'"
},
"value": "MdSeedRunnerError"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Error name.\n * @type {String}\n ",
"start": 509,
"end": 561,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 18,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Error type (one of the MdSeedRunner.operations).\n * @type {String}\n ",
"start": 603,
"end": 692,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 23,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 697,
"end": 714,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 21
}
},
"expression": {
"type": "AssignmentExpression",
"start": 697,
"end": 713,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 20
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 697,
"end": 706,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 13
}
},
"object": {
"type": "ThisExpression",
"start": 697,
"end": 701,
"loc": {
"start": {
"line": 24,
"column": 4
},
"end": {
"line": 24,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 702,
"end": 706,
"loc": {
"start": {
"line": 24,
"column": 9
},
"end": {
"line": 24,
"column": 13
},
"identifierName": "type"
},
"name": "type"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 709,
"end": 713,
"loc": {
"start": {
"line": 24,
"column": 16
},
"end": {
"line": 24,
"column": 20
},
"identifierName": "type"
},
"name": "type"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Error type (one of the MdSeedRunner.operations).\n * @type {String}\n ",
"start": 603,
"end": 692,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 23,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Custom payload object.\n * @type {Object}\n ",
"start": 719,
"end": 782,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 28,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 787,
"end": 824,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 41
}
},
"expression": {
"type": "AssignmentExpression",
"start": 787,
"end": 823,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 40
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 787,
"end": 799,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 16
}
},
"object": {
"type": "ThisExpression",
"start": 787,
"end": 791,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 29,
"column": 8
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 792,
"end": 799,
"loc": {
"start": {
"line": 29,
"column": 9
},
"end": {
"line": 29,
"column": 16
},
"identifierName": "payload"
},
"name": "payload"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "ObjectExpression",
"start": 802,
"end": 823,
"loc": {
"start": {
"line": 29,
"column": 19
},
"end": {
"line": 29,
"column": 40
}
},
"properties": [
{
"type": "SpreadProperty",
"start": 804,
"end": 814,
"loc": {
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 29,
"column": 31
}
},
"argument": {
"type": "Identifier",
"start": 807,
"end": 814,
"loc": {
"start": {
"line": 29,
"column": 24
},
"end": {
"line": 29,
"column": 31
},
"identifierName": "payload"
},
"name": "payload"
}
},
{
"type": "ObjectProperty",
"start": 816,
"end": 821,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 38
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 816,
"end": 821,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 38
},
"identifierName": "error"
},
"name": "error"
},
"value": {
"type": "Identifier",
"start": 816,
"end": 821,
"loc": {
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 38
},
"identifierName": "error"
},
"name": "error"
},
"extra": {
"shorthand": true
}
}
]
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Custom payload object.\n * @type {Object}\n ",
"start": 719,
"end": 782,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 28,
"column": 7
}
}
}
]
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Creates an MdSeedRunnerError.\n * @param {Object} [options={}] options\n * @param {String} [options.type=''] The error type key (MdSeedRunner.operations).\n * @param {Object} [options.payload={}] A custom payload object.\n * @param {Error} [options.error={}] Error object.\n ",
"start": 87,
"end": 392,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
]
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * MdSeedRunner Error\n ",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
}
],
"trailingComments": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * MdSeedRunner Error\n ",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\n * MdSeedRunner Error\n ",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Creates an MdSeedRunnerError.\n * @param {Object} [options={}] options\n * @param {String} [options.type=''] The error type key (MdSeedRunner.operations).\n * @param {Object} [options.payload={}] A custom payload object.\n * @param {Error} [options.error={}] Error object.\n ",
"start": 87,
"end": 392,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Error name.\n * @type {String}\n ",
"start": 509,
"end": 561,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 18,
"column": 7
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Error type (one of the MdSeedRunner.operations).\n * @type {String}\n ",
"start": 603,
"end": 692,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 23,
"column": 7
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Custom payload object.\n * @type {Object}\n ",
"start": 719,
"end": 782,
"loc": {
"start": {
"line": 25,
"column": 4
},
"end": {
"line": 28,
"column": 7
}
}
}
],
"tokens": [
{
"type": "CommentBlock",
"value": "*\n * MdSeedRunner Error\n ",
"start": 0,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
},
{
"type": {
"label": "export",
"keyword": "export",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "export",
"start": 30,
"end": 36,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 6
}
}
},
{
"type": {
"label": "default",
"keyword": "default",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "default",
"start": 37,
"end": 44,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 14
}
}
},
{
"type": {
"label": "class",
"keyword": "class",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "class",
"start": 45,
"end": 50,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 20
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "MdSeedRunnerError",
"start": 51,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 38
}
}
},
{
"type": {
"label": "extends",
"keyword": "extends",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "extends",
"start": 69,
"end": 76,
"loc": {
"start": {
"line": 4,
"column": 39
},
"end": {
"line": 4,
"column": 46
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "Error",
"start": 77,
"end": 82,
"loc": {
"start": {
"line": 4,
"column": 47
},
"end": {
"line": 4,
"column": 52
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 83,
"end": 84,
"loc": {
"start": {
"line": 4,
"column": 53
},
"end": {
"line": 4,
"column": 54
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Creates an MdSeedRunnerError.\n * @param {Object} [options={}] options\n * @param {String} [options.type=''] The error type key (MdSeedRunner.operations).\n * @param {Object} [options.payload={}] A custom payload object.\n * @param {Error} [options.error={}] Error object.\n ",
"start": 87,
"end": 392,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "constructor",
"start": 395,
"end": 406,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {