mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,340 lines • 121 kB
JSON
{
"type": "File",
"start": 0,
"end": 560,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 26,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 560,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 26,
"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": 116,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 64
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 59,
"end": 63,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 59,
"end": 63,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 11
},
"identifierName": "help"
},
"name": "help"
}
},
{
"type": "ImportSpecifier",
"start": 67,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 47
}
},
"imported": {
"type": "Identifier",
"start": 67,
"end": 80,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 28
},
"identifierName": "__RewireAPI__"
},
"name": "__RewireAPI__"
},
"local": {
"type": "Identifier",
"start": 84,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 47
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
}
}
],
"source": {
"type": "StringLiteral",
"start": 107,
"end": 115,
"loc": {
"start": {
"line": 4,
"column": 55
},
"end": {
"line": 4,
"column": 63
}
},
"extra": {
"rawValue": "./help",
"raw": "'./help'"
},
"value": "./help"
}
},
{
"type": "ExpressionStatement",
"start": 118,
"end": 559,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 25,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 118,
"end": 558,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 25,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 118,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 123,
"end": 139,
"loc": {
"start": {
"line": 6,
"column": 5
},
"end": {
"line": 6,
"column": 21
}
},
"extra": {
"rawValue": "show show help",
"raw": "'show show help'"
},
"value": "show show help"
},
{
"type": "ArrowFunctionExpression",
"start": 141,
"end": 557,
"loc": {
"start": {
"line": 6,
"column": 23
},
"end": {
"line": 25,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 141,
"end": 142,
"loc": {
"start": {
"line": 6,
"column": 23
},
"end": {
"line": 6,
"column": 24
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 146,
"end": 557,
"loc": {
"start": {
"line": 6,
"column": 28
},
"end": {
"line": 25,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 150,
"end": 286,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 10,
"column": 4
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 156,
"end": 285,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 10,
"column": 3
}
},
"id": {
"type": "Identifier",
"start": 156,
"end": 167,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 19
},
"identifierName": "createStubs"
},
"name": "createStubs"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 170,
"end": 285,
"loc": {
"start": {
"line": 7,
"column": 22
},
"end": {
"line": 10,
"column": 3
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 171,
"end": 185,
"loc": {
"start": {
"line": 7,
"column": 23
},
"end": {
"line": 7,
"column": 37
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 173,
"end": 183,
"loc": {
"start": {
"line": 7,
"column": 25
},
"end": {
"line": 7,
"column": 35
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 173,
"end": 183,
"loc": {
"start": {
"line": 7,
"column": 25
},
"end": {
"line": 7,
"column": 35
},
"identifierName": "usageGuide"
},
"name": "usageGuide"
},
"value": {
"type": "Identifier",
"start": 173,
"end": 183,
"loc": {
"start": {
"line": 7,
"column": 25
},
"end": {
"line": 7,
"column": 35
},
"identifierName": "usageGuide"
},
"name": "usageGuide"
},
"extra": {
"shorthand": true
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start": 190,
"end": 285,
"loc": {
"start": {
"line": 7,
"column": 42
},
"end": {
"line": 10,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 196,
"end": 249,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 57
}
},
"expression": {
"type": "CallExpression",
"start": 196,
"end": 248,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 56
}
},
"callee": {
"type": "MemberExpression",
"start": 196,
"end": 222,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 196,
"end": 211,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 19
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"property": {
"type": "Identifier",
"start": 212,
"end": 222,
"loc": {
"start": {
"line": 8,
"column": 20
},
"end": {
"line": 8,
"column": 30
},
"identifierName": "__Rewire__"
},
"name": "__Rewire__"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 223,
"end": 235,
"loc": {
"start": {
"line": 8,
"column": 31
},
"end": {
"line": 8,
"column": 43
}
},
"extra": {
"rawValue": "usageGuide",
"raw": "'usageGuide'"
},
"value": "usageGuide"
},
{
"type": "Identifier",
"start": 237,
"end": 247,
"loc": {
"start": {
"line": 8,
"column": 45
},
"end": {
"line": 8,
"column": 55
},
"identifierName": "usageGuide"
},
"name": "usageGuide"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 254,
"end": 281,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 31
}
},
"expression": {
"type": "CallExpression",
"start": 254,
"end": 280,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 30
}
},
"callee": {
"type": "MemberExpression",
"start": 254,
"end": 264,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 254,
"end": 259,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 9
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 260,
"end": 264,
"loc": {
"start": {
"line": 9,
"column": 10
},
"end": {
"line": 9,
"column": 14
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 265,
"end": 272,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 22
},
"identifierName": "console"
},
"name": "console"
},
{
"type": "StringLiteral",
"start": 274,
"end": 279,
"loc": {
"start": {
"line": 9,
"column": 24
},
"end": {
"line": 9,
"column": 29
}
},
"extra": {
"rawValue": "log",
"raw": "'log'"
},
"value": "log"
}
]
}
}
],
"directives": []
}
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 289,
"end": 404,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 14,
"column": 4
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 295,
"end": 403,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 14,
"column": 3
}
},
"id": {
"type": "Identifier",
"start": 295,
"end": 307,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 20
},
"identifierName": "restoreStubs"
},
"name": "restoreStubs"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 310,
"end": 403,
"loc": {
"start": {
"line": 11,
"column": 23
},
"end": {
"line": 14,
"column": 3
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 316,
"end": 403,
"loc": {
"start": {
"line": 11,
"column": 29
},
"end": {
"line": 14,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 322,
"end": 372,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 54
}
},
"expression": {
"type": "CallExpression",
"start": 322,
"end": 371,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 53
}
},
"callee": {
"type": "MemberExpression",
"start": 322,
"end": 357,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 322,
"end": 337,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 19
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"property": {
"type": "Identifier",
"start": 338,
"end": 357,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 39
},
"identifierName": "__ResetDependency__"
},
"name": "__ResetDependency__"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 358,
"end": 370,
"loc": {
"start": {
"line": 12,
"column": 40
},
"end": {
"line": 12,
"column": 52
}
},
"extra": {
"rawValue": "usageGuide",
"raw": "'usageGuide'"
},
"value": "usageGuide"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 377,
"end": 399,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 26
}
},
"expression": {
"type": "CallExpression",
"start": 377,
"end": 398,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 25
}
},
"callee": {
"type": "MemberExpression",
"start": 377,
"end": 396,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 23
}
},
"object": {
"type": "MemberExpression",
"start": 377,
"end": 388,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 15
}
},
"object": {
"type": "Identifier",
"start": 377,
"end": 384,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 11
},
"identifierName": "console"
},
"name": "console"
},
"property": {
"type": "Identifier",
"start": 385,
"end": 388,
"loc": {
"start": {
"line": 13,
"column": 12
},
"end": {
"line": 13,
"column": 15
},
"identifierName": "log"
},
"name": "log"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 389,
"end": 396,
"loc": {
"start": {
"line": 13,
"column": 16
},
"end": {
"line": 13,
"column": 23
},
"identifierName": "restore"
},
"name": "restore"
},
"computed": false
},
"arguments": []
}
}
],
"directives": []
}
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 408,
"end": 446,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 40
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 414,
"end": 445,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 39
}
},
"id": {
"type": "Identifier",
"start": 414,
"end": 424,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 18
},
"identifierName": "usageGuide"
},
"name": "usageGuide"
},
"init": {
"type": "StringLiteral",
"start": 427,
"end": 445,
"loc": {
"start": {
"line": 16,
"column": 21
},
"end": {
"line": 16,
"column": 39
}
},
"extra": {
"rawValue": "some usage guide",
"raw": "'some usage guide'"
},
"value": "some usage guide"
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 450,
"end": 478,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 30
}
},
"expression": {
"type": "CallExpression",
"start": 450,
"end": 477,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 29
}
},
"callee": {
"type": "Identifier",
"start": 450,
"end": 461,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 13
},
"identifierName": "createStubs"
},
"name": "createStubs"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 462,
"end": 476,
"loc": {
"start": {
"line": 18,
"column": 14
},
"end": {
"line": 18,
"column": 28
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 464,
"end": 474,
"loc": {
"start": {
"line": 18,
"column": 16
},
"end": {
"line": 18,
"column": 26
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 464,
"end": 474,
"loc": {
"start": {
"line": 18,
"column": 16
},
"end": {
"line": 18,
"column": 26
},
"identifierName": "usageGuide"
},
"name": "usageGuide"
},
"value": {
"type": "Identifier",
"start": 464,
"end": 474,
"loc": {
"start": {
"line": 18,
"column": 16
},
"end": {
"line": 18,
"column": 26
},
"identifierName": "usageGuide"
},
"name": "usageGuide"
},
"extra": {
"shorthand": true
}
}
]
}
]
}
},
{
"type": "ExpressionStatement",
"start": 482,
"end": 489,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 9
}
},
"expression": {
"type": "CallExpression",
"start": 482,
"end": 488,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 8
}
},
"callee": {
"type": "Identifier",
"start": 482,
"end": 486,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 6
},
"