@prismicio/mock 0.0.6 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/api/index.cjs +242 -122
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.ts +3 -2
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +669 -0
- package/dist/api/index.js.map +1 -0
- package/dist/index.cjs +581 -571
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +155 -247
- package/dist/{index.mjs → index.js} +574 -561
- package/dist/index.js.map +1 -0
- package/dist/model/index.cjs +294 -257
- package/dist/model/index.cjs.map +1 -0
- package/dist/model/index.d.ts +72 -106
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +556 -0
- package/dist/model/index.js.map +1 -0
- package/dist/value/index.cjs +500 -647
- package/dist/value/index.cjs.map +1 -0
- package/dist/value/index.d.ts +71 -129
- package/dist/value/index.d.ts.map +1 -0
- package/dist/value/index.js +1461 -0
- package/dist/value/index.js.map +1 -0
- package/package.json +30 -27
- package/src/api/query.ts +2 -2
- package/src/api/ref.ts +3 -3
- package/src/api/repository.ts +5 -5
- package/src/lib/buildContentRelationshipField.ts +6 -1
- package/src/lib/buildEmbedField.ts +16 -27
- package/src/lib/buildImageFieldImage.ts +49 -0
- package/src/lib/createFaker.ts +98 -20
- package/src/lib/generateCustomTypeId.ts +1 -1
- package/src/lib/generateFieldId.ts +1 -3
- package/src/lib/generateTags.ts +4 -12
- package/src/lib/getMockEmbedData.ts +33 -12
- package/src/lib/getMockImageData.ts +1 -1
- package/src/lib/lorem.ts +112 -0
- package/src/model/boolean.ts +1 -1
- package/src/model/buildMockGroupFieldMap.ts +65 -0
- package/src/model/color.ts +2 -2
- package/src/model/contentRelationship.ts +16 -23
- package/src/model/customType.ts +49 -48
- package/src/model/date.ts +2 -2
- package/src/model/embed.ts +2 -2
- package/src/model/geoPoint.ts +1 -1
- package/src/model/group.ts +9 -16
- package/src/model/image.ts +16 -20
- package/src/model/index.ts +2 -0
- package/src/model/integrationFields.ts +5 -3
- package/src/model/keyText.ts +2 -2
- package/src/model/link.ts +3 -3
- package/src/model/linkToMedia.ts +2 -2
- package/src/model/number.ts +2 -2
- package/src/model/richText.ts +6 -6
- package/src/model/select.ts +13 -18
- package/src/model/sharedSlice.ts +15 -42
- package/src/model/sharedSliceVariation.ts +36 -24
- package/src/model/slice.ts +19 -23
- package/src/model/sliceZone.ts +23 -59
- package/src/model/timestamp.ts +2 -2
- package/src/model/title.ts +5 -5
- package/src/model/uid.ts +2 -2
- package/src/types.ts +130 -88
- package/src/value/boolean.ts +1 -1
- package/src/value/color.ts +16 -6
- package/src/value/contentRelationship.ts +54 -39
- package/src/value/customType.ts +5 -5
- package/src/value/date.ts +25 -9
- package/src/value/embed.ts +32 -7
- package/src/value/geoPoint.ts +21 -11
- package/src/value/group.ts +31 -45
- package/src/value/image.ts +22 -9
- package/src/value/integrationFields.ts +26 -14
- package/src/value/keyText.ts +16 -6
- package/src/value/link.ts +36 -37
- package/src/value/linkToMedia.ts +19 -23
- package/src/value/number.ts +16 -6
- package/src/value/richText/embed.ts +2 -2
- package/src/value/richText/heading.ts +10 -17
- package/src/value/richText/image.ts +8 -6
- package/src/value/richText/index.ts +4 -9
- package/src/value/richText/list.ts +4 -8
- package/src/value/richText/oList.ts +4 -8
- package/src/value/richText/paragraph.ts +8 -4
- package/src/value/richText/preformatted.ts +9 -5
- package/src/value/select.ts +23 -8
- package/src/value/sharedSlice.ts +3 -3
- package/src/value/sharedSliceVariation.ts +4 -36
- package/src/value/slice.ts +3 -32
- package/src/value/sliceZone.ts +54 -69
- package/src/value/timestamp.ts +42 -16
- package/src/value/title.ts +26 -13
- package/src/value/uid.ts +2 -2
- package/dist/api/index.mjs +0 -515
- package/dist/model/index.mjs +0 -465
- package/dist/value/index.mjs +0 -1554
- package/src/lib/buildImageField.ts +0 -34
- package/src/lib/buildMockGroupFieldMap.ts +0 -84
package/README.md
CHANGED
|
@@ -36,7 +36,9 @@ Whether you're helping us fix bugs, improve the docs, or spread the word, we'd l
|
|
|
36
36
|
|
|
37
37
|
**Suggesting an improvement**: [Open an issue][repo-feature-request] explaining your improvement or feature so we can discuss and learn more.
|
|
38
38
|
|
|
39
|
-
**Submitting code changes**: For small fixes, feel free to [open a
|
|
39
|
+
**Submitting code changes**: For small fixes, feel free to [open a pull request][repo-pull-requests] with a description of your changes. For large changes, please first [open an issue][repo-feature-request] so we can discuss if and how the changes should be implemented.
|
|
40
|
+
|
|
41
|
+
For more clarity on this project and its structure you can also check out the detailed [CONTRIBUTING.md][contributing] document.
|
|
40
42
|
|
|
41
43
|
## License
|
|
42
44
|
|
|
@@ -64,6 +66,7 @@ Whether you're helping us fix bugs, improve the docs, or spread the word, we'd l
|
|
|
64
66
|
|
|
65
67
|
[prismic-docs]: https://prismic.io/docs
|
|
66
68
|
[changelog]: /CHANGELOG.md
|
|
69
|
+
[contributing]: ./CONTRIBUTING.md
|
|
67
70
|
|
|
68
71
|
<!-- TODO: Replace link with a more useful one if available -->
|
|
69
72
|
|
package/dist/api/index.cjs
CHANGED
|
@@ -3,70 +3,159 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const changeCase = require('change-case');
|
|
6
|
-
const
|
|
7
|
-
const Faker = require('faker/lib/index.js');
|
|
6
|
+
const Rand = require('rand-seed');
|
|
8
7
|
const prismicT = require('@prismicio/types');
|
|
9
8
|
|
|
10
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
10
|
|
|
12
11
|
function _interopNamespace(e) {
|
|
13
12
|
if (e && e.__esModule) return e;
|
|
14
|
-
|
|
13
|
+
const n = Object.create(null);
|
|
15
14
|
if (e) {
|
|
16
|
-
|
|
15
|
+
for (const k in e) {
|
|
17
16
|
if (k !== 'default') {
|
|
18
|
-
|
|
17
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
18
|
Object.defineProperty(n, k, d.get ? d : {
|
|
20
19
|
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return e[k];
|
|
23
|
-
}
|
|
20
|
+
get: function () { return e[k]; }
|
|
24
21
|
});
|
|
25
22
|
}
|
|
26
|
-
}
|
|
23
|
+
}
|
|
27
24
|
}
|
|
28
|
-
n[
|
|
25
|
+
n["default"] = e;
|
|
29
26
|
return Object.freeze(n);
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
const changeCase__namespace = /*#__PURE__*/_interopNamespace(changeCase);
|
|
33
|
-
const
|
|
34
|
-
const Faker__default = /*#__PURE__*/_interopDefaultLegacy(Faker);
|
|
30
|
+
const Rand__default = /*#__PURE__*/_interopDefaultLegacy(Rand);
|
|
35
31
|
const prismicT__namespace = /*#__PURE__*/_interopNamespace(prismicT);
|
|
36
32
|
|
|
37
33
|
const FAKER_SEED = 1984;
|
|
38
34
|
|
|
35
|
+
const wordsString = "lorem ipsum dolor sit amet, consectetur adipiscing elit ut aliquam, purus sit amet luctus venenatis, lectus magna fringilla urna, porttitor rhoncus dolor purus non enim praesent elementum facilisis leo, vel fringilla est ullamcorper eget nulla facilisi etiam dignissim diam quis enim lobortis scelerisque fermentum dui faucibus in ornare quam viverra orci sagittis eu volutpat odio facilisis mauris sit amet massa vitae tortor condimentum lacinia quis vel eros donec ac odio tempor orci dapibus ultrices in iaculis nunc sed augue lacus, viverra vitae congue eu, consequat ac felis donec et odio pellentesque diam volutpat commodo sed egestas egestas fringilla phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur vitae nunc sed velit dignissim sodales ut eu sem integer vitae justo eget magna fermentum iaculis eu non diam phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet enim tortor, at auctor urna nunc id cursus metus aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices sagittis orci, a scelerisque purus semper eget duis at tellus at urna condimentum mattis pellentesque id nibh tortor, id aliquet lectus proin nibh nisl, condimentum id venenatis a, condimentum vitae sapien pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas sed tempus, urna et pharetra pharetra, massa massa ultricies mi, quis hendrerit dolor magna eget est lorem ipsum dolor sit amet, consectetur adipiscing elit pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas integer eget aliquet nibh praesent tristique magna sit amet purus gravida quis blandit turpis cursus in hac habitasse platea dictumst quisque sagittis, purus sit amet volutpat consequat, mauris nunc congue nisi, vitae suscipit tellus mauris a diam maecenas sed enim ut sem viverra aliquet eget sit amet tellus cras adipiscing enim eu turpis egestas pretium aenean pharetra, magna ac placerat vestibulum, lectus mauris ultrices eros, in cursus turpis massa tincidunt dui ut ornare lectus sit amet est placerat in egestas erat imperdiet sed euismod nisi porta lorem mollis aliquam ut porttitor leo a diam sollicitudin tempor id eu nisl nunc mi ipsum, faucibus vitae aliquet nec, ullamcorper sit amet risus nullam eget felis eget nunc lobortis mattis aliquam faucibus purus in massa tempor nec feugiat nisl pretium fusce id velit ut tortor pretium viverra suspendisse potenti nullam ac tortor vitae purus faucibus ornare suspendisse sed nisi lacus, sed viverra tellus in hac habitasse platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus at augue eget arcu dictum varius duis at consectetur lorem donec massa sapien, faucibus et molestie ac, feugiat sed lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare massa, eget egestas purus viverra accumsan in nisl nisi, scelerisque eu ultrices vitae, auctor eu augue ut lectus arcu, bibendum at varius vel, pharetra vel turpis nunc eget lorem dolor, sed viverra ipsum nunc aliquet bibendum enim, facilisis gravida neque convallis a cras semper auctor neque, vitae tempus quam pellentesque nec nam aliquam sem et tortor consequat id porta nibh venenatis cras sed felis eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar elementum integer enim neque, volutpat ac tincidunt vitae, semper quis lectus nulla at volutpat diam ut venenatis tellus in metus vulputate eu scelerisque felis imperdiet proin fermentum leo vel orci porta non pulvinar neque laoreet suspendisse interdum consectetur libero, id faucibus nisl tincidunt eget nullam non nisi est, sit amet facilisis magna etiam tempor, orci eu lobortis elementum, nibh tellus molestie nunc, non blandit massa enim nec dui nunc mattis enim ut tellus elementum sagittis vitae et leo duis ut diam quam nulla porttitor massa id neque aliquam vestibulum morbi blandit cursus risus, at ultrices mi tempus imperdiet nulla malesuada pellentesque elit eget gravida cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus mauris vitae ultricies leo integer malesuada nunc vel risus commodo viverra maecenas accumsan, lacus vel facilisis volutpat, est velit egestas dui, id ornare arcu odio ut sem nulla pharetra diam sit amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet massa tincidunt nunc pulvinar sapien et ligula ullamcorper malesuada proin libero nunc, consequat interdum varius sit amet, mattis vulputate enim nulla aliquet porttitor lacus, luctus accumsan tortor posuere ac ut consequat semper viverra nam libero justo, laoreet sit amet cursus sit amet, dictum sit amet justo donec enim diam, vulputate ut pharetra sit amet, aliquam id diam maecenas ultricies mi eget mauris pharetra et ultrices neque ornare aenean euismod elementum nisi, quis eleifend quam adipiscing vitae proin sagittis, nisl rhoncus mattis rhoncus, urna neque viverra justo, nec ultrices dui sapien eget mi proin sed libero enim, sed faucibus turpis in eu mi bibendum neque egestas congue quisque egestas diam in arcu cursus euismod quis viverra nibh cras pulvinar mattis nunc, sed blandit libero volutpat sed cras ornare arcu dui vivamus arcu felis, bibendum ut tristique et, egestas quis ipsum suspendisse ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim enim, sit amet venenatis urna cursus eget nunc scelerisque viverra mauris, in aliquam sem fringilla ut morbi tincidunt augue interdum velit euismod in pellentesque massa placerat duis ultricies lacus sed turpis tincidunt id aliquet risus feugiat in ante metus, dictum at tempor commodo, ullamcorper a lacus vestibulum sed arcu non odio euismod lacinia at quis risus sed vulputate odio ut enim blandit volutpat maecenas volutpat blandit aliquam etiam erat velit, scelerisque in dictum non, consectetur a erat nam at lectus urna duis convallis convallis tellus, id interdum velit laoreet id donec ultrices tincidunt arcu, non sodales neque sodales ut etiam sit amet nisl purus, in mollis nunc sed id semper risus in hendrerit gravida rutrum quisque non tellus orci, ac auctor augue mauris augue neque, gravida in fermentum et, sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla facilisi cras fermentum, odio eu feugiat pretium, nibh ipsum consequat nisl, vel pretium lectus quam id leo in vitae turpis massa sed elementum tempus egestas sed sed risus pretium quam vulputate dignissim suspendisse in est ante in nibh mauris, cursus mattis molestie a, iaculis at erat pellentesque adipiscing commodo elit, at imperdiet dui accumsan sit amet nulla facilisi morbi tempus iaculis urna, id volutpat lacus laoreet non curabitur gravida arcu ac tortor dignissim convallis aenean et tortor at risus viverra adipiscing at in tellus integer feugiat scelerisque varius morbi enim nunc, faucibus a pellentesque sit amet, porttitor eget dolor morbi non arcu risus, quis varius quam quisque id diam vel quam elementum pulvinar etiam non quam lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit amet, consectetur adipiscing elit duis tristique sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas maecenas pharetra convallis posuere morbi leo urna, molestie at elementum eu, facilisis sed odio morbi quis commodo odio aenean sed adipiscing diam donec adipiscing tristique risus nec feugiat in fermentum posuere urna nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida hendrerit lectus a molestie";
|
|
36
|
+
const loremWords = wordsString.split(" ");
|
|
37
|
+
const lorem = (length, wordOffset = 0) => {
|
|
38
|
+
const count = parseInt(length.substring(0, length.length - 1));
|
|
39
|
+
const countType = length.charAt(length.length - 1);
|
|
40
|
+
if (!isNaN(count) && (countType === "w" || countType === "c")) {
|
|
41
|
+
if (!lorem.spaceIndices.length) {
|
|
42
|
+
let startIndex = -1;
|
|
43
|
+
do {
|
|
44
|
+
const index = wordsString.indexOf(" ", startIndex + 1);
|
|
45
|
+
lorem.spaceIndices.push(index);
|
|
46
|
+
startIndex = index;
|
|
47
|
+
} while (startIndex !== -1);
|
|
48
|
+
}
|
|
49
|
+
if (countType === "c") {
|
|
50
|
+
return wordsString.substring(0, count);
|
|
51
|
+
} else {
|
|
52
|
+
let sentence = "";
|
|
53
|
+
const startSpaceIndex = lorem.spaceIndices[wordOffset % lorem.spaceIndices.length - 1];
|
|
54
|
+
const endSpaceIndex = lorem.spaceIndices[(wordOffset % lorem.spaceIndices.length + count) % lorem.spaceIndices.length - 1];
|
|
55
|
+
if (count + wordOffset % lorem.spaceIndices.length > lorem.spaceIndices.length) {
|
|
56
|
+
sentence += wordsString.substring(startSpaceIndex + 1) + " ";
|
|
57
|
+
const wraparoundCounts = Math.floor(count / lorem.spaceIndices.length) - 1;
|
|
58
|
+
for (let i = 0; i < wraparoundCounts; i++) {
|
|
59
|
+
sentence += wordsString + " ";
|
|
60
|
+
}
|
|
61
|
+
sentence += wordsString.substring(0, endSpaceIndex);
|
|
62
|
+
} else {
|
|
63
|
+
sentence = wordsString.substring(startSpaceIndex + 1, endSpaceIndex);
|
|
64
|
+
}
|
|
65
|
+
if (sentence.charAt(sentence.length - 1) === ",") {
|
|
66
|
+
return sentence.substring(0, sentence.length - 1);
|
|
67
|
+
} else {
|
|
68
|
+
return sentence.substring(0, sentence.length);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw new Error("Length must be of the form `${number}w` or `${number}c`");
|
|
73
|
+
};
|
|
74
|
+
lorem.spaceIndices = [];
|
|
75
|
+
|
|
39
76
|
const createFaker = (seed = FAKER_SEED) => {
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
77
|
+
const normalizedSeed = seed.toString();
|
|
78
|
+
if (createFaker.cache[normalizedSeed]) {
|
|
79
|
+
return createFaker.cache[normalizedSeed];
|
|
43
80
|
} else {
|
|
44
|
-
|
|
81
|
+
const faker = new Faker(normalizedSeed);
|
|
82
|
+
return createFaker.cache[normalizedSeed] = faker;
|
|
45
83
|
}
|
|
46
|
-
const cacheKey = JSON.stringify(normalizedSeed);
|
|
47
|
-
if (createFaker.cache[cacheKey]) {
|
|
48
|
-
return createFaker.cache[cacheKey];
|
|
49
|
-
}
|
|
50
|
-
const fakerInstance = new Faker__default['default']();
|
|
51
|
-
fakerInstance.locales["en"] = fakerLocaleEN__namespace;
|
|
52
|
-
fakerInstance.seed(normalizedSeed);
|
|
53
|
-
createFaker.cache[cacheKey] = fakerInstance;
|
|
54
|
-
return fakerInstance;
|
|
55
84
|
};
|
|
56
85
|
createFaker.cache = {};
|
|
86
|
+
const DAY_MS = 1e3 * 60 * 60 * 24;
|
|
87
|
+
const YEAR_MS = DAY_MS * 365;
|
|
88
|
+
const YEAR_2022_MS = 52 * (YEAR_MS + DAY_MS / 4);
|
|
89
|
+
class Faker {
|
|
90
|
+
constructor(seed) {
|
|
91
|
+
this.rand = new Rand__default["default"](seed);
|
|
92
|
+
}
|
|
93
|
+
boolean() {
|
|
94
|
+
return this.random() >= 0.5;
|
|
95
|
+
}
|
|
96
|
+
random() {
|
|
97
|
+
return this.rand.next();
|
|
98
|
+
}
|
|
99
|
+
randomElement(elements) {
|
|
100
|
+
return elements[this.range(0, elements.length)];
|
|
101
|
+
}
|
|
102
|
+
randomElements(elements) {
|
|
103
|
+
return elements.filter(() => this.boolean());
|
|
104
|
+
}
|
|
105
|
+
range(min, max) {
|
|
106
|
+
return Math.floor(this.rangeFloat(Math.ceil(min), Math.floor(max)));
|
|
107
|
+
}
|
|
108
|
+
rangeFloat(min, max) {
|
|
109
|
+
return this.random() * (max - min) + min;
|
|
110
|
+
}
|
|
111
|
+
words(length, wordOffset = this.range(0, loremWords.length)) {
|
|
112
|
+
return lorem(`${length}w`, wordOffset);
|
|
113
|
+
}
|
|
114
|
+
word() {
|
|
115
|
+
return this.randomElement(loremWords);
|
|
116
|
+
}
|
|
117
|
+
lorem(length, wordOffset = this.range(0, loremWords.length)) {
|
|
118
|
+
return lorem(length, wordOffset);
|
|
119
|
+
}
|
|
120
|
+
url() {
|
|
121
|
+
return `https://${this.word()}.example`;
|
|
122
|
+
}
|
|
123
|
+
hexColor() {
|
|
124
|
+
return `#${this.hash(6)}`;
|
|
125
|
+
}
|
|
126
|
+
hash(length) {
|
|
127
|
+
let hash = "";
|
|
128
|
+
for (let i = 0; i < length; i++) {
|
|
129
|
+
const chars = this.boolean() ? "abcdef" : "0123456789";
|
|
130
|
+
hash += chars[this.range(0, chars.length)];
|
|
131
|
+
}
|
|
132
|
+
return hash;
|
|
133
|
+
}
|
|
134
|
+
date() {
|
|
135
|
+
return new Date(YEAR_2022_MS + this.range(-YEAR_MS * 3, YEAR_MS * 3));
|
|
136
|
+
}
|
|
137
|
+
dateAfter(date) {
|
|
138
|
+
const timestamp = date.getTime();
|
|
139
|
+
return new Date(this.range(timestamp, timestamp + YEAR_MS * 3));
|
|
140
|
+
}
|
|
141
|
+
dateBefore(date) {
|
|
142
|
+
const timestamp = date.getTime();
|
|
143
|
+
return new Date(this.range(timestamp - YEAR_MS * 3, timestamp));
|
|
144
|
+
}
|
|
145
|
+
dateBetween(min, max) {
|
|
146
|
+
return new Date(this.range(min.getTime(), max.getTime()));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
57
149
|
|
|
58
150
|
const generateTags = (config) => {
|
|
59
151
|
var _a, _b;
|
|
60
152
|
const faker = createFaker(config.seed);
|
|
61
|
-
return Array(faker.
|
|
62
|
-
min: (_a = config.min) != null ? _a : 0,
|
|
63
|
-
max: (_b = config.max) != null ? _b : 2
|
|
64
|
-
})).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))));
|
|
65
154
|
};
|
|
66
155
|
|
|
67
156
|
const title = (config = {}) => {
|
|
68
157
|
const faker = createFaker(config.seed);
|
|
69
|
-
const single = faker.
|
|
158
|
+
const single = faker.randomElements([
|
|
70
159
|
"heading1",
|
|
71
160
|
"heading2",
|
|
72
161
|
"heading3",
|
|
@@ -77,122 +166,155 @@ const title = (config = {}) => {
|
|
|
77
166
|
return {
|
|
78
167
|
type: prismicT__namespace.CustomTypeModelFieldType.StructuredText,
|
|
79
168
|
config: {
|
|
80
|
-
label: changeCase__namespace.capitalCase(faker.
|
|
81
|
-
placeholder: changeCase__namespace.sentenceCase(faker.
|
|
169
|
+
label: changeCase__namespace.capitalCase(faker.word()),
|
|
170
|
+
placeholder: changeCase__namespace.sentenceCase(faker.words(3)),
|
|
82
171
|
single,
|
|
83
|
-
allowTargetBlank: faker.
|
|
172
|
+
allowTargetBlank: faker.boolean() || void 0
|
|
84
173
|
}
|
|
85
174
|
};
|
|
86
175
|
};
|
|
87
176
|
|
|
88
177
|
const timestamp = (config = {}) => {
|
|
89
178
|
const faker = createFaker(config.seed);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
+
}
|
|
93
196
|
};
|
|
94
197
|
|
|
95
198
|
const buildEmbedField = (config) => {
|
|
199
|
+
var _a;
|
|
96
200
|
const faker = createFaker(config.seed);
|
|
97
201
|
return {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
title: changeCase__namespace.capitalCase(faker.lorem.words(3)),
|
|
102
|
-
version: faker.datatype.number({ min: 1, max: 3, precision: 10 }).toString(),
|
|
103
|
-
cache_age: faker.datatype.number(),
|
|
104
|
-
embed_url: config.embedData.embed_url,
|
|
105
|
-
author_url: faker.internet.url(),
|
|
106
|
-
author_name: faker.company.companyName(),
|
|
107
|
-
provider_name: faker.company.companyName(),
|
|
108
|
-
thumbnail_width: config.embedData.thumbnail_width,
|
|
109
|
-
thumbnail_height: config.embedData.thumbnail_height,
|
|
110
|
-
thumbnail_url: config.embedData.thumbnail_url,
|
|
111
|
-
width: faker.datatype.number({ min: 200, max: 500 }),
|
|
112
|
-
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
|
|
113
205
|
};
|
|
114
206
|
};
|
|
115
207
|
|
|
116
208
|
const dataSet$1 = [
|
|
117
209
|
{
|
|
118
|
-
|
|
210
|
+
version: "1.0",
|
|
211
|
+
type: "video",
|
|
119
212
|
embed_url: "https://www.youtube.com/embed/fiOwHYFkUz0",
|
|
120
213
|
thumbnail_url: "https://i.ytimg.com/vi/fiOwHYFkUz0/hqdefault.jpg",
|
|
121
214
|
thumbnail_height: 360,
|
|
122
215
|
thumbnail_width: 480,
|
|
123
|
-
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
|
|
124
219
|
},
|
|
125
220
|
{
|
|
126
|
-
|
|
221
|
+
version: "1.0",
|
|
222
|
+
type: "video",
|
|
127
223
|
embed_url: "https://www.youtube.com/embed/c-ATzcy6VkI",
|
|
128
224
|
thumbnail_url: "https://i.ytimg.com/vi/c-ATzcy6VkI/hqdefault.jpg",
|
|
129
225
|
thumbnail_height: 360,
|
|
130
226
|
thumbnail_width: 480,
|
|
131
|
-
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
|
|
132
230
|
},
|
|
133
231
|
{
|
|
134
|
-
|
|
232
|
+
version: "1.0",
|
|
233
|
+
type: "video",
|
|
135
234
|
embed_url: "https://www.youtube.com/watch?v=fiOwHYFkUz0",
|
|
136
235
|
thumbnail_url: "https://i.ytimg.com/vi/iewZXv94XGY/hqdefault.jpg",
|
|
137
236
|
thumbnail_height: 360,
|
|
138
237
|
thumbnail_width: 480,
|
|
139
|
-
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
|
|
140
241
|
},
|
|
141
242
|
{
|
|
142
|
-
|
|
143
|
-
|
|
243
|
+
version: "1.0",
|
|
244
|
+
type: "rich",
|
|
245
|
+
embed_url: "https://twitter.com/prismicio/status/1356293316158095361",
|
|
144
246
|
thumbnail_url: null,
|
|
145
247
|
thumbnail_height: null,
|
|
146
248
|
thumbnail_width: null,
|
|
147
|
-
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Gatsby is a popular choice for Prismic users and we work hard on delivering a CMS that plays to its strengths.<br><br>But, what makes <a href="https://twitter.com/GatsbyJS?ref_src=twsrc%5Etfw">@GatsbyJS</a> so popular?<br><br>Here are some of <a href="https://twitter.com/mxstbr?ref_src=twsrc%5Etfw">@mxstbr</a>'s thoughts on Gatsby's success and how they're improving developer experience.<a href="https://t.co/ZjCPvsWWUD">https://t.co/ZjCPvsWWUD</a> <a href="https://t.co/EQqzJpeNKl">pic.twitter.com/EQqzJpeNKl</a></p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1356293316158095361?ref_src=twsrc%5Etfw">February 1, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n'
|
|
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>'s thoughts on Gatsby's success and how they're improving developer experience.<a href="https://t.co/ZjCPvsWWUD">https://t.co/ZjCPvsWWUD</a> <a href="https://t.co/EQqzJpeNKl">pic.twitter.com/EQqzJpeNKl</a></p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1356293316158095361?ref_src=twsrc%5Etfw">February 1, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
250
|
+
width: 200,
|
|
251
|
+
height: 113
|
|
148
252
|
},
|
|
149
253
|
{
|
|
150
|
-
|
|
254
|
+
type: "rich",
|
|
255
|
+
version: "1.0",
|
|
256
|
+
embed_url: "https://twitter.com/timbenniks/status/1304146886832594944",
|
|
151
257
|
thumbnail_url: null,
|
|
152
258
|
thumbnail_width: null,
|
|
153
259
|
thumbnail_height: null,
|
|
154
|
-
|
|
155
|
-
|
|
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&ref_src=twsrc%5Etfw">#slicemachine</a> today. I made all my own components and I used custom slices. It works like a charm with <a href="https://twitter.com/nuxt_js?ref_src=twsrc%5Etfw">@nuxt_js</a>. Also: I\u2019m coding with this view. <a href="https://t.co/F0I8X9gz39">pic.twitter.com/F0I8X9gz39</a></p>— Tim Benniks (@timbenniks) <a href="https://twitter.com/timbenniks/status/1304146886832594944?ref_src=twsrc%5Etfw">September 10, 2020</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
261
|
+
width: 200,
|
|
262
|
+
height: 113
|
|
156
263
|
},
|
|
157
264
|
{
|
|
158
|
-
|
|
265
|
+
version: "1.0",
|
|
266
|
+
type: "rich",
|
|
267
|
+
embed_url: "https://twitter.com/prismicio/status/1354112310252630016",
|
|
159
268
|
thumbnail_url: null,
|
|
160
269
|
thumbnail_width: null,
|
|
161
270
|
thumbnail_height: null,
|
|
162
|
-
|
|
163
|
-
|
|
271
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">We're launching a new <a href="https://twitter.com/hashtag/SliceContest?src=hash&ref_src=twsrc%5Etfw">#SliceContest</a> tomorrow along with Slice Machine upgrades.<br><br>Want to know more? Join us at tomorrow's Product Meet-up\u{1F447}<a href="https://t.co/prYSypiAvB">https://t.co/prYSypiAvB</a><br><br>We can't tell you any further details for now, but here's a sneak peek at the prizes\u{1F440} <a href="https://t.co/fV1eoGlEBh">pic.twitter.com/fV1eoGlEBh</a></p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1354112310252630016?ref_src=twsrc%5Etfw">January 26, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
272
|
+
width: 200,
|
|
273
|
+
height: 113
|
|
164
274
|
},
|
|
165
275
|
{
|
|
166
|
-
|
|
276
|
+
version: "1.0",
|
|
277
|
+
type: "rich",
|
|
278
|
+
embed_url: "https://twitter.com/prismicio/status/1354835716430319617",
|
|
167
279
|
thumbnail_url: null,
|
|
168
280
|
thumbnail_width: null,
|
|
169
281
|
thumbnail_height: null,
|
|
170
|
-
|
|
171
|
-
|
|
282
|
+
html: '<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Does anyone want to create a wildly popular website for discussing 'Wall Street Bets' using Prismic?<br><br>It may or may not have to look a lot like <a href="https://twitter.com/hashtag/reddit?src=hash&ref_src=twsrc%5Etfw">#reddit</a> and we won't make it private.<br><br>Just asking for some friends...</p>— Prismic (@prismicio) <a href="https://twitter.com/prismicio/status/1354835716430319617?ref_src=twsrc%5Etfw">January 28, 2021</a></blockquote>\n<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"><\/script>\n',
|
|
283
|
+
width: 200,
|
|
284
|
+
height: 113
|
|
172
285
|
}
|
|
173
286
|
];
|
|
174
287
|
const getMockEmbedData = (config) => {
|
|
175
288
|
const faker = createFaker(config.seed);
|
|
176
|
-
return faker.
|
|
289
|
+
return faker.randomElement(dataSet$1);
|
|
177
290
|
};
|
|
178
291
|
|
|
179
|
-
const
|
|
292
|
+
const buildImageFieldImage = (config) => {
|
|
180
293
|
var _a, _b, _c, _d;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
294
|
+
if (config.state === "empty") {
|
|
295
|
+
return {
|
|
296
|
+
url: null,
|
|
297
|
+
dimensions: null,
|
|
298
|
+
alt: null,
|
|
299
|
+
copyright: null
|
|
300
|
+
};
|
|
301
|
+
} else {
|
|
302
|
+
const faker = createFaker(config.seed);
|
|
303
|
+
const url = new URL(config.imageData.url);
|
|
304
|
+
const dimensions = {
|
|
305
|
+
width: (_b = (_a = config.constraint) == null ? void 0 : _a.width) != null ? _b : config.imageData.width,
|
|
306
|
+
height: (_d = (_c = config.constraint) == null ? void 0 : _c.height) != null ? _d : config.imageData.height
|
|
307
|
+
};
|
|
308
|
+
url.searchParams.set("w", dimensions.width.toString());
|
|
309
|
+
url.searchParams.set("h", dimensions.height.toString());
|
|
310
|
+
url.searchParams.set("fit", "crop");
|
|
311
|
+
return {
|
|
312
|
+
url: url.toString(),
|
|
313
|
+
dimensions,
|
|
314
|
+
alt: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
|
|
315
|
+
copyright: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15)))
|
|
316
|
+
};
|
|
317
|
+
}
|
|
196
318
|
};
|
|
197
319
|
|
|
198
320
|
const dataSet = [
|
|
@@ -279,7 +401,7 @@ const dataSet = [
|
|
|
279
401
|
];
|
|
280
402
|
const getMockImageData = (config) => {
|
|
281
403
|
const faker = createFaker(config.seed);
|
|
282
|
-
return faker.
|
|
404
|
+
return faker.randomElement(dataSet);
|
|
283
405
|
};
|
|
284
406
|
|
|
285
407
|
const patterns$4 = {
|
|
@@ -307,16 +429,13 @@ const heading = (config = {}) => {
|
|
|
307
429
|
prismicT__namespace.RichTextNodeType.heading5,
|
|
308
430
|
prismicT__namespace.RichTextNodeType.heading6
|
|
309
431
|
].includes(type2));
|
|
310
|
-
const type = faker.
|
|
432
|
+
const type = faker.randomElement(types);
|
|
311
433
|
if (type) {
|
|
312
|
-
const patternKey = config.pattern || faker.
|
|
434
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$4));
|
|
313
435
|
const pattern = patterns$4[patternKey];
|
|
314
436
|
return {
|
|
315
437
|
type,
|
|
316
|
-
text: changeCase__namespace.capitalCase(faker.
|
|
317
|
-
min: pattern.minWords,
|
|
318
|
-
max: pattern.maxWords
|
|
319
|
-
}))),
|
|
438
|
+
text: changeCase__namespace.capitalCase(faker.words(faker.range(pattern.minWords, pattern.maxWords))),
|
|
320
439
|
spans: []
|
|
321
440
|
};
|
|
322
441
|
} else {
|
|
@@ -337,11 +456,12 @@ const patterns$3 = {
|
|
|
337
456
|
};
|
|
338
457
|
const paragraph = (config = {}) => {
|
|
339
458
|
const faker = createFaker(config.seed);
|
|
340
|
-
const patternKey = config.pattern || faker.
|
|
459
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$3));
|
|
341
460
|
const pattern = patterns$3[patternKey];
|
|
461
|
+
const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
|
|
342
462
|
return {
|
|
343
463
|
type: prismicT__namespace.RichTextNodeType.paragraph,
|
|
344
|
-
text
|
|
464
|
+
text,
|
|
345
465
|
spans: []
|
|
346
466
|
};
|
|
347
467
|
};
|
|
@@ -359,11 +479,12 @@ const patterns$2 = {
|
|
|
359
479
|
};
|
|
360
480
|
const preformatted = (config = {}) => {
|
|
361
481
|
const faker = createFaker(config.seed);
|
|
362
|
-
const patternKey = config.pattern || faker.
|
|
482
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$2));
|
|
363
483
|
const pattern = patterns$2[patternKey];
|
|
484
|
+
const text = Array.from({ length: pattern.sentenceCount }, () => changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))) + ".").join(" ");
|
|
364
485
|
return {
|
|
365
486
|
type: prismicT__namespace.RichTextNodeType.preformatted,
|
|
366
|
-
text
|
|
487
|
+
text,
|
|
367
488
|
spans: []
|
|
368
489
|
};
|
|
369
490
|
};
|
|
@@ -384,16 +505,13 @@ const patterns$1 = {
|
|
|
384
505
|
};
|
|
385
506
|
const list = (config = {}) => {
|
|
386
507
|
const faker = createFaker(config.seed);
|
|
387
|
-
const patternKey = config.pattern || faker.
|
|
508
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns$1));
|
|
388
509
|
const pattern = patterns$1[patternKey];
|
|
389
|
-
const itemsCount = faker.
|
|
390
|
-
min: pattern.minItems,
|
|
391
|
-
max: pattern.maxItems
|
|
392
|
-
});
|
|
510
|
+
const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
|
|
393
511
|
return Array(itemsCount).fill(void 0).map(() => {
|
|
394
512
|
return {
|
|
395
513
|
type: prismicT__namespace.RichTextNodeType.listItem,
|
|
396
|
-
text: faker.
|
|
514
|
+
text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
|
|
397
515
|
spans: []
|
|
398
516
|
};
|
|
399
517
|
});
|
|
@@ -415,16 +533,13 @@ const patterns = {
|
|
|
415
533
|
};
|
|
416
534
|
const oList = (config = {}) => {
|
|
417
535
|
const faker = createFaker(config.seed);
|
|
418
|
-
const patternKey = config.pattern || faker.
|
|
536
|
+
const patternKey = config.pattern || faker.randomElement(Object.keys(patterns));
|
|
419
537
|
const pattern = patterns[patternKey];
|
|
420
|
-
const itemsCount = faker.
|
|
421
|
-
min: pattern.minItems,
|
|
422
|
-
max: pattern.maxItems
|
|
423
|
-
});
|
|
538
|
+
const itemsCount = faker.range(pattern.minItems, pattern.maxItems);
|
|
424
539
|
return Array(itemsCount).fill(void 0).map(() => {
|
|
425
540
|
return {
|
|
426
541
|
type: prismicT__namespace.RichTextNodeType.oListItem,
|
|
427
|
-
text: faker.
|
|
542
|
+
text: changeCase__namespace.sentenceCase(faker.words(faker.range(5, 15))),
|
|
428
543
|
spans: []
|
|
429
544
|
};
|
|
430
545
|
});
|
|
@@ -432,7 +547,11 @@ const oList = (config = {}) => {
|
|
|
432
547
|
|
|
433
548
|
const image = (config = {}) => {
|
|
434
549
|
const imageData = getMockImageData({ seed: config.seed });
|
|
435
|
-
const imageField =
|
|
550
|
+
const imageField = buildImageFieldImage({
|
|
551
|
+
seed: config.seed,
|
|
552
|
+
imageData,
|
|
553
|
+
state: "filled"
|
|
554
|
+
});
|
|
436
555
|
return {
|
|
437
556
|
type: prismicT__namespace.RichTextNodeType.image,
|
|
438
557
|
alt: imageField.alt,
|
|
@@ -443,8 +562,8 @@ const image = (config = {}) => {
|
|
|
443
562
|
};
|
|
444
563
|
|
|
445
564
|
const embed = (config = {}) => {
|
|
446
|
-
const
|
|
447
|
-
const embedField = buildEmbedField({ seed: config.seed,
|
|
565
|
+
const data = getMockEmbedData({ seed: config.seed });
|
|
566
|
+
const embedField = buildEmbedField({ seed: config.seed, data });
|
|
448
567
|
return {
|
|
449
568
|
type: prismicT__namespace.RichTextNodeType.embed,
|
|
450
569
|
oembed: embedField
|
|
@@ -470,10 +589,10 @@ const ref = (config = {}) => {
|
|
|
470
589
|
var _a;
|
|
471
590
|
const faker = createFaker(config.seed);
|
|
472
591
|
const value = {
|
|
473
|
-
id: faker.
|
|
474
|
-
ref: faker.
|
|
592
|
+
id: faker.hash(16),
|
|
593
|
+
ref: faker.hash(16),
|
|
475
594
|
isMasterRef: (_a = config.isMasterRef) != null ? _a : false,
|
|
476
|
-
label: config.isMasterRef ? "Master" : changeCase__namespace.capitalCase(faker.
|
|
595
|
+
label: config.isMasterRef ? "Master" : changeCase__namespace.capitalCase(faker.words(faker.range(1, 3)))
|
|
477
596
|
};
|
|
478
597
|
if (config.isScheduled) {
|
|
479
598
|
value.scheduledAt = timestamp({ seed: config.seed });
|
|
@@ -496,8 +615,8 @@ const repository = (config = {}) => {
|
|
|
496
615
|
types,
|
|
497
616
|
languages: [
|
|
498
617
|
{
|
|
499
|
-
id: faker.
|
|
500
|
-
name: changeCase__namespace.capitalCase(faker.
|
|
618
|
+
id: faker.word(),
|
|
619
|
+
name: changeCase__namespace.capitalCase(faker.word())
|
|
501
620
|
}
|
|
502
621
|
],
|
|
503
622
|
tags: generateTags({
|
|
@@ -507,11 +626,11 @@ const repository = (config = {}) => {
|
|
|
507
626
|
}),
|
|
508
627
|
forms: {},
|
|
509
628
|
license: "All Rights Reserved",
|
|
510
|
-
version: faker.
|
|
629
|
+
version: faker.hash(7),
|
|
511
630
|
bookmarks: {},
|
|
512
631
|
experiments: {},
|
|
513
|
-
oauth_token: faker.
|
|
514
|
-
oauth_initiate: faker.
|
|
632
|
+
oauth_token: faker.url(),
|
|
633
|
+
oauth_initiate: faker.url()
|
|
515
634
|
};
|
|
516
635
|
};
|
|
517
636
|
|
|
@@ -525,8 +644,8 @@ const query = (config = {}) => {
|
|
|
525
644
|
const results = documents.slice((page - 1) * pageSize, page * pageSize);
|
|
526
645
|
return {
|
|
527
646
|
page,
|
|
528
|
-
next_page: page < totalPages ? faker.
|
|
529
|
-
prev_page: page > 1 ? faker.
|
|
647
|
+
next_page: page < totalPages ? faker.url() : null,
|
|
648
|
+
prev_page: page > 1 ? faker.url() : null,
|
|
530
649
|
total_pages: totalPages,
|
|
531
650
|
results_size: results.length,
|
|
532
651
|
results_per_page: pageSize,
|
|
@@ -547,3 +666,4 @@ exports.query = query;
|
|
|
547
666
|
exports.ref = ref;
|
|
548
667
|
exports.repository = repository;
|
|
549
668
|
exports.tags = tags;
|
|
669
|
+
//# sourceMappingURL=index.cjs.map
|