@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.
Files changed (202) hide show
  1. package/dist/api/ref.cjs +2 -19
  2. package/dist/api/ref.cjs.map +1 -1
  3. package/dist/api/ref.js +2 -2
  4. package/dist/api/ref.js.map +1 -1
  5. package/dist/api/repository.cjs +2 -19
  6. package/dist/api/repository.cjs.map +1 -1
  7. package/dist/api/repository.js +2 -2
  8. package/dist/api/repository.js.map +1 -1
  9. package/dist/lib/buildImageFieldImage.cjs +3 -20
  10. package/dist/lib/buildImageFieldImage.cjs.map +1 -1
  11. package/dist/lib/buildImageFieldImage.js +3 -3
  12. package/dist/lib/buildImageFieldImage.js.map +1 -1
  13. package/dist/lib/changeCase.cjs +12 -0
  14. package/dist/lib/changeCase.cjs.map +1 -0
  15. package/dist/lib/changeCase.d.ts +4 -0
  16. package/dist/lib/changeCase.js +12 -0
  17. package/dist/lib/changeCase.js.map +1 -0
  18. package/dist/lib/generateCustomTypeId.cjs +2 -19
  19. package/dist/lib/generateCustomTypeId.cjs.map +1 -1
  20. package/dist/lib/generateCustomTypeId.js +2 -2
  21. package/dist/lib/generateCustomTypeId.js.map +1 -1
  22. package/dist/lib/generateFieldId.cjs +2 -19
  23. package/dist/lib/generateFieldId.cjs.map +1 -1
  24. package/dist/lib/generateFieldId.js +2 -2
  25. package/dist/lib/generateFieldId.js.map +1 -1
  26. package/dist/lib/generateTags.cjs +2 -19
  27. package/dist/lib/generateTags.cjs.map +1 -1
  28. package/dist/lib/generateTags.js +2 -2
  29. package/dist/lib/generateTags.js.map +1 -1
  30. package/dist/model/boolean.cjs +2 -3
  31. package/dist/model/boolean.cjs.map +1 -1
  32. package/dist/model/boolean.js +2 -2
  33. package/dist/model/boolean.js.map +1 -1
  34. package/dist/model/color.cjs +3 -4
  35. package/dist/model/color.cjs.map +1 -1
  36. package/dist/model/color.js +3 -3
  37. package/dist/model/color.js.map +1 -1
  38. package/dist/model/contentRelationship.cjs +3 -4
  39. package/dist/model/contentRelationship.cjs.map +1 -1
  40. package/dist/model/contentRelationship.js +3 -3
  41. package/dist/model/contentRelationship.js.map +1 -1
  42. package/dist/model/customType.cjs +5 -22
  43. package/dist/model/customType.cjs.map +1 -1
  44. package/dist/model/customType.js +5 -5
  45. package/dist/model/customType.js.map +1 -1
  46. package/dist/model/date.cjs +3 -4
  47. package/dist/model/date.cjs.map +1 -1
  48. package/dist/model/date.js +3 -3
  49. package/dist/model/date.js.map +1 -1
  50. package/dist/model/embed.cjs +3 -4
  51. package/dist/model/embed.cjs.map +1 -1
  52. package/dist/model/embed.js +3 -3
  53. package/dist/model/embed.js.map +1 -1
  54. package/dist/model/geoPoint.cjs +2 -3
  55. package/dist/model/geoPoint.cjs.map +1 -1
  56. package/dist/model/geoPoint.js +2 -2
  57. package/dist/model/geoPoint.js.map +1 -1
  58. package/dist/model/group.cjs +2 -3
  59. package/dist/model/group.cjs.map +1 -1
  60. package/dist/model/group.js +2 -2
  61. package/dist/model/group.js.map +1 -1
  62. package/dist/model/image.cjs +2 -3
  63. package/dist/model/image.cjs.map +1 -1
  64. package/dist/model/image.js +2 -2
  65. package/dist/model/image.js.map +1 -1
  66. package/dist/model/integration.cjs +3 -4
  67. package/dist/model/integration.cjs.map +1 -1
  68. package/dist/model/integration.js +3 -3
  69. package/dist/model/integration.js.map +1 -1
  70. package/dist/model/keyText.cjs +3 -4
  71. package/dist/model/keyText.cjs.map +1 -1
  72. package/dist/model/keyText.js +3 -3
  73. package/dist/model/keyText.js.map +1 -1
  74. package/dist/model/link.cjs +3 -4
  75. package/dist/model/link.cjs.map +1 -1
  76. package/dist/model/link.js +3 -3
  77. package/dist/model/link.js.map +1 -1
  78. package/dist/model/linkToMedia.cjs +3 -4
  79. package/dist/model/linkToMedia.cjs.map +1 -1
  80. package/dist/model/linkToMedia.js +3 -3
  81. package/dist/model/linkToMedia.js.map +1 -1
  82. package/dist/model/number.cjs +3 -4
  83. package/dist/model/number.cjs.map +1 -1
  84. package/dist/model/number.js +3 -3
  85. package/dist/model/number.js.map +1 -1
  86. package/dist/model/richText.cjs +3 -4
  87. package/dist/model/richText.cjs.map +1 -1
  88. package/dist/model/richText.js +3 -3
  89. package/dist/model/richText.js.map +1 -1
  90. package/dist/model/select.cjs +3 -4
  91. package/dist/model/select.cjs.map +1 -1
  92. package/dist/model/select.js +3 -3
  93. package/dist/model/select.js.map +1 -1
  94. package/dist/model/sharedSlice.cjs +6 -7
  95. package/dist/model/sharedSlice.cjs.map +1 -1
  96. package/dist/model/sharedSlice.js +6 -6
  97. package/dist/model/sharedSlice.js.map +1 -1
  98. package/dist/model/sharedSliceVariation.cjs +6 -23
  99. package/dist/model/sharedSliceVariation.cjs.map +1 -1
  100. package/dist/model/sharedSliceVariation.js +6 -6
  101. package/dist/model/sharedSliceVariation.js.map +1 -1
  102. package/dist/model/slice.cjs +4 -5
  103. package/dist/model/slice.cjs.map +1 -1
  104. package/dist/model/slice.js +4 -4
  105. package/dist/model/slice.js.map +1 -1
  106. package/dist/model/timestamp.cjs +3 -4
  107. package/dist/model/timestamp.cjs.map +1 -1
  108. package/dist/model/timestamp.js +3 -3
  109. package/dist/model/timestamp.js.map +1 -1
  110. package/dist/model/title.cjs +3 -4
  111. package/dist/model/title.cjs.map +1 -1
  112. package/dist/model/title.js +3 -3
  113. package/dist/model/title.js.map +1 -1
  114. package/dist/model/uid.cjs +3 -4
  115. package/dist/model/uid.cjs.map +1 -1
  116. package/dist/model/uid.js +3 -3
  117. package/dist/model/uid.js.map +1 -1
  118. package/dist/value/customType.cjs +2 -3
  119. package/dist/value/customType.cjs.map +1 -1
  120. package/dist/value/customType.js +2 -2
  121. package/dist/value/customType.js.map +1 -1
  122. package/dist/value/keyText.cjs +2 -19
  123. package/dist/value/keyText.cjs.map +1 -1
  124. package/dist/value/keyText.js +2 -2
  125. package/dist/value/keyText.js.map +1 -1
  126. package/dist/value/link.cjs +2 -3
  127. package/dist/value/link.cjs.map +1 -1
  128. package/dist/value/link.js +2 -2
  129. package/dist/value/link.js.map +1 -1
  130. package/dist/value/linkToMedia.cjs +4 -5
  131. package/dist/value/linkToMedia.cjs.map +1 -1
  132. package/dist/value/linkToMedia.js +4 -4
  133. package/dist/value/linkToMedia.js.map +1 -1
  134. package/dist/value/richText/heading.cjs +2 -3
  135. package/dist/value/richText/heading.cjs.map +1 -1
  136. package/dist/value/richText/heading.js +2 -2
  137. package/dist/value/richText/heading.js.map +1 -1
  138. package/dist/value/richText/list.cjs +2 -3
  139. package/dist/value/richText/list.cjs.map +1 -1
  140. package/dist/value/richText/list.js +2 -2
  141. package/dist/value/richText/list.js.map +1 -1
  142. package/dist/value/richText/oList.cjs +2 -3
  143. package/dist/value/richText/oList.cjs.map +1 -1
  144. package/dist/value/richText/oList.js +2 -2
  145. package/dist/value/richText/oList.js.map +1 -1
  146. package/dist/value/richText/paragraph.cjs +2 -3
  147. package/dist/value/richText/paragraph.cjs.map +1 -1
  148. package/dist/value/richText/paragraph.js +2 -2
  149. package/dist/value/richText/paragraph.js.map +1 -1
  150. package/dist/value/richText/preformatted.cjs +2 -3
  151. package/dist/value/richText/preformatted.cjs.map +1 -1
  152. package/dist/value/richText/preformatted.js +2 -2
  153. package/dist/value/richText/preformatted.js.map +1 -1
  154. package/dist/value/slice.cjs +2 -19
  155. package/dist/value/slice.cjs.map +1 -1
  156. package/dist/value/slice.js +2 -2
  157. package/dist/value/slice.js.map +1 -1
  158. package/dist/value/uid.cjs +2 -19
  159. package/dist/value/uid.cjs.map +1 -1
  160. package/dist/value/uid.js +2 -2
  161. package/dist/value/uid.js.map +1 -1
  162. package/package.json +2 -5
  163. package/src/api/ref.ts +2 -2
  164. package/src/api/repository.ts +2 -2
  165. package/src/lib/buildImageFieldImage.ts +3 -3
  166. package/src/lib/changeCase.ts +14 -0
  167. package/src/lib/generateCustomTypeId.ts +2 -3
  168. package/src/lib/generateFieldId.ts +2 -3
  169. package/src/lib/generateTags.ts +2 -3
  170. package/src/model/boolean.ts +2 -2
  171. package/src/model/color.ts +3 -3
  172. package/src/model/contentRelationship.ts +3 -3
  173. package/src/model/customType.ts +5 -5
  174. package/src/model/date.ts +3 -3
  175. package/src/model/embed.ts +3 -3
  176. package/src/model/geoPoint.ts +2 -2
  177. package/src/model/group.ts +2 -2
  178. package/src/model/image.ts +2 -2
  179. package/src/model/integration.ts +3 -3
  180. package/src/model/keyText.ts +3 -3
  181. package/src/model/link.ts +3 -3
  182. package/src/model/linkToMedia.ts +3 -3
  183. package/src/model/number.ts +3 -3
  184. package/src/model/richText.ts +3 -3
  185. package/src/model/select.ts +3 -3
  186. package/src/model/sharedSlice.ts +11 -7
  187. package/src/model/sharedSliceVariation.ts +11 -7
  188. package/src/model/slice.ts +4 -4
  189. package/src/model/timestamp.ts +3 -3
  190. package/src/model/title.ts +3 -3
  191. package/src/model/uid.ts +3 -3
  192. package/src/value/customType.ts +2 -2
  193. package/src/value/keyText.ts +2 -2
  194. package/src/value/link.ts +2 -2
  195. package/src/value/linkToMedia.ts +4 -4
  196. package/src/value/richText/heading.ts +2 -2
  197. package/src/value/richText/list.ts +2 -2
  198. package/src/value/richText/oList.ts +2 -2
  199. package/src/value/richText/paragraph.ts +2 -2
  200. package/src/value/richText/preformatted.ts +2 -2
  201. package/src/value/slice.ts +2 -2
  202. package/src/value/uid.ts +2 -2
@@ -1,5 +1,4 @@
1
- import * as changeCase from "change-case";
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 changeCase.snakeCase(faker.words(faker.range(1, 3)));
19
+ return snakeCase(faker.words(faker.range(1, 3)));
21
20
  };
@@ -1,5 +1,4 @@
1
- import * as changeCase from "change-case";
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
- () => changeCase.capitalCase(faker.words(faker.range(1, 3))),
25
+ () => capitalCase(faker.words(faker.range(1, 3))),
27
26
  );
28
27
  };
@@ -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: changeCase.capitalCase(faker.word()),
18
+ label: capitalCase(faker.word()),
19
19
  },
20
20
  };
21
21
  }
@@ -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: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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: changeCase.capitalCase(faker.word()),
28
- placeholder: changeCase.sentenceCase(faker.words(3)),
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,
@@ -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 || changeCase.capitalCase(faker.words(faker.range(1, 2)));
55
- let id: string = config.id || changeCase.snakeCase(label);
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 = changeCase.capitalCase(config.id);
58
+ label = capitalCase(config.id);
59
59
  } else if (config.label && !config.label) {
60
- id = changeCase.snakeCase(config.label);
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: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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";
@@ -15,8 +15,8 @@ export const embed = (
15
15
  return {
16
16
  type: prismic.CustomTypeModelFieldType.Embed,
17
17
  config: {
18
- label: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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 } 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: changeCase.capitalCase(faker.word()),
18
+ label: capitalCase(faker.word()),
19
19
  },
20
20
  };
21
21
  };
@@ -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: changeCase.capitalCase(faker.word()),
20
+ label: capitalCase(faker.word()),
21
21
  fields: config.fields || ({} as Fields),
22
22
  },
23
23
  };
@@ -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: changeCase.capitalCase(faker.word()),
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,
@@ -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: changeCase.capitalCase(faker.word()),
21
- catalog: config.catalog || changeCase.snakeCase(faker.words(2)),
20
+ label: capitalCase(faker.word()),
21
+ catalog: config.catalog || snakeCase(faker.words(2)),
22
22
  },
23
23
  };
24
24
  };
@@ -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: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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: changeCase.capitalCase(faker.word()),
47
- placeholder: changeCase.sentenceCase(faker.words(3)),
46
+ label: capitalCase(faker.word()),
47
+ placeholder: sentenceCase(faker.words(3)),
48
48
  select: null,
49
49
  allowTargetBlank:
50
50
  ("allowTargetBlank" in config
@@ -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: changeCase.capitalCase(faker.word()),
27
- placeholder: changeCase.sentenceCase(faker.words(3)),
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()) ||
@@ -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: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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";
@@ -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: changeCase.capitalCase(faker.word()),
50
- placeholder: changeCase.sentenceCase(faker.words(3)),
49
+ label: capitalCase(faker.word()),
50
+ placeholder: sentenceCase(faker.words(3)),
51
51
  allowTargetBlank: faker.boolean() ? true : undefined,
52
52
  ...blockTypeConfig,
53
53
  },
@@ -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: changeCase.capitalCase(faker.word()),
25
- placeholder: changeCase.sentenceCase(faker.words(3)),
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
  },
@@ -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
- config.name || changeCase.capitalCase(faker.words(faker.range(1, 2)));
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 = changeCase.pascalCase(config.id);
32
+ name = pascalCase(config.id);
29
33
  } else if (config.name && !config.name) {
30
- id = changeCase.snakeCase(config.name);
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: changeCase.sentenceCase(faker.words(faker.range(5, 10))),
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
- config.name || changeCase.capitalCase(faker.words(faker.range(1, 2)));
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 = changeCase.pascalCase(config.id);
42
+ name = pascalCase(config.id);
39
43
  } else if (config.name && !config.name) {
40
- id = changeCase.snakeCase(config.name) as 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: changeCase.sentenceCase(faker.words(faker.range(5, 10))),
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),
@@ -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: changeCase.snakeCase(faker.word()),
26
+ icon: snakeCase(faker.word()),
27
27
  display: faker.boolean()
28
28
  ? prismic.CustomTypeModelSliceDisplay.Grid
29
29
  : prismic.CustomTypeModelSliceDisplay.List,
30
- fieldset: changeCase.capitalCase(faker.words(2)),
31
- description: changeCase.sentenceCase(faker.words(faker.range(5, 10))),
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
  };
@@ -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: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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";
@@ -26,8 +26,8 @@ export const title = (
26
26
  return {
27
27
  type: prismic.CustomTypeModelFieldType.StructuredText,
28
28
  config: {
29
- label: changeCase.capitalCase(faker.word()),
30
- placeholder: changeCase.sentenceCase(faker.words(3)),
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: changeCase.capitalCase(faker.word()),
19
- placeholder: changeCase.sentenceCase(faker.words(3)),
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 { 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 ? changeCase.snakeCase(faker.words(faker.range(1, 3))) : null,
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(),
@@ -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 : changeCase.sentenceCase(faker.words(3))
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
- ? changeCase.sentenceCase(faker.words(2))
107
+ ? sentenceCase(faker.words(2))
108
108
  : undefined,
109
109
  } as MockLinkValue<LinkType, State>;
110
110
  }
@@ -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: `${changeCase.snakeCase(faker.words(faker.range(1, 2)))}.example`,
45
- kind: changeCase.snakeCase(faker.word()),
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
- ? changeCase.sentenceCase(faker.words(2))
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: changeCase.capitalCase(
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: changeCase.sentenceCase(faker.words(faker.range(5, 15))),
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: changeCase.sentenceCase(faker.words(faker.range(5, 15))),
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
- () => changeCase.sentenceCase(faker.words(faker.range(5, 15))) + ".",
36
+ () => sentenceCase(faker.words(faker.range(5, 15))) + ".",
37
37
  ).join(" ");
38
38
 
39
39
  return {