mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,454 lines (1,453 loc) • 220 kB
JSON
{
"type": "File",
"start": 0,
"end": 907,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 37,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 907,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 37,
"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": 91,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 39
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 59,
"end": 69,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 59,
"end": 69,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 17
},
"identifierName": "BaseLogger"
},
"name": "BaseLogger"
}
}
],
"source": {
"type": "StringLiteral",
"start": 75,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 23
},
"end": {
"line": 4,
"column": 38
}
},
"extra": {
"rawValue": "./base-logger",
"raw": "'./base-logger'"
},
"value": "./base-logger"
}
},
{
"type": "ExpressionStatement",
"start": 93,
"end": 292,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 14,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 93,
"end": 291,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 93,
"end": 97,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 98,
"end": 141,
"loc": {
"start": {
"line": 6,
"column": 5
},
"end": {
"line": 6,
"column": 48
}
},
"extra": {
"rawValue": "Should create a installer-logger instance",
"raw": "'Should create a installer-logger instance'"
},
"value": "Should create a installer-logger instance"
},
{
"type": "ArrowFunctionExpression",
"start": 143,
"end": 290,
"loc": {
"start": {
"line": 6,
"column": 50
},
"end": {
"line": 14,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 143,
"end": 144,
"loc": {
"start": {
"line": 6,
"column": 50
},
"end": {
"line": 6,
"column": 51
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 148,
"end": 290,
"loc": {
"start": {
"line": 6,
"column": 55
},
"end": {
"line": 14,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 152,
"end": 184,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 34
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 158,
"end": 183,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 33
}
},
"id": {
"type": "Identifier",
"start": 158,
"end": 164,
"loc": {
"start": {
"line": 7,
"column": 8
},
"end": {
"line": 7,
"column": 14
},
"identifierName": "logger"
},
"name": "logger"
},
"init": {
"type": "NewExpression",
"start": 167,
"end": 183,
"loc": {
"start": {
"line": 7,
"column": 17
},
"end": {
"line": 7,
"column": 33
}
},
"callee": {
"type": "Identifier",
"start": 171,
"end": 181,
"loc": {
"start": {
"line": 7,
"column": 21
},
"end": {
"line": 7,
"column": 31
},
"identifierName": "BaseLogger"
},
"name": "BaseLogger"
},
"arguments": []
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 188,
"end": 202,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 16
}
},
"expression": {
"type": "CallExpression",
"start": 188,
"end": 201,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 15
}
},
"callee": {
"type": "MemberExpression",
"start": 188,
"end": 199,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 188,
"end": 194,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 8
},
"identifierName": "logger"
},
"name": "logger"
},
"property": {
"type": "Identifier",
"start": 195,
"end": 199,
"loc": {
"start": {
"line": 9,
"column": 9
},
"end": {
"line": 9,
"column": 13
},
"identifierName": "next"
},
"name": "next"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 205,
"end": 220,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 17
}
},
"expression": {
"type": "CallExpression",
"start": 205,
"end": 219,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 16
}
},
"callee": {
"type": "MemberExpression",
"start": 205,
"end": 217,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 205,
"end": 211,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 8
},
"identifierName": "logger"
},
"name": "logger"
},
"property": {
"type": "Identifier",
"start": 212,
"end": 217,
"loc": {
"start": {
"line": 10,
"column": 9
},
"end": {
"line": 10,
"column": 14
},
"identifierName": "error"
},
"name": "error"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 223,
"end": 241,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 20
}
},
"expression": {
"type": "CallExpression",
"start": 223,
"end": 240,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 19
}
},
"callee": {
"type": "MemberExpression",
"start": 223,
"end": 238,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 223,
"end": 229,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 8
},
"identifierName": "logger"
},
"name": "logger"
},
"property": {
"type": "Identifier",
"start": 230,
"end": 238,
"loc": {
"start": {
"line": 11,
"column": 9
},
"end": {
"line": 11,
"column": 17
},
"identifierName": "complete"
},
"name": "complete"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 245,
"end": 288,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 45
}
},
"expression": {
"type": "CallExpression",
"start": 245,
"end": 287,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 44
}
},
"callee": {
"type": "MemberExpression",
"start": 245,
"end": 249,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 245,
"end": 246,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 247,
"end": 249,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "UnaryExpression",
"start": 250,
"end": 274,
"loc": {
"start": {
"line": 13,
"column": 7
},
"end": {
"line": 13,
"column": 31
}
},
"operator": "typeof",
"prefix": true,
"argument": {
"type": "MemberExpression",
"start": 257,
"end": 274,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 257,
"end": 263,
"loc": {
"start": {
"line": 13,
"column": 14
},
"end": {
"line": 13,
"column": 20
},
"identifierName": "logger"
},
"name": "logger"
},
"property": {
"type": "Identifier",
"start": 264,
"end": 274,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 31
},
"identifierName": "asObserver"
},
"name": "asObserver"
},
"computed": false
},
"extra": {
"parenthesizedArgument": false
}
},
{
"type": "StringLiteral",
"start": 276,
"end": 286,
"loc": {
"start": {
"line": 13,
"column": 33
},
"end": {
"line": 13,
"column": 43
}
},
"extra": {
"rawValue": "function",
"raw": "'function'"
},
"value": "function"
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 294,
"end": 906,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 294,
"end": 905,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 36,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 294,
"end": 298,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 16,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 299,
"end": 323,
"loc": {
"start": {
"line": 16,
"column": 5
},
"end": {
"line": 16,
"column": 29
}
},
"extra": {
"rawValue": "Should return observer",
"raw": "'Should return observer'"
},
"value": "Should return observer"
},
{
"type": "ArrowFunctionExpression",
"start": 325,
"end": 904,
"loc": {
"start": {
"line": 16,
"column": 31
},
"end": {
"line": 36,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 325,
"end": 326,
"loc": {
"start": {
"line": 16,
"column": 31
},
"end": {
"line": 16,
"column": 32
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 330,
"end": 904,
"loc": {
"start": {
"line": 16,
"column": 36
},
"end": {
"line": 36,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 334,
"end": 433,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 21,
"column": 4
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 340,
"end": 432,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 21,
"column": 3
}
},
"id": {
"type": "Identifier",
"start": 340,
"end": 347,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 15
},
"identifierName": "context"
},
"name": "context"
},
"init": {
"type": "ObjectExpression",
"start": 350,
"end": 432,
"loc": {
"start": {
"line": 17,
"column": 18
},
"end": {
"line": 21,
"column": 3
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 356,
"end": 374,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 22
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 356,
"end": 360,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 8
},
"identifierName": "next"
},
"name": "next"
},
"value": {
"type": "CallExpression",
"start": 362,
"end": 374,
"loc": {
"start": {
"line": 18,
"column": 10
},
"end": {
"line": 18,
"column": 22
}
},
"callee": {
"type": "MemberExpression",
"start": 362,
"end": 372,
"loc": {
"start": {
"line": 18,
"column": 10
},
"end": {
"line": 18,
"column": 20
}
},
"object": {
"type": "Identifier",
"start": 362,
"end": 367,
"loc": {
"start": {
"line": 18,
"column": 10
},
"end": {
"line": 18,
"column": 15
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 368,
"end": 372,
"loc": {
"start": {
"line": 18,
"column": 16
},
"end": {
"line": 18,
"column": 20
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ObjectProperty",
"start": 380,
"end": 399,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 23
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 380,
"end": 385,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 9
},
"identifierName": "error"
},
"name": "error"
},
"value": {
"type": "CallExpression",
"start": 387,
"end": 399,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 23
}
},
"callee": {
"type": "MemberExpression",
"start": 387,
"end": 397,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 21
}
},
"object": {
"type": "Identifier",
"start": 387,
"end": 392,
"loc": {
"start": {
"line": 19,
"column": 11
},
"end": {
"line": 19,
"column": 16
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 393,
"end": 397,
"loc": {
"start": {
"line": 19,
"column": 17
},
"end": {
"line": 19,
"column": 21
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ObjectProperty",
"start": 405,
"end": 427,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 26
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 405,
"end": 413,
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 20,
"column": 12
},
"identifierName": "complete"
},
"name": "complete"
},
"value": {
"type": "CallExpression",
"start": 415,
"end": 427,
"loc": {
"start": {
"line": 20,
"column": 14
},
"end": {
"line": 20,
"column": 26
}
},
"callee": {
"type": "MemberExpression",
"start": 415,
"end": 425,
"loc": {
"start": {
"line": 20,
"column": 14
},
"end": {
"line": 20,
"column": 24
}
},
"object": {
"type": "Identifier",
"start": 415,
"end": 420,
"loc": {
"start": {
"line": 20,
"column": 14
},
"end": {
"line": 20,
"column": 19
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 421,
"end": 425,
"loc": {
"start": {
"line": 20,
"column": 20
},
"end": {
"line": 20,
"column": 24
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": []
}
}
]
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 437,
"end": 500,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 65
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 443,
"end": 499,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 64
}
},
"id": {
"type": "Identifier",
"start": 443,
"end": 451,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 16
},
"identifierName": "observer"
},
"name": "observer"
},
"init": {
"type": "CallExpression",
"start": 454,
"end": 499,
"loc": {
"start": {
"line": 23,
"column": 19
},
"end": {
"line": 23,
"column": 64
}
},
"callee": {
"type": "MemberExpression",
"start": 454,
"end": 490,
"loc": {
"start": {
"line": 23,
"column": 19
},
"end": {
"line": 23,
"column": 55
}
},
"object": {
"type": "MemberExpression",
"start": 454,
"end": 485,
"loc": {
"start": {
"line": 23,
"column": 19
},
"end": {
"line": 23,
"column": 50
}
},
"object": {
"type": "MemberExpression",
"start": 454,
"end": 474,
"loc": {
"start": {
"line": 23,
"column": 19
},
"end": {
"line": 23,
"column": 39
}
},
"object": {
"type": "Identifier",
"start": 454,