mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,567 lines (1,566 loc) • 102 kB
JSON
{
"type": "File",
"start": 0,
"end": 860,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 33,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 860,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 33,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 9,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 9,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "Installer"
},
"name": "Installer"
},
"local": {
"type": "Identifier",
"start": 9,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "Installer"
},
"name": "Installer"
}
}
],
"source": {
"type": "StringLiteral",
"start": 26,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 38
}
},
"extra": {
"rawValue": "../../core",
"raw": "'../../core'"
},
"value": "../../core"
}
},
{
"type": "ImportDeclaration",
"start": 40,
"end": 89,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 49
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 49,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 29
}
},
"imported": {
"type": "Identifier",
"start": 49,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 29
},
"identifierName": "promptMissingOptions"
},
"name": "promptMissingOptions"
},
"local": {
"type": "Identifier",
"start": 49,
"end": 69,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 29
},
"identifierName": "promptMissingOptions"
},
"name": "promptMissingOptions"
}
}
],
"source": {
"type": "StringLiteral",
"start": 77,
"end": 88,
"loc": {
"start": {
"line": 2,
"column": 37
},
"end": {
"line": 2,
"column": 48
}
},
"extra": {
"rawValue": "./options",
"raw": "'./options'"
},
"value": "./options"
}
},
{
"type": "ImportDeclaration",
"start": 90,
"end": 139,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 49
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 97,
"end": 112,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 22
}
},
"local": {
"type": "Identifier",
"start": 97,
"end": 112,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 22
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger"
}
}
],
"source": {
"type": "StringLiteral",
"start": 118,
"end": 138,
"loc": {
"start": {
"line": 3,
"column": 28
},
"end": {
"line": 3,
"column": 48
}
},
"extra": {
"rawValue": "./installer-logger",
"raw": "'./installer-logger'"
},
"value": "./installer-logger"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Run the installer\n * @param {Object} [options={}] installer options\n * @param {string} options.seedersFolder\n * @param {string} options.seedersTemplate\n * @return {Promise}\n ",
"start": 141,
"end": 330,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 331,
"end": 859,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 32,
"column": 2
}
},
"declaration": {
"type": "ArrowFunctionExpression",
"start": 346,
"end": 858,
"loc": {
"start": {
"line": 12,
"column": 15
},
"end": {
"line": 32,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": true,
"params": [
{
"type": "AssignmentPattern",
"start": 353,
"end": 365,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 34
}
},
"left": {
"type": "Identifier",
"start": 353,
"end": 360,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 12,
"column": 29
},
"identifierName": "options"
},
"name": "options"
},
"right": {
"type": "ObjectExpression",
"start": 363,
"end": 365,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 34
}
},
"properties": []
}
}
],
"body": {
"type": "BlockStatement",
"start": 370,
"end": 858,
"loc": {
"start": {
"line": 12,
"column": 39
},
"end": {
"line": 32,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 410,
"end": 502,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 16,
"column": 4
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 416,
"end": 501,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 16,
"column": 3
}
},
"id": {
"type": "ObjectPattern",
"start": 416,
"end": 455,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 47
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 418,
"end": 431,
"loc": {
"start": {
"line": 14,
"column": 10
},
"end": {
"line": 14,
"column": 23
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 418,
"end": 431,
"loc": {
"start": {
"line": 14,
"column": 10
},
"end": {
"line": 14,
"column": 23
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder",
"leadingComments": null
},
"value": {
"type": "Identifier",
"start": 418,
"end": 431,
"loc": {
"start": {
"line": 14,
"column": 10
},
"end": {
"line": 14,
"column": 23
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"leadingComments": null,
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 433,
"end": 453,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 45
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 433,
"end": 453,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 45
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"value": {
"type": "Identifier",
"start": 433,
"end": 453,
"loc": {
"start": {
"line": 14,
"column": 25
},
"end": {
"line": 14,
"column": 45
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"extra": {
"shorthand": true
}
}
],
"leadingComments": null
},
"init": {
"type": "AwaitExpression",
"start": 458,
"end": 501,
"loc": {
"start": {
"line": 14,
"column": 50
},
"end": {
"line": 16,
"column": 3
}
},
"argument": {
"type": "CallExpression",
"start": 464,
"end": 501,
"loc": {
"start": {
"line": 14,
"column": 56
},
"end": {
"line": 16,
"column": 3
}
},
"callee": {
"type": "Identifier",
"start": 464,
"end": 484,
"loc": {
"start": {
"line": 14,
"column": 56
},
"end": {
"line": 14,
"column": 76
},
"identifierName": "promptMissingOptions"
},
"name": "promptMissingOptions"
},
"arguments": [
{
"type": "Identifier",
"start": 490,
"end": 497,
"loc": {
"start": {
"line": 15,
"column": 4
},
"end": {
"line": 15,
"column": 11
},
"identifierName": "options"
},
"name": "options"
}
]
}
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentLine",
"value": " get relevat config and options",
"start": 374,
"end": 407,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 35
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " create logger",
"start": 506,
"end": 522,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 18
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 525,
"end": 562,
"loc": {
"start": {
"line": 19,
"column": 2
},
"end": {
"line": 19,
"column": 39
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 531,
"end": 561,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 531,
"end": 537,
"loc": {
"start": {
"line": 19,
"column": 8
},
"end": {
"line": 19,
"column": 14
},
"identifierName": "logger"
},
"name": "logger",
"leadingComments": null
},
"init": {
"type": "NewExpression",
"start": 540,
"end": 561,
"loc": {
"start": {
"line": 19,
"column": 17
},
"end": {
"line": 19,
"column": 38
}
},
"callee": {
"type": "Identifier",
"start": 544,
"end": 559,
"loc": {
"start": {
"line": 19,
"column": 21
},
"end": {
"line": 19,
"column": 36
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger"
},
"arguments": []
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentLine",
"value": " create logger",
"start": 506,
"end": 522,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 18
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " create installer",
"start": 566,
"end": 585,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 21
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 588,
"end": 661,
"loc": {
"start": {
"line": 22,
"column": 2
},
"end": {
"line": 22,
"column": 75
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 594,
"end": 660,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 74
}
},
"id": {
"type": "Identifier",
"start": 594,
"end": 603,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 17
},
"identifierName": "installer"
},
"name": "installer",
"leadingComments": null
},
"init": {
"type": "NewExpression",
"start": 606,
"end": 660,
"loc": {
"start": {
"line": 22,
"column": 20
},
"end": {
"line": 22,
"column": 74
}
},
"callee": {
"type": "Identifier",
"start": 610,
"end": 619,
"loc": {
"start": {
"line": 22,
"column": 24
},
"end": {
"line": 22,
"column": 33
},
"identifierName": "Installer"
},
"name": "Installer"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 620,
"end": 659,
"loc": {
"start": {
"line": 22,
"column": 34
},
"end": {
"line": 22,
"column": 73
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 622,
"end": 635,
"loc": {
"start": {
"line": 22,
"column": 36
},
"end": {
"line": 22,
"column": 49
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 622,
"end": 635,
"loc": {
"start": {
"line": 22,
"column": 36
},
"end": {
"line": 22,
"column": 49
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"value": {
"type": "Identifier",
"start": 622,
"end": 635,
"loc": {
"start": {
"line": 22,
"column": 36
},
"end": {
"line": 22,
"column": 49
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 637,
"end": 657,
"loc": {
"start": {
"line": 22,
"column": 51
},
"end": {
"line": 22,
"column": 71
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 637,
"end": 657,
"loc": {
"start": {
"line": 22,
"column": 51
},
"end": {
"line": 22,
"column": 71
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"value": {
"type": "Identifier",
"start": 637,
"end": 657,
"loc": {
"start": {
"line": 22,
"column": 51
},
"end": {
"line": 22,
"column": 71
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"extra": {
"shorthand": true
}
}
]
}
]
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentLine",
"value": " create installer",
"start": 566,
"end": 585,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 21
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " run seeders",
"start": 665,
"end": 679,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 24,
"column": 16
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 682,
"end": 721,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 41
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 688,
"end": 720,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 40
}
},
"id": {
"type": "Identifier",
"start": 688,
"end": 698,
"loc": {
"start": {
"line": 25,
"column": 8
},
"end": {
"line": 25,
"column": 18
},
"identifierName": "observable"
},
"name": "observable",
"leadingComments": null
},
"init": {
"type": "CallExpression",
"start": 701,
"end": 720,
"loc": {
"start": {
"line": 25,
"column": 21
},
"end": {
"line": 25,
"column": 40
}
},
"callee": {
"type": "MemberExpression",
"start": 701,
"end": 718,
"loc": {
"start": {
"line": 25,
"column": 21
},
"end": {
"line": 25,
"column": 38
}
},
"object": {
"type": "Identifier",
"start": 701,
"end": 710,
"loc": {
"start": {
"line": 25,
"column": 21
},
"end": {
"line": 25,
"column": 30
},
"identifierName": "installer"
},
"name": "installer"
},
"property": {
"type": "Identifier",
"start": 711,
"end": 718,
"loc": {
"start": {
"line": 25,
"column": 31
},
"end": {
"line": 25,
"column": 38
},
"identifierName": "install"
},
"name": "install"
},
"computed": false
},
"arguments": []
},
"leadingComments": null
}
],
"kind": "const",
"leadingComments": [
{
"type": "CommentLine",
"value": " run seeders",
"start": 665,
"end": 679,
"loc": {
"start": {
"line": 24,
"column": 2
},
"end": {
"line": 24,
"column": 16
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " subscribe logger",
"start": 725,
"end": 744,
"loc": {
"start": {
"line": 27,
"column": 2
},
"end": {
"line": 27,
"column": 21
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 747,
"end": 789,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 44
}
},
"expression": {
"type": "CallExpression",
"start": 747,
"end": 788,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 747,
"end": 767,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 22
}
},
"object": {
"type": "Identifier",
"start": 747,
"end": 757,
"loc": {
"start": {
"line": 28,
"column": 2
},
"end": {
"line": 28,
"column": 12
},
"identifierName": "observable"
},
"name": "observable",
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 758,
"end": 767,
"loc": {
"start": {
"line": 28,
"column": 13
},
"end": {
"line": 28,
"column": 22
},
"identifierName": "subscribe"
},
"name": "subscribe"
},
"computed": false,
"leadingComments": null
},
"arguments": [
{
"type": "CallExpression",
"start": 768,
"end": 787,
"loc": {
"start": {
"line": 28,
"column": 23
},
"end": {
"line": 28,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 768,
"end": 785,
"loc": {
"start": {
"line": 28,
"column": 23
},
"end": {
"line": 28,
"column": 40
}
},
"object": {
"type": "Identifier",
"start": 768,
"end": 774,
"loc": {
"start": {
"line": 28,
"column": 23
},
"end": {
"line": 28,
"column": 29
},
"identifierName": "logger"
},
"name": "logger"
},
"property": {
"type": "Identifier",
"start": 775,
"end": 785,
"loc": {
"start": {
"line": 28,
"column": 30
},
"end": {
"line": 28,
"column": 40
},
"identifierName": "asObserver"
},
"name": "asObserver"
},
"computed": false
},
"arguments": []
}
],
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " subscribe logger",
"start": 725,
"end": 744,
"loc": {
"start": {
"line": 27,
"column": 2
},
"end": {
"line": 27,
"column": 21
}
}
}
],
"trailingComments": [
{
"type": "CommentLine",
"value": " wait for installer to finish",
"start": 793,
"end": 824,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 30,
"column": 33
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 827,
"end": 856,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 31,
"column": 31
}
},
"expression": {
"type": "AwaitExpression",
"start": 827,
"end": 855,
"loc": {
"start": {
"line": 31,
"column": 2
},
"end": {
"line": 31,
"column": 30
}
},
"argument": {
"type": "CallExpression",
"start": 833,
"end": 855,
"loc": {
"start": {
"line": 31,
"column": 8
},
"end": {
"line": 31,
"column": 30
}
},
"callee": {
"type": "MemberExpression",
"start": 833,
"end": 853,
"loc": {
"start": {
"line": 31,
"column": 8
},
"end": {
"line": 31,
"column": 28
}
},
"object": {
"type": "Identifier",
"start": 833,
"end": 843,
"loc": {
"start": {
"line": 31,
"column": 8
},
"end": {
"line": 31,
"column": 18
},
"identifierName": "observable"
},
"name": "observable"
},
"property": {
"type": "Identifier",
"start": 844,
"end": 853,
"loc": {
"start": {
"line": 31,
"column": 19
},
"end": {
"line": 31,
"column": 28
},
"identifierName": "toPromise"
},
"name": "toPromise"
},
"computed": false
},
"arguments": []
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": " wait for installer to finish",
"start": 793,
"end": 824,
"loc": {
"start": {
"line": 30,
"column": 2
},
"end": {
"line": 30,
"column": 33
}
}
}
]
}
],
"directives": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Run the installer\n * @param {Object} [options={}] installer options\n * @param {string} options.seedersFolder\n * @param {string} options.seedersTemplate\n * @return {Promise}\n ",
"start": 141,
"end": 330,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
],
"trailingComments": []
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Run the installer\n * @param {Object} [options={}] installer options\n * @param {string} options.seedersFolder\n * @param {string} options.seedersTemplate\n * @return {Promise}\n ",
"start": 141,
"end": 330,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\n * Run the installer\n * @param {Object} [options={}] installer options\n * @param {string} options.seedersFolder\n * @param {string} options.seedersTemplate\n * @return {Promise}\n ",
"start": 141,
"end": 330,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
}
},
{
"type": "CommentLine",
"value": " get relevat config and options",
"start": 374,
"end": 407,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 35
}
}
},
{
"type": "CommentLine",
"value": " create logger",
"start": 506,
"end": 522,
"loc": {
"start": {
"line": 18,
"column": 2
},