@datocms/cma-client 5.1.3 → 5.1.5

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 (87) hide show
  1. package/dist/cjs/fieldTypes/lat_lon.js +6 -6
  2. package/dist/cjs/fieldTypes/lat_lon.js.map +1 -1
  3. package/dist/cjs/fieldTypes/rich_text.js.map +1 -1
  4. package/dist/cjs/fieldTypes/single_block.js.map +1 -1
  5. package/dist/cjs/fieldTypes/structured_text.js.map +1 -1
  6. package/dist/cjs/generated/Client.js +1 -1
  7. package/dist/cjs/generated/resources/Item.js +41 -23
  8. package/dist/cjs/generated/resources/Item.js.map +1 -1
  9. package/dist/cjs/generated/resources/ScheduledPublication.js +4 -2
  10. package/dist/cjs/generated/resources/ScheduledPublication.js.map +1 -1
  11. package/dist/cjs/generated/resources/ScheduledUnpublishing.js +4 -2
  12. package/dist/cjs/generated/resources/ScheduledUnpublishing.js.map +1 -1
  13. package/dist/cjs/generated/resources/Upload.js +4 -2
  14. package/dist/cjs/generated/resources/Upload.js.map +1 -1
  15. package/dist/cjs/index.js +1 -0
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/cjs/utilities/buildBlockRecord.js.map +1 -1
  18. package/dist/cjs/utilities/itemDefinition.js +3 -0
  19. package/dist/cjs/utilities/itemDefinition.js.map +1 -0
  20. package/dist/esm/fieldTypes/gallery.d.ts +1 -1
  21. package/dist/esm/fieldTypes/lat_lon.d.ts +5 -5
  22. package/dist/esm/fieldTypes/lat_lon.js +3 -3
  23. package/dist/esm/fieldTypes/lat_lon.js.map +1 -1
  24. package/dist/esm/fieldTypes/rich_text.d.ts +8 -7
  25. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  26. package/dist/esm/fieldTypes/single_block.d.ts +15 -14
  27. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  28. package/dist/esm/fieldTypes/structured_text.d.ts +13 -12
  29. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  30. package/dist/esm/generated/ApiTypes.d.ts +74 -62
  31. package/dist/esm/generated/Client.js +1 -1
  32. package/dist/esm/generated/RawApiTypes.d.ts +123 -121
  33. package/dist/esm/generated/resources/Field.d.ts +230 -230
  34. package/dist/esm/generated/resources/Item.d.ts +42 -24
  35. package/dist/esm/generated/resources/Item.js +41 -23
  36. package/dist/esm/generated/resources/Item.js.map +1 -1
  37. package/dist/esm/generated/resources/ItemVersion.d.ts +1 -1
  38. package/dist/esm/generated/resources/ScheduledPublication.d.ts +5 -2
  39. package/dist/esm/generated/resources/ScheduledPublication.js +4 -2
  40. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  41. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +5 -2
  42. package/dist/esm/generated/resources/ScheduledUnpublishing.js +4 -2
  43. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  44. package/dist/esm/generated/resources/Upload.d.ts +10 -2
  45. package/dist/esm/generated/resources/Upload.js +4 -2
  46. package/dist/esm/generated/resources/Upload.js.map +1 -1
  47. package/dist/esm/index.d.ts +1 -0
  48. package/dist/esm/index.js +1 -0
  49. package/dist/esm/index.js.map +1 -1
  50. package/dist/esm/utilities/buildBlockRecord.d.ts +5 -31
  51. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  52. package/dist/esm/utilities/itemDefinition.d.ts +74 -0
  53. package/dist/esm/utilities/itemDefinition.js +2 -0
  54. package/dist/esm/utilities/itemDefinition.js.map +1 -0
  55. package/dist/types/fieldTypes/gallery.d.ts +1 -1
  56. package/dist/types/fieldTypes/lat_lon.d.ts +5 -5
  57. package/dist/types/fieldTypes/rich_text.d.ts +8 -7
  58. package/dist/types/fieldTypes/single_block.d.ts +15 -14
  59. package/dist/types/fieldTypes/structured_text.d.ts +13 -12
  60. package/dist/types/generated/ApiTypes.d.ts +74 -62
  61. package/dist/types/generated/RawApiTypes.d.ts +123 -121
  62. package/dist/types/generated/resources/Field.d.ts +230 -230
  63. package/dist/types/generated/resources/Item.d.ts +42 -24
  64. package/dist/types/generated/resources/ItemVersion.d.ts +1 -1
  65. package/dist/types/generated/resources/ScheduledPublication.d.ts +5 -2
  66. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +5 -2
  67. package/dist/types/generated/resources/Upload.d.ts +10 -2
  68. package/dist/types/index.d.ts +1 -0
  69. package/dist/types/utilities/buildBlockRecord.d.ts +5 -31
  70. package/dist/types/utilities/itemDefinition.d.ts +74 -0
  71. package/package.json +5 -5
  72. package/resources.json +564 -0
  73. package/src/fieldTypes/gallery.ts +1 -1
  74. package/src/fieldTypes/lat_lon.ts +7 -9
  75. package/src/fieldTypes/rich_text.ts +22 -13
  76. package/src/fieldTypes/single_block.ts +42 -32
  77. package/src/fieldTypes/structured_text.ts +60 -23
  78. package/src/generated/ApiTypes.ts +123 -70
  79. package/src/generated/Client.ts +1 -1
  80. package/src/generated/RawApiTypes.ts +174 -138
  81. package/src/generated/resources/Item.ts +360 -108
  82. package/src/generated/resources/ScheduledPublication.ts +31 -11
  83. package/src/generated/resources/ScheduledUnpublishing.ts +31 -11
  84. package/src/generated/resources/Upload.ts +54 -12
  85. package/src/index.ts +1 -0
  86. package/src/utilities/buildBlockRecord.ts +19 -3
  87. package/src/utilities/itemDefinition.ts +229 -0
@@ -1 +1 @@
1
- {"version":3,"file":"single_block.js","sourceRoot":"","sources":["../../../src/fieldTypes/single_block.ts"],"names":[],"mappings":"AAkGA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,YAAY,IAAI,KAAK,CACtB,CAAC;AACJ,CAAC;AAID;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC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A2B,CAAC,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,yCAAyC,CAGvD,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CAErD,KAAc;IACd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,uFAAuF;IACvF,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,gDAAgD,CAG9D,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,uCAAuC,CAAC,CACpE,CAAC;AACJ,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type Block, type Document, type InlineBlock } from 'datocms-structured-text-utils';
2
2
  import type * as RawApiTypes from '../generated/RawApiTypes';
3
3
  import type { LocalizedFieldValue } from '../utilities/fieldValue';
4
+ import type { ItemDefinition } from '../utilities/itemDefinition';
4
5
  import type { StructuredTextEditorConfiguration } from './appearance/structured_text';
5
6
  import { type BlockItemInARequest } from './single_block';
6
7
  import type { LengthValidator } from './validators/length';
@@ -39,15 +40,15 @@ import type { StructuredTextLinksValidator } from './validators/structured_text_
39
40
  /**
40
41
  * Variant of 'block' structured text node for API requests
41
42
  */
42
- export type BlockAsRequest = Block<BlockItemInARequest>;
43
+ export type BlockAsRequest<D extends ItemDefinition = ItemDefinition> = Block<BlockItemInARequest<D>>;
43
44
  /**
44
45
  * Variant of 'inlineBlock' structured text node for API requests
45
46
  */
46
- export type InlineBlockAsRequest = InlineBlock<BlockItemInARequest>;
47
+ export type InlineBlockAsRequest<D extends ItemDefinition = ItemDefinition> = InlineBlock<BlockItemInARequest<D>>;
47
48
  /**
48
49
  * Variant of Structured Text document for API requests
49
50
  */
50
- export type DocumentAsRequest = Document<BlockItemInARequest>;
51
+ export type DocumentAsRequest<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = Document<BlockItemInARequest<BlockItemDefinition>, BlockItemInARequest<InlineBlockItemDefinition>>;
51
52
  /**
52
53
  * =============================================================================
53
54
  * NESTED VARIANTS - Types for API responses with ?nested=true parameter
@@ -60,15 +61,15 @@ export type DocumentAsRequest = Document<BlockItemInARequest>;
60
61
  /**
61
62
  * Variant of 'block' structured text node for ?nested=true API responses
62
63
  */
63
- export type BlockWithNestedBlocks = Block<RawApiTypes.Item>;
64
+ export type BlockWithNestedBlocks<D extends ItemDefinition = ItemDefinition> = Block<RawApiTypes.Item<D>>;
64
65
  /**
65
66
  * Variant of 'inlineBlock' structured text node for ?nested=true API responses
66
67
  */
67
- export type InlineBlockWithNestedBlocks = InlineBlock<RawApiTypes.Item>;
68
+ export type InlineBlockWithNestedBlocks<D extends ItemDefinition = ItemDefinition> = InlineBlock<RawApiTypes.Item<D>>;
68
69
  /**
69
70
  * Variant of Structured Text document for ?nested=true API responses
70
71
  */
71
- export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
72
+ export type DocumentWithNestedBlocks<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = Document<RawApiTypes.Item<BlockItemDefinition>, RawApiTypes.Item<InlineBlockItemDefinition>>;
72
73
  /**
73
74
  * =============================================================================
74
75
  * MAIN APPLICATION TYPES
@@ -79,8 +80,8 @@ export type DocumentWithNestedBlocks = Document<RawApiTypes.Item>;
79
80
  * Can be null (empty field) or a document with blocks as string IDs
80
81
  */
81
82
  export type StructuredTextFieldValue = Document | null;
82
- export type StructuredTextFieldValueAsRequest = DocumentAsRequest | null;
83
- export type StructuredTextFieldValueWithNestedBlocks = DocumentWithNestedBlocks | null;
83
+ export type StructuredTextFieldValueAsRequest<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = DocumentAsRequest<BlockItemDefinition, InlineBlockItemDefinition> | null;
84
+ export type StructuredTextFieldValueWithNestedBlocks<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition> = DocumentWithNestedBlocks<BlockItemDefinition, InlineBlockItemDefinition> | null;
84
85
  /**
85
86
  * Type guard for basic structured text field values (blocks as string IDs only).
86
87
  * Checks for the expected structure and ensures all block/inlineBlock nodes have string IDs.
@@ -91,14 +92,14 @@ export declare function isLocalizedStructuredTextFieldValue(value: unknown): val
91
92
  * Type guard for structured text field values in API request format.
92
93
  * Allows blocks as string IDs, full objects with IDs, or objects without IDs.
93
94
  */
94
- export declare function isStructuredTextFieldValueAsRequest(value: unknown): value is StructuredTextFieldValueAsRequest;
95
- export declare function isLocalizedStructuredTextFieldValueAsRequest(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueAsRequest>;
95
+ export declare function isStructuredTextFieldValueAsRequest<BlockItemDefinition extends ItemDefinition = ItemDefinition, InlineBlockItemDefinition extends ItemDefinition = ItemDefinition>(value: unknown): value is StructuredTextFieldValueAsRequest<BlockItemDefinition, InlineBlockItemDefinition>;
96
+ export declare function isLocalizedStructuredTextFieldValueAsRequest<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueAsRequest<D>>;
96
97
  /**
97
98
  * Type guard for structured text field values with nested blocks (?nested=true format).
98
99
  * Ensures all block/inlineBlock nodes have full RawApiTypes.Item objects.
99
100
  */
100
- export declare function isStructuredTextFieldValueWithNestedBlocks(value: unknown): value is StructuredTextFieldValueWithNestedBlocks;
101
- export declare function isLocalizedStructuredTextFieldValueWithNestedBlocks(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueWithNestedBlocks>;
101
+ export declare function isStructuredTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is StructuredTextFieldValueWithNestedBlocks<D>;
102
+ export declare function isLocalizedStructuredTextFieldValueWithNestedBlocks<D extends ItemDefinition = ItemDefinition>(value: unknown): value is LocalizedFieldValue<StructuredTextFieldValueWithNestedBlocks<D>>;
102
103
  export type StructuredTextFieldValidators = {
103
104
  /** Only accept references to block records of the specified block models */
104
105
  structured_text_blocks: StructuredTextBlocksValidator;
@@ -1 +1 @@
1
- {"version":3,"file":"structured_text.js","sourceRoot":"","sources":["../../../src/fieldTypes/structured_text.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,GACd,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAEL,QAAQ,EACR,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AA4FxB;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,IAAa,EACb,QAAsD;IAEtD,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE;QACrC,wEAAwE;QACxE,IAAI,OAAO,CAAI,WAAW,CAAC,IAAI,aAAa,CAAI,WAAW,CAAC,EAAE;YAC5D,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QACD,qDAAqD;QACrD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEhC,IAAI,CAAC,UAAU,CAAU,KAAK,CAAC,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,8DAA8D;IAC9D,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACpD,OAAO,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;IACvC,CAAC,CAAC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B,2EAA2E;QAC3E,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mDAAmD,CAGjE,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,0CAA0C,CAAC,CACvE,CAAC;AACJ,CAAC"}
@@ -1,4 +1,5 @@
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, LinkFieldAppearance, LinkFieldValidators, LinksFieldAppearance, LinksFieldValidators, LocationFieldAppearance, LocationFieldValidators, LocationFieldValue, RichTextFieldAppearance, RichTextFieldValidators, SeoFieldAppearance, SeoFieldValidators, SingleBlockFieldAppearance, SingleBlockFieldValidators, SlugFieldAppearance, SlugFieldValidators, StringFieldAppearance, StringFieldValidators, StringFieldValue, StructuredTextFieldAppearance, StructuredTextFieldValidators, TextFieldAppearance, TextFieldValidators, TextFieldValue, VideoFieldAppearance, VideoFieldValidators } from '../fieldTypes';
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';
2
3
  /**
3
4
  * Enhanced appearance configuration with field-specific types and addon support
4
5
  */
@@ -27,7 +28,7 @@ type LocalizedFieldAttributesForFieldType<SourceType, FieldType extends RawField
27
28
  * Union of localized and non-localized field configurations for attributes
28
29
  */
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>;
30
- 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', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | 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>;
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>;
31
32
  export type FieldAttributes = GenericFieldAttributes<RawFieldAttributes>;
32
33
  export type Field = GenericFieldAttributes<RawField>;
33
34
  type LocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends RawFieldAttributes['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
@@ -45,7 +46,7 @@ type NonLocalizedFieldCreateConfigForFieldType<SourceType, FieldType extends Raw
45
46
  appearance?: FieldAppearanceConfig<FieldAppearance>;
46
47
  };
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>;
48
- 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', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | 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>;
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>;
49
50
  export type FieldCreateSchema = FieldCreateConfig<RawFieldCreateSchema>;
50
51
  /**
51
52
  * Helper type to conditionally handle default values based on localization for field updates
@@ -57,8 +58,24 @@ type FieldUpdateConfigForFieldType<SourceType, FieldType extends RawFieldAttribu
57
58
  validators?: FieldValidators;
58
59
  appearance?: FieldAppearanceConfig<FieldAppearance>;
59
60
  };
60
- 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', LocationFieldValue, LocationFieldValidators, LocationFieldAppearance> | 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>;
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>;
61
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;
72
+ };
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>;
62
79
  /**
63
80
  * This file was automatically generated by hyperschema-to-ts: DO NOT MODIFY IT BY HAND.
64
81
  */
@@ -529,17 +546,17 @@ export type UploadCollectionReorderSchema = {
529
546
  */
530
547
  export type UploadCollectionReorderJobSchema = UploadCollection[];
531
548
  /**
532
- * This interface was referenced by `Item`'s JSON-Schema
549
+ * This interface was referenced by `Item<D>`'s JSON-Schema
533
550
  * via the `definition` "type".
534
551
  */
535
552
  export type ItemType1 = 'item';
536
553
  /**
537
554
  * RFC 4122 UUID of record expressed in URL-safe base64 format
538
555
  *
539
- * This interface was referenced by `Item`'s JSON-Schema
556
+ * This interface was referenced by `Item<D>`'s JSON-Schema
540
557
  * via the `definition` "identity".
541
558
  *
542
- * This interface was referenced by `Item`'s JSON-Schema
559
+ * This interface was referenced by `Item<D>`'s JSON-Schema
543
560
  * via the `definition` "id".
544
561
  */
545
562
  export type ItemIdentity = string;
@@ -827,12 +844,12 @@ export type BuildEventInstancesHrefSchema = {
827
844
  [k: string]: unknown;
828
845
  };
829
846
  /**
830
- * This interface was referenced by `Item`'s JSON-Schema
847
+ * This interface was referenced by `Item<D>`'s JSON-Schema
831
848
  * via the `instances.targetSchema` link.
832
849
  */
833
- export type ItemInstancesTargetSchema = Item[];
850
+ export type ItemInstancesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
834
851
  /**
835
- * This interface was referenced by `Item`'s JSON-Schema
852
+ * This interface was referenced by `Item<D>`'s JSON-Schema
836
853
  * via the `instances.hrefSchema` link.
837
854
  */
838
855
  export type ItemInstancesHrefSchema = {
@@ -896,12 +913,12 @@ export type ItemInstancesHrefSchema = {
896
913
  [k: string]: unknown;
897
914
  };
898
915
  /**
899
- * This interface was referenced by `Item`'s JSON-Schema
916
+ * This interface was referenced by `Item<D>`'s JSON-Schema
900
917
  * via the `references.targetSchema` link.
901
918
  */
902
- export type ItemReferencesTargetSchema = Item[];
919
+ export type ItemReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
903
920
  /**
904
- * This interface was referenced by `Item`'s JSON-Schema
921
+ * This interface was referenced by `Item<D>`'s JSON-Schema
905
922
  * via the `references.hrefSchema` link.
906
923
  */
907
924
  export type ItemReferencesHrefSchema = {
@@ -916,7 +933,7 @@ export type ItemReferencesHrefSchema = {
916
933
  [k: string]: unknown;
917
934
  };
918
935
  /**
919
- * This interface was referenced by `Item`'s JSON-Schema
936
+ * This interface was referenced by `Item<D>`'s JSON-Schema
920
937
  * via the `self.hrefSchema` link.
921
938
  */
922
939
  export type ItemSelfHrefSchema = {
@@ -991,7 +1008,7 @@ export type ItemVersionType = 'item_version';
991
1008
  */
992
1009
  export type ItemVersionIdentity = string;
993
1010
  /**
994
- * This interface was referenced by `Item`'s JSON-Schema
1011
+ * This interface was referenced by `Item<D>`'s JSON-Schema
995
1012
  * via the `publish.schema` link.
996
1013
  */
997
1014
  export type ItemPublishSchema = {
@@ -1009,7 +1026,7 @@ export type ItemPublishSchema = {
1009
1026
  non_localized_content: boolean;
1010
1027
  } | null;
1011
1028
  /**
1012
- * This interface was referenced by `Item`'s JSON-Schema
1029
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1013
1030
  * via the `publish.hrefSchema` link.
1014
1031
  */
1015
1032
  export type ItemPublishHrefSchema = {
@@ -1020,7 +1037,7 @@ export type ItemPublishHrefSchema = {
1020
1037
  [k: string]: unknown;
1021
1038
  };
1022
1039
  /**
1023
- * This interface was referenced by `Item`'s JSON-Schema
1040
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1024
1041
  * via the `unpublish.schema` link.
1025
1042
  */
1026
1043
  export type ItemUnpublishSchema = {
@@ -1031,7 +1048,7 @@ export type ItemUnpublishSchema = {
1031
1048
  content_in_locales: string[];
1032
1049
  } | null;
1033
1050
  /**
1034
- * This interface was referenced by `Item`'s JSON-Schema
1051
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1035
1052
  * via the `unpublish.hrefSchema` link.
1036
1053
  */
1037
1054
  export type ItemUnpublishHrefSchema = {
@@ -1042,22 +1059,22 @@ export type ItemUnpublishHrefSchema = {
1042
1059
  [k: string]: unknown;
1043
1060
  };
1044
1061
  /**
1045
- * This interface was referenced by `Item`'s JSON-Schema
1062
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1046
1063
  * via the `bulk_publish.jobSchema` link.
1047
1064
  */
1048
1065
  export type ItemBulkPublishJobSchema = unknown[];
1049
1066
  /**
1050
- * This interface was referenced by `Item`'s JSON-Schema
1067
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1051
1068
  * via the `bulk_unpublish.jobSchema` link.
1052
1069
  */
1053
1070
  export type ItemBulkUnpublishJobSchema = unknown[];
1054
1071
  /**
1055
- * This interface was referenced by `Item`'s JSON-Schema
1072
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1056
1073
  * via the `bulk_destroy.jobSchema` link.
1057
1074
  */
1058
1075
  export type ItemBulkDestroyJobSchema = unknown[];
1059
1076
  /**
1060
- * This interface was referenced by `Item`'s JSON-Schema
1077
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1061
1078
  * via the `bulk_move_to_stage.jobSchema` link.
1062
1079
  */
1063
1080
  export type ItemBulkMoveToStageJobSchema = unknown[];
@@ -1065,7 +1082,7 @@ export type ItemBulkMoveToStageJobSchema = unknown[];
1065
1082
  * This interface was referenced by `ItemVersion`'s JSON-Schema
1066
1083
  * via the `restore.jobSchema` link.
1067
1084
  */
1068
- export type ItemVersionRestoreJobSchema = [Item, ItemVersion];
1085
+ export type ItemVersionRestoreJobSchema<D extends ItemDefinition = ItemDefinition> = [Item<D>, ItemVersion];
1069
1086
  /**
1070
1087
  * This interface was referenced by `ItemVersion`'s JSON-Schema
1071
1088
  * via the `instances.targetSchema` link.
@@ -1167,7 +1184,7 @@ export type UploadInstancesHrefSchema = {
1167
1184
  * This interface was referenced by `Upload`'s JSON-Schema
1168
1185
  * via the `references.targetSchema` link.
1169
1186
  */
1170
- export type UploadReferencesTargetSchema = Item[];
1187
+ export type UploadReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
1171
1188
  /**
1172
1189
  * This interface was referenced by `Upload`'s JSON-Schema
1173
1190
  * via the `references.hrefSchema` link.
@@ -4217,22 +4234,22 @@ export type MenuItemUpdateSchema = {
4217
4234
  * This interface was referenced by `Field`'s JSON-Schema
4218
4235
  * via the `duplicate.targetSchema` link.
4219
4236
  *
4220
- * This interface was referenced by `Item`'s JSON-Schema
4237
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4221
4238
  * via the `duplicate.targetSchema` link.
4222
4239
  *
4223
- * This interface was referenced by `Item`'s JSON-Schema
4240
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4224
4241
  * via the `destroy.targetSchema` link.
4225
4242
  *
4226
- * This interface was referenced by `Item`'s JSON-Schema
4243
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4227
4244
  * via the `bulk_publish.targetSchema` link.
4228
4245
  *
4229
- * This interface was referenced by `Item`'s JSON-Schema
4246
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4230
4247
  * via the `bulk_unpublish.targetSchema` link.
4231
4248
  *
4232
- * This interface was referenced by `Item`'s JSON-Schema
4249
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4233
4250
  * via the `bulk_destroy.targetSchema` link.
4234
4251
  *
4235
- * This interface was referenced by `Item`'s JSON-Schema
4252
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4236
4253
  * via the `bulk_move_to_stage.targetSchema` link.
4237
4254
  *
4238
4255
  * This interface was referenced by `ItemVersion`'s JSON-Schema
@@ -4615,7 +4632,7 @@ export type ItemTypeDestroyJobSchema = ItemType;
4615
4632
  /**
4616
4633
  * JSON API data
4617
4634
  *
4618
- * This interface was referenced by `Item`'s JSON-Schema
4635
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4619
4636
  * via the `definition` "data".
4620
4637
  */
4621
4638
  export type ItemData = {
@@ -6906,27 +6923,26 @@ export type BuildEventRelationships = {
6906
6923
  * This interface was referenced by `DatoApi`'s JSON-Schema
6907
6924
  * via the `definition` "item".
6908
6925
  */
6909
- export type Item = {
6926
+ export type RawItem = {
6910
6927
  id: ItemIdentity;
6911
6928
  type: ItemType1;
6912
6929
  item_type: ItemTypeData;
6913
6930
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6914
6931
  meta: ItemMeta;
6915
- [k: string]: unknown;
6916
6932
  };
6917
- export type ItemCreateTargetSchema = Item;
6918
- export type ItemDuplicateJobSchema = Item;
6919
- export type ItemUpdateTargetSchema = Item;
6920
- export type ItemSelfTargetSchema = Item;
6921
- export type ItemDestroyJobSchema = Item;
6922
- export type ItemPublishTargetSchema = Item;
6923
- export type ItemUnpublishTargetSchema = Item;
6924
- export type ScheduledPublicationDestroyTargetSchema = Item;
6925
- export type ScheduledUnpublishingDestroyTargetSchema = Item;
6933
+ export type ItemCreateTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6934
+ export type ItemDuplicateJobSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6935
+ export type ItemUpdateTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6936
+ export type ItemSelfTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6937
+ export type ItemDestroyJobSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6938
+ export type ItemPublishTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6939
+ export type ItemUnpublishTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6940
+ export type ScheduledPublicationDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6941
+ export type ScheduledUnpublishingDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6926
6942
  /**
6927
6943
  * Meta information regarding the record
6928
6944
  *
6929
- * This interface was referenced by `Item`'s JSON-Schema
6945
+ * This interface was referenced by `Item<D>`'s JSON-Schema
6930
6946
  * via the `definition` "meta".
6931
6947
  */
6932
6948
  export type ItemMeta = {
@@ -6986,7 +7002,7 @@ export type ItemMeta = {
6986
7002
  /**
6987
7003
  * The JSON data associated to the record
6988
7004
  *
6989
- * This interface was referenced by `Item`'s JSON-Schema
7005
+ * This interface was referenced by `Item<D>`'s JSON-Schema
6990
7006
  * via the `definition` "attributes".
6991
7007
  */
6992
7008
  export type ItemAttributes = {
@@ -6995,7 +7011,7 @@ export type ItemAttributes = {
6995
7011
  /**
6996
7012
  * JSON API links
6997
7013
  *
6998
- * This interface was referenced by `Item`'s JSON-Schema
7014
+ * This interface was referenced by `Item<D>`'s JSON-Schema
6999
7015
  * via the `definition` "relationships".
7000
7016
  */
7001
7017
  export type ItemRelationships = {
@@ -7003,31 +7019,29 @@ export type ItemRelationships = {
7003
7019
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7004
7020
  };
7005
7021
  /**
7006
- * This interface was referenced by `Item`'s JSON-Schema
7022
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7007
7023
  * via the `validate_existing.schema` link.
7008
7024
  */
7009
- export type ItemValidateExistingSchema = {
7025
+ export type RawItemValidateExistingSchema = {
7010
7026
  id?: ItemIdentity;
7011
7027
  type?: ItemType1;
7012
7028
  item_type: ItemTypeData;
7013
7029
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7014
- [k: string]: unknown;
7015
7030
  };
7016
7031
  /**
7017
- * This interface was referenced by `Item`'s JSON-Schema
7032
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7018
7033
  * via the `validate_new.schema` link.
7019
7034
  */
7020
- export type ItemValidateNewSchema = {
7035
+ export type RawItemValidateNewSchema = {
7021
7036
  type?: ItemType1;
7022
7037
  item_type: ItemTypeData;
7023
7038
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7024
- [k: string]: unknown;
7025
7039
  };
7026
7040
  /**
7027
- * This interface was referenced by `Item`'s JSON-Schema
7041
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7028
7042
  * via the `create.schema` link.
7029
7043
  */
7030
- export type ItemCreateSchema = {
7044
+ export type RawItemCreateSchema = {
7031
7045
  id?: ItemIdentity;
7032
7046
  type?: ItemType1;
7033
7047
  item_type: ItemTypeData;
@@ -7077,13 +7091,12 @@ export type ItemCreateSchema = {
7077
7091
  */
7078
7092
  current_version?: string;
7079
7093
  };
7080
- [k: string]: unknown;
7081
7094
  };
7082
7095
  /**
7083
- * This interface was referenced by `Item`'s JSON-Schema
7096
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7084
7097
  * via the `update.schema` link.
7085
7098
  */
7086
- export type ItemUpdateSchema = {
7099
+ export type RawItemUpdateSchema = {
7087
7100
  id?: ItemIdentity;
7088
7101
  type?: ItemType1;
7089
7102
  item_type?: ItemTypeData;
@@ -7145,12 +7158,11 @@ export type ItemUpdateSchema = {
7145
7158
  */
7146
7159
  has_children?: null | boolean;
7147
7160
  };
7148
- [k: string]: unknown;
7149
7161
  };
7150
7162
  /**
7151
7163
  * Information about the record
7152
7164
  *
7153
- * This interface was referenced by `Item`'s JSON-Schema
7165
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7154
7166
  * via the `current_vs_published_state.targetSchema` link.
7155
7167
  *
7156
7168
  * This interface was referenced by `DatoApi`'s JSON-Schema
@@ -7240,7 +7252,7 @@ export type ItemCurrentVsPublishedStateRelationships = {
7240
7252
  published_version: ItemVersionData | null;
7241
7253
  };
7242
7254
  /**
7243
- * This interface was referenced by `Item`'s JSON-Schema
7255
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7244
7256
  * via the `bulk_publish.schema` link.
7245
7257
  */
7246
7258
  export type ItemBulkPublishSchema = {
@@ -7249,7 +7261,7 @@ export type ItemBulkPublishSchema = {
7249
7261
  minItems?: unknown;
7250
7262
  };
7251
7263
  /**
7252
- * This interface was referenced by `Item`'s JSON-Schema
7264
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7253
7265
  * via the `bulk_unpublish.schema` link.
7254
7266
  */
7255
7267
  export type ItemBulkUnpublishSchema = {
@@ -7258,7 +7270,7 @@ export type ItemBulkUnpublishSchema = {
7258
7270
  minItems?: unknown;
7259
7271
  };
7260
7272
  /**
7261
- * This interface was referenced by `Item`'s JSON-Schema
7273
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7262
7274
  * via the `bulk_destroy.schema` link.
7263
7275
  */
7264
7276
  export type ItemBulkDestroySchema = {
@@ -7267,7 +7279,7 @@ export type ItemBulkDestroySchema = {
7267
7279
  minItems?: unknown;
7268
7280
  };
7269
7281
  /**
7270
- * This interface was referenced by `Item`'s JSON-Schema
7282
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7271
7283
  * via the `bulk_move_to_stage.schema` link.
7272
7284
  */
7273
7285
  export type ItemBulkMoveToStageSchema = {
@@ -62,7 +62,7 @@ export class Client {
62
62
  return this.config.baseUrl || Client.defaultBaseUrl;
63
63
  }
64
64
  request(options) {
65
- return request(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.3', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: Object.assign(Object.assign(Object.assign({}, (this.config.extraHeaders || {})), (this.config.environment
65
+ return request(Object.assign(Object.assign(Object.assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v5.1.5', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: Object.assign(Object.assign(Object.assign({}, (this.config.extraHeaders || {})), (this.config.environment
66
66
  ? { 'X-Environment': this.config.environment }
67
67
  : {})), { 'X-API-Version': '3' }), fetchJobResult: (jobId) => {
68
68
  return this.jobResultsFetcher