make-mp-data 1.5.55 → 1.5.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +16 -2
- package/index.js +12 -2
- package/log.json +705 -94
- package/package.json +9 -2
- package/types.d.ts +8 -7
- package/dungeons/adspend.js +0 -96
- package/dungeons/anon.js +0 -104
- package/dungeons/big.js +0 -224
- package/dungeons/business.js +0 -327
- package/dungeons/complex.js +0 -396
- package/dungeons/foobar.js +0 -241
- package/dungeons/funnels.js +0 -220
- package/dungeons/gaming-experiments.js +0 -323
- package/dungeons/gaming.js +0 -314
- package/dungeons/governance.js +0 -288
- package/dungeons/mirror.js +0 -129
- package/dungeons/sanity.js +0 -118
- package/dungeons/scd.js +0 -205
- package/dungeons/session-replay.js +0 -175
- package/dungeons/simple.js +0 -150
- package/dungeons/userAgent.js +0 -190
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "make-mp-data",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.056",
|
|
4
4
|
"description": "builds all mixpanel primitives for a given project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "types.d.ts",
|
|
@@ -67,5 +67,12 @@
|
|
|
67
67
|
},
|
|
68
68
|
"jest": {
|
|
69
69
|
"preset": "./tests/jest.config.js"
|
|
70
|
+
},
|
|
71
|
+
"nodemonConfig": {
|
|
72
|
+
"ignore": [
|
|
73
|
+
"data/",
|
|
74
|
+
"tmp/"
|
|
75
|
+
|
|
76
|
+
]
|
|
70
77
|
}
|
|
71
|
-
}
|
|
78
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -26,10 +26,10 @@ declare namespace main {
|
|
|
26
26
|
concurrency?: number;
|
|
27
27
|
batchSize?: number;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
serviceAccount?: string;
|
|
30
|
+
serviceSecret?: string;
|
|
31
|
+
projectId?: string;
|
|
32
|
+
|
|
33
33
|
// ids
|
|
34
34
|
simulationName?: string;
|
|
35
35
|
name?: string;
|
|
@@ -50,7 +50,7 @@ declare namespace main {
|
|
|
50
50
|
hasSessionIds?: boolean;
|
|
51
51
|
alsoInferFunnels?: boolean;
|
|
52
52
|
makeChart?: boolean | string;
|
|
53
|
-
|
|
53
|
+
singleCountry?: string;
|
|
54
54
|
|
|
55
55
|
//models
|
|
56
56
|
events?: EventConfig[]; //| string[]; //can also be a array of strings
|
|
@@ -69,8 +69,8 @@ declare namespace main {
|
|
|
69
69
|
//allow anything to be on the config
|
|
70
70
|
[key: string]: any;
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
//probabilities
|
|
73
|
+
percentUsersBornInDataset?: number;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export type complexSCDProp = {
|
|
@@ -169,6 +169,7 @@ declare namespace main {
|
|
|
169
169
|
properties?: Record<string, ValueValid>;
|
|
170
170
|
isFirstEvent?: boolean;
|
|
171
171
|
isChurnEvent?: boolean;
|
|
172
|
+
isSessionStartEvent?: boolean;
|
|
172
173
|
relativeTimeMs?: number;
|
|
173
174
|
}
|
|
174
175
|
|
package/dungeons/adspend.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the default configuration file for the data generator in SIMPLE mode
|
|
3
|
-
* notice how the config object is structured, and see it's type definition in ./types.d.ts
|
|
4
|
-
* feel free to modify this file to customize the data you generate
|
|
5
|
-
* see helper functions in utils.js for more ways to generate data
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const Chance = require('chance');
|
|
12
|
-
const chance = new Chance();
|
|
13
|
-
const dayjs = require("dayjs");
|
|
14
|
-
const utc = require("dayjs/plugin/utc");
|
|
15
|
-
dayjs.extend(utc);
|
|
16
|
-
const { uid, comma } = require('ak-tools');
|
|
17
|
-
const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
|
|
18
|
-
|
|
19
|
-
/** @type {import('../types').Dungeon} */
|
|
20
|
-
const config = {
|
|
21
|
-
token: "",
|
|
22
|
-
seed: "foo bar",
|
|
23
|
-
numDays: 365, //how many days worth of data
|
|
24
|
-
numEvents: 10000000, //how many events
|
|
25
|
-
numUsers: 25000, //how many users
|
|
26
|
-
format: 'json', //csv or json
|
|
27
|
-
region: "US",
|
|
28
|
-
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
29
|
-
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
30
|
-
hasAdSpend: true,
|
|
31
|
-
events: [
|
|
32
|
-
{
|
|
33
|
-
event: "foo",
|
|
34
|
-
weight: 10,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
event: "bar",
|
|
38
|
-
weight: 9,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
event: "baz",
|
|
42
|
-
weight: 8,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
event: "qux",
|
|
46
|
-
weight: 7,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
event: "garply",
|
|
50
|
-
weight: 6,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
event: "durtle",
|
|
54
|
-
weight: 5,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
event: "linny",
|
|
58
|
-
weight: 4,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
event: "fonk",
|
|
62
|
-
weight: 3,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
event: "crumn",
|
|
66
|
-
weight: 2,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
event: "yak",
|
|
70
|
-
weight: 1,
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
superProps: {
|
|
74
|
-
color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
|
|
75
|
-
number: integer,
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
userProps: {
|
|
79
|
-
title: chance.profession.bind(chance),
|
|
80
|
-
luckyNumber: weighNumRange(42, 420),
|
|
81
|
-
spiritAnimal: ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
scdProps: {},
|
|
85
|
-
mirrorProps: {},
|
|
86
|
-
groupKeys: [],
|
|
87
|
-
groupProps: {},
|
|
88
|
-
lookupTables: [],
|
|
89
|
-
hook: function (record, type, meta) {
|
|
90
|
-
return record;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
module.exports = config;
|
package/dungeons/anon.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the default configuration file for the data generator in SIMPLE mode
|
|
3
|
-
* notice how the config object is structured, and see it's type definition in ./types.d.ts
|
|
4
|
-
* feel free to modify this file to customize the data you generate
|
|
5
|
-
* see helper functions in utils.js for more ways to generate data
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const Chance = require('chance');
|
|
12
|
-
const chance = new Chance();
|
|
13
|
-
const dayjs = require("dayjs");
|
|
14
|
-
const utc = require("dayjs/plugin/utc");
|
|
15
|
-
dayjs.extend(utc);
|
|
16
|
-
const { uid, comma } = require('ak-tools');
|
|
17
|
-
const { pickAWinner, weighNumRange, date, integer } = require('../components/utils');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** @type {import('../types').Dungeon} */
|
|
22
|
-
const config = {
|
|
23
|
-
token: "",
|
|
24
|
-
seed: "foo bar",
|
|
25
|
-
numDays: 365, //how many days worth of data
|
|
26
|
-
numEvents: 100000, //how many events
|
|
27
|
-
numUsers: 10000, //how many users
|
|
28
|
-
format: 'json', //csv or json
|
|
29
|
-
region: "US",
|
|
30
|
-
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
31
|
-
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
32
|
-
isAnonymous: true,
|
|
33
|
-
hasLocation: true,
|
|
34
|
-
events: [
|
|
35
|
-
{
|
|
36
|
-
event: "foo",
|
|
37
|
-
weight: 10,
|
|
38
|
-
properties: {}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
event: "bar",
|
|
42
|
-
weight: 9,
|
|
43
|
-
properties: {}
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
event: "baz",
|
|
47
|
-
weight: 8,
|
|
48
|
-
properties: {}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
event: "qux",
|
|
52
|
-
weight: 7,
|
|
53
|
-
properties: {}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
event: "garply",
|
|
57
|
-
weight: 6,
|
|
58
|
-
properties: {}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
event: "durtle",
|
|
62
|
-
weight: 5,
|
|
63
|
-
properties: {}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
event: "linny",
|
|
67
|
-
weight: 4,
|
|
68
|
-
properties: {}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
event: "fonk",
|
|
72
|
-
weight: 3,
|
|
73
|
-
properties: {}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
event: "crumn",
|
|
77
|
-
weight: 2,
|
|
78
|
-
properties: {}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
event: "yak",
|
|
82
|
-
weight: 1,
|
|
83
|
-
properties: {}
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
superProps: {},
|
|
87
|
-
userProps: {
|
|
88
|
-
title: chance.profession.bind(chance),
|
|
89
|
-
luckyNumber: weighNumRange(42, 420),
|
|
90
|
-
spiritAnimal: ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]
|
|
91
|
-
},
|
|
92
|
-
scdProps: {},
|
|
93
|
-
mirrorProps: {},
|
|
94
|
-
groupKeys: [],
|
|
95
|
-
groupProps: {},
|
|
96
|
-
lookupTables: [],
|
|
97
|
-
hook: function (record, type, meta) {
|
|
98
|
-
return record;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
module.exports = config;
|
package/dungeons/big.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
const seed = "lets go big";
|
|
2
|
-
const Chance = require('chance');
|
|
3
|
-
const chance = new Chance();
|
|
4
|
-
const dayjs = require("dayjs");
|
|
5
|
-
const utc = require("dayjs/plugin/utc");
|
|
6
|
-
dayjs.extend(utc);
|
|
7
|
-
const { uid, comma, makeName } = require('ak-tools');
|
|
8
|
-
const { pickAWinner, weighNumRange, integer, date, choose } = require('../components/utils');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const eventsPerQuarter = 5_000_000_000 // ~5 billion
|
|
12
|
-
const numQuarters = 8; // 24 months
|
|
13
|
-
const parallelism = 5000;
|
|
14
|
-
const totalEvents = Math.floor((eventsPerQuarter * numQuarters) / parallelism);
|
|
15
|
-
const eventPerUser = 500;
|
|
16
|
-
const totalUsers = Math.floor(totalEvents / eventPerUser);
|
|
17
|
-
const totalDays = (numQuarters * 90) + 10;
|
|
18
|
-
|
|
19
|
-
/** @type {import('../types').Dungeon} */
|
|
20
|
-
const config = {
|
|
21
|
-
token: "",
|
|
22
|
-
seed: seed,
|
|
23
|
-
numDays: totalDays,
|
|
24
|
-
numEvents: totalEvents,
|
|
25
|
-
numUsers: totalUsers,
|
|
26
|
-
format: 'json', //csv or json
|
|
27
|
-
region: "US",
|
|
28
|
-
hasAnonIds: false, //if true, anonymousIds are created for each user
|
|
29
|
-
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
30
|
-
hasLocation: true,
|
|
31
|
-
hasAndroidDevices: false,
|
|
32
|
-
alsoInferFunnels: false,
|
|
33
|
-
batchSize: 2_000_000,
|
|
34
|
-
hasAvatar: false,
|
|
35
|
-
hasAdSpend: false,
|
|
36
|
-
hasBrowser: false,
|
|
37
|
-
hasCampaigns: false,
|
|
38
|
-
hasDesktopDevices: false,
|
|
39
|
-
hasIOSDevices: false,
|
|
40
|
-
writeToDisk: "gs://dungeon_master_4/big_data",
|
|
41
|
-
funnels: [
|
|
42
|
-
{
|
|
43
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
|
|
44
|
-
weight: 1,
|
|
45
|
-
order: "sequential"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"sequence": ["foo", "bar"],
|
|
49
|
-
weight: 25,
|
|
50
|
-
order: "sequential"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"sequence": ["foo", "bar", "baz"],
|
|
54
|
-
weight: 20,
|
|
55
|
-
order: "sequential"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"sequence": ["foo", "bar", "baz", "qux"],
|
|
59
|
-
weight: 15,
|
|
60
|
-
order: "sequential"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply"],
|
|
64
|
-
weight: 10,
|
|
65
|
-
order: "sequential"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply", "durtle"],
|
|
69
|
-
weight: 8,
|
|
70
|
-
order: "sequential"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny"],
|
|
74
|
-
weight: 6,
|
|
75
|
-
order: "sequential"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk"],
|
|
79
|
-
weight: 4,
|
|
80
|
-
order: "sequential"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn"],
|
|
84
|
-
weight: 2,
|
|
85
|
-
order: "sequential"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"sequence": ["foo", "bar", "baz", "qux", "garply", "durtle", "linny", "fonk", "crumn", "yak"],
|
|
89
|
-
weight: 1,
|
|
90
|
-
order: "sequential"
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
],
|
|
94
|
-
events: [
|
|
95
|
-
{ event: "foo" },
|
|
96
|
-
{ event: "bar" },
|
|
97
|
-
{ event: "baz" },
|
|
98
|
-
{ event: "qux" },
|
|
99
|
-
{ event: "garply" },
|
|
100
|
-
{ event: "durtle" },
|
|
101
|
-
{ event: "linny" },
|
|
102
|
-
{ event: "fonk" },
|
|
103
|
-
{ event: "crumn" },
|
|
104
|
-
{ event: "yak" }
|
|
105
|
-
],
|
|
106
|
-
//? https://docs.mixpanel.com/docs/data-structure/property-reference/data-type
|
|
107
|
-
superProps: {
|
|
108
|
-
"string": pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"]),
|
|
109
|
-
"number": integer,
|
|
110
|
-
"boolean": [true, true, false],
|
|
111
|
-
"date": () => date(90),
|
|
112
|
-
"string []": buildStringArray,
|
|
113
|
-
"number []": buildNumberArray,
|
|
114
|
-
"object {}": buildObjectProp,
|
|
115
|
-
"object [{}]": buildObjArrayProp
|
|
116
|
-
},
|
|
117
|
-
userProps: {
|
|
118
|
-
title: chance.profession.bind(chance),
|
|
119
|
-
luckyNumber: weighNumRange(42, 420),
|
|
120
|
-
spiritAnimal: pickAWinner(["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]),
|
|
121
|
-
isHappyCustomer: pickAWinner([true, true, false]),
|
|
122
|
-
},
|
|
123
|
-
hook: function (record, type, meta) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// if (type === "event") {
|
|
127
|
-
// debugger;
|
|
128
|
-
// }
|
|
129
|
-
|
|
130
|
-
// if (type === "user") {
|
|
131
|
-
|
|
132
|
-
// }
|
|
133
|
-
|
|
134
|
-
// if (type === "funnel-post") {
|
|
135
|
-
|
|
136
|
-
// }
|
|
137
|
-
|
|
138
|
-
// if (type === "funnel-pre") {
|
|
139
|
-
|
|
140
|
-
// }
|
|
141
|
-
|
|
142
|
-
// if (type === "scd") {
|
|
143
|
-
|
|
144
|
-
// }
|
|
145
|
-
|
|
146
|
-
// if (type === "everything") {
|
|
147
|
-
// debugger;
|
|
148
|
-
// }
|
|
149
|
-
|
|
150
|
-
return record;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
function buildObjectProp() {
|
|
156
|
-
return function () {
|
|
157
|
-
return {
|
|
158
|
-
"foo key": choose(pickAWinner(["red", "orange", "yellow", "green", "blue", "indigo", "violet"])()),
|
|
159
|
-
"bar key": integer(1, 100),
|
|
160
|
-
"baz key": choose(pickAWinner([true, true, false])()),
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
function buildNumberArray() {
|
|
167
|
-
return function () {
|
|
168
|
-
const arr = [];
|
|
169
|
-
const times = integer(1, 10);
|
|
170
|
-
for (let i = 0; i < times; i++) {
|
|
171
|
-
arr.push(integer(1, 100));
|
|
172
|
-
}
|
|
173
|
-
return [arr];
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function buildStringArray() {
|
|
178
|
-
return function () {
|
|
179
|
-
const arr = [];
|
|
180
|
-
const times = integer(1, 10);
|
|
181
|
-
for (let i = 0; i < times; i++) {
|
|
182
|
-
arr.push(makeName(integer(1, 3), " "));
|
|
183
|
-
}
|
|
184
|
-
return [arr];
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
function buildObjArrayProp(maxItems = 5) {
|
|
190
|
-
|
|
191
|
-
return function () {
|
|
192
|
-
const categories = ["Device Accessories", "eBooks", "Automotive", "Baby Products", "Beauty", "Books", "Camera & Photo", "Cell Phones & Accessories", "Collectible Coins", "Consumer Electronics", "Entertainment Collectibles", "Fine Art", "Grocery & Gourmet Food", "Health & Personal Care", "Home & Garden", "Independent Design", "Industrial & Scientific", "Accessories", "Major Appliances", "Music", "Musical Instruments", "Office Products", "Outdoors", "Personal Computers", "Pet Supplies", "Software", "Sports", "Sports Collectibles", "Tools & Home Improvement", "Toys & Games", "Video, DVD & Blu-ray", "Video Games", "Watches"];
|
|
193
|
-
const slugs = ['/sale/', '/featured/', '/home/', '/search/', '/wishlist/', '/'];
|
|
194
|
-
const assetExtension = ['.png', '.jpg', '.jpeg', '.heic', '.mp4', '.mov', '.avi'];
|
|
195
|
-
const data = [];
|
|
196
|
-
const numOfItems = integer(1, maxItems);
|
|
197
|
-
|
|
198
|
-
for (var i = 0; i < numOfItems; i++) {
|
|
199
|
-
const category = chance.pickone(categories);
|
|
200
|
-
const slug = chance.pickone(slugs);
|
|
201
|
-
const asset = chance.pickone(assetExtension);
|
|
202
|
-
const price = integer(1, 300);
|
|
203
|
-
const quantity = integer(1, 5);
|
|
204
|
-
|
|
205
|
-
const item = {
|
|
206
|
-
sku: integer(11111, 99999),
|
|
207
|
-
amount: price,
|
|
208
|
-
quantity: quantity,
|
|
209
|
-
total: price * quantity,
|
|
210
|
-
featured: chance.pickone([true, false]),
|
|
211
|
-
category: category,
|
|
212
|
-
urlSlug: slug + category,
|
|
213
|
-
asset: `${category}-${integer(1, 20)}${asset}`
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
data.push(item);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return () => [data];
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
module.exports = config;
|