@datocms/cma-client 5.1.12 → 5.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,14 @@
1
1
  import type { NewBlockInRequest } from '../fieldTypes';
2
2
  import type * as ApiTypes from '../generated/ApiTypes';
3
- import type { ItemTypeDefinition } from './itemDefinition';
3
+ import type { ItemTypeDefinition, ToItemAttributesInRequest } from './itemDefinition';
4
4
  type NoInfer<T> = [T][T extends any ? 0 : never];
5
- export declare function buildBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(body: ApiTypes.ItemUpdateSchema<NoInfer<D>>): NewBlockInRequest<NoInfer<D>>;
5
+ type UpdateOrCreateBlockRecordSchema<D extends ItemTypeDefinition = ItemTypeDefinition> = {
6
+ id?: ApiTypes.ItemIdentity;
7
+ type?: ApiTypes.ItemType1;
8
+ item_type: ApiTypes.ItemTypeData<D>;
9
+ meta?: ApiTypes.ItemUpdateSchema['meta'];
10
+ creator?: ApiTypes.ItemUpdateSchema['creator'];
11
+ __itemTypeId?: D['itemTypeId'];
12
+ } & ToItemAttributesInRequest<D>;
13
+ export declare function buildBlockRecord<D extends ItemTypeDefinition = ItemTypeDefinition>(body: UpdateOrCreateBlockRecordSchema<NoInfer<D>>): NewBlockInRequest<NoInfer<D>>;
6
14
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"buildBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/buildBlockRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAK9C,MAAM,UAAU,gBAAgB,CAE9B,IAA2C;IAC3C,OAAO,KAAK,CAAC,oBAAoB,CAE9B,IAAI,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,GAAG;QACf,aAAa,EAAE,CAAC,WAAW,CAAC;KAC7B,CAAC,CAAC,IAAI,CAAC;AACV,CAAC"}
1
+ {"version":3,"file":"buildBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/buildBlockRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAmB9C,MAAM,UAAU,gBAAgB,CAG9B,IAAiD;IAEjD,OAAO,KAAK,CAAC,oBAAoB,CAE9B,IAAI,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,GAAG;QACf,aAAa,EAAE,CAAC,WAAW,CAAC;KAC7B,CAAC,CAAC,IAAI,CAAC;AACV,CAAC"}
@@ -21,9 +21,10 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  import { mapBlocksInNonLocalizedFieldValue } from './recursiveBlocks';
22
22
  export function duplicateBlockRecord(existingBlock, schemaRepository) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
- const { type, attributes, relationships } = existingBlock;
24
+ const { __itemTypeId, type, attributes, relationships } = existingBlock;
25
25
  const itemType = yield schemaRepository.getRawItemTypeById(existingBlock.relationships.item_type.data.id);
26
26
  const newBlock = {
27
+ __itemTypeId,
27
28
  type,
28
29
  relationships,
29
30
  attributes,
@@ -1 +1 @@
1
- {"version":3,"file":"duplicateBlockRecord.js","sourceRoot":"","sources":["../../../src/utilities/duplicateBlockRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAKA,OAAO,EAAE,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAKtE,MAAM,UAAgB,oBAAoB,CAGxC,aAAoD,EACpD,gBAAkC;;QAElC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;QAE1D,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,kBAAkB,CACxD,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC9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AAC,EAAE,CAC9C,CAAC;QAEF,MAAM,QAAQ,GAAG;YACf,YAAY;YACZ,IAAI;YACJ,aAAa;YACb,UAAU;SACU,CAAC;QAEvB,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAErE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC3C,MAAM,iCAAiC,CACrC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAC7C,KAAK,CAAC,UAAU,CAAC,UAAU,EAC3B,gBAAgB,EAChB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;oBACd,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;wBAC7B,MAAM,IAAI,KAAK,CACb,6DAA6D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,6BAA6B,KAAK,2BAA2B,CACzI,CAAC;qBACH;oBAED,MAAM,EAAE,EAAE,EAAE,IAAI,KAA+B,KAAK,EAA/B,qBAAqB,UAAK,KAAK,EAA9C,cAAsC,CAAQ,CAAC;oBAErD,OAAO,qBAA0C,CAAC;gBACpD,CAAC,CACF,CAAC;SACL;QAED,OAAO,QAAyC,CAAC;IACnD,CAAC;CAAA"}
@@ -20,7 +20,7 @@ type NonLocalizedFieldAttributesForFieldType<SourceType, FieldType extends Field
20
20
  type LocalizedFieldAttributesForFieldType<SourceType, FieldType extends FieldAttributesStableShell['field_type'], FieldValue, FieldValidators, FieldAppearance> = Omit<SourceType, 'field_type' | 'default_value' | 'validators' | 'appearance' | 'localized'> & {
21
21
  field_type: FieldType;
22
22
  localized: true;
23
- default_value: FieldValue | Record<string, FieldValue>;
23
+ default_value: Record<string, FieldValue>;
24
24
  validators: FieldValidators;
25
25
  appearance: FieldAppearanceConfig<FieldAppearance>;
26
26
  };
@@ -52,7 +52,7 @@ export type UpdatedBlockInRequest<D extends ItemTypeDefinition = ItemTypeDefinit
52
52
  __itemTypeId?: D['itemTypeId'];
53
53
  type: RawApiTypes.ItemType1;
54
54
  id: RawApiTypes.ItemIdentity;
55
- relationships?: RawApiTypes.ItemRelationships<D>;
55
+ relationships: RawApiTypes.ItemRelationships<D>;
56
56
  meta?: RawApiTypes.ItemMeta;
57
57
  attributes: ToItemAttributesInRequest<D>;
58
58
  };
@@ -6876,6 +6876,7 @@ export type ItemValidateExistingSchema<D extends ItemTypeDefinition = ItemTypeDe
6876
6876
  type?: ItemType1;
6877
6877
  item_type: ItemTypeData<D>;
6878
6878
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6879
+ __itemTypeId?: D['itemTypeId'];
6879
6880
  } & ToItemAttributesInRequest<D>;
6880
6881
  /**
6881
6882
  * This interface was referenced by `Item`'s JSON-Schema
@@ -6885,6 +6886,7 @@ export type ItemValidateNewSchema<D extends ItemTypeDefinition = ItemTypeDefinit
6885
6886
  type?: ItemType1;
6886
6887
  item_type: ItemTypeData<D>;
6887
6888
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6889
+ __itemTypeId?: D['itemTypeId'];
6888
6890
  } & ToItemAttributesInRequest<D>;
6889
6891
  /**
6890
6892
  * This interface was referenced by `Item`'s JSON-Schema
@@ -6940,6 +6942,7 @@ export type ItemCreateSchema<D extends ItemTypeDefinition = ItemTypeDefinition>
6940
6942
  */
6941
6943
  current_version?: string;
6942
6944
  };
6945
+ __itemTypeId?: D['itemTypeId'];
6943
6946
  } & ToItemAttributesInRequest<D>;
6944
6947
  /**
6945
6948
  * This interface was referenced by `Item`'s JSON-Schema
@@ -7007,6 +7010,7 @@ export type ItemUpdateSchema<D extends ItemTypeDefinition = ItemTypeDefinition>
7007
7010
  */
7008
7011
  has_children?: null | boolean;
7009
7012
  };
7013
+ __itemTypeId?: D['itemTypeId'];
7010
7014
  } & ToItemAttributesInRequest<D>;
7011
7015
  /**
7012
7016
  * Information about the record
@@ -6744,6 +6744,7 @@ export type ItemValidateExistingSchema<D extends ItemTypeDefinition = ItemTypeDe
6744
6744
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6745
6745
  };
6746
6746
  };
6747
+ __itemTypeId?: D['itemTypeId'];
6747
6748
  };
6748
6749
  };
6749
6750
  /**
@@ -6771,6 +6772,7 @@ export type ItemValidateNewSchema<D extends ItemTypeDefinition = ItemTypeDefinit
6771
6772
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6772
6773
  };
6773
6774
  };
6775
+ __itemTypeId?: D['itemTypeId'];
6774
6776
  };
6775
6777
  };
6776
6778
  /**
@@ -6844,6 +6846,7 @@ export type ItemCreateSchema<D extends ItemTypeDefinition = ItemTypeDefinition>
6844
6846
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6845
6847
  };
6846
6848
  };
6849
+ __itemTypeId?: D['itemTypeId'];
6847
6850
  };
6848
6851
  };
6849
6852
  /**
@@ -6958,6 +6961,7 @@ export type ItemUpdateSchema<D extends ItemTypeDefinition = ItemTypeDefinition>
6958
6961
  data: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
6959
6962
  };
6960
6963
  };
6964
+ __itemTypeId?: D['itemTypeId'];
6961
6965
  };
6962
6966
  };
6963
6967
  /**