@prismicio/mock 0.0.6 → 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.
Files changed (99) hide show
  1. package/README.md +4 -1
  2. package/dist/api/index.cjs +242 -122
  3. package/dist/api/index.cjs.map +1 -0
  4. package/dist/api/index.d.ts +3 -2
  5. package/dist/api/index.d.ts.map +1 -0
  6. package/dist/api/index.js +669 -0
  7. package/dist/api/index.js.map +1 -0
  8. package/dist/index.cjs +581 -571
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.ts +155 -247
  11. package/dist/{index.mjs → index.js} +574 -561
  12. package/dist/index.js.map +1 -0
  13. package/dist/model/index.cjs +294 -257
  14. package/dist/model/index.cjs.map +1 -0
  15. package/dist/model/index.d.ts +72 -106
  16. package/dist/model/index.d.ts.map +1 -0
  17. package/dist/model/index.js +556 -0
  18. package/dist/model/index.js.map +1 -0
  19. package/dist/value/index.cjs +500 -647
  20. package/dist/value/index.cjs.map +1 -0
  21. package/dist/value/index.d.ts +71 -129
  22. package/dist/value/index.d.ts.map +1 -0
  23. package/dist/value/index.js +1461 -0
  24. package/dist/value/index.js.map +1 -0
  25. package/package.json +30 -27
  26. package/src/api/query.ts +2 -2
  27. package/src/api/ref.ts +3 -3
  28. package/src/api/repository.ts +5 -5
  29. package/src/lib/buildContentRelationshipField.ts +6 -1
  30. package/src/lib/buildEmbedField.ts +16 -27
  31. package/src/lib/buildImageFieldImage.ts +49 -0
  32. package/src/lib/createFaker.ts +98 -20
  33. package/src/lib/generateCustomTypeId.ts +1 -1
  34. package/src/lib/generateFieldId.ts +1 -3
  35. package/src/lib/generateTags.ts +4 -12
  36. package/src/lib/getMockEmbedData.ts +33 -12
  37. package/src/lib/getMockImageData.ts +1 -1
  38. package/src/lib/lorem.ts +112 -0
  39. package/src/model/boolean.ts +1 -1
  40. package/src/model/buildMockGroupFieldMap.ts +65 -0
  41. package/src/model/color.ts +2 -2
  42. package/src/model/contentRelationship.ts +16 -23
  43. package/src/model/customType.ts +49 -48
  44. package/src/model/date.ts +2 -2
  45. package/src/model/embed.ts +2 -2
  46. package/src/model/geoPoint.ts +1 -1
  47. package/src/model/group.ts +9 -16
  48. package/src/model/image.ts +16 -20
  49. package/src/model/index.ts +2 -0
  50. package/src/model/integrationFields.ts +5 -3
  51. package/src/model/keyText.ts +2 -2
  52. package/src/model/link.ts +3 -3
  53. package/src/model/linkToMedia.ts +2 -2
  54. package/src/model/number.ts +2 -2
  55. package/src/model/richText.ts +6 -6
  56. package/src/model/select.ts +13 -18
  57. package/src/model/sharedSlice.ts +15 -42
  58. package/src/model/sharedSliceVariation.ts +36 -24
  59. package/src/model/slice.ts +19 -23
  60. package/src/model/sliceZone.ts +23 -59
  61. package/src/model/timestamp.ts +2 -2
  62. package/src/model/title.ts +5 -5
  63. package/src/model/uid.ts +2 -2
  64. package/src/types.ts +130 -88
  65. package/src/value/boolean.ts +1 -1
  66. package/src/value/color.ts +16 -6
  67. package/src/value/contentRelationship.ts +54 -39
  68. package/src/value/customType.ts +5 -5
  69. package/src/value/date.ts +25 -9
  70. package/src/value/embed.ts +32 -7
  71. package/src/value/geoPoint.ts +21 -11
  72. package/src/value/group.ts +31 -45
  73. package/src/value/image.ts +22 -9
  74. package/src/value/integrationFields.ts +26 -14
  75. package/src/value/keyText.ts +16 -6
  76. package/src/value/link.ts +36 -37
  77. package/src/value/linkToMedia.ts +19 -23
  78. package/src/value/number.ts +16 -6
  79. package/src/value/richText/embed.ts +2 -2
  80. package/src/value/richText/heading.ts +10 -17
  81. package/src/value/richText/image.ts +8 -6
  82. package/src/value/richText/index.ts +4 -9
  83. package/src/value/richText/list.ts +4 -8
  84. package/src/value/richText/oList.ts +4 -8
  85. package/src/value/richText/paragraph.ts +8 -4
  86. package/src/value/richText/preformatted.ts +9 -5
  87. package/src/value/select.ts +23 -8
  88. package/src/value/sharedSlice.ts +3 -3
  89. package/src/value/sharedSliceVariation.ts +4 -36
  90. package/src/value/slice.ts +3 -32
  91. package/src/value/sliceZone.ts +54 -69
  92. package/src/value/timestamp.ts +42 -16
  93. package/src/value/title.ts +26 -13
  94. package/src/value/uid.ts +2 -2
  95. package/dist/api/index.mjs +0 -515
  96. package/dist/model/index.mjs +0 -465
  97. package/dist/value/index.mjs +0 -1554
  98. package/src/lib/buildImageField.ts +0 -34
  99. package/src/lib/buildMockGroupFieldMap.ts +0 -84
@@ -2,8 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const fakerLocaleEN = require('faker/lib/locales/en/index.js');
6
- const Faker = require('faker/lib/index.js');
5
+ const Rand = require('rand-seed');
7
6
  const prismicT = require('@prismicio/types');
8
7
  const changeCase = require('change-case');
9
8
 
@@ -11,69 +10,159 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
10
 
12
11
  function _interopNamespace(e) {
13
12
  if (e && e.__esModule) return e;
14
- var n = Object.create(null);
13
+ const n = Object.create(null);
15
14
  if (e) {
16
- Object.keys(e).forEach(function (k) {
15
+ for (const k in e) {
17
16
  if (k !== 'default') {
18
- var d = Object.getOwnPropertyDescriptor(e, k);
17
+ const d = Object.getOwnPropertyDescriptor(e, k);
19
18
  Object.defineProperty(n, k, d.get ? d : {
20
19
  enumerable: true,
21
- get: function () {
22
- return e[k];
23
- }
20
+ get: function () { return e[k]; }
24
21
  });
25
22
  }
26
- });
23
+ }
27
24
  }
28
- n['default'] = e;
25
+ n["default"] = e;
29
26
  return Object.freeze(n);
30
27
  }
31
28
 
32
- const fakerLocaleEN__namespace = /*#__PURE__*/_interopNamespace(fakerLocaleEN);
33
- const Faker__default = /*#__PURE__*/_interopDefaultLegacy(Faker);
29
+ const Rand__default = /*#__PURE__*/_interopDefaultLegacy(Rand);
34
30
  const prismicT__namespace = /*#__PURE__*/_interopNamespace(prismicT);
35
31
  const changeCase__namespace = /*#__PURE__*/_interopNamespace(changeCase);
36
32
 
37
33
  const FAKER_SEED = 1984;
38
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
+
39
76
  const createFaker = (seed = FAKER_SEED) => {
40
- let normalizedSeed;
41
- if (typeof seed === "string") {
42
- normalizedSeed = seed.split("").map((char) => char.charCodeAt(0));
77
+ const normalizedSeed = seed.toString();
78
+ if (createFaker.cache[normalizedSeed]) {
79
+ return createFaker.cache[normalizedSeed];
43
80
  } else {
44
- normalizedSeed = seed;
45
- }
46
- const cacheKey = JSON.stringify(normalizedSeed);
47
- if (createFaker.cache[cacheKey]) {
48
- return createFaker.cache[cacheKey];
81
+ const faker = new Faker(normalizedSeed);
82
+ return createFaker.cache[normalizedSeed] = faker;
49
83
  }
50
- const fakerInstance = new Faker__default['default']();
51
- fakerInstance.locales["en"] = fakerLocaleEN__namespace;
52
- fakerInstance.seed(normalizedSeed);
53
- createFaker.cache[cacheKey] = fakerInstance;
54
- return fakerInstance;
55
84
  };
56
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
+ }
57
149
 
58
- const boolean$1 = (config = {}) => {
150
+ const boolean = (config = {}) => {
59
151
  const faker = createFaker(config.seed);
60
- return faker.datatype.boolean();
152
+ return faker.boolean();
61
153
  };
62
154
 
63
155
  const generateTags = (config) => {
64
156
  var _a, _b;
65
157
  const faker = createFaker(config.seed);
66
- return Array(faker.datatype.number({
67
- min: (_a = config.min) != null ? _a : 0,
68
- max: (_b = config.max) != null ? _b : 2
69
- })).fill(void 0).map(() => changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({ min: 1, max: 3 }))));
158
+ 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))));
70
159
  };
71
160
 
72
161
  const valueForModel = (config) => {
73
162
  const model = config.model;
74
163
  switch (model.type) {
75
164
  case prismicT__namespace.CustomTypeModelFieldType.Boolean: {
76
- return boolean$1({
165
+ return boolean({
77
166
  seed: config.seed,
78
167
  model,
79
168
  ...config.config
@@ -278,117 +367,74 @@ const valueForModelMap = (config) => {
278
367
  return result;
279
368
  };
280
369
 
281
- const boolean = (config = {}) => {
282
- const faker = createFaker(config.seed);
283
- return {
284
- type: prismicT__namespace.CustomTypeModelFieldType.Boolean,
285
- config: {
286
- label: changeCase__namespace.capitalCase(faker.company.bsNoun())
287
- }
288
- };
289
- };
290
-
291
- const color$1 = (config = {}) => {
292
- const faker = createFaker(config.seed);
293
- return {
294
- type: prismicT__namespace.CustomTypeModelFieldType.Color,
295
- config: {
296
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
297
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
298
- }
299
- };
300
- };
301
-
302
- const generateCustomTypeId = (config) => {
303
- const faker = createFaker(config.seed);
304
- return changeCase__namespace.snakeCase(faker.company.bsNoun());
305
- };
306
-
307
370
  const contentRelationship$1 = (config = {}) => {
308
371
  const faker = createFaker(config.seed);
309
372
  return {
310
373
  type: prismicT__namespace.CustomTypeModelFieldType.Link,
311
374
  config: {
312
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
313
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
375
+ label: changeCase__namespace.capitalCase(faker.word()),
376
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
314
377
  select: prismicT__namespace.CustomTypeModelLinkSelectType.Document,
315
- customtypes: config.constrainCustomTypes ? Array(faker.datatype.number({ min: 1, max: 3 })).fill(void 0).map(() => generateCustomTypeId({ seed: config.seed })) : void 0,
316
- tags: config.constrainTags ? Array(faker.datatype.number({ min: 1, max: 3 })).fill(void 0).map(() => changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({ min: 1, max: 3 })))) : void 0
317
- }
318
- };
319
- };
320
-
321
- const date$1 = (config = {}) => {
322
- const faker = createFaker(config.seed);
323
- return {
324
- type: prismicT__namespace.CustomTypeModelFieldType.Date,
325
- config: {
326
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
327
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
378
+ customtypes: config.customTypeIDs,
379
+ tags: config.tags
328
380
  }
329
381
  };
330
382
  };
331
383
 
332
- const embed$2 = (config = {}) => {
384
+ const customType$1 = (config = {}) => {
385
+ var _a, _b;
333
386
  const faker = createFaker(config.seed);
387
+ let label = config.label || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
388
+ let id = config.id || changeCase__namespace.snakeCase(label);
389
+ if (config.id && !config.label) {
390
+ label = changeCase__namespace.capitalCase(config.id);
391
+ } else if (config.label && !config.label) {
392
+ id = changeCase__namespace.snakeCase(config.label);
393
+ }
394
+ let json = {};
395
+ if ("fields" in config && config.fields) {
396
+ json = { Main: config.fields };
397
+ } else if ("tabs" in config && config.tabs) {
398
+ json = config.tabs;
399
+ }
334
400
  return {
335
- type: prismicT__namespace.CustomTypeModelFieldType.Embed,
336
- config: {
337
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
338
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
339
- }
401
+ id,
402
+ label,
403
+ status: (_a = config.status) != null ? _a : faker.boolean(),
404
+ repeatable: (_b = config.repeatable) != null ? _b : faker.boolean(),
405
+ json
340
406
  };
341
407
  };
342
408
 
343
- const geoPoint$1 = (config = {}) => {
409
+ const group$1 = (config = {}) => {
344
410
  const faker = createFaker(config.seed);
345
411
  return {
346
- type: prismicT__namespace.CustomTypeModelFieldType.GeoPoint,
412
+ type: prismicT__namespace.CustomTypeModelFieldType.Group,
347
413
  config: {
348
- label: changeCase__namespace.capitalCase(faker.company.bsNoun())
414
+ label: changeCase__namespace.capitalCase(faker.word()),
415
+ fields: config.fields || {}
349
416
  }
350
417
  };
351
418
  };
352
419
 
353
420
  const image$2 = (config = {}) => {
354
- var _a;
355
421
  const faker = createFaker(config.seed);
356
- const thumbnailsCount = (_a = config.thumbnailsCount) != null ? _a : faker.datatype.number(3);
422
+ const thumbnails = (config.thumbnailNames || []).map((name) => {
423
+ return {
424
+ name,
425
+ width: faker.range(500, 2e3),
426
+ height: faker.range(500, 2e3)
427
+ };
428
+ });
357
429
  return {
358
430
  type: prismicT__namespace.CustomTypeModelFieldType.Image,
359
431
  config: {
360
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
432
+ label: changeCase__namespace.capitalCase(faker.word()),
361
433
  constraint: {
362
- width: config.withConstraint ? faker.datatype.number({ min: 500, max: 2e3 }) : null,
363
- height: config.withConstraint ? faker.datatype.number({ min: 500, max: 2e3 }) : null
434
+ width: config.withConstraint ? faker.range(500, 2e3) : null,
435
+ height: config.withConstraint ? faker.range(500, 2e3) : null
364
436
  },
365
- thumbnails: Array(thumbnailsCount).fill(void 0).map(() => ({
366
- name: changeCase__namespace.pascalCase(faker.company.bsNoun()),
367
- width: faker.datatype.number({ min: 500, max: 2e3 }),
368
- height: faker.datatype.number({ min: 500, max: 2e3 })
369
- }))
370
- }
371
- };
372
- };
373
-
374
- const integrationFields$1 = (config = {}) => {
375
- const faker = createFaker(config.seed);
376
- return {
377
- type: prismicT__namespace.CustomTypeModelFieldType.IntegrationFields,
378
- config: {
379
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
380
- catalog: changeCase__namespace.snakeCase(faker.lorem.words(4))
381
- }
382
- };
383
- };
384
-
385
- const keyText$1 = (config = {}) => {
386
- const faker = createFaker(config.seed);
387
- return {
388
- type: prismicT__namespace.CustomTypeModelFieldType.Text,
389
- config: {
390
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
391
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
437
+ thumbnails
392
438
  }
393
439
  };
394
440
  };
@@ -398,33 +444,10 @@ const link$1 = (config = {}) => {
398
444
  return {
399
445
  type: prismicT__namespace.CustomTypeModelFieldType.Link,
400
446
  config: {
401
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
402
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
447
+ label: changeCase__namespace.capitalCase(faker.word()),
448
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
403
449
  select: null,
404
- allowTargetBlank: ("allowTargetBlank" in config ? config.allowTargetBlank : faker.datatype.boolean()) || void 0
405
- }
406
- };
407
- };
408
-
409
- const linkToMedia$1 = (config = {}) => {
410
- const faker = createFaker(config.seed);
411
- return {
412
- type: prismicT__namespace.CustomTypeModelFieldType.Link,
413
- config: {
414
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
415
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
416
- select: prismicT__namespace.CustomTypeModelLinkSelectType.Media
417
- }
418
- };
419
- };
420
-
421
- const number$1 = (config = {}) => {
422
- const faker = createFaker(config.seed);
423
- return {
424
- type: prismicT__namespace.CustomTypeModelFieldType.Number,
425
- config: {
426
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
427
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
450
+ allowTargetBlank: ("allowTargetBlank" in config ? config.allowTargetBlank : faker.boolean()) || void 0
428
451
  }
429
452
  };
430
453
  };
@@ -432,7 +455,7 @@ const number$1 = (config = {}) => {
432
455
  const richText$1 = (config = {}) => {
433
456
  var _a;
434
457
  const faker = createFaker(config.seed);
435
- const blockTypes = faker.random.arrayElements([
458
+ const blockTypes = faker.randomElements([
436
459
  prismicT__namespace.RichTextNodeType.heading1,
437
460
  prismicT__namespace.RichTextNodeType.heading2,
438
461
  prismicT__namespace.RichTextNodeType.heading3,
@@ -449,168 +472,88 @@ const richText$1 = (config = {}) => {
449
472
  prismicT__namespace.RichTextNodeType.embed,
450
473
  prismicT__namespace.RichTextNodeType.hyperlink
451
474
  ]).join(",");
452
- const blockTypeConfig = ((_a = config.withMultipleBlocks) != null ? _a : faker.datatype.boolean()) ? { multi: blockTypes } : { single: blockTypes };
475
+ const blockTypeConfig = ((_a = config.withMultipleBlocks) != null ? _a : faker.boolean()) ? { multi: blockTypes } : { single: blockTypes };
453
476
  return {
454
477
  type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
455
478
  config: {
456
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
457
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
458
- allowTargetBlank: faker.datatype.boolean() ? true : void 0,
479
+ label: changeCase__namespace.capitalCase(faker.word()),
480
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
481
+ allowTargetBlank: faker.boolean() ? true : void 0,
459
482
  ...blockTypeConfig
460
483
  }
461
484
  };
462
485
  };
463
486
 
464
487
  const select$1 = (config = {}) => {
465
- var _a;
466
488
  const faker = createFaker(config.seed);
467
- const optionsCount = (_a = config.optionsCount) != null ? _a : faker.datatype.number({ min: 1, max: 5 });
468
- const options = Array(optionsCount).fill(void 0).map(() => changeCase__namespace.capitalCase(faker.company.bsBuzz()));
469
489
  return {
470
490
  type: prismicT__namespace.CustomTypeModelFieldType.Select,
471
491
  config: {
472
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
473
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
474
- options,
475
- default_value: config.withDefaultValue ? faker.random.arrayElement(options) : void 0
492
+ label: changeCase__namespace.capitalCase(faker.word()),
493
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
494
+ options: config.options || [],
495
+ default_value: config.defaultValue || void 0
476
496
  }
477
497
  };
478
498
  };
479
499
 
480
- const timestamp$1 = (config = {}) => {
481
- const faker = createFaker(config.seed);
482
- return {
483
- type: prismicT__namespace.CustomTypeModelFieldType.Timestamp,
484
- config: {
485
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
486
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
487
- }
488
- };
489
- };
490
-
491
- const title$1 = (config = {}) => {
500
+ const sharedSlice$1 = (config = {}) => {
492
501
  const faker = createFaker(config.seed);
493
- const single = faker.random.arrayElements([
494
- "heading1",
495
- "heading2",
496
- "heading3",
497
- "heading4",
498
- "heading5",
499
- "heading6"
500
- ]).join(",");
502
+ let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
503
+ let id = config.id || changeCase__namespace.snakeCase(name);
504
+ if (config.id && !config.name) {
505
+ name = changeCase__namespace.pascalCase(config.id);
506
+ } else if (config.name && !config.name) {
507
+ id = changeCase__namespace.snakeCase(config.name);
508
+ }
501
509
  return {
502
- type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
503
- config: {
504
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
505
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
506
- single,
507
- allowTargetBlank: faker.datatype.boolean() ? true : void 0
508
- }
510
+ type: prismicT__namespace.CustomTypeModelSliceType.SharedSlice,
511
+ id,
512
+ name,
513
+ description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
514
+ variations: config.variations || []
509
515
  };
510
516
  };
511
517
 
512
- const generateFieldId = (config) => {
513
- const faker = createFaker(config.seed);
514
- return changeCase__namespace.snakeCase(faker.lorem.words(faker.datatype.number({ min: 1, max: 3 })));
515
- };
516
-
517
- const mockModelFns = {
518
- boolean,
519
- color: color$1,
520
- contentRelationship: contentRelationship$1,
521
- date: date$1,
522
- embed: embed$2,
523
- geoPoint: geoPoint$1,
524
- image: image$2,
525
- integrationFields: integrationFields$1,
526
- keyText: keyText$1,
527
- link: link$1,
528
- linkToMedia: linkToMedia$1,
529
- number: number$1,
530
- richText: richText$1,
531
- select: select$1,
532
- timestamp: timestamp$1,
533
- title: title$1
534
- };
535
- const buildMockGroupFieldMap = (config = {}) => {
536
- var _a;
518
+ const sharedSliceVariation$1 = (config = {}) => {
537
519
  const faker = createFaker(config.seed);
538
- const configs = config.configs || {};
539
- const fields = {};
540
- for (const mockModelType in mockModelFns) {
541
- const mockModelFn = mockModelFns[mockModelType];
542
- const mockModelMapConfig = configs[mockModelType] || {};
543
- const count = (_a = mockModelMapConfig.count) != null ? _a : faker.random.arrayElement([0, 0, 0, 1]);
544
- for (let i = 0; i < count; i++) {
545
- const fieldId = generateFieldId({ seed: config.seed });
546
- fields[fieldId] = mockModelFn({
547
- seed: config.seed,
548
- ...mockModelMapConfig.config
549
- });
550
- }
520
+ let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
521
+ let id = config.id || changeCase__namespace.snakeCase(name);
522
+ if (config.id && !config.name) {
523
+ name = changeCase__namespace.pascalCase(config.id);
524
+ } else if (config.name && !config.name) {
525
+ id = changeCase__namespace.snakeCase(config.name);
551
526
  }
552
- return fields;
553
- };
554
-
555
- const uid$1 = (config = {}) => {
556
- const faker = createFaker(config.seed);
557
527
  return {
558
- type: prismicT__namespace.CustomTypeModelFieldType.UID,
559
- config: {
560
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
561
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3))
562
- }
563
- };
564
- };
565
-
566
- const sharedSliceChoice = () => {
567
- return {
568
- type: prismicT__namespace.CustomTypeModelSliceType.SharedSlice
528
+ id,
529
+ name,
530
+ description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
531
+ docURL: faker.url(),
532
+ version: faker.hash(7),
533
+ primary: config.primaryFields || {},
534
+ items: config.itemsFields || {}
569
535
  };
570
536
  };
571
537
 
572
538
  const slice$1 = (config = {}) => {
573
- var _a, _b, _c, _d, _e, _f;
574
539
  const faker = createFaker(config.seed);
575
540
  return {
576
541
  type: prismicT__namespace.CustomTypeModelSliceType.Slice,
577
- icon: changeCase__namespace.snakeCase(faker.company.bsNoun()),
578
- display: faker.datatype.boolean() ? prismicT__namespace.CustomTypeModelSliceDisplay.Grid : prismicT__namespace.CustomTypeModelSliceDisplay.List,
579
- fieldset: changeCase__namespace.capitalCase(faker.lorem.words()),
580
- description: faker.lorem.sentence(),
581
- repeat: buildMockGroupFieldMap({
582
- seed: (_b = (_a = config.repeatFieldConfig) == null ? void 0 : _a.seed) != null ? _b : config.seed,
583
- configs: (_c = config.repeatFieldConfig) == null ? void 0 : _c.configs
584
- }),
585
- "non-repeat": buildMockGroupFieldMap({
586
- seed: (_e = (_d = config.nonRepeatFieldConfig) == null ? void 0 : _d.seed) != null ? _e : config.seed,
587
- configs: (_f = config.nonRepeatFieldConfig) == null ? void 0 : _f.configs
588
- })
542
+ icon: changeCase__namespace.snakeCase(faker.word()),
543
+ display: faker.boolean() ? prismicT__namespace.CustomTypeModelSliceDisplay.Grid : prismicT__namespace.CustomTypeModelSliceDisplay.List,
544
+ fieldset: changeCase__namespace.capitalCase(faker.words(2)),
545
+ description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
546
+ repeat: config.repeatFields || {},
547
+ "non-repeat": config.nonRepeatFields || {}
589
548
  };
590
549
  };
591
550
 
592
551
  const sliceZone$1 = (config = {}) => {
593
- var _a;
594
- const faker = createFaker(config.seed);
595
- let choices = {};
596
- if ("choices" in config) {
597
- choices = config.choices || {};
598
- } else {
599
- const choicesCount = (_a = config.choicesCount) != null ? _a : faker.datatype.number({ min: 2, max: 6 });
600
- for (let i = 0; i < choicesCount; i++) {
601
- const choiceId = generateFieldId({ seed: config.seed });
602
- choices[choiceId] = config.withSharedSlices ? sharedSliceChoice() : slice$1({ seed: config.seed });
603
- }
604
- }
605
552
  const labels = {};
606
- for (const choiceId in choices) {
607
- const choice = choices[choiceId];
553
+ for (const choiceId in config.choices) {
554
+ const choice = config.choices[choiceId];
608
555
  if (choice.type === prismicT__namespace.CustomTypeModelSliceType.Slice) {
609
- const labelsCount = faker.datatype.number({ min: 0, max: 3 });
610
- labels[choiceId] = Array(labelsCount).fill(void 0).map(() => ({
611
- name: changeCase__namespace.capitalCase(faker.company.bsNoun()),
612
- display: faker.datatype.boolean() ? prismicT__namespace.CustomTypeModelSliceDisplay.Grid : prismicT__namespace.CustomTypeModelSliceDisplay.List
613
- }));
556
+ labels[choiceId] = [];
614
557
  }
615
558
  }
616
559
  return {
@@ -618,109 +561,56 @@ const sliceZone$1 = (config = {}) => {
618
561
  fieldset: "Slice zone",
619
562
  config: {
620
563
  labels,
621
- choices
622
- }
623
- };
624
- };
625
-
626
- const customType$1 = (config = {}) => {
627
- var _a;
628
- const faker = createFaker(config.seed);
629
- const tabsCount = (_a = config.tabsCount) != null ? _a : faker.datatype.number({ min: 1, max: 3 });
630
- const json = {};
631
- for (let i = 0; i < tabsCount; i++) {
632
- const tabName = changeCase__namespace.capitalCase(faker.lorem.word());
633
- const tabFields = buildMockGroupFieldMap({
634
- seed: config.seed,
635
- configs: config.configs
636
- });
637
- if (i === 0 && config.withUID) {
638
- const fieldId = generateFieldId({ seed: config.seed });
639
- tabFields[fieldId] = uid$1();
640
- }
641
- if (config.withSliceZones) {
642
- const sliceZoneId = generateFieldId({ seed: config.seed });
643
- tabFields[sliceZoneId] = sliceZone$1({
644
- withSharedSlices: config.withSharedSlices
645
- });
564
+ choices: config.choices || {}
646
565
  }
647
- json[tabName] = tabFields;
648
- }
649
- const id = generateCustomTypeId({ seed: config.seed });
650
- return {
651
- id,
652
- label: changeCase__namespace.capitalCase(id),
653
- status: faker.datatype.boolean(),
654
- repeatable: faker.datatype.boolean(),
655
- json
656
566
  };
657
567
  };
658
568
 
659
- const group$1 = (config = {}) => {
569
+ const title$1 = (config = {}) => {
660
570
  const faker = createFaker(config.seed);
661
- const fields = buildMockGroupFieldMap({
662
- seed: config.seed,
663
- configs: config.configs
664
- });
571
+ const single = faker.randomElements([
572
+ "heading1",
573
+ "heading2",
574
+ "heading3",
575
+ "heading4",
576
+ "heading5",
577
+ "heading6"
578
+ ]).join(",");
665
579
  return {
666
- type: prismicT__namespace.CustomTypeModelFieldType.Group,
580
+ type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
667
581
  config: {
668
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
669
- fields
582
+ label: changeCase__namespace.capitalCase(faker.word()),
583
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
584
+ single,
585
+ allowTargetBlank: faker.boolean() || void 0
670
586
  }
671
587
  };
672
588
  };
673
589
 
674
- const sharedSliceVariation$1 = (config = {}) => {
675
- var _a, _b, _c, _d, _e, _f;
590
+ const generateFieldId = (config) => {
676
591
  const faker = createFaker(config.seed);
677
- const name = changeCase__namespace.capitalCase(faker.company.bsNoun());
678
- return {
679
- id: changeCase__namespace.snakeCase(name),
680
- name,
681
- description: faker.lorem.sentence(),
682
- docURL: faker.internet.url(),
683
- version: faker.git.shortSha(),
684
- primary: buildMockGroupFieldMap({
685
- seed: (_b = (_a = config.primaryFieldConfig) == null ? void 0 : _a.seed) != null ? _b : config.seed,
686
- configs: (_c = config.primaryFieldConfig) == null ? void 0 : _c.configs
687
- }),
688
- items: buildMockGroupFieldMap({
689
- seed: (_e = (_d = config.itemsFieldConfig) == null ? void 0 : _d.seed) != null ? _e : config.seed,
690
- configs: (_f = config.itemsFieldConfig) == null ? void 0 : _f.configs
691
- })
692
- };
592
+ return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
693
593
  };
694
594
 
695
- const sharedSlice$1 = (config = {}) => {
696
- var _a;
595
+ const timestamp = (config = {}) => {
697
596
  const faker = createFaker(config.seed);
698
- const name = changeCase__namespace.capitalCase(faker.company.bsNoun());
699
- let variations = [];
700
- if ("variations" in config) {
701
- variations = config.variations || [];
597
+ if (config.state === "empty") {
598
+ return null;
702
599
  } else {
703
- const variationsCount = (_a = config.variationsCount) != null ? _a : faker.datatype.number({ min: 1, max: 3 });
704
- variations = Array(variationsCount).fill(void 0).map(() => sharedSliceVariation$1({
705
- seed: config.seed,
706
- itemsFieldConfig: config.itemsFieldConfig,
707
- primaryFieldConfig: config.primaryFieldConfig
708
- }));
600
+ let date;
601
+ const after = config.after ? new Date(config.after.toISOString().split("T")[0]) : void 0;
602
+ const before = config.before ? new Date(config.before.toISOString().split("T")[0]) : void 0;
603
+ if (after && before) {
604
+ date = faker.dateBetween(after, before);
605
+ } else if (after) {
606
+ date = faker.dateAfter(after);
607
+ } else if (before) {
608
+ date = faker.dateBefore(before);
609
+ } else {
610
+ date = faker.date();
611
+ }
612
+ return date.toISOString();
709
613
  }
710
- return {
711
- type: prismicT__namespace.CustomTypeModelSliceType.SharedSlice,
712
- id: changeCase__namespace.snakeCase(name),
713
- name,
714
- description: faker.lorem.sentence(),
715
- variations
716
- };
717
- };
718
-
719
- const timestamp = (config = {}) => {
720
- const faker = createFaker(config.seed);
721
- const after = config.after || faker.date.past(20, new Date("2021-03-07")).toISOString().split("T")[0];
722
- const before = config.before || faker.date.future(20, new Date("2021-03-07")).toISOString().split("T")[0];
723
- return faker.date.between(after, before).toISOString();
724
614
  };
725
615
 
726
616
  const buildAlternativeLanguage = (config) => {
@@ -751,11 +641,11 @@ const customType = (config = {}) => {
751
641
  }));
752
642
  return {
753
643
  type: model.id,
754
- id: faker.git.shortSha(),
755
- uid: hasUID ? changeCase__namespace.snakeCase(faker.lorem.words(2)) : null,
756
- url: withURL ? faker.internet.url() : null,
757
- href: faker.internet.url(),
758
- lang: faker.lorem.word(),
644
+ id: faker.hash(7),
645
+ uid: hasUID ? changeCase__namespace.snakeCase(faker.words(faker.range(1, 3))) : null,
646
+ url: withURL ? faker.url() : null,
647
+ href: faker.url(),
648
+ lang: faker.word(),
759
649
  tags: generateTags({ seed: config.seed }),
760
650
  slugs: [],
761
651
  linked_documents: [],
@@ -772,7 +662,7 @@ const customType = (config = {}) => {
772
662
 
773
663
  const color = (config = {}) => {
774
664
  const faker = createFaker(config.seed);
775
- return faker.internet.color().toUpperCase();
665
+ return config.state === "empty" ? null : faker.hexColor().toUpperCase();
776
666
  };
777
667
 
778
668
  const buildContentRelationshipField = (config) => {
@@ -789,11 +679,18 @@ const buildContentRelationshipField = (config) => {
789
679
  };
790
680
  };
791
681
 
682
+ const generateCustomTypeId = (config) => {
683
+ const faker = createFaker(config.seed);
684
+ return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
685
+ };
686
+
792
687
  const contentRelationship = (config = {}) => {
793
- var _a;
794
688
  const faker = createFaker(config.seed);
795
- const isFilled = (_a = config.isFilled) != null ? _a : true;
796
- if (isFilled) {
689
+ if (config.state === "empty") {
690
+ return {
691
+ link_type: prismicT__namespace.LinkType.Document
692
+ };
693
+ } else {
797
694
  const model = config.model || contentRelationship$1({ seed: config.seed });
798
695
  const linkableDocuments = config.linkableDocuments ? config.linkableDocuments.filter((document2) => {
799
696
  let shouldKeep = true;
@@ -807,177 +704,186 @@ const contentRelationship = (config = {}) => {
807
704
  }) : [
808
705
  {
809
706
  ...customType({ seed: config.seed }),
810
- type: model.config.customtypes ? faker.random.arrayElement(model.config.customtypes) : generateCustomTypeId({ seed: config.seed }),
811
- tags: model.config.tags ? faker.random.arrayElements(model.config.tags) : generateTags({ seed: config.seed })
707
+ type: model.config.customtypes ? faker.randomElement(model.config.customtypes) : generateCustomTypeId({ seed: config.seed }),
708
+ tags: model.config.tags ? faker.randomElements(model.config.tags) : generateTags({ seed: config.seed })
812
709
  }
813
710
  ];
814
- const document = faker.random.arrayElement(linkableDocuments);
711
+ const document = faker.randomElement(linkableDocuments);
815
712
  if (!document) {
816
713
  throw new Error("A linkable document could not be found.");
817
714
  }
818
- return buildContentRelationshipField({ document });
819
- } else {
820
- return {
821
- link_type: prismicT__namespace.LinkType.Document
822
- };
715
+ return buildContentRelationshipField({
716
+ document
717
+ });
823
718
  }
824
719
  };
825
720
 
826
721
  const date = (config = {}) => {
827
- return timestamp({
722
+ return config.state === "empty" ? null : timestamp({
828
723
  seed: config.seed,
829
724
  after: config.after,
830
- before: config.before
725
+ before: config.before,
726
+ state: "filled"
831
727
  }).split("T")[0];
832
728
  };
833
729
 
834
730
  const buildEmbedField = (config) => {
731
+ var _a;
835
732
  const faker = createFaker(config.seed);
836
733
  return {
837
- type: faker.datatype.boolean() ? prismicT__namespace.EmbedType.Link : prismicT__namespace.EmbedType.Rich,
838
- url: config.embedData.url,
839
- html: config.embedData.html,
840
- title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
841
- version: faker.datatype.number({ min: 1, max: 3, precision: 10 }).toString(),
842
- cache_age: faker.datatype.number(),
843
- embed_url: config.embedData.embed_url,
844
- author_url: faker.internet.url(),
845
- author_name: faker.company.companyName(),
846
- provider_name: faker.company.companyName(),
847
- thumbnail_width: config.embedData.thumbnail_width,
848
- thumbnail_height: config.embedData.thumbnail_height,
849
- thumbnail_url: config.embedData.thumbnail_url,
850
- width: faker.datatype.number({ min: 200, max: 500 }),
851
- height: faker.datatype.number({ min: 200, max: 500 })
734
+ embed_url: (_a = config.url) != null ? _a : faker.url(),
735
+ html: `<div>embed html</div>`,
736
+ ...config.data
852
737
  };
853
738
  };
854
739
 
855
740
  const dataSet$1 = [
856
741
  {
857
- url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
742
+ version: "1.0",
743
+ type: "video",
858
744
  embed_url: "https://www.youtube.com/embed/fiOwHYFkUz0",
859
745
  thumbnail_url: "https://i.ytimg.com/vi/fiOwHYFkUz0/hqdefault.jpg",
860
746
  thumbnail_height: 360,
861
747
  thumbnail_width: 480,
862
- 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>'
748
+ 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>',
749
+ width: 200,
750
+ height: 113
863
751
  },
864
752
  {
865
- url: "https://www.youtube.com/watch?v=c-ATzcy6VkI",
753
+ version: "1.0",
754
+ type: "video",
866
755
  embed_url: "https://www.youtube.com/embed/c-ATzcy6VkI",
867
756
  thumbnail_url: "https://i.ytimg.com/vi/c-ATzcy6VkI/hqdefault.jpg",
868
757
  thumbnail_height: 360,
869
758
  thumbnail_width: 480,
870
- 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>'
759
+ 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>',
760
+ width: 200,
761
+ height: 113
871
762
  },
872
763
  {
873
- url: "https://www.youtube.com/watch?v=iewZXv94XGY",
764
+ version: "1.0",
765
+ type: "video",
874
766
  embed_url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
875
767
  thumbnail_url: "https://i.ytimg.com/vi/iewZXv94XGY/hqdefault.jpg",
876
768
  thumbnail_height: 360,
877
769
  thumbnail_width: 480,
878
- 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>'
770
+ 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>',
771
+ width: 200,
772
+ height: 113
879
773
  },
880
774
  {
881
- url: "https://twitter.com/prismicio/status/1356293316158095361",
882
- embed_url: "https://www.youtube.com/watch?v=iewZXv94XGY",
775
+ version: "1.0",
776
+ type: "rich",
777
+ embed_url: "https://twitter.com/prismicio/status/1356293316158095361",
883
778
  thumbnail_url: null,
884
779
  thumbnail_height: null,
885
780
  thumbnail_width: null,
886
- 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>&#39;s thoughts on Gatsby&#39;s success and how they&#39;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>&mdash; 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'
781
+ 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>&#39;s thoughts on Gatsby&#39;s success and how they&#39;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>&mdash; 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',
782
+ width: 200,
783
+ height: 113
887
784
  },
888
785
  {
889
- url: "https://twitter.com/timbenniks/status/1304146886832594944",
786
+ type: "rich",
787
+ version: "1.0",
788
+ embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
890
789
  thumbnail_url: null,
891
790
  thumbnail_width: null,
892
791
  thumbnail_height: null,
893
- embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
894
- 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&amp;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>&mdash; 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'
792
+ 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&amp;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>&mdash; 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',
793
+ width: 200,
794
+ height: 113
895
795
  },
896
796
  {
897
- url: "https://twitter.com/prismicio/status/1354112310252630016",
797
+ version: "1.0",
798
+ type: "rich",
799
+ embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
898
800
  thumbnail_url: null,
899
801
  thumbnail_width: null,
900
802
  thumbnail_height: null,
901
- embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
902
- html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">We&#39;re launching a new <a href="https://twitter.com/hashtag/SliceContest?src=hash&amp;ref_src=twsrc%5Etfw">#SliceContest</a> tomorrow along with Slice Machine upgrades.<br><br>Want to know more? Join us at tomorrow&#39;s Product Meet-up\u{1F447}<a href="https://t.co/prYSypiAvB">https://t.co/prYSypiAvB</a><br><br>We can&#39;t tell you any further details for now, but here&#39;s a sneak peek at the prizes\u{1F440} <a href="https://t.co/fV1eoGlEBh">pic.twitter.com/fV1eoGlEBh</a></p>&mdash; 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'
803
+ html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">We&#39;re launching a new <a href="https://twitter.com/hashtag/SliceContest?src=hash&amp;ref_src=twsrc%5Etfw">#SliceContest</a> tomorrow along with Slice Machine upgrades.<br><br>Want to know more? Join us at tomorrow&#39;s Product Meet-up\u{1F447}<a href="https://t.co/prYSypiAvB">https://t.co/prYSypiAvB</a><br><br>We can&#39;t tell you any further details for now, but here&#39;s a sneak peek at the prizes\u{1F440} <a href="https://t.co/fV1eoGlEBh">pic.twitter.com/fV1eoGlEBh</a></p>&mdash; 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',
804
+ width: 200,
805
+ height: 113
903
806
  },
904
807
  {
905
- url: "https://twitter.com/prismicio/status/1354835716430319617",
808
+ version: "1.0",
809
+ type: "rich",
810
+ embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
906
811
  thumbnail_url: null,
907
812
  thumbnail_width: null,
908
813
  thumbnail_height: null,
909
- embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
910
- html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Does anyone want to create a wildly popular website for discussing &#39;Wall Street Bets&#39; using Prismic?<br><br>It may or may not have to look a lot like <a href="https://twitter.com/hashtag/reddit?src=hash&amp;ref_src=twsrc%5Etfw">#reddit</a> and we won&#39;t make it private.<br><br>Just asking for some friends...</p>&mdash; 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'
814
+ html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Does anyone want to create a wildly popular website for discussing &#39;Wall Street Bets&#39; using Prismic?<br><br>It may or may not have to look a lot like <a href="https://twitter.com/hashtag/reddit?src=hash&amp;ref_src=twsrc%5Etfw">#reddit</a> and we won&#39;t make it private.<br><br>Just asking for some friends...</p>&mdash; 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',
815
+ width: 200,
816
+ height: 113
911
817
  }
912
818
  ];
913
819
  const getMockEmbedData = (config) => {
914
820
  const faker = createFaker(config.seed);
915
- return faker.random.arrayElement(dataSet$1);
821
+ return faker.randomElement(dataSet$1);
916
822
  };
917
823
 
918
824
  const embed$1 = (config = {}) => {
919
- const embedData = getMockEmbedData({ seed: config.seed });
920
- return buildEmbedField({ seed: config.seed, embedData });
825
+ var _a, _b, _c;
826
+ const data = (_a = config.data) != null ? _a : getMockEmbedData({ seed: config.seed });
827
+ return config.state === "empty" ? {} : buildEmbedField({
828
+ seed: config.seed,
829
+ url: (_b = config.url) != null ? _b : "embed_url" in data ? data.embed_url : void 0,
830
+ html: (_c = config.html) != null ? _c : "html" in data ? data.html : void 0,
831
+ data
832
+ });
921
833
  };
922
834
 
923
835
  const geoPoint = (config = {}) => {
924
836
  const faker = createFaker(config.seed);
925
- const coordinates = faker.address.nearbyGPSCoordinate();
926
- return {
927
- longitude: Number.parseFloat(coordinates[0]),
928
- latitude: Number.parseFloat(coordinates[1])
837
+ return config.state === "empty" ? {} : {
838
+ longitude: faker.rangeFloat(-180, 180),
839
+ latitude: faker.rangeFloat(-90, 90)
929
840
  };
930
841
  };
931
842
 
932
- const patterns$9 = {
933
- short: {
934
- minItems: 1,
935
- maxItems: 3
936
- },
937
- medium: {
938
- minItems: 3,
939
- maxItems: 6
940
- },
941
- long: {
942
- minItems: 6,
943
- maxItems: 12
944
- }
945
- };
946
843
  const group = (config = {}) => {
947
- const faker = createFaker(config.seed);
948
- const model = config.model || group$1({ seed: config.seed });
949
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$9));
950
- const pattern = patterns$9[patternKey];
951
- const itemsCount = faker.datatype.number({
952
- min: pattern.minItems,
953
- max: pattern.maxItems
954
- });
955
- return Array(itemsCount).fill(void 0).map(() => {
956
- return valueForModelMap({
957
- seed: config.seed,
958
- map: model.config.fields,
959
- configs: config.configs
844
+ var _a;
845
+ if (config.state === "empty") {
846
+ return [];
847
+ } else {
848
+ const faker = createFaker(config.seed);
849
+ const model = config.model || group$1({ seed: config.seed });
850
+ const itemsCount = (_a = config.itemsCount) != null ? _a : faker.range(1, 6);
851
+ return Array(itemsCount).fill(void 0).map(() => {
852
+ return valueForModelMap({
853
+ seed: config.seed,
854
+ map: model.config.fields,
855
+ configs: config.configs
856
+ });
960
857
  });
961
- });
858
+ }
962
859
  };
963
860
 
964
- const buildImageField = (config) => {
861
+ const buildImageFieldImage = (config) => {
965
862
  var _a, _b, _c, _d;
966
- const faker = createFaker(config.seed);
967
- const url = new URL(config.imageData.url);
968
- const dimensions = {
969
- width: (_b = (_a = config.constraint) == null ? void 0 : _a.width) != null ? _b : config.imageData.width,
970
- height: (_d = (_c = config.constraint) == null ? void 0 : _c.height) != null ? _d : config.imageData.height
971
- };
972
- url.searchParams.set("w", dimensions.width.toString());
973
- url.searchParams.set("h", dimensions.height.toString());
974
- url.searchParams.set("fit", "crop");
975
- return {
976
- url: url.toString(),
977
- dimensions,
978
- alt: faker.lorem.sentence(),
979
- copyright: faker.lorem.sentence()
980
- };
863
+ if (config.state === "empty") {
864
+ return {
865
+ url: null,
866
+ dimensions: null,
867
+ alt: null,
868
+ copyright: null
869
+ };
870
+ } else {
871
+ const faker = createFaker(config.seed);
872
+ const url = new URL(config.imageData.url);
873
+ const dimensions = {
874
+ width: (_b = (_a = config.constraint) == null ? void 0 : _a.width) != null ? _b : config.imageData.width,
875
+ height: (_d = (_c = config.constraint) == null ? void 0 : _c.height) != null ? _d : config.imageData.height
876
+ };
877
+ url.searchParams.set("w", dimensions.width.toString());
878
+ url.searchParams.set("h", dimensions.height.toString());
879
+ url.searchParams.set("fit", "crop");
880
+ return {
881
+ url: url.toString(),
882
+ dimensions,
883
+ alt: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
884
+ copyright: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15)))
885
+ };
886
+ }
981
887
  };
982
888
 
983
889
  const dataSet = [
@@ -1064,25 +970,27 @@ const dataSet = [
1064
970
  ];
1065
971
  const getMockImageData = (config) => {
1066
972
  const faker = createFaker(config.seed);
1067
- return faker.random.arrayElement(dataSet);
973
+ return faker.randomElement(dataSet);
1068
974
  };
1069
975
 
1070
976
  const image$1 = (config = {}) => {
1071
977
  const model = config.model || image$2({ seed: config.seed });
1072
978
  const imageData = getMockImageData({ seed: config.seed });
1073
- const value = buildImageField({
979
+ const value = buildImageFieldImage({
1074
980
  seed: config.seed,
1075
981
  imageData,
1076
- constraint: model.config.constraint
982
+ constraint: model.config.constraint,
983
+ state: config.state
1077
984
  });
1078
985
  for (const thumbnail of model.config.thumbnails) {
1079
- value[thumbnail.name] = buildImageField({
986
+ value[thumbnail.name] = buildImageFieldImage({
1080
987
  seed: config.seed,
1081
988
  imageData,
1082
989
  constraint: {
1083
990
  width: thumbnail.width,
1084
991
  height: thumbnail.height
1085
- }
992
+ },
993
+ state: config.state
1086
994
  });
1087
995
  }
1088
996
  return value;
@@ -1091,87 +999,86 @@ const image$1 = (config = {}) => {
1091
999
  const integrationFields = (config = {}) => {
1092
1000
  const faker = createFaker(config.seed);
1093
1001
  const imageData = getMockImageData({ seed: config.seed });
1094
- return {
1095
- id: faker.git.shortSha(),
1096
- title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
1097
- description: faker.lorem.sentence(),
1002
+ return config.state === "empty" ? null : {
1003
+ id: faker.hash(7),
1004
+ title: changeCase__namespace.capitalCase(faker.words(faker.range(1, 3))),
1005
+ description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
1098
1006
  image_url: imageData.url,
1099
- last_update: faker.date.past(20, new Date("2021-03-07")).getTime(),
1007
+ last_update: faker.date().getTime(),
1100
1008
  blob: config.data
1101
1009
  };
1102
1010
  };
1103
1011
 
1104
1012
  const keyText = (config = {}) => {
1105
1013
  const faker = createFaker(config.seed);
1106
- return changeCase__namespace.sentenceCase(faker.lorem.words(3));
1014
+ return config.state === "empty" ? null : changeCase__namespace.sentenceCase(faker.words(3));
1107
1015
  };
1108
1016
 
1109
1017
  const linkToMedia = (config = {}) => {
1110
- var _a;
1111
1018
  const faker = createFaker(config.seed);
1112
- const isFilled = (_a = config.isFilled) != null ? _a : true;
1113
- if (isFilled) {
1019
+ if (config.state === "empty") {
1114
1020
  return {
1115
- link_type: prismicT__namespace.LinkType.Media,
1116
- name: faker.system.commonFileName(),
1117
- kind: faker.system.commonFileType(),
1118
- url: faker.internet.url(),
1119
- size: faker.datatype.number().toString(),
1120
- height: faker.datatype.number().toString(),
1121
- width: faker.datatype.number().toString()
1021
+ link_type: prismicT__namespace.LinkType.Media
1122
1022
  };
1123
1023
  } else {
1124
1024
  return {
1125
- link_type: prismicT__namespace.LinkType.Media
1025
+ link_type: prismicT__namespace.LinkType.Media,
1026
+ name: `${changeCase__namespace.snakeCase(faker.words(faker.range(1, 2)))}.example`,
1027
+ kind: changeCase__namespace.snakeCase(faker.word()),
1028
+ url: faker.url(),
1029
+ size: faker.range(500, 3e3).toString(),
1030
+ height: faker.range(500, 3e3).toString(),
1031
+ width: faker.range(500, 3e3).toString()
1126
1032
  };
1127
1033
  }
1128
1034
  };
1129
1035
 
1130
1036
  const link = (config = {}) => {
1131
- var _a, _b;
1037
+ var _a;
1132
1038
  const faker = createFaker(config.seed);
1133
- const isFilled = (_a = config.isFilled) != null ? _a : true;
1134
- const type = config.type || faker.random.arrayElement([
1039
+ const type = config.type || faker.randomElement([
1135
1040
  prismicT__namespace.LinkType.Web,
1136
1041
  prismicT__namespace.LinkType.Document,
1137
1042
  prismicT__namespace.LinkType.Media
1138
1043
  ]);
1139
- if (isFilled) {
1044
+ if (config.state === "empty") {
1045
+ return {
1046
+ link_type: type
1047
+ };
1048
+ } else {
1140
1049
  switch (type) {
1141
1050
  case prismicT__namespace.LinkType.Document: {
1142
1051
  return contentRelationship({
1143
1052
  seed: config.seed,
1144
- isFilled,
1053
+ state: config.state,
1145
1054
  linkableDocuments: config.linkableDocuments
1146
1055
  });
1147
1056
  }
1148
1057
  case prismicT__namespace.LinkType.Media: {
1149
1058
  return linkToMedia({
1150
1059
  seed: config.seed,
1151
- isFilled
1060
+ state: config.state
1152
1061
  });
1153
1062
  }
1154
- case prismicT__namespace.LinkType.Web: {
1063
+ case prismicT__namespace.LinkType.Web:
1064
+ default: {
1155
1065
  const model = config.model || link$1({ seed: config.seed });
1156
1066
  return {
1157
1067
  link_type: prismicT__namespace.LinkType.Web,
1158
- url: faker.internet.url(),
1159
- target: ((_b = config.withTargetBlank) != null ? _b : model.config.allowTargetBlank && faker.datatype.boolean()) ? "_blank" : void 0
1068
+ url: faker.url(),
1069
+ target: ((_a = config.withTargetBlank) != null ? _a : model.config.allowTargetBlank && faker.boolean()) ? "_blank" : void 0
1160
1070
  };
1161
1071
  }
1162
1072
  }
1163
1073
  }
1164
- return {
1165
- link_type: type
1166
- };
1167
1074
  };
1168
1075
 
1169
1076
  const number = (config = {}) => {
1170
1077
  const faker = createFaker(config.seed);
1171
- return faker.datatype.number();
1078
+ return config.state === "empty" ? null : faker.range(1, 100);
1172
1079
  };
1173
1080
 
1174
- const patterns$8 = {
1081
+ const patterns$5 = {
1175
1082
  short: {
1176
1083
  minWords: 1,
1177
1084
  maxWords: 3
@@ -1196,16 +1103,13 @@ const heading = (config = {}) => {
1196
1103
  prismicT__namespace.RichTextNodeType.heading5,
1197
1104
  prismicT__namespace.RichTextNodeType.heading6
1198
1105
  ].includes(type2));
1199
- const type = faker.random.arrayElement(types);
1106
+ const type = faker.randomElement(types);
1200
1107
  if (type) {
1201
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$8));
1202
- const pattern = patterns$8[patternKey];
1108
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$5));
1109
+ const pattern = patterns$5[patternKey];
1203
1110
  return {
1204
1111
  type,
1205
- text: changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({
1206
- min: pattern.minWords,
1207
- max: pattern.maxWords
1208
- }))),
1112
+ text: changeCase__namespace.capitalCase(faker.words(faker.range(pattern.minWords, pattern.maxWords))),
1209
1113
  spans: []
1210
1114
  };
1211
1115
  } else {
@@ -1213,7 +1117,7 @@ const heading = (config = {}) => {
1213
1117
  }
1214
1118
  };
1215
1119
 
1216
- const patterns$7 = {
1120
+ const patterns$4 = {
1217
1121
  short: {
1218
1122
  sentenceCount: 2
1219
1123
  },
@@ -1226,16 +1130,17 @@ const patterns$7 = {
1226
1130
  };
1227
1131
  const paragraph = (config = {}) => {
1228
1132
  const faker = createFaker(config.seed);
1229
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$7));
1230
- const pattern = patterns$7[patternKey];
1133
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$4));
1134
+ const pattern = patterns$4[patternKey];
1135
+ const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
1231
1136
  return {
1232
1137
  type: prismicT__namespace.RichTextNodeType.paragraph,
1233
- text: faker.lorem.paragraph(pattern.sentenceCount),
1138
+ text,
1234
1139
  spans: []
1235
1140
  };
1236
1141
  };
1237
1142
 
1238
- const patterns$6 = {
1143
+ const patterns$3 = {
1239
1144
  short: {
1240
1145
  sentenceCount: 2
1241
1146
  },
@@ -1248,16 +1153,17 @@ const patterns$6 = {
1248
1153
  };
1249
1154
  const preformatted = (config = {}) => {
1250
1155
  const faker = createFaker(config.seed);
1251
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$6));
1252
- const pattern = patterns$6[patternKey];
1156
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$3));
1157
+ const pattern = patterns$3[patternKey];
1158
+ const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
1253
1159
  return {
1254
1160
  type: prismicT__namespace.RichTextNodeType.preformatted,
1255
- text: faker.lorem.paragraph(pattern.sentenceCount),
1161
+ text,
1256
1162
  spans: []
1257
1163
  };
1258
1164
  };
1259
1165
 
1260
- const patterns$5 = {
1166
+ const patterns$2 = {
1261
1167
  short: {
1262
1168
  minItems: 1,
1263
1169
  maxItems: 3
@@ -1273,22 +1179,19 @@ const patterns$5 = {
1273
1179
  };
1274
1180
  const list = (config = {}) => {
1275
1181
  const faker = createFaker(config.seed);
1276
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$5));
1277
- const pattern = patterns$5[patternKey];
1278
- const itemsCount = faker.datatype.number({
1279
- min: pattern.minItems,
1280
- max: pattern.maxItems
1281
- });
1182
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$2));
1183
+ const pattern = patterns$2[patternKey];
1184
+ const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
1282
1185
  return Array(itemsCount).fill(void 0).map(() => {
1283
1186
  return {
1284
1187
  type: prismicT__namespace.RichTextNodeType.listItem,
1285
- text: faker.lorem.sentence(),
1188
+ text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
1286
1189
  spans: []
1287
1190
  };
1288
1191
  });
1289
1192
  };
1290
1193
 
1291
- const patterns$4 = {
1194
+ const patterns$1 = {
1292
1195
  short: {
1293
1196
  minItems: 1,
1294
1197
  maxItems: 3
@@ -1304,16 +1207,13 @@ const patterns$4 = {
1304
1207
  };
1305
1208
  const oList = (config = {}) => {
1306
1209
  const faker = createFaker(config.seed);
1307
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$4));
1308
- const pattern = patterns$4[patternKey];
1309
- const itemsCount = faker.datatype.number({
1310
- min: pattern.minItems,
1311
- max: pattern.maxItems
1312
- });
1210
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$1));
1211
+ const pattern = patterns$1[patternKey];
1212
+ const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
1313
1213
  return Array(itemsCount).fill(void 0).map(() => {
1314
1214
  return {
1315
1215
  type: prismicT__namespace.RichTextNodeType.oListItem,
1316
- text: faker.lorem.sentence(),
1216
+ text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
1317
1217
  spans: []
1318
1218
  };
1319
1219
  });
@@ -1321,7 +1221,11 @@ const oList = (config = {}) => {
1321
1221
 
1322
1222
  const image = (config = {}) => {
1323
1223
  const imageData = getMockImageData({ seed: config.seed });
1324
- const imageField = buildImageField({ seed: config.seed, imageData });
1224
+ const imageField = buildImageFieldImage({
1225
+ seed: config.seed,
1226
+ imageData,
1227
+ state: "filled"
1228
+ });
1325
1229
  return {
1326
1230
  type: prismicT__namespace.RichTextNodeType.image,
1327
1231
  alt: imageField.alt,
@@ -1332,15 +1236,15 @@ const image = (config = {}) => {
1332
1236
  };
1333
1237
 
1334
1238
  const embed = (config = {}) => {
1335
- const embedData = getMockEmbedData({ seed: config.seed });
1336
- const embedField = buildEmbedField({ seed: config.seed, embedData });
1239
+ const data = getMockEmbedData({ seed: config.seed });
1240
+ const embedField = buildEmbedField({ seed: config.seed, data });
1337
1241
  return {
1338
1242
  type: prismicT__namespace.RichTextNodeType.embed,
1339
1243
  oembed: embedField
1340
1244
  };
1341
1245
  };
1342
1246
 
1343
- const patterns$3 = {
1247
+ const patterns = {
1344
1248
  short: {
1345
1249
  blockCountMin: 1,
1346
1250
  blockCountMax: 2
@@ -1377,14 +1281,11 @@ const richText = (config = {}) => {
1377
1281
  const supportsMultipleBlocks = "multi" in model.config;
1378
1282
  const types = ("multi" in model.config ? model.config.multi : model.config.single).split(",").filter((type) => Object.keys(generators).includes(type));
1379
1283
  if (types.length > 0) {
1380
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$3));
1381
- const pattern = patterns$3[patternKey];
1382
- const blockCount = supportsMultipleBlocks ? faker.datatype.number({
1383
- min: pattern.blockCountMin,
1384
- max: pattern.blockCountMax
1385
- }) : 1;
1284
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
1285
+ const pattern = patterns[patternKey];
1286
+ const blockCount = supportsMultipleBlocks ? faker.range(pattern.blockCountMin, pattern.blockCountMax) : 1;
1386
1287
  return Array(blockCount).fill(void 0).map(() => {
1387
- const type = faker.random.arrayElement(types);
1288
+ const type = faker.randomElement(types);
1388
1289
  const generator = generators[type];
1389
1290
  return generator({ seed: config.seed, model });
1390
1291
  }).flat().filter((block) => block !== void 0).slice(0, blockCount);
@@ -1397,39 +1298,20 @@ const select = (config = {}) => {
1397
1298
  const faker = createFaker(config.seed);
1398
1299
  const model = config.model || select$1({ seed: config.seed });
1399
1300
  const defaultValue = model.config.default_value;
1400
- return typeof defaultValue === "string" && faker.datatype.boolean() ? defaultValue : faker.random.arrayElement(model.config.options);
1401
- };
1402
-
1403
- const patterns$2 = {
1404
- none: {
1405
- minItems: 0,
1406
- maxItems: 0
1407
- },
1408
- short: {
1409
- minItems: 1,
1410
- maxItems: 3
1411
- },
1412
- medium: {
1413
- minItems: 3,
1414
- maxItems: 6
1415
- },
1416
- long: {
1417
- minItems: 6,
1418
- maxItems: 12
1301
+ if (config.state === "empty") {
1302
+ return null;
1303
+ } else {
1304
+ return typeof defaultValue === "string" && faker.boolean() ? defaultValue : faker.randomElement(model.config.options);
1419
1305
  }
1420
1306
  };
1307
+
1421
1308
  const slice = (config = {}) => {
1422
- var _a;
1309
+ var _a, _b;
1423
1310
  const faker = createFaker(config.seed);
1424
1311
  const model = config.model || slice$1({ seed: config.seed });
1425
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$2));
1426
- const pattern = patterns$2[patternKey];
1427
1312
  const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
1428
- const sliceLabel = config.label !== void 0 ? config.label : changeCase__namespace.capitalCase(faker.company.bsNoun());
1429
- const itemsCount = Object.keys(model.repeat).length > 0 ? faker.datatype.number({
1430
- min: pattern.minItems,
1431
- max: pattern.maxItems
1432
- }) : 0;
1313
+ const sliceLabel = config.label !== void 0 ? config.label : changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
1314
+ const itemsCount = Object.keys(model.repeat).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
1433
1315
  return {
1434
1316
  slice_type: sliceType,
1435
1317
  slice_label: sliceLabel,
@@ -1448,41 +1330,17 @@ const slice = (config = {}) => {
1448
1330
  };
1449
1331
  };
1450
1332
 
1451
- const patterns$1 = {
1452
- none: {
1453
- minItems: 0,
1454
- maxItems: 0
1455
- },
1456
- short: {
1457
- minItems: 1,
1458
- maxItems: 3
1459
- },
1460
- medium: {
1461
- minItems: 3,
1462
- maxItems: 6
1463
- },
1464
- long: {
1465
- minItems: 6,
1466
- maxItems: 12
1467
- }
1468
- };
1469
1333
  const sharedSliceVariation = (config = {}) => {
1470
1334
  var _a, _b;
1471
1335
  const faker = createFaker(config.seed);
1472
1336
  const model = config.model || sharedSliceVariation$1({ seed: config.seed });
1473
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$1));
1474
- const pattern = patterns$1[patternKey];
1475
1337
  const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
1476
- const sliceLabel = (_b = config.label) != null ? _b : changeCase__namespace.capitalCase(faker.company.bsNoun());
1477
- const itemsCount = Object.keys(model.items).length > 0 ? faker.datatype.number({
1478
- min: pattern.minItems,
1479
- max: pattern.maxItems
1480
- }) : 0;
1338
+ const itemsCount = Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
1481
1339
  return {
1482
1340
  slice_type: sliceType,
1483
- slice_label: sliceLabel,
1341
+ slice_label: null,
1484
1342
  variation: model.id,
1485
- version: faker.git.shortSha(),
1343
+ version: faker.hash(7),
1486
1344
  primary: valueForModelMap({
1487
1345
  seed: config.seed,
1488
1346
  map: model.primary,
@@ -1501,88 +1359,82 @@ const sharedSliceVariation = (config = {}) => {
1501
1359
  const sharedSlice = (config = {}) => {
1502
1360
  const faker = createFaker(config.seed);
1503
1361
  const model = config.model || sharedSlice$1({ seed: config.seed });
1504
- const variationModel = faker.random.arrayElement(model.variations);
1362
+ const variationModel = faker.randomElement(model.variations);
1505
1363
  return sharedSliceVariation({
1506
1364
  seed: config.seed,
1507
1365
  model: variationModel,
1508
- pattern: config.pattern,
1366
+ itemsCount: config.itemsCount,
1509
1367
  type: model.id,
1510
1368
  primaryFieldConfigs: config.primaryFieldConfigs,
1511
1369
  itemsFieldConfigs: config.itemsFieldConfigs
1512
1370
  });
1513
1371
  };
1514
1372
 
1515
- const patterns = {
1516
- short: {
1517
- minItems: 1,
1518
- maxItems: 3
1519
- },
1520
- medium: {
1521
- minItems: 3,
1522
- maxItems: 6
1523
- },
1524
- long: {
1525
- minItems: 6,
1526
- maxItems: 12
1527
- }
1528
- };
1529
1373
  const sliceZone = (config = {}) => {
1530
- const faker = createFaker(config.seed);
1531
- const model = config.model || sliceZone$1({ seed: config.seed });
1532
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns));
1533
- const pattern = patterns[patternKey];
1534
- const itemsCount = faker.datatype.number({
1535
- min: pattern.minItems,
1536
- max: pattern.maxItems
1537
- });
1538
- return Array(itemsCount).fill(void 0).map(() => {
1539
- var _a;
1540
- const choices = Object.entries(model.config.choices);
1541
- const [choiceType, choiceModel] = faker.random.arrayElement(choices);
1542
- const choiceLabels = model.config.labels[choiceType] || [];
1543
- const choiceLabel = faker.random.arrayElement(choiceLabels);
1544
- switch (choiceModel.type) {
1545
- case prismicT__namespace.CustomTypeModelSliceType.Slice: {
1546
- return slice({
1547
- seed: config.seed,
1548
- model: choiceModel,
1549
- type: choiceType,
1550
- label: choiceLabel ? choiceLabel.name : null,
1551
- primaryFieldConfigs: config.primaryFieldConfigs,
1552
- itemsFieldConfigs: config.itemsFieldConfigs
1553
- });
1554
- }
1555
- case prismicT__namespace.CustomTypeModelSliceType.SharedSlice: {
1556
- const sharedSliceModel = (_a = config.sharedSliceModels) == null ? void 0 : _a.find((sharedSliceModel2) => sharedSliceModel2.id === choiceType);
1557
- if (sharedSliceModel) {
1558
- return sharedSlice({
1559
- seed: config.seed,
1560
- model: sharedSliceModel,
1561
- primaryFieldConfigs: config.primaryFieldConfigs,
1562
- itemsFieldConfigs: config.itemsFieldConfigs
1563
- });
1374
+ var _a;
1375
+ if (config.state === "empty") {
1376
+ return [];
1377
+ } else {
1378
+ const faker = createFaker(config.seed);
1379
+ const model = config.model || sliceZone$1({ seed: config.seed });
1380
+ if (Object.keys(model.config.choices).length > 0) {
1381
+ const itemsCount = (_a = config.itemsCount) != null ? _a : faker.range(1, 6);
1382
+ return Array(itemsCount).fill(void 0).map(() => {
1383
+ var _a2;
1384
+ const choices = Object.entries(model.config.choices);
1385
+ const [choiceType, choiceModel] = faker.randomElement(choices);
1386
+ const choiceLabels = model.config.labels[choiceType] || [];
1387
+ const choiceLabel = faker.randomElement(choiceLabels);
1388
+ switch (choiceModel.type) {
1389
+ case prismicT__namespace.CustomTypeModelSliceType.Slice: {
1390
+ return slice({
1391
+ seed: config.seed,
1392
+ model: choiceModel,
1393
+ type: choiceType,
1394
+ label: choiceLabel ? choiceLabel.name : null,
1395
+ primaryFieldConfigs: config.primaryFieldConfigs,
1396
+ itemsFieldConfigs: config.itemsFieldConfigs
1397
+ });
1398
+ }
1399
+ case prismicT__namespace.CustomTypeModelSliceType.SharedSlice: {
1400
+ const sharedSliceModel = (_a2 = config.sharedSliceModels) == null ? void 0 : _a2.find((sharedSliceModel2) => sharedSliceModel2.id === choiceType);
1401
+ if (sharedSliceModel) {
1402
+ return sharedSlice({
1403
+ seed: config.seed,
1404
+ model: sharedSliceModel,
1405
+ primaryFieldConfigs: config.primaryFieldConfigs,
1406
+ itemsFieldConfigs: config.itemsFieldConfigs
1407
+ });
1408
+ }
1409
+ }
1564
1410
  }
1565
- }
1411
+ }).filter((slice2) => slice2 !== void 0);
1412
+ } else {
1413
+ return [];
1566
1414
  }
1567
- }).filter((slice2) => slice2 !== void 0);
1415
+ }
1568
1416
  };
1569
1417
 
1570
1418
  const title = (config = {}) => {
1571
- return [
1572
- heading({
1573
- seed: config.seed,
1574
- model: config.model,
1575
- pattern: config.pattern
1576
- })
1577
- ];
1419
+ if (config.state === "empty") {
1420
+ return [];
1421
+ } else {
1422
+ return [
1423
+ heading({
1424
+ seed: config.seed,
1425
+ model: config.model,
1426
+ pattern: config.pattern
1427
+ })
1428
+ ];
1429
+ }
1578
1430
  };
1579
1431
 
1580
1432
  const uid = (config = {}) => {
1581
1433
  const faker = createFaker(config.seed);
1582
- return changeCase__namespace.snakeCase(faker.lorem.words(2));
1434
+ return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
1583
1435
  };
1584
1436
 
1585
- exports.boolean = boolean$1;
1437
+ exports.boolean = boolean;
1586
1438
  exports.color = color;
1587
1439
  exports.contentRelationship = contentRelationship;
1588
1440
  exports.customType = customType;
@@ -1606,3 +1458,4 @@ exports.sliceZone = sliceZone;
1606
1458
  exports.timestamp = timestamp;
1607
1459
  exports.title = title;
1608
1460
  exports.uid = uid;
1461
+ //# sourceMappingURL=index.cjs.map