@prismicio/mock 0.6.0-alpha.0 → 0.6.0-alpha.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.
- package/dist/api/ref.cjs +2 -19
- package/dist/api/ref.cjs.map +1 -1
- package/dist/api/ref.js +2 -2
- package/dist/api/ref.js.map +1 -1
- package/dist/api/repository.cjs +2 -19
- package/dist/api/repository.cjs.map +1 -1
- package/dist/api/repository.js +2 -2
- package/dist/api/repository.js.map +1 -1
- package/dist/lib/buildImageFieldImage.cjs +3 -20
- package/dist/lib/buildImageFieldImage.cjs.map +1 -1
- package/dist/lib/buildImageFieldImage.js +3 -3
- package/dist/lib/buildImageFieldImage.js.map +1 -1
- package/dist/lib/changeCase.cjs +12 -0
- package/dist/lib/changeCase.cjs.map +1 -0
- package/dist/lib/changeCase.d.ts +4 -0
- package/dist/lib/changeCase.js +12 -0
- package/dist/lib/changeCase.js.map +1 -0
- package/dist/lib/generateCustomTypeId.cjs +2 -19
- package/dist/lib/generateCustomTypeId.cjs.map +1 -1
- package/dist/lib/generateCustomTypeId.js +2 -2
- package/dist/lib/generateCustomTypeId.js.map +1 -1
- package/dist/lib/generateFieldId.cjs +2 -19
- package/dist/lib/generateFieldId.cjs.map +1 -1
- package/dist/lib/generateFieldId.js +2 -2
- package/dist/lib/generateFieldId.js.map +1 -1
- package/dist/lib/generateTags.cjs +2 -19
- package/dist/lib/generateTags.cjs.map +1 -1
- package/dist/lib/generateTags.js +2 -2
- package/dist/lib/generateTags.js.map +1 -1
- package/dist/model/boolean.cjs +2 -3
- package/dist/model/boolean.cjs.map +1 -1
- package/dist/model/boolean.js +2 -2
- package/dist/model/boolean.js.map +1 -1
- package/dist/model/color.cjs +3 -4
- package/dist/model/color.cjs.map +1 -1
- package/dist/model/color.js +3 -3
- package/dist/model/color.js.map +1 -1
- package/dist/model/contentRelationship.cjs +3 -4
- package/dist/model/contentRelationship.cjs.map +1 -1
- package/dist/model/contentRelationship.js +3 -3
- package/dist/model/contentRelationship.js.map +1 -1
- package/dist/model/customType.cjs +5 -22
- package/dist/model/customType.cjs.map +1 -1
- package/dist/model/customType.js +5 -5
- package/dist/model/customType.js.map +1 -1
- package/dist/model/date.cjs +3 -4
- package/dist/model/date.cjs.map +1 -1
- package/dist/model/date.js +3 -3
- package/dist/model/date.js.map +1 -1
- package/dist/model/embed.cjs +3 -4
- package/dist/model/embed.cjs.map +1 -1
- package/dist/model/embed.js +3 -3
- package/dist/model/embed.js.map +1 -1
- package/dist/model/geoPoint.cjs +2 -3
- package/dist/model/geoPoint.cjs.map +1 -1
- package/dist/model/geoPoint.js +2 -2
- package/dist/model/geoPoint.js.map +1 -1
- package/dist/model/group.cjs +2 -3
- package/dist/model/group.cjs.map +1 -1
- package/dist/model/group.js +2 -2
- package/dist/model/group.js.map +1 -1
- package/dist/model/image.cjs +2 -3
- package/dist/model/image.cjs.map +1 -1
- package/dist/model/image.js +2 -2
- package/dist/model/image.js.map +1 -1
- package/dist/model/integration.cjs +3 -4
- package/dist/model/integration.cjs.map +1 -1
- package/dist/model/integration.js +3 -3
- package/dist/model/integration.js.map +1 -1
- package/dist/model/keyText.cjs +3 -4
- package/dist/model/keyText.cjs.map +1 -1
- package/dist/model/keyText.js +3 -3
- package/dist/model/keyText.js.map +1 -1
- package/dist/model/link.cjs +3 -4
- package/dist/model/link.cjs.map +1 -1
- package/dist/model/link.js +3 -3
- package/dist/model/link.js.map +1 -1
- package/dist/model/linkToMedia.cjs +3 -4
- package/dist/model/linkToMedia.cjs.map +1 -1
- package/dist/model/linkToMedia.js +3 -3
- package/dist/model/linkToMedia.js.map +1 -1
- package/dist/model/number.cjs +3 -4
- package/dist/model/number.cjs.map +1 -1
- package/dist/model/number.js +3 -3
- package/dist/model/number.js.map +1 -1
- package/dist/model/richText.cjs +3 -4
- package/dist/model/richText.cjs.map +1 -1
- package/dist/model/richText.js +3 -3
- package/dist/model/richText.js.map +1 -1
- package/dist/model/select.cjs +3 -4
- package/dist/model/select.cjs.map +1 -1
- package/dist/model/select.js +3 -3
- package/dist/model/select.js.map +1 -1
- package/dist/model/sharedSlice.cjs +6 -7
- package/dist/model/sharedSlice.cjs.map +1 -1
- package/dist/model/sharedSlice.js +6 -6
- package/dist/model/sharedSlice.js.map +1 -1
- package/dist/model/sharedSliceVariation.cjs +6 -23
- package/dist/model/sharedSliceVariation.cjs.map +1 -1
- package/dist/model/sharedSliceVariation.js +6 -6
- package/dist/model/sharedSliceVariation.js.map +1 -1
- package/dist/model/slice.cjs +4 -5
- package/dist/model/slice.cjs.map +1 -1
- package/dist/model/slice.js +4 -4
- package/dist/model/slice.js.map +1 -1
- package/dist/model/timestamp.cjs +3 -4
- package/dist/model/timestamp.cjs.map +1 -1
- package/dist/model/timestamp.js +3 -3
- package/dist/model/timestamp.js.map +1 -1
- package/dist/model/title.cjs +3 -4
- package/dist/model/title.cjs.map +1 -1
- package/dist/model/title.js +3 -3
- package/dist/model/title.js.map +1 -1
- package/dist/model/uid.cjs +3 -4
- package/dist/model/uid.cjs.map +1 -1
- package/dist/model/uid.js +3 -3
- package/dist/model/uid.js.map +1 -1
- package/dist/value/customType.cjs +2 -3
- package/dist/value/customType.cjs.map +1 -1
- package/dist/value/customType.js +2 -2
- package/dist/value/customType.js.map +1 -1
- package/dist/value/keyText.cjs +2 -19
- package/dist/value/keyText.cjs.map +1 -1
- package/dist/value/keyText.js +2 -2
- package/dist/value/keyText.js.map +1 -1
- package/dist/value/link.cjs +2 -3
- package/dist/value/link.cjs.map +1 -1
- package/dist/value/link.js +2 -2
- package/dist/value/link.js.map +1 -1
- package/dist/value/linkToMedia.cjs +4 -5
- package/dist/value/linkToMedia.cjs.map +1 -1
- package/dist/value/linkToMedia.js +4 -4
- package/dist/value/linkToMedia.js.map +1 -1
- package/dist/value/richText/heading.cjs +2 -3
- package/dist/value/richText/heading.cjs.map +1 -1
- package/dist/value/richText/heading.js +2 -2
- package/dist/value/richText/heading.js.map +1 -1
- package/dist/value/richText/list.cjs +2 -3
- package/dist/value/richText/list.cjs.map +1 -1
- package/dist/value/richText/list.js +2 -2
- package/dist/value/richText/list.js.map +1 -1
- package/dist/value/richText/oList.cjs +2 -3
- package/dist/value/richText/oList.cjs.map +1 -1
- package/dist/value/richText/oList.js +2 -2
- package/dist/value/richText/oList.js.map +1 -1
- package/dist/value/richText/paragraph.cjs +2 -3
- package/dist/value/richText/paragraph.cjs.map +1 -1
- package/dist/value/richText/paragraph.js +2 -2
- package/dist/value/richText/paragraph.js.map +1 -1
- package/dist/value/richText/preformatted.cjs +2 -3
- package/dist/value/richText/preformatted.cjs.map +1 -1
- package/dist/value/richText/preformatted.js +2 -2
- package/dist/value/richText/preformatted.js.map +1 -1
- package/dist/value/slice.cjs +2 -19
- package/dist/value/slice.cjs.map +1 -1
- package/dist/value/slice.js +2 -2
- package/dist/value/slice.js.map +1 -1
- package/dist/value/uid.cjs +2 -19
- package/dist/value/uid.cjs.map +1 -1
- package/dist/value/uid.js +2 -2
- package/dist/value/uid.js.map +1 -1
- package/package.json +2 -5
- package/src/api/ref.ts +2 -2
- package/src/api/repository.ts +2 -2
- package/src/lib/buildImageFieldImage.ts +3 -3
- package/src/lib/changeCase.ts +14 -0
- package/src/lib/generateCustomTypeId.ts +2 -3
- package/src/lib/generateFieldId.ts +2 -3
- package/src/lib/generateTags.ts +2 -3
- package/src/model/boolean.ts +2 -2
- package/src/model/color.ts +3 -3
- package/src/model/contentRelationship.ts +3 -3
- package/src/model/customType.ts +5 -5
- package/src/model/date.ts +3 -3
- package/src/model/embed.ts +3 -3
- package/src/model/geoPoint.ts +2 -2
- package/src/model/group.ts +2 -2
- package/src/model/image.ts +2 -2
- package/src/model/integration.ts +3 -3
- package/src/model/keyText.ts +3 -3
- package/src/model/link.ts +3 -3
- package/src/model/linkToMedia.ts +3 -3
- package/src/model/number.ts +3 -3
- package/src/model/richText.ts +3 -3
- package/src/model/select.ts +3 -3
- package/src/model/sharedSlice.ts +11 -7
- package/src/model/sharedSliceVariation.ts +11 -7
- package/src/model/slice.ts +4 -4
- package/src/model/timestamp.ts +3 -3
- package/src/model/title.ts +3 -3
- package/src/model/uid.ts +3 -3
- package/src/value/customType.ts +2 -2
- package/src/value/keyText.ts +2 -2
- package/src/value/link.ts +2 -2
- package/src/value/linkToMedia.ts +4 -4
- package/src/value/richText/heading.ts +2 -2
- package/src/value/richText/list.ts +2 -2
- package/src/value/richText/oList.ts +2 -2
- package/src/value/richText/paragraph.ts +2 -2
- package/src/value/richText/preformatted.ts +2 -2
- package/src/value/slice.ts +2 -2
- package/src/value/uid.ts +2 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { snakeCase } from "../lib/changeCase";
|
|
3
2
|
import { createFaker, Faker } from "../lib/createFaker";
|
|
4
3
|
|
|
5
4
|
import { Seed } from "../types";
|
|
@@ -17,5 +16,5 @@ type GenerateFieldIdConfig =
|
|
|
17
16
|
export const generateFieldId = (config: GenerateFieldIdConfig): string => {
|
|
18
17
|
const faker = config.faker || createFaker(config.seed);
|
|
19
18
|
|
|
20
|
-
return
|
|
19
|
+
return snakeCase(faker.words(faker.range(1, 3)));
|
|
21
20
|
};
|
package/src/lib/generateTags.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { capitalCase } from "../lib/changeCase";
|
|
3
2
|
import { createFaker, Faker } from "../lib/createFaker";
|
|
4
3
|
|
|
5
4
|
import { Seed } from "../types";
|
|
@@ -23,6 +22,6 @@ export const generateTags = (config: GenerateTagsConfig): string[] => {
|
|
|
23
22
|
|
|
24
23
|
return Array.from(
|
|
25
24
|
{ length: faker.range(config.min ?? 0, config.max ?? 2) },
|
|
26
|
-
() =>
|
|
25
|
+
() => capitalCase(faker.words(faker.range(1, 3))),
|
|
27
26
|
);
|
|
28
27
|
};
|
package/src/model/boolean.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,7 +15,7 @@ export function boolean(
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Boolean,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
}
|
package/src/model/color.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const color = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Color,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -24,8 +24,8 @@ export const contentRelationship = <
|
|
|
24
24
|
return {
|
|
25
25
|
type: prismic.CustomTypeModelFieldType.Link,
|
|
26
26
|
config: {
|
|
27
|
-
label:
|
|
28
|
-
placeholder:
|
|
27
|
+
label: capitalCase(faker.word()),
|
|
28
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
29
29
|
select: prismic.CustomTypeModelLinkSelectType.Document,
|
|
30
30
|
customtypes: config.customTypeIDs,
|
|
31
31
|
tags: config.tags,
|
package/src/model/customType.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, snakeCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -51,13 +51,13 @@ export const customType = <
|
|
|
51
51
|
const faker = config.faker || createFaker(config.seed);
|
|
52
52
|
|
|
53
53
|
let label: string =
|
|
54
|
-
config.label ||
|
|
55
|
-
let id: string = config.id ||
|
|
54
|
+
config.label || capitalCase(faker.words(faker.range(1, 2)));
|
|
55
|
+
let id: string = config.id || snakeCase(label);
|
|
56
56
|
|
|
57
57
|
if (config.id && !config.label) {
|
|
58
|
-
label =
|
|
58
|
+
label = capitalCase(config.id);
|
|
59
59
|
} else if (config.label && !config.label) {
|
|
60
|
-
id =
|
|
60
|
+
id = snakeCase(config.label);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const format = config.format ?? faker.randomElement(["page", "custom"]);
|
package/src/model/date.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const date = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Date,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
package/src/model/embed.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const embed = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Embed,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
package/src/model/geoPoint.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,7 +15,7 @@ export const geoPoint = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.GeoPoint,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
21
|
};
|
package/src/model/group.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { GroupFieldModelMap, MockModelConfig } from "../types";
|
|
@@ -17,7 +17,7 @@ export function group<Fields extends GroupFieldModelMap>(
|
|
|
17
17
|
return {
|
|
18
18
|
type: prismic.CustomTypeModelFieldType.Group,
|
|
19
19
|
config: {
|
|
20
|
-
label:
|
|
20
|
+
label: capitalCase(faker.word()),
|
|
21
21
|
fields: config.fields || ({} as Fields),
|
|
22
22
|
},
|
|
23
23
|
};
|
package/src/model/image.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -26,7 +26,7 @@ export const image = <ThumbnailNames extends string = string>(
|
|
|
26
26
|
return {
|
|
27
27
|
type: prismic.CustomTypeModelFieldType.Image,
|
|
28
28
|
config: {
|
|
29
|
-
label:
|
|
29
|
+
label: capitalCase(faker.word()),
|
|
30
30
|
constraint: {
|
|
31
31
|
width: config.withConstraint ? faker.range(500, 2000) : null,
|
|
32
32
|
height: config.withConstraint ? faker.range(500, 2000) : null,
|
package/src/model/integration.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, snakeCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -17,8 +17,8 @@ export const integration = (
|
|
|
17
17
|
return {
|
|
18
18
|
type: prismic.CustomTypeModelFieldType.Integration,
|
|
19
19
|
config: {
|
|
20
|
-
label:
|
|
21
|
-
catalog: config.catalog ||
|
|
20
|
+
label: capitalCase(faker.word()),
|
|
21
|
+
catalog: config.catalog || snakeCase(faker.words(2)),
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
};
|
package/src/model/keyText.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const keyText = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Text,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
package/src/model/link.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -43,8 +43,8 @@ export const link = <
|
|
|
43
43
|
return {
|
|
44
44
|
type: prismic.CustomTypeModelFieldType.Link,
|
|
45
45
|
config: {
|
|
46
|
-
label:
|
|
47
|
-
placeholder:
|
|
46
|
+
label: capitalCase(faker.word()),
|
|
47
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
48
48
|
select: null,
|
|
49
49
|
allowTargetBlank:
|
|
50
50
|
("allowTargetBlank" in config
|
package/src/model/linkToMedia.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -23,8 +23,8 @@ export const linkToMedia = <AllowText extends boolean = boolean>(
|
|
|
23
23
|
return {
|
|
24
24
|
type: prismic.CustomTypeModelFieldType.Link,
|
|
25
25
|
config: {
|
|
26
|
-
label:
|
|
27
|
-
placeholder:
|
|
26
|
+
label: capitalCase(faker.word()),
|
|
27
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
28
28
|
select: prismic.CustomTypeModelLinkSelectType.Media,
|
|
29
29
|
allowText:
|
|
30
30
|
("allowText" in config ? config.allowText : faker.boolean()) ||
|
package/src/model/number.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const number = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Number,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
package/src/model/richText.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -46,8 +46,8 @@ export const richText = <WithMultipleBlocks extends boolean = boolean>(
|
|
|
46
46
|
return {
|
|
47
47
|
type: prismic.CustomTypeModelFieldType.StructuredText,
|
|
48
48
|
config: {
|
|
49
|
-
label:
|
|
50
|
-
placeholder:
|
|
49
|
+
label: capitalCase(faker.word()),
|
|
50
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
51
51
|
allowTargetBlank: faker.boolean() ? true : undefined,
|
|
52
52
|
...blockTypeConfig,
|
|
53
53
|
},
|
package/src/model/select.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -21,8 +21,8 @@ export const select = <Option extends string, DefaultOption extends Option>(
|
|
|
21
21
|
return {
|
|
22
22
|
type: prismic.CustomTypeModelFieldType.Select,
|
|
23
23
|
config: {
|
|
24
|
-
label:
|
|
25
|
-
placeholder:
|
|
24
|
+
label: capitalCase(faker.word()),
|
|
25
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
26
26
|
options: config.options || [],
|
|
27
27
|
default_value: config.defaultValue || undefined,
|
|
28
28
|
},
|
package/src/model/sharedSlice.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import {
|
|
4
|
+
capitalCase,
|
|
5
|
+
pascalCase,
|
|
6
|
+
sentenceCase,
|
|
7
|
+
snakeCase,
|
|
8
|
+
} from "../lib/changeCase";
|
|
4
9
|
import { createFaker } from "../lib/createFaker";
|
|
5
10
|
|
|
6
11
|
import { MockModelConfig } from "../types";
|
|
@@ -20,21 +25,20 @@ export const sharedSlice = <
|
|
|
20
25
|
): prismic.SharedSliceModel<string, Variation> => {
|
|
21
26
|
const faker = config.faker || createFaker(config.seed);
|
|
22
27
|
|
|
23
|
-
let name: string =
|
|
24
|
-
|
|
25
|
-
let id: string = config.id || changeCase.snakeCase(name);
|
|
28
|
+
let name: string = config.name || capitalCase(faker.words(faker.range(1, 2)));
|
|
29
|
+
let id: string = config.id || snakeCase(name);
|
|
26
30
|
|
|
27
31
|
if (config.id && !config.name) {
|
|
28
|
-
name =
|
|
32
|
+
name = pascalCase(config.id);
|
|
29
33
|
} else if (config.name && !config.name) {
|
|
30
|
-
id =
|
|
34
|
+
id = snakeCase(config.name);
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
return {
|
|
34
38
|
type: prismic.CustomTypeModelSliceType.SharedSlice,
|
|
35
39
|
id,
|
|
36
40
|
name,
|
|
37
|
-
description:
|
|
41
|
+
description: sentenceCase(faker.words(faker.range(5, 10))),
|
|
38
42
|
variations: config.variations || ([] as Variation[]),
|
|
39
43
|
};
|
|
40
44
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import {
|
|
4
|
+
capitalCase,
|
|
5
|
+
pascalCase,
|
|
6
|
+
sentenceCase,
|
|
7
|
+
snakeCase,
|
|
8
|
+
} from "../lib/changeCase";
|
|
4
9
|
import { createFaker } from "../lib/createFaker";
|
|
5
10
|
import { getMockImageData } from "../lib/getMockImageData";
|
|
6
11
|
|
|
@@ -30,14 +35,13 @@ export const sharedSliceVariation = <
|
|
|
30
35
|
): prismic.SharedSliceModelVariation<ID, PrimaryFields, ItemsFields> => {
|
|
31
36
|
const faker = config.faker || createFaker(config.seed);
|
|
32
37
|
|
|
33
|
-
let name: string =
|
|
34
|
-
|
|
35
|
-
let id: ID = config.id || (changeCase.snakeCase(name) as ID);
|
|
38
|
+
let name: string = config.name || capitalCase(faker.words(faker.range(1, 2)));
|
|
39
|
+
let id: ID = config.id || (snakeCase(name) as ID);
|
|
36
40
|
|
|
37
41
|
if (config.id && !config.name) {
|
|
38
|
-
name =
|
|
42
|
+
name = pascalCase(config.id);
|
|
39
43
|
} else if (config.name && !config.name) {
|
|
40
|
-
id =
|
|
44
|
+
id = snakeCase(config.name) as ID;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
const imageData = getMockImageData({ faker });
|
|
@@ -45,7 +49,7 @@ export const sharedSliceVariation = <
|
|
|
45
49
|
return {
|
|
46
50
|
id,
|
|
47
51
|
name,
|
|
48
|
-
description:
|
|
52
|
+
description: sentenceCase(faker.words(faker.range(5, 10))),
|
|
49
53
|
docURL: faker.url(),
|
|
50
54
|
version: faker.hash(7),
|
|
51
55
|
primary: config.primaryFields || ({} as PrimaryFields),
|
package/src/model/slice.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase, snakeCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig, NestedGroupFieldModelMap } from "../types";
|
|
@@ -23,12 +23,12 @@ export const slice = <
|
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
25
|
type: prismic.CustomTypeModelSliceType.Slice,
|
|
26
|
-
icon:
|
|
26
|
+
icon: snakeCase(faker.word()),
|
|
27
27
|
display: faker.boolean()
|
|
28
28
|
? prismic.CustomTypeModelSliceDisplay.Grid
|
|
29
29
|
: prismic.CustomTypeModelSliceDisplay.List,
|
|
30
|
-
fieldset:
|
|
31
|
-
description:
|
|
30
|
+
fieldset: capitalCase(faker.words(2)),
|
|
31
|
+
description: sentenceCase(faker.words(faker.range(5, 10))),
|
|
32
32
|
repeat: config.repeatFields || ({} as RepeatFields),
|
|
33
33
|
"non-repeat": config.nonRepeatFields || ({} as NonRepeatFields),
|
|
34
34
|
};
|
package/src/model/timestamp.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const timestamp = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.Timestamp,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
package/src/model/title.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -26,8 +26,8 @@ export const title = (
|
|
|
26
26
|
return {
|
|
27
27
|
type: prismic.CustomTypeModelFieldType.StructuredText,
|
|
28
28
|
config: {
|
|
29
|
-
label:
|
|
30
|
-
placeholder:
|
|
29
|
+
label: capitalCase(faker.word()),
|
|
30
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
31
31
|
single,
|
|
32
32
|
allowTargetBlank: faker.boolean() || undefined,
|
|
33
33
|
},
|
package/src/model/uid.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase, sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockModelConfig } from "../types";
|
|
@@ -15,8 +15,8 @@ export const uid = (
|
|
|
15
15
|
return {
|
|
16
16
|
type: prismic.CustomTypeModelFieldType.UID,
|
|
17
17
|
config: {
|
|
18
|
-
label:
|
|
19
|
-
placeholder:
|
|
18
|
+
label: capitalCase(faker.word()),
|
|
19
|
+
placeholder: sentenceCase(faker.words(3)),
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
};
|
package/src/value/customType.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { snakeCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
import { generateTags } from "../lib/generateTags";
|
|
6
6
|
import {
|
|
@@ -64,7 +64,7 @@ export const customType = <
|
|
|
64
64
|
return {
|
|
65
65
|
type: model.id,
|
|
66
66
|
id: faker.hash(7),
|
|
67
|
-
uid: hasUID ?
|
|
67
|
+
uid: hasUID ? snakeCase(faker.words(faker.range(1, 3))) : null,
|
|
68
68
|
url: withURL ? faker.url() : null,
|
|
69
69
|
href: faker.url(),
|
|
70
70
|
lang: faker.word(),
|
package/src/value/keyText.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockValueStateConfig, MockValueConfig } from "../types";
|
|
@@ -25,6 +25,6 @@ export const keyText = <
|
|
|
25
25
|
const faker = config.faker || createFaker(config.seed);
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
config.state === "empty" ? null :
|
|
28
|
+
config.state === "empty" ? null : sentenceCase(faker.words(3))
|
|
29
29
|
) as MockKeyTextValue<State>;
|
|
30
30
|
};
|
package/src/value/link.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { sentenceCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockValueStateConfig, MockValueConfig } from "../types";
|
|
@@ -104,7 +104,7 @@ export const link = <
|
|
|
104
104
|
: undefined,
|
|
105
105
|
text:
|
|
106
106
|
config.withText ?? (model.config?.allowText && faker.boolean())
|
|
107
|
-
?
|
|
107
|
+
? sentenceCase(faker.words(2))
|
|
108
108
|
: undefined,
|
|
109
109
|
} as MockLinkValue<LinkType, State>;
|
|
110
110
|
}
|
package/src/value/linkToMedia.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { sentenceCase, snakeCase } from "../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockValueStateConfig, MockValueConfig } from "../types";
|
|
@@ -41,15 +41,15 @@ export const linkToMedia = <
|
|
|
41
41
|
return {
|
|
42
42
|
link_type: prismic.LinkType.Media,
|
|
43
43
|
id: faker.hash(11),
|
|
44
|
-
name: `${
|
|
45
|
-
kind:
|
|
44
|
+
name: `${snakeCase(faker.words(faker.range(1, 2)))}.example`,
|
|
45
|
+
kind: snakeCase(faker.word()),
|
|
46
46
|
url: faker.url(),
|
|
47
47
|
size: faker.range(500, 3000).toString(),
|
|
48
48
|
height: faker.range(500, 3000).toString(),
|
|
49
49
|
width: faker.range(500, 3000).toString(),
|
|
50
50
|
text:
|
|
51
51
|
config.withText ?? (model.config?.allowText && faker.boolean())
|
|
52
|
-
?
|
|
52
|
+
? sentenceCase(faker.words(2))
|
|
53
53
|
: undefined,
|
|
54
54
|
} as MockLinkToMediaValue<State>;
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { capitalCase } from "../../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockRichTextValueConfig } from "../../types";
|
|
@@ -85,7 +85,7 @@ export const heading = (
|
|
|
85
85
|
|
|
86
86
|
return {
|
|
87
87
|
type,
|
|
88
|
-
text:
|
|
88
|
+
text: capitalCase(
|
|
89
89
|
faker.words(faker.range(pattern.minWords, pattern.maxWords)),
|
|
90
90
|
),
|
|
91
91
|
spans: [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { sentenceCase } from "../../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockRichTextValueConfig } from "../../types";
|
|
@@ -41,7 +41,7 @@ export const list = (
|
|
|
41
41
|
.map(() => {
|
|
42
42
|
return {
|
|
43
43
|
type: prismic.RichTextNodeType.listItem,
|
|
44
|
-
text:
|
|
44
|
+
text: sentenceCase(faker.words(faker.range(5, 15))),
|
|
45
45
|
spans: [],
|
|
46
46
|
};
|
|
47
47
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { sentenceCase } from "../../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockRichTextValueConfig } from "../../types";
|
|
@@ -41,7 +41,7 @@ export const oList = (
|
|
|
41
41
|
.map(() => {
|
|
42
42
|
return {
|
|
43
43
|
type: prismic.RichTextNodeType.oListItem,
|
|
44
|
-
text:
|
|
44
|
+
text: sentenceCase(faker.words(faker.range(5, 15))),
|
|
45
45
|
spans: [],
|
|
46
46
|
};
|
|
47
47
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as changeCase from "change-case";
|
|
3
2
|
|
|
3
|
+
import { sentenceCase } from "../../lib/changeCase";
|
|
4
4
|
import { createFaker } from "../../lib/createFaker";
|
|
5
5
|
|
|
6
6
|
import { MockRichTextValueConfig } from "../../types";
|
|
@@ -33,7 +33,7 @@ export const paragraph = (
|
|
|
33
33
|
|
|
34
34
|
const text = Array.from(
|
|
35
35
|
{ length: pattern.sentenceCount },
|
|
36
|
-
() =>
|
|
36
|
+
() => sentenceCase(faker.words(faker.range(5, 15))) + ".",
|
|
37
37
|
).join(" ");
|
|
38
38
|
|
|
39
39
|
return {
|