@prismicio/mock 0.0.9 → 0.1.1

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 (96) hide show
  1. package/dist/api/index.cjs +153 -149
  2. package/dist/api/index.cjs.map +1 -1
  3. package/dist/api/index.d.ts +51 -5
  4. package/dist/api/index.js +153 -149
  5. package/dist/api/index.js.map +1 -1
  6. package/dist/index.cjs +609 -357
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.ts +240 -70
  9. package/dist/index.js +602 -358
  10. package/dist/index.js.map +1 -1
  11. package/dist/model/index.cjs +236 -66
  12. package/dist/model/index.cjs.map +1 -1
  13. package/dist/model/index.d.ts +113 -27
  14. package/dist/model/index.js +236 -66
  15. package/dist/model/index.js.map +1 -1
  16. package/dist/value/index.cjs +347 -315
  17. package/dist/value/index.cjs.map +1 -1
  18. package/dist/value/index.d.ts +90 -38
  19. package/dist/value/index.js +347 -315
  20. package/dist/value/index.js.map +1 -1
  21. package/package.json +14 -15
  22. package/src/api/createAPIMockFactory.ts +56 -0
  23. package/src/api/query.ts +2 -2
  24. package/src/api/ref.ts +3 -3
  25. package/src/api/repository.ts +7 -9
  26. package/src/api/tags.ts +5 -2
  27. package/src/createMockFactory.ts +52 -0
  28. package/src/index.ts +15 -0
  29. package/src/lib/buildEmbedField.ts +13 -4
  30. package/src/lib/buildImageFieldImage.ts +16 -5
  31. package/src/lib/createFaker.ts +14 -15
  32. package/src/lib/generateCustomTypeId.ts +12 -4
  33. package/src/lib/generateFieldId.ts +12 -4
  34. package/src/lib/generateTags.ts +13 -4
  35. package/src/lib/getMockEmbedData.ts +12 -4
  36. package/src/lib/getMockImageData.ts +12 -4
  37. package/src/lib/valueForModel.ts +47 -30
  38. package/src/lib/valueForModelMap.ts +24 -4
  39. package/src/model/boolean.ts +5 -5
  40. package/src/model/buildMockGroupFieldMap.ts +4 -4
  41. package/src/model/color.ts +2 -2
  42. package/src/model/contentRelationship.ts +2 -2
  43. package/src/model/createModelMockFactory.ts +213 -0
  44. package/src/model/customType.ts +3 -3
  45. package/src/model/date.ts +2 -2
  46. package/src/model/embed.ts +2 -2
  47. package/src/model/geoPoint.ts +2 -2
  48. package/src/model/group.ts +6 -6
  49. package/src/model/image.ts +3 -3
  50. package/src/model/index.ts +2 -0
  51. package/src/model/integrationFields.ts +2 -2
  52. package/src/model/keyText.ts +2 -2
  53. package/src/model/link.ts +3 -3
  54. package/src/model/linkToMedia.ts +3 -3
  55. package/src/model/number.ts +2 -2
  56. package/src/model/richText.ts +2 -2
  57. package/src/model/select.ts +3 -3
  58. package/src/model/sharedSlice.ts +3 -3
  59. package/src/model/sharedSliceVariation.ts +6 -6
  60. package/src/model/slice.ts +3 -3
  61. package/src/model/sliceZone.ts +7 -4
  62. package/src/model/timestamp.ts +2 -2
  63. package/src/model/title.ts +2 -2
  64. package/src/model/uid.ts +2 -2
  65. package/src/types.ts +67 -25
  66. package/src/value/boolean.ts +3 -5
  67. package/src/value/color.ts +2 -2
  68. package/src/value/contentRelationship.ts +18 -15
  69. package/src/value/createValueMockFactory.ts +236 -0
  70. package/src/value/customType.ts +7 -7
  71. package/src/value/date.ts +6 -2
  72. package/src/value/embed.ts +6 -3
  73. package/src/value/geoPoint.ts +2 -2
  74. package/src/value/group.ts +5 -5
  75. package/src/value/image.ts +26 -18
  76. package/src/value/integrationFields.ts +12 -26
  77. package/src/value/keyText.ts +2 -2
  78. package/src/value/link.ts +9 -7
  79. package/src/value/linkToMedia.ts +2 -2
  80. package/src/value/number.ts +2 -2
  81. package/src/value/richText/embed.ts +6 -3
  82. package/src/value/richText/heading.ts +29 -17
  83. package/src/value/richText/image.ts +6 -3
  84. package/src/value/richText/index.ts +71 -43
  85. package/src/value/richText/list.ts +2 -2
  86. package/src/value/richText/oList.ts +2 -2
  87. package/src/value/richText/paragraph.ts +2 -2
  88. package/src/value/richText/preformatted.ts +2 -2
  89. package/src/value/select.ts +10 -6
  90. package/src/value/sharedSlice.ts +4 -4
  91. package/src/value/sharedSliceVariation.ts +9 -10
  92. package/src/value/slice.ts +9 -9
  93. package/src/value/sliceZone.ts +10 -8
  94. package/src/value/timestamp.ts +2 -2
  95. package/src/value/title.ts +7 -3
  96. package/src/value/uid.ts +5 -3
@@ -30,8 +30,6 @@ const Rand__default = /*#__PURE__*/_interopDefaultLegacy(Rand);
30
30
  const prismicT__namespace = /*#__PURE__*/_interopNamespace(prismicT);
31
31
  const changeCase__namespace = /*#__PURE__*/_interopNamespace(changeCase);
32
32
 
33
- const FAKER_SEED = 1984;
34
-
35
33
  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
34
  const loremWords = wordsString.split(" ");
37
35
  const lorem = (length, wordOffset = 0) => {
@@ -73,22 +71,16 @@ const lorem = (length, wordOffset = 0) => {
73
71
  };
74
72
  lorem.spaceIndices = [];
75
73
 
76
- const createFaker = (seed = FAKER_SEED) => {
77
- const normalizedSeed = seed.toString();
78
- if (createFaker.cache[normalizedSeed]) {
79
- return createFaker.cache[normalizedSeed];
80
- } else {
81
- const faker = new Faker(normalizedSeed);
82
- return createFaker.cache[normalizedSeed] = faker;
83
- }
74
+ const createFaker = (seed) => {
75
+ return new Faker(seed);
84
76
  };
85
- createFaker.cache = {};
86
77
  const DAY_MS = 1e3 * 60 * 60 * 24;
87
78
  const YEAR_MS = DAY_MS * 365;
88
79
  const YEAR_2022_MS = 52 * (YEAR_MS + DAY_MS / 4);
89
80
  class Faker {
90
81
  constructor(seed) {
91
- this.rand = new Rand__default["default"](seed);
82
+ this.seed = seed;
83
+ this.rand = new Rand__default["default"](seed.toString());
92
84
  }
93
85
  boolean() {
94
86
  return this.random() >= 0.5;
@@ -100,7 +92,8 @@ class Faker {
100
92
  return elements[this.range(0, elements.length)];
101
93
  }
102
94
  randomElements(elements) {
103
- return elements.filter(() => this.boolean());
95
+ const alwaysInclude = this.randomElement(elements);
96
+ return elements.filter((element) => element === alwaysInclude || this.boolean());
104
97
  }
105
98
  range(min, max) {
106
99
  return Math.floor(this.rangeFloat(Math.ceil(min), Math.floor(max)));
@@ -147,53 +140,55 @@ class Faker {
147
140
  }
148
141
  }
149
142
 
150
- const boolean = (config = {}) => {
151
- const faker = createFaker(config.seed);
143
+ const boolean = (config) => {
144
+ const faker = config.faker || createFaker(config.seed);
152
145
  return faker.boolean();
153
146
  };
154
147
 
155
148
  const generateTags = (config) => {
156
149
  var _a, _b;
157
- const faker = createFaker(config.seed);
150
+ const faker = config.faker || createFaker(config.seed);
158
151
  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))));
159
152
  };
160
153
 
161
154
  const valueForModel = (config) => {
155
+ var _a;
156
+ const faker = config.faker || createFaker(config.seed);
162
157
  const model = config.model;
163
158
  switch (model.type) {
164
159
  case prismicT__namespace.CustomTypeModelFieldType.Boolean: {
165
160
  return boolean({
166
- seed: config.seed,
161
+ faker,
167
162
  model,
168
163
  ...config.config
169
164
  });
170
165
  }
171
166
  case prismicT__namespace.CustomTypeModelFieldType.Color: {
172
167
  return color({
173
- seed: config.seed,
168
+ faker,
174
169
  model,
175
170
  ...config.config
176
171
  });
177
172
  }
178
173
  case prismicT__namespace.CustomTypeModelFieldType.Link: {
179
- switch (model.config.select) {
174
+ switch ((_a = model.config) == null ? void 0 : _a.select) {
180
175
  case prismicT__namespace.CustomTypeModelLinkSelectType.Document: {
181
176
  return contentRelationship({
182
- seed: config.seed,
177
+ faker,
183
178
  model,
184
179
  ...config.config
185
180
  });
186
181
  }
187
182
  case prismicT__namespace.CustomTypeModelLinkSelectType.Media: {
188
183
  return linkToMedia({
189
- seed: config.seed,
184
+ faker,
190
185
  model,
191
186
  ...config.config
192
187
  });
193
188
  }
194
189
  default: {
195
190
  return link({
196
- seed: config.seed,
191
+ faker,
197
192
  model,
198
193
  ...config.config
199
194
  });
@@ -202,70 +197,70 @@ const valueForModel = (config) => {
202
197
  }
203
198
  case prismicT__namespace.CustomTypeModelFieldType.Date: {
204
199
  return date({
205
- seed: config.seed,
200
+ faker,
206
201
  model,
207
202
  ...config.config
208
203
  });
209
204
  }
210
205
  case prismicT__namespace.CustomTypeModelFieldType.Embed: {
211
206
  return embed$1({
212
- seed: config.seed,
207
+ faker,
213
208
  model,
214
209
  ...config.config
215
210
  });
216
211
  }
217
212
  case prismicT__namespace.CustomTypeModelFieldType.GeoPoint: {
218
213
  return geoPoint({
219
- seed: config.seed,
214
+ faker,
220
215
  model,
221
216
  ...config.config
222
217
  });
223
218
  }
224
219
  case prismicT__namespace.CustomTypeModelFieldType.Image: {
225
220
  return image$1({
226
- seed: config.seed,
221
+ faker,
227
222
  model,
228
223
  ...config.config
229
224
  });
230
225
  }
231
226
  case prismicT__namespace.CustomTypeModelFieldType.Text: {
232
227
  return keyText({
233
- seed: config.seed,
228
+ faker,
234
229
  model,
235
230
  ...config.config
236
231
  });
237
232
  }
238
233
  case prismicT__namespace.CustomTypeModelFieldType.Number: {
239
234
  return number({
240
- seed: config.seed,
235
+ faker,
241
236
  model,
242
237
  ...config.config
243
238
  });
244
239
  }
245
240
  case prismicT__namespace.CustomTypeModelFieldType.Select: {
246
241
  return select({
247
- seed: config.seed,
242
+ faker,
248
243
  model,
249
244
  ...config.config
250
245
  });
251
246
  }
252
247
  case prismicT__namespace.CustomTypeModelFieldType.Timestamp: {
253
248
  return timestamp({
254
- seed: config.seed,
249
+ faker,
255
250
  model,
256
251
  ...config.config
257
252
  });
258
253
  }
259
254
  case prismicT__namespace.CustomTypeModelFieldType.StructuredText: {
260
- if ("single" in model.config && model.config.single.split(",").every((element) => /heading[1-6]/.test(element.trim()))) {
255
+ if (model.config && "single" in model.config && model.config.single && model.config.single.split(",").every((element) => /heading[1-6]/.test(element.trim()))) {
261
256
  return title({
262
- seed: config.seed,
257
+ faker,
263
258
  model,
264
259
  ...config.config
265
260
  });
266
261
  } else {
267
262
  return richText({
268
- seed: config.seed,
263
+ faker,
269
264
  model,
270
265
  ...config.config
271
266
  });
@@ -273,36 +268,41 @@ const valueForModel = (config) => {
273
268
  }
274
269
  case prismicT__namespace.CustomTypeModelFieldType.IntegrationFields: {
275
270
  return integrationFields({
276
- seed: config.seed,
271
+ faker,
277
272
  model,
278
273
  ...config.config
279
274
  });
280
275
  }
281
276
  case prismicT__namespace.CustomTypeModelFieldType.UID: {
282
277
  return uid({
283
- seed: config.seed,
278
+ faker,
284
279
  model,
285
280
  ...config.config
286
281
  });
287
282
  }
288
283
  case prismicT__namespace.CustomTypeModelFieldType.Group: {
289
284
  return group({
290
- seed: config.seed,
285
+ faker,
291
286
  model,
292
287
  ...config.config
293
288
  });
294
289
  }
290
+ case prismicT__namespace.CustomTypeModelFieldType.LegacySlices:
295
291
  case prismicT__namespace.CustomTypeModelFieldType.Slices: {
296
292
  return sliceZone({
297
- seed: config.seed,
293
+ faker,
298
294
  model,
299
295
  ...config.config
300
296
  });
301
297
  }
298
+ default: {
299
+ throw new Error(`The "${model.type}" field type is not supported in @prismicio/mock.`);
300
+ }
302
301
  }
303
302
  };
304
303
 
305
304
  const getValueConfigType = (model) => {
305
+ var _a;
306
306
  switch (model.type) {
307
307
  case prismicT__namespace.CustomTypeModelFieldType.Boolean:
308
308
  return "boolean";
@@ -319,7 +319,7 @@ const getValueConfigType = (model) => {
319
319
  case prismicT__namespace.CustomTypeModelFieldType.Image:
320
320
  return "image";
321
321
  case prismicT__namespace.CustomTypeModelFieldType.Link: {
322
- switch (model.config.select) {
322
+ switch ((_a = model.config) == null ? void 0 : _a.select) {
323
323
  case prismicT__namespace.CustomTypeModelLinkSelectType.Document:
324
324
  return "contentRelationship";
325
325
  case prismicT__namespace.CustomTypeModelLinkSelectType.Media:
@@ -333,7 +333,7 @@ const getValueConfigType = (model) => {
333
333
  case prismicT__namespace.CustomTypeModelFieldType.Select:
334
334
  return "select";
335
335
  case prismicT__namespace.CustomTypeModelFieldType.StructuredText: {
336
- if ("single" in model.config && model.config.single.split(",").every((element) => /heading{1,6}/.test(element.trim()))) {
336
+ if (model.config && "single" in model.config && model.config.single && model.config.single.split(",").every((element) => /heading{1,6}/.test(element.trim()))) {
337
337
  return "title";
338
338
  } else {
339
339
  return "richText";
@@ -349,17 +349,21 @@ const getValueConfigType = (model) => {
349
349
  return "integrationFields";
350
350
  case prismicT__namespace.CustomTypeModelFieldType.Slices:
351
351
  return "sliceZone";
352
+ default: {
353
+ throw new Error(`The "${model.type}" field type is not supported in @prismicio/mock.`);
354
+ }
352
355
  }
353
356
  };
354
357
  const valueForModelMap = (config) => {
355
358
  var _a;
359
+ const faker = config.faker || createFaker(config.seed);
356
360
  const result = {};
357
361
  for (const fieldId in config.map) {
358
362
  const fieldModel = config.map[fieldId];
359
363
  const fieldConfigType = getValueConfigType(fieldModel);
360
364
  const fieldConfig = (_a = config.configs) == null ? void 0 : _a[fieldConfigType];
361
365
  result[fieldId] = valueForModel({
362
- seed: config.seed,
366
+ faker,
363
367
  model: fieldModel,
364
368
  config: fieldConfig
365
369
  });
@@ -367,8 +371,8 @@ const valueForModelMap = (config) => {
367
371
  return result;
368
372
  };
369
373
 
370
- const contentRelationship$1 = (config = {}) => {
371
- const faker = createFaker(config.seed);
374
+ const contentRelationship$1 = (config) => {
375
+ const faker = config.faker || createFaker(config.seed);
372
376
  return {
373
377
  type: prismicT__namespace.CustomTypeModelFieldType.Link,
374
378
  config: {
@@ -381,9 +385,9 @@ const contentRelationship$1 = (config = {}) => {
381
385
  };
382
386
  };
383
387
 
384
- const customType$1 = (config = {}) => {
388
+ const customType$1 = (config) => {
385
389
  var _a, _b;
386
- const faker = createFaker(config.seed);
390
+ const faker = config.faker || createFaker(config.seed);
387
391
  let label = config.label || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
388
392
  let id = config.id || changeCase__namespace.snakeCase(label);
389
393
  if (config.id && !config.label) {
@@ -406,8 +410,8 @@ const customType$1 = (config = {}) => {
406
410
  };
407
411
  };
408
412
 
409
- const group$1 = (config = {}) => {
410
- const faker = createFaker(config.seed);
413
+ function group$1(config) {
414
+ const faker = config.faker || createFaker(config.seed);
411
415
  return {
412
416
  type: prismicT__namespace.CustomTypeModelFieldType.Group,
413
417
  config: {
@@ -415,10 +419,10 @@ const group$1 = (config = {}) => {
415
419
  fields: config.fields || {}
416
420
  }
417
421
  };
418
- };
422
+ }
419
423
 
420
- const image$2 = (config = {}) => {
421
- const faker = createFaker(config.seed);
424
+ const image$2 = (config) => {
425
+ const faker = config.faker || createFaker(config.seed);
422
426
  const thumbnails = (config.thumbnailNames || []).map((name) => {
423
427
  return {
424
428
  name,
@@ -439,8 +443,8 @@ const image$2 = (config = {}) => {
439
443
  };
440
444
  };
441
445
 
442
- const link$1 = (config = {}) => {
443
- const faker = createFaker(config.seed);
446
+ const link$1 = (config) => {
447
+ const faker = config.faker || createFaker(config.seed);
444
448
  return {
445
449
  type: prismicT__namespace.CustomTypeModelFieldType.Link,
446
450
  config: {
@@ -452,9 +456,9 @@ const link$1 = (config = {}) => {
452
456
  };
453
457
  };
454
458
 
455
- const richText$1 = (config = {}) => {
459
+ const richText$1 = (config) => {
456
460
  var _a;
457
- const faker = createFaker(config.seed);
461
+ const faker = config.faker || createFaker(config.seed);
458
462
  const blockTypes = faker.randomElements([
459
463
  prismicT__namespace.RichTextNodeType.heading1,
460
464
  prismicT__namespace.RichTextNodeType.heading2,
@@ -484,8 +488,8 @@ const richText$1 = (config = {}) => {
484
488
  };
485
489
  };
486
490
 
487
- const select$1 = (config = {}) => {
488
- const faker = createFaker(config.seed);
491
+ const select$1 = (config) => {
492
+ const faker = config.faker || createFaker(config.seed);
489
493
  return {
490
494
  type: prismicT__namespace.CustomTypeModelFieldType.Select,
491
495
  config: {
@@ -497,8 +501,8 @@ const select$1 = (config = {}) => {
497
501
  };
498
502
  };
499
503
 
500
- const sharedSlice$1 = (config = {}) => {
501
- const faker = createFaker(config.seed);
504
+ const sharedSlice$1 = (config) => {
505
+ const faker = config.faker || createFaker(config.seed);
502
506
  let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
503
507
  let id = config.id || changeCase__namespace.snakeCase(name);
504
508
  if (config.id && !config.name) {
@@ -515,8 +519,95 @@ const sharedSlice$1 = (config = {}) => {
515
519
  };
516
520
  };
517
521
 
518
- const sharedSliceVariation$1 = (config = {}) => {
519
- const faker = createFaker(config.seed);
522
+ const dataSet$1 = [
523
+ {
524
+ url: "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d",
525
+ width: 4240,
526
+ height: 2832
527
+ },
528
+ {
529
+ url: "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05",
530
+ width: 7372,
531
+ height: 4392
532
+ },
533
+ {
534
+ url: "https://images.unsplash.com/photo-1441974231531-c6227db76b6e",
535
+ width: 2560,
536
+ height: 1705
537
+ },
538
+ {
539
+ url: "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5",
540
+ width: 2200,
541
+ height: 1467
542
+ },
543
+ {
544
+ url: "https://images.unsplash.com/photo-1426604966848-d7adac402bff",
545
+ width: 5616,
546
+ height: 3744
547
+ },
548
+ {
549
+ url: "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b",
550
+ width: 4240,
551
+ height: 2832
552
+ },
553
+ {
554
+ url: "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1",
555
+ width: 2560,
556
+ height: 1440
557
+ },
558
+ {
559
+ url: "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg",
560
+ width: 6373,
561
+ height: 4253
562
+ },
563
+ {
564
+ url: "https://images.unsplash.com/photo-1504198266287-1659872e6590",
565
+ width: 4272,
566
+ height: 2848
567
+ },
568
+ {
569
+ url: "https://images.unsplash.com/photo-1470770903676-69b98201ea1c",
570
+ width: 4554,
571
+ height: 3036
572
+ },
573
+ {
574
+ url: "https://images.unsplash.com/photo-1587502537745-84b86da1204f",
575
+ width: 6550,
576
+ height: 4367
577
+ },
578
+ {
579
+ url: "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c",
580
+ width: 6e3,
581
+ height: 4e3
582
+ },
583
+ {
584
+ url: "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f",
585
+ width: 6e3,
586
+ height: 4e3
587
+ },
588
+ {
589
+ url: "https://images.unsplash.com/photo-1504567961542-e24d9439a724",
590
+ width: 4608,
591
+ height: 3456
592
+ },
593
+ {
594
+ url: "https://images.unsplash.com/photo-1444464666168-49d633b86797",
595
+ width: 4844,
596
+ height: 3234
597
+ },
598
+ {
599
+ url: "https://images.unsplash.com/photo-1553531384-397c80973a0b",
600
+ width: 4335,
601
+ height: 6502
602
+ }
603
+ ];
604
+ const getMockImageData = (config) => {
605
+ const faker = config.faker || createFaker(config.seed);
606
+ return faker.randomElement(dataSet$1);
607
+ };
608
+
609
+ const sharedSliceVariation$1 = (config) => {
610
+ const faker = config.faker || createFaker(config.seed);
520
611
  let name = config.name || changeCase__namespace.capitalCase(faker.words(faker.range(1, 2)));
521
612
  let id = config.id || changeCase__namespace.snakeCase(name);
522
613
  if (config.id && !config.name) {
@@ -524,6 +615,7 @@ const sharedSliceVariation$1 = (config = {}) => {
524
615
  } else if (config.name && !config.name) {
525
616
  id = changeCase__namespace.snakeCase(config.name);
526
617
  }
618
+ const imageData = getMockImageData({ faker });
527
619
  return {
528
620
  id,
529
621
  name,
@@ -531,12 +623,13 @@ const sharedSliceVariation$1 = (config = {}) => {
531
623
  docURL: faker.url(),
532
624
  version: faker.hash(7),
533
625
  primary: config.primaryFields || {},
534
- items: config.itemsFields || {}
626
+ items: config.itemsFields || {},
627
+ imageUrl: imageData.url
535
628
  };
536
629
  };
537
630
 
538
- const slice$1 = (config = {}) => {
539
- const faker = createFaker(config.seed);
631
+ const slice$1 = (config) => {
632
+ const faker = config.faker || createFaker(config.seed);
540
633
  return {
541
634
  type: prismicT__namespace.CustomTypeModelSliceType.Slice,
542
635
  icon: changeCase__namespace.snakeCase(faker.word()),
@@ -548,7 +641,7 @@ const slice$1 = (config = {}) => {
548
641
  };
549
642
  };
550
643
 
551
- const sliceZone$1 = (config = {}) => {
644
+ const sliceZone$1 = (config) => {
552
645
  const labels = {};
553
646
  for (const choiceId in config.choices) {
554
647
  const choice = config.choices[choiceId];
@@ -566,8 +659,8 @@ const sliceZone$1 = (config = {}) => {
566
659
  };
567
660
  };
568
661
 
569
- const title$1 = (config = {}) => {
570
- const faker = createFaker(config.seed);
662
+ const title$1 = (config) => {
663
+ const faker = config.faker || createFaker(config.seed);
571
664
  const single = faker.randomElements([
572
665
  "heading1",
573
666
  "heading2",
@@ -588,12 +681,12 @@ const title$1 = (config = {}) => {
588
681
  };
589
682
 
590
683
  const generateFieldId = (config) => {
591
- const faker = createFaker(config.seed);
684
+ const faker = config.faker || createFaker(config.seed);
592
685
  return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
593
686
  };
594
687
 
595
- const timestamp = (config = {}) => {
596
- const faker = createFaker(config.seed);
688
+ const timestamp = (config) => {
689
+ const faker = config.faker || createFaker(config.seed);
597
690
  if (config.state === "empty") {
598
691
  return null;
599
692
  } else {
@@ -622,10 +715,10 @@ const buildAlternativeLanguage = (config) => {
622
715
  };
623
716
  };
624
717
 
625
- const customType = (config = {}) => {
718
+ const customType = (config) => {
626
719
  var _a;
627
- const faker = createFaker(config.seed);
628
- const model = config.model || customType$1({ seed: config.seed });
720
+ const faker = config.faker || createFaker(config.seed);
721
+ const model = config.model || customType$1({ faker });
629
722
  const fieldModelsMap = Object.assign({}, ...Object.values(model.json));
630
723
  const dataFieldModelsMap = {};
631
724
  for (const key in fieldModelsMap) {
@@ -646,22 +739,22 @@ const customType = (config = {}) => {
646
739
  url: withURL ? faker.url() : null,
647
740
  href: faker.url(),
648
741
  lang: faker.word(),
649
- tags: generateTags({ seed: config.seed }),
742
+ tags: generateTags({ faker }),
650
743
  slugs: [],
651
744
  linked_documents: [],
652
745
  alternate_languages: alternateLanguages,
653
- first_publication_date: timestamp({ seed: config.seed }),
654
- last_publication_date: timestamp({ seed: config.seed }),
746
+ first_publication_date: timestamp({ faker }),
747
+ last_publication_date: timestamp({ faker }),
655
748
  data: valueForModelMap({
656
- seed: config.seed,
749
+ faker,
657
750
  map: dataFieldModelsMap,
658
751
  configs: config.configs
659
752
  })
660
753
  };
661
754
  };
662
755
 
663
- const color = (config = {}) => {
664
- const faker = createFaker(config.seed);
756
+ const color = (config) => {
757
+ const faker = config.faker || createFaker(config.seed);
665
758
  return config.state === "empty" ? null : faker.hexColor().toUpperCase();
666
759
  };
667
760
 
@@ -680,32 +773,34 @@ const buildContentRelationshipField = (config) => {
680
773
  };
681
774
 
682
775
  const generateCustomTypeId = (config) => {
683
- const faker = createFaker(config.seed);
776
+ const faker = config.faker || createFaker(config.seed);
684
777
  return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
685
778
  };
686
779
 
687
- const contentRelationship = (config = {}) => {
688
- const faker = createFaker(config.seed);
780
+ const contentRelationship = (config) => {
781
+ var _a, _b;
782
+ const faker = config.faker || createFaker(config.seed);
689
783
  if (config.state === "empty") {
690
784
  return {
691
785
  link_type: prismicT__namespace.LinkType.Document
692
786
  };
693
787
  } else {
694
- const model = config.model || contentRelationship$1({ seed: config.seed });
788
+ const model = config.model || contentRelationship$1({ faker });
695
789
  const linkableDocuments = config.linkableDocuments ? config.linkableDocuments.filter((document2) => {
790
+ var _a2, _b2;
696
791
  let shouldKeep = true;
697
- if (model.config.customtypes) {
792
+ if ((_a2 = model.config) == null ? void 0 : _a2.customtypes) {
698
793
  shouldKeep = shouldKeep && model.config.customtypes.includes(document2.type);
699
794
  }
700
- if (model.config.tags) {
795
+ if ((_b2 = model.config) == null ? void 0 : _b2.tags) {
701
796
  shouldKeep = shouldKeep && model.config.tags.some((tag) => document2.tags.includes(tag));
702
797
  }
703
798
  return shouldKeep;
704
799
  }) : [
705
800
  {
706
- ...customType({ 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 })
801
+ ...customType({ faker }),
802
+ type: ((_a = model.config) == null ? void 0 : _a.customtypes) ? faker.randomElement(model.config.customtypes) : generateCustomTypeId({ faker }),
803
+ tags: ((_b = model.config) == null ? void 0 : _b.tags) ? faker.randomElements(model.config.tags) : generateTags({ faker })
709
804
  }
710
805
  ];
711
806
  const document = faker.randomElement(linkableDocuments);
@@ -718,9 +813,10 @@ const contentRelationship = (config = {}) => {
718
813
  }
719
814
  };
720
815
 
721
- const date = (config = {}) => {
816
+ const date = (config) => {
817
+ const faker = config.faker || createFaker(config.seed);
722
818
  return config.state === "empty" ? null : timestamp({
723
- seed: config.seed,
819
+ faker,
724
820
  after: config.after,
725
821
  before: config.before,
726
822
  state: "filled"
@@ -729,7 +825,7 @@ const date = (config = {}) => {
729
825
 
730
826
  const buildEmbedField = (config) => {
731
827
  var _a;
732
- const faker = createFaker(config.seed);
828
+ const faker = config.faker || createFaker(config.seed);
733
829
  return {
734
830
  embed_url: (_a = config.url) != null ? _a : faker.url(),
735
831
  html: `<div>embed html</div>`,
@@ -737,7 +833,7 @@ const buildEmbedField = (config) => {
737
833
  };
738
834
  };
739
835
 
740
- const dataSet$1 = [
836
+ const dataSet = [
741
837
  {
742
838
  version: "1.0",
743
839
  type: "video",
@@ -817,41 +913,43 @@ const dataSet$1 = [
817
913
  }
818
914
  ];
819
915
  const getMockEmbedData = (config) => {
820
- const faker = createFaker(config.seed);
821
- return faker.randomElement(dataSet$1);
916
+ const faker = config.faker || createFaker(config.seed);
917
+ return faker.randomElement(dataSet);
822
918
  };
823
919
 
824
- const embed$1 = (config = {}) => {
920
+ const embed$1 = (config) => {
825
921
  var _a, _b, _c;
826
- const data = (_a = config.data) != null ? _a : getMockEmbedData({ seed: config.seed });
922
+ const faker = config.faker || createFaker(config.seed);
923
+ const data = (_a = config.data) != null ? _a : getMockEmbedData({ faker });
827
924
  return config.state === "empty" ? {} : buildEmbedField({
828
- seed: config.seed,
925
+ faker,
829
926
  url: (_b = config.url) != null ? _b : "embed_url" in data ? data.embed_url : void 0,
830
927
  html: (_c = config.html) != null ? _c : "html" in data ? data.html : void 0,
831
928
  data
832
929
  });
833
930
  };
834
931
 
835
- const geoPoint = (config = {}) => {
836
- const faker = createFaker(config.seed);
932
+ const geoPoint = (config) => {
933
+ const faker = config.faker || createFaker(config.seed);
837
934
  return config.state === "empty" ? {} : {
838
935
  longitude: faker.rangeFloat(-180, 180),
839
936
  latitude: faker.rangeFloat(-90, 90)
840
937
  };
841
938
  };
842
939
 
843
- const group = (config = {}) => {
940
+ const group = (config) => {
844
941
  var _a;
845
942
  if (config.state === "empty") {
846
943
  return [];
847
944
  } else {
848
- const faker = createFaker(config.seed);
849
- const model = config.model || group$1({ seed: config.seed });
945
+ const faker = config.faker || createFaker(config.seed);
946
+ const model = config.model || group$1({ faker });
850
947
  const itemsCount = (_a = config.itemsCount) != null ? _a : faker.range(1, 6);
851
948
  return Array(itemsCount).fill(void 0).map(() => {
949
+ var _a2;
852
950
  return valueForModelMap({
853
- seed: config.seed,
854
- map: model.config.fields,
951
+ faker,
952
+ map: ((_a2 = model.config) == null ? void 0 : _a2.fields) || {},
855
953
  configs: config.configs
856
954
  });
857
955
  });
@@ -868,7 +966,7 @@ const buildImageFieldImage = (config) => {
868
966
  copyright: null
869
967
  };
870
968
  } else {
871
- const faker = createFaker(config.seed);
969
+ const faker = config.faker || createFaker(config.seed);
872
970
  const url = new URL(config.imageData.url);
873
971
  const dimensions = {
874
972
  width: (_b = (_a = config.constraint) == null ? void 0 : _a.width) != null ? _b : config.imageData.width,
@@ -886,136 +984,46 @@ const buildImageFieldImage = (config) => {
886
984
  }
887
985
  };
888
986
 
889
- const dataSet = [
890
- {
891
- url: "https://images.unsplash.com/photo-1604537529428-15bcbeecfe4d",
892
- width: 4240,
893
- height: 2832
894
- },
895
- {
896
- url: "https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05",
897
- width: 7372,
898
- height: 4392
899
- },
900
- {
901
- url: "https://images.unsplash.com/photo-1441974231531-c6227db76b6e",
902
- width: 2560,
903
- height: 1705
904
- },
905
- {
906
- url: "https://images.unsplash.com/photo-1418065460487-3e41a6c84dc5",
907
- width: 2200,
908
- height: 1467
909
- },
910
- {
911
- url: "https://images.unsplash.com/photo-1426604966848-d7adac402bff",
912
- width: 5616,
913
- height: 3744
914
- },
915
- {
916
- url: "https://images.unsplash.com/photo-1604537466608-109fa2f16c3b",
917
- width: 4240,
918
- height: 2832
919
- },
920
- {
921
- url: "https://images.unsplash.com/photo-1497436072909-60f360e1d4b1",
922
- width: 2560,
923
- height: 1440
924
- },
925
- {
926
- url: "https://images.unsplash.com/reserve/HgZuGu3gSD6db21T3lxm_San%20Zenone.jpg",
927
- width: 6373,
928
- height: 4253
929
- },
930
- {
931
- url: "https://images.unsplash.com/photo-1504198266287-1659872e6590",
932
- width: 4272,
933
- height: 2848
934
- },
935
- {
936
- url: "https://images.unsplash.com/photo-1470770903676-69b98201ea1c",
937
- width: 4554,
938
- height: 3036
939
- },
940
- {
941
- url: "https://images.unsplash.com/photo-1587502537745-84b86da1204f",
942
- width: 6550,
943
- height: 4367
944
- },
945
- {
946
- url: "https://images.unsplash.com/photo-1431794062232-2a99a5431c6c",
947
- width: 6e3,
948
- height: 4e3
949
- },
950
- {
951
- url: "https://images.unsplash.com/photo-1446329813274-7c9036bd9a1f",
952
- width: 6e3,
953
- height: 4e3
954
- },
955
- {
956
- url: "https://images.unsplash.com/photo-1504567961542-e24d9439a724",
957
- width: 4608,
958
- height: 3456
959
- },
960
- {
961
- url: "https://images.unsplash.com/photo-1444464666168-49d633b86797",
962
- width: 4844,
963
- height: 3234
964
- },
965
- {
966
- url: "https://images.unsplash.com/photo-1553531384-397c80973a0b",
967
- width: 4335,
968
- height: 6502
969
- }
970
- ];
971
- const getMockImageData = (config) => {
972
- const faker = createFaker(config.seed);
973
- return faker.randomElement(dataSet);
974
- };
975
-
976
- const image$1 = (config = {}) => {
977
- const model = config.model || image$2({ seed: config.seed });
978
- const imageData = getMockImageData({ seed: config.seed });
987
+ const image$1 = (config) => {
988
+ var _a, _b;
989
+ const faker = config.faker || createFaker(config.seed);
990
+ const model = config.model || image$2({ faker });
991
+ const imageData = getMockImageData({ faker });
979
992
  const value = buildImageFieldImage({
980
- seed: config.seed,
993
+ faker,
981
994
  imageData,
982
- constraint: model.config.constraint,
995
+ constraint: (_a = model.config) == null ? void 0 : _a.constraint,
983
996
  state: config.state
984
997
  });
985
- for (const thumbnail of model.config.thumbnails) {
986
- value[thumbnail.name] = buildImageFieldImage({
987
- seed: config.seed,
988
- imageData,
989
- constraint: {
990
- width: thumbnail.width,
991
- height: thumbnail.height
992
- },
993
- state: config.state
994
- });
998
+ if ((_b = model.config) == null ? void 0 : _b.thumbnails) {
999
+ for (const thumbnail of model.config.thumbnails) {
1000
+ value[thumbnail.name] = buildImageFieldImage({
1001
+ faker,
1002
+ imageData,
1003
+ constraint: {
1004
+ width: thumbnail.width,
1005
+ height: thumbnail.height
1006
+ },
1007
+ state: config.state
1008
+ });
1009
+ }
995
1010
  }
996
1011
  return value;
997
1012
  };
998
1013
 
999
- const integrationFields = (config = {}) => {
1000
- const faker = createFaker(config.seed);
1001
- const imageData = getMockImageData({ seed: config.seed });
1002
- return config.state === "empty" ? null : {
1003
- id: faker.hash(7),
1004
- title: changeCase__namespace.capitalCase(faker.words(faker.range(1, 3))),
1005
- description: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 10))),
1006
- image_url: imageData.url,
1007
- last_update: faker.date().getTime(),
1008
- blob: config.data
1009
- };
1014
+ const integrationFields = (config) => {
1015
+ var _a;
1016
+ const data = (_a = config.data) != null ? _a : {};
1017
+ return config.state === "empty" ? null : data;
1010
1018
  };
1011
1019
 
1012
- const keyText = (config = {}) => {
1013
- const faker = createFaker(config.seed);
1020
+ const keyText = (config) => {
1021
+ const faker = config.faker || createFaker(config.seed);
1014
1022
  return config.state === "empty" ? null : changeCase__namespace.sentenceCase(faker.words(3));
1015
1023
  };
1016
1024
 
1017
- const linkToMedia = (config = {}) => {
1018
- const faker = createFaker(config.seed);
1025
+ const linkToMedia = (config) => {
1026
+ const faker = config.faker || createFaker(config.seed);
1019
1027
  if (config.state === "empty") {
1020
1028
  return {
1021
1029
  link_type: prismicT__namespace.LinkType.Media
@@ -1033,9 +1041,9 @@ const linkToMedia = (config = {}) => {
1033
1041
  }
1034
1042
  };
1035
1043
 
1036
- const link = (config = {}) => {
1037
- var _a;
1038
- const faker = createFaker(config.seed);
1044
+ const link = (config) => {
1045
+ var _a, _b;
1046
+ const faker = config.faker || createFaker(config.seed);
1039
1047
  const type = config.type || faker.randomElement([
1040
1048
  prismicT__namespace.LinkType.Web,
1041
1049
  prismicT__namespace.LinkType.Document,
@@ -1049,32 +1057,32 @@ const link = (config = {}) => {
1049
1057
  switch (type) {
1050
1058
  case prismicT__namespace.LinkType.Document: {
1051
1059
  return contentRelationship({
1052
- seed: config.seed,
1060
+ faker,
1053
1061
  state: config.state,
1054
1062
  linkableDocuments: config.linkableDocuments
1055
1063
  });
1056
1064
  }
1057
1065
  case prismicT__namespace.LinkType.Media: {
1058
1066
  return linkToMedia({
1059
- seed: config.seed,
1067
+ faker,
1060
1068
  state: config.state
1061
1069
  });
1062
1070
  }
1063
1071
  case prismicT__namespace.LinkType.Web:
1064
1072
  default: {
1065
- const model = config.model || link$1({ seed: config.seed });
1073
+ const model = config.model || link$1({ faker });
1066
1074
  return {
1067
1075
  link_type: prismicT__namespace.LinkType.Web,
1068
1076
  url: faker.url(),
1069
- target: ((_a = config.withTargetBlank) != null ? _a : model.config.allowTargetBlank && faker.boolean()) ? "_blank" : void 0
1077
+ target: ((_b = config.withTargetBlank) != null ? _b : ((_a = model.config) == null ? void 0 : _a.allowTargetBlank) && faker.boolean()) ? "_blank" : void 0
1070
1078
  };
1071
1079
  }
1072
1080
  }
1073
1081
  }
1074
1082
  };
1075
1083
 
1076
- const number = (config = {}) => {
1077
- const faker = createFaker(config.seed);
1084
+ const number = (config) => {
1085
+ const faker = config.faker || createFaker(config.seed);
1078
1086
  return config.state === "empty" ? null : faker.range(1, 100);
1079
1087
  };
1080
1088
 
@@ -1092,17 +1100,25 @@ const patterns$5 = {
1092
1100
  maxWords: 12
1093
1101
  }
1094
1102
  };
1095
- const heading = (config = {}) => {
1096
- const faker = createFaker(config.seed);
1097
- const model = config.model || title$1({ seed: config.seed });
1098
- const types = ("single" in model.config ? model.config.single : model.config.multi).split(",").filter((type2) => [
1099
- prismicT__namespace.RichTextNodeType.heading1,
1100
- prismicT__namespace.RichTextNodeType.heading2,
1101
- prismicT__namespace.RichTextNodeType.heading3,
1102
- prismicT__namespace.RichTextNodeType.heading4,
1103
- prismicT__namespace.RichTextNodeType.heading5,
1104
- prismicT__namespace.RichTextNodeType.heading6
1105
- ].includes(type2));
1103
+ const headingNoteTypes = [
1104
+ prismicT__namespace.RichTextNodeType.heading1,
1105
+ prismicT__namespace.RichTextNodeType.heading2,
1106
+ prismicT__namespace.RichTextNodeType.heading3,
1107
+ prismicT__namespace.RichTextNodeType.heading4,
1108
+ prismicT__namespace.RichTextNodeType.heading5,
1109
+ prismicT__namespace.RichTextNodeType.heading6
1110
+ ];
1111
+ const heading = (config) => {
1112
+ const faker = config.faker || createFaker(config.seed);
1113
+ const model = config.model || title$1({ faker });
1114
+ let types = [];
1115
+ if (model.config) {
1116
+ if ("single" in model.config && model.config.single) {
1117
+ types = model.config.single.split(",").filter((type2) => headingNoteTypes.includes(type2));
1118
+ } else if ("multi" in model.config && model.config.multi) {
1119
+ types = model.config.multi.split(",").filter((type2) => headingNoteTypes.includes(type2));
1120
+ }
1121
+ }
1106
1122
  const type = faker.randomElement(types);
1107
1123
  if (type) {
1108
1124
  const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$5));
@@ -1128,8 +1144,8 @@ const patterns$4 = {
1128
1144
  sentenceCount: 12
1129
1145
  }
1130
1146
  };
1131
- const paragraph = (config = {}) => {
1132
- const faker = createFaker(config.seed);
1147
+ const paragraph = (config) => {
1148
+ const faker = config.faker || createFaker(config.seed);
1133
1149
  const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$4));
1134
1150
  const pattern = patterns$4[patternKey];
1135
1151
  const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
@@ -1151,8 +1167,8 @@ const patterns$3 = {
1151
1167
  sentenceCount: 12
1152
1168
  }
1153
1169
  };
1154
- const preformatted = (config = {}) => {
1155
- const faker = createFaker(config.seed);
1170
+ const preformatted = (config) => {
1171
+ const faker = config.faker || createFaker(config.seed);
1156
1172
  const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$3));
1157
1173
  const pattern = patterns$3[patternKey];
1158
1174
  const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
@@ -1177,8 +1193,8 @@ const patterns$2 = {
1177
1193
  maxItems: 12
1178
1194
  }
1179
1195
  };
1180
- const list = (config = {}) => {
1181
- const faker = createFaker(config.seed);
1196
+ const list = (config) => {
1197
+ const faker = config.faker || createFaker(config.seed);
1182
1198
  const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$2));
1183
1199
  const pattern = patterns$2[patternKey];
1184
1200
  const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
@@ -1205,8 +1221,8 @@ const patterns$1 = {
1205
1221
  maxItems: 12
1206
1222
  }
1207
1223
  };
1208
- const oList = (config = {}) => {
1209
- const faker = createFaker(config.seed);
1224
+ const oList = (config) => {
1225
+ const faker = config.faker || createFaker(config.seed);
1210
1226
  const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$1));
1211
1227
  const pattern = patterns$1[patternKey];
1212
1228
  const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
@@ -1219,10 +1235,11 @@ const oList = (config = {}) => {
1219
1235
  });
1220
1236
  };
1221
1237
 
1222
- const image = (config = {}) => {
1223
- const imageData = getMockImageData({ seed: config.seed });
1238
+ const image = (config) => {
1239
+ const faker = config.faker || createFaker(config.seed);
1240
+ const imageData = getMockImageData({ faker });
1224
1241
  const imageField = buildImageFieldImage({
1225
- seed: config.seed,
1242
+ faker,
1226
1243
  imageData,
1227
1244
  state: "filled"
1228
1245
  });
@@ -1235,9 +1252,10 @@ const image = (config = {}) => {
1235
1252
  };
1236
1253
  };
1237
1254
 
1238
- const embed = (config = {}) => {
1239
- const data = getMockEmbedData({ seed: config.seed });
1240
- const embedField = buildEmbedField({ seed: config.seed, data });
1255
+ const embed = (config) => {
1256
+ const faker = config.faker || createFaker(config.seed);
1257
+ const data = getMockEmbedData({ faker });
1258
+ const embedField = buildEmbedField({ faker, data });
1241
1259
  return {
1242
1260
  type: prismicT__namespace.RichTextNodeType.embed,
1243
1261
  oembed: embedField
@@ -1272,96 +1290,109 @@ const generators = {
1272
1290
  [prismicT__namespace.RichTextNodeType.image]: image,
1273
1291
  [prismicT__namespace.RichTextNodeType.embed]: embed
1274
1292
  };
1275
- const richText = (config = {}) => {
1276
- const faker = createFaker(config.seed);
1277
- const model = config.model || richText$1({
1278
- seed: config.seed,
1279
- withMultipleBlocks: true
1280
- });
1281
- const supportsMultipleBlocks = "multi" in model.config;
1282
- const types = ("multi" in model.config ? model.config.multi : model.config.single).split(",").filter((type) => Object.keys(generators).includes(type));
1283
- if (types.length > 0) {
1284
- const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
1285
- const pattern = patterns[patternKey];
1286
- const blockCount = supportsMultipleBlocks ? faker.range(pattern.blockCountMin, pattern.blockCountMax) : 1;
1287
- return Array(blockCount).fill(void 0).map(() => {
1288
- const type = faker.randomElement(types);
1289
- const generator = generators[type];
1290
- return generator({ seed: config.seed, model });
1291
- }).flat().filter((block) => block !== void 0).slice(0, blockCount);
1292
- } else {
1293
+ const richText = (config) => {
1294
+ const faker = config.faker || createFaker(config.seed);
1295
+ if (config.state === "empty") {
1293
1296
  return [];
1297
+ } else {
1298
+ const model = config.model || richText$1({
1299
+ faker,
1300
+ withMultipleBlocks: true
1301
+ });
1302
+ const supportsMultipleBlocks = model.config && "multi" in model.config;
1303
+ let types = [];
1304
+ if (model.config) {
1305
+ if ("multi" in model.config && model.config.multi) {
1306
+ types = model.config.multi.split(",").filter((type) => Object.keys(generators).includes(type));
1307
+ } else if ("single" in model.config && model.config.single) {
1308
+ types = model.config.single.split(",").filter((type) => Object.keys(generators).includes(type));
1309
+ }
1310
+ }
1311
+ if (types.length > 0) {
1312
+ const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
1313
+ const pattern = patterns[patternKey];
1314
+ const blockCount = supportsMultipleBlocks ? faker.range(pattern.blockCountMin, pattern.blockCountMax) : 1;
1315
+ return Array(blockCount).fill(void 0).map(() => {
1316
+ const type = faker.randomElement(types);
1317
+ const generator = generators[type];
1318
+ return generator({ faker, model });
1319
+ }).flat().filter((block) => block !== void 0).slice(0, blockCount);
1320
+ } else {
1321
+ return [];
1322
+ }
1294
1323
  }
1295
1324
  };
1296
1325
 
1297
- const select = (config = {}) => {
1298
- const faker = createFaker(config.seed);
1299
- const model = config.model || select$1({ seed: config.seed });
1300
- const defaultValue = model.config.default_value;
1326
+ const select = (config) => {
1327
+ var _a, _b;
1328
+ const faker = config.faker || createFaker(config.seed);
1329
+ const model = config.model || select$1({ faker });
1330
+ const defaultValue = (_a = model.config) == null ? void 0 : _a.default_value;
1331
+ const options = ((_b = model.config) == null ? void 0 : _b.options) || [];
1301
1332
  if (config.state === "empty") {
1302
1333
  return null;
1303
1334
  } else {
1304
- return typeof defaultValue === "string" && faker.boolean() ? defaultValue : faker.randomElement(model.config.options);
1335
+ return typeof defaultValue === "string" && faker.boolean() ? defaultValue : faker.randomElement(options);
1305
1336
  }
1306
1337
  };
1307
1338
 
1308
- const slice = (config = {}) => {
1339
+ const slice = (config) => {
1309
1340
  var _a, _b;
1310
- const faker = createFaker(config.seed);
1311
- const model = config.model || slice$1({ seed: config.seed });
1312
- const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
1341
+ const faker = config.faker || createFaker(config.seed);
1342
+ const model = config.model || slice$1({ faker });
1343
+ const sliceType = (_a = config.type) != null ? _a : generateFieldId({ faker });
1313
1344
  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;
1345
+ const itemsCount = model.repeat && Object.keys(model.repeat).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
1315
1346
  return {
1316
1347
  slice_type: sliceType,
1317
1348
  slice_label: sliceLabel,
1318
1349
  primary: valueForModelMap({
1319
- seed: config.seed,
1320
- map: model["non-repeat"],
1350
+ faker,
1351
+ map: model["non-repeat"] || {},
1321
1352
  configs: config.primaryFieldConfigs
1322
1353
  }),
1323
1354
  items: Array(itemsCount).fill(void 0).map(() => {
1324
1355
  return valueForModelMap({
1325
- seed: config.seed,
1326
- map: model.repeat,
1356
+ faker,
1357
+ map: model.repeat || {},
1327
1358
  configs: config.itemsFieldConfigs
1328
1359
  });
1329
1360
  })
1330
1361
  };
1331
1362
  };
1332
1363
 
1333
- const sharedSliceVariation = (config = {}) => {
1364
+ const sharedSliceVariation = (config) => {
1334
1365
  var _a, _b;
1335
- const faker = createFaker(config.seed);
1336
- const model = config.model || sharedSliceVariation$1({ seed: config.seed });
1337
- const sliceType = (_a = config.type) != null ? _a : generateFieldId({ seed: config.seed });
1338
- const itemsCount = Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
1366
+ const faker = config.faker || createFaker(config.seed);
1367
+ const model = config.model || sharedSliceVariation$1({ faker });
1368
+ const sliceType = (_a = config.type) != null ? _a : generateFieldId({ faker });
1369
+ const itemsCount = model.items && Object.keys(model.items).length > 0 ? (_b = config.itemsCount) != null ? _b : faker.range(1, 6) : 0;
1339
1370
  return {
1340
1371
  slice_type: sliceType,
1341
1372
  slice_label: null,
1342
1373
  variation: model.id,
1343
1374
  version: faker.hash(7),
1344
1375
  primary: valueForModelMap({
1345
- seed: config.seed,
1346
- map: model.primary,
1376
+ faker,
1377
+ map: model.primary || {},
1347
1378
  configs: config.primaryFieldConfigs
1348
1379
  }),
1349
1380
  items: Array(itemsCount).fill(void 0).map(() => {
1350
1381
  return valueForModelMap({
1351
- seed: config.seed,
1352
- map: model.items,
1382
+ faker,
1383
+ map: model.items || {},
1353
1384
  configs: config.itemsFieldConfigs
1354
1385
  });
1355
1386
  })
1356
1387
  };
1357
1388
  };
1358
1389
 
1359
- const sharedSlice = (config = {}) => {
1360
- const faker = createFaker(config.seed);
1361
- const model = config.model || sharedSlice$1({ seed: config.seed });
1390
+ const sharedSlice = (config) => {
1391
+ const faker = config.faker || createFaker(config.seed);
1392
+ const model = config.model || sharedSlice$1({ faker });
1362
1393
  const variationModel = faker.randomElement(model.variations);
1363
1394
  return sharedSliceVariation({
1364
- seed: config.seed,
1395
+ faker,
1365
1396
  model: variationModel,
1366
1397
  itemsCount: config.itemsCount,
1367
1398
  type: model.id,
@@ -1370,25 +1401,25 @@ const sharedSlice = (config = {}) => {
1370
1401
  });
1371
1402
  };
1372
1403
 
1373
- const sliceZone = (config = {}) => {
1374
- var _a;
1404
+ const sliceZone = (config) => {
1405
+ var _a, _b;
1375
1406
  if (config.state === "empty") {
1376
1407
  return [];
1377
1408
  } 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);
1409
+ const faker = config.faker || createFaker(config.seed);
1410
+ const model = config.model || sliceZone$1({ faker });
1411
+ if (((_a = model.config) == null ? void 0 : _a.choices) && Object.keys(model.config.choices).length > 0) {
1412
+ const itemsCount = (_b = config.itemsCount) != null ? _b : faker.range(1, 6);
1382
1413
  return Array(itemsCount).fill(void 0).map(() => {
1383
- var _a2;
1384
- const choices = Object.entries(model.config.choices);
1414
+ var _a2, _b2, _c, _d;
1415
+ const choices = ((_a2 = model.config) == null ? void 0 : _a2.choices) && Object.entries(model.config.choices) || [];
1385
1416
  const [choiceType, choiceModel] = faker.randomElement(choices);
1386
- const choiceLabels = model.config.labels[choiceType] || [];
1417
+ const choiceLabels = ((_c = (_b2 = model.config) == null ? void 0 : _b2.labels) == null ? void 0 : _c[choiceType]) || [];
1387
1418
  const choiceLabel = faker.randomElement(choiceLabels);
1388
1419
  switch (choiceModel.type) {
1389
1420
  case prismicT__namespace.CustomTypeModelSliceType.Slice: {
1390
1421
  return slice({
1391
- seed: config.seed,
1422
+ faker,
1392
1423
  model: choiceModel,
1393
1424
  type: choiceType,
1394
1425
  label: choiceLabel ? choiceLabel.name : null,
@@ -1397,10 +1428,10 @@ const sliceZone = (config = {}) => {
1397
1428
  });
1398
1429
  }
1399
1430
  case prismicT__namespace.CustomTypeModelSliceType.SharedSlice: {
1400
- const sharedSliceModel = (_a2 = config.sharedSliceModels) == null ? void 0 : _a2.find((sharedSliceModel2) => sharedSliceModel2.id === choiceType);
1431
+ const sharedSliceModel = (_d = config.sharedSliceModels) == null ? void 0 : _d.find((sharedSliceModel2) => sharedSliceModel2.id === choiceType);
1401
1432
  if (sharedSliceModel) {
1402
1433
  return sharedSlice({
1403
- seed: config.seed,
1434
+ faker,
1404
1435
  model: sharedSliceModel,
1405
1436
  primaryFieldConfigs: config.primaryFieldConfigs,
1406
1437
  itemsFieldConfigs: config.itemsFieldConfigs
@@ -1415,13 +1446,14 @@ const sliceZone = (config = {}) => {
1415
1446
  }
1416
1447
  };
1417
1448
 
1418
- const title = (config = {}) => {
1449
+ const title = (config) => {
1450
+ const faker = config.faker || createFaker(config.seed);
1419
1451
  if (config.state === "empty") {
1420
1452
  return [];
1421
1453
  } else {
1422
1454
  return [
1423
1455
  heading({
1424
- seed: config.seed,
1456
+ faker,
1425
1457
  model: config.model,
1426
1458
  pattern: config.pattern
1427
1459
  })
@@ -1429,8 +1461,8 @@ const title = (config = {}) => {
1429
1461
  }
1430
1462
  };
1431
1463
 
1432
- const uid = (config = {}) => {
1433
- const faker = createFaker(config.seed);
1464
+ const uid = (config) => {
1465
+ const faker = config.faker || createFaker(config.seed);
1434
1466
  return changeCase__namespace.snakeCase(faker.words(faker.range(1, 3)));
1435
1467
  };
1436
1468