Skip to content

Commit 1e127b0

Browse files
authored
Merge pull request #48 from datocms/c16/feat/support-dual-shape-upload-metadata
Support dual shape upload metadata
2 parents 8c21d02 + ac6a528 commit 1e127b0

21 files changed

Lines changed: 346 additions & 269 deletions

File tree

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "5.4.22"
5+
"version": "5.5.0-alpha.2"
66
}

packages/cma-client-analysis/__tests__/__snapshots__/code-analysis.test.ts.snap

Lines changed: 54 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,42 +1098,25 @@ exports[`TypeScript Compiler API - Unit Tests extractTypeDependencies uploads.cr
10981098
*/
10991099
notes?: string | null;
11001100
/**
1101-
* For each of the project's locales, the default metadata to apply if nothing is specified at record's level.
1101+
* 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.
11021102
*/
11031103
default_field_metadata?: {
1104+
alt?: LocalizedAlt;
1105+
title?: LocalizedTitle;
1106+
custom_data?: LocalizedCustomData;
11041107
/**
1105-
* This interface was referenced by \`undefined\`'s JSON-Schema definition
1106-
* via the \`patternProperty\` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
1108+
* Focal point (only for image assets)
11071109
*/
1108-
[k: string]: {
1110+
focal_point?: {
11091111
/**
1110-
* Alternate text for the asset
1112+
* Horizontal position expressed as float between 0 and 1
11111113
*/
1112-
alt?: string | null;
1114+
x: number;
11131115
/**
1114-
* Title for the asset
1116+
* Vertical position expressed as float between 0 and 1
11151117
*/
1116-
title?: string | null;
1117-
/**
1118-
* Object with arbitrary metadata
1119-
*/
1120-
custom_data?: {
1121-
[k: string]: unknown;
1122-
};
1123-
/**
1124-
* Focal point (only for image assets)
1125-
*/
1126-
focal_point?: {
1127-
/**
1128-
* Horizontal position expressed as float between 0 and 1
1129-
*/
1130-
x: number;
1131-
/**
1132-
* Vertical position expressed as float between 0 and 1
1133-
*/
1134-
y: number;
1135-
} | null;
1136-
};
1118+
y: number;
1119+
} | null;
11371120
};
11381121
/**
11391122
* Tags
@@ -1146,6 +1129,38 @@ export type UploadIdentity = string;
11461129
11471130
export type UploadType = 'upload';
11481131
1132+
export type LocalizedAlt = {
1133+
/**
1134+
* Alternate text for the asset in this locale
1135+
*
1136+
* This interface was referenced by \`LocalizedAlt\`'s JSON-Schema definition
1137+
* via the \`patternProperty\` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
1138+
*/
1139+
[k: string]: string | null;
1140+
};
1141+
1142+
export type LocalizedTitle = {
1143+
/**
1144+
* Title for the asset in this locale
1145+
*
1146+
* This interface was referenced by \`LocalizedTitle\`'s JSON-Schema definition
1147+
* via the \`patternProperty\` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
1148+
*/
1149+
[k: string]: string | null;
1150+
};
1151+
1152+
export type LocalizedCustomData = {
1153+
/**
1154+
* Arbitrary metadata for the asset in this locale
1155+
*
1156+
* This interface was referenced by \`LocalizedCustomData\`'s JSON-Schema definition
1157+
* via the \`patternProperty\` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
1158+
*/
1159+
[k: string]: {
1160+
[k: string]: unknown;
1161+
};
1162+
};
1163+
11491164
export type UploadCollectionData = {
11501165
type: UploadCollectionType;
11511166
id: UploadCollectionIdentity;
@@ -1227,42 +1242,25 @@ export type Upload = {
12271242
*/
12281243
mux_mp4_highest_res: null | 'high' | 'medium' | 'low';
12291244
/**
1230-
* For each of the project's locales, the default metadata to apply if nothing is specified at record's level.
1245+
* 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 a single value per asset (only meaningful for image assets). See [non-localized focal points](https://www.datocms.com/product-updates/non-localized-focal-points) for more info.
12311246
*/
12321247
default_field_metadata: {
1248+
alt: LocalizedAlt;
1249+
title: LocalizedTitle;
1250+
custom_data: LocalizedCustomData;
12331251
/**
1234-
* This interface was referenced by \`undefined\`'s JSON-Schema definition
1235-
* via the \`patternProperty\` "^(?<languagecode>[a-z]{0,3}(-[A-Za-z]+)?(-[A-Z]{0,3})?)$".
1252+
* Focal point (only for image assets)
12361253
*/
1237-
[k: string]: {
1238-
/**
1239-
* Alternate text for the asset
1240-
*/
1241-
alt: string | null;
1242-
/**
1243-
* Title for the asset
1244-
*/
1245-
title: string | null;
1254+
focal_point: {
12461255
/**
1247-
* Object with arbitrary metadata
1256+
* Horizontal position expressed as float between 0 and 1
12481257
*/
1249-
custom_data: {
1250-
[k: string]: unknown;
1251-
};
1258+
x: number;
12521259
/**
1253-
* Focal point (only for image assets)
1260+
* Vertical position expressed as float between 0 and 1
12541261
*/
1255-
focal_point: {
1256-
/**
1257-
* Horizontal position expressed as float between 0 and 1
1258-
*/
1259-
x: number;
1260-
/**
1261-
* Vertical position expressed as float between 0 and 1
1262-
*/
1263-
y: number;
1264-
} | null;
1265-
};
1262+
y: number;
1263+
} | null;
12661264
};
12671265
/**
12681266
* Is this upload an image?

packages/cma-client-analysis/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datocms/cma-client-analysis",
3-
"version": "5.4.22",
3+
"version": "5.5.0-alpha.2",
44
"description": "TypeScript-based static analysis utilities for the @datocms/cma-client-node Client class. Extracts method signatures, referenced types, and endpoint mappings.",
55
"keywords": [
66
"datocms",
@@ -49,7 +49,7 @@
4949
"typescript": ">=5.0.0"
5050
},
5151
"devDependencies": {
52-
"@datocms/cma-client-node": "^5.4.22",
52+
"@datocms/cma-client-node": "^5.5.0-alpha.2",
5353
"@datocms/rest-api-reference": "^5.4.19",
5454
"typescript": "^5.0.0"
5555
}

packages/cma-client-browser/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datocms/cma-client-browser",
3-
"version": "5.4.22",
3+
"version": "5.5.0-alpha.2",
44
"description": "Browser client for DatoCMS REST Content Management API",
55
"keywords": [
66
"datocms",
@@ -28,7 +28,7 @@
2828
"url": "git+https://github.com/datocms/js-rest-api-clients.git"
2929
},
3030
"dependencies": {
31-
"@datocms/cma-client": "^5.4.22",
31+
"@datocms/cma-client": "^5.5.0-alpha.2",
3232
"@datocms/rest-client-utils": "^5.4.9"
3333
},
3434
"scripts": {

packages/cma-client-browser/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ export type {
257257
UnchangedBlockInRequest,
258258
UniqueValidator,
259259
UpdatedBlockInRequest,
260+
UploadLocaleKeyedDefaultFieldMetadata,
261+
UploadLocaleKeyedDefaultFieldMetadataInRequest,
260262
VideoEditorConfiguration,
261263
VideoFieldAppearance,
262264
VideoFieldValidators,

packages/cma-client-node/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cma-client-node/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datocms/cma-client-node",
3-
"version": "5.4.22",
3+
"version": "5.5.0-alpha.2",
44
"description": "NodeJS client for DatoCMS REST Content Management API",
55
"keywords": [
66
"datocms",
@@ -37,7 +37,7 @@
3737
"url": "git+https://github.com/datocms/js-rest-api-clients.git"
3838
},
3939
"dependencies": {
40-
"@datocms/cma-client": "^5.4.22",
40+
"@datocms/cma-client": "^5.5.0-alpha.2",
4141
"@datocms/rest-client-utils": "^5.4.9",
4242
"mime-types": "^2.1.35",
4343
"tmp-promise": "^3.0.3"

packages/cma-client-node/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ export type {
257257
UnchangedBlockInRequest,
258258
UniqueValidator,
259259
UpdatedBlockInRequest,
260+
UploadLocaleKeyedDefaultFieldMetadata,
261+
UploadLocaleKeyedDefaultFieldMetadataInRequest,
260262
VideoEditorConfiguration,
261263
VideoFieldAppearance,
262264
VideoFieldValidators,

packages/cma-client/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cma-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datocms/cma-client",
3-
"version": "5.4.22",
3+
"version": "5.5.0-alpha.2",
44
"description": "JS client for DatoCMS REST Content Management API",
55
"keywords": [
66
"datocms",

0 commit comments

Comments
 (0)