UNPKG

mongoose-data-seed

Version:

Seed mongodb with data using mongoose models

1,399 lines 433 kB
{ "type": "File", "start": 0, "end": 1961, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1961, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 69, "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": 149, "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": 92, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 17 } }, "imported": { "type": "Identifier", "start": 77, "end": 92, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 17 }, "identifierName": "validateOptions" }, "name": "validateOptions" }, "local": { "type": "Identifier", "start": 77, "end": 92, "loc": { "start": { "line": 6, "column": 2 }, "end": { "line": 6, "column": 17 }, "identifierName": "validateOptions" }, "name": "validateOptions" } }, { "type": "ImportSpecifier", "start": 96, "end": 128, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 34 } }, "imported": { "type": "Identifier", "start": 96, "end": 109, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 7, "column": 15 }, "identifierName": "__RewireAPI__" }, "name": "__RewireAPI__" }, "local": { "type": "Identifier", "start": 113, "end": 128, "loc": { "start": { "line": 7, "column": 19 }, "end": { "line": 7, "column": 34 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" } } ], "source": { "type": "StringLiteral", "start": 137, "end": 148, "loc": { "start": { "line": 8, "column": 7 }, "end": { "line": 8, "column": 18 } }, "extra": { "rawValue": "./options", "raw": "'./options'" }, "value": "./options" } }, { "type": "VariableDeclaration", "start": 151, "end": 275, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 14, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", "start": 157, "end": 274, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 14, "column": 1 } }, "id": { "type": "Identifier", "start": 157, "end": 165, "loc": { "start": { "line": 10, "column": 6 }, "end": { "line": 10, "column": 14 }, "identifierName": "helpData" }, "name": "helpData" }, "init": { "type": "ObjectExpression", "start": 168, "end": 274, "loc": { "start": { "line": 10, "column": 17 }, "end": { "line": 14, "column": 1 } }, "properties": [ { "type": "ObjectProperty", "start": 172, "end": 189, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 19 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 172, "end": 176, "loc": { "start": { "line": 11, "column": 2 }, "end": { "line": 11, "column": 6 }, "identifierName": "argv" }, "name": "argv" }, "value": { "type": "StringLiteral", "start": 178, "end": 189, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 19 } }, "extra": { "rawValue": "some argv", "raw": "'some argv'" }, "value": "some argv" } }, { "type": "ObjectProperty", "start": 193, "end": 223, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 32 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 193, "end": 203, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 12 }, "identifierName": "seederName" }, "name": "seederName" }, "value": { "type": "StringLiteral", "start": 205, "end": 223, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 32 } }, "extra": { "rawValue": "some-seeder-name", "raw": "'some-seeder-name'" }, "value": "some-seeder-name" } }, { "type": "ObjectProperty", "start": 227, "end": 271, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 46 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 227, "end": 244, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 19 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" }, "value": { "type": "StringLiteral", "start": 246, "end": 271, "loc": { "start": { "line": 13, "column": 21 }, "end": { "line": 13, "column": 46 } }, "extra": { "rawValue": "some option definitions", "raw": "'some option definitions'" }, "value": "some option definitions" } } ] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 277, "end": 1197, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 42, "column": 3 } }, "expression": { "type": "CallExpression", "start": 277, "end": 1196, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 42, "column": 2 } }, "callee": { "type": "Identifier", "start": 277, "end": 281, "loc": { "start": { "line": 16, "column": 0 }, "end": { "line": 16, "column": 4 }, "identifierName": "test" }, "name": "test" }, "arguments": [ { "type": "StringLiteral", "start": 282, "end": 320, "loc": { "start": { "line": 16, "column": 5 }, "end": { "line": 16, "column": 43 } }, "extra": { "rawValue": "should get user options from the cli", "raw": "'should get user options from the cli'" }, "value": "should get user options from the cli" }, { "type": "ArrowFunctionExpression", "start": 322, "end": 1195, "loc": { "start": { "line": 16, "column": 45 }, "end": { "line": 42, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 322, "end": 323, "loc": { "start": { "line": 16, "column": 45 }, "end": { "line": 16, "column": 46 }, "identifierName": "t" }, "name": "t" } ], "body": { "type": "BlockStatement", "start": 327, "end": 1195, "loc": { "start": { "line": 16, "column": 50 }, "end": { "line": 42, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 331, "end": 541, "loc": { "start": { "line": 17, "column": 2 }, "end": { "line": 20, "column": 4 } }, "declarations": [ { "type": "VariableDeclarator", "start": 337, "end": 540, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 20, "column": 3 } }, "id": { "type": "Identifier", "start": 337, "end": 348, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 19 }, "identifierName": "createStubs" }, "name": "createStubs" }, "init": { "type": "ArrowFunctionExpression", "start": 351, "end": 540, "loc": { "start": { "line": 17, "column": 22 }, "end": { "line": 20, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "ObjectPattern", "start": 352, "end": 390, "loc": { "start": { "line": 17, "column": 23 }, "end": { "line": 17, "column": 61 } }, "properties": [ { "type": "ObjectProperty", "start": 354, "end": 369, "loc": { "start": { "line": 17, "column": 25 }, "end": { "line": 17, "column": 40 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 354, "end": 369, "loc": { "start": { "line": 17, "column": 25 }, "end": { "line": 17, "column": 40 }, "identifierName": "commandLineArgs" }, "name": "commandLineArgs" }, "value": { "type": "Identifier", "start": 354, "end": 369, "loc": { "start": { "line": 17, "column": 25 }, "end": { "line": 17, "column": 40 }, "identifierName": "commandLineArgs" }, "name": "commandLineArgs" }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 371, "end": 388, "loc": { "start": { "line": 17, "column": 42 }, "end": { "line": 17, "column": 59 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 371, "end": 388, "loc": { "start": { "line": 17, "column": 42 }, "end": { "line": 17, "column": 59 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" }, "value": { "type": "Identifier", "start": 371, "end": 388, "loc": { "start": { "line": 17, "column": 42 }, "end": { "line": 17, "column": 59 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" }, "extra": { "shorthand": true } } ] } ], "body": { "type": "BlockStatement", "start": 395, "end": 540, "loc": { "start": { "line": 17, "column": 66 }, "end": { "line": 20, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 401, "end": 464, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 67 } }, "expression": { "type": "CallExpression", "start": 401, "end": 463, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 66 } }, "callee": { "type": "MemberExpression", "start": 401, "end": 427, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 30 } }, "object": { "type": "Identifier", "start": 401, "end": 416, "loc": { "start": { "line": 18, "column": 4 }, "end": { "line": 18, "column": 19 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" }, "property": { "type": "Identifier", "start": 417, "end": 427, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 30 }, "identifierName": "__Rewire__" }, "name": "__Rewire__" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 428, "end": 445, "loc": { "start": { "line": 18, "column": 31 }, "end": { "line": 18, "column": 48 } }, "extra": { "rawValue": "commandLineArgs", "raw": "'commandLineArgs'" }, "value": "commandLineArgs" }, { "type": "Identifier", "start": 447, "end": 462, "loc": { "start": { "line": 18, "column": 50 }, "end": { "line": 18, "column": 65 }, "identifierName": "commandLineArgs" }, "name": "commandLineArgs" } ] } }, { "type": "ExpressionStatement", "start": 469, "end": 536, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 71 } }, "expression": { "type": "CallExpression", "start": 469, "end": 535, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 70 } }, "callee": { "type": "MemberExpression", "start": 469, "end": 495, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 30 } }, "object": { "type": "Identifier", "start": 469, "end": 484, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 19 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" }, "property": { "type": "Identifier", "start": 485, "end": 495, "loc": { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 30 }, "identifierName": "__Rewire__" }, "name": "__Rewire__" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 496, "end": 515, "loc": { "start": { "line": 19, "column": 31 }, "end": { "line": 19, "column": 50 } }, "extra": { "rawValue": "optionDefinitions", "raw": "'optionDefinitions'" }, "value": "optionDefinitions" }, { "type": "Identifier", "start": 517, "end": 534, "loc": { "start": { "line": 19, "column": 52 }, "end": { "line": 19, "column": 69 }, "identifierName": "optionDefinitions" }, "name": "optionDefinitions" } ] } } ], "directives": [] } } } ], "kind": "const" }, { "type": "VariableDeclaration", "start": 544, "end": 699, "loc": { "start": { "line": 21, "column": 2 }, "end": { "line": 24, "column": 4 } }, "declarations": [ { "type": "VariableDeclarator", "start": 550, "end": 698, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 24, "column": 3 } }, "id": { "type": "Identifier", "start": 550, "end": 562, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 20 }, "identifierName": "restoreStubs" }, "name": "restoreStubs" }, "init": { "type": "ArrowFunctionExpression", "start": 565, "end": 698, "loc": { "start": { "line": 21, "column": 23 }, "end": { "line": 24, "column": 3 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 571, "end": 698, "loc": { "start": { "line": 21, "column": 29 }, "end": { "line": 24, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 577, "end": 632, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 59 } }, "expression": { "type": "CallExpression", "start": 577, "end": 631, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 58 } }, "callee": { "type": "MemberExpression", "start": 577, "end": 612, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 39 } }, "object": { "type": "Identifier", "start": 577, "end": 592, "loc": { "start": { "line": 22, "column": 4 }, "end": { "line": 22, "column": 19 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" }, "property": { "type": "Identifier", "start": 593, "end": 612, "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 22, "column": 39 }, "identifierName": "__ResetDependency__" }, "name": "__ResetDependency__" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 613, "end": 630, "loc": { "start": { "line": 22, "column": 40 }, "end": { "line": 22, "column": 57 } }, "extra": { "rawValue": "commandLineArgs", "raw": "'commandLineArgs'" }, "value": "commandLineArgs" } ] } }, { "type": "ExpressionStatement", "start": 637, "end": 694, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 61 } }, "expression": { "type": "CallExpression", "start": 637, "end": 693, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 60 } }, "callee": { "type": "MemberExpression", "start": 637, "end": 672, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 39 } }, "object": { "type": "Identifier", "start": 637, "end": 652, "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 19 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" }, "property": { "type": "Ide