@datocms/cma-client 5.5.0-alpha.0 → 5.5.0-alpha.1

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 (37) hide show
  1. package/dist/cjs/generated/Client.js +1 -1
  2. package/dist/cjs/generated/resources/Session.js +29 -0
  3. package/dist/cjs/generated/resources/Session.js.map +1 -1
  4. package/dist/cjs/generated/resources/index.js +1 -1
  5. package/dist/cjs/generated/resources/index.js.map +1 -1
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/esm/generated/ApiTypes.d.ts +120 -96
  8. package/dist/esm/generated/Client.js +1 -1
  9. package/dist/esm/generated/RawApiTypes.d.ts +92 -82
  10. package/dist/esm/generated/resources/Session.d.ts +22 -0
  11. package/dist/esm/generated/resources/Session.js +29 -0
  12. package/dist/esm/generated/resources/Session.js.map +1 -1
  13. package/dist/esm/generated/resources/index.d.ts +1 -1
  14. package/dist/esm/generated/resources/index.js +1 -1
  15. package/dist/esm/generated/resources/index.js.map +1 -1
  16. package/dist/esm/index.d.ts +0 -1
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/types/generated/ApiTypes.d.ts +120 -96
  19. package/dist/types/generated/RawApiTypes.d.ts +92 -82
  20. package/dist/types/generated/resources/Session.d.ts +22 -0
  21. package/dist/types/generated/resources/index.d.ts +1 -1
  22. package/dist/types/index.d.ts +0 -1
  23. package/package.json +3 -3
  24. package/resources.json +16 -0
  25. package/src/generated/ApiTypes.ts +120 -96
  26. package/src/generated/Client.ts +1 -1
  27. package/src/generated/RawApiTypes.ts +92 -82
  28. package/src/generated/resources/Session.ts +31 -0
  29. package/src/generated/resources/index.ts +1 -1
  30. package/src/index.ts +0 -4
  31. package/dist/cjs/resources/Upload.js +0 -10
  32. package/dist/cjs/resources/Upload.js.map +0 -1
  33. package/dist/esm/resources/Upload.d.ts +0 -44
  34. package/dist/esm/resources/Upload.js +0 -4
  35. package/dist/esm/resources/Upload.js.map +0 -1
  36. package/dist/types/resources/Upload.d.ts +0 -44
  37. package/src/resources/Upload.ts +0 -36
@@ -8277,6 +8277,14 @@ export type ItemVersionMeta = {
8277
8277
  * Whether the record version is the published version or not
8278
8278
  */
8279
8279
  is_published: boolean;
8280
+ /**
8281
+ * Date this version became the published version of the record, or `null` if it has never been published. May also be `null` for versions that were published before publication-history tracking was introduced; in that case, fall back to `is_published` to determine the live status.
8282
+ */
8283
+ published_from: string | null;
8284
+ /**
8285
+ * Date this version stopped being the published version of the record (either replaced by a newer published version, or explicitly unpublished). `null` when the version is currently published or has never been published.
8286
+ */
8287
+ published_until: string | null;
8280
8288
  /**
8281
8289
  * Whether the record version is the most recent version or not
8282
8290
  */
@@ -8616,28 +8624,42 @@ export type UploadAttributes = {
8616
8624
  */
8617
8625
  mux_mp4_highest_res: null | 'high' | 'medium' | 'low';
8618
8626
  /**
8619
- * Per-asset default metadata applied when no record-level overrides are present. `alt`, `title`, and `custom_data` are objects keyed by locale; `focal_point` is non-localized a single value per asset, applied across every locale (only meaningful for image assets).
8620
- *
8621
- * > [!PROTIP] 📘 Requires the `non_localized_focal_points` environment opt-in
8622
- * > This shape is returned and accepted in environments where the opt-in is active. The opt-in is the path forward and will become the default for all projects. Environments where it is still inactive use a legacy locale-keyed shape under the hood (kept working for compatibility) — opt in to align with this documentation.
8627
+ * For each of the project's locales, the default metadata to apply if nothing is specified at record's level.
8623
8628
  */
8624
8629
  default_field_metadata: {
8625
- alt: LocalizedAlt;
8626
- title: LocalizedTitle;
8627
- custom_data: LocalizedCustomData;
8628
8630
  /**
8629
- * Focal point non-localized; a single value applies across every locale (only meaningful for image assets)
8631
+ * This interface was referenced by `undefined`'s JSON-Schema definition
8632
+ * via the `patternProperty` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
8630
8633
  */
8631
- focal_point: {
8634
+ [k: string]: {
8635
+ /**
8636
+ * Alternate text for the asset
8637
+ */
8638
+ alt: string | null;
8639
+ /**
8640
+ * Title for the asset
8641
+ */
8642
+ title: string | null;
8632
8643
  /**
8633
- * Horizontal position expressed as float between 0 and 1
8644
+ * Object with arbitrary metadata
8634
8645
  */
8635
- x: number;
8646
+ custom_data: {
8647
+ [k: string]: unknown;
8648
+ };
8636
8649
  /**
8637
- * Vertical position expressed as float between 0 and 1
8650
+ * Focal point (only for image assets)
8638
8651
  */
8639
- y: number;
8640
- } | null;
8652
+ focal_point: {
8653
+ /**
8654
+ * Horizontal position expressed as float between 0 and 1
8655
+ */
8656
+ x: number;
8657
+ /**
8658
+ * Vertical position expressed as float between 0 and 1
8659
+ */
8660
+ y: number;
8661
+ } | null;
8662
+ };
8641
8663
  };
8642
8664
  /**
8643
8665
  * Is this upload an image?
@@ -8691,44 +8713,6 @@ export type UploadAttributes = {
8691
8713
  alpha: number;
8692
8714
  }[];
8693
8715
  };
8694
- /**
8695
- * Alternate text per locale
8696
- */
8697
- export type LocalizedAlt = {
8698
- /**
8699
- * Alternate text for the asset in this locale
8700
- *
8701
- * This interface was referenced by `LocalizedAlt`'s JSON-Schema definition
8702
- * via the `patternProperty` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
8703
- */
8704
- [k: string]: string | null;
8705
- };
8706
- /**
8707
- * Title per locale
8708
- */
8709
- export type LocalizedTitle = {
8710
- /**
8711
- * Title for the asset in this locale
8712
- *
8713
- * This interface was referenced by `LocalizedTitle`'s JSON-Schema definition
8714
- * via the `patternProperty` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
8715
- */
8716
- [k: string]: string | null;
8717
- };
8718
- /**
8719
- * Object with arbitrary metadata, per locale
8720
- */
8721
- export type LocalizedCustomData = {
8722
- /**
8723
- * Arbitrary metadata for the asset in this locale
8724
- *
8725
- * This interface was referenced by `LocalizedCustomData`'s JSON-Schema definition
8726
- * via the `patternProperty` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
8727
- */
8728
- [k: string]: {
8729
- [k: string]: unknown;
8730
- };
8731
- };
8732
8716
  /**
8733
8717
  * JSON API links
8734
8718
  *
@@ -8815,25 +8799,42 @@ export type UploadCreateSchema = {
8815
8799
  */
8816
8800
  notes?: string | null;
8817
8801
  /**
8818
- * Patch the asset's default metadata. Send any subset of `alt`/`title`/`custom_data`/`focal_point` missing keys preserve their stored values. See the response shape for the full structure and per-key semantics.
8802
+ * For each of the project's locales, the default metadata to apply if nothing is specified at record's level.
8819
8803
  */
8820
8804
  default_field_metadata?: {
8821
- alt?: LocalizedAlt;
8822
- title?: LocalizedTitle;
8823
- custom_data?: LocalizedCustomData;
8824
8805
  /**
8825
- * Focal point non-localized; a single value applies across every locale (only meaningful for image assets)
8806
+ * This interface was referenced by `undefined`'s JSON-Schema definition
8807
+ * via the `patternProperty` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
8826
8808
  */
8827
- focal_point?: {
8809
+ [k: string]: {
8810
+ /**
8811
+ * Alternate text for the asset
8812
+ */
8813
+ alt?: string | null;
8814
+ /**
8815
+ * Title for the asset
8816
+ */
8817
+ title?: string | null;
8828
8818
  /**
8829
- * Horizontal position expressed as float between 0 and 1
8819
+ * Object with arbitrary metadata
8830
8820
  */
8831
- x: number;
8821
+ custom_data?: {
8822
+ [k: string]: unknown;
8823
+ };
8832
8824
  /**
8833
- * Vertical position expressed as float between 0 and 1
8825
+ * Focal point (only for image assets)
8834
8826
  */
8835
- y: number;
8836
- } | null;
8827
+ focal_point?: {
8828
+ /**
8829
+ * Horizontal position expressed as float between 0 and 1
8830
+ */
8831
+ x: number;
8832
+ /**
8833
+ * Vertical position expressed as float between 0 and 1
8834
+ */
8835
+ y: number;
8836
+ } | null;
8837
+ };
8837
8838
  };
8838
8839
  /**
8839
8840
  * Tags
@@ -8923,25 +8924,42 @@ export type UploadUpdateSchema = {
8923
8924
  */
8924
8925
  tags?: string[];
8925
8926
  /**
8926
- * Patch the asset's default metadata. Send any subset of `alt`/`title`/`custom_data`/`focal_point` missing keys preserve their stored values. See the response shape for the full structure and per-key semantics.
8927
+ * For each of the project's locales, the default metadata to apply if nothing is specified at record's level.
8927
8928
  */
8928
8929
  default_field_metadata?: {
8929
- alt?: LocalizedAlt;
8930
- title?: LocalizedTitle;
8931
- custom_data?: LocalizedCustomData;
8932
8930
  /**
8933
- * Focal point non-localized; a single value applies across every locale (only meaningful for image assets)
8931
+ * This interface was referenced by `undefined`'s JSON-Schema definition
8932
+ * via the `patternProperty` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
8934
8933
  */
8935
- focal_point?: {
8934
+ [k: string]: {
8936
8935
  /**
8937
- * Horizontal position expressed as float between 0 and 1
8936
+ * Alternate text for the asset
8938
8937
  */
8939
- x: number;
8938
+ alt?: string | null;
8940
8939
  /**
8941
- * Vertical position expressed as float between 0 and 1
8940
+ * Title for the asset
8942
8941
  */
8943
- y: number;
8944
- } | null;
8942
+ title?: string | null;
8943
+ /**
8944
+ * Object with arbitrary metadata
8945
+ */
8946
+ custom_data?: {
8947
+ [k: string]: unknown;
8948
+ };
8949
+ /**
8950
+ * Focal point (only for image assets)
8951
+ */
8952
+ focal_point?: {
8953
+ /**
8954
+ * Horizontal position expressed as float between 0 and 1
8955
+ */
8956
+ x: number;
8957
+ /**
8958
+ * Vertical position expressed as float between 0 and 1
8959
+ */
8960
+ y: number;
8961
+ } | null;
8962
+ };
8945
8963
  };
8946
8964
  [k: string]: unknown;
8947
8965
  };
@@ -12088,10 +12106,6 @@ export type SiteMeta = {
12088
12106
  * Whether the [Milliseconds in datetime](https://www.datocms.com/product-updates/milliseconds-in-datetime) opt-in product update is active or not
12089
12107
  */
12090
12108
  milliseconds_in_datetime: boolean;
12091
- /**
12092
- * Whether the non-localized focal points opt-in is active for the environment. When active, an upload's `focal_point` is stored once per asset rather than once per locale, and the CMA `default_field_metadata` attribute is exposed in its field-keyed shape (with `alt`/`title`/`custom_data` keyed by locale and a single top-level `focal_point`). When inactive, the CMA continues to accept and return the legacy locale-keyed shape — the single stored focal_point is replicated into every locale entry on read. The CDA's behavior is unaffected: it already returns a single `focalPoint` value.
12093
- */
12094
- non_localized_focal_points: boolean;
12095
12109
  };
12096
12110
  /**
12097
12111
  * JSON API data
@@ -12284,10 +12298,6 @@ export type SiteUpdateSchema = {
12284
12298
  * Whether the [Milliseconds in datetime](https://www.datocms.com/product-updates/milliseconds-in-datetime) opt-in product update is active or not
12285
12299
  */
12286
12300
  milliseconds_in_datetime?: boolean;
12287
- /**
12288
- * Whether the non-localized focal points opt-in is active for the environment. When active, an upload's `focal_point` is stored once per asset rather than once per locale, and the CMA `default_field_metadata` attribute is exposed in its field-keyed shape (with `alt`/`title`/`custom_data` keyed by locale and a single top-level `focal_point`). When inactive, the CMA continues to accept and return the legacy locale-keyed shape — the single stored focal_point is replicated into every locale entry on read. The CDA's behavior is unaffected: it already returns a single `focalPoint` value.
12289
- */
12290
- non_localized_focal_points?: boolean;
12291
12301
  };
12292
12302
  relationships?: {
12293
12303
  sso_default_role?: {
@@ -47,4 +47,35 @@ export default class Session extends BaseResource {
47
47
  body,
48
48
  });
49
49
  }
50
+
51
+ /**
52
+ * Destroy the current session
53
+ *
54
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/session/destroy
55
+ *
56
+ * @throws {ApiError}
57
+ * @throws {TimeoutError}
58
+ *
59
+ * @deprecated This API call is to be considered private and might change without notice
60
+ */
61
+ destroy() {
62
+ return this.rawDestroy();
63
+ }
64
+
65
+ /**
66
+ * Destroy the current session
67
+ *
68
+ * Read more: https://www.datocms.com/docs/content-management-api/resources/session/destroy
69
+ *
70
+ * @throws {ApiError}
71
+ * @throws {TimeoutError}
72
+ *
73
+ * @deprecated This API call is to be considered private and might change without notice
74
+ */
75
+ rawDestroy(): Promise<void> {
76
+ return this.client.request<void>({
77
+ method: 'DELETE',
78
+ url: '/session',
79
+ });
80
+ }
50
81
  }
@@ -18,7 +18,7 @@ export { default as BuildEvent } from './BuildEvent.js';
18
18
  export { default as SearchIndexEvent } from './SearchIndexEvent.js';
19
19
  export { default as Item } from './Item.js';
20
20
  export { default as ItemVersion } from './ItemVersion.js';
21
- export { default as Upload } from '../../resources/Upload.js';
21
+ export { default as Upload } from './Upload.js';
22
22
  export { default as UploadRequest } from './UploadRequest.js';
23
23
  export { default as UploadTrack } from './UploadTrack.js';
24
24
  export { default as ScheduledPublication } from './ScheduledPublication.js';
package/src/index.ts CHANGED
@@ -4,10 +4,6 @@ export * from './fieldTypes/index.js';
4
4
  export { Client } from './generated/Client.js';
5
5
  export type { ClientConfigOptions } from './generated/Client.js';
6
6
  export * as Resources from './generated/resources/index.js';
7
- export type {
8
- UploadLocaleKeyedDefaultFieldMetadata,
9
- UploadLocaleKeyedDefaultFieldMetadataInRequest,
10
- } from './resources/Upload.js';
11
7
  export * from './utilities/buildBlockRecord.js';
12
8
  export * from './utilities/duplicateBlockRecord.js';
13
9
  export * from './utilities/fieldsContainingReferences.js';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Upload_js_1 = __importDefault(require("../generated/resources/Upload.js"));
7
- class UploadResource extends Upload_js_1.default {
8
- }
9
- exports.default = UploadResource;
10
- //# sourceMappingURL=Upload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Upload.js","sourceRoot":"","sources":["../../../src/resources/Upload.ts"],"names":[],"mappings":";;;;;AAAA,iFAA0D;AAmC1D,MAAqB,cAAe,SAAQ,mBAAU;CAAG;AAAzD,iCAAyD"}
@@ -1,44 +0,0 @@
1
- import BaseUpload from '../generated/resources/Upload.js';
2
- /**
3
- * Legacy locale-keyed shape of an upload's `default_field_metadata`, as
4
- * returned and accepted by environments where the `non_localized_focal_points`
5
- * opt-in is inactive.
6
- *
7
- * The generated `Upload.default_field_metadata` type reflects the new
8
- * field-keyed shape (the path forward). This type is provided so consumers
9
- * targeting opted-out environments during the transition can cast the
10
- * response value to a structurally accurate shape.
11
- */
12
- export type UploadLocaleKeyedDefaultFieldMetadata = {
13
- [localeCode: string]: {
14
- alt: string | null;
15
- title: string | null;
16
- custom_data: {
17
- [k: string]: unknown;
18
- };
19
- focal_point: {
20
- x: number;
21
- y: number;
22
- } | null;
23
- };
24
- };
25
- /**
26
- * Legacy locale-keyed shape accepted on `create` / `update` request bodies
27
- * by environments where the `non_localized_focal_points` opt-in is inactive.
28
- * All fields are optional, matching the partial-write contract.
29
- */
30
- export type UploadLocaleKeyedDefaultFieldMetadataInRequest = {
31
- [localeCode: string]: {
32
- alt?: string | null;
33
- title?: string | null;
34
- custom_data?: {
35
- [k: string]: unknown;
36
- };
37
- focal_point?: {
38
- x: number;
39
- y: number;
40
- } | null;
41
- };
42
- };
43
- export default class UploadResource extends BaseUpload {
44
- }
@@ -1,4 +0,0 @@
1
- import BaseUpload from '../generated/resources/Upload.js';
2
- export default class UploadResource extends BaseUpload {
3
- }
4
- //# sourceMappingURL=Upload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Upload.js","sourceRoot":"","sources":["../../../src/resources/Upload.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kCAAkC,CAAC;AAmC1D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU;CAAG"}
@@ -1,44 +0,0 @@
1
- import BaseUpload from '../generated/resources/Upload.js';
2
- /**
3
- * Legacy locale-keyed shape of an upload's `default_field_metadata`, as
4
- * returned and accepted by environments where the `non_localized_focal_points`
5
- * opt-in is inactive.
6
- *
7
- * The generated `Upload.default_field_metadata` type reflects the new
8
- * field-keyed shape (the path forward). This type is provided so consumers
9
- * targeting opted-out environments during the transition can cast the
10
- * response value to a structurally accurate shape.
11
- */
12
- export type UploadLocaleKeyedDefaultFieldMetadata = {
13
- [localeCode: string]: {
14
- alt: string | null;
15
- title: string | null;
16
- custom_data: {
17
- [k: string]: unknown;
18
- };
19
- focal_point: {
20
- x: number;
21
- y: number;
22
- } | null;
23
- };
24
- };
25
- /**
26
- * Legacy locale-keyed shape accepted on `create` / `update` request bodies
27
- * by environments where the `non_localized_focal_points` opt-in is inactive.
28
- * All fields are optional, matching the partial-write contract.
29
- */
30
- export type UploadLocaleKeyedDefaultFieldMetadataInRequest = {
31
- [localeCode: string]: {
32
- alt?: string | null;
33
- title?: string | null;
34
- custom_data?: {
35
- [k: string]: unknown;
36
- };
37
- focal_point?: {
38
- x: number;
39
- y: number;
40
- } | null;
41
- };
42
- };
43
- export default class UploadResource extends BaseUpload {
44
- }
@@ -1,36 +0,0 @@
1
- import BaseUpload from '../generated/resources/Upload.js';
2
-
3
- /**
4
- * Legacy locale-keyed shape of an upload's `default_field_metadata`, as
5
- * returned and accepted by environments where the `non_localized_focal_points`
6
- * opt-in is inactive.
7
- *
8
- * The generated `Upload.default_field_metadata` type reflects the new
9
- * field-keyed shape (the path forward). This type is provided so consumers
10
- * targeting opted-out environments during the transition can cast the
11
- * response value to a structurally accurate shape.
12
- */
13
- export type UploadLocaleKeyedDefaultFieldMetadata = {
14
- [localeCode: string]: {
15
- alt: string | null;
16
- title: string | null;
17
- custom_data: { [k: string]: unknown };
18
- focal_point: { x: number; y: number } | null;
19
- };
20
- };
21
-
22
- /**
23
- * Legacy locale-keyed shape accepted on `create` / `update` request bodies
24
- * by environments where the `non_localized_focal_points` opt-in is inactive.
25
- * All fields are optional, matching the partial-write contract.
26
- */
27
- export type UploadLocaleKeyedDefaultFieldMetadataInRequest = {
28
- [localeCode: string]: {
29
- alt?: string | null;
30
- title?: string | null;
31
- custom_data?: { [k: string]: unknown };
32
- focal_point?: { x: number; y: number } | null;
33
- };
34
- };
35
-
36
- export default class UploadResource extends BaseUpload {}