@datocms/cma-client 5.1.3 → 5.1.4

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 (84) 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/lat_lon.d.ts +5 -5
  21. package/dist/esm/fieldTypes/lat_lon.js +3 -3
  22. package/dist/esm/fieldTypes/lat_lon.js.map +1 -1
  23. package/dist/esm/fieldTypes/rich_text.d.ts +8 -7
  24. package/dist/esm/fieldTypes/rich_text.js.map +1 -1
  25. package/dist/esm/fieldTypes/single_block.d.ts +15 -14
  26. package/dist/esm/fieldTypes/single_block.js.map +1 -1
  27. package/dist/esm/fieldTypes/structured_text.d.ts +13 -12
  28. package/dist/esm/fieldTypes/structured_text.js.map +1 -1
  29. package/dist/esm/generated/ApiTypes.d.ts +67 -62
  30. package/dist/esm/generated/Client.js +1 -1
  31. package/dist/esm/generated/RawApiTypes.d.ts +116 -121
  32. package/dist/esm/generated/resources/Field.d.ts +230 -230
  33. package/dist/esm/generated/resources/Item.d.ts +42 -24
  34. package/dist/esm/generated/resources/Item.js +41 -23
  35. package/dist/esm/generated/resources/Item.js.map +1 -1
  36. package/dist/esm/generated/resources/ItemVersion.d.ts +1 -1
  37. package/dist/esm/generated/resources/ScheduledPublication.d.ts +5 -2
  38. package/dist/esm/generated/resources/ScheduledPublication.js +4 -2
  39. package/dist/esm/generated/resources/ScheduledPublication.js.map +1 -1
  40. package/dist/esm/generated/resources/ScheduledUnpublishing.d.ts +5 -2
  41. package/dist/esm/generated/resources/ScheduledUnpublishing.js +4 -2
  42. package/dist/esm/generated/resources/ScheduledUnpublishing.js.map +1 -1
  43. package/dist/esm/generated/resources/Upload.d.ts +10 -2
  44. package/dist/esm/generated/resources/Upload.js +4 -2
  45. package/dist/esm/generated/resources/Upload.js.map +1 -1
  46. package/dist/esm/index.d.ts +1 -0
  47. package/dist/esm/index.js +1 -0
  48. package/dist/esm/index.js.map +1 -1
  49. package/dist/esm/utilities/buildBlockRecord.d.ts +5 -31
  50. package/dist/esm/utilities/buildBlockRecord.js.map +1 -1
  51. package/dist/esm/utilities/itemDefinition.d.ts +74 -0
  52. package/dist/esm/utilities/itemDefinition.js +2 -0
  53. package/dist/esm/utilities/itemDefinition.js.map +1 -0
  54. package/dist/types/fieldTypes/lat_lon.d.ts +5 -5
  55. package/dist/types/fieldTypes/rich_text.d.ts +8 -7
  56. package/dist/types/fieldTypes/single_block.d.ts +15 -14
  57. package/dist/types/fieldTypes/structured_text.d.ts +13 -12
  58. package/dist/types/generated/ApiTypes.d.ts +67 -62
  59. package/dist/types/generated/RawApiTypes.d.ts +116 -121
  60. package/dist/types/generated/resources/Field.d.ts +230 -230
  61. package/dist/types/generated/resources/Item.d.ts +42 -24
  62. package/dist/types/generated/resources/ItemVersion.d.ts +1 -1
  63. package/dist/types/generated/resources/ScheduledPublication.d.ts +5 -2
  64. package/dist/types/generated/resources/ScheduledUnpublishing.d.ts +5 -2
  65. package/dist/types/generated/resources/Upload.d.ts +10 -2
  66. package/dist/types/index.d.ts +1 -0
  67. package/dist/types/utilities/buildBlockRecord.d.ts +5 -31
  68. package/dist/types/utilities/itemDefinition.d.ts +74 -0
  69. package/package.json +5 -5
  70. package/resources.json +564 -0
  71. package/src/fieldTypes/lat_lon.ts +7 -9
  72. package/src/fieldTypes/rich_text.ts +22 -13
  73. package/src/fieldTypes/single_block.ts +42 -32
  74. package/src/fieldTypes/structured_text.ts +60 -23
  75. package/src/generated/ApiTypes.ts +110 -70
  76. package/src/generated/Client.ts +1 -1
  77. package/src/generated/RawApiTypes.ts +160 -138
  78. package/src/generated/resources/Item.ts +360 -108
  79. package/src/generated/resources/ScheduledPublication.ts +31 -11
  80. package/src/generated/resources/ScheduledUnpublishing.ts +31 -11
  81. package/src/generated/resources/Upload.ts +54 -12
  82. package/src/index.ts +1 -0
  83. package/src/utilities/buildBlockRecord.ts +19 -3
  84. 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,KAAc;IAEd,OAAO,CACL,2BAA2B,CAAC,KAAK,CAAC;QAClC,IAAI,IAAI,KAAK;QACb,OAAO,KAAK,CAAC,EAAE,KAA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K,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,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAA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,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,17 @@ 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
+ export type ApplyItemDefinitionToSchema<Schema, D extends ItemDefinition = ItemDefinition> = D extends any ? Schema & D['fields'] & {
64
+ /** Useful for type narrowing */
65
+ __itemTypeId?: D['itemTypeId'];
66
+ } : never;
67
+ export type Item<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItem, D>;
68
+ export type ItemValidateExistingSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemValidateExistingSchema, D>;
69
+ export type ItemValidateNewSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemValidateNewSchema, D>;
70
+ export type ItemCreateSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemCreateSchema, D>;
71
+ export type ItemUpdateSchema<D extends ItemDefinition = ItemDefinition> = ApplyItemDefinitionToSchema<RawItemUpdateSchema, D>;
62
72
  /**
63
73
  * This file was automatically generated by hyperschema-to-ts: DO NOT MODIFY IT BY HAND.
64
74
  */
@@ -529,17 +539,17 @@ export type UploadCollectionReorderSchema = {
529
539
  */
530
540
  export type UploadCollectionReorderJobSchema = UploadCollection[];
531
541
  /**
532
- * This interface was referenced by `Item`'s JSON-Schema
542
+ * This interface was referenced by `Item<D>`'s JSON-Schema
533
543
  * via the `definition` "type".
534
544
  */
535
545
  export type ItemType1 = 'item';
536
546
  /**
537
547
  * RFC 4122 UUID of record expressed in URL-safe base64 format
538
548
  *
539
- * This interface was referenced by `Item`'s JSON-Schema
549
+ * This interface was referenced by `Item<D>`'s JSON-Schema
540
550
  * via the `definition` "identity".
541
551
  *
542
- * This interface was referenced by `Item`'s JSON-Schema
552
+ * This interface was referenced by `Item<D>`'s JSON-Schema
543
553
  * via the `definition` "id".
544
554
  */
545
555
  export type ItemIdentity = string;
@@ -827,12 +837,12 @@ export type BuildEventInstancesHrefSchema = {
827
837
  [k: string]: unknown;
828
838
  };
829
839
  /**
830
- * This interface was referenced by `Item`'s JSON-Schema
840
+ * This interface was referenced by `Item<D>`'s JSON-Schema
831
841
  * via the `instances.targetSchema` link.
832
842
  */
833
- export type ItemInstancesTargetSchema = Item[];
843
+ export type ItemInstancesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
834
844
  /**
835
- * This interface was referenced by `Item`'s JSON-Schema
845
+ * This interface was referenced by `Item<D>`'s JSON-Schema
836
846
  * via the `instances.hrefSchema` link.
837
847
  */
838
848
  export type ItemInstancesHrefSchema = {
@@ -896,12 +906,12 @@ export type ItemInstancesHrefSchema = {
896
906
  [k: string]: unknown;
897
907
  };
898
908
  /**
899
- * This interface was referenced by `Item`'s JSON-Schema
909
+ * This interface was referenced by `Item<D>`'s JSON-Schema
900
910
  * via the `references.targetSchema` link.
901
911
  */
902
- export type ItemReferencesTargetSchema = Item[];
912
+ export type ItemReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
903
913
  /**
904
- * This interface was referenced by `Item`'s JSON-Schema
914
+ * This interface was referenced by `Item<D>`'s JSON-Schema
905
915
  * via the `references.hrefSchema` link.
906
916
  */
907
917
  export type ItemReferencesHrefSchema = {
@@ -916,7 +926,7 @@ export type ItemReferencesHrefSchema = {
916
926
  [k: string]: unknown;
917
927
  };
918
928
  /**
919
- * This interface was referenced by `Item`'s JSON-Schema
929
+ * This interface was referenced by `Item<D>`'s JSON-Schema
920
930
  * via the `self.hrefSchema` link.
921
931
  */
922
932
  export type ItemSelfHrefSchema = {
@@ -991,7 +1001,7 @@ export type ItemVersionType = 'item_version';
991
1001
  */
992
1002
  export type ItemVersionIdentity = string;
993
1003
  /**
994
- * This interface was referenced by `Item`'s JSON-Schema
1004
+ * This interface was referenced by `Item<D>`'s JSON-Schema
995
1005
  * via the `publish.schema` link.
996
1006
  */
997
1007
  export type ItemPublishSchema = {
@@ -1009,7 +1019,7 @@ export type ItemPublishSchema = {
1009
1019
  non_localized_content: boolean;
1010
1020
  } | null;
1011
1021
  /**
1012
- * This interface was referenced by `Item`'s JSON-Schema
1022
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1013
1023
  * via the `publish.hrefSchema` link.
1014
1024
  */
1015
1025
  export type ItemPublishHrefSchema = {
@@ -1020,7 +1030,7 @@ export type ItemPublishHrefSchema = {
1020
1030
  [k: string]: unknown;
1021
1031
  };
1022
1032
  /**
1023
- * This interface was referenced by `Item`'s JSON-Schema
1033
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1024
1034
  * via the `unpublish.schema` link.
1025
1035
  */
1026
1036
  export type ItemUnpublishSchema = {
@@ -1031,7 +1041,7 @@ export type ItemUnpublishSchema = {
1031
1041
  content_in_locales: string[];
1032
1042
  } | null;
1033
1043
  /**
1034
- * This interface was referenced by `Item`'s JSON-Schema
1044
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1035
1045
  * via the `unpublish.hrefSchema` link.
1036
1046
  */
1037
1047
  export type ItemUnpublishHrefSchema = {
@@ -1042,22 +1052,22 @@ export type ItemUnpublishHrefSchema = {
1042
1052
  [k: string]: unknown;
1043
1053
  };
1044
1054
  /**
1045
- * This interface was referenced by `Item`'s JSON-Schema
1055
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1046
1056
  * via the `bulk_publish.jobSchema` link.
1047
1057
  */
1048
1058
  export type ItemBulkPublishJobSchema = unknown[];
1049
1059
  /**
1050
- * This interface was referenced by `Item`'s JSON-Schema
1060
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1051
1061
  * via the `bulk_unpublish.jobSchema` link.
1052
1062
  */
1053
1063
  export type ItemBulkUnpublishJobSchema = unknown[];
1054
1064
  /**
1055
- * This interface was referenced by `Item`'s JSON-Schema
1065
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1056
1066
  * via the `bulk_destroy.jobSchema` link.
1057
1067
  */
1058
1068
  export type ItemBulkDestroyJobSchema = unknown[];
1059
1069
  /**
1060
- * This interface was referenced by `Item`'s JSON-Schema
1070
+ * This interface was referenced by `Item<D>`'s JSON-Schema
1061
1071
  * via the `bulk_move_to_stage.jobSchema` link.
1062
1072
  */
1063
1073
  export type ItemBulkMoveToStageJobSchema = unknown[];
@@ -1065,7 +1075,7 @@ export type ItemBulkMoveToStageJobSchema = unknown[];
1065
1075
  * This interface was referenced by `ItemVersion`'s JSON-Schema
1066
1076
  * via the `restore.jobSchema` link.
1067
1077
  */
1068
- export type ItemVersionRestoreJobSchema = [Item, ItemVersion];
1078
+ export type ItemVersionRestoreJobSchema<D extends ItemDefinition = ItemDefinition> = [Item<D>, ItemVersion];
1069
1079
  /**
1070
1080
  * This interface was referenced by `ItemVersion`'s JSON-Schema
1071
1081
  * via the `instances.targetSchema` link.
@@ -1167,7 +1177,7 @@ export type UploadInstancesHrefSchema = {
1167
1177
  * This interface was referenced by `Upload`'s JSON-Schema
1168
1178
  * via the `references.targetSchema` link.
1169
1179
  */
1170
- export type UploadReferencesTargetSchema = Item[];
1180
+ export type UploadReferencesTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>[];
1171
1181
  /**
1172
1182
  * This interface was referenced by `Upload`'s JSON-Schema
1173
1183
  * via the `references.hrefSchema` link.
@@ -4217,22 +4227,22 @@ export type MenuItemUpdateSchema = {
4217
4227
  * This interface was referenced by `Field`'s JSON-Schema
4218
4228
  * via the `duplicate.targetSchema` link.
4219
4229
  *
4220
- * This interface was referenced by `Item`'s JSON-Schema
4230
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4221
4231
  * via the `duplicate.targetSchema` link.
4222
4232
  *
4223
- * This interface was referenced by `Item`'s JSON-Schema
4233
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4224
4234
  * via the `destroy.targetSchema` link.
4225
4235
  *
4226
- * This interface was referenced by `Item`'s JSON-Schema
4236
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4227
4237
  * via the `bulk_publish.targetSchema` link.
4228
4238
  *
4229
- * This interface was referenced by `Item`'s JSON-Schema
4239
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4230
4240
  * via the `bulk_unpublish.targetSchema` link.
4231
4241
  *
4232
- * This interface was referenced by `Item`'s JSON-Schema
4242
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4233
4243
  * via the `bulk_destroy.targetSchema` link.
4234
4244
  *
4235
- * This interface was referenced by `Item`'s JSON-Schema
4245
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4236
4246
  * via the `bulk_move_to_stage.targetSchema` link.
4237
4247
  *
4238
4248
  * This interface was referenced by `ItemVersion`'s JSON-Schema
@@ -4615,7 +4625,7 @@ export type ItemTypeDestroyJobSchema = ItemType;
4615
4625
  /**
4616
4626
  * JSON API data
4617
4627
  *
4618
- * This interface was referenced by `Item`'s JSON-Schema
4628
+ * This interface was referenced by `Item<D>`'s JSON-Schema
4619
4629
  * via the `definition` "data".
4620
4630
  */
4621
4631
  export type ItemData = {
@@ -6906,27 +6916,26 @@ export type BuildEventRelationships = {
6906
6916
  * This interface was referenced by `DatoApi`'s JSON-Schema
6907
6917
  * via the `definition` "item".
6908
6918
  */
6909
- export type Item = {
6919
+ export type RawItem = {
6910
6920
  id: ItemIdentity;
6911
6921
  type: ItemType1;
6912
6922
  item_type: ItemTypeData;
6913
6923
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6914
6924
  meta: ItemMeta;
6915
- [k: string]: unknown;
6916
6925
  };
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;
6926
+ export type ItemCreateTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6927
+ export type ItemDuplicateJobSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6928
+ export type ItemUpdateTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6929
+ export type ItemSelfTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6930
+ export type ItemDestroyJobSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6931
+ export type ItemPublishTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6932
+ export type ItemUnpublishTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6933
+ export type ScheduledPublicationDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6934
+ export type ScheduledUnpublishingDestroyTargetSchema<D extends ItemDefinition = ItemDefinition> = Item<D>;
6926
6935
  /**
6927
6936
  * Meta information regarding the record
6928
6937
  *
6929
- * This interface was referenced by `Item`'s JSON-Schema
6938
+ * This interface was referenced by `Item<D>`'s JSON-Schema
6930
6939
  * via the `definition` "meta".
6931
6940
  */
6932
6941
  export type ItemMeta = {
@@ -6986,7 +6995,7 @@ export type ItemMeta = {
6986
6995
  /**
6987
6996
  * The JSON data associated to the record
6988
6997
  *
6989
- * This interface was referenced by `Item`'s JSON-Schema
6998
+ * This interface was referenced by `Item<D>`'s JSON-Schema
6990
6999
  * via the `definition` "attributes".
6991
7000
  */
6992
7001
  export type ItemAttributes = {
@@ -6995,7 +7004,7 @@ export type ItemAttributes = {
6995
7004
  /**
6996
7005
  * JSON API links
6997
7006
  *
6998
- * This interface was referenced by `Item`'s JSON-Schema
7007
+ * This interface was referenced by `Item<D>`'s JSON-Schema
6999
7008
  * via the `definition` "relationships".
7000
7009
  */
7001
7010
  export type ItemRelationships = {
@@ -7003,31 +7012,29 @@ export type ItemRelationships = {
7003
7012
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7004
7013
  };
7005
7014
  /**
7006
- * This interface was referenced by `Item`'s JSON-Schema
7015
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7007
7016
  * via the `validate_existing.schema` link.
7008
7017
  */
7009
- export type ItemValidateExistingSchema = {
7018
+ export type RawItemValidateExistingSchema = {
7010
7019
  id?: ItemIdentity;
7011
7020
  type?: ItemType1;
7012
7021
  item_type: ItemTypeData;
7013
7022
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7014
- [k: string]: unknown;
7015
7023
  };
7016
7024
  /**
7017
- * This interface was referenced by `Item`'s JSON-Schema
7025
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7018
7026
  * via the `validate_new.schema` link.
7019
7027
  */
7020
- export type ItemValidateNewSchema = {
7028
+ export type RawItemValidateNewSchema = {
7021
7029
  type?: ItemType1;
7022
7030
  item_type: ItemTypeData;
7023
7031
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
7024
- [k: string]: unknown;
7025
7032
  };
7026
7033
  /**
7027
- * This interface was referenced by `Item`'s JSON-Schema
7034
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7028
7035
  * via the `create.schema` link.
7029
7036
  */
7030
- export type ItemCreateSchema = {
7037
+ export type RawItemCreateSchema = {
7031
7038
  id?: ItemIdentity;
7032
7039
  type?: ItemType1;
7033
7040
  item_type: ItemTypeData;
@@ -7077,13 +7084,12 @@ export type ItemCreateSchema = {
7077
7084
  */
7078
7085
  current_version?: string;
7079
7086
  };
7080
- [k: string]: unknown;
7081
7087
  };
7082
7088
  /**
7083
- * This interface was referenced by `Item`'s JSON-Schema
7089
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7084
7090
  * via the `update.schema` link.
7085
7091
  */
7086
- export type ItemUpdateSchema = {
7092
+ export type RawItemUpdateSchema = {
7087
7093
  id?: ItemIdentity;
7088
7094
  type?: ItemType1;
7089
7095
  item_type?: ItemTypeData;
@@ -7145,12 +7151,11 @@ export type ItemUpdateSchema = {
7145
7151
  */
7146
7152
  has_children?: null | boolean;
7147
7153
  };
7148
- [k: string]: unknown;
7149
7154
  };
7150
7155
  /**
7151
7156
  * Information about the record
7152
7157
  *
7153
- * This interface was referenced by `Item`'s JSON-Schema
7158
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7154
7159
  * via the `current_vs_published_state.targetSchema` link.
7155
7160
  *
7156
7161
  * This interface was referenced by `DatoApi`'s JSON-Schema
@@ -7240,7 +7245,7 @@ export type ItemCurrentVsPublishedStateRelationships = {
7240
7245
  published_version: ItemVersionData | null;
7241
7246
  };
7242
7247
  /**
7243
- * This interface was referenced by `Item`'s JSON-Schema
7248
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7244
7249
  * via the `bulk_publish.schema` link.
7245
7250
  */
7246
7251
  export type ItemBulkPublishSchema = {
@@ -7249,7 +7254,7 @@ export type ItemBulkPublishSchema = {
7249
7254
  minItems?: unknown;
7250
7255
  };
7251
7256
  /**
7252
- * This interface was referenced by `Item`'s JSON-Schema
7257
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7253
7258
  * via the `bulk_unpublish.schema` link.
7254
7259
  */
7255
7260
  export type ItemBulkUnpublishSchema = {
@@ -7258,7 +7263,7 @@ export type ItemBulkUnpublishSchema = {
7258
7263
  minItems?: unknown;
7259
7264
  };
7260
7265
  /**
7261
- * This interface was referenced by `Item`'s JSON-Schema
7266
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7262
7267
  * via the `bulk_destroy.schema` link.
7263
7268
  */
7264
7269
  export type ItemBulkDestroySchema = {
@@ -7267,7 +7272,7 @@ export type ItemBulkDestroySchema = {
7267
7272
  minItems?: unknown;
7268
7273
  };
7269
7274
  /**
7270
- * This interface was referenced by `Item`'s JSON-Schema
7275
+ * This interface was referenced by `Item<D>`'s JSON-Schema
7271
7276
  * via the `bulk_move_to_stage.schema` link.
7272
7277
  */
7273
7278
  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.4', 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