@prismicio/mock 0.0.7 → 0.0.10

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 (85) hide show
  1. package/dist/api/index.cjs +208 -100
  2. package/dist/api/index.cjs.map +1 -1
  3. package/dist/api/index.d.ts +1 -1
  4. package/dist/api/index.js +208 -100
  5. package/dist/api/index.js.map +1 -1
  6. package/dist/index.cjs +365 -255
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +36 -30
  9. package/dist/index.js +364 -253
  10. package/dist/index.js.map +1 -1
  11. package/dist/model/index.cjs +168 -74
  12. package/dist/model/index.cjs.map +1 -1
  13. package/dist/model/index.d.ts +4 -2
  14. package/dist/model/index.js +168 -74
  15. package/dist/model/index.js.map +1 -1
  16. package/dist/value/index.cjs +334 -224
  17. package/dist/value/index.cjs.map +1 -1
  18. package/dist/value/index.d.ts +29 -25
  19. package/dist/value/index.js +334 -224
  20. package/dist/value/index.js.map +1 -1
  21. package/package.json +19 -17
  22. package/src/api/query.ts +2 -2
  23. package/src/api/ref.ts +3 -3
  24. package/src/api/repository.ts +5 -5
  25. package/src/lib/buildEmbedField.ts +16 -27
  26. package/src/lib/buildImageFieldImage.ts +3 -2
  27. package/src/lib/createFaker.ts +98 -20
  28. package/src/lib/generateCustomTypeId.ts +1 -1
  29. package/src/lib/generateFieldId.ts +1 -3
  30. package/src/lib/generateTags.ts +4 -12
  31. package/src/lib/getMockEmbedData.ts +33 -12
  32. package/src/lib/getMockImageData.ts +1 -1
  33. package/src/lib/lorem.ts +112 -0
  34. package/src/model/boolean.ts +1 -1
  35. package/src/model/buildMockGroupFieldMap.ts +1 -1
  36. package/src/model/color.ts +2 -2
  37. package/src/model/contentRelationship.ts +2 -2
  38. package/src/model/customType.ts +3 -3
  39. package/src/model/date.ts +2 -2
  40. package/src/model/embed.ts +2 -2
  41. package/src/model/geoPoint.ts +1 -1
  42. package/src/model/group.ts +1 -1
  43. package/src/model/image.ts +5 -9
  44. package/src/model/integrationFields.ts +5 -3
  45. package/src/model/keyText.ts +2 -2
  46. package/src/model/link.ts +3 -3
  47. package/src/model/linkToMedia.ts +2 -2
  48. package/src/model/number.ts +2 -2
  49. package/src/model/richText.ts +6 -6
  50. package/src/model/select.ts +2 -2
  51. package/src/model/sharedSlice.ts +2 -2
  52. package/src/model/sharedSliceVariation.ts +4 -4
  53. package/src/model/slice.ts +4 -4
  54. package/src/model/timestamp.ts +2 -2
  55. package/src/model/title.ts +5 -5
  56. package/src/model/uid.ts +2 -2
  57. package/src/types.ts +105 -92
  58. package/src/value/boolean.ts +1 -1
  59. package/src/value/color.ts +1 -1
  60. package/src/value/contentRelationship.ts +3 -3
  61. package/src/value/customType.ts +5 -5
  62. package/src/value/embed.ts +20 -7
  63. package/src/value/geoPoint.ts +2 -4
  64. package/src/value/group.ts +31 -25
  65. package/src/value/integrationFields.ts +4 -4
  66. package/src/value/keyText.ts +1 -3
  67. package/src/value/link.ts +3 -3
  68. package/src/value/linkToMedia.ts +7 -6
  69. package/src/value/number.ts +1 -1
  70. package/src/value/richText/embed.ts +2 -2
  71. package/src/value/richText/heading.ts +3 -10
  72. package/src/value/richText/image.ts +3 -5
  73. package/src/value/richText/index.ts +3 -8
  74. package/src/value/richText/list.ts +4 -8
  75. package/src/value/richText/oList.ts +4 -8
  76. package/src/value/richText/paragraph.ts +8 -4
  77. package/src/value/richText/preformatted.ts +9 -5
  78. package/src/value/select.ts +2 -2
  79. package/src/value/sharedSlice.ts +1 -1
  80. package/src/value/sharedSliceVariation.ts +2 -6
  81. package/src/value/slice.ts +2 -6
  82. package/src/value/sliceZone.ts +50 -49
  83. package/src/value/timestamp.ts +28 -15
  84. package/src/value/title.ts +26 -13
  85. package/src/value/uid.ts +1 -1
@@ -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
 
@@ -27,44 +26,136 @@ function _interopNamespace(e) {
27
26
  return Object.freeze(n);
28
27
  }
29
28
 
30
- const fakerLocaleEN__namespace = /*#__PURE__*/_interopNamespace(fakerLocaleEN);
31
- const Faker__default = /*#__PURE__*/_interopDefaultLegacy(Faker);
29
+ const Rand__default = /*#__PURE__*/_interopDefaultLegacy(Rand);
32
30
  const prismicT__namespace = /*#__PURE__*/_interopNamespace(prismicT);
33
31
  const changeCase__namespace = /*#__PURE__*/_interopNamespace(changeCase);
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
- let normalizedSeed;
39
- if (typeof seed === "string") {
40
- normalizedSeed = seed.split("").map((char) => char.charCodeAt(0));
77
+ const normalizedSeed = seed.toString();
78
+ if (createFaker.cache[normalizedSeed]) {
79
+ return createFaker.cache[normalizedSeed];
41
80
  } else {
42
- normalizedSeed = seed;
43
- }
44
- const cacheKey = JSON.stringify(normalizedSeed);
45
- if (createFaker.cache[cacheKey]) {
46
- return createFaker.cache[cacheKey];
81
+ const faker = new Faker(normalizedSeed);
82
+ return createFaker.cache[normalizedSeed] = faker;
47
83
  }
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 boolean = (config = {}) => {
57
151
  const faker = createFaker(config.seed);
58
- return faker.datatype.boolean();
152
+ return faker.boolean();
59
153
  };
60
154
 
61
155
  const generateTags = (config) => {
62
156
  var _a, _b;
63
157
  const faker = createFaker(config.seed);
64
- return Array(faker.datatype.number({
65
- min: (_a = config.min) != null ? _a : 0,
66
- max: (_b = config.max) != null ? _b : 2
67
- })).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))));
68
159
  };
69
160
 
70
161
  const valueForModel = (config) => {
@@ -281,8 +372,8 @@ const contentRelationship$1 = (config = {}) => {
281
372
  return {
282
373
  type: prismicT__namespace.CustomTypeModelFieldType.Link,
283
374
  config: {
284
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
285
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
375
+ label: changeCase__namespace.capitalCase(faker.word()),
376
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
286
377
  select: prismicT__namespace.CustomTypeModelLinkSelectType.Document,
287
378
  customtypes: config.customTypeIDs,
288
379
  tags: config.tags
@@ -293,7 +384,7 @@ const contentRelationship$1 = (config = {}) => {
293
384
  const customType$1 = (config = {}) => {
294
385
  var _a, _b;
295
386
  const faker = createFaker(config.seed);
296
- let label = config.label || changeCase__namespace.capitalCase(faker.company.bsNoun());
387
+ let label = config.label || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
297
388
  let id = config.id || changeCase__namespace.snakeCase(label);
298
389
  if (config.id && !config.label) {
299
390
  label = changeCase__namespace.capitalCase(config.id);
@@ -309,8 +400,8 @@ const customType$1 = (config = {}) => {
309
400
  return {
310
401
  id,
311
402
  label,
312
- status: (_a = config.status) != null ? _a : faker.datatype.boolean(),
313
- repeatable: (_b = config.repeatable) != null ? _b : faker.datatype.boolean(),
403
+ status: (_a = config.status) != null ? _a : faker.boolean(),
404
+ repeatable: (_b = config.repeatable) != null ? _b : faker.boolean(),
314
405
  json
315
406
  };
316
407
  };
@@ -320,7 +411,7 @@ const group$1 = (config = {}) => {
320
411
  return {
321
412
  type: prismicT__namespace.CustomTypeModelFieldType.Group,
322
413
  config: {
323
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
414
+ label: changeCase__namespace.capitalCase(faker.word()),
324
415
  fields: config.fields || {}
325
416
  }
326
417
  };
@@ -331,17 +422,17 @@ const image$2 = (config = {}) => {
331
422
  const thumbnails = (config.thumbnailNames || []).map((name) => {
332
423
  return {
333
424
  name,
334
- width: faker.datatype.number({ min: 500, max: 2e3 }),
335
- height: faker.datatype.number({ min: 500, max: 2e3 })
425
+ width: faker.range(500, 2e3),
426
+ height: faker.range(500, 2e3)
336
427
  };
337
428
  });
338
429
  return {
339
430
  type: prismicT__namespace.CustomTypeModelFieldType.Image,
340
431
  config: {
341
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
432
+ label: changeCase__namespace.capitalCase(faker.word()),
342
433
  constraint: {
343
- width: config.withConstraint ? faker.datatype.number({ min: 500, max: 2e3 }) : null,
344
- 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
345
436
  },
346
437
  thumbnails
347
438
  }
@@ -353,10 +444,10 @@ const link$1 = (config = {}) => {
353
444
  return {
354
445
  type: prismicT__namespace.CustomTypeModelFieldType.Link,
355
446
  config: {
356
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
357
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
447
+ label: changeCase__namespace.capitalCase(faker.word()),
448
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
358
449
  select: null,
359
- allowTargetBlank: ("allowTargetBlank" in config ? config.allowTargetBlank : faker.datatype.boolean()) || void 0
450
+ allowTargetBlank: ("allowTargetBlank" in config ? config.allowTargetBlank : faker.boolean()) || void 0
360
451
  }
361
452
  };
362
453
  };
@@ -364,7 +455,7 @@ const link$1 = (config = {}) => {
364
455
  const richText$1 = (config = {}) => {
365
456
  var _a;
366
457
  const faker = createFaker(config.seed);
367
- const blockTypes = faker.random.arrayElements([
458
+ const blockTypes = faker.randomElements([
368
459
  prismicT__namespace.RichTextNodeType.heading1,
369
460
  prismicT__namespace.RichTextNodeType.heading2,
370
461
  prismicT__namespace.RichTextNodeType.heading3,
@@ -381,13 +472,13 @@ const richText$1 = (config = {}) => {
381
472
  prismicT__namespace.RichTextNodeType.embed,
382
473
  prismicT__namespace.RichTextNodeType.hyperlink
383
474
  ]).join(",");
384
- 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 };
385
476
  return {
386
477
  type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
387
478
  config: {
388
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
389
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
390
- 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,
391
482
  ...blockTypeConfig
392
483
  }
393
484
  };
@@ -398,8 +489,8 @@ const select$1 = (config = {}) => {
398
489
  return {
399
490
  type: prismicT__namespace.CustomTypeModelFieldType.Select,
400
491
  config: {
401
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
402
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
492
+ label: changeCase__namespace.capitalCase(faker.word()),
493
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
403
494
  options: config.options || [],
404
495
  default_value: config.defaultValue || void 0
405
496
  }
@@ -408,7 +499,7 @@ const select$1 = (config = {}) => {
408
499
 
409
500
  const sharedSlice$1 = (config = {}) => {
410
501
  const faker = createFaker(config.seed);
411
- let name = config.name || changeCase__namespace.capitalCase(faker.company.bsNoun());
502
+ let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
412
503
  let id = config.id || changeCase__namespace.snakeCase(name);
413
504
  if (config.id && !config.name) {
414
505
  name = changeCase__namespace.pascalCase(config.id);
@@ -419,14 +510,14 @@ const sharedSlice$1 = (config = {}) => {
419
510
  type: prismicT__namespace.CustomTypeModelSliceType.SharedSlice,
420
511
  id,
421
512
  name,
422
- description: faker.lorem.sentence(),
513
+ description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
423
514
  variations: config.variations || []
424
515
  };
425
516
  };
426
517
 
427
518
  const sharedSliceVariation$1 = (config = {}) => {
428
519
  const faker = createFaker(config.seed);
429
- let name = config.name || changeCase__namespace.capitalCase(faker.company.bsNoun());
520
+ let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
430
521
  let id = config.id || changeCase__namespace.snakeCase(name);
431
522
  if (config.id && !config.name) {
432
523
  name = changeCase__namespace.pascalCase(config.id);
@@ -436,9 +527,9 @@ const sharedSliceVariation$1 = (config = {}) => {
436
527
  return {
437
528
  id,
438
529
  name,
439
- description: faker.lorem.sentence(),
440
- docURL: faker.internet.url(),
441
- version: faker.git.shortSha(),
530
+ description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
531
+ docURL: faker.url(),
532
+ version: faker.hash(7),
442
533
  primary: config.primaryFields || {},
443
534
  items: config.itemsFields || {}
444
535
  };
@@ -448,10 +539,10 @@ const slice$1 = (config = {}) => {
448
539
  const faker = createFaker(config.seed);
449
540
  return {
450
541
  type: prismicT__namespace.CustomTypeModelSliceType.Slice,
451
- icon: changeCase__namespace.snakeCase(faker.company.bsNoun()),
452
- display: faker.datatype.boolean() ? prismicT__namespace.CustomTypeModelSliceDisplay.Grid : prismicT__namespace.CustomTypeModelSliceDisplay.List,
453
- fieldset: changeCase__namespace.capitalCase(faker.lorem.words()),
454
- description: faker.lorem.sentence(),
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))),
455
546
  repeat: config.repeatFields || {},
456
547
  "non-repeat": config.nonRepeatFields || {}
457
548
  };
@@ -477,7 +568,7 @@ const sliceZone$1 = (config = {}) => {
477
568
 
478
569
  const title$1 = (config = {}) => {
479
570
  const faker = createFaker(config.seed);
480
- const single = faker.random.arrayElements([
571
+ const single = faker.randomElements([
481
572
  "heading1",
482
573
  "heading2",
483
574
  "heading3",
@@ -488,24 +579,38 @@ const title$1 = (config = {}) => {
488
579
  return {
489
580
  type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
490
581
  config: {
491
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
492
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
582
+ label: changeCase__namespace.capitalCase(faker.word()),
583
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
493
584
  single,
494
- allowTargetBlank: faker.datatype.boolean() ? true : void 0
585
+ allowTargetBlank: faker.boolean() || void 0
495
586
  }
496
587
  };
497
588
  };
498
589
 
499
590
  const generateFieldId = (config) => {
500
591
  const faker = createFaker(config.seed);
501
- return changeCase__namespace.snakeCase(faker.lorem.words(faker.datatype.number({ min: 1, max: 3 })));
592
+ return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
502
593
  };
503
594
 
504
595
  const timestamp = (config = {}) => {
505
596
  const faker = createFaker(config.seed);
506
- const after = config.after || faker.date.past(20, new Date("2021-03-07")).toISOString().split("T")[0];
507
- const before = config.before || faker.date.future(20, new Date("2021-03-07")).toISOString().split("T")[0];
508
- return config.state === "empty" ? null : faker.date.between(after, before).toISOString();
597
+ if (config.state === "empty") {
598
+ return null;
599
+ } else {
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();
613
+ }
509
614
  };
510
615
 
511
616
  const buildAlternativeLanguage = (config) => {
@@ -536,11 +641,11 @@ const customType = (config = {}) => {
536
641
  }));
537
642
  return {
538
643
  type: model.id,
539
- id: faker.git.shortSha(),
540
- uid: hasUID ? changeCase__namespace.snakeCase(faker.lorem.words(2)) : null,
541
- url: withURL ? faker.internet.url() : null,
542
- href: faker.internet.url(),
543
- 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(),
544
649
  tags: generateTags({ seed: config.seed }),
545
650
  slugs: [],
546
651
  linked_documents: [],
@@ -557,7 +662,7 @@ const customType = (config = {}) => {
557
662
 
558
663
  const color = (config = {}) => {
559
664
  const faker = createFaker(config.seed);
560
- return config.state === "empty" ? null : faker.internet.color().toUpperCase();
665
+ return config.state === "empty" ? null : faker.hexColor().toUpperCase();
561
666
  };
562
667
 
563
668
  const buildContentRelationshipField = (config) => {
@@ -576,7 +681,7 @@ const buildContentRelationshipField = (config) => {
576
681
 
577
682
  const generateCustomTypeId = (config) => {
578
683
  const faker = createFaker(config.seed);
579
- return changeCase__namespace.snakeCase(faker.company.bsNoun());
684
+ return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
580
685
  };
581
686
 
582
687
  const contentRelationship = (config = {}) => {
@@ -599,11 +704,11 @@ const contentRelationship = (config = {}) => {
599
704
  }) : [
600
705
  {
601
706
  ...customType({ seed: config.seed }),
602
- type: model.config.customtypes ? faker.random.arrayElement(model.config.customtypes) : generateCustomTypeId({ seed: config.seed }),
603
- 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 })
604
709
  }
605
710
  ];
606
- const document = faker.random.arrayElement(linkableDocuments);
711
+ const document = faker.randomElement(linkableDocuments);
607
712
  if (!document) {
608
713
  throw new Error("A linkable document could not be found.");
609
714
  }
@@ -623,118 +728,134 @@ const date = (config = {}) => {
623
728
  };
624
729
 
625
730
  const buildEmbedField = (config) => {
731
+ var _a;
626
732
  const faker = createFaker(config.seed);
627
733
  return {
628
- type: faker.datatype.boolean() ? prismicT__namespace.EmbedType.Link : prismicT__namespace.EmbedType.Rich,
629
- url: config.embedData.url,
630
- html: config.embedData.html,
631
- title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
632
- version: faker.datatype.number({ min: 1, max: 3, precision: 10 }).toString(),
633
- cache_age: faker.datatype.number(),
634
- embed_url: config.embedData.embed_url,
635
- author_url: faker.internet.url(),
636
- author_name: faker.company.companyName(),
637
- provider_name: faker.company.companyName(),
638
- thumbnail_width: config.embedData.thumbnail_width,
639
- thumbnail_height: config.embedData.thumbnail_height,
640
- thumbnail_url: config.embedData.thumbnail_url,
641
- width: faker.datatype.number({ min: 200, max: 500 }),
642
- 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
643
737
  };
644
738
  };
645
739
 
646
740
  const dataSet$1 = [
647
741
  {
648
- url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
742
+ version: "1.0",
743
+ type: "video",
649
744
  embed_url: "https://www.youtube.com/embed/fiOwHYFkUz0",
650
745
  thumbnail_url: "https://i.ytimg.com/vi/fiOwHYFkUz0/hqdefault.jpg",
651
746
  thumbnail_height: 360,
652
747
  thumbnail_width: 480,
653
- 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
654
751
  },
655
752
  {
656
- url: "https://www.youtube.com/watch?v=c-ATzcy6VkI",
753
+ version: "1.0",
754
+ type: "video",
657
755
  embed_url: "https://www.youtube.com/embed/c-ATzcy6VkI",
658
756
  thumbnail_url: "https://i.ytimg.com/vi/c-ATzcy6VkI/hqdefault.jpg",
659
757
  thumbnail_height: 360,
660
758
  thumbnail_width: 480,
661
- 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
662
762
  },
663
763
  {
664
- url: "https://www.youtube.com/watch?v=iewZXv94XGY",
764
+ version: "1.0",
765
+ type: "video",
665
766
  embed_url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
666
767
  thumbnail_url: "https://i.ytimg.com/vi/iewZXv94XGY/hqdefault.jpg",
667
768
  thumbnail_height: 360,
668
769
  thumbnail_width: 480,
669
- 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
670
773
  },
671
774
  {
672
- url: "https://twitter.com/prismicio/status/1356293316158095361",
673
- 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",
674
778
  thumbnail_url: null,
675
779
  thumbnail_height: null,
676
780
  thumbnail_width: null,
677
- 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
678
784
  },
679
785
  {
680
- url: "https://twitter.com/timbenniks/status/1304146886832594944",
786
+ type: "rich",
787
+ version: "1.0",
788
+ embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
681
789
  thumbnail_url: null,
682
790
  thumbnail_width: null,
683
791
  thumbnail_height: null,
684
- embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
685
- 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
686
795
  },
687
796
  {
688
- url: "https://twitter.com/prismicio/status/1354112310252630016",
797
+ version: "1.0",
798
+ type: "rich",
799
+ embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
689
800
  thumbnail_url: null,
690
801
  thumbnail_width: null,
691
802
  thumbnail_height: null,
692
- embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
693
- 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
694
806
  },
695
807
  {
696
- url: "https://twitter.com/prismicio/status/1354835716430319617",
808
+ version: "1.0",
809
+ type: "rich",
810
+ embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
697
811
  thumbnail_url: null,
698
812
  thumbnail_width: null,
699
813
  thumbnail_height: null,
700
- embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
701
- 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
702
817
  }
703
818
  ];
704
819
  const getMockEmbedData = (config) => {
705
820
  const faker = createFaker(config.seed);
706
- return faker.random.arrayElement(dataSet$1);
821
+ return faker.randomElement(dataSet$1);
707
822
  };
708
823
 
709
824
  const embed$1 = (config = {}) => {
710
- const embedData = getMockEmbedData({ seed: config.seed });
711
- return config.state === "empty" ? {} : 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
+ });
712
833
  };
713
834
 
714
835
  const geoPoint = (config = {}) => {
715
836
  const faker = createFaker(config.seed);
716
- const coordinates = faker.address.nearbyGPSCoordinate();
717
837
  return config.state === "empty" ? {} : {
718
- longitude: Number.parseFloat(coordinates[0]),
719
- latitude: Number.parseFloat(coordinates[1])
838
+ longitude: faker.rangeFloat(-180, 180),
839
+ latitude: faker.rangeFloat(-90, 90)
720
840
  };
721
841
  };
722
842
 
723
843
  const group = (config = {}) => {
724
844
  var _a;
725
- const faker = createFaker(config.seed);
726
- const model = config.model || group$1({ seed: config.seed });
727
- const itemsCount = (_a = config.itemsCount) != null ? _a : faker.datatype.number({
728
- min: 1,
729
- max: 6
730
- });
731
- return Array(itemsCount).fill(void 0).map(() => {
732
- return valueForModelMap({
733
- seed: config.seed,
734
- map: model.config.fields,
735
- configs: config.configs
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
+ });
736
857
  });
737
- });
858
+ }
738
859
  };
739
860
 
740
861
  const buildImageFieldImage = (config) => {
@@ -759,8 +880,8 @@ const buildImageFieldImage = (config) => {
759
880
  return {
760
881
  url: url.toString(),
761
882
  dimensions,
762
- alt: faker.lorem.sentence(),
763
- copyright: faker.lorem.sentence()
883
+ alt: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
884
+ copyright: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15)))
764
885
  };
765
886
  }
766
887
  };
@@ -849,7 +970,7 @@ const dataSet = [
849
970
  ];
850
971
  const getMockImageData = (config) => {
851
972
  const faker = createFaker(config.seed);
852
- return faker.random.arrayElement(dataSet);
973
+ return faker.randomElement(dataSet);
853
974
  };
854
975
 
855
976
  const image$1 = (config = {}) => {
@@ -879,18 +1000,18 @@ const integrationFields = (config = {}) => {
879
1000
  const faker = createFaker(config.seed);
880
1001
  const imageData = getMockImageData({ seed: config.seed });
881
1002
  return config.state === "empty" ? null : {
882
- id: faker.git.shortSha(),
883
- title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
884
- description: faker.lorem.sentence(),
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))),
885
1006
  image_url: imageData.url,
886
- last_update: faker.date.past(20, new Date("2021-03-07")).getTime(),
1007
+ last_update: faker.date().getTime(),
887
1008
  blob: config.data
888
1009
  };
889
1010
  };
890
1011
 
891
1012
  const keyText = (config = {}) => {
892
1013
  const faker = createFaker(config.seed);
893
- return config.state === "empty" ? null : changeCase__namespace.sentenceCase(faker.lorem.words(3));
1014
+ return config.state === "empty" ? null : changeCase__namespace.sentenceCase(faker.words(3));
894
1015
  };
895
1016
 
896
1017
  const linkToMedia = (config = {}) => {
@@ -902,12 +1023,12 @@ const linkToMedia = (config = {}) => {
902
1023
  } else {
903
1024
  return {
904
1025
  link_type: prismicT__namespace.LinkType.Media,
905
- name: faker.system.commonFileName(),
906
- kind: faker.system.commonFileType(),
907
- url: faker.internet.url(),
908
- size: faker.datatype.number().toString(),
909
- height: faker.datatype.number().toString(),
910
- width: faker.datatype.number().toString()
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()
911
1032
  };
912
1033
  }
913
1034
  };
@@ -915,7 +1036,7 @@ const linkToMedia = (config = {}) => {
915
1036
  const link = (config = {}) => {
916
1037
  var _a;
917
1038
  const faker = createFaker(config.seed);
918
- const type = config.type || faker.random.arrayElement([
1039
+ const type = config.type || faker.randomElement([
919
1040
  prismicT__namespace.LinkType.Web,
920
1041
  prismicT__namespace.LinkType.Document,
921
1042
  prismicT__namespace.LinkType.Media
@@ -944,8 +1065,8 @@ const link = (config = {}) => {
944
1065
  const model = config.model || link$1({ seed: config.seed });
945
1066
  return {
946
1067
  link_type: prismicT__namespace.LinkType.Web,
947
- url: faker.internet.url(),
948
- target: ((_a = config.withTargetBlank) != null ? _a : 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
949
1070
  };
950
1071
  }
951
1072
  }
@@ -954,7 +1075,7 @@ const link = (config = {}) => {
954
1075
 
955
1076
  const number = (config = {}) => {
956
1077
  const faker = createFaker(config.seed);
957
- return config.state === "empty" ? null : faker.datatype.number();
1078
+ return config.state === "empty" ? null : faker.range(1, 100);
958
1079
  };
959
1080
 
960
1081
  const patterns$5 = {
@@ -982,16 +1103,13 @@ const heading = (config = {}) => {
982
1103
  prismicT__namespace.RichTextNodeType.heading5,
983
1104
  prismicT__namespace.RichTextNodeType.heading6
984
1105
  ].includes(type2));
985
- const type = faker.random.arrayElement(types);
1106
+ const type = faker.randomElement(types);
986
1107
  if (type) {
987
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$5));
1108
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$5));
988
1109
  const pattern = patterns$5[patternKey];
989
1110
  return {
990
1111
  type,
991
- text: changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({
992
- min: pattern.minWords,
993
- max: pattern.maxWords
994
- }))),
1112
+ text: changeCase__namespace.capitalCase(faker.words(faker.range(pattern.minWords, pattern.maxWords))),
995
1113
  spans: []
996
1114
  };
997
1115
  } else {
@@ -1012,11 +1130,12 @@ const patterns$4 = {
1012
1130
  };
1013
1131
  const paragraph = (config = {}) => {
1014
1132
  const faker = createFaker(config.seed);
1015
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$4));
1133
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$4));
1016
1134
  const pattern = patterns$4[patternKey];
1135
+ const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
1017
1136
  return {
1018
1137
  type: prismicT__namespace.RichTextNodeType.paragraph,
1019
- text: faker.lorem.paragraph(pattern.sentenceCount),
1138
+ text,
1020
1139
  spans: []
1021
1140
  };
1022
1141
  };
@@ -1034,11 +1153,12 @@ const patterns$3 = {
1034
1153
  };
1035
1154
  const preformatted = (config = {}) => {
1036
1155
  const faker = createFaker(config.seed);
1037
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$3));
1156
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$3));
1038
1157
  const pattern = patterns$3[patternKey];
1158
+ const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
1039
1159
  return {
1040
1160
  type: prismicT__namespace.RichTextNodeType.preformatted,
1041
- text: faker.lorem.paragraph(pattern.sentenceCount),
1161
+ text,
1042
1162
  spans: []
1043
1163
  };
1044
1164
  };
@@ -1059,16 +1179,13 @@ const patterns$2 = {
1059
1179
  };
1060
1180
  const list = (config = {}) => {
1061
1181
  const faker = createFaker(config.seed);
1062
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$2));
1182
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$2));
1063
1183
  const pattern = patterns$2[patternKey];
1064
- const itemsCount = faker.datatype.number({
1065
- min: pattern.minItems,
1066
- max: pattern.maxItems
1067
- });
1184
+ const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
1068
1185
  return Array(itemsCount).fill(void 0).map(() => {
1069
1186
  return {
1070
1187
  type: prismicT__namespace.RichTextNodeType.listItem,
1071
- text: faker.lorem.sentence(),
1188
+ text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
1072
1189
  spans: []
1073
1190
  };
1074
1191
  });
@@ -1090,16 +1207,13 @@ const patterns$1 = {
1090
1207
  };
1091
1208
  const oList = (config = {}) => {
1092
1209
  const faker = createFaker(config.seed);
1093
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$1));
1210
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$1));
1094
1211
  const pattern = patterns$1[patternKey];
1095
- const itemsCount = faker.datatype.number({
1096
- min: pattern.minItems,
1097
- max: pattern.maxItems
1098
- });
1212
+ const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
1099
1213
  return Array(itemsCount).fill(void 0).map(() => {
1100
1214
  return {
1101
1215
  type: prismicT__namespace.RichTextNodeType.oListItem,
1102
- text: faker.lorem.sentence(),
1216
+ text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
1103
1217
  spans: []
1104
1218
  };
1105
1219
  });
@@ -1110,7 +1224,7 @@ const image = (config = {}) => {
1110
1224
  const imageField = buildImageFieldImage({
1111
1225
  seed: config.seed,
1112
1226
  imageData,
1113
- state: false
1227
+ state: "filled"
1114
1228
  });
1115
1229
  return {
1116
1230
  type: prismicT__namespace.RichTextNodeType.image,
@@ -1122,8 +1236,8 @@ const image = (config = {}) => {
1122
1236
  };
1123
1237
 
1124
1238
  const embed = (config = {}) => {
1125
- const embedData = getMockEmbedData({ seed: config.seed });
1126
- const embedField = buildEmbedField({ seed: config.seed, embedData });
1239
+ const data = getMockEmbedData({ seed: config.seed });
1240
+ const embedField = buildEmbedField({ seed: config.seed, data });
1127
1241
  return {
1128
1242
  type: prismicT__namespace.RichTextNodeType.embed,
1129
1243
  oembed: embedField
@@ -1167,14 +1281,11 @@ const richText = (config = {}) => {
1167
1281
  const supportsMultipleBlocks = "multi" in model.config;
1168
1282
  const types = ("multi" in model.config ? model.config.multi : model.config.single).split(",").filter((type) => Object.keys(generators).includes(type));
1169
1283
  if (types.length > 0) {
1170
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns));
1284
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
1171
1285
  const pattern = patterns[patternKey];
1172
- const blockCount = supportsMultipleBlocks ? faker.datatype.number({
1173
- min: pattern.blockCountMin,
1174
- max: pattern.blockCountMax
1175
- }) : 1;
1286
+ const blockCount = supportsMultipleBlocks ? faker.range(pattern.blockCountMin, pattern.blockCountMax) : 1;
1176
1287
  return Array(blockCount).fill(void 0).map(() => {
1177
- const type = faker.random.arrayElement(types);
1288
+ const type = faker.randomElement(types);
1178
1289
  const generator = generators[type];
1179
1290
  return generator({ seed: config.seed, model });
1180
1291
  }).flat().filter((block) => block !== void 0).slice(0, blockCount);
@@ -1190,7 +1301,7 @@ const select = (config = {}) => {
1190
1301
  if (config.state === "empty") {
1191
1302
  return null;
1192
1303
  } else {
1193
- return typeof defaultValue === "string" && faker.datatype.boolean() ? defaultValue : faker.random.arrayElement(model.config.options);
1304
+ return typeof defaultValue === "string" && faker.boolean() ? defaultValue : faker.randomElement(model.config.options);
1194
1305
  }
1195
1306
  };
1196
1307
 
@@ -1199,11 +1310,8 @@ const slice = (config = {}) => {
1199
1310
  const faker = createFaker(config.seed);
1200
1311
  const model = config.model || slice$1({ seed: config.seed });
1201
1312
  const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
1202
- const sliceLabel = config.label !== void 0 ? config.label : changeCase__namespace.capitalCase(faker.company.bsNoun());
1203
- const itemsCount = Object.keys(model.repeat).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.datatype.number({
1204
- min: 1,
1205
- max: 6
1206
- }) : 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;
1207
1315
  return {
1208
1316
  slice_type: sliceType,
1209
1317
  slice_label: sliceLabel,
@@ -1227,15 +1335,12 @@ const sharedSliceVariation = (config = {}) => {
1227
1335
  const faker = createFaker(config.seed);
1228
1336
  const model = config.model || sharedSliceVariation$1({ seed: config.seed });
1229
1337
  const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
1230
- const itemsCount = Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.datatype.number({
1231
- min: 1,
1232
- max: 6
1233
- }) : 0;
1338
+ const itemsCount = Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
1234
1339
  return {
1235
1340
  slice_type: sliceType,
1236
1341
  slice_label: null,
1237
1342
  variation: model.id,
1238
- version: faker.git.shortSha(),
1343
+ version: faker.hash(7),
1239
1344
  primary: valueForModelMap({
1240
1345
  seed: config.seed,
1241
1346
  map: model.primary,
@@ -1254,7 +1359,7 @@ const sharedSliceVariation = (config = {}) => {
1254
1359
  const sharedSlice = (config = {}) => {
1255
1360
  const faker = createFaker(config.seed);
1256
1361
  const model = config.model || sharedSlice$1({ seed: config.seed });
1257
- const variationModel = faker.random.arrayElement(model.variations);
1362
+ const variationModel = faker.randomElement(model.variations);
1258
1363
  return sharedSliceVariation({
1259
1364
  seed: config.seed,
1260
1365
  model: variationModel,
@@ -1267,61 +1372,66 @@ const sharedSlice = (config = {}) => {
1267
1372
 
1268
1373
  const sliceZone = (config = {}) => {
1269
1374
  var _a;
1270
- const faker = createFaker(config.seed);
1271
- const model = config.model || sliceZone$1({ seed: config.seed });
1272
- if (Object.keys(model.config.choices).length > 0) {
1273
- const itemsCount = (_a = config.itemsCount) != null ? _a : faker.datatype.number({
1274
- min: 1,
1275
- max: 6
1276
- });
1277
- return Array(itemsCount).fill(void 0).map(() => {
1278
- var _a2;
1279
- const choices = Object.entries(model.config.choices);
1280
- const [choiceType, choiceModel] = faker.random.arrayElement(choices);
1281
- const choiceLabels = model.config.labels[choiceType] || [];
1282
- const choiceLabel = faker.random.arrayElement(choiceLabels);
1283
- switch (choiceModel.type) {
1284
- case prismicT__namespace.CustomTypeModelSliceType.Slice: {
1285
- return slice({
1286
- seed: config.seed,
1287
- model: choiceModel,
1288
- type: choiceType,
1289
- label: choiceLabel ? choiceLabel.name : null,
1290
- primaryFieldConfigs: config.primaryFieldConfigs,
1291
- itemsFieldConfigs: config.itemsFieldConfigs
1292
- });
1293
- }
1294
- case prismicT__namespace.CustomTypeModelSliceType.SharedSlice: {
1295
- const sharedSliceModel = (_a2 = config.sharedSliceModels) == null ? void 0 : _a2.find((sharedSliceModel2) => sharedSliceModel2.id === choiceType);
1296
- if (sharedSliceModel) {
1297
- return sharedSlice({
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({
1298
1391
  seed: config.seed,
1299
- model: sharedSliceModel,
1392
+ model: choiceModel,
1393
+ type: choiceType,
1394
+ label: choiceLabel ? choiceLabel.name : null,
1300
1395
  primaryFieldConfigs: config.primaryFieldConfigs,
1301
1396
  itemsFieldConfigs: config.itemsFieldConfigs
1302
1397
  });
1303
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
+ }
1304
1410
  }
1305
- }
1306
- }).filter((slice2) => slice2 !== void 0);
1307
- } else {
1308
- return [];
1411
+ }).filter((slice2) => slice2 !== void 0);
1412
+ } else {
1413
+ return [];
1414
+ }
1309
1415
  }
1310
1416
  };
1311
1417
 
1312
1418
  const title = (config = {}) => {
1313
- return [
1314
- heading({
1315
- seed: config.seed,
1316
- model: config.model,
1317
- pattern: config.pattern
1318
- })
1319
- ];
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
+ }
1320
1430
  };
1321
1431
 
1322
1432
  const uid = (config = {}) => {
1323
1433
  const faker = createFaker(config.seed);
1324
- return changeCase__namespace.snakeCase(faker.lorem.words(2));
1434
+ return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
1325
1435
  };
1326
1436
 
1327
1437
  exports.boolean = boolean;