@prismicio/mock 0.0.8 → 0.0.9
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/dist/api/index.cjs +208 -100
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +208 -100
- package/dist/api/index.js.map +1 -1
- package/dist/index.cjs +311 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.js +310 -211
- package/dist/index.js.map +1 -1
- package/dist/model/index.cjs +168 -74
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.d.ts +1 -1
- package/dist/model/index.js +168 -74
- package/dist/model/index.js.map +1 -1
- package/dist/value/index.cjs +280 -182
- package/dist/value/index.cjs.map +1 -1
- package/dist/value/index.d.ts +8 -4
- package/dist/value/index.js +280 -182
- package/dist/value/index.js.map +1 -1
- package/package.json +19 -16
- package/src/api/query.ts +2 -2
- package/src/api/ref.ts +3 -3
- package/src/api/repository.ts +5 -5
- package/src/lib/buildEmbedField.ts +16 -27
- package/src/lib/buildImageFieldImage.ts +3 -2
- package/src/lib/createFaker.ts +98 -20
- package/src/lib/generateCustomTypeId.ts +1 -1
- package/src/lib/generateFieldId.ts +1 -3
- package/src/lib/generateTags.ts +4 -12
- package/src/lib/getMockEmbedData.ts +33 -12
- package/src/lib/getMockImageData.ts +1 -1
- package/src/lib/lorem.ts +112 -0
- package/src/model/boolean.ts +1 -1
- package/src/model/buildMockGroupFieldMap.ts +1 -1
- package/src/model/color.ts +2 -2
- package/src/model/contentRelationship.ts +2 -2
- package/src/model/customType.ts +3 -3
- package/src/model/date.ts +2 -2
- package/src/model/embed.ts +2 -2
- package/src/model/geoPoint.ts +1 -1
- package/src/model/group.ts +1 -1
- package/src/model/image.ts +5 -9
- package/src/model/integrationFields.ts +2 -2
- package/src/model/keyText.ts +2 -2
- package/src/model/link.ts +3 -3
- package/src/model/linkToMedia.ts +2 -2
- package/src/model/number.ts +2 -2
- package/src/model/richText.ts +6 -6
- package/src/model/select.ts +2 -2
- package/src/model/sharedSlice.ts +2 -2
- package/src/model/sharedSliceVariation.ts +4 -4
- package/src/model/slice.ts +4 -4
- package/src/model/timestamp.ts +2 -2
- package/src/model/title.ts +5 -5
- package/src/model/uid.ts +2 -2
- package/src/types.ts +7 -10
- package/src/value/boolean.ts +1 -1
- package/src/value/color.ts +1 -1
- package/src/value/contentRelationship.ts +3 -3
- package/src/value/customType.ts +5 -5
- package/src/value/embed.ts +20 -7
- package/src/value/geoPoint.ts +2 -4
- package/src/value/group.ts +1 -6
- package/src/value/integrationFields.ts +4 -4
- package/src/value/keyText.ts +1 -3
- package/src/value/link.ts +3 -3
- package/src/value/linkToMedia.ts +7 -6
- package/src/value/number.ts +1 -1
- package/src/value/richText/embed.ts +2 -2
- package/src/value/richText/heading.ts +3 -10
- package/src/value/richText/image.ts +3 -5
- package/src/value/richText/index.ts +3 -8
- package/src/value/richText/list.ts +4 -8
- package/src/value/richText/oList.ts +4 -8
- package/src/value/richText/paragraph.ts +8 -4
- package/src/value/richText/preformatted.ts +9 -5
- package/src/value/select.ts +2 -2
- package/src/value/sharedSlice.ts +1 -1
- package/src/value/sharedSliceVariation.ts +2 -6
- package/src/value/slice.ts +2 -6
- package/src/value/sliceZone.ts +4 -10
- package/src/value/timestamp.ts +28 -15
- package/src/value/uid.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const changeCase = require('change-case');
|
|
6
|
-
const
|
|
7
|
-
const Faker = require('faker/lib/index.js');
|
|
6
|
+
const Rand = require('rand-seed');
|
|
8
7
|
const prismicT = require('@prismicio/types');
|
|
9
8
|
|
|
10
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -28,43 +27,135 @@ function _interopNamespace(e) {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
const changeCase__namespace = /*#__PURE__*/_interopNamespace(changeCase);
|
|
31
|
-
const
|
|
32
|
-
const Faker__default = /*#__PURE__*/_interopDefaultLegacy(Faker);
|
|
30
|
+
const Rand__default = /*#__PURE__*/_interopDefaultLegacy(Rand);
|
|
33
31
|
const prismicT__namespace = /*#__PURE__*/_interopNamespace(prismicT);
|
|
34
32
|
|
|
35
33
|
const FAKER_SEED = 1984;
|
|
36
34
|
|
|
35
|
+
const wordsString = "lorem ipsum dolor sit amet, consectetur adipiscing elit ut aliquam, purus sit amet luctus venenatis, lectus magna fringilla urna, porttitor rhoncus dolor purus non enim praesent elementum facilisis leo, vel fringilla est ullamcorper eget nulla facilisi etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus in ornare quam viverra orci sagittis eu volutpat odio facilisis mauris sit amet massa vitae tortor condimentum lacinia quis vel eros donec ac odio tempor orci dapibus ultrices in iaculis nunc sed augue lacus, viverra vitae congue eu, consequat ac felis donec et odio pellentesque diam volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed velit dignissim sodales ut eu sem integer vitae justo eget magna fermentum iaculis eu non diam phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet enim tortor, at auctor urna nunc id cursus metus aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices sagittis orci, a scelerisque purus semper eget duis at tellus at urna condimentum mattis pellentesque id nibh tortor, id aliquet lectus proin nibh nisl, condimentum id venenatis a, condimentum vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas sed tempus, urna et pharetra pharetra, massa massa ultricies mi, quis hendrerit dolor magna eget est lorem ipsum dolor sit amet, consectetur adipiscing elit pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas integer eget aliquet nibh praesent tristique magna sit amet purus gravida quis blandit turpis cursus in hac habitasse platea dictumst quisque sagittis, purus sit amet volutpat consequat, mauris nunc congue nisi, vitae suscipit tellus mauris a diam maecenas sed enim ut sem viverra aliquet eget sit amet tellus cras adipiscing enim eu turpis egestas pretium aenean pharetra, magna ac placerat vestibulum, lectus mauris ultrices eros, in cursus turpis massa tincidunt dui ut ornare lectus sit amet est placerat in egestas erat imperdiet sed euismod nisi porta lorem mollis aliquam ut porttitor leo a diam sollicitudin tempor id eu nisl nunc mi ipsum, faucibus vitae aliquet nec, ullamcorper sit amet risus nullam eget felis eget nunc lobortis mattis aliquam faucibus purus in massa tempor nec feugiat nisl pretium fusce id velit ut tortor pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare suspendisse sed nisi lacus, sed viverra tellus in hac habitasse platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu dictum varius duis at consectetur lorem donec massa sapien, faucibus et molestie ac, feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra accumsan in nisl nisi, scelerisque eu ultrices vitae, auctor eu augue ut lectus arcu, bibendum at varius vel, pharetra vel turpis nunc eget lorem dolor, sed viverra ipsum nunc aliquet bibendum enim, facilisis gravida neque convallis a cras semper auctor neque, vitae tempus quam pellentesque nec nam aliquam sem et tortor consequat id porta nibh venenatis cras sed felis eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar elementum integer enim neque, volutpat ac tincidunt vitae, semper quis lectus nulla at volutpat diam ut venenatis tellus in metus vulputate eu scelerisque felis imperdiet proin fermentum leo vel orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero, id faucibus nisl tincidunt eget nullam non nisi est, sit amet facilisis magna etiam tempor, orci eu lobortis elementum, nibh tellus molestie nunc, non blandit massa enim nec dui nunc mattis enim ut tellus elementum sagittis vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum morbi blandit cursus risus, at ultrices mi tempus imperdiet nulla malesuada pellentesque elit eget gravida cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus mauris vitae ultricies leo integer malesuada nunc vel risus commodo viverra maecenas accumsan, lacus vel facilisis volutpat, est velit egestas dui, id ornare arcu odio ut sem nulla pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc, consequat interdum varius sit amet, mattis vulputate enim nulla aliquet porttitor lacus, luctus accumsan tortor posuere ac ut consequat semper viverra nam libero justo, laoreet sit amet cursus sit amet, dictum sit amet justo donec enim diam, vulputate ut pharetra sit amet, aliquam id diam maecenas ultricies mi eget mauris pharetra et ultrices neque ornare aenean euismod elementum nisi, quis eleifend quam adipiscing vitae proin sagittis, nisl rhoncus mattis rhoncus, urna neque viverra justo, nec ultrices dui sapien eget mi proin sed libero enim, sed faucibus turpis in eu mi bibendum neque egestas congue quisque egestas diam in arcu cursus euismod quis viverra nibh cras pulvinar mattis nunc, sed blandit libero volutpat sed cras ornare arcu dui vivamus arcu felis, bibendum ut tristique et, egestas quis ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim enim, sit amet venenatis urna cursus eget nunc scelerisque viverra mauris, in aliquam sem fringilla ut morbi tincidunt augue interdum velit euismod in pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id aliquet risus feugiat in ante metus, dictum at tempor commodo, ullamcorper a lacus vestibulum sed arcu non odio euismod lacinia at quis risus sed vulputate odio ut enim blandit volutpat maecenas volutpat blandit aliquam etiam erat velit, scelerisque in dictum non, consectetur a erat nam at lectus urna duis convallis convallis tellus, id interdum velit laoreet id donec ultrices tincidunt arcu, non sodales neque sodales ut etiam sit amet nisl purus, in mollis nunc sed id semper risus in hendrerit gravida rutrum quisque non tellus orci, ac auctor augue mauris augue neque, gravida in fermentum et, sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum, odio eu feugiat pretium, nibh ipsum consequat nisl, vel pretium lectus quam id leo in vitae turpis massa sed elementum tempus egestas sed sed risus pretium quam vulputate dignissim suspendisse in est ante in nibh mauris, cursus mattis molestie a, iaculis at erat pellentesque adipiscing commodo elit, at imperdiet dui accumsan sit amet nulla facilisi morbi tempus iaculis urna, id volutpat lacus laoreet non curabitur gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius morbi enim nunc, faucibus a pellentesque sit amet, porttitor eget dolor morbi non arcu risus, quis varius quam quisque id diam vel quam elementum pulvinar etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit amet, consectetur adipiscing elit duis tristique sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi leo urna, molestie at elementum eu, facilisis sed odio morbi quis commodo odio aenean sed adipiscing diam donec adipiscing tristique risus nec feugiat in fermentum posuere urna nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida hendrerit lectus a molestie";
|
|
36
|
+
const loremWords = wordsString.split(" ");
|
|
37
|
+
const lorem = (length, wordOffset = 0) => {
|
|
38
|
+
const count = parseInt(length.substring(0, length.length - 1));
|
|
39
|
+
const countType = length.charAt(length.length - 1);
|
|
40
|
+
if (!isNaN(count) && (countType === "w" || countType === "c")) {
|
|
41
|
+
if (!lorem.spaceIndices.length) {
|
|
42
|
+
let startIndex = -1;
|
|
43
|
+
do {
|
|
44
|
+
const index = wordsString.indexOf(" ", startIndex + 1);
|
|
45
|
+
lorem.spaceIndices.push(index);
|
|
46
|
+
startIndex = index;
|
|
47
|
+
} while (startIndex !== -1);
|
|
48
|
+
}
|
|
49
|
+
if (countType === "c") {
|
|
50
|
+
return wordsString.substring(0, count);
|
|
51
|
+
} else {
|
|
52
|
+
let sentence = "";
|
|
53
|
+
const startSpaceIndex = lorem.spaceIndices[wordOffset % lorem.spaceIndices.length - 1];
|
|
54
|
+
const endSpaceIndex = lorem.spaceIndices[(wordOffset % lorem.spaceIndices.length + count) % lorem.spaceIndices.length - 1];
|
|
55
|
+
if (count + wordOffset % lorem.spaceIndices.length > lorem.spaceIndices.length) {
|
|
56
|
+
sentence += wordsString.substring(startSpaceIndex + 1) + " ";
|
|
57
|
+
const wraparoundCounts = Math.floor(count / lorem.spaceIndices.length) - 1;
|
|
58
|
+
for (let i = 0; i < wraparoundCounts; i++) {
|
|
59
|
+
sentence += wordsString + " ";
|
|
60
|
+
}
|
|
61
|
+
sentence += wordsString.substring(0, endSpaceIndex);
|
|
62
|
+
} else {
|
|
63
|
+
sentence = wordsString.substring(startSpaceIndex + 1, endSpaceIndex);
|
|
64
|
+
}
|
|
65
|
+
if (sentence.charAt(sentence.length - 1) === ",") {
|
|
66
|
+
return sentence.substring(0, sentence.length - 1);
|
|
67
|
+
} else {
|
|
68
|
+
return sentence.substring(0, sentence.length);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw new Error("Length must be of the form `${number}w` or `${number}c`");
|
|
73
|
+
};
|
|
74
|
+
lorem.spaceIndices = [];
|
|
75
|
+
|
|
37
76
|
const createFaker = (seed = FAKER_SEED) => {
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
77
|
+
const normalizedSeed = seed.toString();
|
|
78
|
+
if (createFaker.cache[normalizedSeed]) {
|
|
79
|
+
return createFaker.cache[normalizedSeed];
|
|
41
80
|
} else {
|
|
42
|
-
|
|
81
|
+
const faker = new Faker(normalizedSeed);
|
|
82
|
+
return createFaker.cache[normalizedSeed] = faker;
|
|
43
83
|
}
|
|
44
|
-
const cacheKey = JSON.stringify(normalizedSeed);
|
|
45
|
-
if (createFaker.cache[cacheKey]) {
|
|
46
|
-
return createFaker.cache[cacheKey];
|
|
47
|
-
}
|
|
48
|
-
const fakerInstance = new Faker__default["default"]();
|
|
49
|
-
fakerInstance.locales["en"] = fakerLocaleEN__namespace;
|
|
50
|
-
fakerInstance.seed(normalizedSeed);
|
|
51
|
-
createFaker.cache[cacheKey] = fakerInstance;
|
|
52
|
-
return fakerInstance;
|
|
53
84
|
};
|
|
54
85
|
createFaker.cache = {};
|
|
86
|
+
const DAY_MS = 1e3 * 60 * 60 * 24;
|
|
87
|
+
const YEAR_MS = DAY_MS * 365;
|
|
88
|
+
const YEAR_2022_MS = 52 * (YEAR_MS + DAY_MS / 4);
|
|
89
|
+
class Faker {
|
|
90
|
+
constructor(seed) {
|
|
91
|
+
this.rand = new Rand__default["default"](seed);
|
|
92
|
+
}
|
|
93
|
+
boolean() {
|
|
94
|
+
return this.random() >= 0.5;
|
|
95
|
+
}
|
|
96
|
+
random() {
|
|
97
|
+
return this.rand.next();
|
|
98
|
+
}
|
|
99
|
+
randomElement(elements) {
|
|
100
|
+
return elements[this.range(0, elements.length)];
|
|
101
|
+
}
|
|
102
|
+
randomElements(elements) {
|
|
103
|
+
return elements.filter(() => this.boolean());
|
|
104
|
+
}
|
|
105
|
+
range(min, max) {
|
|
106
|
+
return Math.floor(this.rangeFloat(Math.ceil(min), Math.floor(max)));
|
|
107
|
+
}
|
|
108
|
+
rangeFloat(min, max) {
|
|
109
|
+
return this.random() * (max - min) + min;
|
|
110
|
+
}
|
|
111
|
+
words(length, wordOffset = this.range(0, loremWords.length)) {
|
|
112
|
+
return lorem(`${length}w`, wordOffset);
|
|
113
|
+
}
|
|
114
|
+
word() {
|
|
115
|
+
return this.randomElement(loremWords);
|
|
116
|
+
}
|
|
117
|
+
lorem(length, wordOffset = this.range(0, loremWords.length)) {
|
|
118
|
+
return lorem(length, wordOffset);
|
|
119
|
+
}
|
|
120
|
+
url() {
|
|
121
|
+
return `https://${this.word()}.example`;
|
|
122
|
+
}
|
|
123
|
+
hexColor() {
|
|
124
|
+
return `#${this.hash(6)}`;
|
|
125
|
+
}
|
|
126
|
+
hash(length) {
|
|
127
|
+
let hash = "";
|
|
128
|
+
for (let i = 0; i < length; i++) {
|
|
129
|
+
const chars = this.boolean() ? "abcdef" : "0123456789";
|
|
130
|
+
hash += chars[this.range(0, chars.length)];
|
|
131
|
+
}
|
|
132
|
+
return hash;
|
|
133
|
+
}
|
|
134
|
+
date() {
|
|
135
|
+
return new Date(YEAR_2022_MS + this.range(-YEAR_MS * 3, YEAR_MS * 3));
|
|
136
|
+
}
|
|
137
|
+
dateAfter(date) {
|
|
138
|
+
const timestamp = date.getTime();
|
|
139
|
+
return new Date(this.range(timestamp, timestamp + YEAR_MS * 3));
|
|
140
|
+
}
|
|
141
|
+
dateBefore(date) {
|
|
142
|
+
const timestamp = date.getTime();
|
|
143
|
+
return new Date(this.range(timestamp - YEAR_MS * 3, timestamp));
|
|
144
|
+
}
|
|
145
|
+
dateBetween(min, max) {
|
|
146
|
+
return new Date(this.range(min.getTime(), max.getTime()));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
55
149
|
|
|
56
150
|
const generateTags = (config) => {
|
|
57
151
|
var _a, _b;
|
|
58
152
|
const faker = createFaker(config.seed);
|
|
59
|
-
return Array(faker.
|
|
60
|
-
min: (_a = config.min) != null ? _a : 0,
|
|
61
|
-
max: (_b = config.max) != null ? _b : 2
|
|
62
|
-
})).fill(void 0).map(() => changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({ min: 1, max: 3 }))));
|
|
153
|
+
return Array.from({ length: faker.range((_a = config.min) != null ? _a : 0, (_b = config.max) != null ? _b : 2) }, () => changeCase__namespace.capitalCase(faker.words(faker.range(1, 3))));
|
|
63
154
|
};
|
|
64
155
|
|
|
65
156
|
const boolean$1 = (config = {}) => {
|
|
66
157
|
const faker = createFaker(config.seed);
|
|
67
|
-
return faker.
|
|
158
|
+
return faker.boolean();
|
|
68
159
|
};
|
|
69
160
|
|
|
70
161
|
const valueForModel = (config) => {
|
|
@@ -281,7 +372,7 @@ const boolean = (config = {}) => {
|
|
|
281
372
|
return {
|
|
282
373
|
type: prismicT__namespace.CustomTypeModelFieldType.Boolean,
|
|
283
374
|
config: {
|
|
284
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
375
|
+
label: changeCase__namespace.capitalCase(faker.word())
|
|
285
376
|
}
|
|
286
377
|
};
|
|
287
378
|
};
|
|
@@ -291,8 +382,8 @@ const color$1 = (config = {}) => {
|
|
|
291
382
|
return {
|
|
292
383
|
type: prismicT__namespace.CustomTypeModelFieldType.Color,
|
|
293
384
|
config: {
|
|
294
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
295
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
385
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
386
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
296
387
|
}
|
|
297
388
|
};
|
|
298
389
|
};
|
|
@@ -302,8 +393,8 @@ const contentRelationship$1 = (config = {}) => {
|
|
|
302
393
|
return {
|
|
303
394
|
type: prismicT__namespace.CustomTypeModelFieldType.Link,
|
|
304
395
|
config: {
|
|
305
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
306
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
396
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
397
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
307
398
|
select: prismicT__namespace.CustomTypeModelLinkSelectType.Document,
|
|
308
399
|
customtypes: config.customTypeIDs,
|
|
309
400
|
tags: config.tags
|
|
@@ -314,7 +405,7 @@ const contentRelationship$1 = (config = {}) => {
|
|
|
314
405
|
const customType$1 = (config = {}) => {
|
|
315
406
|
var _a, _b;
|
|
316
407
|
const faker = createFaker(config.seed);
|
|
317
|
-
let label = config.label || changeCase__namespace.capitalCase(faker.
|
|
408
|
+
let label = config.label || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
|
|
318
409
|
let id = config.id || changeCase__namespace.snakeCase(label);
|
|
319
410
|
if (config.id && !config.label) {
|
|
320
411
|
label = changeCase__namespace.capitalCase(config.id);
|
|
@@ -330,8 +421,8 @@ const customType$1 = (config = {}) => {
|
|
|
330
421
|
return {
|
|
331
422
|
id,
|
|
332
423
|
label,
|
|
333
|
-
status: (_a = config.status) != null ? _a : faker.
|
|
334
|
-
repeatable: (_b = config.repeatable) != null ? _b : faker.
|
|
424
|
+
status: (_a = config.status) != null ? _a : faker.boolean(),
|
|
425
|
+
repeatable: (_b = config.repeatable) != null ? _b : faker.boolean(),
|
|
335
426
|
json
|
|
336
427
|
};
|
|
337
428
|
};
|
|
@@ -341,8 +432,8 @@ const date$1 = (config = {}) => {
|
|
|
341
432
|
return {
|
|
342
433
|
type: prismicT__namespace.CustomTypeModelFieldType.Date,
|
|
343
434
|
config: {
|
|
344
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
345
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
435
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
436
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
346
437
|
}
|
|
347
438
|
};
|
|
348
439
|
};
|
|
@@ -352,8 +443,8 @@ const embed$2 = (config = {}) => {
|
|
|
352
443
|
return {
|
|
353
444
|
type: prismicT__namespace.CustomTypeModelFieldType.Embed,
|
|
354
445
|
config: {
|
|
355
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
356
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
446
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
447
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
357
448
|
}
|
|
358
449
|
};
|
|
359
450
|
};
|
|
@@ -363,7 +454,7 @@ const geoPoint$1 = (config = {}) => {
|
|
|
363
454
|
return {
|
|
364
455
|
type: prismicT__namespace.CustomTypeModelFieldType.GeoPoint,
|
|
365
456
|
config: {
|
|
366
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
457
|
+
label: changeCase__namespace.capitalCase(faker.word())
|
|
367
458
|
}
|
|
368
459
|
};
|
|
369
460
|
};
|
|
@@ -373,7 +464,7 @@ const group$1 = (config = {}) => {
|
|
|
373
464
|
return {
|
|
374
465
|
type: prismicT__namespace.CustomTypeModelFieldType.Group,
|
|
375
466
|
config: {
|
|
376
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
467
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
377
468
|
fields: config.fields || {}
|
|
378
469
|
}
|
|
379
470
|
};
|
|
@@ -384,17 +475,17 @@ const image$2 = (config = {}) => {
|
|
|
384
475
|
const thumbnails = (config.thumbnailNames || []).map((name) => {
|
|
385
476
|
return {
|
|
386
477
|
name,
|
|
387
|
-
width: faker.
|
|
388
|
-
height: faker.
|
|
478
|
+
width: faker.range(500, 2e3),
|
|
479
|
+
height: faker.range(500, 2e3)
|
|
389
480
|
};
|
|
390
481
|
});
|
|
391
482
|
return {
|
|
392
483
|
type: prismicT__namespace.CustomTypeModelFieldType.Image,
|
|
393
484
|
config: {
|
|
394
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
485
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
395
486
|
constraint: {
|
|
396
|
-
width: config.withConstraint ? faker.
|
|
397
|
-
height: config.withConstraint ? faker.
|
|
487
|
+
width: config.withConstraint ? faker.range(500, 2e3) : null,
|
|
488
|
+
height: config.withConstraint ? faker.range(500, 2e3) : null
|
|
398
489
|
},
|
|
399
490
|
thumbnails
|
|
400
491
|
}
|
|
@@ -406,8 +497,8 @@ const integrationFields$1 = (config = {}) => {
|
|
|
406
497
|
return {
|
|
407
498
|
type: prismicT__namespace.CustomTypeModelFieldType.IntegrationFields,
|
|
408
499
|
config: {
|
|
409
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
410
|
-
catalog: config.catalog || changeCase__namespace.snakeCase(faker.
|
|
500
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
501
|
+
catalog: config.catalog || changeCase__namespace.snakeCase(faker.words(2))
|
|
411
502
|
}
|
|
412
503
|
};
|
|
413
504
|
};
|
|
@@ -417,8 +508,8 @@ const keyText$1 = (config = {}) => {
|
|
|
417
508
|
return {
|
|
418
509
|
type: prismicT__namespace.CustomTypeModelFieldType.Text,
|
|
419
510
|
config: {
|
|
420
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
421
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
511
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
512
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
422
513
|
}
|
|
423
514
|
};
|
|
424
515
|
};
|
|
@@ -428,10 +519,10 @@ const link$1 = (config = {}) => {
|
|
|
428
519
|
return {
|
|
429
520
|
type: prismicT__namespace.CustomTypeModelFieldType.Link,
|
|
430
521
|
config: {
|
|
431
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
432
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
522
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
523
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
433
524
|
select: null,
|
|
434
|
-
allowTargetBlank: ("allowTargetBlank" in config ? config.allowTargetBlank : faker.
|
|
525
|
+
allowTargetBlank: ("allowTargetBlank" in config ? config.allowTargetBlank : faker.boolean()) || void 0
|
|
435
526
|
}
|
|
436
527
|
};
|
|
437
528
|
};
|
|
@@ -441,8 +532,8 @@ const linkToMedia$1 = (config = {}) => {
|
|
|
441
532
|
return {
|
|
442
533
|
type: prismicT__namespace.CustomTypeModelFieldType.Link,
|
|
443
534
|
config: {
|
|
444
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
445
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
535
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
536
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
446
537
|
select: prismicT__namespace.CustomTypeModelLinkSelectType.Media
|
|
447
538
|
}
|
|
448
539
|
};
|
|
@@ -453,8 +544,8 @@ const number$1 = (config = {}) => {
|
|
|
453
544
|
return {
|
|
454
545
|
type: prismicT__namespace.CustomTypeModelFieldType.Number,
|
|
455
546
|
config: {
|
|
456
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
457
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
547
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
548
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
458
549
|
}
|
|
459
550
|
};
|
|
460
551
|
};
|
|
@@ -462,7 +553,7 @@ const number$1 = (config = {}) => {
|
|
|
462
553
|
const richText$1 = (config = {}) => {
|
|
463
554
|
var _a;
|
|
464
555
|
const faker = createFaker(config.seed);
|
|
465
|
-
const blockTypes = faker.
|
|
556
|
+
const blockTypes = faker.randomElements([
|
|
466
557
|
prismicT__namespace.RichTextNodeType.heading1,
|
|
467
558
|
prismicT__namespace.RichTextNodeType.heading2,
|
|
468
559
|
prismicT__namespace.RichTextNodeType.heading3,
|
|
@@ -479,13 +570,13 @@ const richText$1 = (config = {}) => {
|
|
|
479
570
|
prismicT__namespace.RichTextNodeType.embed,
|
|
480
571
|
prismicT__namespace.RichTextNodeType.hyperlink
|
|
481
572
|
]).join(",");
|
|
482
|
-
const blockTypeConfig = ((_a = config.withMultipleBlocks) != null ? _a : faker.
|
|
573
|
+
const blockTypeConfig = ((_a = config.withMultipleBlocks) != null ? _a : faker.boolean()) ? { multi: blockTypes } : { single: blockTypes };
|
|
483
574
|
return {
|
|
484
575
|
type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
|
|
485
576
|
config: {
|
|
486
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
487
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
488
|
-
allowTargetBlank: faker.
|
|
577
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
578
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
579
|
+
allowTargetBlank: faker.boolean() ? true : void 0,
|
|
489
580
|
...blockTypeConfig
|
|
490
581
|
}
|
|
491
582
|
};
|
|
@@ -496,8 +587,8 @@ const select$1 = (config = {}) => {
|
|
|
496
587
|
return {
|
|
497
588
|
type: prismicT__namespace.CustomTypeModelFieldType.Select,
|
|
498
589
|
config: {
|
|
499
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
500
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
590
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
591
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
501
592
|
options: config.options || [],
|
|
502
593
|
default_value: config.defaultValue || void 0
|
|
503
594
|
}
|
|
@@ -506,7 +597,7 @@ const select$1 = (config = {}) => {
|
|
|
506
597
|
|
|
507
598
|
const sharedSlice$1 = (config = {}) => {
|
|
508
599
|
const faker = createFaker(config.seed);
|
|
509
|
-
let name = config.name || changeCase__namespace.capitalCase(faker.
|
|
600
|
+
let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
|
|
510
601
|
let id = config.id || changeCase__namespace.snakeCase(name);
|
|
511
602
|
if (config.id && !config.name) {
|
|
512
603
|
name = changeCase__namespace.pascalCase(config.id);
|
|
@@ -517,7 +608,7 @@ const sharedSlice$1 = (config = {}) => {
|
|
|
517
608
|
type: prismicT__namespace.CustomTypeModelSliceType.SharedSlice,
|
|
518
609
|
id,
|
|
519
610
|
name,
|
|
520
|
-
description: faker.
|
|
611
|
+
description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
|
|
521
612
|
variations: config.variations || []
|
|
522
613
|
};
|
|
523
614
|
};
|
|
@@ -530,7 +621,7 @@ const sharedSliceChoice = () => {
|
|
|
530
621
|
|
|
531
622
|
const sharedSliceVariation$1 = (config = {}) => {
|
|
532
623
|
const faker = createFaker(config.seed);
|
|
533
|
-
let name = config.name || changeCase__namespace.capitalCase(faker.
|
|
624
|
+
let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
|
|
534
625
|
let id = config.id || changeCase__namespace.snakeCase(name);
|
|
535
626
|
if (config.id && !config.name) {
|
|
536
627
|
name = changeCase__namespace.pascalCase(config.id);
|
|
@@ -540,9 +631,9 @@ const sharedSliceVariation$1 = (config = {}) => {
|
|
|
540
631
|
return {
|
|
541
632
|
id,
|
|
542
633
|
name,
|
|
543
|
-
description: faker.
|
|
544
|
-
docURL: faker.
|
|
545
|
-
version: faker.
|
|
634
|
+
description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
|
|
635
|
+
docURL: faker.url(),
|
|
636
|
+
version: faker.hash(7),
|
|
546
637
|
primary: config.primaryFields || {},
|
|
547
638
|
items: config.itemsFields || {}
|
|
548
639
|
};
|
|
@@ -552,10 +643,10 @@ const slice$1 = (config = {}) => {
|
|
|
552
643
|
const faker = createFaker(config.seed);
|
|
553
644
|
return {
|
|
554
645
|
type: prismicT__namespace.CustomTypeModelSliceType.Slice,
|
|
555
|
-
icon: changeCase__namespace.snakeCase(faker.
|
|
556
|
-
display: faker.
|
|
557
|
-
fieldset: changeCase__namespace.capitalCase(faker.
|
|
558
|
-
description: faker.
|
|
646
|
+
icon: changeCase__namespace.snakeCase(faker.word()),
|
|
647
|
+
display: faker.boolean() ? prismicT__namespace.CustomTypeModelSliceDisplay.Grid : prismicT__namespace.CustomTypeModelSliceDisplay.List,
|
|
648
|
+
fieldset: changeCase__namespace.capitalCase(faker.words(2)),
|
|
649
|
+
description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
|
|
559
650
|
repeat: config.repeatFields || {},
|
|
560
651
|
"non-repeat": config.nonRepeatFields || {}
|
|
561
652
|
};
|
|
@@ -584,15 +675,15 @@ const timestamp$1 = (config = {}) => {
|
|
|
584
675
|
return {
|
|
585
676
|
type: prismicT__namespace.CustomTypeModelFieldType.Timestamp,
|
|
586
677
|
config: {
|
|
587
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
588
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
678
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
679
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
589
680
|
}
|
|
590
681
|
};
|
|
591
682
|
};
|
|
592
683
|
|
|
593
684
|
const title$1 = (config = {}) => {
|
|
594
685
|
const faker = createFaker(config.seed);
|
|
595
|
-
const single = faker.
|
|
686
|
+
const single = faker.randomElements([
|
|
596
687
|
"heading1",
|
|
597
688
|
"heading2",
|
|
598
689
|
"heading3",
|
|
@@ -603,10 +694,10 @@ const title$1 = (config = {}) => {
|
|
|
603
694
|
return {
|
|
604
695
|
type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
|
|
605
696
|
config: {
|
|
606
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
607
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
697
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
698
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
608
699
|
single,
|
|
609
|
-
allowTargetBlank: faker.
|
|
700
|
+
allowTargetBlank: faker.boolean() || void 0
|
|
610
701
|
}
|
|
611
702
|
};
|
|
612
703
|
};
|
|
@@ -616,15 +707,15 @@ const uid$1 = (config = {}) => {
|
|
|
616
707
|
return {
|
|
617
708
|
type: prismicT__namespace.CustomTypeModelFieldType.UID,
|
|
618
709
|
config: {
|
|
619
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
620
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
710
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
711
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3))
|
|
621
712
|
}
|
|
622
713
|
};
|
|
623
714
|
};
|
|
624
715
|
|
|
625
716
|
const generateFieldId = (config) => {
|
|
626
717
|
const faker = createFaker(config.seed);
|
|
627
|
-
return changeCase__namespace.snakeCase(faker.
|
|
718
|
+
return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
|
|
628
719
|
};
|
|
629
720
|
|
|
630
721
|
const mockModelFns = {
|
|
@@ -648,7 +739,7 @@ const mockModelFns = {
|
|
|
648
739
|
const buildMockGroupFieldMap = (config = {}) => {
|
|
649
740
|
const faker = createFaker(config.seed);
|
|
650
741
|
const fields = {};
|
|
651
|
-
const fieldTypes = faker.
|
|
742
|
+
const fieldTypes = faker.randomElements(Object.keys(mockModelFns));
|
|
652
743
|
for (const fieldType of fieldTypes) {
|
|
653
744
|
const fieldId = generateFieldId({ seed: config.seed });
|
|
654
745
|
const mockModelFn = mockModelFns[fieldType];
|
|
@@ -688,9 +779,23 @@ const index$2 = /*#__PURE__*/Object.freeze({
|
|
|
688
779
|
|
|
689
780
|
const timestamp = (config = {}) => {
|
|
690
781
|
const faker = createFaker(config.seed);
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
782
|
+
if (config.state === "empty") {
|
|
783
|
+
return null;
|
|
784
|
+
} else {
|
|
785
|
+
let date;
|
|
786
|
+
const after = config.after ? new Date(config.after.toISOString().split("T")[0]) : void 0;
|
|
787
|
+
const before = config.before ? new Date(config.before.toISOString().split("T")[0]) : void 0;
|
|
788
|
+
if (after && before) {
|
|
789
|
+
date = faker.dateBetween(after, before);
|
|
790
|
+
} else if (after) {
|
|
791
|
+
date = faker.dateAfter(after);
|
|
792
|
+
} else if (before) {
|
|
793
|
+
date = faker.dateBefore(before);
|
|
794
|
+
} else {
|
|
795
|
+
date = faker.date();
|
|
796
|
+
}
|
|
797
|
+
return date.toISOString();
|
|
798
|
+
}
|
|
694
799
|
};
|
|
695
800
|
|
|
696
801
|
const buildAlternativeLanguage = (config) => {
|
|
@@ -721,11 +826,11 @@ const customType = (config = {}) => {
|
|
|
721
826
|
}));
|
|
722
827
|
return {
|
|
723
828
|
type: model.id,
|
|
724
|
-
id: faker.
|
|
725
|
-
uid: hasUID ? changeCase__namespace.snakeCase(faker.
|
|
726
|
-
url: withURL ? faker.
|
|
727
|
-
href: faker.
|
|
728
|
-
lang: faker.
|
|
829
|
+
id: faker.hash(7),
|
|
830
|
+
uid: hasUID ? changeCase__namespace.snakeCase(faker.words(faker.range(1, 3))) : null,
|
|
831
|
+
url: withURL ? faker.url() : null,
|
|
832
|
+
href: faker.url(),
|
|
833
|
+
lang: faker.word(),
|
|
729
834
|
tags: generateTags({ seed: config.seed }),
|
|
730
835
|
slugs: [],
|
|
731
836
|
linked_documents: [],
|
|
@@ -742,7 +847,7 @@ const customType = (config = {}) => {
|
|
|
742
847
|
|
|
743
848
|
const color = (config = {}) => {
|
|
744
849
|
const faker = createFaker(config.seed);
|
|
745
|
-
return config.state === "empty" ? null : faker.
|
|
850
|
+
return config.state === "empty" ? null : faker.hexColor().toUpperCase();
|
|
746
851
|
};
|
|
747
852
|
|
|
748
853
|
const buildContentRelationshipField = (config) => {
|
|
@@ -761,7 +866,7 @@ const buildContentRelationshipField = (config) => {
|
|
|
761
866
|
|
|
762
867
|
const generateCustomTypeId = (config) => {
|
|
763
868
|
const faker = createFaker(config.seed);
|
|
764
|
-
return changeCase__namespace.snakeCase(faker.
|
|
869
|
+
return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
|
|
765
870
|
};
|
|
766
871
|
|
|
767
872
|
const contentRelationship = (config = {}) => {
|
|
@@ -784,11 +889,11 @@ const contentRelationship = (config = {}) => {
|
|
|
784
889
|
}) : [
|
|
785
890
|
{
|
|
786
891
|
...customType({ seed: config.seed }),
|
|
787
|
-
type: model.config.customtypes ? faker.
|
|
788
|
-
tags: model.config.tags ? faker.
|
|
892
|
+
type: model.config.customtypes ? faker.randomElement(model.config.customtypes) : generateCustomTypeId({ seed: config.seed }),
|
|
893
|
+
tags: model.config.tags ? faker.randomElements(model.config.tags) : generateTags({ seed: config.seed })
|
|
789
894
|
}
|
|
790
895
|
];
|
|
791
|
-
const document = faker.
|
|
896
|
+
const document = faker.randomElement(linkableDocuments);
|
|
792
897
|
if (!document) {
|
|
793
898
|
throw new Error("A linkable document could not be found.");
|
|
794
899
|
}
|
|
@@ -808,100 +913,115 @@ const date = (config = {}) => {
|
|
|
808
913
|
};
|
|
809
914
|
|
|
810
915
|
const buildEmbedField = (config) => {
|
|
916
|
+
var _a;
|
|
811
917
|
const faker = createFaker(config.seed);
|
|
812
918
|
return {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
|
|
817
|
-
version: faker.datatype.number({ min: 1, max: 3, precision: 10 }).toString(),
|
|
818
|
-
cache_age: faker.datatype.number(),
|
|
819
|
-
embed_url: config.embedData.embed_url,
|
|
820
|
-
author_url: faker.internet.url(),
|
|
821
|
-
author_name: faker.company.companyName(),
|
|
822
|
-
provider_name: faker.company.companyName(),
|
|
823
|
-
thumbnail_width: config.embedData.thumbnail_width,
|
|
824
|
-
thumbnail_height: config.embedData.thumbnail_height,
|
|
825
|
-
thumbnail_url: config.embedData.thumbnail_url,
|
|
826
|
-
width: faker.datatype.number({ min: 200, max: 500 }),
|
|
827
|
-
height: faker.datatype.number({ min: 200, max: 500 })
|
|
919
|
+
embed_url: (_a = config.url) != null ? _a : faker.url(),
|
|
920
|
+
html: `<div>embed html</div>`,
|
|
921
|
+
...config.data
|
|
828
922
|
};
|
|
829
923
|
};
|
|
830
924
|
|
|
831
925
|
const dataSet$1 = [
|
|
832
926
|
{
|
|
833
|
-
|
|
927
|
+
version: "1.0",
|
|
928
|
+
type: "video",
|
|
834
929
|
embed_url: "https://www.youtube.com/embed/fiOwHYFkUz0",
|
|
835
930
|
thumbnail_url: "https://i.ytimg.com/vi/fiOwHYFkUz0/hqdefault.jpg",
|
|
836
931
|
thumbnail_height: 360,
|
|
837
932
|
thumbnail_width: 480,
|
|
838
|
-
html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/fiOwHYFkUz0?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
|
933
|
+
html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/fiOwHYFkUz0?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
|
|
934
|
+
width: 200,
|
|
935
|
+
height: 113
|
|
839
936
|
},
|
|
840
937
|
{
|
|
841
|
-
|
|
938
|
+
version: "1.0",
|
|
939
|
+
type: "video",
|
|
842
940
|
embed_url: "https://www.youtube.com/embed/c-ATzcy6VkI",
|
|
843
941
|
thumbnail_url: "https://i.ytimg.com/vi/c-ATzcy6VkI/hqdefault.jpg",
|
|
844
942
|
thumbnail_height: 360,
|
|
845
943
|
thumbnail_width: 480,
|
|
846
|
-
html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/c-ATzcy6VkI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
|
944
|
+
html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/c-ATzcy6VkI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
|
|
945
|
+
width: 200,
|
|
946
|
+
height: 113
|
|
847
947
|
},
|
|
848
948
|
{
|
|
849
|
-
|
|
949
|
+
version: "1.0",
|
|
950
|
+
type: "video",
|
|
850
951
|
embed_url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
|
|
851
952
|
thumbnail_url: "https://i.ytimg.com/vi/iewZXv94XGY/hqdefault.jpg",
|
|
852
953
|
thumbnail_height: 360,
|
|
853
954
|
thumbnail_width: 480,
|
|
854
|
-
html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/iewZXv94XGY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'
|
|
955
|
+
html: '<iframe width="200" height="113" src="https://www.youtube.com/embed/iewZXv94XGY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
|
|
956
|
+
width: 200,
|
|
957
|
+
height: 113
|
|
855
958
|
},
|
|
856
959
|
{
|
|
857
|
-
|
|
858
|
-
|
|
960
|
+
version: "1.0",
|
|
961
|
+
type: "rich",
|
|
962
|
+
embed_url: "https://twitter.com/prismicio/status/1356293316158095361",
|
|
859
963
|
thumbnail_url: null,
|
|
860
964
|
thumbnail_height: null,
|
|
861
965
|
thumbnail_width: null,
|
|
862
|
-
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Gatsby is a popular choice for Prismic users and we work hard on delivering a CMS that plays to its strengths.<br><br>But, what makes <a href="https://twitter.com/GatsbyJS?ref_src=twsrc%5Etfw">@GatsbyJS</a> so popular?<br><br>Here are some of <a href="https://twitter.com/mxstbr?ref_src=twsrc%5Etfw">@mxstbr</a>'s thoughts on Gatsby's success and how they're improving developer experience.<a href="https://t.co/ZjCPvsWWUD">https://t.co/ZjCPvsWWUD</a> <a href="https://t.co/EQqzJpeNKl">pic.twitter.com/EQqzJpeNKl</a></p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1356293316158095361?ref_src=twsrc%5Etfw">February 1, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n'
|
|
966
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Gatsby is a popular choice for Prismic users and we work hard on delivering a CMS that plays to its strengths.<br><br>But, what makes <a href="https://twitter.com/GatsbyJS?ref_src=twsrc%5Etfw">@GatsbyJS</a> so popular?<br><br>Here are some of <a href="https://twitter.com/mxstbr?ref_src=twsrc%5Etfw">@mxstbr</a>'s thoughts on Gatsby's success and how they're improving developer experience.<a href="https://t.co/ZjCPvsWWUD">https://t.co/ZjCPvsWWUD</a> <a href="https://t.co/EQqzJpeNKl">pic.twitter.com/EQqzJpeNKl</a></p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1356293316158095361?ref_src=twsrc%5Etfw">February 1, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
967
|
+
width: 200,
|
|
968
|
+
height: 113
|
|
863
969
|
},
|
|
864
970
|
{
|
|
865
|
-
|
|
971
|
+
type: "rich",
|
|
972
|
+
version: "1.0",
|
|
973
|
+
embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
|
|
866
974
|
thumbnail_url: null,
|
|
867
975
|
thumbnail_width: null,
|
|
868
976
|
thumbnail_height: null,
|
|
869
|
-
|
|
870
|
-
|
|
977
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">I\u2019ve been diving deep on <a href="https://twitter.com/prismicio?ref_src=twsrc%5Etfw">@prismicio</a> <a href="https://twitter.com/hashtag/slicemachine?src=hash&ref_src=twsrc%5Etfw">#slicemachine</a> today. I made all my own components and I used custom slices. It works like a charm with <a href="https://twitter.com/nuxt_js?ref_src=twsrc%5Etfw">@nuxt_js</a>. Also: I\u2019m coding with this view. <a href="https://t.co/F0I8X9gz39">pic.twitter.com/F0I8X9gz39</a></p>— Tim Benniks (@timbenniks) <a href="https://twitter.com/timbenniks/status/1304146886832594944?ref_src=twsrc%5Etfw">September 10, 2020</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
978
|
+
width: 200,
|
|
979
|
+
height: 113
|
|
871
980
|
},
|
|
872
981
|
{
|
|
873
|
-
|
|
982
|
+
version: "1.0",
|
|
983
|
+
type: "rich",
|
|
984
|
+
embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
|
|
874
985
|
thumbnail_url: null,
|
|
875
986
|
thumbnail_width: null,
|
|
876
987
|
thumbnail_height: null,
|
|
877
|
-
|
|
878
|
-
|
|
988
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">We're launching a new <a href="https://twitter.com/hashtag/SliceContest?src=hash&ref_src=twsrc%5Etfw">#SliceContest</a> tomorrow along with Slice Machine upgrades.<br><br>Want to know more? Join us at tomorrow's Product Meet-up\u{1F447}<a href="https://t.co/prYSypiAvB">https://t.co/prYSypiAvB</a><br><br>We can't tell you any further details for now, but here's a sneak peek at the prizes\u{1F440} <a href="https://t.co/fV1eoGlEBh">pic.twitter.com/fV1eoGlEBh</a></p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1354112310252630016?ref_src=twsrc%5Etfw">January 26, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
989
|
+
width: 200,
|
|
990
|
+
height: 113
|
|
879
991
|
},
|
|
880
992
|
{
|
|
881
|
-
|
|
993
|
+
version: "1.0",
|
|
994
|
+
type: "rich",
|
|
995
|
+
embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
|
|
882
996
|
thumbnail_url: null,
|
|
883
997
|
thumbnail_width: null,
|
|
884
998
|
thumbnail_height: null,
|
|
885
|
-
|
|
886
|
-
|
|
999
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Does anyone want to create a wildly popular website for discussing 'Wall Street Bets' using Prismic?<br><br>It may or may not have to look a lot like <a href="https://twitter.com/hashtag/reddit?src=hash&ref_src=twsrc%5Etfw">#reddit</a> and we won't make it private.<br><br>Just asking for some friends...</p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1354835716430319617?ref_src=twsrc%5Etfw">January 28, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
1000
|
+
width: 200,
|
|
1001
|
+
height: 113
|
|
887
1002
|
}
|
|
888
1003
|
];
|
|
889
1004
|
const getMockEmbedData = (config) => {
|
|
890
1005
|
const faker = createFaker(config.seed);
|
|
891
|
-
return faker.
|
|
1006
|
+
return faker.randomElement(dataSet$1);
|
|
892
1007
|
};
|
|
893
1008
|
|
|
894
1009
|
const embed$1 = (config = {}) => {
|
|
895
|
-
|
|
896
|
-
|
|
1010
|
+
var _a, _b, _c;
|
|
1011
|
+
const data = (_a = config.data) != null ? _a : getMockEmbedData({ seed: config.seed });
|
|
1012
|
+
return config.state === "empty" ? {} : buildEmbedField({
|
|
1013
|
+
seed: config.seed,
|
|
1014
|
+
url: (_b = config.url) != null ? _b : "embed_url" in data ? data.embed_url : void 0,
|
|
1015
|
+
html: (_c = config.html) != null ? _c : "html" in data ? data.html : void 0,
|
|
1016
|
+
data
|
|
1017
|
+
});
|
|
897
1018
|
};
|
|
898
1019
|
|
|
899
1020
|
const geoPoint = (config = {}) => {
|
|
900
1021
|
const faker = createFaker(config.seed);
|
|
901
|
-
const coordinates = faker.address.nearbyGPSCoordinate();
|
|
902
1022
|
return config.state === "empty" ? {} : {
|
|
903
|
-
longitude:
|
|
904
|
-
latitude:
|
|
1023
|
+
longitude: faker.rangeFloat(-180, 180),
|
|
1024
|
+
latitude: faker.rangeFloat(-90, 90)
|
|
905
1025
|
};
|
|
906
1026
|
};
|
|
907
1027
|
|
|
@@ -912,10 +1032,7 @@ const group = (config = {}) => {
|
|
|
912
1032
|
} else {
|
|
913
1033
|
const faker = createFaker(config.seed);
|
|
914
1034
|
const model = config.model || group$1({ seed: config.seed });
|
|
915
|
-
const itemsCount = (_a = config.itemsCount) != null ? _a : faker.
|
|
916
|
-
min: 1,
|
|
917
|
-
max: 6
|
|
918
|
-
});
|
|
1035
|
+
const itemsCount = (_a = config.itemsCount) != null ? _a : faker.range(1, 6);
|
|
919
1036
|
return Array(itemsCount).fill(void 0).map(() => {
|
|
920
1037
|
return valueForModelMap({
|
|
921
1038
|
seed: config.seed,
|
|
@@ -948,8 +1065,8 @@ const buildImageFieldImage = (config) => {
|
|
|
948
1065
|
return {
|
|
949
1066
|
url: url.toString(),
|
|
950
1067
|
dimensions,
|
|
951
|
-
alt: faker.
|
|
952
|
-
copyright: faker.
|
|
1068
|
+
alt: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
|
|
1069
|
+
copyright: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15)))
|
|
953
1070
|
};
|
|
954
1071
|
}
|
|
955
1072
|
};
|
|
@@ -1038,7 +1155,7 @@ const dataSet = [
|
|
|
1038
1155
|
];
|
|
1039
1156
|
const getMockImageData = (config) => {
|
|
1040
1157
|
const faker = createFaker(config.seed);
|
|
1041
|
-
return faker.
|
|
1158
|
+
return faker.randomElement(dataSet);
|
|
1042
1159
|
};
|
|
1043
1160
|
|
|
1044
1161
|
const image$1 = (config = {}) => {
|
|
@@ -1068,18 +1185,18 @@ const integrationFields = (config = {}) => {
|
|
|
1068
1185
|
const faker = createFaker(config.seed);
|
|
1069
1186
|
const imageData = getMockImageData({ seed: config.seed });
|
|
1070
1187
|
return config.state === "empty" ? null : {
|
|
1071
|
-
id: faker.
|
|
1072
|
-
title: changeCase__namespace.capitalCase(faker.
|
|
1073
|
-
description: faker.
|
|
1188
|
+
id: faker.hash(7),
|
|
1189
|
+
title: changeCase__namespace.capitalCase(faker.words(faker.range(1, 3))),
|
|
1190
|
+
description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
|
|
1074
1191
|
image_url: imageData.url,
|
|
1075
|
-
last_update: faker.date
|
|
1192
|
+
last_update: faker.date().getTime(),
|
|
1076
1193
|
blob: config.data
|
|
1077
1194
|
};
|
|
1078
1195
|
};
|
|
1079
1196
|
|
|
1080
1197
|
const keyText = (config = {}) => {
|
|
1081
1198
|
const faker = createFaker(config.seed);
|
|
1082
|
-
return config.state === "empty" ? null : changeCase__namespace.sentenceCase(faker.
|
|
1199
|
+
return config.state === "empty" ? null : changeCase__namespace.sentenceCase(faker.words(3));
|
|
1083
1200
|
};
|
|
1084
1201
|
|
|
1085
1202
|
const linkToMedia = (config = {}) => {
|
|
@@ -1091,12 +1208,12 @@ const linkToMedia = (config = {}) => {
|
|
|
1091
1208
|
} else {
|
|
1092
1209
|
return {
|
|
1093
1210
|
link_type: prismicT__namespace.LinkType.Media,
|
|
1094
|
-
name: faker.
|
|
1095
|
-
kind: faker.
|
|
1096
|
-
url: faker.
|
|
1097
|
-
size: faker.
|
|
1098
|
-
height: faker.
|
|
1099
|
-
width: faker.
|
|
1211
|
+
name: `${changeCase__namespace.snakeCase(faker.words(faker.range(1, 2)))}.example`,
|
|
1212
|
+
kind: changeCase__namespace.snakeCase(faker.word()),
|
|
1213
|
+
url: faker.url(),
|
|
1214
|
+
size: faker.range(500, 3e3).toString(),
|
|
1215
|
+
height: faker.range(500, 3e3).toString(),
|
|
1216
|
+
width: faker.range(500, 3e3).toString()
|
|
1100
1217
|
};
|
|
1101
1218
|
}
|
|
1102
1219
|
};
|
|
@@ -1104,7 +1221,7 @@ const linkToMedia = (config = {}) => {
|
|
|
1104
1221
|
const link = (config = {}) => {
|
|
1105
1222
|
var _a;
|
|
1106
1223
|
const faker = createFaker(config.seed);
|
|
1107
|
-
const type = config.type || faker.
|
|
1224
|
+
const type = config.type || faker.randomElement([
|
|
1108
1225
|
prismicT__namespace.LinkType.Web,
|
|
1109
1226
|
prismicT__namespace.LinkType.Document,
|
|
1110
1227
|
prismicT__namespace.LinkType.Media
|
|
@@ -1133,8 +1250,8 @@ const link = (config = {}) => {
|
|
|
1133
1250
|
const model = config.model || link$1({ seed: config.seed });
|
|
1134
1251
|
return {
|
|
1135
1252
|
link_type: prismicT__namespace.LinkType.Web,
|
|
1136
|
-
url: faker.
|
|
1137
|
-
target: ((_a = config.withTargetBlank) != null ? _a : model.config.allowTargetBlank && faker.
|
|
1253
|
+
url: faker.url(),
|
|
1254
|
+
target: ((_a = config.withTargetBlank) != null ? _a : model.config.allowTargetBlank && faker.boolean()) ? "_blank" : void 0
|
|
1138
1255
|
};
|
|
1139
1256
|
}
|
|
1140
1257
|
}
|
|
@@ -1143,7 +1260,7 @@ const link = (config = {}) => {
|
|
|
1143
1260
|
|
|
1144
1261
|
const number = (config = {}) => {
|
|
1145
1262
|
const faker = createFaker(config.seed);
|
|
1146
|
-
return config.state === "empty" ? null : faker.
|
|
1263
|
+
return config.state === "empty" ? null : faker.range(1, 100);
|
|
1147
1264
|
};
|
|
1148
1265
|
|
|
1149
1266
|
const patterns$5 = {
|
|
@@ -1171,16 +1288,13 @@ const heading = (config = {}) => {
|
|
|
1171
1288
|
prismicT__namespace.RichTextNodeType.heading5,
|
|
1172
1289
|
prismicT__namespace.RichTextNodeType.heading6
|
|
1173
1290
|
].includes(type2));
|
|
1174
|
-
const type = faker.
|
|
1291
|
+
const type = faker.randomElement(types);
|
|
1175
1292
|
if (type) {
|
|
1176
|
-
const patternKey = config.pattern || faker.
|
|
1293
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$5));
|
|
1177
1294
|
const pattern = patterns$5[patternKey];
|
|
1178
1295
|
return {
|
|
1179
1296
|
type,
|
|
1180
|
-
text: changeCase__namespace.capitalCase(faker.
|
|
1181
|
-
min: pattern.minWords,
|
|
1182
|
-
max: pattern.maxWords
|
|
1183
|
-
}))),
|
|
1297
|
+
text: changeCase__namespace.capitalCase(faker.words(faker.range(pattern.minWords, pattern.maxWords))),
|
|
1184
1298
|
spans: []
|
|
1185
1299
|
};
|
|
1186
1300
|
} else {
|
|
@@ -1201,11 +1315,12 @@ const patterns$4 = {
|
|
|
1201
1315
|
};
|
|
1202
1316
|
const paragraph = (config = {}) => {
|
|
1203
1317
|
const faker = createFaker(config.seed);
|
|
1204
|
-
const patternKey = config.pattern || faker.
|
|
1318
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$4));
|
|
1205
1319
|
const pattern = patterns$4[patternKey];
|
|
1320
|
+
const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
|
|
1206
1321
|
return {
|
|
1207
1322
|
type: prismicT__namespace.RichTextNodeType.paragraph,
|
|
1208
|
-
text
|
|
1323
|
+
text,
|
|
1209
1324
|
spans: []
|
|
1210
1325
|
};
|
|
1211
1326
|
};
|
|
@@ -1223,11 +1338,12 @@ const patterns$3 = {
|
|
|
1223
1338
|
};
|
|
1224
1339
|
const preformatted = (config = {}) => {
|
|
1225
1340
|
const faker = createFaker(config.seed);
|
|
1226
|
-
const patternKey = config.pattern || faker.
|
|
1341
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$3));
|
|
1227
1342
|
const pattern = patterns$3[patternKey];
|
|
1343
|
+
const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
|
|
1228
1344
|
return {
|
|
1229
1345
|
type: prismicT__namespace.RichTextNodeType.preformatted,
|
|
1230
|
-
text
|
|
1346
|
+
text,
|
|
1231
1347
|
spans: []
|
|
1232
1348
|
};
|
|
1233
1349
|
};
|
|
@@ -1248,16 +1364,13 @@ const patterns$2 = {
|
|
|
1248
1364
|
};
|
|
1249
1365
|
const list = (config = {}) => {
|
|
1250
1366
|
const faker = createFaker(config.seed);
|
|
1251
|
-
const patternKey = config.pattern || faker.
|
|
1367
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$2));
|
|
1252
1368
|
const pattern = patterns$2[patternKey];
|
|
1253
|
-
const itemsCount = faker.
|
|
1254
|
-
min: pattern.minItems,
|
|
1255
|
-
max: pattern.maxItems
|
|
1256
|
-
});
|
|
1369
|
+
const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
|
|
1257
1370
|
return Array(itemsCount).fill(void 0).map(() => {
|
|
1258
1371
|
return {
|
|
1259
1372
|
type: prismicT__namespace.RichTextNodeType.listItem,
|
|
1260
|
-
text: faker.
|
|
1373
|
+
text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
|
|
1261
1374
|
spans: []
|
|
1262
1375
|
};
|
|
1263
1376
|
});
|
|
@@ -1279,16 +1392,13 @@ const patterns$1 = {
|
|
|
1279
1392
|
};
|
|
1280
1393
|
const oList = (config = {}) => {
|
|
1281
1394
|
const faker = createFaker(config.seed);
|
|
1282
|
-
const patternKey = config.pattern || faker.
|
|
1395
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$1));
|
|
1283
1396
|
const pattern = patterns$1[patternKey];
|
|
1284
|
-
const itemsCount = faker.
|
|
1285
|
-
min: pattern.minItems,
|
|
1286
|
-
max: pattern.maxItems
|
|
1287
|
-
});
|
|
1397
|
+
const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
|
|
1288
1398
|
return Array(itemsCount).fill(void 0).map(() => {
|
|
1289
1399
|
return {
|
|
1290
1400
|
type: prismicT__namespace.RichTextNodeType.oListItem,
|
|
1291
|
-
text: faker.
|
|
1401
|
+
text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
|
|
1292
1402
|
spans: []
|
|
1293
1403
|
};
|
|
1294
1404
|
});
|
|
@@ -1299,7 +1409,7 @@ const image = (config = {}) => {
|
|
|
1299
1409
|
const imageField = buildImageFieldImage({
|
|
1300
1410
|
seed: config.seed,
|
|
1301
1411
|
imageData,
|
|
1302
|
-
state:
|
|
1412
|
+
state: "filled"
|
|
1303
1413
|
});
|
|
1304
1414
|
return {
|
|
1305
1415
|
type: prismicT__namespace.RichTextNodeType.image,
|
|
@@ -1311,8 +1421,8 @@ const image = (config = {}) => {
|
|
|
1311
1421
|
};
|
|
1312
1422
|
|
|
1313
1423
|
const embed = (config = {}) => {
|
|
1314
|
-
const
|
|
1315
|
-
const embedField = buildEmbedField({ seed: config.seed,
|
|
1424
|
+
const data = getMockEmbedData({ seed: config.seed });
|
|
1425
|
+
const embedField = buildEmbedField({ seed: config.seed, data });
|
|
1316
1426
|
return {
|
|
1317
1427
|
type: prismicT__namespace.RichTextNodeType.embed,
|
|
1318
1428
|
oembed: embedField
|
|
@@ -1356,14 +1466,11 @@ const richText = (config = {}) => {
|
|
|
1356
1466
|
const supportsMultipleBlocks = "multi" in model.config;
|
|
1357
1467
|
const types = ("multi" in model.config ? model.config.multi : model.config.single).split(",").filter((type) => Object.keys(generators).includes(type));
|
|
1358
1468
|
if (types.length > 0) {
|
|
1359
|
-
const patternKey = config.pattern || faker.
|
|
1469
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
|
|
1360
1470
|
const pattern = patterns[patternKey];
|
|
1361
|
-
const blockCount = supportsMultipleBlocks ? faker.
|
|
1362
|
-
min: pattern.blockCountMin,
|
|
1363
|
-
max: pattern.blockCountMax
|
|
1364
|
-
}) : 1;
|
|
1471
|
+
const blockCount = supportsMultipleBlocks ? faker.range(pattern.blockCountMin, pattern.blockCountMax) : 1;
|
|
1365
1472
|
return Array(blockCount).fill(void 0).map(() => {
|
|
1366
|
-
const type = faker.
|
|
1473
|
+
const type = faker.randomElement(types);
|
|
1367
1474
|
const generator = generators[type];
|
|
1368
1475
|
return generator({ seed: config.seed, model });
|
|
1369
1476
|
}).flat().filter((block) => block !== void 0).slice(0, blockCount);
|
|
@@ -1379,7 +1486,7 @@ const select = (config = {}) => {
|
|
|
1379
1486
|
if (config.state === "empty") {
|
|
1380
1487
|
return null;
|
|
1381
1488
|
} else {
|
|
1382
|
-
return typeof defaultValue === "string" && faker.
|
|
1489
|
+
return typeof defaultValue === "string" && faker.boolean() ? defaultValue : faker.randomElement(model.config.options);
|
|
1383
1490
|
}
|
|
1384
1491
|
};
|
|
1385
1492
|
|
|
@@ -1388,11 +1495,8 @@ const slice = (config = {}) => {
|
|
|
1388
1495
|
const faker = createFaker(config.seed);
|
|
1389
1496
|
const model = config.model || slice$1({ seed: config.seed });
|
|
1390
1497
|
const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
|
|
1391
|
-
const sliceLabel = config.label !== void 0 ? config.label : changeCase__namespace.capitalCase(faker.
|
|
1392
|
-
const itemsCount = Object.keys(model.repeat).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.
|
|
1393
|
-
min: 1,
|
|
1394
|
-
max: 6
|
|
1395
|
-
}) : 0;
|
|
1498
|
+
const sliceLabel = config.label !== void 0 ? config.label : changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
|
|
1499
|
+
const itemsCount = Object.keys(model.repeat).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
|
|
1396
1500
|
return {
|
|
1397
1501
|
slice_type: sliceType,
|
|
1398
1502
|
slice_label: sliceLabel,
|
|
@@ -1416,15 +1520,12 @@ const sharedSliceVariation = (config = {}) => {
|
|
|
1416
1520
|
const faker = createFaker(config.seed);
|
|
1417
1521
|
const model = config.model || sharedSliceVariation$1({ seed: config.seed });
|
|
1418
1522
|
const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
|
|
1419
|
-
const itemsCount = Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.
|
|
1420
|
-
min: 1,
|
|
1421
|
-
max: 6
|
|
1422
|
-
}) : 0;
|
|
1523
|
+
const itemsCount = Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
|
|
1423
1524
|
return {
|
|
1424
1525
|
slice_type: sliceType,
|
|
1425
1526
|
slice_label: null,
|
|
1426
1527
|
variation: model.id,
|
|
1427
|
-
version: faker.
|
|
1528
|
+
version: faker.hash(7),
|
|
1428
1529
|
primary: valueForModelMap({
|
|
1429
1530
|
seed: config.seed,
|
|
1430
1531
|
map: model.primary,
|
|
@@ -1443,7 +1544,7 @@ const sharedSliceVariation = (config = {}) => {
|
|
|
1443
1544
|
const sharedSlice = (config = {}) => {
|
|
1444
1545
|
const faker = createFaker(config.seed);
|
|
1445
1546
|
const model = config.model || sharedSlice$1({ seed: config.seed });
|
|
1446
|
-
const variationModel = faker.
|
|
1547
|
+
const variationModel = faker.randomElement(model.variations);
|
|
1447
1548
|
return sharedSliceVariation({
|
|
1448
1549
|
seed: config.seed,
|
|
1449
1550
|
model: variationModel,
|
|
@@ -1462,16 +1563,13 @@ const sliceZone = (config = {}) => {
|
|
|
1462
1563
|
const faker = createFaker(config.seed);
|
|
1463
1564
|
const model = config.model || sliceZone$1({ seed: config.seed });
|
|
1464
1565
|
if (Object.keys(model.config.choices).length > 0) {
|
|
1465
|
-
const itemsCount = (_a = config.itemsCount) != null ? _a : faker.
|
|
1466
|
-
min: 1,
|
|
1467
|
-
max: 6
|
|
1468
|
-
});
|
|
1566
|
+
const itemsCount = (_a = config.itemsCount) != null ? _a : faker.range(1, 6);
|
|
1469
1567
|
return Array(itemsCount).fill(void 0).map(() => {
|
|
1470
1568
|
var _a2;
|
|
1471
1569
|
const choices = Object.entries(model.config.choices);
|
|
1472
|
-
const [choiceType, choiceModel] = faker.
|
|
1570
|
+
const [choiceType, choiceModel] = faker.randomElement(choices);
|
|
1473
1571
|
const choiceLabels = model.config.labels[choiceType] || [];
|
|
1474
|
-
const choiceLabel = faker.
|
|
1572
|
+
const choiceLabel = faker.randomElement(choiceLabels);
|
|
1475
1573
|
switch (choiceModel.type) {
|
|
1476
1574
|
case prismicT__namespace.CustomTypeModelSliceType.Slice: {
|
|
1477
1575
|
return slice({
|
|
@@ -1518,7 +1616,7 @@ const title = (config = {}) => {
|
|
|
1518
1616
|
|
|
1519
1617
|
const uid = (config = {}) => {
|
|
1520
1618
|
const faker = createFaker(config.seed);
|
|
1521
|
-
return changeCase__namespace.snakeCase(faker.
|
|
1619
|
+
return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
|
|
1522
1620
|
};
|
|
1523
1621
|
|
|
1524
1622
|
const index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -1553,10 +1651,10 @@ const ref = (config = {}) => {
|
|
|
1553
1651
|
var _a;
|
|
1554
1652
|
const faker = createFaker(config.seed);
|
|
1555
1653
|
const value = {
|
|
1556
|
-
id: faker.
|
|
1557
|
-
ref: faker.
|
|
1654
|
+
id: faker.hash(16),
|
|
1655
|
+
ref: faker.hash(16),
|
|
1558
1656
|
isMasterRef: (_a = config.isMasterRef) != null ? _a : false,
|
|
1559
|
-
label: config.isMasterRef ? "Master" : changeCase__namespace.capitalCase(faker.
|
|
1657
|
+
label: config.isMasterRef ? "Master" : changeCase__namespace.capitalCase(faker.words(faker.range(1, 3)))
|
|
1560
1658
|
};
|
|
1561
1659
|
if (config.isScheduled) {
|
|
1562
1660
|
value.scheduledAt = timestamp({ seed: config.seed });
|
|
@@ -1579,8 +1677,8 @@ const repository = (config = {}) => {
|
|
|
1579
1677
|
types,
|
|
1580
1678
|
languages: [
|
|
1581
1679
|
{
|
|
1582
|
-
id: faker.
|
|
1583
|
-
name: changeCase__namespace.capitalCase(faker.
|
|
1680
|
+
id: faker.word(),
|
|
1681
|
+
name: changeCase__namespace.capitalCase(faker.word())
|
|
1584
1682
|
}
|
|
1585
1683
|
],
|
|
1586
1684
|
tags: generateTags({
|
|
@@ -1590,11 +1688,11 @@ const repository = (config = {}) => {
|
|
|
1590
1688
|
}),
|
|
1591
1689
|
forms: {},
|
|
1592
1690
|
license: "All Rights Reserved",
|
|
1593
|
-
version: faker.
|
|
1691
|
+
version: faker.hash(7),
|
|
1594
1692
|
bookmarks: {},
|
|
1595
1693
|
experiments: {},
|
|
1596
|
-
oauth_token: faker.
|
|
1597
|
-
oauth_initiate: faker.
|
|
1694
|
+
oauth_token: faker.url(),
|
|
1695
|
+
oauth_initiate: faker.url()
|
|
1598
1696
|
};
|
|
1599
1697
|
};
|
|
1600
1698
|
|
|
@@ -1608,8 +1706,8 @@ const query = (config = {}) => {
|
|
|
1608
1706
|
const results = documents.slice((page - 1) * pageSize, page * pageSize);
|
|
1609
1707
|
return {
|
|
1610
1708
|
page,
|
|
1611
|
-
next_page: page < totalPages ? faker.
|
|
1612
|
-
prev_page: page > 1 ? faker.
|
|
1709
|
+
next_page: page < totalPages ? faker.url() : null,
|
|
1710
|
+
prev_page: page > 1 ? faker.url() : null,
|
|
1613
1711
|
total_pages: totalPages,
|
|
1614
1712
|
results_size: results.length,
|
|
1615
1713
|
results_per_page: pageSize,
|