mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,476 lines (1,475 loc) • 351 kB
JSON
{
"type": "File",
"start": 0,
"end": 1765,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 67,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1765,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 67,
"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": 107,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 55
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 59,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 16
}
},
"local": {
"type": "Identifier",
"start": 59,
"end": 68,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 16
},
"identifierName": "Installer"
},
"name": "Installer"
}
}
],
"source": {
"type": "StringLiteral",
"start": 74,
"end": 106,
"loc": {
"start": {
"line": 4,
"column": 22
},
"end": {
"line": 4,
"column": 54
}
},
"extra": {
"rawValue": "../../core/__mocks__/installer",
"raw": "'../../core/__mocks__/installer'"
},
"value": "../../core/__mocks__/installer"
}
},
{
"type": "ImportDeclaration",
"start": 109,
"end": 193,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 25
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 116,
"end": 128,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 19
}
},
"local": {
"type": "Identifier",
"start": 116,
"end": 128,
"loc": {
"start": {
"line": 6,
"column": 7
},
"end": {
"line": 6,
"column": 19
},
"identifierName": "runInstaller"
},
"name": "runInstaller"
}
},
{
"type": "ImportSpecifier",
"start": 134,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 134,
"end": 147,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 15
},
"identifierName": "__RewireAPI__"
},
"name": "__RewireAPI__"
},
"local": {
"type": "Identifier",
"start": 151,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 19
},
"end": {
"line": 7,
"column": 34
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
}
}
],
"source": {
"type": "StringLiteral",
"start": 175,
"end": 192,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 24
}
},
"extra": {
"rawValue": "./run-installer",
"raw": "'./run-installer'"
},
"value": "./run-installer"
}
},
{
"type": "ImportDeclaration",
"start": 195,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 59
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 202,
"end": 217,
"loc": {
"start": {
"line": 10,
"column": 7
},
"end": {
"line": 10,
"column": 22
}
},
"local": {
"type": "Identifier",
"start": 202,
"end": 217,
"loc": {
"start": {
"line": 10,
"column": 7
},
"end": {
"line": 10,
"column": 22
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger"
}
}
],
"source": {
"type": "StringLiteral",
"start": 223,
"end": 253,
"loc": {
"start": {
"line": 10,
"column": 28
},
"end": {
"line": 10,
"column": 58
}
},
"extra": {
"rawValue": "./__mocks__/installer-logger",
"raw": "'./__mocks__/installer-logger'"
},
"value": "./__mocks__/installer-logger"
}
},
{
"type": "VariableDeclaration",
"start": 256,
"end": 1102,
"loc": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 37,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 262,
"end": 1101,
"loc": {
"start": {
"line": 12,
"column": 6
},
"end": {
"line": 37,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 262,
"end": 275,
"loc": {
"start": {
"line": 12,
"column": 6
},
"end": {
"line": 12,
"column": 19
},
"identifierName": "testInstaller"
},
"name": "testInstaller"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 278,
"end": 1101,
"loc": {
"start": {
"line": 12,
"column": 22
},
"end": {
"line": 37,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 262,
"end": 275,
"loc": {
"start": {
"line": 12,
"column": 6
},
"end": {
"line": 12,
"column": 19
},
"identifierName": "testInstaller"
},
"name": "testInstaller"
},
"generator": false,
"expression": false,
"async": true,
"params": [
{
"type": "Identifier",
"start": 285,
"end": 286,
"loc": {
"start": {
"line": 12,
"column": 29
},
"end": {
"line": 12,
"column": 30
},
"identifierName": "t"
},
"name": "t"
},
{
"type": "Identifier",
"start": 288,
"end": 295,
"loc": {
"start": {
"line": 12,
"column": 32
},
"end": {
"line": 12,
"column": 39
},
"identifierName": "options"
},
"name": "options"
}
],
"body": {
"type": "BlockStatement",
"start": 300,
"end": 1101,
"loc": {
"start": {
"line": 12,
"column": 44
},
"end": {
"line": 37,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 304,
"end": 364,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 62
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 310,
"end": 363,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 61
}
},
"id": {
"type": "ObjectPattern",
"start": 310,
"end": 345,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 43
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 312,
"end": 321,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 19
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 312,
"end": 321,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 19
},
"identifierName": "Installer"
},
"name": "Installer"
},
"value": {
"type": "Identifier",
"start": 312,
"end": 321,
"loc": {
"start": {
"line": 13,
"column": 10
},
"end": {
"line": 13,
"column": 19
},
"identifierName": "Installer"
},
"name": "Installer"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 323,
"end": 343,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 41
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 323,
"end": 343,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 41
},
"identifierName": "promptMissingOptions"
},
"name": "promptMissingOptions"
},
"value": {
"type": "Identifier",
"start": 323,
"end": 343,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 41
},
"identifierName": "promptMissingOptions"
},
"name": "promptMissingOptions"
},
"extra": {
"shorthand": true
}
}
]
},
"init": {
"type": "MemberExpression",
"start": 348,
"end": 363,
"loc": {
"start": {
"line": 13,
"column": 46
},
"end": {
"line": 13,
"column": 61
}
},
"object": {
"type": "MemberExpression",
"start": 348,
"end": 357,
"loc": {
"start": {
"line": 13,
"column": 46
},
"end": {
"line": 13,
"column": 55
}
},
"object": {
"type": "Identifier",
"start": 348,
"end": 349,
"loc": {
"start": {
"line": 13,
"column": 46
},
"end": {
"line": 13,
"column": 47
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 350,
"end": 357,
"loc": {
"start": {
"line": 13,
"column": 48
},
"end": {
"line": 13,
"column": 55
},
"identifierName": "context"
},
"name": "context"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 358,
"end": 363,
"loc": {
"start": {
"line": 13,
"column": 56
},
"end": {
"line": 13,
"column": 61
},
"identifierName": "mocks"
},
"name": "mocks"
},
"computed": false
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 368,
"end": 453,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 16,
"column": 63
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 374,
"end": 452,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 16,
"column": 62
}
},
"id": {
"type": "Identifier",
"start": 374,
"end": 387,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 21
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"init": {
"type": "LogicalExpression",
"start": 394,
"end": 452,
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 16,
"column": 62
}
},
"left": {
"type": "LogicalExpression",
"start": 395,
"end": 427,
"loc": {
"start": {
"line": 16,
"column": 5
},
"end": {
"line": 16,
"column": 37
}
},
"left": {
"type": "Identifier",
"start": 395,
"end": 402,
"loc": {
"start": {
"line": 16,
"column": 5
},
"end": {
"line": 16,
"column": 12
},
"identifierName": "options"
},
"name": "options"
},
"operator": "&&",
"right": {
"type": "MemberExpression",
"start": 406,
"end": 427,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 16,
"column": 37
}
},
"object": {
"type": "Identifier",
"start": 406,
"end": 413,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 16,
"column": 23
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 414,
"end": 427,
"loc": {
"start": {
"line": 16,
"column": 24
},
"end": {
"line": 16,
"column": 37
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"computed": false
},
"extra": {
"parenthesized": true,
"parenStart": 394
}
},
"operator": "||",
"right": {
"type": "StringLiteral",
"start": 432,
"end": 452,
"loc": {
"start": {
"line": 16,
"column": 42
},
"end": {
"line": 16,
"column": 62
}
},
"extra": {
"rawValue": "some-seeder-folder",
"raw": "'some-seeder-folder'"
},
"value": "some-seeder-folder"
}
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 457,
"end": 555,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 19,
"column": 69
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 463,
"end": 554,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 19,
"column": 68
}
},
"id": {
"type": "Identifier",
"start": 463,
"end": 483,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 18,
"column": 28
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"init": {
"type": "LogicalExpression",
"start": 490,
"end": 554,
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 68
}
},
"left": {
"type": "LogicalExpression",
"start": 491,
"end": 530,
"loc": {
"start": {
"line": 19,
"column": 5
},
"end": {
"line": 19,
"column": 44
}
},
"left": {
"type": "Identifier",
"start": 491,
"end": 498,
"loc": {
"start": {
"line": 19,
"column": 5
},
"end": {
"line": 19,
"column": 12
},
"identifierName": "options"
},
"name": "options"
},
"operator": "&&",
"right": {
"type": "MemberExpression",
"start": 502,
"end": 530,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 44
}
},
"object": {
"type": "Identifier",
"start": 502,
"end": 509,
"loc": {
"start": {
"line": 19,
"column": 16
},
"end": {
"line": 19,
"column": 23
},
"identifierName": "options"
},
"name": "options"
},
"property": {
"type": "Identifier",
"start": 510,
"end": 530,
"loc": {
"start": {
"line": 19,
"column": 24
},
"end": {
"line": 19,
"column": 44
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"computed": false
},
"extra": {
"parenthesized": true,
"parenStart": 490
}
},
"operator": "||",
"right": {
"type": "StringLiteral",
"start": 535,
"end": 554,
"loc": {
"start": {
"line": 19,
"column": 49
},
"end": {
"line": 19,
"column": 68
}
},
"extra": {
"rawValue": "some-file-path.js",
"raw": "'some-file-path.js'"
},
"value": "some-file-path.js"
}
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 559,
"end": 630,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 73
}
},
"expression": {
"type": "CallExpression",
"start": 559,
"end": 629,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 72
}
},
"callee": {
"type": "MemberExpression",
"start": 559,
"end": 588,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 559,
"end": 579,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 22
},
"identifierName": "promptMissingOptions"
},
"name": "promptMissingOptions"
},
"property": {
"type": "Identifier",
"start": 580,
"end": 588,
"loc": {
"start": {
"line": 21,
"column": 23
},
"end": {
"line": 21,
"column": 31
},
"identifierName": "resolves"
},
"name": "resolves"
},
"computed": false
},
"arguments": [
{
"type": "ObjectExpression",
"start": 589,
"end": 628,
"loc": {
"start": {
"line": 21,
"column": 32
},
"end": {
"line": 21,
"column": 71
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 591,
"end": 604,
"loc": {
"start": {
"line": 21,
"column": 34
},
"end": {
"line": 21,
"column": 47
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 591,
"end": 604,
"loc": {
"start": {
"line": 21,
"column": 34
},
"end": {
"line": 21,
"column": 47
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"value": {
"type": "Identifier",
"start": 591,
"end": 604,
"loc": {
"start": {
"line": 21,
"column": 34
},
"end": {
"line": 21,
"column": 47
},
"identifierName": "seedersFolder"
},
"name": "seedersFolder"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 606,
"end": 626,
"loc": {
"start": {
"line": 21,
"column": 49
},
"end": {
"line": 21,
"column": 69
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 606,
"end": 626,
"loc": {
"start": {
"line": 21,
"column": 49
},
"end": {
"line": 21,
"column": 69
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"value": {
"type": "Identifier",
"start": 606,
"end": 626,
"loc": {
"start": {
"line": 21,
"column": 49
},
"end": {
"line": 21,
"column": 69
},
"identifierName": "customSeederTemplate"
},
"name": "customSeederTemplate"
},
"extra": {
"shorthand": true
}
}
]
}
]
}
},
{
"type": "ExpressionStatement",
"start": 634,
"end": 662,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 30
}
},
"expression": {
"type": "AwaitExpression",
"start": 634,
"end": 661,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 29
}
},
"argument": {
"type": "CallExpression",
"start": 640,
"end": 661,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 29
}
},
"callee": {
"type": "Identifier",
"start": 640,
"end": 652,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 20
},
"identifierName": "runInstaller"
},
"name": "runInstaller"
},
"arguments": [
{
"type": "Identifier",
"start": 653,
"end": 660,
"loc": {
"start": {
"line": 23,
"column": 21
},
"end": {
"line": 23,
"column": 28
},
"identifierName": "options"
},
"name": "options"
}
]
}
}
},
{
"type": "ExpressionStatement",
"start": 666,
"end": 721,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 57
}
},
"expression": {
"type": "CallExpression",
"start": 666,
"end": 720,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 56
}
},
"callee": {
"type": "MemberExpression",
"start": 666,
"end": 672,
"loc": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 25,
"column": 8
}