@prismicio/mock 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) 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 +311 -213
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +9 -5
  9. package/dist/index.js +310 -211
  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 +1 -1
  14. package/dist/model/index.js +168 -74
  15. package/dist/model/index.js.map +1 -1
  16. package/dist/value/index.cjs +280 -182
  17. package/dist/value/index.cjs.map +1 -1
  18. package/dist/value/index.d.ts +8 -4
  19. package/dist/value/index.js +280 -182
  20. package/dist/value/index.js.map +1 -1
  21. package/package.json +19 -16
  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 +2 -2
  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 +7 -10
  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 +1 -6
  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 +4 -10
  83. package/src/value/timestamp.ts +28 -15
  84. package/src/value/uid.ts +1 -1
@@ -3,8 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const changeCase = require('change-case');
6
- const fakerLocaleEN = require('faker/lib/locales/en/index.js');
7
- const Faker = require('faker/lib/index.js');
6
+ const Rand = require('rand-seed');
8
7
  const prismicT = require('@prismicio/types');
9
8
 
10
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -28,43 +27,135 @@ function _interopNamespace(e) {
28
27
  }
29
28
 
30
29
  const changeCase__namespace = /*#__PURE__*/_interopNamespace(changeCase);
31
- const fakerLocaleEN__namespace = /*#__PURE__*/_interopNamespace(fakerLocaleEN);
32
- const Faker__default = /*#__PURE__*/_interopDefaultLegacy(Faker);
30
+ const Rand__default = /*#__PURE__*/_interopDefaultLegacy(Rand);
33
31
  const prismicT__namespace = /*#__PURE__*/_interopNamespace(prismicT);
34
32
 
35
33
  const FAKER_SEED = 1984;
36
34
 
35
+ const wordsString = "lorem ipsum dolor sit amet, consectetur adipiscing elit ut aliquam, purus sit amet luctus venenatis, lectus magna fringilla urna, porttitor rhoncus dolor purus non enim praesent elementum facilisis leo, vel fringilla est ullamcorper eget nulla facilisi etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus in ornare quam viverra orci sagittis eu volutpat odio facilisis mauris sit amet massa vitae tortor condimentum lacinia quis vel eros donec ac odio tempor orci dapibus ultrices in iaculis nunc sed augue lacus, viverra vitae congue eu, consequat ac felis donec et odio pellentesque diam volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed velit dignissim sodales ut eu sem integer vitae justo eget magna fermentum iaculis eu non diam phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet enim tortor, at auctor urna nunc id cursus metus aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices sagittis orci, a scelerisque purus semper eget duis at tellus at urna condimentum mattis pellentesque id nibh tortor, id aliquet lectus proin nibh nisl, condimentum id venenatis a, condimentum vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas sed tempus, urna et pharetra pharetra, massa massa ultricies mi, quis hendrerit dolor magna eget est lorem ipsum dolor sit amet, consectetur adipiscing elit pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas integer eget aliquet nibh praesent tristique magna sit amet purus gravida quis blandit turpis cursus in hac habitasse platea dictumst quisque sagittis, purus sit amet volutpat consequat, mauris nunc congue nisi, vitae suscipit tellus mauris a diam maecenas sed enim ut sem viverra aliquet eget sit amet tellus cras adipiscing enim eu turpis egestas pretium aenean pharetra, magna ac placerat vestibulum, lectus mauris ultrices eros, in cursus turpis massa tincidunt dui ut ornare lectus sit amet est placerat in egestas erat imperdiet sed euismod nisi porta lorem mollis aliquam ut porttitor leo a diam sollicitudin tempor id eu nisl nunc mi ipsum, faucibus vitae aliquet nec, ullamcorper sit amet risus nullam eget felis eget nunc lobortis mattis aliquam faucibus purus in massa tempor nec feugiat nisl pretium fusce id velit ut tortor pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare suspendisse sed nisi lacus, sed viverra tellus in hac habitasse platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu dictum varius duis at consectetur lorem donec massa sapien, faucibus et molestie ac, feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra accumsan in nisl nisi, scelerisque eu ultrices vitae, auctor eu augue ut lectus arcu, bibendum at varius vel, pharetra vel turpis nunc eget lorem dolor, sed viverra ipsum nunc aliquet bibendum enim, facilisis gravida neque convallis a cras semper auctor neque, vitae tempus quam pellentesque nec nam aliquam sem et tortor consequat id porta nibh venenatis cras sed felis eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar elementum integer enim neque, volutpat ac tincidunt vitae, semper quis lectus nulla at volutpat diam ut venenatis tellus in metus vulputate eu scelerisque felis imperdiet proin fermentum leo vel orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero, id faucibus nisl tincidunt eget nullam non nisi est, sit amet facilisis magna etiam tempor, orci eu lobortis elementum, nibh tellus molestie nunc, non blandit massa enim nec dui nunc mattis enim ut tellus elementum sagittis vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum morbi blandit cursus risus, at ultrices mi tempus imperdiet nulla malesuada pellentesque elit eget gravida cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus mauris vitae ultricies leo integer malesuada nunc vel risus commodo viverra maecenas accumsan, lacus vel facilisis volutpat, est velit egestas dui, id ornare arcu odio ut sem nulla pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc, consequat interdum varius sit amet, mattis vulputate enim nulla aliquet porttitor lacus, luctus accumsan tortor posuere ac ut consequat semper viverra nam libero justo, laoreet sit amet cursus sit amet, dictum sit amet justo donec enim diam, vulputate ut pharetra sit amet, aliquam id diam maecenas ultricies mi eget mauris pharetra et ultrices neque ornare aenean euismod elementum nisi, quis eleifend quam adipiscing vitae proin sagittis, nisl rhoncus mattis rhoncus, urna neque viverra justo, nec ultrices dui sapien eget mi proin sed libero enim, sed faucibus turpis in eu mi bibendum neque egestas congue quisque egestas diam in arcu cursus euismod quis viverra nibh cras pulvinar mattis nunc, sed blandit libero volutpat sed cras ornare arcu dui vivamus arcu felis, bibendum ut tristique et, egestas quis ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim enim, sit amet venenatis urna cursus eget nunc scelerisque viverra mauris, in aliquam sem fringilla ut morbi tincidunt augue interdum velit euismod in pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id aliquet risus feugiat in ante metus, dictum at tempor commodo, ullamcorper a lacus vestibulum sed arcu non odio euismod lacinia at quis risus sed vulputate odio ut enim blandit volutpat maecenas volutpat blandit aliquam etiam erat velit, scelerisque in dictum non, consectetur a erat nam at lectus urna duis convallis convallis tellus, id interdum velit laoreet id donec ultrices tincidunt arcu, non sodales neque sodales ut etiam sit amet nisl purus, in mollis nunc sed id semper risus in hendrerit gravida rutrum quisque non tellus orci, ac auctor augue mauris augue neque, gravida in fermentum et, sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum, odio eu feugiat pretium, nibh ipsum consequat nisl, vel pretium lectus quam id leo in vitae turpis massa sed elementum tempus egestas sed sed risus pretium quam vulputate dignissim suspendisse in est ante in nibh mauris, cursus mattis molestie a, iaculis at erat pellentesque adipiscing commodo elit, at imperdiet dui accumsan sit amet nulla facilisi morbi tempus iaculis urna, id volutpat lacus laoreet non curabitur gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius morbi enim nunc, faucibus a pellentesque sit amet, porttitor eget dolor morbi non arcu risus, quis varius quam quisque id diam vel quam elementum pulvinar etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit amet, consectetur adipiscing elit duis tristique sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi leo urna, molestie at elementum eu, facilisis sed odio morbi quis commodo odio aenean sed adipiscing diam donec adipiscing tristique risus nec feugiat in fermentum posuere urna nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida hendrerit lectus a molestie";
36
+ const loremWords = wordsString.split(" ");
37
+ const lorem = (length, wordOffset = 0) => {
38
+ const count = parseInt(length.substring(0, length.length - 1));
39
+ const countType = length.charAt(length.length - 1);
40
+ if (!isNaN(count) && (countType === "w" || countType === "c")) {
41
+ if (!lorem.spaceIndices.length) {
42
+ let startIndex = -1;
43
+ do {
44
+ const index = wordsString.indexOf(" ", startIndex + 1);
45
+ lorem.spaceIndices.push(index);
46
+ startIndex = index;
47
+ } while (startIndex !== -1);
48
+ }
49
+ if (countType === "c") {
50
+ return wordsString.substring(0, count);
51
+ } else {
52
+ let sentence = "";
53
+ const startSpaceIndex = lorem.spaceIndices[wordOffset % lorem.spaceIndices.length - 1];
54
+ const endSpaceIndex = lorem.spaceIndices[(wordOffset % lorem.spaceIndices.length + count) % lorem.spaceIndices.length - 1];
55
+ if (count + wordOffset % lorem.spaceIndices.length > lorem.spaceIndices.length) {
56
+ sentence += wordsString.substring(startSpaceIndex + 1) + " ";
57
+ const wraparoundCounts = Math.floor(count / lorem.spaceIndices.length) - 1;
58
+ for (let i = 0; i < wraparoundCounts; i++) {
59
+ sentence += wordsString + " ";
60
+ }
61
+ sentence += wordsString.substring(0, endSpaceIndex);
62
+ } else {
63
+ sentence = wordsString.substring(startSpaceIndex + 1, endSpaceIndex);
64
+ }
65
+ if (sentence.charAt(sentence.length - 1) === ",") {
66
+ return sentence.substring(0, sentence.length - 1);
67
+ } else {
68
+ return sentence.substring(0, sentence.length);
69
+ }
70
+ }
71
+ }
72
+ throw new Error("Length must be of the form `${number}w` or `${number}c`");
73
+ };
74
+ lorem.spaceIndices = [];
75
+
37
76
  const createFaker = (seed = FAKER_SEED) => {
38
- 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 generateTags = (config) => {
57
151
  var _a, _b;
58
152
  const faker = createFaker(config.seed);
59
- return Array(faker.datatype.number({
60
- min: (_a = config.min) != null ? _a : 0,
61
- max: (_b = config.max) != null ? _b : 2
62
- })).fill(void 0).map(() => changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({ min: 1, max: 3 }))));
153
+ return Array.from({ length: faker.range((_a = config.min) != null ? _a : 0, (_b = config.max) != null ? _b : 2) }, () => changeCase__namespace.capitalCase(faker.words(faker.range(1, 3))));
63
154
  };
64
155
 
65
156
  const title = (config = {}) => {
66
157
  const faker = createFaker(config.seed);
67
- const single = faker.random.arrayElements([
158
+ const single = faker.randomElements([
68
159
  "heading1",
69
160
  "heading2",
70
161
  "heading3",
@@ -75,103 +166,127 @@ const title = (config = {}) => {
75
166
  return {
76
167
  type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
77
168
  config: {
78
- label: changeCase__namespace.capitalCase(faker.company.bsNoun()),
79
- placeholder: changeCase__namespace.sentenceCase(faker.lorem.words(3)),
169
+ label: changeCase__namespace.capitalCase(faker.word()),
170
+ placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
80
171
  single,
81
- allowTargetBlank: faker.datatype.boolean() ? true : void 0
172
+ allowTargetBlank: faker.boolean() || void 0
82
173
  }
83
174
  };
84
175
  };
85
176
 
86
177
  const timestamp = (config = {}) => {
87
178
  const faker = createFaker(config.seed);
88
- const after = config.after || faker.date.past(20, new Date("2021-03-07")).toISOString().split("T")[0];
89
- const before = config.before || faker.date.future(20, new Date("2021-03-07")).toISOString().split("T")[0];
90
- return config.state === "empty" ? null : faker.date.between(after, before).toISOString();
179
+ if (config.state === "empty") {
180
+ return null;
181
+ } else {
182
+ let date;
183
+ const after = config.after ? new Date(config.after.toISOString().split("T")[0]) : void 0;
184
+ const before = config.before ? new Date(config.before.toISOString().split("T")[0]) : void 0;
185
+ if (after && before) {
186
+ date = faker.dateBetween(after, before);
187
+ } else if (after) {
188
+ date = faker.dateAfter(after);
189
+ } else if (before) {
190
+ date = faker.dateBefore(before);
191
+ } else {
192
+ date = faker.date();
193
+ }
194
+ return date.toISOString();
195
+ }
91
196
  };
92
197
 
93
198
  const buildEmbedField = (config) => {
199
+ var _a;
94
200
  const faker = createFaker(config.seed);
95
201
  return {
96
- type: faker.datatype.boolean() ? prismicT__namespace.EmbedType.Link : prismicT__namespace.EmbedType.Rich,
97
- url: config.embedData.url,
98
- html: config.embedData.html,
99
- title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
100
- version: faker.datatype.number({ min: 1, max: 3, precision: 10 }).toString(),
101
- cache_age: faker.datatype.number(),
102
- embed_url: config.embedData.embed_url,
103
- author_url: faker.internet.url(),
104
- author_name: faker.company.companyName(),
105
- provider_name: faker.company.companyName(),
106
- thumbnail_width: config.embedData.thumbnail_width,
107
- thumbnail_height: config.embedData.thumbnail_height,
108
- thumbnail_url: config.embedData.thumbnail_url,
109
- width: faker.datatype.number({ min: 200, max: 500 }),
110
- height: faker.datatype.number({ min: 200, max: 500 })
202
+ embed_url: (_a = config.url) != null ? _a : faker.url(),
203
+ html: `<div>embed html</div>`,
204
+ ...config.data
111
205
  };
112
206
  };
113
207
 
114
208
  const dataSet$1 = [
115
209
  {
116
- url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
210
+ version: "1.0",
211
+ type: "video",
117
212
  embed_url: "https://www.youtube.com/embed/fiOwHYFkUz0",
118
213
  thumbnail_url: "https://i.ytimg.com/vi/fiOwHYFkUz0/hqdefault.jpg",
119
214
  thumbnail_height: 360,
120
215
  thumbnail_width: 480,
121
- 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>'
216
+ 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>',
217
+ width: 200,
218
+ height: 113
122
219
  },
123
220
  {
124
- url: "https://www.youtube.com/watch?v=c-ATzcy6VkI",
221
+ version: "1.0",
222
+ type: "video",
125
223
  embed_url: "https://www.youtube.com/embed/c-ATzcy6VkI",
126
224
  thumbnail_url: "https://i.ytimg.com/vi/c-ATzcy6VkI/hqdefault.jpg",
127
225
  thumbnail_height: 360,
128
226
  thumbnail_width: 480,
129
- 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>'
227
+ 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>',
228
+ width: 200,
229
+ height: 113
130
230
  },
131
231
  {
132
- url: "https://www.youtube.com/watch?v=iewZXv94XGY",
232
+ version: "1.0",
233
+ type: "video",
133
234
  embed_url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
134
235
  thumbnail_url: "https://i.ytimg.com/vi/iewZXv94XGY/hqdefault.jpg",
135
236
  thumbnail_height: 360,
136
237
  thumbnail_width: 480,
137
- 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>'
238
+ 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>',
239
+ width: 200,
240
+ height: 113
138
241
  },
139
242
  {
140
- url: "https://twitter.com/prismicio/status/1356293316158095361",
141
- embed_url: "https://www.youtube.com/watch?v=iewZXv94XGY",
243
+ version: "1.0",
244
+ type: "rich",
245
+ embed_url: "https://twitter.com/prismicio/status/1356293316158095361",
142
246
  thumbnail_url: null,
143
247
  thumbnail_height: null,
144
248
  thumbnail_width: null,
145
- 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'
249
+ 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',
250
+ width: 200,
251
+ height: 113
146
252
  },
147
253
  {
148
- url: "https://twitter.com/timbenniks/status/1304146886832594944",
254
+ type: "rich",
255
+ version: "1.0",
256
+ embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
149
257
  thumbnail_url: null,
150
258
  thumbnail_width: null,
151
259
  thumbnail_height: null,
152
- embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
153
- 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'
260
+ 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',
261
+ width: 200,
262
+ height: 113
154
263
  },
155
264
  {
156
- url: "https://twitter.com/prismicio/status/1354112310252630016",
265
+ version: "1.0",
266
+ type: "rich",
267
+ embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
157
268
  thumbnail_url: null,
158
269
  thumbnail_width: null,
159
270
  thumbnail_height: null,
160
- embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
161
- 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'
271
+ 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',
272
+ width: 200,
273
+ height: 113
162
274
  },
163
275
  {
164
- url: "https://twitter.com/prismicio/status/1354835716430319617",
276
+ version: "1.0",
277
+ type: "rich",
278
+ embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
165
279
  thumbnail_url: null,
166
280
  thumbnail_width: null,
167
281
  thumbnail_height: null,
168
- embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
169
- 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'
282
+ 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',
283
+ width: 200,
284
+ height: 113
170
285
  }
171
286
  ];
172
287
  const getMockEmbedData = (config) => {
173
288
  const faker = createFaker(config.seed);
174
- return faker.random.arrayElement(dataSet$1);
289
+ return faker.randomElement(dataSet$1);
175
290
  };
176
291
 
177
292
  const buildImageFieldImage = (config) => {
@@ -196,8 +311,8 @@ const buildImageFieldImage = (config) => {
196
311
  return {
197
312
  url: url.toString(),
198
313
  dimensions,
199
- alt: faker.lorem.sentence(),
200
- copyright: faker.lorem.sentence()
314
+ alt: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
315
+ copyright: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15)))
201
316
  };
202
317
  }
203
318
  };
@@ -286,7 +401,7 @@ const dataSet = [
286
401
  ];
287
402
  const getMockImageData = (config) => {
288
403
  const faker = createFaker(config.seed);
289
- return faker.random.arrayElement(dataSet);
404
+ return faker.randomElement(dataSet);
290
405
  };
291
406
 
292
407
  const patterns$4 = {
@@ -314,16 +429,13 @@ const heading = (config = {}) => {
314
429
  prismicT__namespace.RichTextNodeType.heading5,
315
430
  prismicT__namespace.RichTextNodeType.heading6
316
431
  ].includes(type2));
317
- const type = faker.random.arrayElement(types);
432
+ const type = faker.randomElement(types);
318
433
  if (type) {
319
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$4));
434
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$4));
320
435
  const pattern = patterns$4[patternKey];
321
436
  return {
322
437
  type,
323
- text: changeCase__namespace.capitalCase(faker.lorem.words(faker.datatype.number({
324
- min: pattern.minWords,
325
- max: pattern.maxWords
326
- }))),
438
+ text: changeCase__namespace.capitalCase(faker.words(faker.range(pattern.minWords, pattern.maxWords))),
327
439
  spans: []
328
440
  };
329
441
  } else {
@@ -344,11 +456,12 @@ const patterns$3 = {
344
456
  };
345
457
  const paragraph = (config = {}) => {
346
458
  const faker = createFaker(config.seed);
347
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$3));
459
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$3));
348
460
  const pattern = patterns$3[patternKey];
461
+ const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
349
462
  return {
350
463
  type: prismicT__namespace.RichTextNodeType.paragraph,
351
- text: faker.lorem.paragraph(pattern.sentenceCount),
464
+ text,
352
465
  spans: []
353
466
  };
354
467
  };
@@ -366,11 +479,12 @@ const patterns$2 = {
366
479
  };
367
480
  const preformatted = (config = {}) => {
368
481
  const faker = createFaker(config.seed);
369
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$2));
482
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$2));
370
483
  const pattern = patterns$2[patternKey];
484
+ const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
371
485
  return {
372
486
  type: prismicT__namespace.RichTextNodeType.preformatted,
373
- text: faker.lorem.paragraph(pattern.sentenceCount),
487
+ text,
374
488
  spans: []
375
489
  };
376
490
  };
@@ -391,16 +505,13 @@ const patterns$1 = {
391
505
  };
392
506
  const list = (config = {}) => {
393
507
  const faker = createFaker(config.seed);
394
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns$1));
508
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$1));
395
509
  const pattern = patterns$1[patternKey];
396
- const itemsCount = faker.datatype.number({
397
- min: pattern.minItems,
398
- max: pattern.maxItems
399
- });
510
+ const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
400
511
  return Array(itemsCount).fill(void 0).map(() => {
401
512
  return {
402
513
  type: prismicT__namespace.RichTextNodeType.listItem,
403
- text: faker.lorem.sentence(),
514
+ text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
404
515
  spans: []
405
516
  };
406
517
  });
@@ -422,16 +533,13 @@ const patterns = {
422
533
  };
423
534
  const oList = (config = {}) => {
424
535
  const faker = createFaker(config.seed);
425
- const patternKey = config.pattern || faker.random.arrayElement(Object.keys(patterns));
536
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
426
537
  const pattern = patterns[patternKey];
427
- const itemsCount = faker.datatype.number({
428
- min: pattern.minItems,
429
- max: pattern.maxItems
430
- });
538
+ const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
431
539
  return Array(itemsCount).fill(void 0).map(() => {
432
540
  return {
433
541
  type: prismicT__namespace.RichTextNodeType.oListItem,
434
- text: faker.lorem.sentence(),
542
+ text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
435
543
  spans: []
436
544
  };
437
545
  });
@@ -442,7 +550,7 @@ const image = (config = {}) => {
442
550
  const imageField = buildImageFieldImage({
443
551
  seed: config.seed,
444
552
  imageData,
445
- state: false
553
+ state: "filled"
446
554
  });
447
555
  return {
448
556
  type: prismicT__namespace.RichTextNodeType.image,
@@ -454,8 +562,8 @@ const image = (config = {}) => {
454
562
  };
455
563
 
456
564
  const embed = (config = {}) => {
457
- const embedData = getMockEmbedData({ seed: config.seed });
458
- const embedField = buildEmbedField({ seed: config.seed, embedData });
565
+ const data = getMockEmbedData({ seed: config.seed });
566
+ const embedField = buildEmbedField({ seed: config.seed, data });
459
567
  return {
460
568
  type: prismicT__namespace.RichTextNodeType.embed,
461
569
  oembed: embedField
@@ -481,10 +589,10 @@ const ref = (config = {}) => {
481
589
  var _a;
482
590
  const faker = createFaker(config.seed);
483
591
  const value = {
484
- id: faker.git.shortSha(),
485
- ref: faker.git.shortSha(),
592
+ id: faker.hash(16),
593
+ ref: faker.hash(16),
486
594
  isMasterRef: (_a = config.isMasterRef) != null ? _a : false,
487
- label: config.isMasterRef ? "Master" : changeCase__namespace.capitalCase(faker.company.bsNoun())
595
+ label: config.isMasterRef ? "Master" : changeCase__namespace.capitalCase(faker.words(faker.range(1, 3)))
488
596
  };
489
597
  if (config.isScheduled) {
490
598
  value.scheduledAt = timestamp({ seed: config.seed });
@@ -507,8 +615,8 @@ const repository = (config = {}) => {
507
615
  types,
508
616
  languages: [
509
617
  {
510
- id: faker.lorem.word(),
511
- name: changeCase__namespace.capitalCase(faker.lorem.word())
618
+ id: faker.word(),
619
+ name: changeCase__namespace.capitalCase(faker.word())
512
620
  }
513
621
  ],
514
622
  tags: generateTags({
@@ -518,11 +626,11 @@ const repository = (config = {}) => {
518
626
  }),
519
627
  forms: {},
520
628
  license: "All Rights Reserved",
521
- version: faker.git.shortSha(),
629
+ version: faker.hash(7),
522
630
  bookmarks: {},
523
631
  experiments: {},
524
- oauth_token: faker.internet.url(),
525
- oauth_initiate: faker.internet.url()
632
+ oauth_token: faker.url(),
633
+ oauth_initiate: faker.url()
526
634
  };
527
635
  };
528
636
 
@@ -536,8 +644,8 @@ const query = (config = {}) => {
536
644
  const results = documents.slice((page - 1) * pageSize, page * pageSize);
537
645
  return {
538
646
  page,
539
- next_page: page < totalPages ? faker.internet.url() : null,
540
- prev_page: page > 1 ? faker.internet.url() : null,
647
+ next_page: page < totalPages ? faker.url() : null,
648
+ prev_page: page > 1 ? faker.url() : null,
541
649
  total_pages: totalPages,
542
650
  results_size: results.length,
543
651
  results_per_page: pageSize,