mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,645 lines (1,644 loc) • 79.5 kB
JSON
{
"type": "File",
"start": 0,
"end": 405,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 19,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 405,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 19,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportNamedDeclaration",
"start": 44,
"end": 209,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 9,
"column": 2
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "VariableDeclaration",
"start": 51,
"end": 209,
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 9,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 57,
"end": 208,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 9,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 57,
"end": 68,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 5,
"column": 24
},
"identifierName": "mockImports"
},
"name": "mockImports",
"leadingComments": null
},
"init": {
"type": "ArrowFunctionExpression",
"start": 71,
"end": 208,
"loc": {
"start": {
"line": 5,
"column": 27
},
"end": {
"line": 9,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 57,
"end": 68,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 5,
"column": 24
},
"identifierName": "mockImports"
},
"name": "mockImports",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 72,
"end": 98,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 5,
"column": 54
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 74,
"end": 89,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 45
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 74,
"end": 89,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 45
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"value": {
"type": "Identifier",
"start": 74,
"end": 89,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 45
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 91,
"end": 96,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 52
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 91,
"end": 96,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 52
},
"identifierName": "mocks"
},
"name": "mocks"
},
"value": {
"type": "Identifier",
"start": 91,
"end": 96,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 52
},
"identifierName": "mocks"
},
"name": "mocks"
},
"extra": {
"shorthand": true
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start": 103,
"end": 208,
"loc": {
"start": {
"line": 5,
"column": 59
},
"end": {
"line": 9,
"column": 1
}
},
"body": [
{
"type": "ForOfStatement",
"start": 107,
"end": 206,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 8,
"column": 3
}
},
"left": {
"type": "VariableDeclaration",
"start": 112,
"end": 130,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 25
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 118,
"end": 130,
"loc": {
"start": {
"line": 6,
"column": 13
},
"end": {
"line": 6,
"column": 25
}
},
"id": {
"type": "ArrayPattern",
"start": 118,
"end": 130,
"loc": {
"start": {
"line": 6,
"column": 13
},
"end": {
"line": 6,
"column": 25
}
},
"elements": [
{
"type": "Identifier",
"start": 119,
"end": 123,
"loc": {
"start": {
"line": 6,
"column": 14
},
"end": {
"line": 6,
"column": 18
},
"identifierName": "name"
},
"name": "name"
},
{
"type": "Identifier",
"start": 125,
"end": 129,
"loc": {
"start": {
"line": 6,
"column": 20
},
"end": {
"line": 6,
"column": 24
},
"identifierName": "mock"
},
"name": "mock"
}
]
},
"init": null
}
],
"kind": "const"
},
"right": {
"type": "CallExpression",
"start": 134,
"end": 155,
"loc": {
"start": {
"line": 6,
"column": 29
},
"end": {
"line": 6,
"column": 50
}
},
"callee": {
"type": "MemberExpression",
"start": 134,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 29
},
"end": {
"line": 6,
"column": 43
}
},
"object": {
"type": "Identifier",
"start": 134,
"end": 140,
"loc": {
"start": {
"line": 6,
"column": 29
},
"end": {
"line": 6,
"column": 35
},
"identifierName": "Object"
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 141,
"end": 148,
"loc": {
"start": {
"line": 6,
"column": 36
},
"end": {
"line": 6,
"column": 43
},
"identifierName": "entries"
},
"name": "entries"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 149,
"end": 154,
"loc": {
"start": {
"line": 6,
"column": 44
},
"end": {
"line": 6,
"column": 49
},
"identifierName": "mocks"
},
"name": "mocks"
}
]
},
"body": {
"type": "BlockStatement",
"start": 157,
"end": 206,
"loc": {
"start": {
"line": 6,
"column": 52
},
"end": {
"line": 8,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 163,
"end": 202,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 43
}
},
"expression": {
"type": "CallExpression",
"start": 163,
"end": 201,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 163,
"end": 189,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 30
}
},
"object": {
"type": "Identifier",
"start": 163,
"end": 178,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 19
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"property": {
"type": "Identifier",
"start": 179,
"end": 189,
"loc": {
"start": {
"line": 7,
"column": 20
},
"end": {
"line": 7,
"column": 30
},
"identifierName": "__Rewire__"
},
"name": "__Rewire__"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 190,
"end": 194,
"loc": {
"start": {
"line": 7,
"column": 31
},
"end": {
"line": 7,
"column": 35
},
"identifierName": "name"
},
"name": "name"
},
{
"type": "Identifier",
"start": 196,
"end": 200,
"loc": {
"start": {
"line": 7,
"column": 37
},
"end": {
"line": 7,
"column": 41
},
"identifierName": "mock"
},
"name": "mock"
}
]
}
}
],
"directives": []
}
}
],
"directives": []
}
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Mock imports in test\n * @private\n ",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Reset imports in test\n * @private\n ",
"start": 210,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Mock imports in test\n * @private\n ",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Reset imports in test\n * @private\n ",
"start": 210,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 255,
"end": 404,
"loc": {
"start": {
"line": 14,
"column": 0
},
"end": {
"line": 18,
"column": 2
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "VariableDeclaration",
"start": 262,
"end": 404,
"loc": {
"start": {
"line": 14,
"column": 7
},
"end": {
"line": 18,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 268,
"end": 403,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 18,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 268,
"end": 280,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 25
},
"identifierName": "resetImports"
},
"name": "resetImports",
"leadingComments": null
},
"init": {
"type": "ArrowFunctionExpression",
"start": 283,
"end": 403,
"loc": {
"start": {
"line": 14,
"column": 28
},
"end": {
"line": 18,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 268,
"end": 280,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 25
},
"identifierName": "resetImports"
},
"name": "resetImports",
"leadingComments": null
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 284,
"end": 312,
"loc": {
"start": {
"line": 14,
"column": 29
},
"end": {
"line": 14,
"column": 57
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 286,
"end": 301,
"loc": {
"start": {
"line": 14,
"column": 31
},
"end": {
"line": 14,
"column": 46
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 286,
"end": 301,
"loc": {
"start": {
"line": 14,
"column": 31
},
"end": {
"line": 14,
"column": 46
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"value": {
"type": "Identifier",
"start": 286,
"end": 301,
"loc": {
"start": {
"line": 14,
"column": 31
},
"end": {
"line": 14,
"column": 46
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 303,
"end": 310,
"loc": {
"start": {
"line": 14,
"column": 48
},
"end": {
"line": 14,
"column": 55
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 303,
"end": 310,
"loc": {
"start": {
"line": 14,
"column": 48
},
"end": {
"line": 14,
"column": 55
},
"identifierName": "imports"
},
"name": "imports"
},
"value": {
"type": "Identifier",
"start": 303,
"end": 310,
"loc": {
"start": {
"line": 14,
"column": 48
},
"end": {
"line": 14,
"column": 55
},
"identifierName": "imports"
},
"name": "imports"
},
"extra": {
"shorthand": true
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start": 317,
"end": 403,
"loc": {
"start": {
"line": 14,
"column": 62
},
"end": {
"line": 18,
"column": 1
}
},
"body": [
{
"type": "ForOfStatement",
"start": 321,
"end": 401,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 17,
"column": 3
}
},
"left": {
"type": "VariableDeclaration",
"start": 326,
"end": 336,
"loc": {
"start": {
"line": 15,
"column": 7
},
"end": {
"line": 15,
"column": 17
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 332,
"end": 336,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 17
}
},
"id": {
"type": "Identifier",
"start": 332,
"end": 336,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 17
},
"identifierName": "name"
},
"name": "name"
},
"init": null
}
],
"kind": "const"
},
"right": {
"type": "Identifier",
"start": 340,
"end": 347,
"loc": {
"start": {
"line": 15,
"column": 21
},
"end": {
"line": 15,
"column": 28
},
"identifierName": "imports"
},
"name": "imports"
},
"body": {
"type": "BlockStatement",
"start": 349,
"end": 401,
"loc": {
"start": {
"line": 15,
"column": 30
},
"end": {
"line": 17,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 355,
"end": 397,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 46
}
},
"expression": {
"type": "CallExpression",
"start": 355,
"end": 396,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 45
}
},
"callee": {
"type": "MemberExpression",
"start": 355,
"end": 390,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 355,
"end": 370,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 19
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"property": {
"type": "Identifier",
"start": 371,
"end": 390,
"loc": {
"start": {
"line": 16,
"column": 20
},
"end": {
"line": 16,
"column": 39
},
"identifierName": "__ResetDependency__"
},
"name": "__ResetDependency__"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 391,
"end": 395,
"loc": {
"start": {
"line": 16,
"column": 40
},
"end": {
"line": 16,
"column": 44
},
"identifierName": "name"
},
"name": "name"
}
]
}
}
],
"directives": []
}
}
],
"directives": []
}
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Reset imports in test\n * @private\n ",
"start": 210,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
}
}
],
"trailingComments": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Reset imports in test\n * @private\n ",
"start": 210,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\n * Mock imports in test\n * @private\n ",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Reset imports in test\n * @private\n ",
"start": 210,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
}
}
],
"tokens": [
{
"type": "CommentBlock",
"value": "*\n * Mock imports in test\n * @private\n ",
"start": 0,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"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": 44,
"end": 50,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 6
}
}
},
{
"type": {
"label": "const",
"keyword": "const",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "const",
"start": 51,
"end": 56,
"loc": {
"start": {
"line": 5,
"column": 7
},
"end": {
"line": 5,
"column": 12
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "mockImports",
"start": 57,
"end": 68,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 5,
"column": 24
}
}
},
{
"type": {
"label": "=",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": true,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "=",
"start": 69,
"end": 70,
"loc": {
"start": {
"line": 5,
"column": 25
},
"end": {
"line": 5,
"column": 26
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 71,
"end": 72,
"loc": {
"start": {
"line": 5,
"column": 27
},
"end": {
"line": 5,
"column": 28
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 72,
"end": 73,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 5,
"column": 29
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "moduleRewireAPI",
"start": 74,
"end": 89,
"loc": {
"start": {
"line": 5,
"column": 30
},
"end": {
"line": 5,
"column": 45
}
}
},
{
"type": {
"label": ",",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 89,
"end": 90,
"loc": {
"start": {
"line": 5,
"column": 45
},
"end": {
"line": 5,
"column": 46
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "mocks",
"start": 91,
"end": 96,
"loc": {
"start": {
"line": 5,
"column": 47
},
"end": {
"line": 5,
"column": 52
}
}
},
{
"type": {
"label": "}",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 97,
"end": 98,
"loc": {
"start": {
"line": 5,
"column": 53
},
"end": {
"line": 5,
"column": 54
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 98,
"end": 99,
"loc": {
"start": {
"line": 5,
"column": 54
},
"end": {
"line": 5,
"column": 55
}
}
},
{
"type": {
"label": "=>",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 100,
"end": 102,
"loc": {
"start": {
"line": 5,
"column": 56
},
"end": {
"line": 5,
"column": 58
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 103,
"end": 104,
"loc": {
"start": {
"line": 5,
"column": 59
},
"end": {
"line": 5,
"column": 60
}
}
},
{
"type": {
"label": "for",
"keyword": "for",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": true,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "for",
"start": 107,
"end": 110,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 5
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 111,
"end": 112,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 7
}
}
},
{
"type": {
"label": "const",
"keyword": "const",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "const",
"start": 112,
"end": 117,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 12
}
}
},
{
"type": {
"label": "[",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,