@datocms/cma-client 5.1.11 → 5.1.13

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 (118) hide show
  1. package/README.md +313 -178
  2. package/dist/cjs/fieldTypes/file.js +6 -6
  3. package/dist/cjs/fieldTypes/gallery.js +7 -7
  4. package/dist/cjs/fieldTypes/rich_text.js +14 -12
  5. package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
  6. package/dist/cjs/fieldTypes/schema.js +3 -0
  7. package/dist/cjs/fieldTypes/schema.js.map +1 -0
  8. package/dist/cjs/fieldTypes/single_block.js +13 -12
  9. package/dist/cjs/fieldTypes/single_block.js.map +1 -1
  10. package/dist/cjs/fieldTypes/structured_text.js +13 -12
  11. package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
  12. package/dist/cjs/generated/Client.js +1 -1
  13. package/dist/cjs/generated/resources/Item.js.map +1 -1
  14. package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
  15. package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
  16. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  17. package/dist/cjs/index.js +1 -0
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/utilities/buildBlockRecord.js +1 -46
  20. package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
  21. package/dist/cjs/utilities/duplicateBlockRecord.js +50 -0
  22. package/dist/cjs/utilities/duplicateBlockRecord.js.map +1 -0
  23. package/dist/cjs/utilities/inspectItem.js +50 -20
  24. package/dist/cjs/utilities/inspectItem.js.map +1 -1
  25. package/dist/cjs/utilities/nonRecursiveBlocks.js +1 -170
  26. package/dist/cjs/utilities/nonRecursiveBlocks.js.map +1 -1
  27. package/dist/cjs/utilities/recursiveBlocks.js +52 -112
  28. package/dist/cjs/utilities/recursiveBlocks.js.map +1 -1
  29. package/dist/esm/fieldTypes/file.d.ts +3 -3
  30. package/dist/esm/fieldTypes/file.js +3 -3
  31. package/dist/esm/fieldTypes/gallery.d.ts +5 -5
  32. package/dist/esm/fieldTypes/gallery.js +5 -5
  33. package/dist/esm/fieldTypes/rich_text.d.ts +8 -9
  34. package/dist/esm/fieldTypes/rich_text.js +9 -7
  35. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  36. package/dist/esm/fieldTypes/schema.d.ts +59 -0
  37. package/dist/esm/fieldTypes/schema.js +2 -0
  38. package/dist/esm/fieldTypes/schema.js.map +1 -0
  39. package/dist/esm/fieldTypes/single_block.d.ts +30 -15
  40. package/dist/esm/fieldTypes/single_block.js +8 -7
  41. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  42. package/dist/esm/fieldTypes/structured_text.d.ts +14 -15
  43. package/dist/esm/fieldTypes/structured_text.js +8 -7
  44. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  45. package/dist/esm/generated/ApiTypes.d.ts +94 -980
  46. package/dist/esm/generated/Client.js +1 -1
  47. package/dist/esm/generated/RawApiTypes.d.ts +160 -999
  48. package/dist/esm/generated/resources/Field.d.ts +300 -300
  49. package/dist/esm/generated/resources/Item.d.ts +34 -34
  50. package/dist/esm/generated/resources/Item.js.map +1 -1
  51. package/dist/esm/generated/resources/ItemVersion.d.ts +3 -1
  52. package/dist/esm/generated/resources/ScheduledPublication.d.ts +3 -3
  53. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  54. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +3 -3
  55. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  56. package/dist/esm/generated/resources/Upload.d.ts +6 -6
  57. package/dist/esm/generated/resources/Upload.js.map +1 -1
  58. package/dist/esm/index.d.ts +1 -0
  59. package/dist/esm/index.js +1 -0
  60. package/dist/esm/index.js.map +1 -1
  61. package/dist/esm/utilities/buildBlockRecord.d.ts +11 -5
  62. package/dist/esm/utilities/buildBlockRecord.js +0 -44
  63. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  64. package/dist/esm/utilities/duplicateBlockRecord.d.ts +6 -0
  65. package/dist/esm/utilities/duplicateBlockRecord.js +46 -0
  66. package/dist/esm/utilities/duplicateBlockRecord.js.map +1 -0
  67. package/dist/esm/utilities/inspectItem.d.ts +3 -3
  68. package/dist/esm/utilities/inspectItem.js +28 -21
  69. package/dist/esm/utilities/inspectItem.js.map +1 -1
  70. package/dist/esm/utilities/itemDefinition.d.ts +25 -27
  71. package/dist/esm/utilities/nonRecursiveBlocks.d.ts +10 -75
  72. package/dist/esm/utilities/nonRecursiveBlocks.js +1 -164
  73. package/dist/esm/utilities/nonRecursiveBlocks.js.map +1 -1
  74. package/dist/esm/utilities/recursiveBlocks.d.ts +53 -23
  75. package/dist/esm/utilities/recursiveBlocks.js +52 -112
  76. package/dist/esm/utilities/recursiveBlocks.js.map +1 -1
  77. package/dist/types/fieldTypes/file.d.ts +3 -3
  78. package/dist/types/fieldTypes/gallery.d.ts +5 -5
  79. package/dist/types/fieldTypes/rich_text.d.ts +8 -9
  80. package/dist/types/fieldTypes/schema.d.ts +59 -0
  81. package/dist/types/fieldTypes/single_block.d.ts +30 -15
  82. package/dist/types/fieldTypes/structured_text.d.ts +14 -15
  83. package/dist/types/generated/ApiTypes.d.ts +94 -980
  84. package/dist/types/generated/RawApiTypes.d.ts +160 -999
  85. package/dist/types/generated/resources/Field.d.ts +300 -300
  86. package/dist/types/generated/resources/Item.d.ts +34 -34
  87. package/dist/types/generated/resources/ItemVersion.d.ts +3 -1
  88. package/dist/types/generated/resources/ScheduledPublication.d.ts +3 -3
  89. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +3 -3
  90. package/dist/types/generated/resources/Upload.d.ts +6 -6
  91. package/dist/types/index.d.ts +1 -0
  92. package/dist/types/utilities/buildBlockRecord.d.ts +11 -5
  93. package/dist/types/utilities/duplicateBlockRecord.d.ts +6 -0
  94. package/dist/types/utilities/inspectItem.d.ts +3 -3
  95. package/dist/types/utilities/itemDefinition.d.ts +25 -27
  96. package/dist/types/utilities/nonRecursiveBlocks.d.ts +10 -75
  97. package/dist/types/utilities/recursiveBlocks.d.ts +53 -23
  98. package/package.json +4 -4
  99. package/src/fieldTypes/file.ts +6 -6
  100. package/src/fieldTypes/gallery.ts +10 -10
  101. package/src/fieldTypes/rich_text.ts +26 -24
  102. package/src/fieldTypes/schema.ts +657 -0
  103. package/src/fieldTypes/single_block.ts +61 -38
  104. package/src/fieldTypes/structured_text.ts +57 -51
  105. package/src/generated/ApiTypes.ts +221 -1880
  106. package/src/generated/Client.ts +1 -1
  107. package/src/generated/RawApiTypes.ts +276 -2113
  108. package/src/generated/resources/Item.ts +93 -187
  109. package/src/generated/resources/ScheduledPublication.ts +4 -15
  110. package/src/generated/resources/ScheduledUnpublishing.ts +4 -15
  111. package/src/generated/resources/Upload.ts +9 -32
  112. package/src/index.ts +1 -0
  113. package/src/utilities/buildBlockRecord.ts +16 -56
  114. package/src/utilities/duplicateBlockRecord.ts +53 -0
  115. package/src/utilities/inspectItem.ts +64 -52
  116. package/src/utilities/itemDefinition.ts +109 -98
  117. package/src/utilities/nonRecursiveBlocks.ts +25 -279
  118. package/src/utilities/recursiveBlocks.ts +337 -72
@@ -1,98 +1,36 @@
1
- import type { BooleanFieldAppearance, BooleanFieldValidators, BooleanFieldValue, ColorFieldAppearance, ColorFieldValidators, ColorFieldValue, DateFieldAppearance, DateFieldValidators, DateFieldValue, DateTimeFieldAppearance, DateTimeFieldValidators, DateTimeFieldValue, FileFieldAppearance, FileFieldValidators, FloatFieldAppearance, FloatFieldValidators, FloatFieldValue, GalleryFieldAppearance, GalleryFieldValidators, IntegerFieldAppearance, IntegerFieldValidators, IntegerFieldValue, JsonFieldAppearance, JsonFieldValidators, JsonFieldValue, LatLonFieldAppearance, LatLonFieldValidators, LatLonFieldValue, LinkFieldAppearance, LinkFieldValidators, LinksFieldAppearance, LinksFieldValidators, RichTextFieldAppearance, RichTextFieldValidators, SeoFieldAppearance, SeoFieldValidators, SingleBlockFieldAppearance, SingleBlockFieldValidators, SlugFieldAppearance, SlugFieldValidators, StringFieldAppearance, StringFieldValidators, StringFieldValue, StructuredTextFieldAppearance, StructuredTextFieldValidators, TextFieldAppearance, TextFieldValidators, TextFieldValue, VideoFieldAppearance, VideoFieldValidators } from '../fieldTypes';
2
- import type { ItemDefinition } from '../utilities/itemDefinition';
3
- /**
4
- * Enhanced appearance configuration with field-specific types and addon support
5
- */
6
- type FieldAppearanceConfig<TAppearance> = TAppearance & Omit<RawFieldAttributes['appearance'], keyof TAppearance>;
7
- /**
8
- * Base field configuration for attributes (non-localized), extending the original RawApiTypes
9
- */
10
- type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
11
- field_type: FieldType;
12
- localized: false;
13
- default_value: FieldValue;
14
- validators: FieldValidators;
15
- appearance: FieldAppearanceConfig<FieldAppearance>;
16
- };
17
- /**
18
- * Base field configuration for attributes (localized), extending the original RawApiTypes
19
- */
20
- type LocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
21
- field_type: FieldType;
22
- localized: true;
23
- default_value: FieldValue | Record<string, FieldValue>;
24
- validators: FieldValidators;
25
- appearance: FieldAppearanceConfig<FieldAppearance>;
26
- };
27
- /**
28
- * Union of localized and non-localized field configurations for attributes
29
- */
30
- type FieldAttributesForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = NonLocalizedFieldAttributesForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance> | LocalizedFieldAttributesForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance>;
31
- type GenericFieldAttributes<SourceType> = FieldAttributesForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldAttributesForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldAttributesForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldAttributesForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldAttributesForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldAttributesForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldAttributesForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldAttributesForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldAttributesForFieldType<SourceType, 'lat_lon', LatLonFieldValue, LatLonFieldValidators, LatLonFieldAppearance> | FieldAttributesForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldAttributesForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldAttributesForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldAttributesForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldAttributesForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldAttributesForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldAttributesForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldAttributesForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
32
- export type FieldAttributes = GenericFieldAttributes<RawFieldAttributes>;
33
- export type Field = RawField;
34
- type LocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
35
- field_type: FieldType;
36
- localized: true;
37
- default_value?: Record<string, FieldValue>;
38
- validators?: FieldValidators;
39
- appearance?: FieldAppearanceConfig<FieldAppearance>;
40
- };
41
- type NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
42
- field_type: FieldType;
43
- localized?: false;
44
- default_value?: FieldValue;
45
- validators?: FieldValidators;
46
- appearance?: FieldAppearanceConfig<FieldAppearance>;
47
- };
48
- type FieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = LocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance> | NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType, FieldValue, FieldValidators, FieldAppearance>;
49
- type FieldCreateConfig<SourceType> = FieldCreateConfigForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'lat_lon', LatLonFieldValue, LatLonFieldValidators, LatLonFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldCreateConfigForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
50
- export type FieldCreateSchema = Omit<RawFieldCreateSchema, 'data'> & {
51
- data: Omit<RawFieldCreateSchema['data'], 'attributes'> & {
52
- attributes: FieldCreateConfig<RawFieldCreateSchema['data']['attributes']>;
1
+ import type { FieldCreateConfig, FieldUpdateConfig, GenericFieldAttributes } from '../fieldTypes/schema';
2
+ import type { ItemTypeDefinition, ToItemAttributes, ToItemAttributesInNestedResponse, ToItemAttributesInRequest } from '../utilities/itemDefinition';
3
+ export type Field = FieldStableShell;
4
+ export type FieldAttributes = GenericFieldAttributes<FieldAttributesStableShell>;
5
+ export type FieldCreateSchema = Omit<FieldCreateSchemaStableShell, 'data'> & {
6
+ data: Omit<FieldCreateSchemaStableShell['data'], 'attributes'> & {
7
+ attributes: FieldCreateConfig<FieldCreateSchemaStableShell['data']['attributes']>;
53
8
  };
54
9
  };
55
- /**
56
- * Helper type to conditionally handle default values based on localization for field updates
57
- */
58
- type FieldUpdateDefaultValue<T> = T | Record<string, T> | undefined;
59
- type FieldUpdateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance'> & {
60
- field_type?: FieldType;
61
- default_value?: FieldUpdateDefaultValue<FieldValue>;
62
- validators?: FieldValidators;
63
- appearance?: FieldAppearanceConfig<FieldAppearance>;
64
- };
65
- type FieldUpdateConfig<SourceType> = FieldUpdateConfigForFieldType<SourceType, 'boolean', BooleanFieldValue, BooleanFieldValidators, BooleanFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'color', ColorFieldValue, ColorFieldValidators, ColorFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'date', DateFieldValue, DateFieldValidators, DateFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'date_time', DateTimeFieldValue, DateTimeFieldValidators, DateTimeFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'file', null, FileFieldValidators, FileFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'float', FloatFieldValue, FloatFieldValidators, FloatFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'gallery', null, GalleryFieldValidators, GalleryFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'integer', IntegerFieldValue, IntegerFieldValidators, IntegerFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'json', JsonFieldValue, JsonFieldValidators, JsonFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'lat_lon', LatLonFieldValue, LatLonFieldValidators, LatLonFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'link', null, LinkFieldValidators, LinkFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'links', null, LinksFieldValidators, LinksFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'rich_text', null, RichTextFieldValidators, RichTextFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'seo', null, SeoFieldValidators, SeoFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'single_block', null, SingleBlockFieldValidators, SingleBlockFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'slug', null, SlugFieldValidators, SlugFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'string', StringFieldValue, StringFieldValidators, StringFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'structured_text', null, StructuredTextFieldValidators, StructuredTextFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'text', TextFieldValue, TextFieldValidators, TextFieldAppearance> | FieldUpdateConfigForFieldType<SourceType, 'video', null, VideoFieldValidators, VideoFieldAppearance>;
66
- export type FieldUpdateSchema = Omit<RawFieldUpdateSchema, 'data'> & {
67
- data: Omit<RawFieldUpdateSchema['data'], 'attributes'> & {
68
- attributes: FieldUpdateConfig<RawFieldUpdateSchema['data']['attributes']>;
10
+ export type FieldUpdateSchema = Omit<FieldUpdateSchemaStableShell, 'data'> & {
11
+ data: Omit<FieldUpdateSchemaStableShell['data'], 'attributes'> & {
12
+ attributes: FieldUpdateConfig<FieldUpdateSchemaStableShell['data']['attributes']>;
69
13
  };
70
14
  };
71
- type ForceItemTypeDataId<ItemTypeId> = Omit<ItemTypeData, 'id'> & {
72
- id: ItemTypeId;
73
- };
74
- type ForceItemTypeData<T, ItemTypeId> = {
75
- [K in keyof T]: T[K] extends ItemTypeData ? ForceItemTypeDataId<ItemTypeId> : T[K] extends object ? ForceItemTypeData<T[K], ItemTypeId> : T[K];
76
- };
77
- type ForceItemTypeId<T, ItemTypeId> = ForceItemTypeData<T, ItemTypeId> & {
78
- /** Useful for type narrowing */
79
- __itemTypeId?: ItemTypeId;
80
- };
81
- export type ApplyItemDefinitionToSchema<Schema, D extends ItemDefinition = ItemDefinition> = D extends any ? ForceItemTypeId<Schema, D['itemTypeId']> & {
82
- attributes: D['fields'];
83
- } : never;
84
- export type Item<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItem, D>;
85
- export type ItemValidateExistingSchema<D extends ItemDefinition = ItemDefinition> = {
86
- data: ApplyItemDefinitionToSchema<RawItemValidateExistingSchema['data'], D>;
87
- };
88
- export type ItemValidateNewSchema<D extends ItemDefinition = ItemDefinition> = {
89
- data: ApplyItemDefinitionToSchema<RawItemValidateNewSchema['data'], D>;
15
+ export type ItemTypeData<D extends ItemTypeDefinition = ItemTypeDefinition> = {
16
+ type: ItemTypeType;
17
+ id: D extends ItemTypeDefinition ? D['itemTypeId'] : ItemTypeIdentity;
90
18
  };
91
- export type ItemCreateSchema<D extends ItemDefinition = ItemDefinition> = {
92
- data: ApplyItemDefinitionToSchema<RawItemCreateSchema['data'], D>;
19
+ export type Item<D extends ItemTypeDefinition = ItemTypeDefinition> = {
20
+ __itemTypeId?: D['itemTypeId'];
21
+ type: ItemType1;
22
+ id: ItemIdentity;
23
+ relationships: ItemRelationships<D>;
24
+ meta: ItemMeta;
25
+ attributes: ToItemAttributes<D>;
93
26
  };
94
- export type ItemUpdateSchema<D extends ItemDefinition = ItemDefinition> = {
95
- data: ApplyItemDefinitionToSchema<RawItemUpdateSchema['data'], D>;
27
+ export type ItemInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition> = {
28
+ __itemTypeId?: D['itemTypeId'];
29
+ type: ItemType1;
30
+ id: ItemIdentity;
31
+ relationships: ItemRelationships<D>;
32
+ meta: ItemMeta;
33
+ attributes: ToItemAttributesInNestedResponse<D>;
96
34
  };
97
35
  /**
98
36
  * This file was automatically generated by hyperschema-to-ts: DO NOT MODIFY IT BY HAND.
@@ -460,17 +398,17 @@ export type UploadCollectionInstancesHrefSchema = {
460
398
  };
461
399
  };
462
400
  /**
463
- * This interface was referenced by `Item<D>`'s JSON-Schema
401
+ * This interface was referenced by `Item`'s JSON-Schema
464
402
  * via the `definition` "type".
465
403
  */
466
404
  export type ItemType1 = 'item';
467
405
  /**
468
406
  * RFC 4122 UUID of record expressed in URL-safe base64 format
469
407
  *
470
- * This interface was referenced by `Item<D>`'s JSON-Schema
408
+ * This interface was referenced by `Item`'s JSON-Schema
471
409
  * via the `definition` "identity".
472
410
  *
473
- * This interface was referenced by `Item<D>`'s JSON-Schema
411
+ * This interface was referenced by `Item`'s JSON-Schema
474
412
  * via the `definition` "id".
475
413
  */
476
414
  export type ItemIdentity = string;
@@ -683,7 +621,7 @@ export type BuildEventInstancesHrefSchema = {
683
621
  [k: string]: unknown;
684
622
  };
685
623
  /**
686
- * This interface was referenced by `Item<D>`'s JSON-Schema
624
+ * This interface was referenced by `Item`'s JSON-Schema
687
625
  * via the `instances.hrefSchema` link.
688
626
  */
689
627
  export type ItemInstancesHrefSchema = {
@@ -747,7 +685,7 @@ export type ItemInstancesHrefSchema = {
747
685
  [k: string]: unknown;
748
686
  };
749
687
  /**
750
- * This interface was referenced by `Item<D>`'s JSON-Schema
688
+ * This interface was referenced by `Item`'s JSON-Schema
751
689
  * via the `references.hrefSchema` link.
752
690
  */
753
691
  export type ItemReferencesHrefSchema = {
@@ -762,7 +700,7 @@ export type ItemReferencesHrefSchema = {
762
700
  [k: string]: unknown;
763
701
  };
764
702
  /**
765
- * This interface was referenced by `Item<D>`'s JSON-Schema
703
+ * This interface was referenced by `Item`'s JSON-Schema
766
704
  * via the `self.hrefSchema` link.
767
705
  */
768
706
  export type ItemSelfHrefSchema = {
@@ -861,7 +799,7 @@ export type ItemVersionInstancesHrefSchema = {
861
799
  [k: string]: unknown;
862
800
  };
863
801
  /**
864
- * This interface was referenced by `Item<D>`'s JSON-Schema
802
+ * This interface was referenced by `Item`'s JSON-Schema
865
803
  * via the `publish.schema` link.
866
804
  */
867
805
  export type ItemPublishSchema = {
@@ -883,7 +821,7 @@ export type ItemPublishSchema = {
883
821
  };
884
822
  } | null;
885
823
  /**
886
- * This interface was referenced by `Item<D>`'s JSON-Schema
824
+ * This interface was referenced by `Item`'s JSON-Schema
887
825
  * via the `publish.hrefSchema` link.
888
826
  */
889
827
  export type ItemPublishHrefSchema = {
@@ -894,7 +832,7 @@ export type ItemPublishHrefSchema = {
894
832
  [k: string]: unknown;
895
833
  };
896
834
  /**
897
- * This interface was referenced by `Item<D>`'s JSON-Schema
835
+ * This interface was referenced by `Item`'s JSON-Schema
898
836
  * via the `unpublish.schema` link.
899
837
  */
900
838
  export type ItemUnpublishSchema = {
@@ -909,7 +847,7 @@ export type ItemUnpublishSchema = {
909
847
  };
910
848
  } | null;
911
849
  /**
912
- * This interface was referenced by `Item<D>`'s JSON-Schema
850
+ * This interface was referenced by `Item`'s JSON-Schema
913
851
  * via the `unpublish.hrefSchema` link.
914
852
  */
915
853
  export type ItemUnpublishHrefSchema = {
@@ -1519,60 +1457,6 @@ export type SiteSelfHrefSchema = {
1519
1457
  include?: string;
1520
1458
  [k: string]: unknown;
1521
1459
  };
1522
- export type DatoApi = {
1523
- role?: Role;
1524
- user?: User;
1525
- sso_user?: SsoUser;
1526
- audit_log_event?: AuditLogEvent;
1527
- account?: Account;
1528
- organization?: Organization;
1529
- site_plan?: SitePlan;
1530
- menu_item?: MenuItem;
1531
- schema_menu_item?: SchemaMenuItem;
1532
- upload_collection?: UploadCollection;
1533
- item_type?: ItemType;
1534
- field?: Field;
1535
- fieldset?: Fieldset;
1536
- job?: Job;
1537
- session?: Session;
1538
- access_token?: AccessToken;
1539
- plugin?: Plugin;
1540
- job_result?: JobResult;
1541
- subscription_limit?: SubscriptionLimit;
1542
- subscription_feature?: SubscriptionFeature;
1543
- build_event?: BuildEvent;
1544
- item?: Item;
1545
- item_current_vs_published_state?: ItemCurrentVsPublishedState;
1546
- item_version?: ItemVersion;
1547
- upload?: Upload;
1548
- upload_request?: UploadRequest;
1549
- upload_track?: UploadTrack;
1550
- scheduled_publication?: ScheduledPublication;
1551
- scheduled_unpublishing?: ScheduledUnpublishing;
1552
- search_result?: SearchResult;
1553
- environment?: Environment;
1554
- maintenance_mode?: MaintenanceMode;
1555
- webhook?: Webhook;
1556
- webhook_call?: WebhookCall;
1557
- build_trigger?: BuildTrigger;
1558
- item_type_filter?: ItemTypeFilter;
1559
- upload_filter?: UploadFilter;
1560
- site_invitation?: SiteInvitation;
1561
- editing_session?: EditingSession;
1562
- form_data?: FormData;
1563
- sso_group?: SsoGroup;
1564
- sso_settings?: SsoSettings;
1565
- emoji_suggestions?: EmojiSuggestions;
1566
- white_label_settings?: WhiteLabelSettings;
1567
- public_info?: PublicInfo;
1568
- daily_usage?: DailyUsage;
1569
- usage_counter?: UsageCounter;
1570
- upload_tag?: UploadTag;
1571
- upload_smart_tag?: UploadSmartTag;
1572
- site?: Site;
1573
- workflow?: Workflow;
1574
- [k: string]: unknown;
1575
- };
1576
1460
  /**
1577
1461
  * A Role represents a specific set of actions an editor (or an API token) can perform on your administrative area.
1578
1462
  *
@@ -3439,13 +3323,13 @@ export type MenuItemAttributes = {
3439
3323
  */
3440
3324
  export type MenuItemRelationships = {
3441
3325
  /**
3442
- * Item<D> type associated with the menu item
3326
+ * Item type associated with the menu item
3443
3327
  */
3444
3328
  item_type: {
3445
3329
  data: ItemTypeData | null;
3446
3330
  };
3447
3331
  /**
3448
- * Item<D> type filter associated with the menu item (to be used together with `item_type` relationship)
3332
+ * Item type filter associated with the menu item (to be used together with `item_type` relationship)
3449
3333
  */
3450
3334
  item_type_filter: {
3451
3335
  data: ItemTypeFilterData | null;
@@ -3463,16 +3347,6 @@ export type MenuItemRelationships = {
3463
3347
  data: MenuItemData[];
3464
3348
  };
3465
3349
  };
3466
- /**
3467
- * JSON API data
3468
- *
3469
- * This interface was referenced by `ItemType`'s JSON-Schema
3470
- * via the `definition` "data".
3471
- */
3472
- export type ItemTypeData = {
3473
- type: ItemTypeType;
3474
- id: ItemTypeIdentity;
3475
- };
3476
3350
  /**
3477
3351
  * JSON API data
3478
3352
  *
@@ -3524,13 +3398,13 @@ export type MenuItemCreateSchema = {
3524
3398
  };
3525
3399
  relationships?: {
3526
3400
  /**
3527
- * Item<D> type associated with the menu item
3401
+ * Item type associated with the menu item
3528
3402
  */
3529
3403
  item_type?: {
3530
3404
  data: ItemTypeData | null;
3531
3405
  };
3532
3406
  /**
3533
- * Item<D> type filter associated with the menu item (to be used together with `item_type` relationship)
3407
+ * Item type filter associated with the menu item (to be used together with `item_type` relationship)
3534
3408
  */
3535
3409
  item_type_filter?: {
3536
3410
  data: ItemTypeFilterData | null;
@@ -3582,13 +3456,13 @@ export type MenuItemUpdateSchema = {
3582
3456
  };
3583
3457
  relationships?: {
3584
3458
  /**
3585
- * Item<D> type associated with the menu item
3459
+ * Item type associated with the menu item
3586
3460
  */
3587
3461
  item_type?: {
3588
3462
  data: ItemTypeData | null;
3589
3463
  };
3590
3464
  /**
3591
- * Item<D> type filter associated with the menu item (to be used together with `item_type` relationship)
3465
+ * Item type filter associated with the menu item (to be used together with `item_type` relationship)
3592
3466
  */
3593
3467
  item_type_filter?: {
3594
3468
  data: ItemTypeFilterData | null;
@@ -3729,7 +3603,7 @@ export type SchemaMenuItemAttributes = {
3729
3603
  */
3730
3604
  export type SchemaMenuItemRelationships = {
3731
3605
  /**
3732
- * Item<D> type associated with the schema menu item
3606
+ * Item type associated with the schema menu item
3733
3607
  */
3734
3608
  item_type: {
3735
3609
  data: ItemTypeData | null;
@@ -3784,7 +3658,7 @@ export type SchemaMenuItemCreateSchema = {
3784
3658
  };
3785
3659
  relationships?: {
3786
3660
  /**
3787
- * Item<D> type associated with the menu item
3661
+ * Item type associated with the menu item
3788
3662
  */
3789
3663
  item_type?: {
3790
3664
  data: ItemTypeData | null;
@@ -3832,7 +3706,7 @@ export type SchemaMenuItemUpdateSchema = {
3832
3706
  };
3833
3707
  relationships?: {
3834
3708
  /**
3835
- * Item<D> type associated with the menu item
3709
+ * Item type associated with the menu item
3836
3710
  */
3837
3711
  item_type?: {
3838
3712
  data: ItemTypeData | null;
@@ -4279,7 +4153,7 @@ export type ItemTypeRelationships = {
4279
4153
  /**
4280
4154
  * JSON API data
4281
4155
  *
4282
- * This interface was referenced by `Item<D>`'s JSON-Schema
4156
+ * This interface was referenced by `Item`'s JSON-Schema
4283
4157
  * via the `definition` "data".
4284
4158
  */
4285
4159
  export type ItemData = {
@@ -5640,7 +5514,7 @@ export type ItemTypeReorderFieldsAndFieldsetsJobSchema = {
5640
5514
  * This interface was referenced by `DatoApi`'s JSON-Schema
5641
5515
  * via the `definition` "field".
5642
5516
  */
5643
- export type RawField = {
5517
+ export type FieldStableShell = {
5644
5518
  type: FieldType;
5645
5519
  id: FieldIdentity;
5646
5520
  attributes: FieldAttributes;
@@ -5652,7 +5526,7 @@ export type RawField = {
5652
5526
  * This interface was referenced by `Field`'s JSON-Schema
5653
5527
  * via the `definition` "attributes".
5654
5528
  */
5655
- export type RawFieldAttributes = {
5529
+ export type FieldAttributesStableShell = {
5656
5530
  /**
5657
5531
  * The label of the field
5658
5532
  */
@@ -5765,7 +5639,7 @@ export type FieldRelationships = {
5765
5639
  * This interface was referenced by `Field`'s JSON-Schema
5766
5640
  * via the `create.schema` link.
5767
5641
  */
5768
- export type RawFieldCreateSchema = {
5642
+ export type FieldCreateSchemaStableShell = {
5769
5643
  data: {
5770
5644
  id?: FieldIdentity;
5771
5645
  type: FieldType;
@@ -5893,7 +5767,7 @@ export type FieldCreateJobSchema = {
5893
5767
  * This interface was referenced by `Field`'s JSON-Schema
5894
5768
  * via the `update.schema` link.
5895
5769
  */
5896
- export type RawFieldUpdateSchema = {
5770
+ export type FieldUpdateSchemaStableShell = {
5897
5771
  data: {
5898
5772
  type: FieldType;
5899
5773
  id: FieldIdentity;
@@ -6749,775 +6623,18 @@ export type BuildEventInstancesTargetSchema = {
6749
6623
  export type BuildEventSelfTargetSchema = {
6750
6624
  data: BuildEvent;
6751
6625
  };
6752
- /**
6753
- * DatoCMS stores the individual pieces of content you create from a model as records (for backwards compatibility the API calls these `item`). The shape of a record’s attributes depends on the fields defined by that record’s model — see the [Object payload](#object-payload) section for the full object payload documentation.
6754
- *
6755
- * ```json
6756
- * // A simple record
6757
- * {
6758
- * "id": "A4gkL_8pTZmcyJ-IlIEd2w",
6759
- * "type": "item",
6760
- * "attributes": {
6761
- * "title": "My Blog Post",
6762
- * "publication_date": "2024-01-15"
6763
- * },
6764
- * "relationships": {
6765
- * "item_type": {
6766
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
6767
- * }
6768
- * }
6769
- * }
6770
- * ```
6771
- *
6772
- * > [!PROTIP] 📘 New to content modeling?
6773
- * > Check out the [Content Modeling Guide](/docs/content-modelling) to understand how to design models, fields, and relationships before diving into API usage.
6774
- *
6775
- * ---
6776
- *
6777
- * ## Field types overview
6778
- *
6779
- * ###### Scalar fields
6780
- * These store basic data types (ie. strings, numbers, booleans):
6781
- *
6782
- * <details>
6783
- * <summary>Single-line string</summary>
6784
- *
6785
- * The field accepts `String` values or `null`.
6786
- *
6787
- * </details>
6788
- *
6789
- * <details>
6790
- * <summary>Slug</summary>
6791
- *
6792
- * The field accepts `String` values or `null`.
6793
- * </details>
6794
- *
6795
- * <details>
6796
- * <summary>Multi-line text</summary>
6797
- *
6798
- * The field accepts simple `String` values (can include newlines) or `null`
6799
- * </details>
6800
- *
6801
- * <details>
6802
- * <summary>Boolean</summary>
6803
- *
6804
- * The field accepts simple `Boolean` values or `null`.
6805
- * </details>
6806
- *
6807
- * <details>
6808
- * <summary>Integer</summary>
6809
- *
6810
- * The field accepts simple `Integer` values or `null`.
6811
- * </details>
6812
- *
6813
- * <details>
6814
- * <summary>Float</summary>
6815
- *
6816
- * The field accepts simple `Float` values or `null`.
6817
- *
6818
- * </details>
6819
- *
6820
- * <details>
6821
- * <summary>Date</summary>
6822
- *
6823
- * The field accepts `String` values in ISO 8601 date format (ie. `"2015-12-29"`) or `null`.
6824
- *
6825
- * </details>
6826
- *
6827
- * <details>
6828
- * <summary>Date time</summary>
6829
- *
6830
- * The field accepts `String` values in ISO 8601 date-time format (ie. `"2020-04-17T16:34:31.981+01:00"`) or `null`.
6831
- *
6832
- * If you're on [legacy timezone management](/product-updates/improved-timezone-management), remember that when sending an ISO8601 datetime you should keep in mind that the system will ignore any provided timezone, and will use the project's timezone instead.
6833
- * </details>
6834
- *
6835
- * <details>
6836
- * <summary>JSON</summary>
6837
- *
6838
- * The field accepts `String` values that are valid JSON or `null`.
6839
- *
6840
- * **Note**: Must be a JSON-serialized string, not a JavaScript object!
6841
- *
6842
- * </details>
6843
- *
6844
- * ###### Object Fields
6845
- * These require structured objects:
6846
- *
6847
- * <details>
6848
- * <summary>Color</summary>
6849
- *
6850
- * The field accepts an object with the following properties, or `null`:
6851
- *
6852
- * | Property | Required | Type |
6853
- * | -------- | -------- | --------------------------- |
6854
- * | `red` | ✅ | `Integer` between 0 and 255 |
6855
- * | `green` | ✅ | `Integer` between 0 and 255 |
6856
- * | `blue` | ✅ | `Integer` between 0 and 255 |
6857
- * | `alpha` | ✅ | `Integer` between 0 and 255 |
6858
- *
6859
- * </details>
6860
- *
6861
- *
6862
- * <details>
6863
- * <summary>Location</summary>
6864
- *
6865
- * The field accepts an object with the following properties, or `null`:
6866
- *
6867
- * | Property | Required | Type |
6868
- * | ----------- | -------- | ----------------------------- |
6869
- * | `latitude` | ✅ | `Float` between -90.0 to 90 |
6870
- * | `longitude` | ✅ | `Float` between -180.0 to 180 |
6871
- *
6872
- * </details>
6873
- *
6874
- * <details>
6875
- * <summary>SEO</summary>
6876
- *
6877
- * The field accepts an object with the following properties, or `null`:
6878
- *
6879
- * | Property | Required | Type | Description |
6880
- * | -------------- | -------- | ------------------------------------ | ----------------------------------------------- |
6881
- * | `title` | | `String` | Title meta tag (max. 320 characters) |
6882
- * | `description` | | `String` | Description meta tag (max. 320 characters) |
6883
- * | `image` | | `Upload ID` | Asset to be used for social shares |
6884
- * | `twitter_card` | | `"summary"`, `"summary_large_image"` | Type of Twitter card to use |
6885
- * | `no_index` | | `Boolean` | Whether the noindex meta tag should be returned |
6886
- *
6887
- * </details>
6888
- *
6889
- * <details>
6890
- * <summary>External video</summary>
6891
- *
6892
- * The field accepts an object with the following properties, or `null`:
6893
- *
6894
- * | Property | Required | Type | Description | Example |
6895
- * | --------------- | -------- | ------------------------------------ | -------------------------------------------------- | ---------------------------------------------------- |
6896
- * | `provider` | ✅ | `"youtube"`, `"vimeo"`, `"facebook"` | External video provider | `"youtube"` |
6897
- * | `provider_uid` | ✅ | `String` | Unique identifier of the video within the provider | `"vUdGBEb1i9g"` |
6898
- * | `url` | ✅ | `URL` | URL of the video | `"https://www.youtube.com/watch?v=qJhobECFQYk"` |
6899
- * | `width` | ✅ | `Integer` | Video width | `459` |
6900
- * | `height` | ✅ | `Integer` | Video height | `344` |
6901
- * | `thumbnail_url` | ✅ | `URL` | URL for the video thumb | `"https://i.ytimg.com/vi/vUdGBEb1i9g/hqdefault.jpg"` |
6902
- * | `title` | ✅ | `String` | Title of the video | `"Next.js Conf Booth Welcoming!"` |
6903
- *
6904
- * </details>
6905
- *
6906
- * ###### Reference Fields
6907
- *
6908
- * These point to other resources (either assets or other records):
6909
- *
6910
- * <details>
6911
- * <summary>Single-asset</summary>
6912
- *
6913
- * The field accepts an object with the following properties, or `null`:
6914
- *
6915
- * | Property | Required | Type | Description | Example |
6916
- * | ------------- | -------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
6917
- * | `upload_id` | ✅ | `Upload ID` | ID of an asset | `"dhVR2HqgRVCTGFi0bWqLqA"` |
6918
- * | `title` | | `String` | Title for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`) | `"From my trip to Italy"` |
6919
- * | `alt` | | `String` | Alternate text for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`) | `"Florence skyline"` |
6920
- * | `focal_point` | | `{ x: Float, y: Float }`, `null` | Focal point for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`). Values must be expressed as `Float` between 0 and 1. Focal point can only be specified for image assets. | `{ "x": 0.34, "y": 0.45 }` |
6921
- * | `custom_data` | | `Record<String, String>` | An object containing custom keys that you can use on your frontend projects | `{ "watermark_image": "true" }` |
6922
- *
6923
- * **API responses**: Always returns asset ID only (use separate asset API for details)
6924
- *
6925
- * </details>
6926
- *
6927
- * <details>
6928
- * <summary>Asset gallery</summary>
6929
- *
6930
- * This field accepts an `Array` of objects with the following properties, or `null`:
6931
- *
6932
- * | Property | Required | Type | Description | Example |
6933
- * | ------------- | -------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
6934
- * | `upload_id` | ✅ | `Upload ID` | ID of an asset | `"dhVR2HqgRVCTGFi0bWqLqA"` |
6935
- * | `title` | | `String` | Title for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`) | `"Gallery Image Title"` |
6936
- * | `alt` | | `String` | Alternate text for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`) | `"Gallery image description"` |
6937
- * | `focal_point` | | `{ x: Float, y: Float }`, `null` | Focal point for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`). Values must be expressed as `Float` between 0 and 1. Focal point can only be specified for image assets. | `{ "x": 0.34, "y": 0.45 }` |
6938
- * | `custom_data` | | `Record<String, String>` | An object containing custom keys that you can use on your frontend projects | `{ "watermark_image": "true" }` |
6939
- *
6940
- * **API responses**: Always returns array of asset IDs only
6941
- *
6942
- * </details>
6943
- *
6944
- * <details>
6945
- * <summary>Single link</summary>
6946
- *
6947
- * This field accepts a `String` representing the ID of the linked record, or `null`. See [Link Fields Guide](/docs/content-modelling/links) for relationship modeling concepts.
6948
- *
6949
- * **API responses**: Always returns record ID only
6950
- *
6951
- * </details>
6952
- *
6953
- * <details>
6954
- * <summary>Multiple links</summary>
6955
- *
6956
- * This field accepts an `Array<String>` representing the IDs of the linked records, or `null`. See [Link Fields Guide](/docs/content-modelling/links) for relationship modeling concepts.
6957
- *
6958
- * **API responses**: Always returns array of record IDs only
6959
- *
6960
- * </details>
6961
- *
6962
- * ###### Block Fields
6963
- *
6964
- * These are special fields that contain **blocks within records**:
6965
- *
6966
- * | Field Type | What it contains |
6967
- * | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
6968
- * | **Modular content** | An array of blocks, perfect for building dynamic page sections |
6969
- * | **Single block** | A single block instance or `null` |
6970
- * | **Structured text** | A rich text document that can have blocks embedded within the flow of content ([DAST format](/docs/structured-text/dast)) |
6971
- *
6972
- * Blocks are **records within records** - they're separate items that live inside fields of other records.
6973
- *
6974
- * > [!PROTIP] 📚 Content Modeling Context
6975
- * > To understand when and how to design blocks vs models, see [Blocks Guide](/docs/content-modelling/blocks). For field-specific concepts, see [Modular Content](/docs/content-modelling/modular-content) and [Structured Text](/docs/content-modelling/structured-text).
6976
- *
6977
- * Blocks inside those fields are unique because they can be represented in two different ways depending on the context: as a lightweight reference (an ID) or as a full content object. Understanding this duality is key to working with them effectively:
6978
- *
6979
- * * **Block ID (Lightweight Reference)**: A simple `String` that uniquely identifies the block (ie. `"dhVR2HqgRVCTGFi_0bWqLqA"`). This is useful when you only need to know *which* block is there, not what's inside it.
6980
- *
6981
- * * **Block Object (Full Content)**: The complete record object for the block, containing its own `id`, `type`, `attributes`, and `relationships`. This is used when you need to read or modify the block's actual content.
6982
- *
6983
- * ```json
6984
- * {
6985
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
6986
- * "type": "item",
6987
- * "attributes": {
6988
- * "title": "Block Title",
6989
- * "content": "Block content..."
6990
- * },
6991
- * "relationships": {
6992
- * "item_type": {
6993
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
6994
- * }
6995
- * }
6996
- * }
6997
- * ```
6998
- *
6999
- * <details>
7000
- * <summary>Modular Content</summary>
7001
- *
7002
- * A Modular Content field holds an array of blocks.
7003
- *
7004
- * **As an array of IDs:**
7005
- * ```json
7006
- * {
7007
- * "content_blocks": [
7008
- * "dhVR2HqgRVCTGFi_0bWqLqA",
7009
- * "kL9mN3pQrStUvWxYzAbCdE"
7010
- * ]
7011
- * }
7012
- * ```
7013
- *
7014
- * **As an array of full objects:**
7015
- *
7016
- * ```json
7017
- * {
7018
- * "content_blocks": [
7019
- * {
7020
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7021
- * "type": "item",
7022
- * "attributes": { "title": "Hero Section", "content": "Welcome to our site" },
7023
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7024
- * },
7025
- * {
7026
- * "id": "kL9mN3pQrStUvWxYzAbCdE",
7027
- * "type": "item",
7028
- * "attributes": { "title": "Image Gallery", "images": [...] },
7029
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7030
- * }
7031
- * ]
7032
- * }
7033
- * ```
7034
- * </details>
7035
- *
7036
- * <details>
7037
- * <summary>Single Block</summary>
7038
- *
7039
- * A Single Block field holds exactly one block, or `null`.
7040
- *
7041
- * **As an ID:**
7042
- * ```json
7043
- * {
7044
- * "featured_block": "dhVR2HqgRVCTGFi_0bWqLqA"
7045
- * }
7046
- * ```
7047
- *
7048
- * **As an full object:**
7049
- *
7050
- * ```json
7051
- * {
7052
- * "featured_block": {
7053
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7054
- * "type": "item",
7055
- * "attributes": { "title": "Featured Content", "summary": "A summary..." },
7056
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7057
- * }
7058
- * }
7059
- * ```
7060
- * </details>
7061
- *
7062
- * <details>
7063
- * <summary>Structured Text</summary>
7064
- *
7065
- * A Structured Text field can contain blocks within its document structure ([DAST format](/docs/structured-text/dast)). The item property of a `block` or `inlineBlock` node will hold either the ID or the full object.
7066
- *
7067
- * **With block IDs:**
7068
- *
7069
- * ```json
7070
- * {
7071
- * "rich_text_content": {
7072
- * "schema": "dast",
7073
- * "document": {
7074
- * "type": "root",
7075
- * "children": [
7076
- * {
7077
- * "type": "paragraph",
7078
- * "children": [{ "type": "span", "value": "Text before block." }]
7079
- * },
7080
- * {
7081
- * "type": "block",
7082
- * "item": "dhVR2HqgRVCTGFi_0bWqLqA"
7083
- * }
7084
- * ]
7085
- * }
7086
- * }
7087
- * }
7088
- * ```
7089
- *
7090
- * **With full objects:**
7091
- *
7092
- * ```json
7093
- * {
7094
- * "rich_text_content": {
7095
- * "schema": "dast",
7096
- * "document": {
7097
- * "type": "root",
7098
- * "children": [
7099
- * {
7100
- * "type": "paragraph",
7101
- * "children": [{ "type": "span", "value": "Text before block." }]
7102
- * },
7103
- * {
7104
- * "type": "block",
7105
- * "item": {
7106
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7107
- * "type": "item",
7108
- * "attributes": { "title": "Embedded Block", "content": "..." },
7109
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7110
- * }
7111
- * }
7112
- * ]
7113
- * }
7114
- * }
7115
- * }
7116
- * ```
7117
- * </details>
7118
- *
7119
- * ---
7120
- *
7121
- * ## API response modes: Regular vs. Nested
7122
- *
7123
- * When fetching record data, the API gives you control over how block fields are represented in the response. These two modes, **Regular** and **Nested**, are available on the following endpoints:
7124
- *
7125
- * * [Retrieve a single record (`GET /items/:id`)](/docs/content-management-api/resources/item/self)
7126
- * * [Retrieve multiple records (`GET /items`)](/docs/content-management-api/resources/item/instances)
7127
- * * [Retrieve records referenced by a record (`GET /items/:id/references`)](/docs/content-management-api/resources/item/references)
7128
- * * [Retrieve records linked to an asset (`GET /upload/:id/references`)](/docs/content-management-api/resources/upload/references)
7129
- *
7130
- * ###### Regular mode (default)
7131
- *
7132
- * By default, the API returns block fields as IDs only. This is efficient and fast, making it ideal for listings or when you don't need the blocks' content immediately.
7133
- *
7134
- * ```json
7135
- * GET /items/A4gkL_8pTZmcyJ-IlIEd2w
7136
- *
7137
- * {
7138
- * "id": "A4gkL_8pTZmcyJ-IlIEd2w",
7139
- * "type": "item",
7140
- * "attributes": {
7141
- * "title": "My Blog Post",
7142
- * "content_blocks": ["dhVR2HqgRVCTGFi_0bWqLqA", "kL9mN3pQrStUvWxYzAbCdE"],
7143
- * "featured_block": "nZ8xY2vWqTuJkL3mNcBeFg"
7144
- * }
7145
- * }
7146
- * ```
7147
- *
7148
- * ###### Nested mode (`?nested=true`)
7149
- *
7150
- * The same endpoint, when passing the `?nested=true` option, returns **block fields as full objects**. This is essential when you need to display or edit the content within the blocks.
7151
- *
7152
- * ```json
7153
- * GET /items/A4gkL_8pTZmcyJ-IlIEd2w?nested=true
7154
- *
7155
- * {
7156
- * "id": "A4gkL_8pTZmcyJ-IlIEd2w",
7157
- * "type": "item",
7158
- * "attributes": {
7159
- * "title": "My Blog Post",
7160
- * "content_blocks": [
7161
- * {
7162
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7163
- * "type": "item",
7164
- * "attributes": { "title": "Hero Section", "content": "Welcome to our site" },
7165
- * "relationships": { ... }
7166
- * },
7167
- * {
7168
- * "id": "kL9mN3pQrStUvWxYzAbCdE",
7169
- * "type": "item",
7170
- * "attributes": { "title": "Image Gallery", "images": [...] },
7171
- * "relationships": { ... }
7172
- * }
7173
- * ],
7174
- * "featured_block": {
7175
- * "id": "nZ8xY2vWqTuJkL3mNcBeFg",
7176
- * "type": "item",
7177
- * "attributes": { ... },
7178
- * "relationships": { ... }
7179
- * }
7180
- * }
7181
- * }
7182
- * ```
7183
- *
7184
- * > [!WARNING] Block Fields vs. Other Reference Fields
7185
- * > Block fields are the **only** field type that change representation between modes! Asset and link fields always return IDs. To get full details for assets or linked records, you need to make separate API calls using their IDs.
7186
- *
7187
- * ###### When to use each mode?
7188
- *
7189
- * | Use "Regular Mode" when... | Use "Nested Mode" when... |
7190
- * | -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
7191
- * | Listing many records or building navigation. | Displaying or editing block content, as it provides the actual content needed. |
7192
- * | You only need to know which blocks exist. | You need to read the actual block content for display or updates. |
7193
- * | Building navigation | Preparing to update blocks |
7194
- * | Performance is critical; it's faster because it returns smaller responses (block IDs instead of full content). | You are building content editing interfaces where usability is more important than raw speed. |
7195
- *
7196
- *
7197
- * ---
7198
- *
7199
- * ## Creating and updating blocks
7200
- *
7201
- * Working with blocks follows one fundamental constraint:
7202
- *
7203
- * **You cannot create, edit, or delete blocks directly. You must always update the parent record that contains them.**
7204
- *
7205
- * This ensures data integrity. To create/modify blocks, you send a payload to the parent record's endpoint, using a mix of Block IDs and Block Objects to describe the desired changes.
7206
- *
7207
- * ###### Key rules for block operations
7208
- *
7209
- * 1. **To create a new block**: Provide the **full object**, including `type`, `attributes`, and the `relationships.item_type` which specifies the Block Model being used.
7210
- * 2. **To update an existing block**: Provide the **full object**, including its `id` and the changed `attributes`. You only need to include the specific attributes that you want to change - unchanged attributes will be preserved. You don't need to specify `relationships.item_type`.
7211
- * 3. **To keep an existing block unchanged**: Simply provide its **Block ID** string. This is the most efficient way to handle unchanged blocks.
7212
- * 4. **To delete a block**: Omit it from the payload. For a Modular Content array, remove its ID. For a Single Block field, set the value to `null`.
7213
- * 5. **To reorder blocks** (in Modular Content): Send an array of Block IDs in the new desired order.
7214
- *
7215
- *
7216
- * The following examples show how to apply these rules.
7217
- *
7218
- * <details>
7219
- * <summary>Working with Modular Content Fields</summary>
7220
- *
7221
- * **Current state** (from a regular API response):
7222
- * ```json
7223
- * {
7224
- * "content_blocks": ["dhVR2HqgRVCTGFi_0bWqLqA", "kL9mN3pQrStUvWxYzAbCdE", "fG8hI1jKlMnOpQrStUvWxY"]
7225
- * }
7226
- * ```
7227
- *
7228
- * **To update the second block and reorder the others:**
7229
- * ```json
7230
- * {
7231
- * "content_blocks": [
7232
- * "fG8hI1jKlMnOpQrStUvWxY", // Reordered: kept as ID
7233
- * {
7234
- * "id": "kL9mN3pQrStUvWxYzAbCdE", // Updated: sent as object
7235
- * "type": "item",
7236
- * "attributes": { "title": "Updated Title" }
7237
- * },
7238
- * "dhVR2HqgRVCTGFi_0bWqLqA" // Reordered: kept as ID
7239
- * ]
7240
- * }
7241
- * ```
7242
- *
7243
- * **To add a new block at the end and remove the first block:**
7244
- * ```json
7245
- * {
7246
- * "content_blocks": [
7247
- * "kL9mN3pQrStUvWxYzAbCdE", // Kept as ID
7248
- * "fG8hI1jKlMnOpQrStUvWxY", // Kept as ID
7249
- * {
7250
- * "type": "item", // New block: sent as object with relationships
7251
- * "attributes": { "title": "A Brand New Block" },
7252
- * "relationships": {
7253
- * "item_type": {
7254
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
7255
- * }
7256
- * }
7257
- * }
7258
- * ]
7259
- * }
7260
- * ```
7261
- *
7262
- * </details>
7263
- *
7264
- * <details>
7265
- * <summary>Working with Single Block Fields</summary>
7266
- *
7267
- * **Current state** (from a regular API response):
7268
- * ```json
7269
- * {
7270
- * "hero_block": "dhVR2HqgRVCTGFi_0bWqLqA"
7271
- * }
7272
- * ```
7273
- *
7274
- * **To update the block's content:**
7275
- * ```json
7276
- * {
7277
- * "hero_block": {
7278
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7279
- * "type": "item",
7280
- * "attributes": { "title": "Updated Hero Title" }
7281
- * }
7282
- * }
7283
- * ```
7284
- *
7285
- * **To replace it with a new block:**
7286
- * ```json
7287
- * {
7288
- * "hero_block": {
7289
- * "type": "item",
7290
- * "attributes": { "title": "New Hero Block" },
7291
- * "relationships": {
7292
- * "item_type": {
7293
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
7294
- * }
7295
- * }
7296
- * }
7297
- * }
7298
- * ```
7299
- *
7300
- * **To remove (delete) the block:**
7301
- * ```json
7302
- * {
7303
- * "hero_block": null
7304
- * }
7305
- * ```
7306
- * </details>
7307
- *
7308
- * <details>
7309
- * <summary>Working with Structured Text Fields</summary>
7310
- *
7311
- * Updating blocks within Structured Text follows the same pattern: you replace the `item`'s ID with a full object for the block you want to change.
7312
- *
7313
- * **Current state** (from a regular API response):
7314
- * ```json
7315
- * {
7316
- * "rich_content": {
7317
- * "schema": "dast",
7318
- * "document": {
7319
- * "type": "root",
7320
- * "children": [
7321
- * { "type": "block", "item": "dhVR2HqgRVCTGFi_0bWqLqA" },
7322
- * { "type": "paragraph", "children": [{ "type": "span", "value": "Some text." }] }
7323
- * ]
7324
- * }
7325
- * }
7326
- * }
7327
- * ```
7328
- *
7329
- * **To update the block's content:**
7330
- * ```json
7331
- * {
7332
- * "rich_content": {
7333
- * "schema": "dast",
7334
- * "document": {
7335
- * "type": "root",
7336
- * "children": [
7337
- * {
7338
- * "type": "block",
7339
- * "item": {
7340
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA", // The block to update
7341
- * "type": "item",
7342
- * "attributes": { "title": "Updated DAST Block Title" }
7343
- * }
7344
- * },
7345
- * { "type": "paragraph", "children": [{ "type": "span", "value": "Some text." }] }
7346
- * ]
7347
- * }
7348
- * }
7349
- * }
7350
- * ```
7351
- * </details>
7352
- *
7353
- * ###### Deeply-nested blocks
7354
- *
7355
- * Blocks can contain other blocks, creating hierarchies multiple levels deep. **The same principles apply recursively.** When you fetch a record with `?nested=true`, the API will expand nested blocks at all levels.
7356
- *
7357
- * When updating, you are always sending a payload to the top-level parent record, but you can specify changes to deeply nested blocks using the same ID vs. object rules.
7358
- *
7359
- * <details>
7360
- * <summary>Example: Updating a nested block</summary>
7361
- *
7362
- * Imagine a "Wrapper" block that contains a Modular Content field with "Child" blocks inside it. To update "Child Block 1" while leaving "Child Block 2" untouched:
7363
- *
7364
- * ```json
7365
- * // This payload is sent to the top-level record containing the "Parent Block"
7366
- * {
7367
- * "wrapper_block": {
7368
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA", // ID of the parent block being updated
7369
- * "type": "item",
7370
- * "attributes": {
7371
- * "nested_content": [
7372
- * {
7373
- * "id": "kL9mN3pQrStUvWxYzAbCdE", // ID of the nested block being updated
7374
- * "type": "item",
7375
- * "attributes": { "title": "Updated Child Block 1" }
7376
- * },
7377
- * "fG8hI1jKlMnOpQrStUvWxY" // Unchanged nested block, sent as ID
7378
- * ],
7379
- * // You can skip any attribute that does not need to change
7380
- * }
7381
- * }
7382
- * }
7383
- * ```
7384
- * </details>
7385
- *
7386
- * ---
7387
- *
7388
- * ## Localization
7389
- *
7390
- * Localization allows you to store different versions of your content for different languages or regions. When you mark a field as "localizable" in your model, its structure in the API changes to accommodate multiple values.
7391
- *
7392
- * The fundamental change is that the field's value is no longer a single piece of data but an **object keyed by locale codes**.
7393
- *
7394
- * For example, a simple non-localized `title` field looks like this:
7395
- * ```json
7396
- * {
7397
- * "title": "Hello World"
7398
- * }
7399
- * ```
7400
- *
7401
- * When localized, it becomes an object containing a value for each configured locale:
7402
- * ```json
7403
- * {
7404
- * "title": {
7405
- * "en": "Hello World",
7406
- * "it": "Ciao Mondo",
7407
- * "fr": "Bonjour le Monde"
7408
- * }
7409
- * }
7410
- * ```
7411
- * This principle applies to **every type of field**, from simple strings to **Modular Content**, **Single Block**, and **Structured Text** fields. For instance, a localized Modular Content field will contain a separate array of blocks for each language. This powerful feature allows you to have completely different block structures for each locale.
7412
- *
7413
- * <details>
7414
- * <summary>Example: Localized Modular Content field</summary>
7415
- *
7416
- * In a `regular` API response, you would see different arrays of block IDs for each locale.
7417
- *
7418
- * ```json
7419
- * {
7420
- * "content_blocks": {
7421
- * "en": ["dhVR2HqgRVCTGFi0bWqLqA", "kL9mN3pQrStUvWxYzAbCdE"],
7422
- * "it": ["fG8hI1jKlMnOpQrStUvWxY", "dhVR2HqgRVCTGFi0bWqLqA"]
7423
- * }
7424
- * }
7425
- * ```
7426
- * </details>
7427
- *
7428
- * <details>
7429
- * <summary>Example: Localized Single Block field</summary>
7430
- * A different block can be assigned to each locale.
7431
- *
7432
- * ```json
7433
- * {
7434
- * "hero_block": {
7435
- * "en": "dhVR2HqgRVCTGFi0bWqLqA",
7436
- * "it": "kL9mN3pQrStUvWxYzAbCdE"
7437
- * }
7438
- * }
7439
- * ```
7440
- * </details>
7441
- *
7442
- * <details>
7443
- * <summary>Example: Localized Structured Text field</summary>
7444
- *
7445
- * The entire DAST document is localized, allowing for different text and different embedded blocks per locale.
7446
- *
7447
- * ```json
7448
- * {
7449
- * "rich_content": {
7450
- * "en": {
7451
- * "schema": "dast",
7452
- * "document": {
7453
- * "type": "root",
7454
- * "children": [{ "type": "block", "item": "dhVR2HqgRVCTGFi0bWqLqA" }]
7455
- * }
7456
- * },
7457
- * "it": {
7458
- * "schema": "dast",
7459
- * "document": {
7460
- * "type": "root",
7461
- * "children": [{ "type": "block", "item": "kL9mN3pQrStUvWxYzAbCdE" }]
7462
- * }
7463
- * }
7464
- * }
7465
- * }
7466
- * ```
7467
- * </details>
7468
- *
7469
- * When reading or writing localized content, there are a few key rules to follow to ensure data integrity.
7470
- *
7471
- * ###### Locale consistency
7472
- * Within a single record, all localized fields must have a consistent set of locales. You cannot have a `title` with English and Italian, and a `description` with English and French in the same record.
7473
- *
7474
- * ```json
7475
- * // ❌ This will FAIL due to inconsistent locales ("it" vs "fr")
7476
- * {
7477
- * "title": { "en": "Title", "it": "Titolo" },
7478
- * "description": { "en": "Description", "fr": "Description" }
7479
- * }
7480
- *
7481
- * // ✅ This is VALID because locales are consistent across all fields
7482
- * {
7483
- * "title": { "en": "Title", "it": "Titolo" },
7484
- * "description": { "en": "Description", "it": "Descrizione" }
7485
- * }
7486
- * ```
7487
- *
7488
- * ###### Required locales
7489
- *
7490
- * Your model can be configured to require that all project's locales are always present ([`attributes.all_locales_required`](/docs/content-management-api/resources/item-type#object-payload)). If that's the case, when creating or updating a record, you must provide a value for all required locales.
7491
- *
7492
- * ```json
7493
- * // ❌ This will FAIL if all locales are required for the model
7494
- * {
7495
- * "title": { "en": "Title" }
7496
- * }
7497
- * ```
7498
- *
7499
- *
7500
- * This interface was referenced by `DatoApi`'s JSON-Schema
7501
- * via the `definition` "item".
7502
- */
7503
- export type RawItem = {
7504
- type: ItemType1;
7505
- id: ItemIdentity;
7506
- relationships: ItemRelationships;
7507
- meta: ItemMeta;
7508
- };
7509
6626
  /**
7510
6627
  * JSON API links
7511
6628
  *
7512
- * This interface was referenced by `Item<D>`'s JSON-Schema
6629
+ * This interface was referenced by `Item`'s JSON-Schema
7513
6630
  * via the `definition` "relationships".
7514
6631
  */
7515
- export type ItemRelationships = {
6632
+ export type ItemRelationships<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7516
6633
  /**
7517
6634
  * The record's model
7518
6635
  */
7519
6636
  item_type: {
7520
- data: ItemTypeData;
6637
+ data: ItemTypeData<D>;
7521
6638
  };
7522
6639
  /**
7523
6640
  * The entity (account/collaborator/access token/sso user) who created the record
@@ -7529,7 +6646,7 @@ export type ItemRelationships = {
7529
6646
  /**
7530
6647
  * Meta information regarding the record
7531
6648
  *
7532
- * This interface was referenced by `Item<D>`'s JSON-Schema
6649
+ * This interface was referenced by `Item`'s JSON-Schema
7533
6650
  * via the `definition` "meta".
7534
6651
  */
7535
6652
  export type ItemMeta = {
@@ -7587,38 +6704,38 @@ export type ItemMeta = {
7587
6704
  has_children: null | boolean;
7588
6705
  };
7589
6706
  /**
7590
- * The JSON data associated to the record
7591
- *
7592
- * This interface was referenced by `Item<D>`'s JSON-Schema
7593
- * via the `definition` "attributes".
7594
- */
7595
- export type ItemAttributes = {
7596
- [k: string]: unknown;
7597
- };
7598
- /**
7599
- * This interface was referenced by `Item<D>`'s JSON-Schema
6707
+ * This interface was referenced by `Item`'s JSON-Schema
7600
6708
  * via the `instances.targetSchema` link.
7601
6709
  */
7602
- export type ItemInstancesTargetSchema<D extends ItemDefinition = ItemDefinition> = {
6710
+ export type ItemInstancesTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
7603
6711
  data: Item<D>[];
7604
6712
  meta: {
7605
6713
  total_count: number;
7606
6714
  };
6715
+ } : {
6716
+ data: ItemInNestedResponse<D>[];
6717
+ meta: {
6718
+ total_count: number;
6719
+ };
7607
6720
  };
7608
6721
  /**
7609
- * This interface was referenced by `Item<D>`'s JSON-Schema
6722
+ * This interface was referenced by `Item`'s JSON-Schema
7610
6723
  * via the `validate_existing.schema` link.
7611
6724
  */
7612
- export type RawItemValidateExistingSchema = {
6725
+ export type ItemValidateExistingSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7613
6726
  data: {
7614
6727
  id: ItemIdentity;
7615
6728
  type: ItemType1;
6729
+ /**
6730
+ * The JSON data associated to the record
6731
+ */
6732
+ attributes: ToItemAttributesInRequest<D>;
7616
6733
  relationships: {
7617
6734
  /**
7618
6735
  * The record's model
7619
6736
  */
7620
6737
  item_type: {
7621
- data: ItemTypeData;
6738
+ data: ItemTypeData<D>;
7622
6739
  };
7623
6740
  /**
7624
6741
  * The entity (account/collaborator/access token/sso user) who created the record
@@ -7627,21 +6744,26 @@ export type RawItemValidateExistingSchema = {
7627
6744
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7628
6745
  };
7629
6746
  };
6747
+ __itemTypeId?: D['itemTypeId'];
7630
6748
  };
7631
6749
  };
7632
6750
  /**
7633
- * This interface was referenced by `Item<D>`'s JSON-Schema
6751
+ * This interface was referenced by `Item`'s JSON-Schema
7634
6752
  * via the `validate_new.schema` link.
7635
6753
  */
7636
- export type RawItemValidateNewSchema = {
6754
+ export type ItemValidateNewSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7637
6755
  data: {
7638
6756
  type: ItemType1;
6757
+ /**
6758
+ * The JSON data associated to the record
6759
+ */
6760
+ attributes: ToItemAttributesInRequest<D>;
7639
6761
  relationships: {
7640
6762
  /**
7641
6763
  * The record's model
7642
6764
  */
7643
6765
  item_type: {
7644
- data: ItemTypeData;
6766
+ data: ItemTypeData<D>;
7645
6767
  };
7646
6768
  /**
7647
6769
  * The entity (account/collaborator/access token/sso user) who created the record
@@ -7650,16 +6772,21 @@ export type RawItemValidateNewSchema = {
7650
6772
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7651
6773
  };
7652
6774
  };
6775
+ __itemTypeId?: D['itemTypeId'];
7653
6776
  };
7654
6777
  };
7655
6778
  /**
7656
- * This interface was referenced by `Item<D>`'s JSON-Schema
6779
+ * This interface was referenced by `Item`'s JSON-Schema
7657
6780
  * via the `create.schema` link.
7658
6781
  */
7659
- export type RawItemCreateSchema = {
6782
+ export type ItemCreateSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7660
6783
  data: {
7661
6784
  id?: ItemIdentity;
7662
6785
  type: ItemType1;
6786
+ /**
6787
+ * The JSON data associated to the record
6788
+ */
6789
+ attributes: ToItemAttributesInRequest<D>;
7663
6790
  /**
7664
6791
  * Meta information regarding the record
7665
6792
  */
@@ -7710,7 +6837,7 @@ export type RawItemCreateSchema = {
7710
6837
  * The record's model
7711
6838
  */
7712
6839
  item_type: {
7713
- data: ItemTypeData;
6840
+ data: ItemTypeData<D>;
7714
6841
  };
7715
6842
  /**
7716
6843
  * The entity (account/collaborator/access token/sso user) who created the record
@@ -7719,39 +6846,50 @@ export type RawItemCreateSchema = {
7719
6846
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7720
6847
  };
7721
6848
  };
6849
+ __itemTypeId?: D['itemTypeId'];
7722
6850
  };
7723
6851
  };
7724
6852
  /**
7725
- * This interface was referenced by `Item<D>`'s JSON-Schema
6853
+ * This interface was referenced by `Item`'s JSON-Schema
7726
6854
  * via the `create.targetSchema` link.
7727
6855
  */
7728
- export type ItemCreateTargetSchema<D extends ItemDefinition = ItemDefinition> = {
6856
+ export type ItemCreateTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
7729
6857
  data: Item<D>;
7730
6858
  included: (ItemType | Item)[];
6859
+ } : {
6860
+ data: ItemInNestedResponse<D>;
6861
+ included: (ItemType | Item)[];
7731
6862
  };
7732
6863
  /**
7733
- * This interface was referenced by `Item<D>`'s JSON-Schema
6864
+ * This interface was referenced by `Item`'s JSON-Schema
7734
6865
  * via the `duplicate.targetSchema` link.
7735
6866
  */
7736
6867
  export type ItemDuplicateTargetSchema = {
7737
6868
  data: Job;
7738
6869
  };
7739
6870
  /**
7740
- * This interface was referenced by `Item<D>`'s JSON-Schema
6871
+ * This interface was referenced by `Item`'s JSON-Schema
7741
6872
  * via the `duplicate.jobSchema` link.
7742
6873
  */
7743
- export type ItemDuplicateJobSchema<D extends ItemDefinition = ItemDefinition> = {
6874
+ export type ItemDuplicateJobSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
7744
6875
  data: Item<D>;
7745
6876
  included: ItemType[];
6877
+ } : {
6878
+ data: ItemInNestedResponse<D>;
6879
+ included: ItemType[];
7746
6880
  };
7747
6881
  /**
7748
- * This interface was referenced by `Item<D>`'s JSON-Schema
6882
+ * This interface was referenced by `Item`'s JSON-Schema
7749
6883
  * via the `update.schema` link.
7750
6884
  */
7751
- export type RawItemUpdateSchema = {
6885
+ export type ItemUpdateSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7752
6886
  data: {
7753
6887
  type: ItemType1;
7754
6888
  id: ItemIdentity;
6889
+ /**
6890
+ * The JSON data associated to the record
6891
+ */
6892
+ attributes?: ToItemAttributesInRequest<D>;
7755
6893
  /**
7756
6894
  * Meta information regarding the record
7757
6895
  */
@@ -7814,7 +6952,7 @@ export type RawItemUpdateSchema = {
7814
6952
  * The record's model
7815
6953
  */
7816
6954
  item_type?: {
7817
- data: ItemTypeData;
6955
+ data: ItemTypeData<D>;
7818
6956
  };
7819
6957
  /**
7820
6958
  * The entity (account/collaborator/access token/sso user) who created the record
@@ -7823,32 +6961,40 @@ export type RawItemUpdateSchema = {
7823
6961
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7824
6962
  };
7825
6963
  };
6964
+ __itemTypeId?: D['itemTypeId'];
7826
6965
  };
7827
6966
  };
7828
6967
  /**
7829
- * This interface was referenced by `Item<D>`'s JSON-Schema
6968
+ * This interface was referenced by `Item`'s JSON-Schema
7830
6969
  * via the `update.targetSchema` link.
7831
6970
  */
7832
- export type ItemUpdateTargetSchema<D extends ItemDefinition = ItemDefinition> = {
6971
+ export type ItemUpdateTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
7833
6972
  data: Item<D>;
7834
6973
  included?: (ItemType | Item)[];
6974
+ } : {
6975
+ data: ItemInNestedResponse<D>;
6976
+ included?: (ItemType | Item)[];
7835
6977
  };
7836
6978
  /**
7837
- * This interface was referenced by `Item<D>`'s JSON-Schema
6979
+ * This interface was referenced by `Item`'s JSON-Schema
7838
6980
  * via the `references.targetSchema` link.
7839
6981
  */
7840
- export type ItemReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = {
6982
+ export type ItemReferencesTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
7841
6983
  data: Item<D>[];
6984
+ } : {
6985
+ data: ItemInNestedResponse<D>[];
7842
6986
  };
7843
6987
  /**
7844
- * This interface was referenced by `Item<D>`'s JSON-Schema
6988
+ * This interface was referenced by `Item`'s JSON-Schema
7845
6989
  * via the `self.targetSchema` link.
7846
6990
  */
7847
- export type ItemSelfTargetSchema<D extends ItemDefinition = ItemDefinition> = {
6991
+ export type ItemSelfTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
7848
6992
  data: Item<D>;
6993
+ } : {
6994
+ data: ItemInNestedResponse<D>;
7849
6995
  };
7850
6996
  /**
7851
- * This interface was referenced by `Item<D>`'s JSON-Schema
6997
+ * This interface was referenced by `Item`'s JSON-Schema
7852
6998
  * via the `current_vs_published_state.targetSchema` link.
7853
6999
  */
7854
7000
  export type ItemCurrentVsPublishedStateTargetSchema = {
@@ -7994,7 +7140,7 @@ export type ScheduledPublicationAttributes = {
7994
7140
  */
7995
7141
  export type ScheduledPublicationRelationships = {
7996
7142
  /**
7997
- * Item<D>
7143
+ * Item
7998
7144
  */
7999
7145
  item: {
8000
7146
  data: ItemData;
@@ -8043,8 +7189,10 @@ export type ScheduledPublicationCreateTargetSchema = {
8043
7189
  * This interface was referenced by `ScheduledPublication`'s JSON-Schema
8044
7190
  * via the `destroy.targetSchema` link.
8045
7191
  */
8046
- export type ScheduledPublicationDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = {
7192
+ export type ScheduledPublicationDestroyTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8047
7193
  data: Item<D>;
7194
+ } : {
7195
+ data: ItemInNestedResponse<D>;
8048
7196
  };
8049
7197
  /**
8050
7198
  * You can create a scheduled unpublishing to unpublish records in the future
@@ -8082,7 +7230,7 @@ export type ScheduledUnpublishingAttributes = {
8082
7230
  */
8083
7231
  export type ScheduledUnpublishingRelationships = {
8084
7232
  /**
8085
- * Item<D>
7233
+ * Item
8086
7234
  */
8087
7235
  item: {
8088
7236
  data: ItemData;
@@ -8122,8 +7270,10 @@ export type ScheduledUnpublishingCreateTargetSchema = {
8122
7270
  * This interface was referenced by `ScheduledUnpublishing`'s JSON-Schema
8123
7271
  * via the `destroy.targetSchema` link.
8124
7272
  */
8125
- export type ScheduledUnpublishingDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = {
7273
+ export type ScheduledUnpublishingDestroyTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8126
7274
  data: Item<D>;
7275
+ } : {
7276
+ data: ItemInNestedResponse<D>;
8127
7277
  };
8128
7278
  /**
8129
7279
  * Every change to a record is stored as a separate record version in DatoCMS.
@@ -8208,8 +7358,10 @@ export type ItemVersionRestoreTargetSchema = {
8208
7358
  * This interface was referenced by `ItemVersion`'s JSON-Schema
8209
7359
  * via the `restore.jobSchema` link.
8210
7360
  */
8211
- export type ItemVersionRestoreJobSchema<D extends ItemDefinition = ItemDefinition> = {
7361
+ export type ItemVersionRestoreJobSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8212
7362
  data: [Item<D>, ItemVersion];
7363
+ } : {
7364
+ data: [ItemInNestedResponse<D>, ItemVersion];
8213
7365
  };
8214
7366
  /**
8215
7367
  * This interface was referenced by `ItemVersion`'s JSON-Schema
@@ -8229,37 +7381,45 @@ export type ItemVersionSelfTargetSchema = {
8229
7381
  data: ItemVersion;
8230
7382
  };
8231
7383
  /**
8232
- * This interface was referenced by `Item<D>`'s JSON-Schema
7384
+ * This interface was referenced by `Item`'s JSON-Schema
8233
7385
  * via the `destroy.targetSchema` link.
8234
7386
  */
8235
7387
  export type ItemDestroyTargetSchema = {
8236
7388
  data: Job;
8237
7389
  };
8238
7390
  /**
8239
- * This interface was referenced by `Item<D>`'s JSON-Schema
7391
+ * This interface was referenced by `Item`'s JSON-Schema
8240
7392
  * via the `destroy.jobSchema` link.
8241
7393
  */
8242
- export type ItemDestroyJobSchema<D extends ItemDefinition = ItemDefinition> = {
7394
+ export type ItemDestroyJobSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8243
7395
  data: Item<D>;
7396
+ } : {
7397
+ data: ItemInNestedResponse<D>;
8244
7398
  };
8245
7399
  /**
8246
- * This interface was referenced by `Item<D>`'s JSON-Schema
7400
+ * This interface was referenced by `Item`'s JSON-Schema
8247
7401
  * via the `publish.targetSchema` link.
8248
7402
  */
8249
- export type ItemPublishTargetSchema<D extends ItemDefinition = ItemDefinition> = {
7403
+ export type ItemPublishTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8250
7404
  data: Item<D>;
8251
7405
  included?: ItemType[];
7406
+ } : {
7407
+ data: ItemInNestedResponse<D>;
7408
+ included?: ItemType[];
8252
7409
  };
8253
7410
  /**
8254
- * This interface was referenced by `Item<D>`'s JSON-Schema
7411
+ * This interface was referenced by `Item`'s JSON-Schema
8255
7412
  * via the `unpublish.targetSchema` link.
8256
7413
  */
8257
- export type ItemUnpublishTargetSchema<D extends ItemDefinition = ItemDefinition> = {
7414
+ export type ItemUnpublishTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8258
7415
  data: Item<D>;
8259
7416
  included?: ItemType[];
7417
+ } : {
7418
+ data: ItemInNestedResponse<D>;
7419
+ included?: ItemType[];
8260
7420
  };
8261
7421
  /**
8262
- * This interface was referenced by `Item<D>`'s JSON-Schema
7422
+ * This interface was referenced by `Item`'s JSON-Schema
8263
7423
  * via the `bulk_publish.schema` link.
8264
7424
  */
8265
7425
  export type ItemBulkPublishSchema = {
@@ -8277,14 +7437,14 @@ export type ItemBulkPublishSchema = {
8277
7437
  };
8278
7438
  };
8279
7439
  /**
8280
- * This interface was referenced by `Item<D>`'s JSON-Schema
7440
+ * This interface was referenced by `Item`'s JSON-Schema
8281
7441
  * via the `bulk_publish.targetSchema` link.
8282
7442
  */
8283
7443
  export type ItemBulkPublishTargetSchema = {
8284
7444
  data: Job;
8285
7445
  };
8286
7446
  /**
8287
- * This interface was referenced by `Item<D>`'s JSON-Schema
7447
+ * This interface was referenced by `Item`'s JSON-Schema
8288
7448
  * via the `bulk_publish.jobSchema` link.
8289
7449
  */
8290
7450
  export type ItemBulkPublishJobSchema = {
@@ -8295,7 +7455,7 @@ export type ItemBulkPublishJobSchema = {
8295
7455
  };
8296
7456
  };
8297
7457
  /**
8298
- * This interface was referenced by `Item<D>`'s JSON-Schema
7458
+ * This interface was referenced by `Item`'s JSON-Schema
8299
7459
  * via the `bulk_unpublish.schema` link.
8300
7460
  */
8301
7461
  export type ItemBulkUnpublishSchema = {
@@ -8313,14 +7473,14 @@ export type ItemBulkUnpublishSchema = {
8313
7473
  };
8314
7474
  };
8315
7475
  /**
8316
- * This interface was referenced by `Item<D>`'s JSON-Schema
7476
+ * This interface was referenced by `Item`'s JSON-Schema
8317
7477
  * via the `bulk_unpublish.targetSchema` link.
8318
7478
  */
8319
7479
  export type ItemBulkUnpublishTargetSchema = {
8320
7480
  data: Job;
8321
7481
  };
8322
7482
  /**
8323
- * This interface was referenced by `Item<D>`'s JSON-Schema
7483
+ * This interface was referenced by `Item`'s JSON-Schema
8324
7484
  * via the `bulk_unpublish.jobSchema` link.
8325
7485
  */
8326
7486
  export type ItemBulkUnpublishJobSchema = {
@@ -8331,7 +7491,7 @@ export type ItemBulkUnpublishJobSchema = {
8331
7491
  };
8332
7492
  };
8333
7493
  /**
8334
- * This interface was referenced by `Item<D>`'s JSON-Schema
7494
+ * This interface was referenced by `Item`'s JSON-Schema
8335
7495
  * via the `bulk_destroy.schema` link.
8336
7496
  */
8337
7497
  export type ItemBulkDestroySchema = {
@@ -8349,14 +7509,14 @@ export type ItemBulkDestroySchema = {
8349
7509
  };
8350
7510
  };
8351
7511
  /**
8352
- * This interface was referenced by `Item<D>`'s JSON-Schema
7512
+ * This interface was referenced by `Item`'s JSON-Schema
8353
7513
  * via the `bulk_destroy.targetSchema` link.
8354
7514
  */
8355
7515
  export type ItemBulkDestroyTargetSchema = {
8356
7516
  data: Job;
8357
7517
  };
8358
7518
  /**
8359
- * This interface was referenced by `Item<D>`'s JSON-Schema
7519
+ * This interface was referenced by `Item`'s JSON-Schema
8360
7520
  * via the `bulk_destroy.jobSchema` link.
8361
7521
  */
8362
7522
  export type ItemBulkDestroyJobSchema = {
@@ -8367,7 +7527,7 @@ export type ItemBulkDestroyJobSchema = {
8367
7527
  };
8368
7528
  };
8369
7529
  /**
8370
- * This interface was referenced by `Item<D>`'s JSON-Schema
7530
+ * This interface was referenced by `Item`'s JSON-Schema
8371
7531
  * via the `bulk_move_to_stage.schema` link.
8372
7532
  */
8373
7533
  export type ItemBulkMoveToStageSchema = {
@@ -8391,14 +7551,14 @@ export type ItemBulkMoveToStageSchema = {
8391
7551
  };
8392
7552
  };
8393
7553
  /**
8394
- * This interface was referenced by `Item<D>`'s JSON-Schema
7554
+ * This interface was referenced by `Item`'s JSON-Schema
8395
7555
  * via the `bulk_move_to_stage.targetSchema` link.
8396
7556
  */
8397
7557
  export type ItemBulkMoveToStageTargetSchema = {
8398
7558
  data: Job;
8399
7559
  };
8400
7560
  /**
8401
- * This interface was referenced by `Item<D>`'s JSON-Schema
7561
+ * This interface was referenced by `Item`'s JSON-Schema
8402
7562
  * via the `bulk_move_to_stage.jobSchema` link.
8403
7563
  */
8404
7564
  export type ItemBulkMoveToStageJobSchema = {
@@ -8843,8 +8003,10 @@ export type UploadUpdateJobSchema = {
8843
8003
  * This interface was referenced by `Upload`'s JSON-Schema
8844
8004
  * via the `references.targetSchema` link.
8845
8005
  */
8846
- export type UploadReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = {
8006
+ export type UploadReferencesTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? {
8847
8007
  data: Item<D>[];
8008
+ } : {
8009
+ data: ItemInNestedResponse<D>[];
8848
8010
  };
8849
8011
  /**
8850
8012
  * This interface was referenced by `Upload`'s JSON-Schema
@@ -12154,4 +11316,3 @@ export type WorkflowInstancesTargetSchema = {
12154
11316
  export type WorkflowSelfTargetSchema = {
12155
11317
  data: Workflow;
12156
11318
  };
12157
- export {};