mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,585 lines (1,584 loc) • 405 kB
JSON
{
"type": "File",
"start": 0,
"end": 1800,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 69,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1800,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 69,
"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": 24,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 26
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 31,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 31,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 12
},
"identifierName": "sinon"
},
"name": "sinon"
}
}
],
"source": {
"type": "StringLiteral",
"start": 42,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 18
},
"end": {
"line": 2,
"column": 25
}
},
"extra": {
"rawValue": "sinon",
"raw": "'sinon'"
},
"value": "sinon"
}
},
{
"type": "ImportDeclaration",
"start": 52,
"end": 129,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 77
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 61,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 61,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 16
},
"identifierName": "aliases"
},
"name": "aliases"
},
"local": {
"type": "Identifier",
"start": 61,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 16
},
"identifierName": "aliases"
},
"name": "aliases"
}
},
{
"type": "ImportSpecifier",
"start": 70,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 26
}
},
"imported": {
"type": "Identifier",
"start": 70,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 26
},
"identifierName": "commands"
},
"name": "commands"
},
"local": {
"type": "Identifier",
"start": 70,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 18
},
"end": {
"line": 4,
"column": 26
},
"identifierName": "commands"
},
"name": "commands"
}
},
{
"type": "ImportSpecifier",
"start": 80,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 28
},
"end": {
"line": 4,
"column": 39
}
},
"imported": {
"type": "Identifier",
"start": 80,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 28
},
"end": {
"line": 4,
"column": 39
},
"identifierName": "commandsMap"
},
"name": "commandsMap"
},
"local": {
"type": "Identifier",
"start": 80,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 28
},
"end": {
"line": 4,
"column": 39
},
"identifierName": "commandsMap"
},
"name": "commandsMap"
}
},
{
"type": "ImportSpecifier",
"start": 93,
"end": 107,
"loc": {
"start": {
"line": 4,
"column": 41
},
"end": {
"line": 4,
"column": 55
}
},
"imported": {
"type": "Identifier",
"start": 93,
"end": 107,
"loc": {
"start": {
"line": 4,
"column": 41
},
"end": {
"line": 4,
"column": 55
},
"identifierName": "defaultCommand"
},
"name": "defaultCommand"
},
"local": {
"type": "Identifier",
"start": 93,
"end": 107,
"loc": {
"start": {
"line": 4,
"column": 41
},
"end": {
"line": 4,
"column": 55
},
"identifierName": "defaultCommand"
},
"name": "defaultCommand"
}
}
],
"source": {
"type": "StringLiteral",
"start": 115,
"end": 128,
"loc": {
"start": {
"line": 4,
"column": 63
},
"end": {
"line": 4,
"column": 76
}
},
"extra": {
"rawValue": "./constants",
"raw": "'./constants'"
},
"value": "./constants"
}
},
{
"type": "ImportDeclaration",
"start": 130,
"end": 286,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 12,
"column": 19
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 141,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 9
}
},
"imported": {
"type": "Identifier",
"start": 141,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 9
},
"identifierName": "isAlias"
},
"name": "isAlias"
},
"local": {
"type": "Identifier",
"start": 141,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 9
},
"identifierName": "isAlias"
},
"name": "isAlias"
}
},
{
"type": "ImportSpecifier",
"start": 152,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 152,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 16
},
"identifierName": "aliasToCommand"
},
"name": "aliasToCommand"
},
"local": {
"type": "Identifier",
"start": 152,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 16
},
"identifierName": "aliasToCommand"
},
"name": "aliasToCommand"
}
},
{
"type": "ImportSpecifier",
"start": 170,
"end": 187,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 19
}
},
"imported": {
"type": "Identifier",
"start": 170,
"end": 187,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 19
},
"identifierName": "commandToFunction"
},
"name": "commandToFunction"
},
"local": {
"type": "Identifier",
"start": 170,
"end": 187,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 19
},
"identifierName": "commandToFunction"
},
"name": "commandToFunction"
}
},
{
"type": "ImportSpecifier",
"start": 191,
"end": 201,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 12
}
},
"imported": {
"type": "Identifier",
"start": 191,
"end": 201,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 12
},
"identifierName": "runCommand"
},
"name": "runCommand"
},
"local": {
"type": "Identifier",
"start": 191,
"end": 201,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 12
},
"identifierName": "runCommand"
},
"name": "runCommand"
}
},
{
"type": "ImportSpecifier",
"start": 205,
"end": 229,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 26
}
},
"imported": {
"type": "Identifier",
"start": 205,
"end": 229,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 26
},
"identifierName": "getCommandAndArgvFromCli"
},
"name": "getCommandAndArgvFromCli"
},
"local": {
"type": "Identifier",
"start": 205,
"end": 229,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 26
},
"identifierName": "getCommandAndArgvFromCli"
},
"name": "getCommandAndArgvFromCli"
}
},
{
"type": "ImportSpecifier",
"start": 233,
"end": 265,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 233,
"end": 246,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 15
},
"identifierName": "__RewireAPI__"
},
"name": "__RewireAPI__"
},
"local": {
"type": "Identifier",
"start": 250,
"end": 265,
"loc": {
"start": {
"line": 11,
"column": 19
},
"end": {
"line": 11,
"column": 34
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
}
}
],
"source": {
"type": "StringLiteral",
"start": 274,
"end": 285,
"loc": {
"start": {
"line": 12,
"column": 7
},
"end": {
"line": 12,
"column": 18
}
},
"extra": {
"rawValue": "./helpers",
"raw": "'./helpers'"
},
"value": "./helpers"
}
},
{
"type": "ExpressionStatement",
"start": 288,
"end": 484,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 19,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 288,
"end": 483,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 19,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 288,
"end": 299,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 14,
"column": 11
}
},
"object": {
"type": "Identifier",
"start": 288,
"end": 292,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 14,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"property": {
"type": "Identifier",
"start": 293,
"end": 299,
"loc": {
"start": {
"line": 14,
"column": 5
},
"end": {
"line": 14,
"column": 11
},
"identifierName": "serial"
},
"name": "serial"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 300,
"end": 321,
"loc": {
"start": {
"line": 14,
"column": 12
},
"end": {
"line": 14,
"column": 33
}
},
"extra": {
"rawValue": "isAlias should work",
"raw": "'isAlias should work'"
},
"value": "isAlias should work"
},
{
"type": "ArrowFunctionExpression",
"start": 323,
"end": 482,
"loc": {
"start": {
"line": 14,
"column": 35
},
"end": {
"line": 19,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 323,
"end": 324,
"loc": {
"start": {
"line": 14,
"column": 35
},
"end": {
"line": 14,
"column": 36
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 328,
"end": 482,
"loc": {
"start": {
"line": 14,
"column": 40
},
"end": {
"line": 19,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 332,
"end": 390,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 60
}
},
"expression": {
"type": "CallExpression",
"start": 332,
"end": 389,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 59
}
},
"callee": {
"type": "MemberExpression",
"start": 332,
"end": 360,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 30
}
},
"object": {
"type": "CallExpression",
"start": 332,
"end": 352,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 22
}
},
"callee": {
"type": "MemberExpression",
"start": 332,
"end": 343,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 332,
"end": 338,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 8
},
"identifierName": "Object"
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 339,
"end": 343,
"loc": {
"start": {
"line": 15,
"column": 9
},
"end": {
"line": 15,
"column": 13
},
"identifierName": "keys"
},
"name": "keys"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 344,
"end": 351,
"loc": {
"start": {
"line": 15,
"column": 14
},
"end": {
"line": 15,
"column": 21
},
"identifierName": "aliases"
},
"name": "aliases"
}
]
},
"property": {
"type": "Identifier",
"start": 353,
"end": 360,
"loc": {
"start": {
"line": 15,
"column": 23
},
"end": {
"line": 15,
"column": 30
},
"identifierName": "forEach"
},
"name": "forEach"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 361,
"end": 388,
"loc": {
"start": {
"line": 15,
"column": 31
},
"end": {
"line": 15,
"column": 58
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 361,
"end": 362,
"loc": {
"start": {
"line": 15,
"column": 31
},
"end": {
"line": 15,
"column": 32
},
"identifierName": "a"
},
"name": "a"
}
],
"body": {
"type": "CallExpression",
"start": 366,
"end": 388,
"loc": {
"start": {
"line": 15,
"column": 36
},
"end": {
"line": 15,
"column": 58
}
},
"callee": {
"type": "MemberExpression",
"start": 366,
"end": 370,
"loc": {
"start": {
"line": 15,
"column": 36
},
"end": {
"line": 15,
"column": 40
}
},
"object": {
"type": "Identifier",
"start": 366,
"end": 367,
"loc": {
"start": {
"line": 15,
"column": 36
},
"end": {
"line": 15,
"column": 37
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 368,
"end": 370,
"loc": {
"start": {
"line": 15,
"column": 38
},
"end": {
"line": 15,
"column": 40
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "CallExpression",
"start": 371,
"end": 381,
"loc": {
"start": {
"line": 15,
"column": 41
},
"end": {
"line": 15,
"column": 51
}
},
"callee": {
"type": "Identifier",
"start": 371,
"end": 378,
"loc": {
"start": {
"line": 15,
"column": 41
},
"end": {
"line": 15,
"column": 48
},
"identifierName": "isAlias"
},
"name": "isAlias"
},
"arguments": [
{
"type": "Identifier",
"start": 379,
"end": 380,
"loc": {
"start": {
"line": 15,
"column": 49
},
"end": {
"line": 15,
"column": 50
},
"identifierName": "a"
},
"name": "a"
}
]
},
{
"type": "BooleanLiteral",
"start": 383,
"end": 387,
"loc": {
"start": {
"line": 15,
"column": 53
},
"end": {
"line": 15,
"column": 57
}
},
"value": true
}
]
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 393,
"end": 453,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 62
}
},
"expression": {
"type": "CallExpression",
"start": 393,
"end": 452,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 61
}
},
"callee": {
"type": "MemberExpression",
"start": 393,
"end": 422,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 31
}
},
"object": {
"type": "CallExpression",
"start": 393,
"end": 414,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 23
}
},
"callee": {
"type": "MemberExpression",
"start": 393,
"end": 404,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 393,
"end": 399,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 8
},
"identifierName": "Object"
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 400,
"end": 404,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 13
},
"identifierName": "keys"
},
"name": "keys"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 405,
"end": 413,
"loc": {
"start": {
"line": 16,
"column": 14
},
"end": {
"line": 16,
"column": 22
},
"identifierName": "commands"
},
"name": "commands"
}
]
},
"property": {
"type": "Identifier",
"start": 415,
"end": 422,
"loc": {
"start": {
"line": 16,
"column": 24
},
"end": {
"line": 16,
"column": 31
},
"identifierName": "forEach"
},
"name": "forEach"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 423,
"end": 451,
"loc": {
"start": {
"line": 16,
"column": 32
},
"end": {
"line": 16,
"column": 60
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "Identifier",
"start": 423,
"end": 424,
"loc": {
"start": {
"line": 16,
"column": 32
},
"end": {
"line": 16,
"column": 33
},
"identifierName": "c"
},
"name": "c"
}
],
"body": {
"type": "CallExpression",
"start": 428,
"end": 451,
"loc": {
"start": {
"line": 16,
"column": 37
},
"end": {
"line": 16,
"column": 60
}
},
"callee": {
"type": "MemberExpression",
"start": 428,
"end": 432,
"loc": {
"start": {
"line": 16,
"column": 37
},
"end": {
"line": 16,
"column": 41
}
},
"object": {
"type": "Identifier",
"start": 428,
"end": 429,
"loc": {
"start": {
"line": 16,
"column": 37
},
"end": {
"line": 16,
"column": 38
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 430,
"end": 432,
"loc": {
"start": {
"line": 16,
"column": 39
},
"end": {
"line": 16,
"column": 41
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "CallExpression",
"start": 433,
"end": 443,
"loc": {
"start": {
"line": 16,
"column": 42
},
"end": {
"line": 16,
"column": 52
}
},
"callee": {
"type": "Identifier",
"start": 433,
"end": 440,
"loc": {
"start": {
"line": 16,
"column": 42
},
"end": {
"line": 16,
"column": 49
},
"identifierName": "isAlias"
},
"name": "isAlias"
},
"arguments": [
{
"type": "Identifier",
"start": 441,
"end": 442,
"loc": {
"start": {
"line": 16,
"column": 50
},
"end": {
"line": 16,
"column": 51
},
"identifierName": "c"
},
"name": "c"
}
]
},
{
"type": "BooleanLiteral",
"start": 445,
"end": 450,
"loc": {
"start": {
"line": 16,
"column": 54
},
"end": {
"line": 16,
"column": 59
}
},
"value": false
}
]
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 457,
"end": 480,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 25
}
},
"expression": {
"type": "CallExpression",
"start": 457,
"end": 479,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 24
}
},
"callee": {
"type": "MemberExpression",
"start": 457,
"end": 461,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 457,
"end": 458,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},