mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,473 lines (1,472 loc) • 266 kB
JSON
{
"type": "File",
"start": 0,
"end": 1064,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 39,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1064,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 39,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "test"
},
"name": "test"
}
}
],
"source": {
"type": "StringLiteral",
"start": 17,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 22
}
},
"extra": {
"rawValue": "ava",
"raw": "'ava'"
},
"value": "ava"
}
},
{
"type": "ImportDeclaration",
"start": 25,
"end": 80,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 55
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 32,
"end": 49,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 24
}
},
"local": {
"type": "Identifier",
"start": 32,
"end": 49,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 24
},
"identifierName": "MdSeedRunnerError"
},
"name": "MdSeedRunnerError"
}
}
],
"source": {
"type": "StringLiteral",
"start": 55,
"end": 79,
"loc": {
"start": {
"line": 3,
"column": 30
},
"end": {
"line": 3,
"column": 54
}
},
"extra": {
"rawValue": "./md-seed-runner-error",
"raw": "'./md-seed-runner-error'"
},
"value": "./md-seed-runner-error"
}
},
{
"type": "ExpressionStatement",
"start": 82,
"end": 272,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 82,
"end": 271,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 82,
"end": 86,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 87,
"end": 108,
"loc": {
"start": {
"line": 5,
"column": 5
},
"end": {
"line": 5,
"column": 26
}
},
"extra": {
"rawValue": "should create error",
"raw": "'should create error'"
},
"value": "should create error"
},
{
"type": "ArrowFunctionExpression",
"start": 110,
"end": 270,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 11,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 110,
"end": 111,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 5,
"column": 29
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 115,
"end": 270,
"loc": {
"start": {
"line": 5,
"column": 33
},
"end": {
"line": 11,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 119,
"end": 157,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 40
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 125,
"end": 156,
"loc": {
"start": {
"line": 6,
"column": 8
},
"end": {
"line": 6,
"column": 39
}
},
"id": {
"type": "Identifier",
"start": 125,
"end": 130,
"loc": {
"start": {
"line": 6,
"column": 8
},
"end": {
"line": 6,
"column": 13
},
"identifierName": "error"
},
"name": "error"
},
"init": {
"type": "NewExpression",
"start": 133,
"end": 156,
"loc": {
"start": {
"line": 6,
"column": 16
},
"end": {
"line": 6,
"column": 39
}
},
"callee": {
"type": "Identifier",
"start": 137,
"end": 154,
"loc": {
"start": {
"line": 6,
"column": 20
},
"end": {
"line": 6,
"column": 37
},
"identifierName": "MdSeedRunnerError"
},
"name": "MdSeedRunnerError"
},
"arguments": []
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 161,
"end": 199,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 40
}
},
"expression": {
"type": "CallExpression",
"start": 161,
"end": 198,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 39
}
},
"callee": {
"type": "MemberExpression",
"start": 161,
"end": 165,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 161,
"end": 162,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 163,
"end": 165,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 166,
"end": 176,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 166,
"end": 171,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 172,
"end": 176,
"loc": {
"start": {
"line": 8,
"column": 13
},
"end": {
"line": 8,
"column": 17
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 178,
"end": 197,
"loc": {
"start": {
"line": 8,
"column": 19
},
"end": {
"line": 8,
"column": 38
}
},
"extra": {
"rawValue": "MdSeedRunnerError",
"raw": "'MdSeedRunnerError'"
},
"value": "MdSeedRunnerError"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 202,
"end": 223,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 23
}
},
"expression": {
"type": "CallExpression",
"start": 202,
"end": 222,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 22
}
},
"callee": {
"type": "MemberExpression",
"start": 202,
"end": 206,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 202,
"end": 203,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 204,
"end": 206,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 207,
"end": 217,
"loc": {
"start": {
"line": 9,
"column": 7
},
"end": {
"line": 9,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 207,
"end": 212,
"loc": {
"start": {
"line": 9,
"column": 7
},
"end": {
"line": 9,
"column": 12
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 213,
"end": 217,
"loc": {
"start": {
"line": 9,
"column": 13
},
"end": {
"line": 9,
"column": 17
},
"identifierName": "type"
},
"name": "type"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 219,
"end": 221,
"loc": {
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 9,
"column": 21
}
},
"extra": {
"rawValue": "",
"raw": "''"
},
"value": ""
}
]
}
},
{
"type": "ExpressionStatement",
"start": 226,
"end": 268,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 44
}
},
"expression": {
"type": "CallExpression",
"start": 226,
"end": 267,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 226,
"end": 237,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 226,
"end": 227,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 228,
"end": 237,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 13
},
"identifierName": "deepEqual"
},
"name": "deepEqual"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 238,
"end": 251,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 238,
"end": 243,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 19
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 244,
"end": 251,
"loc": {
"start": {
"line": 10,
"column": 20
},
"end": {
"line": 10,
"column": 27
},
"identifierName": "payload"
},
"name": "payload"
},
"computed": false
},
{
"type": "ObjectExpression",
"start": 253,
"end": 266,
"loc": {
"start": {
"line": 10,
"column": 29
},
"end": {
"line": 10,
"column": 42
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 255,
"end": 264,
"loc": {
"start": {
"line": 10,
"column": 31
},
"end": {
"line": 10,
"column": 40
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 255,
"end": 260,
"loc": {
"start": {
"line": 10,
"column": 31
},
"end": {
"line": 10,
"column": 36
},
"identifierName": "error"
},
"name": "error"
},
"value": {
"type": "ObjectExpression",
"start": 262,
"end": 264,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 40
}
},
"properties": []
}
}
]
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 274,
"end": 512,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 20,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 274,
"end": 511,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 20,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 274,
"end": 278,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 13,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 279,
"end": 310,
"loc": {
"start": {
"line": 13,
"column": 5
},
"end": {
"line": 13,
"column": 36
}
},
"extra": {
"rawValue": "should create error with type",
"raw": "'should create error with type'"
},
"value": "should create error with type"
},
{
"type": "ArrowFunctionExpression",
"start": 312,
"end": 510,
"loc": {
"start": {
"line": 13,
"column": 38
},
"end": {
"line": 20,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 312,
"end": 313,
"loc": {
"start": {
"line": 13,
"column": 38
},
"end": {
"line": 13,
"column": 39
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 317,
"end": 510,
"loc": {
"start": {
"line": 13,
"column": 43
},
"end": {
"line": 20,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 321,
"end": 346,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 27
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 327,
"end": 345,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 26
}
},
"id": {
"type": "Identifier",
"start": 327,
"end": 331,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 12
},
"identifierName": "type"
},
"name": "type"
},
"init": {
"type": "StringLiteral",
"start": 334,
"end": 345,
"loc": {
"start": {
"line": 14,
"column": 15
},
"end": {
"line": 14,
"column": 26
}
},
"extra": {
"rawValue": "some-type",
"raw": "'some-type'"
},
"value": "some-type"
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 349,
"end": 395,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 48
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 355,
"end": 394,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 47
}
},
"id": {
"type": "Identifier",
"start": 355,
"end": 360,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 13
},
"identifierName": "error"
},
"name": "error"
},
"init": {
"type": "NewExpression",
"start": 363,
"end": 394,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 47
}
},
"callee": {
"type": "Identifier",
"start": 367,
"end": 384,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 37
},
"identifierName": "MdSeedRunnerError"
},
"name": "MdSeedRunnerError"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 385,
"end": 393,
"loc": {
"start": {
"line": 15,
"column": 38
},
"end": {
"line": 15,
"column": 46
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 387,
"end": 391,
"loc": {
"start": {
"line": 15,
"column": 40
},
"end": {
"line": 15,
"column": 44
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 387,
"end": 391,
"loc": {
"start": {
"line": 15,
"column": 40
},
"end": {
"line": 15,
"column": 44
},
"identifierName": "type"
},
"name": "type"
},
"value": {
"type": "Identifier",
"start": 387,
"end": 391,
"loc": {
"start": {
"line": 15,
"column": 40
},
"end": {
"line": 15,
"column": 44
},
"identifierName": "type"
},
"name": "type"
},
"extra": {
"shorthand": true
}
}
]
}
]
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 399,
"end": 437,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 40
}
},
"expression": {
"type": "CallExpression",
"start": 399,
"end": 436,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 39
}
},
"callee": {
"type": "MemberExpression",
"start": 399,
"end": 403,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 399,
"end": 400,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 401,
"end": 403,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 404,
"end": 414,
"loc": {
"start": {
"line": 17,
"column": 7
},
"end": {
"line": 17,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 404,
"end": 409,
"loc": {
"start": {
"line": 17,
"column": 7
},
"end": {
"line": 17,
"column": 12
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 410,
"end": 414,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 17
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 416,
"end": 435,
"loc": {
"start": {
"line": 17,
"column": 19
},
"end": {
"line": 17,
"column": 38
}
},
"extra": {
"rawValue": "MdSeedRunnerError",
"raw": "'MdSeedRunnerError'"
},
"value": "MdSeedRunnerError"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 440,
"end": 463,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 25
}
},
"expression": {
"type": "CallExpression",
"start": 440,
"end": 462,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 24
}
},
"callee": {
"type": "MemberExpression",
"start": 440,
"end": 444,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 440,
"end": 441,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 442,
"end": 444,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 445,
"end": 455,
"loc": {
"start": {
"line": 18,
"column": 7
},
"end": {
"line": 18,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 445,