@datocms/cma-client 5.1.11 → 5.1.12

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 +40 -46
  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 +49 -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 +90 -980
  46. package/dist/esm/generated/Client.js +1 -1
  47. package/dist/esm/generated/RawApiTypes.d.ts +156 -999
  48. package/dist/esm/generated/resources/Field.d.ts +200 -200
  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 +3 -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 +45 -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 +90 -980
  84. package/dist/types/generated/RawApiTypes.d.ts +156 -999
  85. package/dist/types/generated/resources/Field.d.ts +200 -200
  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 +3 -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 +3 -3
  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 +217 -1880
  106. package/src/generated/Client.ts +1 -1
  107. package/src/generated/RawApiTypes.ts +272 -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 +4 -60
  114. package/src/utilities/duplicateBlockRecord.ts +52 -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,81 +1,29 @@
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 = GenericFieldAttributes<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 = FieldCreateConfig<RawFieldCreateSchema>;
51
- /**
52
- * Helper type to conditionally handle default values based on localization for field updates
53
- */
54
- type FieldUpdateDefaultValue<T> = T | Record<string, T> | undefined;
55
- type FieldUpdateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance'> & {
56
- field_type?: FieldType;
57
- default_value?: FieldUpdateDefaultValue<FieldValue>;
58
- validators?: FieldValidators;
59
- appearance?: FieldAppearanceConfig<FieldAppearance>;
60
- };
61
- 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>;
62
- export type FieldUpdateSchema = FieldUpdateConfig<RawFieldUpdateSchema>;
63
- type ForceItemTypeDataId<ItemTypeId> = Omit<ItemTypeData, 'id'> & {
64
- id: ItemTypeId;
65
- };
66
- type ForceItemTypeData<T, ItemTypeId> = {
67
- [K in keyof T]: T[K] extends ItemTypeData ? ForceItemTypeDataId<ItemTypeId> : T[K] extends object ? ForceItemTypeData<T[K], ItemTypeId> : T[K];
68
- };
69
- type ForceItemTypeId<T, ItemTypeId> = ForceItemTypeData<T, ItemTypeId> & {
70
- /** Useful for type narrowing */
71
- __itemTypeId?: ItemTypeId;
1
+ import type { FieldCreateConfig, FieldUpdateConfig, GenericFieldAttributes } from '../fieldTypes/schema';
2
+ import type { ItemTypeDefinition, ToItemAttributes, ToItemAttributesInNestedResponse, ToItemAttributesInRequest } from '../utilities/itemDefinition';
3
+ export type Field = GenericFieldAttributes<FieldStableShell>;
4
+ export type FieldAttributes = GenericFieldAttributes<FieldAttributesStableShell>;
5
+ export type FieldCreateSchema = FieldCreateConfig<FieldCreateSchemaStableShell>;
6
+ export type FieldUpdateSchema = FieldUpdateConfig<FieldUpdateSchemaStableShell>;
7
+ export type ItemTypeData<D extends ItemTypeDefinition = ItemTypeDefinition> = {
8
+ type: ItemTypeType;
9
+ id: D extends ItemTypeDefinition ? D['itemTypeId'] : ItemTypeIdentity;
72
10
  };
73
- export type ApplyItemDefinitionToSchema<Schema, D extends ItemDefinition = ItemDefinition> = D extends any ? ForceItemTypeId<Schema, D['itemTypeId']> & D['fields'] : never;
74
- export type Item<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItem, D>;
75
- export type ItemValidateExistingSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemValidateExistingSchema, D>;
76
- export type ItemValidateNewSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemValidateNewSchema, D>;
77
- export type ItemCreateSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemCreateSchema, D>;
78
- export type ItemUpdateSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemUpdateSchema, D>;
11
+ export type Item<D extends ItemTypeDefinition = ItemTypeDefinition> = {
12
+ __itemTypeId?: D['itemTypeId'];
13
+ id: ItemIdentity;
14
+ type: ItemType1;
15
+ item_type: ItemTypeData<D>;
16
+ creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
17
+ meta: ItemMeta;
18
+ } & ToItemAttributes<D>;
19
+ export type ItemInNestedResponse<D extends ItemTypeDefinition = ItemTypeDefinition> = {
20
+ __itemTypeId?: D['itemTypeId'];
21
+ id: ItemIdentity;
22
+ type: ItemType1;
23
+ item_type: ItemTypeData<D>;
24
+ creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
25
+ meta: ItemMeta;
26
+ } & ToItemAttributesInNestedResponse<D>;
79
27
  /**
80
28
  * This file was automatically generated by hyperschema-to-ts: DO NOT MODIFY IT BY HAND.
81
29
  */
@@ -546,17 +494,17 @@ export type UploadCollectionReorderSchema = {
546
494
  */
547
495
  export type UploadCollectionReorderJobSchema = UploadCollection[];
548
496
  /**
549
- * This interface was referenced by `Item<D>`'s JSON-Schema
497
+ * This interface was referenced by `Item`'s JSON-Schema
550
498
  * via the `definition` "type".
551
499
  */
552
500
  export type ItemType1 = 'item';
553
501
  /**
554
502
  * RFC 4122 UUID of record expressed in URL-safe base64 format
555
503
  *
556
- * This interface was referenced by `Item<D>`'s JSON-Schema
504
+ * This interface was referenced by `Item`'s JSON-Schema
557
505
  * via the `definition` "identity".
558
506
  *
559
- * This interface was referenced by `Item<D>`'s JSON-Schema
507
+ * This interface was referenced by `Item`'s JSON-Schema
560
508
  * via the `definition` "id".
561
509
  */
562
510
  export type ItemIdentity = string;
@@ -844,12 +792,12 @@ export type BuildEventInstancesHrefSchema = {
844
792
  [k: string]: unknown;
845
793
  };
846
794
  /**
847
- * This interface was referenced by `Item<D>`'s JSON-Schema
795
+ * This interface was referenced by `Item`'s JSON-Schema
848
796
  * via the `instances.targetSchema` link.
849
797
  */
850
- export type ItemInstancesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
798
+ export type ItemInstancesTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D>[] : ItemInNestedResponse<D>[];
851
799
  /**
852
- * This interface was referenced by `Item<D>`'s JSON-Schema
800
+ * This interface was referenced by `Item`'s JSON-Schema
853
801
  * via the `instances.hrefSchema` link.
854
802
  */
855
803
  export type ItemInstancesHrefSchema = {
@@ -913,12 +861,12 @@ export type ItemInstancesHrefSchema = {
913
861
  [k: string]: unknown;
914
862
  };
915
863
  /**
916
- * This interface was referenced by `Item<D>`'s JSON-Schema
864
+ * This interface was referenced by `Item`'s JSON-Schema
917
865
  * via the `references.targetSchema` link.
918
866
  */
919
- export type ItemReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
867
+ export type ItemReferencesTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D>[] : ItemInNestedResponse<D>[];
920
868
  /**
921
- * This interface was referenced by `Item<D>`'s JSON-Schema
869
+ * This interface was referenced by `Item`'s JSON-Schema
922
870
  * via the `references.hrefSchema` link.
923
871
  */
924
872
  export type ItemReferencesHrefSchema = {
@@ -933,7 +881,7 @@ export type ItemReferencesHrefSchema = {
933
881
  [k: string]: unknown;
934
882
  };
935
883
  /**
936
- * This interface was referenced by `Item<D>`'s JSON-Schema
884
+ * This interface was referenced by `Item`'s JSON-Schema
937
885
  * via the `self.hrefSchema` link.
938
886
  */
939
887
  export type ItemSelfHrefSchema = {
@@ -1008,7 +956,7 @@ export type ItemVersionType = 'item_version';
1008
956
  */
1009
957
  export type ItemVersionIdentity = string;
1010
958
  /**
1011
- * This interface was referenced by `Item<D>`'s JSON-Schema
959
+ * This interface was referenced by `Item`'s JSON-Schema
1012
960
  * via the `publish.schema` link.
1013
961
  */
1014
962
  export type ItemPublishSchema = {
@@ -1026,7 +974,7 @@ export type ItemPublishSchema = {
1026
974
  non_localized_content: boolean;
1027
975
  } | null;
1028
976
  /**
1029
- * This interface was referenced by `Item<D>`'s JSON-Schema
977
+ * This interface was referenced by `Item`'s JSON-Schema
1030
978
  * via the `publish.hrefSchema` link.
1031
979
  */
1032
980
  export type ItemPublishHrefSchema = {
@@ -1037,7 +985,7 @@ export type ItemPublishHrefSchema = {
1037
985
  [k: string]: unknown;
1038
986
  };
1039
987
  /**
1040
- * This interface was referenced by `Item<D>`'s JSON-Schema
988
+ * This interface was referenced by `Item`'s JSON-Schema
1041
989
  * via the `unpublish.schema` link.
1042
990
  */
1043
991
  export type ItemUnpublishSchema = {
@@ -1048,7 +996,7 @@ export type ItemUnpublishSchema = {
1048
996
  content_in_locales: string[];
1049
997
  } | null;
1050
998
  /**
1051
- * This interface was referenced by `Item<D>`'s JSON-Schema
999
+ * This interface was referenced by `Item`'s JSON-Schema
1052
1000
  * via the `unpublish.hrefSchema` link.
1053
1001
  */
1054
1002
  export type ItemUnpublishHrefSchema = {
@@ -1059,22 +1007,22 @@ export type ItemUnpublishHrefSchema = {
1059
1007
  [k: string]: unknown;
1060
1008
  };
1061
1009
  /**
1062
- * This interface was referenced by `Item<D>`'s JSON-Schema
1010
+ * This interface was referenced by `Item`'s JSON-Schema
1063
1011
  * via the `bulk_publish.jobSchema` link.
1064
1012
  */
1065
1013
  export type ItemBulkPublishJobSchema = unknown[];
1066
1014
  /**
1067
- * This interface was referenced by `Item<D>`'s JSON-Schema
1015
+ * This interface was referenced by `Item`'s JSON-Schema
1068
1016
  * via the `bulk_unpublish.jobSchema` link.
1069
1017
  */
1070
1018
  export type ItemBulkUnpublishJobSchema = unknown[];
1071
1019
  /**
1072
- * This interface was referenced by `Item<D>`'s JSON-Schema
1020
+ * This interface was referenced by `Item`'s JSON-Schema
1073
1021
  * via the `bulk_destroy.jobSchema` link.
1074
1022
  */
1075
1023
  export type ItemBulkDestroyJobSchema = unknown[];
1076
1024
  /**
1077
- * This interface was referenced by `Item<D>`'s JSON-Schema
1025
+ * This interface was referenced by `Item`'s JSON-Schema
1078
1026
  * via the `bulk_move_to_stage.jobSchema` link.
1079
1027
  */
1080
1028
  export type ItemBulkMoveToStageJobSchema = unknown[];
@@ -1082,7 +1030,7 @@ export type ItemBulkMoveToStageJobSchema = unknown[];
1082
1030
  * This interface was referenced by `ItemVersion`'s JSON-Schema
1083
1031
  * via the `restore.jobSchema` link.
1084
1032
  */
1085
- export type ItemVersionRestoreJobSchema<D extends ItemDefinition = ItemDefinition> = [Item<D>, ItemVersion];
1033
+ export type ItemVersionRestoreJobSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? [Item<D>, ItemVersion] : [ItemInNestedResponse<D>, ItemVersion];
1086
1034
  /**
1087
1035
  * This interface was referenced by `ItemVersion`'s JSON-Schema
1088
1036
  * via the `instances.targetSchema` link.
@@ -1184,7 +1132,7 @@ export type UploadInstancesHrefSchema = {
1184
1132
  * This interface was referenced by `Upload`'s JSON-Schema
1185
1133
  * via the `references.targetSchema` link.
1186
1134
  */
1187
- export type UploadReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
1135
+ export type UploadReferencesTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D>[] : ItemInNestedResponse<D>[];
1188
1136
  /**
1189
1137
  * This interface was referenced by `Upload`'s JSON-Schema
1190
1138
  * via the `references.hrefSchema` link.
@@ -1855,60 +1803,6 @@ export type SiteSelfHrefSchema = {
1855
1803
  * via the `instances.targetSchema` link.
1856
1804
  */
1857
1805
  export type WorkflowInstancesTargetSchema = Workflow[];
1858
- export type DatoApi = {
1859
- role?: Role;
1860
- user?: User;
1861
- sso_user?: SsoUser;
1862
- audit_log_event?: AuditLogEvent;
1863
- account?: Account;
1864
- organization?: Organization;
1865
- site_plan?: SitePlan;
1866
- menu_item?: MenuItem;
1867
- schema_menu_item?: SchemaMenuItem;
1868
- upload_collection?: UploadCollection;
1869
- item_type?: ItemType;
1870
- field?: Field;
1871
- fieldset?: Fieldset;
1872
- job?: Job;
1873
- session?: Session;
1874
- access_token?: AccessToken;
1875
- plugin?: Plugin;
1876
- job_result?: JobResult;
1877
- subscription_limit?: SubscriptionLimit;
1878
- subscription_feature?: SubscriptionFeature;
1879
- build_event?: BuildEvent;
1880
- item?: Item;
1881
- item_current_vs_published_state?: ItemCurrentVsPublishedState;
1882
- item_version?: ItemVersion;
1883
- upload?: Upload;
1884
- upload_request?: UploadRequest;
1885
- upload_track?: UploadTrack;
1886
- scheduled_publication?: ScheduledPublication;
1887
- scheduled_unpublishing?: ScheduledUnpublishing;
1888
- search_result?: SearchResult;
1889
- environment?: Environment;
1890
- maintenance_mode?: MaintenanceMode;
1891
- webhook?: Webhook;
1892
- webhook_call?: WebhookCall;
1893
- build_trigger?: BuildTrigger;
1894
- item_type_filter?: ItemTypeFilter;
1895
- upload_filter?: UploadFilter;
1896
- site_invitation?: SiteInvitation;
1897
- editing_session?: EditingSession;
1898
- form_data?: FormData;
1899
- sso_group?: SsoGroup;
1900
- sso_settings?: SsoSettings;
1901
- emoji_suggestions?: EmojiSuggestions;
1902
- white_label_settings?: WhiteLabelSettings;
1903
- public_info?: PublicInfo;
1904
- daily_usage?: DailyUsage;
1905
- usage_counter?: UsageCounter;
1906
- upload_tag?: UploadTag;
1907
- upload_smart_tag?: UploadSmartTag;
1908
- site?: Site;
1909
- workflow?: Workflow;
1910
- [k: string]: unknown;
1911
- };
1912
1806
  /**
1913
1807
  * A Role represents a specific set of actions an editor (or an API token) can perform on your administrative area.
1914
1808
  *
@@ -4083,16 +3977,6 @@ export type MenuItemCreateTargetSchema = MenuItem;
4083
3977
  export type MenuItemUpdateTargetSchema = MenuItem;
4084
3978
  export type MenuItemSelfTargetSchema = MenuItem;
4085
3979
  export type MenuItemDestroyTargetSchema = MenuItem;
4086
- /**
4087
- * JSON API data
4088
- *
4089
- * This interface was referenced by `ItemType`'s JSON-Schema
4090
- * via the `definition` "data".
4091
- */
4092
- export type ItemTypeData = {
4093
- type: ItemTypeType;
4094
- id: ItemTypeIdentity;
4095
- };
4096
3980
  /**
4097
3981
  * JSON API data
4098
3982
  *
@@ -4234,22 +4118,22 @@ export type MenuItemUpdateSchema = {
4234
4118
  * This interface was referenced by `Field`'s JSON-Schema
4235
4119
  * via the `duplicate.targetSchema` link.
4236
4120
  *
4237
- * This interface was referenced by `Item<D>`'s JSON-Schema
4121
+ * This interface was referenced by `Item`'s JSON-Schema
4238
4122
  * via the `duplicate.targetSchema` link.
4239
4123
  *
4240
- * This interface was referenced by `Item<D>`'s JSON-Schema
4124
+ * This interface was referenced by `Item`'s JSON-Schema
4241
4125
  * via the `destroy.targetSchema` link.
4242
4126
  *
4243
- * This interface was referenced by `Item<D>`'s JSON-Schema
4127
+ * This interface was referenced by `Item`'s JSON-Schema
4244
4128
  * via the `bulk_publish.targetSchema` link.
4245
4129
  *
4246
- * This interface was referenced by `Item<D>`'s JSON-Schema
4130
+ * This interface was referenced by `Item`'s JSON-Schema
4247
4131
  * via the `bulk_unpublish.targetSchema` link.
4248
4132
  *
4249
- * This interface was referenced by `Item<D>`'s JSON-Schema
4133
+ * This interface was referenced by `Item`'s JSON-Schema
4250
4134
  * via the `bulk_destroy.targetSchema` link.
4251
4135
  *
4252
- * This interface was referenced by `Item<D>`'s JSON-Schema
4136
+ * This interface was referenced by `Item`'s JSON-Schema
4253
4137
  * via the `bulk_move_to_stage.targetSchema` link.
4254
4138
  *
4255
4139
  * This interface was referenced by `ItemVersion`'s JSON-Schema
@@ -4632,7 +4516,7 @@ export type ItemTypeDestroyJobSchema = ItemType;
4632
4516
  /**
4633
4517
  * JSON API data
4634
4518
  *
4635
- * This interface was referenced by `Item<D>`'s JSON-Schema
4519
+ * This interface was referenced by `Item`'s JSON-Schema
4636
4520
  * via the `definition` "data".
4637
4521
  */
4638
4522
  export type ItemData = {
@@ -5885,7 +5769,7 @@ export type ItemTypeUpdateSchema = {
5885
5769
  * This interface was referenced by `DatoApi`'s JSON-Schema
5886
5770
  * via the `definition` "field".
5887
5771
  */
5888
- export type RawField = {
5772
+ export type FieldStableShell = {
5889
5773
  id: FieldIdentity;
5890
5774
  type: FieldType;
5891
5775
  /**
@@ -5989,7 +5873,7 @@ export type FieldDuplicateJobSchema = Field;
5989
5873
  * This interface was referenced by `Field`'s JSON-Schema
5990
5874
  * via the `definition` "attributes".
5991
5875
  */
5992
- export type RawFieldAttributes = {
5876
+ export type FieldAttributesStableShell = {
5993
5877
  /**
5994
5878
  * The label of the field
5995
5879
  */
@@ -6092,7 +5976,7 @@ export type FieldRelationships = {
6092
5976
  * This interface was referenced by `Field`'s JSON-Schema
6093
5977
  * via the `create.schema` link.
6094
5978
  */
6095
- export type RawFieldCreateSchema = {
5979
+ export type FieldCreateSchemaStableShell = {
6096
5980
  id?: FieldIdentity;
6097
5981
  type?: FieldType;
6098
5982
  /**
@@ -6188,7 +6072,7 @@ export type RawFieldCreateSchema = {
6188
6072
  * This interface was referenced by `Field`'s JSON-Schema
6189
6073
  * via the `update.schema` link.
6190
6074
  */
6191
- export type RawFieldUpdateSchema = {
6075
+ export type FieldUpdateSchemaStableShell = {
6192
6076
  id?: FieldIdentity;
6193
6077
  type?: FieldType;
6194
6078
  /**
@@ -6904,783 +6788,19 @@ export type BuildEventAttributes = {
6904
6788
  export type BuildEventRelationships = {
6905
6789
  build_trigger: BuildTriggerData;
6906
6790
  };
6907
- /**
6908
- * 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.
6909
- *
6910
- * ```json
6911
- * // A simple record
6912
- * {
6913
- * "id": "A4gkL_8pTZmcyJ-IlIEd2w",
6914
- * "type": "item",
6915
- * "attributes": {
6916
- * "title": "My Blog Post",
6917
- * "publication_date": "2024-01-15"
6918
- * },
6919
- * "relationships": {
6920
- * "item_type": {
6921
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
6922
- * }
6923
- * }
6924
- * }
6925
- * ```
6926
- *
6927
- * > [!PROTIP] 📘 New to content modeling?
6928
- * > Check out the [Content Modeling Guide](/docs/content-modelling) to understand how to design models, fields, and relationships before diving into API usage.
6929
- *
6930
- * ---
6931
- *
6932
- * ## Field types overview
6933
- *
6934
- * ###### Scalar fields
6935
- * These store basic data types (ie. strings, numbers, booleans):
6936
- *
6937
- * <details>
6938
- * <summary>Single-line string</summary>
6939
- *
6940
- * The field accepts `String` values or `null`.
6941
- *
6942
- * </details>
6943
- *
6944
- * <details>
6945
- * <summary>Slug</summary>
6946
- *
6947
- * The field accepts `String` values or `null`.
6948
- * </details>
6949
- *
6950
- * <details>
6951
- * <summary>Multi-line text</summary>
6952
- *
6953
- * The field accepts simple `String` values (can include newlines) or `null`
6954
- * </details>
6955
- *
6956
- * <details>
6957
- * <summary>Boolean</summary>
6958
- *
6959
- * The field accepts simple `Boolean` values or `null`.
6960
- * </details>
6961
- *
6962
- * <details>
6963
- * <summary>Integer</summary>
6964
- *
6965
- * The field accepts simple `Integer` values or `null`.
6966
- * </details>
6967
- *
6968
- * <details>
6969
- * <summary>Float</summary>
6970
- *
6971
- * The field accepts simple `Float` values or `null`.
6972
- *
6973
- * </details>
6974
- *
6975
- * <details>
6976
- * <summary>Date</summary>
6977
- *
6978
- * The field accepts `String` values in ISO 8601 date format (ie. `"2015-12-29"`) or `null`.
6979
- *
6980
- * </details>
6981
- *
6982
- * <details>
6983
- * <summary>Date time</summary>
6984
- *
6985
- * The field accepts `String` values in ISO 8601 date-time format (ie. `"2020-04-17T16:34:31.981+01:00"`) or `null`.
6986
- *
6987
- * 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.
6988
- * </details>
6989
- *
6990
- * <details>
6991
- * <summary>JSON</summary>
6992
- *
6993
- * The field accepts `String` values that are valid JSON or `null`.
6994
- *
6995
- * **Note**: Must be a JSON-serialized string, not a JavaScript object!
6996
- *
6997
- * </details>
6998
- *
6999
- * ###### Object Fields
7000
- * These require structured objects:
7001
- *
7002
- * <details>
7003
- * <summary>Color</summary>
7004
- *
7005
- * The field accepts an object with the following properties, or `null`:
7006
- *
7007
- * | Property | Required | Type |
7008
- * | -------- | -------- | --------------------------- |
7009
- * | `red` | ✅ | `Integer` between 0 and 255 |
7010
- * | `green` | ✅ | `Integer` between 0 and 255 |
7011
- * | `blue` | ✅ | `Integer` between 0 and 255 |
7012
- * | `alpha` | ✅ | `Integer` between 0 and 255 |
7013
- *
7014
- * </details>
7015
- *
7016
- *
7017
- * <details>
7018
- * <summary>Location</summary>
7019
- *
7020
- * The field accepts an object with the following properties, or `null`:
7021
- *
7022
- * | Property | Required | Type |
7023
- * | ----------- | -------- | ----------------------------- |
7024
- * | `latitude` | ✅ | `Float` between -90.0 to 90 |
7025
- * | `longitude` | ✅ | `Float` between -180.0 to 180 |
7026
- *
7027
- * </details>
7028
- *
7029
- * <details>
7030
- * <summary>SEO</summary>
7031
- *
7032
- * The field accepts an object with the following properties, or `null`:
7033
- *
7034
- * | Property | Required | Type | Description |
7035
- * | -------------- | -------- | ------------------------------------ | ----------------------------------------------- |
7036
- * | `title` | | `String` | Title meta tag (max. 320 characters) |
7037
- * | `description` | | `String` | Description meta tag (max. 320 characters) |
7038
- * | `image` | | `Upload ID` | Asset to be used for social shares |
7039
- * | `twitter_card` | | `"summary"`, `"summary_large_image"` | Type of Twitter card to use |
7040
- * | `no_index` | | `Boolean` | Whether the noindex meta tag should be returned |
7041
- *
7042
- * </details>
7043
- *
7044
- * <details>
7045
- * <summary>External video</summary>
7046
- *
7047
- * The field accepts an object with the following properties, or `null`:
7048
- *
7049
- * | Property | Required | Type | Description | Example |
7050
- * | --------------- | -------- | ------------------------------------ | -------------------------------------------------- | ---------------------------------------------------- |
7051
- * | `provider` | ✅ | `"youtube"`, `"vimeo"`, `"facebook"` | External video provider | `"youtube"` |
7052
- * | `provider_uid` | ✅ | `String` | Unique identifier of the video within the provider | `"vUdGBEb1i9g"` |
7053
- * | `url` | ✅ | `URL` | URL of the video | `"https://www.youtube.com/watch?v=qJhobECFQYk"` |
7054
- * | `width` | ✅ | `Integer` | Video width | `459` |
7055
- * | `height` | ✅ | `Integer` | Video height | `344` |
7056
- * | `thumbnail_url` | ✅ | `URL` | URL for the video thumb | `"https://i.ytimg.com/vi/vUdGBEb1i9g/hqdefault.jpg"` |
7057
- * | `title` | ✅ | `String` | Title of the video | `"Next.js Conf Booth Welcoming!"` |
7058
- *
7059
- * </details>
7060
- *
7061
- * ###### Reference Fields
7062
- *
7063
- * These point to other resources (either assets or other records):
7064
- *
7065
- * <details>
7066
- * <summary>Single-asset</summary>
7067
- *
7068
- * The field accepts an object with the following properties, or `null`:
7069
- *
7070
- * | Property | Required | Type | Description | Example |
7071
- * | ------------- | -------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
7072
- * | `upload_id` | ✅ | `Upload ID` | ID of an asset | `"dhVR2HqgRVCTGFi0bWqLqA"` |
7073
- * | `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"` |
7074
- * | `alt` | | `String` | Alternate text for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`) | `"Florence skyline"` |
7075
- * | `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 }` |
7076
- * | `custom_data` | | `Record<String, String>` | An object containing custom keys that you can use on your frontend projects | `{ "watermark_image": "true" }` |
7077
- *
7078
- * **API responses**: Always returns asset ID only (use separate asset API for details)
7079
- *
7080
- * </details>
7081
- *
7082
- * <details>
7083
- * <summary>Asset gallery</summary>
7084
- *
7085
- * This field accepts an `Array` of objects with the following properties, or `null`:
7086
- *
7087
- * | Property | Required | Type | Description | Example |
7088
- * | ------------- | -------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
7089
- * | `upload_id` | ✅ | `Upload ID` | ID of an asset | `"dhVR2HqgRVCTGFi0bWqLqA"` |
7090
- * | `title` | | `String` | Title for the asset, if you want to override the asset's default value (see Upload `default_field_metadata`) | `"Gallery Image Title"` |
7091
- * | `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"` |
7092
- * | `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 }` |
7093
- * | `custom_data` | | `Record<String, String>` | An object containing custom keys that you can use on your frontend projects | `{ "watermark_image": "true" }` |
7094
- *
7095
- * **API responses**: Always returns array of asset IDs only
7096
- *
7097
- * </details>
7098
- *
7099
- * <details>
7100
- * <summary>Single link</summary>
7101
- *
7102
- * 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.
7103
- *
7104
- * **API responses**: Always returns record ID only
7105
- *
7106
- * </details>
7107
- *
7108
- * <details>
7109
- * <summary>Multiple links</summary>
7110
- *
7111
- * 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.
7112
- *
7113
- * **API responses**: Always returns array of record IDs only
7114
- *
7115
- * </details>
7116
- *
7117
- * ###### Block Fields
7118
- *
7119
- * These are special fields that contain **blocks within records**:
7120
- *
7121
- * | Field Type | What it contains |
7122
- * | ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
7123
- * | **Modular content** | An array of blocks, perfect for building dynamic page sections |
7124
- * | **Single block** | A single block instance or `null` |
7125
- * | **Structured text** | A rich text document that can have blocks embedded within the flow of content ([DAST format](/docs/structured-text/dast)) |
7126
- *
7127
- * Blocks are **records within records** - they're separate items that live inside fields of other records.
7128
- *
7129
- * > [!PROTIP] 📚 Content Modeling Context
7130
- * > 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).
7131
- *
7132
- * 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:
7133
- *
7134
- * * **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.
7135
- *
7136
- * * **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.
7137
- *
7138
- * ```json
7139
- * {
7140
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7141
- * "type": "item",
7142
- * "attributes": {
7143
- * "title": "Block Title",
7144
- * "content": "Block content..."
7145
- * },
7146
- * "relationships": {
7147
- * "item_type": {
7148
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
7149
- * }
7150
- * }
7151
- * }
7152
- * ```
7153
- *
7154
- * <details>
7155
- * <summary>Modular Content</summary>
7156
- *
7157
- * A Modular Content field holds an array of blocks.
7158
- *
7159
- * **As an array of IDs:**
7160
- * ```json
7161
- * {
7162
- * "content_blocks": [
7163
- * "dhVR2HqgRVCTGFi_0bWqLqA",
7164
- * "kL9mN3pQrStUvWxYzAbCdE"
7165
- * ]
7166
- * }
7167
- * ```
7168
- *
7169
- * **As an array of full objects:**
7170
- *
7171
- * ```json
7172
- * {
7173
- * "content_blocks": [
7174
- * {
7175
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7176
- * "type": "item",
7177
- * "attributes": { "title": "Hero Section", "content": "Welcome to our site" },
7178
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7179
- * },
7180
- * {
7181
- * "id": "kL9mN3pQrStUvWxYzAbCdE",
7182
- * "type": "item",
7183
- * "attributes": { "title": "Image Gallery", "images": [...] },
7184
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7185
- * }
7186
- * ]
7187
- * }
7188
- * ```
7189
- * </details>
7190
- *
7191
- * <details>
7192
- * <summary>Single Block</summary>
7193
- *
7194
- * A Single Block field holds exactly one block, or `null`.
7195
- *
7196
- * **As an ID:**
7197
- * ```json
7198
- * {
7199
- * "featured_block": "dhVR2HqgRVCTGFi_0bWqLqA"
7200
- * }
7201
- * ```
7202
- *
7203
- * **As an full object:**
7204
- *
7205
- * ```json
7206
- * {
7207
- * "featured_block": {
7208
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7209
- * "type": "item",
7210
- * "attributes": { "title": "Featured Content", "summary": "A summary..." },
7211
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7212
- * }
7213
- * }
7214
- * ```
7215
- * </details>
7216
- *
7217
- * <details>
7218
- * <summary>Structured Text</summary>
7219
- *
7220
- * 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.
7221
- *
7222
- * **With block IDs:**
7223
- *
7224
- * ```json
7225
- * {
7226
- * "rich_text_content": {
7227
- * "schema": "dast",
7228
- * "document": {
7229
- * "type": "root",
7230
- * "children": [
7231
- * {
7232
- * "type": "paragraph",
7233
- * "children": [{ "type": "span", "value": "Text before block." }]
7234
- * },
7235
- * {
7236
- * "type": "block",
7237
- * "item": "dhVR2HqgRVCTGFi_0bWqLqA"
7238
- * }
7239
- * ]
7240
- * }
7241
- * }
7242
- * }
7243
- * ```
7244
- *
7245
- * **With full objects:**
7246
- *
7247
- * ```json
7248
- * {
7249
- * "rich_text_content": {
7250
- * "schema": "dast",
7251
- * "document": {
7252
- * "type": "root",
7253
- * "children": [
7254
- * {
7255
- * "type": "paragraph",
7256
- * "children": [{ "type": "span", "value": "Text before block." }]
7257
- * },
7258
- * {
7259
- * "type": "block",
7260
- * "item": {
7261
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7262
- * "type": "item",
7263
- * "attributes": { "title": "Embedded Block", "content": "..." },
7264
- * "relationships": { "item_type": { "data": { "id": "...", "type": "item_type" } } }
7265
- * }
7266
- * }
7267
- * ]
7268
- * }
7269
- * }
7270
- * }
7271
- * ```
7272
- * </details>
7273
- *
7274
- * ---
7275
- *
7276
- * ## API response modes: Regular vs. Nested
7277
- *
7278
- * 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:
7279
- *
7280
- * * [Retrieve a single record (`GET /items/:id`)](/docs/content-management-api/resources/item/self)
7281
- * * [Retrieve multiple records (`GET /items`)](/docs/content-management-api/resources/item/instances)
7282
- * * [Retrieve records referenced by a record (`GET /items/:id/references`)](/docs/content-management-api/resources/item/references)
7283
- * * [Retrieve records linked to an asset (`GET /upload/:id/references`)](/docs/content-management-api/resources/upload/references)
7284
- *
7285
- * ###### Regular mode (default)
7286
- *
7287
- * 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.
7288
- *
7289
- * ```json
7290
- * GET /items/A4gkL_8pTZmcyJ-IlIEd2w
7291
- *
7292
- * {
7293
- * "id": "A4gkL_8pTZmcyJ-IlIEd2w",
7294
- * "type": "item",
7295
- * "attributes": {
7296
- * "title": "My Blog Post",
7297
- * "content_blocks": ["dhVR2HqgRVCTGFi_0bWqLqA", "kL9mN3pQrStUvWxYzAbCdE"],
7298
- * "featured_block": "nZ8xY2vWqTuJkL3mNcBeFg"
7299
- * }
7300
- * }
7301
- * ```
7302
- *
7303
- * ###### Nested mode (`?nested=true`)
7304
- *
7305
- * 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.
7306
- *
7307
- * ```json
7308
- * GET /items/A4gkL_8pTZmcyJ-IlIEd2w?nested=true
7309
- *
7310
- * {
7311
- * "id": "A4gkL_8pTZmcyJ-IlIEd2w",
7312
- * "type": "item",
7313
- * "attributes": {
7314
- * "title": "My Blog Post",
7315
- * "content_blocks": [
7316
- * {
7317
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7318
- * "type": "item",
7319
- * "attributes": { "title": "Hero Section", "content": "Welcome to our site" },
7320
- * "relationships": { ... }
7321
- * },
7322
- * {
7323
- * "id": "kL9mN3pQrStUvWxYzAbCdE",
7324
- * "type": "item",
7325
- * "attributes": { "title": "Image Gallery", "images": [...] },
7326
- * "relationships": { ... }
7327
- * }
7328
- * ],
7329
- * "featured_block": {
7330
- * "id": "nZ8xY2vWqTuJkL3mNcBeFg",
7331
- * "type": "item",
7332
- * "attributes": { ... },
7333
- * "relationships": { ... }
7334
- * }
7335
- * }
7336
- * }
7337
- * ```
7338
- *
7339
- * > [!WARNING] Block Fields vs. Other Reference Fields
7340
- * > 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.
7341
- *
7342
- * ###### When to use each mode?
7343
- *
7344
- * | Use "Regular Mode" when... | Use "Nested Mode" when... |
7345
- * | -------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
7346
- * | Listing many records or building navigation. | Displaying or editing block content, as it provides the actual content needed. |
7347
- * | You only need to know which blocks exist. | You need to read the actual block content for display or updates. |
7348
- * | Building navigation | Preparing to update blocks |
7349
- * | 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. |
7350
- *
7351
- *
7352
- * ---
7353
- *
7354
- * ## Creating and updating blocks
7355
- *
7356
- * Working with blocks follows one fundamental constraint:
7357
- *
7358
- * **You cannot create, edit, or delete blocks directly. You must always update the parent record that contains them.**
7359
- *
7360
- * 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.
7361
- *
7362
- * ###### Key rules for block operations
7363
- *
7364
- * 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.
7365
- * 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`.
7366
- * 3. **To keep an existing block unchanged**: Simply provide its **Block ID** string. This is the most efficient way to handle unchanged blocks.
7367
- * 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`.
7368
- * 5. **To reorder blocks** (in Modular Content): Send an array of Block IDs in the new desired order.
7369
- *
7370
- *
7371
- * The following examples show how to apply these rules.
7372
- *
7373
- * <details>
7374
- * <summary>Working with Modular Content Fields</summary>
7375
- *
7376
- * **Current state** (from a regular API response):
7377
- * ```json
7378
- * {
7379
- * "content_blocks": ["dhVR2HqgRVCTGFi_0bWqLqA", "kL9mN3pQrStUvWxYzAbCdE", "fG8hI1jKlMnOpQrStUvWxY"]
7380
- * }
7381
- * ```
7382
- *
7383
- * **To update the second block and reorder the others:**
7384
- * ```json
7385
- * {
7386
- * "content_blocks": [
7387
- * "fG8hI1jKlMnOpQrStUvWxY", // Reordered: kept as ID
7388
- * {
7389
- * "id": "kL9mN3pQrStUvWxYzAbCdE", // Updated: sent as object
7390
- * "type": "item",
7391
- * "attributes": { "title": "Updated Title" }
7392
- * },
7393
- * "dhVR2HqgRVCTGFi_0bWqLqA" // Reordered: kept as ID
7394
- * ]
7395
- * }
7396
- * ```
7397
- *
7398
- * **To add a new block at the end and remove the first block:**
7399
- * ```json
7400
- * {
7401
- * "content_blocks": [
7402
- * "kL9mN3pQrStUvWxYzAbCdE", // Kept as ID
7403
- * "fG8hI1jKlMnOpQrStUvWxY", // Kept as ID
7404
- * {
7405
- * "type": "item", // New block: sent as object with relationships
7406
- * "attributes": { "title": "A Brand New Block" },
7407
- * "relationships": {
7408
- * "item_type": {
7409
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
7410
- * }
7411
- * }
7412
- * }
7413
- * ]
7414
- * }
7415
- * ```
7416
- *
7417
- * </details>
7418
- *
7419
- * <details>
7420
- * <summary>Working with Single Block Fields</summary>
7421
- *
7422
- * **Current state** (from a regular API response):
7423
- * ```json
7424
- * {
7425
- * "hero_block": "dhVR2HqgRVCTGFi_0bWqLqA"
7426
- * }
7427
- * ```
7428
- *
7429
- * **To update the block's content:**
7430
- * ```json
7431
- * {
7432
- * "hero_block": {
7433
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA",
7434
- * "type": "item",
7435
- * "attributes": { "title": "Updated Hero Title" }
7436
- * }
7437
- * }
7438
- * ```
7439
- *
7440
- * **To replace it with a new block:**
7441
- * ```json
7442
- * {
7443
- * "hero_block": {
7444
- * "type": "item",
7445
- * "attributes": { "title": "New Hero Block" },
7446
- * "relationships": {
7447
- * "item_type": {
7448
- * "data": { "id": "BxZ9Y2aKQVeTnM4hP8wLpD", "type": "item_type" }
7449
- * }
7450
- * }
7451
- * }
7452
- * }
7453
- * ```
7454
- *
7455
- * **To remove (delete) the block:**
7456
- * ```json
7457
- * {
7458
- * "hero_block": null
7459
- * }
7460
- * ```
7461
- * </details>
7462
- *
7463
- * <details>
7464
- * <summary>Working with Structured Text Fields</summary>
7465
- *
7466
- * 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.
7467
- *
7468
- * **Current state** (from a regular API response):
7469
- * ```json
7470
- * {
7471
- * "rich_content": {
7472
- * "schema": "dast",
7473
- * "document": {
7474
- * "type": "root",
7475
- * "children": [
7476
- * { "type": "block", "item": "dhVR2HqgRVCTGFi_0bWqLqA" },
7477
- * { "type": "paragraph", "children": [{ "type": "span", "value": "Some text." }] }
7478
- * ]
7479
- * }
7480
- * }
7481
- * }
7482
- * ```
7483
- *
7484
- * **To update the block's content:**
7485
- * ```json
7486
- * {
7487
- * "rich_content": {
7488
- * "schema": "dast",
7489
- * "document": {
7490
- * "type": "root",
7491
- * "children": [
7492
- * {
7493
- * "type": "block",
7494
- * "item": {
7495
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA", // The block to update
7496
- * "type": "item",
7497
- * "attributes": { "title": "Updated DAST Block Title" }
7498
- * }
7499
- * },
7500
- * { "type": "paragraph", "children": [{ "type": "span", "value": "Some text." }] }
7501
- * ]
7502
- * }
7503
- * }
7504
- * }
7505
- * ```
7506
- * </details>
7507
- *
7508
- * ###### Deeply-nested blocks
7509
- *
7510
- * 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.
7511
- *
7512
- * 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.
7513
- *
7514
- * <details>
7515
- * <summary>Example: Updating a nested block</summary>
7516
- *
7517
- * 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:
7518
- *
7519
- * ```json
7520
- * // This payload is sent to the top-level record containing the "Parent Block"
7521
- * {
7522
- * "wrapper_block": {
7523
- * "id": "dhVR2HqgRVCTGFi_0bWqLqA", // ID of the parent block being updated
7524
- * "type": "item",
7525
- * "attributes": {
7526
- * "nested_content": [
7527
- * {
7528
- * "id": "kL9mN3pQrStUvWxYzAbCdE", // ID of the nested block being updated
7529
- * "type": "item",
7530
- * "attributes": { "title": "Updated Child Block 1" }
7531
- * },
7532
- * "fG8hI1jKlMnOpQrStUvWxY" // Unchanged nested block, sent as ID
7533
- * ],
7534
- * // You can skip any attribute that does not need to change
7535
- * }
7536
- * }
7537
- * }
7538
- * ```
7539
- * </details>
7540
- *
7541
- * ---
7542
- *
7543
- * ## Localization
7544
- *
7545
- * 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.
7546
- *
7547
- * The fundamental change is that the field's value is no longer a single piece of data but an **object keyed by locale codes**.
7548
- *
7549
- * For example, a simple non-localized `title` field looks like this:
7550
- * ```json
7551
- * {
7552
- * "title": "Hello World"
7553
- * }
7554
- * ```
7555
- *
7556
- * When localized, it becomes an object containing a value for each configured locale:
7557
- * ```json
7558
- * {
7559
- * "title": {
7560
- * "en": "Hello World",
7561
- * "it": "Ciao Mondo",
7562
- * "fr": "Bonjour le Monde"
7563
- * }
7564
- * }
7565
- * ```
7566
- * 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.
7567
- *
7568
- * <details>
7569
- * <summary>Example: Localized Modular Content field</summary>
7570
- *
7571
- * In a `regular` API response, you would see different arrays of block IDs for each locale.
7572
- *
7573
- * ```json
7574
- * {
7575
- * "content_blocks": {
7576
- * "en": ["dhVR2HqgRVCTGFi0bWqLqA", "kL9mN3pQrStUvWxYzAbCdE"],
7577
- * "it": ["fG8hI1jKlMnOpQrStUvWxY", "dhVR2HqgRVCTGFi0bWqLqA"]
7578
- * }
7579
- * }
7580
- * ```
7581
- * </details>
7582
- *
7583
- * <details>
7584
- * <summary>Example: Localized Single Block field</summary>
7585
- * A different block can be assigned to each locale.
7586
- *
7587
- * ```json
7588
- * {
7589
- * "hero_block": {
7590
- * "en": "dhVR2HqgRVCTGFi0bWqLqA",
7591
- * "it": "kL9mN3pQrStUvWxYzAbCdE"
7592
- * }
7593
- * }
7594
- * ```
7595
- * </details>
7596
- *
7597
- * <details>
7598
- * <summary>Example: Localized Structured Text field</summary>
7599
- *
7600
- * The entire DAST document is localized, allowing for different text and different embedded blocks per locale.
7601
- *
7602
- * ```json
7603
- * {
7604
- * "rich_content": {
7605
- * "en": {
7606
- * "schema": "dast",
7607
- * "document": {
7608
- * "type": "root",
7609
- * "children": [{ "type": "block", "item": "dhVR2HqgRVCTGFi0bWqLqA" }]
7610
- * }
7611
- * },
7612
- * "it": {
7613
- * "schema": "dast",
7614
- * "document": {
7615
- * "type": "root",
7616
- * "children": [{ "type": "block", "item": "kL9mN3pQrStUvWxYzAbCdE" }]
7617
- * }
7618
- * }
7619
- * }
7620
- * }
7621
- * ```
7622
- * </details>
7623
- *
7624
- * When reading or writing localized content, there are a few key rules to follow to ensure data integrity.
7625
- *
7626
- * ###### Locale consistency
7627
- * 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.
7628
- *
7629
- * ```json
7630
- * // ❌ This will FAIL due to inconsistent locales ("it" vs "fr")
7631
- * {
7632
- * "title": { "en": "Title", "it": "Titolo" },
7633
- * "description": { "en": "Description", "fr": "Description" }
7634
- * }
7635
- *
7636
- * // ✅ This is VALID because locales are consistent across all fields
7637
- * {
7638
- * "title": { "en": "Title", "it": "Titolo" },
7639
- * "description": { "en": "Description", "it": "Descrizione" }
7640
- * }
7641
- * ```
7642
- *
7643
- * ###### Required locales
7644
- *
7645
- * 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.
7646
- *
7647
- * ```json
7648
- * // ❌ This will FAIL if all locales are required for the model
7649
- * {
7650
- * "title": { "en": "Title" }
7651
- * }
7652
- * ```
7653
- *
7654
- *
7655
- * This interface was referenced by `ScheduledPublication`'s JSON-Schema
7656
- * via the `destroy.targetSchema` link.
7657
- *
7658
- * This interface was referenced by `ScheduledUnpublishing`'s JSON-Schema
7659
- * via the `destroy.targetSchema` link.
7660
- *
7661
- * This interface was referenced by `DatoApi`'s JSON-Schema
7662
- * via the `definition` "item".
7663
- */
7664
- export type RawItem = {
7665
- id: ItemIdentity;
7666
- type: ItemType1;
7667
- item_type: ItemTypeData;
7668
- creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7669
- meta: ItemMeta;
7670
- };
7671
- export type ItemCreateTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7672
- export type ItemDuplicateJobSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7673
- export type ItemUpdateTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7674
- export type ItemSelfTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7675
- export type ItemDestroyJobSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7676
- export type ItemPublishTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7677
- export type ItemUnpublishTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7678
- export type ScheduledPublicationDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
7679
- export type ScheduledUnpublishingDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6791
+ export type ItemCreateTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6792
+ export type ItemDuplicateJobSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6793
+ export type ItemUpdateTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6794
+ export type ItemSelfTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6795
+ export type ItemDestroyJobSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6796
+ export type ItemPublishTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6797
+ export type ItemUnpublishTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6798
+ export type ScheduledPublicationDestroyTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
6799
+ export type ScheduledUnpublishingDestroyTargetSchema<D extends ItemTypeDefinition = ItemTypeDefinition, NestedMode extends boolean = false> = NestedMode extends false ? Item<D> : ItemInNestedResponse<D>;
7680
6800
  /**
7681
6801
  * Meta information regarding the record
7682
6802
  *
7683
- * This interface was referenced by `Item<D>`'s JSON-Schema
6803
+ * This interface was referenced by `Item`'s JSON-Schema
7684
6804
  * via the `definition` "meta".
7685
6805
  */
7686
6806
  export type ItemMeta = {
@@ -7737,52 +6857,43 @@ export type ItemMeta = {
7737
6857
  */
7738
6858
  has_children: null | boolean;
7739
6859
  };
7740
- /**
7741
- * The JSON data associated to the record
7742
- *
7743
- * This interface was referenced by `Item<D>`'s JSON-Schema
7744
- * via the `definition` "attributes".
7745
- */
7746
- export type ItemAttributes = {
7747
- [k: string]: unknown;
7748
- };
7749
6860
  /**
7750
6861
  * JSON API links
7751
6862
  *
7752
- * This interface was referenced by `Item<D>`'s JSON-Schema
6863
+ * This interface was referenced by `Item`'s JSON-Schema
7753
6864
  * via the `definition` "relationships".
7754
6865
  */
7755
- export type ItemRelationships = {
7756
- item_type: ItemTypeData;
6866
+ export type ItemRelationships<D extends ItemTypeDefinition = ItemTypeDefinition> = {
6867
+ item_type: ItemTypeData<D>;
7757
6868
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7758
6869
  };
7759
6870
  /**
7760
- * This interface was referenced by `Item<D>`'s JSON-Schema
6871
+ * This interface was referenced by `Item`'s JSON-Schema
7761
6872
  * via the `validate_existing.schema` link.
7762
6873
  */
7763
- export type RawItemValidateExistingSchema = {
6874
+ export type ItemValidateExistingSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7764
6875
  id?: ItemIdentity;
7765
6876
  type?: ItemType1;
7766
- item_type: ItemTypeData;
6877
+ item_type: ItemTypeData<D>;
7767
6878
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7768
- };
6879
+ } & ToItemAttributesInRequest<D>;
7769
6880
  /**
7770
- * This interface was referenced by `Item<D>`'s JSON-Schema
6881
+ * This interface was referenced by `Item`'s JSON-Schema
7771
6882
  * via the `validate_new.schema` link.
7772
6883
  */
7773
- export type RawItemValidateNewSchema = {
6884
+ export type ItemValidateNewSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7774
6885
  type?: ItemType1;
7775
- item_type: ItemTypeData;
6886
+ item_type: ItemTypeData<D>;
7776
6887
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7777
- };
6888
+ } & ToItemAttributesInRequest<D>;
7778
6889
  /**
7779
- * This interface was referenced by `Item<D>`'s JSON-Schema
6890
+ * This interface was referenced by `Item`'s JSON-Schema
7780
6891
  * via the `create.schema` link.
7781
6892
  */
7782
- export type RawItemCreateSchema = {
6893
+ export type ItemCreateSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7783
6894
  id?: ItemIdentity;
7784
6895
  type?: ItemType1;
7785
- item_type: ItemTypeData;
6896
+ item_type: ItemTypeData<D>;
7786
6897
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7787
6898
  /**
7788
6899
  * Meta information regarding the record
@@ -7829,15 +6940,15 @@ export type RawItemCreateSchema = {
7829
6940
  */
7830
6941
  current_version?: string;
7831
6942
  };
7832
- };
6943
+ } & ToItemAttributesInRequest<D>;
7833
6944
  /**
7834
- * This interface was referenced by `Item<D>`'s JSON-Schema
6945
+ * This interface was referenced by `Item`'s JSON-Schema
7835
6946
  * via the `update.schema` link.
7836
6947
  */
7837
- export type RawItemUpdateSchema = {
6948
+ export type ItemUpdateSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
7838
6949
  id?: ItemIdentity;
7839
6950
  type?: ItemType1;
7840
- item_type?: ItemTypeData;
6951
+ item_type?: ItemTypeData<D>;
7841
6952
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7842
6953
  /**
7843
6954
  * Meta information regarding the record
@@ -7896,11 +7007,11 @@ export type RawItemUpdateSchema = {
7896
7007
  */
7897
7008
  has_children?: null | boolean;
7898
7009
  };
7899
- };
7010
+ } & ToItemAttributesInRequest<D>;
7900
7011
  /**
7901
7012
  * Information about the record
7902
7013
  *
7903
- * This interface was referenced by `Item<D>`'s JSON-Schema
7014
+ * This interface was referenced by `Item`'s JSON-Schema
7904
7015
  * via the `current_vs_published_state.targetSchema` link.
7905
7016
  *
7906
7017
  * This interface was referenced by `DatoApi`'s JSON-Schema
@@ -7990,7 +7101,7 @@ export type ItemCurrentVsPublishedStateRelationships = {
7990
7101
  published_version: ItemVersionData | null;
7991
7102
  };
7992
7103
  /**
7993
- * This interface was referenced by `Item<D>`'s JSON-Schema
7104
+ * This interface was referenced by `Item`'s JSON-Schema
7994
7105
  * via the `bulk_publish.schema` link.
7995
7106
  */
7996
7107
  export type ItemBulkPublishSchema = {
@@ -7999,7 +7110,7 @@ export type ItemBulkPublishSchema = {
7999
7110
  minItems?: unknown;
8000
7111
  };
8001
7112
  /**
8002
- * This interface was referenced by `Item<D>`'s JSON-Schema
7113
+ * This interface was referenced by `Item`'s JSON-Schema
8003
7114
  * via the `bulk_unpublish.schema` link.
8004
7115
  */
8005
7116
  export type ItemBulkUnpublishSchema = {
@@ -8008,7 +7119,7 @@ export type ItemBulkUnpublishSchema = {
8008
7119
  minItems?: unknown;
8009
7120
  };
8010
7121
  /**
8011
- * This interface was referenced by `Item<D>`'s JSON-Schema
7122
+ * This interface was referenced by `Item`'s JSON-Schema
8012
7123
  * via the `bulk_destroy.schema` link.
8013
7124
  */
8014
7125
  export type ItemBulkDestroySchema = {
@@ -8017,7 +7128,7 @@ export type ItemBulkDestroySchema = {
8017
7128
  minItems?: unknown;
8018
7129
  };
8019
7130
  /**
8020
- * This interface was referenced by `Item<D>`'s JSON-Schema
7131
+ * This interface was referenced by `Item`'s JSON-Schema
8021
7132
  * via the `bulk_move_to_stage.schema` link.
8022
7133
  */
8023
7134
  export type ItemBulkMoveToStageSchema = {
@@ -11796,4 +10907,3 @@ export type WorkflowUpdateSchema = {
11796
10907
  }[]
11797
10908
  ];
11798
10909
  };
11799
- export {};