mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,281 lines (1,280 loc) • 504 kB
JSON
{
"type": "File",
"start": 0,
"end": 3058,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 102,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3058,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 102,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 26
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "chalk"
},
"name": "chalk"
}
}
],
"source": {
"type": "StringLiteral",
"start": 18,
"end": 25,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 25
}
},
"extra": {
"rawValue": "chalk",
"raw": "'chalk'"
},
"value": "chalk"
}
},
{
"type": "ImportDeclaration",
"start": 28,
"end": 77,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 49
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 35,
"end": 45,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 35,
"end": 45,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 17
},
"identifierName": "BaseLogger"
},
"name": "BaseLogger"
}
}
],
"source": {
"type": "StringLiteral",
"start": 51,
"end": 76,
"loc": {
"start": {
"line": 3,
"column": 23
},
"end": {
"line": 3,
"column": 48
}
},
"extra": {
"rawValue": "../../utils/base-logger",
"raw": "'../../utils/base-logger'"
},
"value": "../../utils/base-logger"
}
},
{
"type": "ImportDeclaration",
"start": 78,
"end": 117,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 39
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 87,
"end": 96,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 87,
"end": 96,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 18
},
"identifierName": "Installer"
},
"name": "Installer"
},
"local": {
"type": "Identifier",
"start": 87,
"end": 96,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 18
},
"identifierName": "Installer"
},
"name": "Installer"
}
}
],
"source": {
"type": "StringLiteral",
"start": 104,
"end": 116,
"loc": {
"start": {
"line": 4,
"column": 26
},
"end": {
"line": 4,
"column": 38
}
},
"extra": {
"rawValue": "../../core",
"raw": "'../../core'"
},
"value": "../../core"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Installer Logger\n ",
"start": 119,
"end": 146,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 147,
"end": 3057,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 101,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 162,
"end": 3057,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 101,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 168,
"end": 183,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 36
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 192,
"end": 202,
"loc": {
"start": {
"line": 9,
"column": 45
},
"end": {
"line": 9,
"column": 55
},
"identifierName": "BaseLogger"
},
"name": "BaseLogger"
},
"body": {
"type": "ClassBody",
"start": 203,
"end": 3057,
"loc": {
"start": {
"line": 9,
"column": 56
},
"end": {
"line": 101,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 420,
"end": 1768,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 54,
"column": 3
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 420,
"end": 424,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 6
},
"identifierName": "next"
},
"name": "next",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "ObjectPattern",
"start": 425,
"end": 442,
"loc": {
"start": {
"line": 16,
"column": 7
},
"end": {
"line": 16,
"column": 24
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 427,
"end": 431,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 13
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 427,
"end": 431,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 13
},
"identifierName": "type"
},
"name": "type"
},
"value": {
"type": "Identifier",
"start": 427,
"end": 431,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 13
},
"identifierName": "type"
},
"name": "type"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 433,
"end": 440,
"loc": {
"start": {
"line": 16,
"column": 15
},
"end": {
"line": 16,
"column": 22
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 433,
"end": 440,
"loc": {
"start": {
"line": 16,
"column": 15
},
"end": {
"line": 16,
"column": 22
},
"identifierName": "payload"
},
"name": "payload"
},
"value": {
"type": "Identifier",
"start": 433,
"end": 440,
"loc": {
"start": {
"line": 16,
"column": 15
},
"end": {
"line": 16,
"column": 22
},
"identifierName": "payload"
},
"name": "payload"
},
"extra": {
"shorthand": true
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start": 444,
"end": 1768,
"loc": {
"start": {
"line": 16,
"column": 26
},
"end": {
"line": 54,
"column": 3
}
},
"body": [
{
"type": "SwitchStatement",
"start": 450,
"end": 1764,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 53,
"column": 5
}
},
"discriminant": {
"type": "Identifier",
"start": 458,
"end": 462,
"loc": {
"start": {
"line": 17,
"column": 12
},
"end": {
"line": 17,
"column": 16
},
"identifierName": "type"
},
"name": "type"
},
"cases": [
{
"type": "SwitchCase",
"start": 472,
"end": 612,
"loc": {
"start": {
"line": 18,
"column": 6
},
"end": {
"line": 20,
"column": 14
}
},
"consequent": [
{
"type": "ExpressionStatement",
"start": 543,
"end": 597,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 62
}
},
"expression": {
"type": "CallExpression",
"start": 543,
"end": 596,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 61
}
},
"callee": {
"type": "MemberExpression",
"start": 543,
"end": 554,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 19
}
},
"object": {
"type": "Identifier",
"start": 543,
"end": 550,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 15
},
"identifierName": "console"
},
"name": "console"
},
"property": {
"type": "Identifier",
"start": 551,
"end": 554,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 19
},
"identifierName": "log"
},
"name": "log"
},
"computed": false
},
"arguments": [
{
"type": "TemplateLiteral",
"start": 555,
"end": 595,
"loc": {
"start": {
"line": 19,
"column": 20
},
"end": {
"line": 19,
"column": 60
}
},
"expressions": [
{
"type": "CallExpression",
"start": 558,
"end": 580,
"loc": {
"start": {
"line": 19,
"column": 23
},
"end": {
"line": 19,
"column": 45
}
},
"callee": {
"type": "MemberExpression",
"start": 558,
"end": 569,
"loc": {
"start": {
"line": 19,
"column": 23
},
"end": {
"line": 19,
"column": 34
}
},
"object": {
"type": "Identifier",
"start": 558,
"end": 563,
"loc": {
"start": {
"line": 19,
"column": 23
},
"end": {
"line": 19,
"column": 28
},
"identifierName": "chalk"
},
"name": "chalk"
},
"property": {
"type": "Identifier",
"start": 564,
"end": 569,
"loc": {
"start": {
"line": 19,
"column": 29
},
"end": {
"line": 19,
"column": 34
},
"identifierName": "green"
},
"name": "green"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 570,
"end": 579,
"loc": {
"start": {
"line": 19,
"column": 35
},
"end": {
"line": 19,
"column": 44
}
},
"extra": {
"rawValue": "UPDATED",
"raw": "'UPDATED'"
},
"value": "UPDATED"
}
]
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 556,
"end": 556,
"loc": {
"start": {
"line": 19,
"column": 21
},
"end": {
"line": 19,
"column": 21
}
},
"value": {
"raw": "",
"cooked": ""
},
"tail": false
},
{
"type": "TemplateElement",
"start": 581,
"end": 594,
"loc": {
"start": {
"line": 19,
"column": 46
},
"end": {
"line": 19,
"column": 59
}
},
"value": {
"raw": " package.json",
"cooked": " package.json"
},
"tail": true
}
]
}
]
}
},
{
"type": "BreakStatement",
"start": 606,
"end": 612,
"loc": {
"start": {
"line": 20,
"column": 8
},
"end": {
"line": 20,
"column": 14
}
},
"label": null
}
],
"test": {
"type": "MemberExpression",
"start": 477,
"end": 533,
"loc": {
"start": {
"line": 18,
"column": 11
},
"end": {
"line": 18,
"column": 67
}
},
"object": {
"type": "MemberExpression",
"start": 477,
"end": 497,
"loc": {
"start": {
"line": 18,
"column": 11
},
"end": {
"line": 18,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 477,
"end": 486,
"loc": {
"start": {
"line": 18,
"column": 11
},
"end": {
"line": 18,
"column": 20
},
"identifierName": "Installer"
},
"name": "Installer"
},
"property": {
"type": "Identifier",
"start": 487,
"end": 497,
"loc": {
"start": {
"line": 18,
"column": 21
},
"end": {
"line": 18,
"column": 31
},
"identifierName": "operations"
},
"name": "operations"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 498,
"end": 533,
"loc": {
"start": {
"line": 18,
"column": 32
},
"end": {
"line": 18,
"column": 67
},
"identifierName": "WRITE_USER_GENERETOR_CONFIG_SUCCESS"
},
"name": "WRITE_USER_GENERETOR_CONFIG_SUCCESS"
},
"computed": false
}
},
{
"type": "SwitchCase",
"start": 620,
"end": 873,
"loc": {
"start": {
"line": 22,
"column": 6
},
"end": {
"line": 29,
"column": 14
}
},
"consequent": [
{
"type": "ExpressionStatement",
"start": 716,
"end": 858,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 28,
"column": 10
}
},
"expression": {
"type": "CallExpression",
"start": 716,
"end": 857,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 28,
"column": 9
}
},
"callee": {
"type": "MemberExpression",
"start": 716,
"end": 727,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 19
}
},
"object": {
"type": "Identifier",
"start": 716,
"end": 723,
"loc": {
"start": {
"line": 24,
"column": 8
},
"end": {
"line": 24,
"column": 15
},
"identifierName": "console"
},
"name": "console"
},
"property": {
"type": "Identifier",
"start": 724,
"end": 727,
"loc": {
"start": {
"line": 24,
"column": 16
},
"end": {
"line": 24,
"column": 19
},
"identifierName": "log"
},
"name": "log"
},
"computed": false
},
"arguments": [
{
"type": "TemplateLiteral",
"start": 739,
"end": 847,
"loc": {
"start": {
"line": 25,
"column": 10
},
"end": {
"line": 27,
"column": 31
}
},
"expressions": [
{
"type": "CallExpression",
"start": 742,
"end": 762,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 33
}
},
"callee": {
"type": "MemberExpression",
"start": 742,
"end": 754,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 25
}
},
"object": {
"type": "Identifier",
"start": 742,
"end": 747,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 18
},
"identifierName": "chalk"
},
"name": "chalk"
},
"property": {
"type": "Identifier",
"start": 748,
"end": 754,
"loc": {
"start": {
"line": 25,
"column": 19
},
"end": {
"line": 25,
"column": 25
},
"identifierName": "yellow"
},
"name": "yellow"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 755,
"end": 761,
"loc": {
"start": {
"line": 25,
"column": 26
},
"end": {
"line": 25,
"column": 32
}
},
"extra": {
"rawValue": "SKIP",
"raw": "'SKIP'"
},
"value": "SKIP"
}
]
},
{
"type": "MemberExpression",
"start": 779,
"end": 815,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 48
}
},
"object": {
"type": "Identifier",
"start": 779,
"end": 786,
"loc": {
"start": {
"line": 26,
"column": 12
},
"end": {
"line": 26,
"column": 19
},
"identifierName": "payload"
},
"name": "payload"
},
"property": {
"type": "Identifier",
"start": 787,
"end": 815,
"loc": {
"start": {
"line": 26,
"column": 20
},
"end": {
"line": 26,
"column": 48
},
"identifierName": "customSeederTemplateFilename"
},
"name": "customSeederTemplateFilename"
},
"computed": false
}
],
"quasis": [
{
"type": "TemplateElement",
"start": 740,
"end": 740,
"loc": {
"start": {
"line": 25,
"column": 11
},
"end": {
"line": 25,
"column": 11
}
},
"value": {
"raw": "",
"cooked": ""
},
"tail": false
},
{
"type": "TemplateElement",
"start": 763,
"end": 764,
"loc": {
"start": {
"line": 25,
"column": 34
},
"end": {
"line": 25,
"column": 35
}
},
"value": {
"raw": " ",
"cooked": " "
},
"tail": false
},
{
"type": "TemplateElement",
"start": 827,
"end": 846,
"loc": {
"start": {
"line": 27,
"column": 11
},
"end": {
"line": 27,
"column": 30
}
},
"value": {
"raw": " are already exists",
"cooked": " are already exists"
},
"tail": true
}
]
}
]
}
},
{
"type": "BreakStatement",
"start": 867,
"end": 873,
"loc": {
"start": {
"line": 29,
"column": 8
},
"end": {
"line": 29,
"column": 14
}
},
"label": null
}
],
"test": {
"type": "MemberExpression",
"start": 625,
"end": 706,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 23,
"column": 60
}
},
"object": {
"type": "MemberExpression",
"start": 625,
"end": 645,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 625,
"end": 634,
"loc": {
"start": {
"line": 22,
"column": 11
},
"end": {
"line": 22,
"column": 20
},