mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,633 lines • 76.7 kB
JSON
{
"type": "File",
"start": 0,
"end": 462,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 26,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 462,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 26,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 23,
"end": 461,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 25,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 38,
"end": 461,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 25,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 44,
"end": 54,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 31
},
"identifierName": "BaseLogger"
},
"name": "BaseLogger",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 55,
"end": 461,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 25,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 232,
"end": 415,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 18,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 232,
"end": 242,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 12
},
"identifierName": "asObserver"
},
"name": "asObserver",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 245,
"end": 415,
"loc": {
"start": {
"line": 12,
"column": 15
},
"end": {
"line": 18,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 251,
"end": 411,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 17,
"column": 6
}
},
"argument": {
"type": "ObjectExpression",
"start": 258,
"end": 410,
"loc": {
"start": {
"line": 13,
"column": 11
},
"end": {
"line": 17,
"column": 5
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 266,
"end": 303,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 43
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 266,
"end": 270,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 10
},
"identifierName": "next"
},
"name": "next"
},
"value": {
"type": "ArrowFunctionExpression",
"start": 272,
"end": 303,
"loc": {
"start": {
"line": 14,
"column": 12
},
"end": {
"line": 14,
"column": 43
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "RestElement",
"start": 273,
"end": 280,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 20
}
},
"argument": {
"type": "Identifier",
"start": 276,
"end": 280,
"loc": {
"start": {
"line": 14,
"column": 16
},
"end": {
"line": 14,
"column": 20
},
"identifierName": "args"
},
"name": "args"
}
}
],
"body": {
"type": "CallExpression",
"start": 285,
"end": 303,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 285,
"end": 294,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 34
}
},
"object": {
"type": "ThisExpression",
"start": 285,
"end": 289,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 29
}
}
},
"property": {
"type": "Identifier",
"start": 290,
"end": 294,
"loc": {
"start": {
"line": 14,
"column": 30
},
"end": {
"line": 14,
"column": 34
},
"identifierName": "next"
},
"name": "next"
},
"computed": false
},
"arguments": [
{
"type": "SpreadElement",
"start": 295,
"end": 302,
"loc": {
"start": {
"line": 14,
"column": 35
},
"end": {
"line": 14,
"column": 42
}
},
"argument": {
"type": "Identifier",
"start": 298,
"end": 302,
"loc": {
"start": {
"line": 14,
"column": 38
},
"end": {
"line": 14,
"column": 42
},
"identifierName": "args"
},
"name": "args"
}
}
]
}
}
},
{
"type": "ObjectProperty",
"start": 311,
"end": 350,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 15,
"column": 45
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 311,
"end": 316,
"loc": {
"start": {
"line": 15,
"column": 6
},
"end": {
"line": 15,
"column": 11
},
"identifierName": "error"
},
"name": "error"
},
"value": {
"type": "ArrowFunctionExpression",
"start": 318,
"end": 350,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 45
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "RestElement",
"start": 319,
"end": 326,
"loc": {
"start": {
"line": 15,
"column": 14
},
"end": {
"line": 15,
"column": 21
}
},
"argument": {
"type": "Identifier",
"start": 322,
"end": 326,
"loc": {
"start": {
"line": 15,
"column": 17
},
"end": {
"line": 15,
"column": 21
},
"identifierName": "args"
},
"name": "args"
}
}
],
"body": {
"type": "CallExpression",
"start": 331,
"end": 350,
"loc": {
"start": {
"line": 15,
"column": 26
},
"end": {
"line": 15,
"column": 45
}
},
"callee": {
"type": "MemberExpression",
"start": 331,
"end": 341,
"loc": {
"start": {
"line": 15,
"column": 26
},
"end": {
"line": 15,
"column": 36
}
},
"object": {
"type": "ThisExpression",
"start": 331,
"end": 335,
"loc": {
"start": {
"line": 15,
"column": 26
},
"end": {
"line": 15,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"start": 336,
"end": 341,
"loc": {
"start": {
"line": 15,
"column": 31
},
"end": {
"line": 15,
"column": 36
},
"identifierName": "error"
},
"name": "error"
},
"computed": false
},
"arguments": [
{
"type": "SpreadElement",
"start": 342,
"end": 349,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 15,
"column": 44
}
},
"argument": {
"type": "Identifier",
"start": 345,
"end": 349,
"loc": {
"start": {
"line": 15,
"column": 40
},
"end": {
"line": 15,
"column": 44
},
"identifierName": "args"
},
"name": "args"
}
}
]
}
}
},
{
"type": "ObjectProperty",
"start": 358,
"end": 403,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 16,
"column": 51
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 358,
"end": 366,
"loc": {
"start": {
"line": 16,
"column": 6
},
"end": {
"line": 16,
"column": 14
},
"identifierName": "complete"
},
"name": "complete"
},
"value": {
"type": "ArrowFunctionExpression",
"start": 368,
"end": 403,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 16,
"column": 51
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [
{
"type": "RestElement",
"start": 369,
"end": 376,
"loc": {
"start": {
"line": 16,
"column": 17
},
"end": {
"line": 16,
"column": 24
}
},
"argument": {
"type": "Identifier",
"start": 372,
"end": 376,
"loc": {
"start": {
"line": 16,
"column": 20
},
"end": {
"line": 16,
"column": 24
},
"identifierName": "args"
},
"name": "args"
}
}
],
"body": {
"type": "CallExpression",
"start": 381,
"end": 403,
"loc": {
"start": {
"line": 16,
"column": 29
},
"end": {
"line": 16,
"column": 51
}
},
"callee": {
"type": "MemberExpression",
"start": 381,
"end": 394,
"loc": {
"start": {
"line": 16,
"column": 29
},
"end": {
"line": 16,
"column": 42
}
},
"object": {
"type": "ThisExpression",
"start": 381,
"end": 385,
"loc": {
"start": {
"line": 16,
"column": 29
},
"end": {
"line": 16,
"column": 33
}
}
},
"property": {
"type": "Identifier",
"start": 386,
"end": 394,
"loc": {
"start": {
"line": 16,
"column": 34
},
"end": {
"line": 16,
"column": 42
},
"identifierName": "complete"
},
"name": "complete"
},
"computed": false
},
"arguments": [
{
"type": "SpreadElement",
"start": 395,
"end": 402,
"loc": {
"start": {
"line": 16,
"column": 43
},
"end": {
"line": 16,
"column": 50
}
},
"argument": {
"type": "Identifier",
"start": 398,
"end": 402,
"loc": {
"start": {
"line": 16,
"column": 46
},
"end": {
"line": 16,
"column": 50
},
"identifierName": "args"
},
"name": "args"
}
}
]
}
}
}
]
}
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Get the logger as observer\n * @return {Object} observer\n * @property {Function} next\n * @property {Function} error\n * @property {Function} complete\n ",
"start": 59,
"end": 229,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
]
},
{
"type": "ClassMethod",
"start": 419,
"end": 428,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 11
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 419,
"end": 423,
"loc": {
"start": {
"line": 20,
"column": 2
},
"end": {
"line": 20,
"column": 6
},
"identifierName": "next"
},
"name": "next"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 426,
"end": 428,
"loc": {
"start": {
"line": 20,
"column": 9
},
"end": {
"line": 20,
"column": 11
}
},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 432,
"end": 442,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 22,
"column": 12
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 432,
"end": 437,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 22,
"column": 7
},
"identifierName": "error"
},
"name": "error"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 440,
"end": 442,
"loc": {
"start": {
"line": 22,
"column": 10
},
"end": {
"line": 22,
"column": 12
}
},
"body": [],
"directives": []
}
},
{
"type": "ClassMethod",
"start": 446,
"end": 459,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 24,
"column": 15
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 446,
"end": 454,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 24,
"column": 10
},
"identifierName": "complete"
},
"name": "complete"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 457,
"end": 459,
"loc": {
"start": {
"line": 24,
"column": 13
},
"end": {
"line": 24,
"column": 15
}
},
"body": [],
"directives": []
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Base Logger\n ",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
}
],
"trailingComments": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Base Logger\n ",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\n * Base Logger\n ",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Get the logger as observer\n * @return {Object} observer\n * @property {Function} next\n * @property {Function} error\n * @property {Function} complete\n ",
"start": 59,
"end": 229,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
}
],
"tokens": [
{
"type": "CommentBlock",
"value": "*\n * Base Logger\n ",
"start": 0,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"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": 23,
"end": 29,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 6
}
}
},
{
"type": {
"label": "default",
"keyword": "default",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "default",
"start": 30,
"end": 37,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 14
}
}
},
{
"type": {
"label": "class",
"keyword": "class",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "class",
"start": 38,
"end": 43,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 4,
"column": 20
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "BaseLogger",
"start": 44,
"end": 54,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 31
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 55,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 33
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Get the logger as observer\n * @return {Object} observer\n * @property {Function} next\n * @property {Function} error\n * @property {Function} complete\n ",
"start": 59,
"end": 229,
"loc": {
"start": {
"line": 5,
"column": 2
},
"end": {
"line": 11,
"column": 5
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "asObserver",
"start": 232,
"end": 242,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 12
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 242,
"end": 243,
"loc": {
"start": {
"line": 12,
"column": 12
},
"end": {
"line": 12,
"column": 13
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 243,
"end": 244,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 14
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 245,
"end": 246,
"loc": {
"start": {
"line": 12,
"column": 15
},
"end": {
"line": 12,
"column": 16
}
}
},
{
"type": {
"label": "return",
"keyword": "return",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "return",
"start": 251,
"end": 257,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 10
}
}
},
{
"type": {
"label": "{",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 258,
"end": 259,
"loc": {
"start": {
"line": 13,
"column": 11
},
"end": {
"line": 13,
"column": 12
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "next",
"start": 266,
"end": 270,
"loc": {
"start": {
"line": 14,
"column": 6
},
"end": {
"line": 14,
"column": 10
}
}
},
{
"type": {
"label": ":",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 270,
"end": 271,
"loc": {
"start": {
"line": 14,
"column": 10
},
"end": {
"line": 14,
"column": 11
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 272,
"end": 273,
"loc": {
"start": {
"line": 14,
"column": 12
},
"end": {
"line": 14,
"column": 13
}
}
},
{
"type": {
"label": "...",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 273,
"end": 276,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 16
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "args",
"start": 276,
"end": 280,
"loc": {
"start": {
"line": 14,
"column": 16
},
"end": {
"line": 14,
"column": 20
}
}
},
{
"type": {
"label": ")",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 280,
"end": 281,
"loc": {
"start": {
"line": 14,
"column": 20
},
"end": {
"line": 14,
"column": 21
}
}
},
{
"type": {
"label": "=>",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 282,
"end": 284,
"loc": {
"start": {
"line": 14,
"column": 22
},
"end": {
"line": 14,
"column": 24
}
}
},
{
"type": {
"label": "this",
"keyword": "this",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"value": "this",
"start": 285,
"end": 289,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 29
}
}
},
{
"type": {
"label": ".",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 289,
"end": 290,
"loc": {
"start": {
"line": 14,
"column": 29
},
"end": {
"line": 14,
"column": 30
}
}
},
{
"type": {
"label": "name",
"beforeExpr": false,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"value": "next",
"start": 290,
"end": 294,
"loc": {
"start": {
"line": 14,
"column": 30
},
"end": {
"line": 14,
"column": 34
}
}
},
{
"type": {
"label": "(",
"beforeExpr": true,
"startsExpr": true,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null
},
"start": 294,
"end": 295,
"loc": {
"start": {
"line": 14,
"column": 34
},
"end": {
"line": 14,
"column": 35
}
}
},
{
"type": {
"label": "...",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 295,
"end": 298,
"loc": {
"start": {
"line": 14,
"column": 35
},
"end":