@prismicio/client 7.21.2 → 7.21.3-pr.431.23cc5c6

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 (217) hide show
  1. package/dist/iac/customType.cjs +54 -0
  2. package/dist/iac/customType.cjs.map +1 -0
  3. package/dist/iac/customType.d.cts +43 -0
  4. package/dist/iac/customType.d.cts.map +1 -0
  5. package/dist/iac/customType.d.ts +43 -0
  6. package/dist/iac/customType.d.ts.map +1 -0
  7. package/dist/iac/customType.js +53 -0
  8. package/dist/iac/customType.js.map +1 -0
  9. package/dist/iac/fields/boolean.cjs +38 -0
  10. package/dist/iac/fields/boolean.cjs.map +1 -0
  11. package/dist/iac/fields/boolean.d.cts +22 -0
  12. package/dist/iac/fields/boolean.d.cts.map +1 -0
  13. package/dist/iac/fields/boolean.d.ts +22 -0
  14. package/dist/iac/fields/boolean.d.ts.map +1 -0
  15. package/dist/iac/fields/boolean.js +38 -0
  16. package/dist/iac/fields/boolean.js.map +1 -0
  17. package/dist/iac/fields/color.cjs +29 -0
  18. package/dist/iac/fields/color.cjs.map +1 -0
  19. package/dist/iac/fields/color.d.cts +11 -0
  20. package/dist/iac/fields/color.d.cts.map +1 -0
  21. package/dist/iac/fields/color.d.ts +11 -0
  22. package/dist/iac/fields/color.d.ts.map +1 -0
  23. package/dist/iac/fields/color.js +29 -0
  24. package/dist/iac/fields/color.js.map +1 -0
  25. package/dist/iac/fields/contentRelationship.cjs +50 -0
  26. package/dist/iac/fields/contentRelationship.cjs.map +1 -0
  27. package/dist/iac/fields/contentRelationship.d.cts +23 -0
  28. package/dist/iac/fields/contentRelationship.d.cts.map +1 -0
  29. package/dist/iac/fields/contentRelationship.d.ts +23 -0
  30. package/dist/iac/fields/contentRelationship.d.ts.map +1 -0
  31. package/dist/iac/fields/contentRelationship.js +50 -0
  32. package/dist/iac/fields/contentRelationship.js.map +1 -0
  33. package/dist/iac/fields/date.cjs +29 -0
  34. package/dist/iac/fields/date.cjs.map +1 -0
  35. package/dist/iac/fields/date.d.cts +11 -0
  36. package/dist/iac/fields/date.d.cts.map +1 -0
  37. package/dist/iac/fields/date.d.ts +11 -0
  38. package/dist/iac/fields/date.d.ts.map +1 -0
  39. package/dist/iac/fields/date.js +29 -0
  40. package/dist/iac/fields/date.js.map +1 -0
  41. package/dist/iac/fields/embed.cjs +29 -0
  42. package/dist/iac/fields/embed.cjs.map +1 -0
  43. package/dist/iac/fields/embed.d.cts +11 -0
  44. package/dist/iac/fields/embed.d.cts.map +1 -0
  45. package/dist/iac/fields/embed.d.ts +11 -0
  46. package/dist/iac/fields/embed.d.ts.map +1 -0
  47. package/dist/iac/fields/embed.js +29 -0
  48. package/dist/iac/fields/embed.js.map +1 -0
  49. package/dist/iac/fields/geoPoint.cjs +26 -0
  50. package/dist/iac/fields/geoPoint.cjs.map +1 -0
  51. package/dist/iac/fields/geoPoint.d.cts +10 -0
  52. package/dist/iac/fields/geoPoint.d.cts.map +1 -0
  53. package/dist/iac/fields/geoPoint.d.ts +10 -0
  54. package/dist/iac/fields/geoPoint.d.ts.map +1 -0
  55. package/dist/iac/fields/geoPoint.js +26 -0
  56. package/dist/iac/fields/geoPoint.js.map +1 -0
  57. package/dist/iac/fields/group.cjs +38 -0
  58. package/dist/iac/fields/group.cjs.map +1 -0
  59. package/dist/iac/fields/group.d.cts +17 -0
  60. package/dist/iac/fields/group.d.cts.map +1 -0
  61. package/dist/iac/fields/group.d.ts +17 -0
  62. package/dist/iac/fields/group.d.ts.map +1 -0
  63. package/dist/iac/fields/group.js +38 -0
  64. package/dist/iac/fields/group.js.map +1 -0
  65. package/dist/iac/fields/image.cjs +48 -0
  66. package/dist/iac/fields/image.cjs.map +1 -0
  67. package/dist/iac/fields/image.d.cts +21 -0
  68. package/dist/iac/fields/image.d.cts.map +1 -0
  69. package/dist/iac/fields/image.d.ts +21 -0
  70. package/dist/iac/fields/image.d.ts.map +1 -0
  71. package/dist/iac/fields/image.js +48 -0
  72. package/dist/iac/fields/image.js.map +1 -0
  73. package/dist/iac/fields/integration.cjs +33 -0
  74. package/dist/iac/fields/integration.cjs.map +1 -0
  75. package/dist/iac/fields/integration.d.cts +15 -0
  76. package/dist/iac/fields/integration.d.cts.map +1 -0
  77. package/dist/iac/fields/integration.d.ts +15 -0
  78. package/dist/iac/fields/integration.d.ts.map +1 -0
  79. package/dist/iac/fields/integration.js +33 -0
  80. package/dist/iac/fields/integration.js.map +1 -0
  81. package/dist/iac/fields/link.cjs +45 -0
  82. package/dist/iac/fields/link.cjs.map +1 -0
  83. package/dist/iac/fields/link.d.cts +39 -0
  84. package/dist/iac/fields/link.d.cts.map +1 -0
  85. package/dist/iac/fields/link.d.ts +39 -0
  86. package/dist/iac/fields/link.d.ts.map +1 -0
  87. package/dist/iac/fields/link.js +45 -0
  88. package/dist/iac/fields/link.js.map +1 -0
  89. package/dist/iac/fields/linkToMedia.cjs +31 -0
  90. package/dist/iac/fields/linkToMedia.cjs.map +1 -0
  91. package/dist/iac/fields/linkToMedia.d.cts +11 -0
  92. package/dist/iac/fields/linkToMedia.d.cts.map +1 -0
  93. package/dist/iac/fields/linkToMedia.d.ts +11 -0
  94. package/dist/iac/fields/linkToMedia.d.ts.map +1 -0
  95. package/dist/iac/fields/linkToMedia.js +31 -0
  96. package/dist/iac/fields/linkToMedia.js.map +1 -0
  97. package/dist/iac/fields/number.cjs +29 -0
  98. package/dist/iac/fields/number.cjs.map +1 -0
  99. package/dist/iac/fields/number.d.cts +11 -0
  100. package/dist/iac/fields/number.d.cts.map +1 -0
  101. package/dist/iac/fields/number.d.ts +11 -0
  102. package/dist/iac/fields/number.d.ts.map +1 -0
  103. package/dist/iac/fields/number.js +29 -0
  104. package/dist/iac/fields/number.js.map +1 -0
  105. package/dist/iac/fields/richText.cjs +49 -0
  106. package/dist/iac/fields/richText.cjs.map +1 -0
  107. package/dist/iac/fields/richText.d.cts +33 -0
  108. package/dist/iac/fields/richText.d.cts.map +1 -0
  109. package/dist/iac/fields/richText.d.ts +33 -0
  110. package/dist/iac/fields/richText.d.ts.map +1 -0
  111. package/dist/iac/fields/richText.js +49 -0
  112. package/dist/iac/fields/richText.js.map +1 -0
  113. package/dist/iac/fields/select.cjs +46 -0
  114. package/dist/iac/fields/select.cjs.map +1 -0
  115. package/dist/iac/fields/select.d.cts +15 -0
  116. package/dist/iac/fields/select.d.cts.map +1 -0
  117. package/dist/iac/fields/select.d.ts +15 -0
  118. package/dist/iac/fields/select.d.ts.map +1 -0
  119. package/dist/iac/fields/select.js +46 -0
  120. package/dist/iac/fields/select.js.map +1 -0
  121. package/dist/iac/fields/sliceZone.cjs +37 -0
  122. package/dist/iac/fields/sliceZone.cjs.map +1 -0
  123. package/dist/iac/fields/sliceZone.d.cts +30 -0
  124. package/dist/iac/fields/sliceZone.d.cts.map +1 -0
  125. package/dist/iac/fields/sliceZone.d.ts +30 -0
  126. package/dist/iac/fields/sliceZone.d.ts.map +1 -0
  127. package/dist/iac/fields/sliceZone.js +37 -0
  128. package/dist/iac/fields/sliceZone.js.map +1 -0
  129. package/dist/iac/fields/table.cjs +26 -0
  130. package/dist/iac/fields/table.cjs.map +1 -0
  131. package/dist/iac/fields/table.d.cts +10 -0
  132. package/dist/iac/fields/table.d.cts.map +1 -0
  133. package/dist/iac/fields/table.d.ts +10 -0
  134. package/dist/iac/fields/table.d.ts.map +1 -0
  135. package/dist/iac/fields/table.js +26 -0
  136. package/dist/iac/fields/table.js.map +1 -0
  137. package/dist/iac/fields/text.cjs +29 -0
  138. package/dist/iac/fields/text.cjs.map +1 -0
  139. package/dist/iac/fields/text.d.cts +11 -0
  140. package/dist/iac/fields/text.d.cts.map +1 -0
  141. package/dist/iac/fields/text.d.ts +11 -0
  142. package/dist/iac/fields/text.d.ts.map +1 -0
  143. package/dist/iac/fields/text.js +29 -0
  144. package/dist/iac/fields/text.js.map +1 -0
  145. package/dist/iac/fields/timestamp.cjs +29 -0
  146. package/dist/iac/fields/timestamp.cjs.map +1 -0
  147. package/dist/iac/fields/timestamp.d.cts +11 -0
  148. package/dist/iac/fields/timestamp.d.cts.map +1 -0
  149. package/dist/iac/fields/timestamp.d.ts +11 -0
  150. package/dist/iac/fields/timestamp.d.ts.map +1 -0
  151. package/dist/iac/fields/timestamp.js +29 -0
  152. package/dist/iac/fields/timestamp.js.map +1 -0
  153. package/dist/iac/fields/uid.cjs +29 -0
  154. package/dist/iac/fields/uid.cjs.map +1 -0
  155. package/dist/iac/fields/uid.d.cts +11 -0
  156. package/dist/iac/fields/uid.d.cts.map +1 -0
  157. package/dist/iac/fields/uid.d.ts +11 -0
  158. package/dist/iac/fields/uid.d.ts.map +1 -0
  159. package/dist/iac/fields/uid.js +29 -0
  160. package/dist/iac/fields/uid.js.map +1 -0
  161. package/dist/iac/sharedSlice.cjs +54 -0
  162. package/dist/iac/sharedSlice.cjs.map +1 -0
  163. package/dist/iac/sharedSlice.d.cts +28 -0
  164. package/dist/iac/sharedSlice.d.cts.map +1 -0
  165. package/dist/iac/sharedSlice.d.ts +28 -0
  166. package/dist/iac/sharedSlice.d.ts.map +1 -0
  167. package/dist/iac/sharedSlice.js +54 -0
  168. package/dist/iac/sharedSlice.js.map +1 -0
  169. package/dist/iac/variation.cjs +45 -0
  170. package/dist/iac/variation.cjs.map +1 -0
  171. package/dist/iac/variation.d.cts +46 -0
  172. package/dist/iac/variation.d.cts.map +1 -0
  173. package/dist/iac/variation.d.ts +46 -0
  174. package/dist/iac/variation.d.ts.map +1 -0
  175. package/dist/iac/variation.js +44 -0
  176. package/dist/iac/variation.js.map +1 -0
  177. package/dist/iac.cjs +86 -0
  178. package/dist/iac.cjs.map +1 -0
  179. package/dist/iac.d.cts +109 -0
  180. package/dist/iac.d.cts.map +1 -0
  181. package/dist/iac.d.ts +110 -0
  182. package/dist/iac.d.ts.map +1 -0
  183. package/dist/iac.js +86 -0
  184. package/dist/iac.js.map +1 -0
  185. package/dist/index.d.cts +2 -2
  186. package/dist/index.d.ts +2 -2
  187. package/dist/package.cjs +1 -1
  188. package/dist/package.cjs.map +1 -1
  189. package/dist/package.js +1 -1
  190. package/dist/package.js.map +1 -1
  191. package/dist/types/model/types.d.cts +2 -2
  192. package/dist/types/model/types.d.ts +2 -2
  193. package/package.json +9 -2
  194. package/src/iac/customType.ts +98 -0
  195. package/src/iac/fields/boolean.ts +55 -0
  196. package/src/iac/fields/color.ts +33 -0
  197. package/src/iac/fields/contentRelationship.ts +74 -0
  198. package/src/iac/fields/date.ts +33 -0
  199. package/src/iac/fields/embed.ts +33 -0
  200. package/src/iac/fields/geoPoint.ts +33 -0
  201. package/src/iac/fields/group.ts +58 -0
  202. package/src/iac/fields/image.ts +65 -0
  203. package/src/iac/fields/index.ts +62 -0
  204. package/src/iac/fields/integration.ts +43 -0
  205. package/src/iac/fields/link.ts +79 -0
  206. package/src/iac/fields/linkToMedia.ts +37 -0
  207. package/src/iac/fields/number.ts +35 -0
  208. package/src/iac/fields/richText.ts +84 -0
  209. package/src/iac/fields/select.ts +63 -0
  210. package/src/iac/fields/sliceZone.ts +82 -0
  211. package/src/iac/fields/table.ts +31 -0
  212. package/src/iac/fields/text.ts +33 -0
  213. package/src/iac/fields/timestamp.ts +35 -0
  214. package/src/iac/fields/uid.ts +33 -0
  215. package/src/iac/index.ts +122 -0
  216. package/src/iac/sharedSlice.ts +81 -0
  217. package/src/iac/variation.ts +107 -0
@@ -0,0 +1,55 @@
1
+ import type { CustomTypeModelBooleanField } from "../../types/model/boolean"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for a boolean field.
6
+ */
7
+ export interface BooleanFieldConfig {
8
+ label?: string | null
9
+ /**
10
+ * Default value for the boolean field.
11
+ */
12
+ default_value?: boolean
13
+ /**
14
+ * Placeholder text shown when the value is true.
15
+ */
16
+ placeholder_true?: string
17
+ /**
18
+ * Placeholder text shown when the value is false.
19
+ */
20
+ placeholder_false?: string
21
+ }
22
+
23
+ /**
24
+ * Creates a boolean field model.
25
+ *
26
+ * @example
27
+ *
28
+ * ```ts
29
+ * model.boolean({ label: "Featured" })
30
+ *
31
+ * model.boolean({
32
+ * label: "Published",
33
+ * default_value: false,
34
+ * placeholder_true: "Published",
35
+ * placeholder_false: "Draft"
36
+ * })
37
+ * ```
38
+ *
39
+ * @param config - Configuration for the field.
40
+ *
41
+ * @returns A boolean field model.
42
+ */
43
+ export const boolean = (
44
+ config?: BooleanFieldConfig,
45
+ ): CustomTypeModelBooleanField => {
46
+ return {
47
+ type: CustomTypeModelFieldType.Boolean,
48
+ config: {
49
+ label: config?.label ?? null,
50
+ default_value: config?.default_value,
51
+ placeholder_true: config?.placeholder_true,
52
+ placeholder_false: config?.placeholder_false,
53
+ },
54
+ }
55
+ }
@@ -0,0 +1,33 @@
1
+ import type { CustomTypeModelColorField } from "../../types/model/color"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for a color field.
6
+ */
7
+ export interface ColorFieldConfig {
8
+ label?: string | null
9
+ placeholder?: string
10
+ }
11
+
12
+ /**
13
+ * Creates a color field model.
14
+ *
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * model.color({ label: "Background Color" })
19
+ * ```
20
+ *
21
+ * @param config - Configuration for the field.
22
+ *
23
+ * @returns A color field model.
24
+ */
25
+ export const color = (config?: ColorFieldConfig): CustomTypeModelColorField => {
26
+ return {
27
+ type: CustomTypeModelFieldType.Color,
28
+ config: {
29
+ label: config?.label ?? null,
30
+ placeholder: config?.placeholder,
31
+ },
32
+ }
33
+ }
@@ -0,0 +1,74 @@
1
+ import type { CustomTypeModelContentRelationshipField } from "../../types/model/contentRelationship"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+ import { CustomTypeModelLinkSelectType } from "../../types/model/link"
4
+
5
+ /**
6
+ * Configuration for a content relationship field.
7
+ */
8
+ export interface ContentRelationshipFieldConfig<
9
+ CustomTypes extends string = string,
10
+ Tags extends string = string,
11
+ > {
12
+ label?: string | null
13
+ placeholder?: string
14
+ /**
15
+ * Custom types to allow linking to.
16
+ *
17
+ * @example ["blog_post", "author"] as const
18
+ */
19
+ customtypes?: readonly CustomTypes[]
20
+ /**
21
+ * Tags to filter by.
22
+ *
23
+ * @example ["featured"] as const
24
+ */
25
+ tags?: readonly Tags[]
26
+ }
27
+
28
+ /**
29
+ * Creates a content relationship field model.
30
+ *
31
+ * @example
32
+ *
33
+ * ```ts
34
+ * // Any document
35
+ * model.contentRelationship({ label: "Related Content" })
36
+ *
37
+ * // Specific custom types (type-safe)
38
+ * model.contentRelationship({
39
+ * label: "Author",
40
+ * customtypes: ["author", "contributor"] as const
41
+ * })
42
+ *
43
+ * // With tag filtering
44
+ * model.contentRelationship({
45
+ * label: "Featured Post",
46
+ * customtypes: ["blog_post"] as const,
47
+ * tags: ["featured"] as const
48
+ * })
49
+ * ```
50
+ *
51
+ * @typeParam CustomTypes - Custom type ID literals for type inference.
52
+ * @typeParam Tags - Tag literals for type inference.
53
+ *
54
+ * @param config - Configuration for the field.
55
+ *
56
+ * @returns A content relationship field model.
57
+ */
58
+ export const contentRelationship = <
59
+ CustomTypes extends string = string,
60
+ Tags extends string = string,
61
+ >(
62
+ config?: ContentRelationshipFieldConfig<CustomTypes, Tags>,
63
+ ): CustomTypeModelContentRelationshipField<CustomTypes, Tags> => {
64
+ return {
65
+ type: CustomTypeModelFieldType.Link,
66
+ config: {
67
+ label: config?.label ?? null,
68
+ placeholder: config?.placeholder,
69
+ select: CustomTypeModelLinkSelectType.Document,
70
+ customtypes: config?.customtypes,
71
+ tags: config?.tags,
72
+ },
73
+ }
74
+ }
@@ -0,0 +1,33 @@
1
+ import type { CustomTypeModelDateField } from "../../types/model/date"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for a date field.
6
+ */
7
+ export interface DateFieldConfig {
8
+ label?: string | null
9
+ placeholder?: string
10
+ }
11
+
12
+ /**
13
+ * Creates a date field model.
14
+ *
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * model.date({ label: "Publication Date" })
19
+ * ```
20
+ *
21
+ * @param config - Configuration for the field.
22
+ *
23
+ * @returns A date field model.
24
+ */
25
+ export const date = (config?: DateFieldConfig): CustomTypeModelDateField => {
26
+ return {
27
+ type: CustomTypeModelFieldType.Date,
28
+ config: {
29
+ label: config?.label ?? null,
30
+ placeholder: config?.placeholder,
31
+ },
32
+ }
33
+ }
@@ -0,0 +1,33 @@
1
+ import type { CustomTypeModelEmbedField } from "../../types/model/embed"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for an embed field.
6
+ */
7
+ export interface EmbedFieldConfig {
8
+ label?: string | null
9
+ placeholder?: string
10
+ }
11
+
12
+ /**
13
+ * Creates an embed field model.
14
+ *
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * model.embed({ label: "Video" })
19
+ * ```
20
+ *
21
+ * @param config - Configuration for the field.
22
+ *
23
+ * @returns An embed field model.
24
+ */
25
+ export const embed = (config?: EmbedFieldConfig): CustomTypeModelEmbedField => {
26
+ return {
27
+ type: CustomTypeModelFieldType.Embed,
28
+ config: {
29
+ label: config?.label ?? null,
30
+ placeholder: config?.placeholder,
31
+ },
32
+ }
33
+ }
@@ -0,0 +1,33 @@
1
+ import type { CustomTypeModelGeoPointField } from "../../types/model/geoPoint"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for a geo point field.
6
+ */
7
+ export interface GeoPointFieldConfig {
8
+ label?: string | null
9
+ }
10
+
11
+ /**
12
+ * Creates a geo point field model.
13
+ *
14
+ * @example
15
+ *
16
+ * ```ts
17
+ * model.geoPoint({ label: "Location" })
18
+ * ```
19
+ *
20
+ * @param config - Configuration for the field.
21
+ *
22
+ * @returns A geo point field model.
23
+ */
24
+ export const geoPoint = (
25
+ config?: GeoPointFieldConfig,
26
+ ): CustomTypeModelGeoPointField => {
27
+ return {
28
+ type: CustomTypeModelFieldType.GeoPoint,
29
+ config: {
30
+ label: config?.label ?? null,
31
+ },
32
+ }
33
+ }
@@ -0,0 +1,58 @@
1
+ import type { CustomTypeModelGroupField } from "../../types/model/group"
2
+ import type { CustomTypeModelFieldForGroup } from "../../types/model/types"
3
+ import { CustomTypeModelFieldType } from "../../types/model/types"
4
+
5
+ /**
6
+ * Configuration for a group field.
7
+ */
8
+ export interface GroupFieldConfig<
9
+ Fields extends Record<string, CustomTypeModelFieldForGroup> = Record<
10
+ string,
11
+ CustomTypeModelFieldForGroup
12
+ >,
13
+ > {
14
+ label?: string | null
15
+ /**
16
+ * Fields within the group.
17
+ */
18
+ fields?: Fields
19
+ }
20
+
21
+ /**
22
+ * Creates a group field model.
23
+ *
24
+ * @example
25
+ *
26
+ * ```ts
27
+ * model.group({
28
+ * label: "Items",
29
+ * fields: {
30
+ * title: model.text({ label: "Title" }),
31
+ * image: model.image({ label: "Image" }),
32
+ * link: model.link({ label: "Link" })
33
+ * }
34
+ * })
35
+ * ```
36
+ *
37
+ * @typeParam Fields - Field definitions for type inference.
38
+ *
39
+ * @param config - Configuration for the field.
40
+ *
41
+ * @returns A group field model.
42
+ */
43
+ export const group = <
44
+ Fields extends Record<string, CustomTypeModelFieldForGroup> = Record<
45
+ string,
46
+ CustomTypeModelFieldForGroup
47
+ >,
48
+ >(
49
+ config?: GroupFieldConfig<Fields>,
50
+ ): CustomTypeModelGroupField<Fields> => {
51
+ return {
52
+ type: CustomTypeModelFieldType.Group,
53
+ config: {
54
+ label: config?.label ?? null,
55
+ fields: config?.fields,
56
+ },
57
+ }
58
+ }
@@ -0,0 +1,65 @@
1
+ import type {
2
+ CustomTypeModelImageConstraint,
3
+ CustomTypeModelImageField,
4
+ CustomTypeModelImageThumbnail,
5
+ } from "../../types/model/image"
6
+ import { CustomTypeModelFieldType } from "../../types/model/types"
7
+
8
+ /**
9
+ * Configuration for an image field.
10
+ */
11
+ export interface ImageFieldConfig<ThumbnailNames extends string = string> {
12
+ label?: string | null
13
+ /**
14
+ * Dimension constraints for the image.
15
+ */
16
+ constraint?: CustomTypeModelImageConstraint
17
+ /**
18
+ * Thumbnails (responsive views) for the image.
19
+ */
20
+ thumbnails?: readonly CustomTypeModelImageThumbnail<ThumbnailNames>[]
21
+ }
22
+
23
+ /**
24
+ * Creates an image field model.
25
+ *
26
+ * @example
27
+ *
28
+ * ```ts
29
+ * // Simple image
30
+ * model.image({ label: "Hero Image" })
31
+ *
32
+ * // With constraints
33
+ * model.image({
34
+ * label: "Banner",
35
+ * constraint: { width: 1920, height: 1080 }
36
+ * })
37
+ *
38
+ * // With thumbnails (type-safe names)
39
+ * model.image({
40
+ * label: "Photo",
41
+ * thumbnails: [
42
+ * { name: "mobile", width: 640, height: 360 },
43
+ * { name: "tablet", width: 1024, height: 576 }
44
+ * ] as const
45
+ * })
46
+ * ```
47
+ *
48
+ * @typeParam ThumbnailNames - Thumbnail name literals for type inference.
49
+ *
50
+ * @param config - Configuration for the field.
51
+ *
52
+ * @returns An image field model.
53
+ */
54
+ export const image = <ThumbnailNames extends string = string>(
55
+ config?: ImageFieldConfig<ThumbnailNames>,
56
+ ): CustomTypeModelImageField<ThumbnailNames> => {
57
+ return {
58
+ type: CustomTypeModelFieldType.Image,
59
+ config: {
60
+ label: config?.label ?? null,
61
+ constraint: config?.constraint,
62
+ thumbnails: config?.thumbnails,
63
+ },
64
+ }
65
+ }
@@ -0,0 +1,62 @@
1
+ // Simple fields
2
+ export { boolean } from "./boolean"
3
+ export type { BooleanFieldConfig } from "./boolean"
4
+
5
+ export { color } from "./color"
6
+ export type { ColorFieldConfig } from "./color"
7
+
8
+ export { date } from "./date"
9
+ export type { DateFieldConfig } from "./date"
10
+
11
+ export { timestamp } from "./timestamp"
12
+ export type { TimestampFieldConfig } from "./timestamp"
13
+
14
+ export { number } from "./number"
15
+ export type { NumberFieldConfig } from "./number"
16
+
17
+ export { geoPoint } from "./geoPoint"
18
+ export type { GeoPointFieldConfig } from "./geoPoint"
19
+
20
+ export { embed } from "./embed"
21
+ export type { EmbedFieldConfig } from "./embed"
22
+
23
+ export { table } from "./table"
24
+ export type { TableFieldConfig } from "./table"
25
+
26
+ // Text fields
27
+ export { text } from "./text"
28
+ export type { TextFieldConfig } from "./text"
29
+
30
+ export { richText } from "./richText"
31
+ export type { RichTextFieldConfig } from "./richText"
32
+
33
+ // Media fields
34
+ export { image } from "./image"
35
+ export type { ImageFieldConfig } from "./image"
36
+
37
+ export { linkToMedia } from "./linkToMedia"
38
+ export type { LinkToMediaFieldConfig } from "./linkToMedia"
39
+
40
+ // Link fields
41
+ export { link } from "./link"
42
+ export type { LinkFieldConfig } from "./link"
43
+
44
+ export { contentRelationship } from "./contentRelationship"
45
+ export type { ContentRelationshipFieldConfig } from "./contentRelationship"
46
+
47
+ // Special fields
48
+ export { select } from "./select"
49
+ export type { SelectFieldConfig } from "./select"
50
+
51
+ export { uid } from "./uid"
52
+ export type { UIDFieldConfig } from "./uid"
53
+
54
+ export { integration } from "./integration"
55
+ export type { IntegrationFieldConfig } from "./integration"
56
+
57
+ // Structural fields
58
+ export { group } from "./group"
59
+ export type { GroupFieldConfig } from "./group"
60
+
61
+ export { sliceZone } from "./sliceZone"
62
+ export type { SliceZoneFieldConfig } from "./sliceZone"
@@ -0,0 +1,43 @@
1
+ import type { CustomTypeModelIntegrationField } from "../../types/model/integration"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for an integration field.
6
+ */
7
+ export interface IntegrationFieldConfig {
8
+ label?: string | null
9
+ placeholder?: string
10
+ /**
11
+ * The catalog ID for the integration.
12
+ */
13
+ catalog?: string
14
+ }
15
+
16
+ /**
17
+ * Creates an integration field model.
18
+ *
19
+ * @example
20
+ *
21
+ * ```ts
22
+ * model.integration({
23
+ * label: "Product",
24
+ * catalog: "my-catalog-id"
25
+ * })
26
+ * ```
27
+ *
28
+ * @param config - Configuration for the field.
29
+ *
30
+ * @returns An integration field model.
31
+ */
32
+ export const integration = (
33
+ config?: IntegrationFieldConfig,
34
+ ): CustomTypeModelIntegrationField => {
35
+ return {
36
+ type: CustomTypeModelFieldType.Integration,
37
+ config: {
38
+ label: config?.label ?? null,
39
+ placeholder: config?.placeholder,
40
+ catalog: config?.catalog,
41
+ },
42
+ }
43
+ }
@@ -0,0 +1,79 @@
1
+ import type {
2
+ CustomTypeModelLinkField,
3
+ CustomTypeModelLinkSelectType,
4
+ } from "../../types/model/link"
5
+ import { CustomTypeModelFieldType } from "../../types/model/types"
6
+
7
+ /**
8
+ * Configuration for a link field.
9
+ */
10
+ export interface LinkFieldConfig {
11
+ label?: string | null
12
+ placeholder?: string
13
+ /**
14
+ * Restrict the link type.
15
+ *
16
+ * - `"document"` - Only allow content relationship links.
17
+ * - `"media"` - Only allow media links.
18
+ * - `"web"` - Only allow web links.
19
+ * - `null` or `undefined` - Allow all link types.
20
+ */
21
+ select?:
22
+ | (typeof CustomTypeModelLinkSelectType)[keyof typeof CustomTypeModelLinkSelectType]
23
+ | null
24
+ /**
25
+ * Allow custom link text.
26
+ */
27
+ allowText?: boolean
28
+ /**
29
+ * Allow opening links in a new tab.
30
+ */
31
+ allowTargetBlank?: boolean
32
+ /**
33
+ * Allow multiple links (repeatable).
34
+ */
35
+ repeat?: boolean
36
+ /**
37
+ * Link variants.
38
+ */
39
+ variants?: string[]
40
+ }
41
+
42
+ /**
43
+ * Creates a link field model.
44
+ *
45
+ * @example
46
+ *
47
+ * ```ts
48
+ * // Any link type
49
+ * model.link({ label: "CTA Link" })
50
+ *
51
+ * // Web links only
52
+ * model.link({ label: "External Link", select: "web" })
53
+ *
54
+ * // With custom text and target blank
55
+ * model.link({
56
+ * label: "Button Link",
57
+ * allowText: true,
58
+ * allowTargetBlank: true
59
+ * })
60
+ * ```
61
+ *
62
+ * @param config - Configuration for the field.
63
+ *
64
+ * @returns A link field model.
65
+ */
66
+ export const link = (config?: LinkFieldConfig): CustomTypeModelLinkField => {
67
+ return {
68
+ type: CustomTypeModelFieldType.Link,
69
+ config: {
70
+ label: config?.label ?? null,
71
+ placeholder: config?.placeholder,
72
+ select: config?.select,
73
+ allowText: config?.allowText,
74
+ allowTargetBlank: config?.allowTargetBlank,
75
+ repeat: config?.repeat,
76
+ variants: config?.variants,
77
+ },
78
+ }
79
+ }
@@ -0,0 +1,37 @@
1
+ import type { CustomTypeModelLinkToMediaField } from "../../types/model/linkToMedia"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+ import { CustomTypeModelLinkSelectType } from "../../types/model/link"
4
+
5
+ /**
6
+ * Configuration for a link to media field.
7
+ */
8
+ export interface LinkToMediaFieldConfig {
9
+ label?: string | null
10
+ placeholder?: string
11
+ }
12
+
13
+ /**
14
+ * Creates a link to media field model.
15
+ *
16
+ * @example
17
+ *
18
+ * ```ts
19
+ * model.linkToMedia({ label: "Download File" })
20
+ * ```
21
+ *
22
+ * @param config - Configuration for the field.
23
+ *
24
+ * @returns A link to media field model.
25
+ */
26
+ export const linkToMedia = (
27
+ config?: LinkToMediaFieldConfig,
28
+ ): CustomTypeModelLinkToMediaField => {
29
+ return {
30
+ type: CustomTypeModelFieldType.Link,
31
+ config: {
32
+ label: config?.label ?? null,
33
+ placeholder: config?.placeholder,
34
+ select: CustomTypeModelLinkSelectType.Media,
35
+ },
36
+ }
37
+ }
@@ -0,0 +1,35 @@
1
+ import type { CustomTypeModelNumberField } from "../../types/model/number"
2
+ import { CustomTypeModelFieldType } from "../../types/model/types"
3
+
4
+ /**
5
+ * Configuration for a number field.
6
+ */
7
+ export interface NumberFieldConfig {
8
+ label?: string | null
9
+ placeholder?: string
10
+ }
11
+
12
+ /**
13
+ * Creates a number field model.
14
+ *
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * model.number({ label: "Price" })
19
+ * ```
20
+ *
21
+ * @param config - Configuration for the field.
22
+ *
23
+ * @returns A number field model.
24
+ */
25
+ export const number = (
26
+ config?: NumberFieldConfig,
27
+ ): CustomTypeModelNumberField => {
28
+ return {
29
+ type: CustomTypeModelFieldType.Number,
30
+ config: {
31
+ label: config?.label ?? null,
32
+ placeholder: config?.placeholder,
33
+ },
34
+ }
35
+ }