mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,687 lines • 136 kB
JSON
{
"type": "File",
"start": 0,
"end": 1066,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 58,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1066,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 58,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 34
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "generate"
},
"name": "generate"
}
}
],
"source": {
"type": "StringLiteral",
"start": 21,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 33
}
},
"extra": {
"rawValue": "./generate",
"raw": "'./generate'"
},
"value": "./generate"
}
},
{
"type": "ImportDeclaration",
"start": 35,
"end": 61,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 26
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 42,
"end": 46,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 42,
"end": 46,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 11
},
"identifierName": "help"
},
"name": "help"
}
}
],
"source": {
"type": "StringLiteral",
"start": 52,
"end": 60,
"loc": {
"start": {
"line": 2,
"column": 17
},
"end": {
"line": 2,
"column": 25
}
},
"extra": {
"rawValue": "./help",
"raw": "'./help'"
},
"value": "./help"
}
},
{
"type": "ImportDeclaration",
"start": 62,
"end": 88,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 26
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 69,
"end": 73,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 69,
"end": 73,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 11
},
"identifierName": "init"
},
"name": "init"
}
}
],
"source": {
"type": "StringLiteral",
"start": 79,
"end": 87,
"loc": {
"start": {
"line": 3,
"column": 17
},
"end": {
"line": 3,
"column": 25
}
},
"extra": {
"rawValue": "./init",
"raw": "'./init'"
},
"value": "./init"
}
},
{
"type": "ImportDeclaration",
"start": 89,
"end": 113,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 24
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 96,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 10
}
},
"local": {
"type": "Identifier",
"start": 96,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 10
},
"identifierName": "run"
},
"name": "run"
}
}
],
"source": {
"type": "StringLiteral",
"start": 105,
"end": 112,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 4,
"column": 23
}
},
"extra": {
"rawValue": "./run",
"raw": "'./run'"
},
"value": "./run"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command names\n *\n * Map command key to command name\n * @type {Map<string, string>}\n ",
"start": 115,
"end": 218,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 219,
"end": 317,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 17,
"column": 2
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "VariableDeclaration",
"start": 226,
"end": 317,
"loc": {
"start": {
"line": 12,
"column": 7
},
"end": {
"line": 17,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 232,
"end": 316,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 17,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 232,
"end": 240,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 21
},
"identifierName": "commands"
},
"name": "commands",
"leadingComments": null
},
"init": {
"type": "ObjectExpression",
"start": 243,
"end": 316,
"loc": {
"start": {
"line": 12,
"column": 24
},
"end": {
"line": 17,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 247,
"end": 267,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 22
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 247,
"end": 255,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 10
},
"identifierName": "GENERATE"
},
"name": "GENERATE"
},
"value": {
"type": "StringLiteral",
"start": 257,
"end": 267,
"loc": {
"start": {
"line": 13,
"column": 12
},
"end": {
"line": 13,
"column": 22
}
},
"extra": {
"rawValue": "generate",
"raw": "'generate'"
},
"value": "generate"
}
},
{
"type": "ObjectProperty",
"start": 271,
"end": 283,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 14
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 271,
"end": 275,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 6
},
"identifierName": "HELP"
},
"name": "HELP"
},
"value": {
"type": "StringLiteral",
"start": 277,
"end": 283,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 14
}
},
"extra": {
"rawValue": "help",
"raw": "'help'"
},
"value": "help"
}
},
{
"type": "ObjectProperty",
"start": 287,
"end": 299,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 14
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 287,
"end": 291,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 6
},
"identifierName": "INIT"
},
"name": "INIT"
},
"value": {
"type": "StringLiteral",
"start": 293,
"end": 299,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 14
}
},
"extra": {
"rawValue": "init",
"raw": "'init'"
},
"value": "init"
}
},
{
"type": "ObjectProperty",
"start": 303,
"end": 313,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 12
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 303,
"end": 306,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 5
},
"identifierName": "RUN"
},
"name": "RUN"
},
"value": {
"type": "StringLiteral",
"start": 308,
"end": 313,
"loc": {
"start": {
"line": 16,
"column": 7
},
"end": {
"line": 16,
"column": 12
}
},
"extra": {
"rawValue": "run",
"raw": "'run'"
},
"value": "run"
}
}
]
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command names\n *\n * Map command key to command name\n * @type {Map<string, string>}\n ",
"start": 115,
"end": 218,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command aliases\n *\n * Map alias to command name\n * @type {Map<string, string>}\n ",
"start": 319,
"end": 418,
"loc": {
"start": {
"line": 19,
"column": 0
},
"end": {
"line": 24,
"column": 3
}
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command names\n *\n * Map command key to command name\n * @type {Map<string, string>}\n ",
"start": 115,
"end": 218,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command aliases\n *\n * Map alias to command name\n * @type {Map<string, string>}\n ",
"start": 319,
"end": 418,
"loc": {
"start": {
"line": 19,
"column": 0
},
"end": {
"line": 24,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 419,
"end": 490,
"loc": {
"start": {
"line": 25,
"column": 0
},
"end": {
"line": 28,
"column": 2
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "VariableDeclaration",
"start": 426,
"end": 490,
"loc": {
"start": {
"line": 25,
"column": 7
},
"end": {
"line": 28,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 432,
"end": 489,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 28,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 432,
"end": 439,
"loc": {
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 20
},
"identifierName": "aliases"
},
"name": "aliases",
"leadingComments": null
},
"init": {
"type": "ObjectExpression",
"start": 442,
"end": 489,
"loc": {
"start": {
"line": 25,
"column": 23
},
"end": {
"line": 28,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 446,
"end": 466,
"loc": {
"start": {
"line": 26,
"column": 2
},
"end": {
"line": 26,
"column": 22
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 446,
"end": 447,
"loc": {
"start": {
"line": 26,
"column": 2
},
"end": {
"line": 26,
"column": 3
},
"identifierName": "g"
},
"name": "g"
},
"value": {
"type": "MemberExpression",
"start": 449,
"end": 466,
"loc": {
"start": {
"line": 26,
"column": 5
},
"end": {
"line": 26,
"column": 22
}
},
"object": {
"type": "Identifier",
"start": 449,
"end": 457,
"loc": {
"start": {
"line": 26,
"column": 5
},
"end": {
"line": 26,
"column": 13
},
"identifierName": "commands"
},
"name": "commands"
},
"property": {
"type": "Identifier",
"start": 458,
"end": 466,
"loc": {
"start": {
"line": 26,
"column": 14
},
"end": {
"line": 26,
"column": 22
},
"identifierName": "GENERATE"
},
"name": "GENERATE"
},
"computed": false
}
},
{
"type": "ObjectProperty",
"start": 470,
"end": 486,
"loc": {
"start": {
"line": 27,
"column": 2
},
"end": {
"line": 27,
"column": 18
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 470,
"end": 471,
"loc": {
"start": {
"line": 27,
"column": 2
},
"end": {
"line": 27,
"column": 3
},
"identifierName": "h"
},
"name": "h"
},
"value": {
"type": "MemberExpression",
"start": 473,
"end": 486,
"loc": {
"start": {
"line": 27,
"column": 5
},
"end": {
"line": 27,
"column": 18
}
},
"object": {
"type": "Identifier",
"start": 473,
"end": 481,
"loc": {
"start": {
"line": 27,
"column": 5
},
"end": {
"line": 27,
"column": 13
},
"identifierName": "commands"
},
"name": "commands"
},
"property": {
"type": "Identifier",
"start": 482,
"end": 486,
"loc": {
"start": {
"line": 27,
"column": 14
},
"end": {
"line": 27,
"column": 18
},
"identifierName": "HELP"
},
"name": "HELP"
},
"computed": false
}
}
]
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command aliases\n *\n * Map alias to command name\n * @type {Map<string, string>}\n ",
"start": 319,
"end": 418,
"loc": {
"start": {
"line": 19,
"column": 0
},
"end": {
"line": 24,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * All available command names as list (includes aliases)\n * @type {string[]}\n ",
"start": 492,
"end": 577,
"loc": {
"start": {
"line": 30,
"column": 0
},
"end": {
"line": 33,
"column": 3
}
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Available command aliases\n *\n * Map alias to command name\n * @type {Map<string, string>}\n ",
"start": 319,
"end": 418,
"loc": {
"start": {
"line": 19,
"column": 0
},
"end": {
"line": 24,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * All available command names as list (includes aliases)\n * @type {string[]}\n ",
"start": 492,
"end": 577,
"loc": {
"start": {
"line": 30,
"column": 0
},
"end": {
"line": 33,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 578,
"end": 714,
"loc": {
"start": {
"line": 34,
"column": 0
},
"end": {
"line": 38,
"column": 2
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "VariableDeclaration",
"start": 585,
"end": 714,
"loc": {
"start": {
"line": 34,
"column": 7
},
"end": {
"line": 38,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 591,
"end": 713,
"loc": {
"start": {
"line": 34,
"column": 13
},
"end": {
"line": 38,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 591,
"end": 612,
"loc": {
"start": {
"line": 34,
"column": 13
},
"end": {
"line": 34,
"column": 34
},
"identifierName": "availableCommandsList"
},
"name": "availableCommandsList",
"leadingComments": null
},
"init": {
"type": "ArrayExpression",
"start": 615,
"end": 713,
"loc": {
"start": {
"line": 34,
"column": 37
},
"end": {
"line": 38,
"column": 1
}
},
"elements": [
{
"type": "NullLiteral",
"start": 619,
"end": 623,
"loc": {
"start": {
"line": 35,
"column": 2
},
"end": {
"line": 35,
"column": 6
}
}
},
{
"type": "SpreadElement",
"start": 657,
"end": 683,
"loc": {
"start": {
"line": 36,
"column": 2
},
"end": {
"line": 36,
"column": 28
}
},
"argument": {
"type": "CallExpression",
"start": 660,
"end": 683,
"loc": {
"start": {
"line": 36,
"column": 5
},
"end": {
"line": 36,
"column": 28
}
},
"callee": {
"type": "MemberExpression",
"start": 660,
"end": 673,
"loc": {
"start": {
"line": 36,
"column": 5
},
"end": {
"line": 36,
"column": 18
}
},
"object": {
"type": "Identifier",
"start": 660,
"end": 666,
"loc": {
"start": {
"line": 36,
"column": 5
},
"end": {
"line": 36,
"column": 11
},
"identifierName": "Object"
},
"name": "Object",
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 667,
"end": 673,
"loc": {
"start": {
"line": 36,
"column": 12
},
"end": {
"line": 36,
"column": 18
},
"identifierName": "values"
},
"name": "values"
},
"computed": false,
"leadingComments": null
},
"arguments": [
{
"type": "Identifier",
"start": 674,
"end": 682,
"loc": {
"start": {
"line": 36,
"column": 19
},
"end": {
"line": 36,
"column": 27
},
"identifierName": "commands"
},
"name": "commands"
}
],
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " no command should run help",
"start": 625,
"end": 654,
"loc": {
"start": {
"line": 35,
"column": 8
},
"end": {
"line": 35,
"column": 37
}
}
}
]
},
{
"type": "SpreadElement",
"start": 687,
"end": 710,
"loc": {
"start": {
"line": 37,
"column": 2
},
"end": {
"line": 37,
"column": 25
}
},
"argument": {
"type": "CallExpression",
"start": 690,
"end": 710,
"loc": {
"start": {
"line": 37,
"column": 5
},
"end": {
"line": 37,
"column": 25
}
},
"callee": {
"type": "MemberExpression",
"start": 690,
"end": 701,
"loc": {
"start": {
"line": 37,
"column": 5
},
"end": {
"line": 37,
"column": 16
}
},
"object": {
"type": "Identifier",
"start": 690,
"end": 696,
"loc": {
"start": {
"line": 37,
"column": 5
},
"end": {
"line": 37,
"column": 11
},
"identifierName": "Object"
},
"name": "Object"
},
"property": {
"type": "Identifier",
"start": 697,
"end": 701,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 16
},
"identifierName": "keys"
},
"name": "keys"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 702,
"end": 709,
"loc": {
"start": {
"line": 37,
"column": 17
},
"end": {
"line": 37,
"column": 24
},
"identifierName": "aliases"
},
"name": "aliases"
}
]
}
}
]
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * All available command names as list (includes aliases)\n * @type {string[]}\n ",
"start": 492,
"end": 577,
"loc": {
"start": {
"line": 30,
"column": 0
},
"end": {
"line": 33,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Commands map\n *\n * Map command name to the actuall command function\n * @type {Map<string, Function>}\n ",
"start": 716,
"end": 827,
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 45,
"column": 3
}
}
}
]
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * All available command names as list (includes aliases)\n * @type {string[]}\n ",
"start": 492,
"end": 577,
"loc": {
"start": {
"line": 30,
"column": 0
},
"end": {
"line": 33,
"column": 3
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Commands map\n *\n * Map command name to the actuall command function\n * @type {Map<string, Function>}\n ",
"start": 716,
"end": 827,
"loc": {
"start": {
"line": 40,
"column": 0
},
"end": {
"line": 45,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start": 828,
"end": 965,
"loc": {
"start": {
"line": 46,
"column": 0
},
"end": {
"line": 51,
"column": 2
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "VariableDeclaration",
"start": 835,
"end": 965,
"loc": {
"start": {
"line": 46,
"column": 7
},
"end": {
"line": 51,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 841,
"end": 964,
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 51,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 841,
"end": 852,
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 24
},
"identifierName": "commandsMap"
},
"name": "commandsMap",
"leadingComments": null
},
"init": {
"type": "ObjectExpression",
"start": 855,
"end": 964,
"loc": {
"start": {
"line": 46,
"column": 27
},
"end": {
"line": 51,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 859,
"end": 888,
"loc": {
"start": {
"line": 47,
"column": 2
},
"end": {
"line": 47,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": true,
"key": {
"type": "MemberExpression",
"start": 860,
"end": 877,
"loc": {
"start": {
"line": 47,
"column": 3
},
"end": {
"line": 47,
"column": 20
}
},
"object": {
"type": "Identifier",
"start": 860,
"end": 868,
"loc": {
"start": {
"line": 47,
"column": 3
},
"end": {
"line": 47,
"column": 11
},
"identifierName": "commands"
},
"name": "commands"
},
"property": {
"type": "Identifier",
"start": 869,
"end": 877,
"loc": {
"start": {
"line": 47,
"column": 12
},
"end": {
"line": 47,
"column": 20
},
"identifierName": "GENERATE"
},
"name": "GENERATE"
},
"computed": false
},
"value": {
"type": "Identifier",
"start": 880,
"end": 888,
"loc": {
"start": {
"line": 47,
"column": 23
},
"end": {
"line": 47,
"column": 31
},
"identifierName": "generate"
},
"name": "generate"
}
},
{
"type": "ObjectProperty",
"start": 892,
"end": 913,
"loc": {
"start": {
"line": 48,
"column": 2
},
"end": {
"line": 48,
"column": 23
}
},
"method": false,
"shorthand": false,
"computed": true,
"key": {
"type": "MemberExpression",
"start": 893,
"end": 906,
"loc": {
"start": {
"line": 48,
"column": 3
},
"end": {
"line": 48,
"column": 16
}
},
"object": {
"type": "Identifier",
"start": 893,
"end": 901,
"loc": {
"start": {
"line": 48,
"column": 3
},
"end": {
"line": 48,
"column": 11
},
"identifierName": "commands"
},
"name": "commands"
},
"property": {
"type": "Identifier",
"start": 902,
"end": 906,
"loc": {
"start": {
"line": 48,
"column": 12
},
"end": {
"line": 48,
"column": 16
},
"identifierName": "HELP"
},
"name": "HELP"
},
"computed": false
},
"value": {
"type": "Identifier",
"start": 909,
"end": 913,
"loc": {
"start": {
"line": 48,
"column": 19
},
"end": {
"line": 48,
"column": 23
},
"identifierName": "help"
},
"name": "help"
}
},
{
"type": "ObjectProperty",
"start": 917,
"end": 938,
"loc": {
"start": {
"line": 49,
"column": 2
},
"end": {
"line": 49,
"column": 23
}
},
"method": false,
"shorthand": false,
"com