UNPKG

mongoose-data-seed

Version:

Seed mongodb with data using mongoose models

1,447 lines (1,446 loc) 589 kB
{ "type": "File", "start": 0, "end": 3194, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 115, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 3194, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 115, "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": 154, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 8, "column": 19 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 63, "end": 73, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 12 } }, "imported": { "type": "Identifier", "start": 63, "end": 73, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 12 }, "identifierName": "getOptions" }, "name": "getOptions" }, "local": { "type": "Identifier", "start": 63, "end": 73, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 5, "column": 12 }, "identifierName": "getOptions" }, "name": "getOptions" } }, { "type": "ImportSpecifier", "start": 77, "end": 97, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 22 } }, "imported": { "type": "Identifier", "start": 77, "end": 97, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 22 }, "identifierName": "promptMissingOptions" }, "name": "promptMissingOptions" }, "local": { "type": "Identifier", "start": 77, "end": 97, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 22 }, "identifierName": "promptMissingOptions" }, "name": "promptMissingOptions" } }, { "type": "ImportSpecifier", "start": 101, "end": 133, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 34 } }, "imported": { "type": "Identifier", "start": 101, "end": 114, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 15 }, "identifierName": "__RewireAPI__" }, "name": "__RewireAPI__" }, "local": { "type": "Identifier", "start": 118, "end": 133, "loc": { "start": { "line": 7, "column": 19 }, "end": { "line": 7, "column": 34 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" } } ], "source": { "type": "StringLiteral", "start": 142, "end": 153, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 18 } }, "extra": { "rawValue": "./options", "raw": "'./options'" }, "value": "./options" } }, { "type": "VariableDeclaration", "start": 156, "end": 264, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 14, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 162, "end": 263, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 14, "column": 1 } }, "id": { "type": "Identifier", "start": 162, "end": 170, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 14 }, "identifierName": "helpData" }, "name": "helpData" }, "init": { "type": "ObjectExpression", "start": 173, "end": 263, "loc": { "start": { "line": 10, "column": 17 }, "end": { "line": 14, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 177, "end": 194, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 19 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 177, "end": 181, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 6 }, "identifierName": "argv" }, "name": "argv" }, "value": { "type": "StringLiteral", "start": 183, "end": 194, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 19 } }, "extra": { "rawValue": "some argv", "raw": "'some argv'" }, "value": "some argv" } }, { "type": "ObjectProperty", "start": 198, "end": 226, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 30 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 198, "end": 211, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 15 }, "identifierName": "seedersFolder" }, "name": "seedersFolder" }, "value": { "type": "StringLiteral", "start": 213, "end": 226, "loc": { "start": { "line": 12, "column": 17 }, "end": { "line": 12, "column": 30 } }, "extra": { "rawValue": "folder-name", "raw": "'folder-name'" }, "value": "folder-name" } }, { "type": "ObjectProperty", "start": 230, "end": 260, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 230, "end": 244, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 16 }, "identifierName": "seederTemplate" }, "name": "seederTemplate" }, "value": { "type": "StringLiteral", "start": 246, "end": 260, "loc": { "start": { "line": 13, "column": 18 }, "end": { "line": 13, "column": 32 } }, "extra": { "rawValue": "file-path.js", "raw": "'file-path.js'" }, "value": "file-path.js" } } ] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 266, "end": 715, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 31, "column": 3 } }, "expression": { "type": "CallExpression", "start": 266, "end": 714, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 31, "column": 2 } }, "callee": { "type": "MemberExpression", "start": 266, "end": 281, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 15 } }, "object": { "type": "Identifier", "start": 266, "end": 270, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 4 }, "identifierName": "test" }, "name": "test" }, "property": { "type": "Identifier", "start": 271, "end": 281, "loc": { "start": { "line": 16, "column": 5 }, "end": { "line": 16, "column": 15 }, "identifierName": "beforeEach" }, "name": "beforeEach" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 282, "end": 296, "loc": { "start": { "line": 16, "column": 16 }, "end": { "line": 16, "column": 30 } }, "extra": { "rawValue": "mock imports", "raw": "'mock imports'" }, "value": "mock imports" }, { "type": "ArrowFunctionExpression", "start": 298, "end": 713, "loc": { "start": { "line": 16, "column": 32 }, "end": { "line": 31, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 298, "end": 299, "loc": { "start": { "line": 16, "column": 32 }, "end": { "line": 16, "column": 33 }, "identifierName": "t" }, "name": "t" } ], "body": { "type": "BlockStatement", "start": 303, "end": 713, "loc": { "start": { "line": 16, "column": 37 }, "end": { "line": 31, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 307, "end": 582, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 24, "column": 4 } }, "declarations": [ { "type": "VariableDeclarator", "start": 313, "end": 581, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 24, "column": 3 } }, "id": { "type": "Identifier", "start": 313, "end": 318, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 13 }, "identifierName": "mocks" }, "name": "mocks" }, "init": { "type": "ObjectExpression", "start": 321, "end": 581, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 24, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 327, "end": 371, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 48 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 327, "end": 344, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 21 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" }, "value": { "type": "StringLiteral", "start": 346, "end": 371, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 48 } }, "extra": { "rawValue": "some option definitions", "raw": "'some option definitions'" }, "value": "some option definitions" } }, { "type": "ObjectProperty", "start": 377, "end": 406, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 33 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 377, "end": 392, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 19 }, "identifierName": "commandLineArgs" }, "name": "commandLineArgs" }, "value": { "type": "CallExpression", "start": 394, "end": 406, "loc": { "start": { "line": 19, "column": 21 }, "end": { "line": 19, "column": 33 } }, "callee": { "type": "MemberExpression", "start": 394, "end": 404, "loc": { "start": { "line": 19, "column": 21 }, "end": { "line": 19, "column": 31 } }, "object": { "type": "Identifier", "start": 394, "end": 399, "loc": { "start": { "line": 19, "column": 21 }, "end": { "line": 19, "column": 26 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 400, "end": 404, "loc": { "start": { "line": 19, "column": 27 }, "end": { "line": 19, "column": 31 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 412, "end": 451, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 43 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 412, "end": 437, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 29 }, "identifierName": "validateSeedersFolderName" }, "name": "validateSeedersFolderName" }, "value": { "type": "CallExpression", "start": 439, "end": 451, "loc": { "start": { "line": 20, "column": 31 }, "end": { "line": 20, "column": 43 } }, "callee": { "type": "MemberExpression", "start": 439, "end": 449, "loc": { "start": { "line": 20, "column": 31 }, "end": { "line": 20, "column": 41 } }, "object": { "type": "Identifier", "start": 439, "end": 444, "loc": { "start": { "line": 20, "column": 31 }, "end": { "line": 20, "column": 36 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 445, "end": 449, "loc": { "start": { "line": 20, "column": 37 }, "end": { "line": 20, "column": 41 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 457, "end": 497, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 44 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 457, "end": 483, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 30 }, "identifierName": "validateSeederTemplatePath" }, "name": "validateSeederTemplatePath" }, "value": { "type": "CallExpression", "start": 485, "end": 497, "loc": { "start": { "line": 21, "column": 32 }, "end": { "line": 21, "column": 44 } }, "callee": { "type": "MemberExpression", "start": 485, "end": 495, "loc": { "start": { "line": 21, "column": 32 }, "end": { "line": 21, "column": 42 } }, "object": { "type": "Identifier", "start": 485, "end": 490, "loc": { "start": { "line": 21, "column": 32 }, "end": { "line": 21, "column": 37 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 491, "end": 495, "loc": { "start": { "line": 21, "column": 38 }, "end": { "line": 21, "column": 42 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 503, "end": 536, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 37 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 503, "end": 522, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 23 }, "identifierName": "promptSeedersFolder" }, "name": "promptSeedersFolder" }, "value": { "type": "CallExpression", "start": 524, "end": 536, "loc": { "start": { "line": 22, "column": 25 }, "end": { "line": 22, "column": 37 } }, "callee": { "type": "MemberExpression", "start": 524, "end": 534, "loc": { "start": { "line": 22, "column": 25 }, "end": { "line": 22, "column": 35 } }, "object": { "type": "Identifier", "start": 524, "end": 529, "loc": { "start": { "line": 22, "column": 25 }, "end": { "line": 22, "column": 30 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 530, "end": 534, "loc": { "start": { "line": 22, "column": 31 }, "end": { "line": 22, "column": 35 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 542, "end": 576, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 38 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 542, "end": 562, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 24 }, "identifierName": "promptSeederTemplate" }, "name": "promptSeederTemplate" }, "value": { "type": "CallExpression", "start": 564, "end": 576, "loc": { "start": { "line": 23, "column": 26 }, "end": { "line": 23, "column": 38 } }, "callee": { "type": "MemberExpression", "start": 564, "end": 574, "loc": { "start": { "line": 23, "column": 26 }, "end": { "line": 23, "column": 36 } }, "object": { "type": "Identifier", "start": 564, "end": 569, "loc": { "start": { "line": 23, "column": 26 }, "end": { "line": 23, "column": 31 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 570, "end": 574, "loc": { "start": { "line": 23, "column": 32 }, "end": { "line": 23, "column": 36 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } } ] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 586, "end": 608, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 586, "end": 607, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 586, "end": 595, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 11 } }, "object": { "type": "Identifier", "start": 586, "end": 587, "loc": { "start": { "line": 26, "column": 2 }, "end": { "line": 26, "column": 3 }, "identifierName": "t" }, "name": "t" }, "property": { "type": "Identifier", "start": 588, "end": 595, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 26, "column": 11 }, "identifierName": "context" }, "name": "context" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 598, "end": 607, "loc": {