mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,474 lines (1,473 loc) • 266 kB
JSON
{
"type": "File",
"start": 0,
"end": 1032,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 39,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1032,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 39,
"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": 25,
"end": 72,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 47
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 32,
"end": 46,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 21
}
},
"local": {
"type": "Identifier",
"start": 32,
"end": 46,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 21
},
"identifierName": "InstallerError"
},
"name": "InstallerError"
}
}
],
"source": {
"type": "StringLiteral",
"start": 52,
"end": 71,
"loc": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 46
}
},
"extra": {
"rawValue": "./installer-error",
"raw": "'./installer-error'"
},
"value": "./installer-error"
}
},
{
"type": "ExpressionStatement",
"start": 74,
"end": 258,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 74,
"end": 257,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 11,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 74,
"end": 78,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 79,
"end": 100,
"loc": {
"start": {
"line": 5,
"column": 5
},
"end": {
"line": 5,
"column": 26
}
},
"extra": {
"rawValue": "should create error",
"raw": "'should create error'"
},
"value": "should create error"
},
{
"type": "ArrowFunctionExpression",
"start": 102,
"end": 256,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 11,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 102,
"end": 103,
"loc": {
"start": {
"line": 5,
"column": 28
},
"end": {
"line": 5,
"column": 29
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 107,
"end": 256,
"loc": {
"start": {
"line": 5,
"column": 33
},
"end": {
"line": 11,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 111,
"end": 146,
"loc": {
"start": {
"line": 6,
"column": 2
},
"end": {
"line": 6,
"column": 37
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 117,
"end": 145,
"loc": {
"start": {
"line": 6,
"column": 8
},
"end": {
"line": 6,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 117,
"end": 122,
"loc": {
"start": {
"line": 6,
"column": 8
},
"end": {
"line": 6,
"column": 13
},
"identifierName": "error"
},
"name": "error"
},
"init": {
"type": "NewExpression",
"start": 125,
"end": 145,
"loc": {
"start": {
"line": 6,
"column": 16
},
"end": {
"line": 6,
"column": 36
}
},
"callee": {
"type": "Identifier",
"start": 129,
"end": 143,
"loc": {
"start": {
"line": 6,
"column": 20
},
"end": {
"line": 6,
"column": 34
},
"identifierName": "InstallerError"
},
"name": "InstallerError"
},
"arguments": []
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 150,
"end": 185,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 37
}
},
"expression": {
"type": "CallExpression",
"start": 150,
"end": 184,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 36
}
},
"callee": {
"type": "MemberExpression",
"start": 150,
"end": 154,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 150,
"end": 151,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 152,
"end": 154,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 155,
"end": 165,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 155,
"end": 160,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 12
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 161,
"end": 165,
"loc": {
"start": {
"line": 8,
"column": 13
},
"end": {
"line": 8,
"column": 17
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 167,
"end": 183,
"loc": {
"start": {
"line": 8,
"column": 19
},
"end": {
"line": 8,
"column": 35
}
},
"extra": {
"rawValue": "InstallerError",
"raw": "'InstallerError'"
},
"value": "InstallerError"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 188,
"end": 209,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 23
}
},
"expression": {
"type": "CallExpression",
"start": 188,
"end": 208,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 22
}
},
"callee": {
"type": "MemberExpression",
"start": 188,
"end": 192,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 188,
"end": 189,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 190,
"end": 192,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 193,
"end": 203,
"loc": {
"start": {
"line": 9,
"column": 7
},
"end": {
"line": 9,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 193,
"end": 198,
"loc": {
"start": {
"line": 9,
"column": 7
},
"end": {
"line": 9,
"column": 12
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 199,
"end": 203,
"loc": {
"start": {
"line": 9,
"column": 13
},
"end": {
"line": 9,
"column": 17
},
"identifierName": "type"
},
"name": "type"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 205,
"end": 207,
"loc": {
"start": {
"line": 9,
"column": 19
},
"end": {
"line": 9,
"column": 21
}
},
"extra": {
"rawValue": "",
"raw": "''"
},
"value": ""
}
]
}
},
{
"type": "ExpressionStatement",
"start": 212,
"end": 254,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 44
}
},
"expression": {
"type": "CallExpression",
"start": 212,
"end": 253,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 212,
"end": 223,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 212,
"end": 213,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 214,
"end": 223,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 13
},
"identifierName": "deepEqual"
},
"name": "deepEqual"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 224,
"end": 237,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 224,
"end": 229,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 19
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 230,
"end": 237,
"loc": {
"start": {
"line": 10,
"column": 20
},
"end": {
"line": 10,
"column": 27
},
"identifierName": "payload"
},
"name": "payload"
},
"computed": false
},
{
"type": "ObjectExpression",
"start": 239,
"end": 252,
"loc": {
"start": {
"line": 10,
"column": 29
},
"end": {
"line": 10,
"column": 42
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 241,
"end": 250,
"loc": {
"start": {
"line": 10,
"column": 31
},
"end": {
"line": 10,
"column": 40
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 241,
"end": 246,
"loc": {
"start": {
"line": 10,
"column": 31
},
"end": {
"line": 10,
"column": 36
},
"identifierName": "error"
},
"name": "error"
},
"value": {
"type": "ObjectExpression",
"start": 248,
"end": 250,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 40
}
},
"properties": []
}
}
]
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 260,
"end": 492,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 20,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 260,
"end": 491,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 20,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 260,
"end": 264,
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 13,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 265,
"end": 296,
"loc": {
"start": {
"line": 13,
"column": 5
},
"end": {
"line": 13,
"column": 36
}
},
"extra": {
"rawValue": "should create error with type",
"raw": "'should create error with type'"
},
"value": "should create error with type"
},
{
"type": "ArrowFunctionExpression",
"start": 298,
"end": 490,
"loc": {
"start": {
"line": 13,
"column": 38
},
"end": {
"line": 20,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 298,
"end": 299,
"loc": {
"start": {
"line": 13,
"column": 38
},
"end": {
"line": 13,
"column": 39
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 303,
"end": 490,
"loc": {
"start": {
"line": 13,
"column": 43
},
"end": {
"line": 20,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 307,
"end": 332,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 27
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 313,
"end": 331,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 26
}
},
"id": {
"type": "Identifier",
"start": 313,
"end": 317,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 12
},
"identifierName": "type"
},
"name": "type"
},
"init": {
"type": "StringLiteral",
"start": 320,
"end": 331,
"loc": {
"start": {
"line": 14,
"column": 15
},
"end": {
"line": 14,
"column": 26
}
},
"extra": {
"rawValue": "some-type",
"raw": "'some-type'"
},
"value": "some-type"
}
}
],
"kind": "const"
},
{
"type": "VariableDeclaration",
"start": 335,
"end": 378,
"loc": {
"start": {
"line": 15,
"column": 2
},
"end": {
"line": 15,
"column": 45
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 341,
"end": 377,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 44
}
},
"id": {
"type": "Identifier",
"start": 341,
"end": 346,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 13
},
"identifierName": "error"
},
"name": "error"
},
"init": {
"type": "NewExpression",
"start": 349,
"end": 377,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 44
}
},
"callee": {
"type": "Identifier",
"start": 353,
"end": 367,
"loc": {
"start": {
"line": 15,
"column": 20
},
"end": {
"line": 15,
"column": 34
},
"identifierName": "InstallerError"
},
"name": "InstallerError"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 368,
"end": 376,
"loc": {
"start": {
"line": 15,
"column": 35
},
"end": {
"line": 15,
"column": 43
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 370,
"end": 374,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 15,
"column": 41
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 370,
"end": 374,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 15,
"column": 41
},
"identifierName": "type"
},
"name": "type"
},
"value": {
"type": "Identifier",
"start": 370,
"end": 374,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 15,
"column": 41
},
"identifierName": "type"
},
"name": "type"
},
"extra": {
"shorthand": true
}
}
]
}
]
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 382,
"end": 417,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 37
}
},
"expression": {
"type": "CallExpression",
"start": 382,
"end": 416,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 36
}
},
"callee": {
"type": "MemberExpression",
"start": 382,
"end": 386,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 382,
"end": 383,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 384,
"end": 386,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 387,
"end": 397,
"loc": {
"start": {
"line": 17,
"column": 7
},
"end": {
"line": 17,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 387,
"end": 392,
"loc": {
"start": {
"line": 17,
"column": 7
},
"end": {
"line": 17,
"column": 12
},
"identifierName": "error"
},
"name": "error"
},
"property": {
"type": "Identifier",
"start": 393,
"end": 397,
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 17
},
"identifierName": "name"
},
"name": "name"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 399,
"end": 415,
"loc": {
"start": {
"line": 17,
"column": 19
},
"end": {
"line": 17,
"column": 35
}
},
"extra": {
"rawValue": "InstallerError",
"raw": "'InstallerError'"
},
"value": "InstallerError"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 420,
"end": 443,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 25
}
},
"expression": {
"type": "CallExpression",
"start": 420,
"end": 442,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 24
}
},
"callee": {
"type": "MemberExpression",
"start": 420,
"end": 424,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 420,
"end": 421,
"loc": {
"start": {
"line": 18,
"column": 2
},
"end": {
"line": 18,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 422,
"end": 424,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 6
},
"identifierName": "is"
},
"name": "is"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 425,
"end": 435,
"loc": {
"start": {
"line": 18,
"column": 7
},
"end": {
"line": 18,
"column": 17
}
},
"object": {
"type": "Identifier",
"start": 425,
"end": 430,