UNPKG

mongoose-data-seed

Version:

Seed mongodb with data using mongoose models

1,498 lines (1,497 loc) 79.8 kB
{ "type": "File", "start": 0, "end": 810, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 32, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 810, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 32, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 27, "end": 809, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 31, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 42, "end": 809, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 31, "column": 1 } }, "id": { "type": "Identifier", "start": 48, "end": 62, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 35 }, "identifierName": "InstallerError" }, "name": "InstallerError", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 71, "end": 76, "loc": { "start": { "line": 4, "column": 44 }, "end": { "line": 4, "column": 49 }, "identifierName": "Error" }, "name": "Error" }, "body": { "type": "ClassBody", "start": 77, "end": 809, "loc": { "start": { "line": 4, "column": 50 }, "end": { "line": 31, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 383, "end": 807, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 30, "column": 3 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 383, "end": 394, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 13 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "AssignmentPattern", "start": 395, "end": 439, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 58 } }, "left": { "type": "ObjectPattern", "start": 395, "end": 434, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 53 } }, "properties": [ { "type": "ObjectProperty", "start": 397, "end": 406, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 25 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 397, "end": 401, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "type" }, "name": "type" }, "value": { "type": "AssignmentPattern", "start": 397, "end": 406, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 25 } }, "left": { "type": "Identifier", "start": 397, "end": 401, "loc": { "start": { "line": 12, "column": 16 }, "end": { "line": 12, "column": 20 }, "identifierName": "type" }, "name": "type" }, "right": { "type": "StringLiteral", "start": 404, "end": 406, "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 25 } }, "extra": { "rawValue": "", "raw": "''" }, "value": "" } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 408, "end": 420, "loc": { "start": { "line": 12, "column": 27 }, "end": { "line": 12, "column": 39 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 408, "end": 415, "loc": { "start": { "line": 12, "column": 27 }, "end": { "line": 12, "column": 34 }, "identifierName": "payload" }, "name": "payload" }, "value": { "type": "AssignmentPattern", "start": 408, "end": 420, "loc": { "start": { "line": 12, "column": 27 }, "end": { "line": 12, "column": 39 } }, "left": { "type": "Identifier", "start": 408, "end": 415, "loc": { "start": { "line": 12, "column": 27 }, "end": { "line": 12, "column": 34 }, "identifierName": "payload" }, "name": "payload" }, "right": { "type": "ObjectExpression", "start": 418, "end": 420, "loc": { "start": { "line": 12, "column": 37 }, "end": { "line": 12, "column": 39 } }, "properties": [] } }, "extra": { "shorthand": true } }, { "type": "ObjectProperty", "start": 422, "end": 432, "loc": { "start": { "line": 12, "column": 41 }, "end": { "line": 12, "column": 51 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 422, "end": 427, "loc": { "start": { "line": 12, "column": 41 }, "end": { "line": 12, "column": 46 }, "identifierName": "error" }, "name": "error" }, "value": { "type": "AssignmentPattern", "start": 422, "end": 432, "loc": { "start": { "line": 12, "column": 41 }, "end": { "line": 12, "column": 51 } }, "left": { "type": "Identifier", "start": 422, "end": 427, "loc": { "start": { "line": 12, "column": 41 }, "end": { "line": 12, "column": 46 }, "identifierName": "error" }, "name": "error" }, "right": { "type": "ObjectExpression", "start": 430, "end": 432, "loc": { "start": { "line": 12, "column": 49 }, "end": { "line": 12, "column": 51 } }, "properties": [] } }, "extra": { "shorthand": true } } ] }, "right": { "type": "ObjectExpression", "start": 437, "end": 439, "loc": { "start": { "line": 12, "column": 56 }, "end": { "line": 12, "column": 58 } }, "properties": [] } } ], "body": { "type": "BlockStatement", "start": 441, "end": 807, "loc": { "start": { "line": 12, "column": 60 }, "end": { "line": 30, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 447, "end": 488, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 45 } }, "expression": { "type": "CallExpression", "start": 447, "end": 487, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 44 } }, "callee": { "type": "Super", "start": 447, "end": 452, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 9 } } }, "arguments": [ { "type": "LogicalExpression", "start": 453, "end": 486, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 43 } }, "left": { "type": "MemberExpression", "start": 453, "end": 466, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 23 } }, "object": { "type": "Identifier", "start": 453, "end": 458, "loc": { "start": { "line": 13, "column": 10 }, "end": { "line": 13, "column": 15 }, "identifierName": "error" }, "name": "error" }, "property": { "type": "Identifier", "start": 459, "end": 466, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 23 }, "identifierName": "message" }, "name": "message" }, "computed": false }, "operator": "||", "right": { "type": "StringLiteral", "start": 470, "end": 486, "loc": { "start": { "line": 13, "column": 27 }, "end": { "line": 13, "column": 43 } }, "extra": { "rawValue": "InstallerError", "raw": "'InstallerError'" }, "value": "InstallerError" } } ] }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Error name.\n * @type {String}\n ", "start": 494, "end": 546, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 18, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 551, "end": 580, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 551, "end": 579, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 551, "end": 560, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 13 } }, "object": { "type": "ThisExpression", "start": 551, "end": 555, "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 556, "end": 560, "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 13 }, "identifierName": "name" }, "name": "name" }, "computed": false, "leadingComments": null }, "right": { "type": "StringLiteral", "start": 563, "end": 579, "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 32 } }, "extra": { "rawValue": "InstallerError", "raw": "'InstallerError'" }, "value": "InstallerError" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Error name.\n * @type {String}\n ", "start": 494, "end": 546, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 18, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Error type (one of the Installer.operations).\n * @type {String}\n ", "start": 585, "end": 671, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 676, "end": 693, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 21 } }, "expression": { "type": "AssignmentExpression", "start": 676, "end": 692, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 676, "end": 685, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 13 } }, "object": { "type": "ThisExpression", "start": 676, "end": 680, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 681, "end": 685, "loc": { "start": { "line": 24, "column": 9 }, "end": { "line": 24, "column": 13 }, "identifierName": "type" }, "name": "type" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 688, "end": 692, "loc": { "start": { "line": 24, "column": 16 }, "end": { "line": 24, "column": 20 }, "identifierName": "type" }, "name": "type" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Error type (one of the Installer.operations).\n * @type {String}\n ", "start": 585, "end": 671, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 23, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Custom payload object.\n * @type {Object}\n ", "start": 698, "end": 761, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 28, "column": 7 } } } ] }, { "type": "ExpressionStatement", "start": 766, "end": 803, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 41 } }, "expression": { "type": "AssignmentExpression", "start": 766, "end": 802, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 40 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 766, "end": 778, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 16 } }, "object": { "type": "ThisExpression", "start": 766, "end": 770, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 8 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 771, "end": 778, "loc": { "start": { "line": 29, "column": 9 }, "end": { "line": 29, "column": 16 }, "identifierName": "payload" }, "name": "payload" }, "computed": false, "leadingComments": null }, "right": { "type": "ObjectExpression", "start": 781, "end": 802, "loc": { "start": { "line": 29, "column": 19 }, "end": { "line": 29, "column": 40 } }, "properties": [ { "type": "SpreadProperty", "start": 783, "end": 793, "loc": { "start": { "line": 29, "column": 21 }, "end": { "line": 29, "column": 31 } }, "argument": { "type": "Identifier", "start": 786, "end": 793, "loc": { "start": { "line": 29, "column": 24 }, "end": { "line": 29, "column": 31 }, "identifierName": "payload" }, "name": "payload" } }, { "type": "ObjectProperty", "start": 795, "end": 800, "loc": { "start": { "line": 29, "column": 33 }, "end": { "line": 29, "column": 38 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 795, "end": 800, "loc": { "start": { "line": 29, "column": 33 }, "end": { "line": 29, "column": 38 }, "identifierName": "error" }, "name": "error" }, "value": { "type": "Identifier", "start": 795, "end": 800, "loc": { "start": { "line": 29, "column": 33 }, "end": { "line": 29, "column": 38 }, "identifierName": "error" }, "name": "error" }, "extra": { "shorthand": true } } ] }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Custom payload object.\n * @type {Object}\n ", "start": 698, "end": 761, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 28, "column": 7 } } } ] } ], "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Creates an InstallerError.\n * @param {Object} [options={}] options\n * @param {String} [options.type=''] The error type key (Installer.operations).\n * @param {Object} [options.payload={}] A custom payload object.\n * @param {Error} [options.error={}] Error object.\n ", "start": 81, "end": 380, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 11, "column": 5 } } } ] } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Installer Error\n ", "start": 0, "end": 26, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Installer Error\n ", "start": 0, "end": 26, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Installer Error\n ", "start": 0, "end": 26, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": "CommentBlock", "value": "*\n * Creates an InstallerError.\n * @param {Object} [options={}] options\n * @param {String} [options.type=''] The error type key (Installer.operations).\n * @param {Object} [options.payload={}] A custom payload object.\n * @param {Error} [options.error={}] Error object.\n ", "start": 81, "end": 380, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 11, "column": 5 } } }, { "type": "CommentBlock", "value": "*\n * Error name.\n * @type {String}\n ", "start": 494, "end": 546, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 18, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Error type (one of the Installer.operations).\n * @type {String}\n ", "start": 585, "end": 671, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 23, "column": 7 } } }, { "type": "CommentBlock", "value": "*\n * Custom payload object.\n * @type {Object}\n ", "start": 698, "end": 761, "loc": { "start": { "line": 25, "column": 4 }, "end": { "line": 28, "column": 7 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Installer Error\n ", "start": 0, "end": 26, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 3, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 27, "end": 33, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 34, "end": 41, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 14 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 42, "end": 47, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "InstallerError", "start": 48, "end": 62, "loc": { "start": { "line": 4, "column": 21 }, "end": { "line": 4, "column": 35 } } }, { "type": { "label": "extends", "keyword": "extends", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "extends", "start": 63, "end": 70, "loc": { "start": { "line": 4, "column": 36 }, "end": { "line": 4, "column": 43 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Error", "start": 71, "end": 76, "loc": { "start": { "line": 4, "column": 44 }, "end": { "line": 4, "column": 49 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 77, "end": 78, "loc": { "start": { "line": 4, "column": 50 }, "end": { "line": 4, "column": 51 } } }, { "type": "CommentBlock", "value": "*\n * Creates an InstallerError.\n * @param {Object} [options={}] options\n * @param {String} [options.type=''] The error type key (Installer.operations).\n * @param {Object} [options.payload={}] A custom payload object.\n * @param {Error} [options.error={}] Error object.\n ", "start": 81, "end": 380, "loc": { "start": { "line": 5, "column": 2 }, "end": { "line": 11, "column": 5 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "constructor", "start": 383, "end": 394, "loc": { "start": { "line": 12, "column": 2 }, "end": { "line": 12, "column": 13 } }