@uniformdev/assets 20.79.1 → 20.79.2-alpha.19.sha-0b10e12c18
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.
- package/dist/index.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.esm.js +18 -8
- package/dist/index.js +21 -9
- package/dist/index.mjs +18 -8
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1955,6 +1955,21 @@ interface ImageFromApi {
|
|
|
1955
1955
|
*/
|
|
1956
1956
|
declare const imageFrom: (asset: Asset | AssetParamValueItem | string) => ImageFromApi;
|
|
1957
1957
|
|
|
1958
|
+
type AssetInputFields = NonNullable<NonNullable<AssetUpsertRequest['asset']>['fields']>;
|
|
1959
|
+
/**
|
|
1960
|
+
* The asset `fields` a write carries. The API assembles `url`, `mediaType`, `size`, `width` and
|
|
1961
|
+
* `height` from the attached file on every read, and the write schema rejects those along with
|
|
1962
|
+
* `custom`, so a write can neither send nor settle them.
|
|
1963
|
+
*
|
|
1964
|
+
* The CLI's asset comparator projects onto this same list, so a push only reports a difference a
|
|
1965
|
+
* push can act on.
|
|
1966
|
+
*/
|
|
1967
|
+
declare const WRITABLE_ASSET_FIELDS: readonly ["title", "description", "file", "focalPoint"];
|
|
1968
|
+
/**
|
|
1969
|
+
* Selects the asset fields a write carries, dropping the ones the API computes from the attached
|
|
1970
|
+
* file. Returns a new object rather than editing the asset it reads.
|
|
1971
|
+
*/
|
|
1972
|
+
declare const selectWritableAssetFields: (fields?: Asset["fields"]) => AssetInputFields;
|
|
1958
1973
|
/**
|
|
1959
1974
|
* Converts a content asset to a put content asset body that has only the properties expected to the PUT API.
|
|
1960
1975
|
* Removes things like author, stats, etc.
|
|
@@ -1964,4 +1979,4 @@ declare function convertAssetToPutAsset(asset: {
|
|
|
1964
1979
|
projectId: string;
|
|
1965
1980
|
}): AssetUpsertRequest;
|
|
1966
1981
|
|
|
1967
|
-
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, type ImageFromApi, type ImageFromTransformProps, UncachedAssetClient, assetDefinitions, convertAssetToPutAsset, getAssetDefinitionType, imageFrom };
|
|
1982
|
+
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, type ImageFromApi, type ImageFromTransformProps, UncachedAssetClient, WRITABLE_ASSET_FIELDS, assetDefinitions, convertAssetToPutAsset, getAssetDefinitionType, imageFrom, selectWritableAssetFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -1955,6 +1955,21 @@ interface ImageFromApi {
|
|
|
1955
1955
|
*/
|
|
1956
1956
|
declare const imageFrom: (asset: Asset | AssetParamValueItem | string) => ImageFromApi;
|
|
1957
1957
|
|
|
1958
|
+
type AssetInputFields = NonNullable<NonNullable<AssetUpsertRequest['asset']>['fields']>;
|
|
1959
|
+
/**
|
|
1960
|
+
* The asset `fields` a write carries. The API assembles `url`, `mediaType`, `size`, `width` and
|
|
1961
|
+
* `height` from the attached file on every read, and the write schema rejects those along with
|
|
1962
|
+
* `custom`, so a write can neither send nor settle them.
|
|
1963
|
+
*
|
|
1964
|
+
* The CLI's asset comparator projects onto this same list, so a push only reports a difference a
|
|
1965
|
+
* push can act on.
|
|
1966
|
+
*/
|
|
1967
|
+
declare const WRITABLE_ASSET_FIELDS: readonly ["title", "description", "file", "focalPoint"];
|
|
1968
|
+
/**
|
|
1969
|
+
* Selects the asset fields a write carries, dropping the ones the API computes from the attached
|
|
1970
|
+
* file. Returns a new object rather than editing the asset it reads.
|
|
1971
|
+
*/
|
|
1972
|
+
declare const selectWritableAssetFields: (fields?: Asset["fields"]) => AssetInputFields;
|
|
1958
1973
|
/**
|
|
1959
1974
|
* Converts a content asset to a put content asset body that has only the properties expected to the PUT API.
|
|
1960
1975
|
* Removes things like author, stats, etc.
|
|
@@ -1964,4 +1979,4 @@ declare function convertAssetToPutAsset(asset: {
|
|
|
1964
1979
|
projectId: string;
|
|
1965
1980
|
}): AssetUpsertRequest;
|
|
1966
1981
|
|
|
1967
|
-
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, type ImageFromApi, type ImageFromTransformProps, UncachedAssetClient, assetDefinitions, convertAssetToPutAsset, getAssetDefinitionType, imageFrom };
|
|
1982
|
+
export { type Asset, AssetClient, type AssetDefinitionType, type AssetDeleteRequest, type AssetGetRequest, type AssetGetRequestList, type AssetGetRequestSingle, type AssetGetResponse, type AssetGetResponseList, type AssetGetResponseSingle, type AssetParamValue, type AssetParamValueItem, type AssetUpsertRequest, type ImageDeliveryParams, type ImageFromApi, type ImageFromTransformProps, UncachedAssetClient, WRITABLE_ASSET_FIELDS, assetDefinitions, convertAssetToPutAsset, getAssetDefinitionType, imageFrom, selectWritableAssetFields };
|
package/dist/index.esm.js
CHANGED
|
@@ -172,8 +172,21 @@ var imageFrom = (asset) => {
|
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
// src/utils/assetConverter.ts
|
|
175
|
+
var WRITABLE_ASSET_FIELDS = [
|
|
176
|
+
"title",
|
|
177
|
+
"description",
|
|
178
|
+
"file",
|
|
179
|
+
"focalPoint"
|
|
180
|
+
];
|
|
181
|
+
var selectProperties = (source, names) => {
|
|
182
|
+
const selected = {};
|
|
183
|
+
for (const name of names) {
|
|
184
|
+
selected[name] = source[name];
|
|
185
|
+
}
|
|
186
|
+
return selected;
|
|
187
|
+
};
|
|
188
|
+
var selectWritableAssetFields = (fields = {}) => selectProperties(fields, WRITABLE_ASSET_FIELDS);
|
|
175
189
|
function convertAssetToPutAsset(asset) {
|
|
176
|
-
var _a, _b, _c, _d;
|
|
177
190
|
return {
|
|
178
191
|
asset: {
|
|
179
192
|
_id: asset.asset._id,
|
|
@@ -181,12 +194,7 @@ function convertAssetToPutAsset(asset) {
|
|
|
181
194
|
_name: asset.asset._name,
|
|
182
195
|
type: asset.asset.type,
|
|
183
196
|
labels: asset.asset.labels,
|
|
184
|
-
fields:
|
|
185
|
-
title: (_a = asset.asset.fields) == null ? void 0 : _a.title,
|
|
186
|
-
description: (_b = asset.asset.fields) == null ? void 0 : _b.description,
|
|
187
|
-
file: (_c = asset.asset.fields) == null ? void 0 : _c.file,
|
|
188
|
-
focalPoint: (_d = asset.asset.fields) == null ? void 0 : _d.focalPoint
|
|
189
|
-
}
|
|
197
|
+
fields: selectWritableAssetFields(asset.asset.fields)
|
|
190
198
|
},
|
|
191
199
|
projectId: asset.projectId
|
|
192
200
|
};
|
|
@@ -194,8 +202,10 @@ function convertAssetToPutAsset(asset) {
|
|
|
194
202
|
export {
|
|
195
203
|
AssetClient,
|
|
196
204
|
UncachedAssetClient,
|
|
205
|
+
WRITABLE_ASSET_FIELDS,
|
|
197
206
|
assetDefinitions,
|
|
198
207
|
convertAssetToPutAsset,
|
|
199
208
|
getAssetDefinitionType,
|
|
200
|
-
imageFrom
|
|
209
|
+
imageFrom,
|
|
210
|
+
selectWritableAssetFields
|
|
201
211
|
};
|
package/dist/index.js
CHANGED
|
@@ -22,10 +22,12 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AssetClient: () => AssetClient,
|
|
24
24
|
UncachedAssetClient: () => UncachedAssetClient,
|
|
25
|
+
WRITABLE_ASSET_FIELDS: () => WRITABLE_ASSET_FIELDS,
|
|
25
26
|
assetDefinitions: () => assetDefinitions,
|
|
26
27
|
convertAssetToPutAsset: () => convertAssetToPutAsset,
|
|
27
28
|
getAssetDefinitionType: () => getAssetDefinitionType,
|
|
28
|
-
imageFrom: () => imageFrom
|
|
29
|
+
imageFrom: () => imageFrom,
|
|
30
|
+
selectWritableAssetFields: () => selectWritableAssetFields
|
|
29
31
|
});
|
|
30
32
|
module.exports = __toCommonJS(index_exports);
|
|
31
33
|
|
|
@@ -203,8 +205,21 @@ var imageFrom = (asset) => {
|
|
|
203
205
|
};
|
|
204
206
|
|
|
205
207
|
// src/utils/assetConverter.ts
|
|
208
|
+
var WRITABLE_ASSET_FIELDS = [
|
|
209
|
+
"title",
|
|
210
|
+
"description",
|
|
211
|
+
"file",
|
|
212
|
+
"focalPoint"
|
|
213
|
+
];
|
|
214
|
+
var selectProperties = (source, names) => {
|
|
215
|
+
const selected = {};
|
|
216
|
+
for (const name of names) {
|
|
217
|
+
selected[name] = source[name];
|
|
218
|
+
}
|
|
219
|
+
return selected;
|
|
220
|
+
};
|
|
221
|
+
var selectWritableAssetFields = (fields = {}) => selectProperties(fields, WRITABLE_ASSET_FIELDS);
|
|
206
222
|
function convertAssetToPutAsset(asset) {
|
|
207
|
-
var _a, _b, _c, _d;
|
|
208
223
|
return {
|
|
209
224
|
asset: {
|
|
210
225
|
_id: asset.asset._id,
|
|
@@ -212,12 +227,7 @@ function convertAssetToPutAsset(asset) {
|
|
|
212
227
|
_name: asset.asset._name,
|
|
213
228
|
type: asset.asset.type,
|
|
214
229
|
labels: asset.asset.labels,
|
|
215
|
-
fields:
|
|
216
|
-
title: (_a = asset.asset.fields) == null ? void 0 : _a.title,
|
|
217
|
-
description: (_b = asset.asset.fields) == null ? void 0 : _b.description,
|
|
218
|
-
file: (_c = asset.asset.fields) == null ? void 0 : _c.file,
|
|
219
|
-
focalPoint: (_d = asset.asset.fields) == null ? void 0 : _d.focalPoint
|
|
220
|
-
}
|
|
230
|
+
fields: selectWritableAssetFields(asset.asset.fields)
|
|
221
231
|
},
|
|
222
232
|
projectId: asset.projectId
|
|
223
233
|
};
|
|
@@ -226,8 +236,10 @@ function convertAssetToPutAsset(asset) {
|
|
|
226
236
|
0 && (module.exports = {
|
|
227
237
|
AssetClient,
|
|
228
238
|
UncachedAssetClient,
|
|
239
|
+
WRITABLE_ASSET_FIELDS,
|
|
229
240
|
assetDefinitions,
|
|
230
241
|
convertAssetToPutAsset,
|
|
231
242
|
getAssetDefinitionType,
|
|
232
|
-
imageFrom
|
|
243
|
+
imageFrom,
|
|
244
|
+
selectWritableAssetFields
|
|
233
245
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -172,8 +172,21 @@ var imageFrom = (asset) => {
|
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
// src/utils/assetConverter.ts
|
|
175
|
+
var WRITABLE_ASSET_FIELDS = [
|
|
176
|
+
"title",
|
|
177
|
+
"description",
|
|
178
|
+
"file",
|
|
179
|
+
"focalPoint"
|
|
180
|
+
];
|
|
181
|
+
var selectProperties = (source, names) => {
|
|
182
|
+
const selected = {};
|
|
183
|
+
for (const name of names) {
|
|
184
|
+
selected[name] = source[name];
|
|
185
|
+
}
|
|
186
|
+
return selected;
|
|
187
|
+
};
|
|
188
|
+
var selectWritableAssetFields = (fields = {}) => selectProperties(fields, WRITABLE_ASSET_FIELDS);
|
|
175
189
|
function convertAssetToPutAsset(asset) {
|
|
176
|
-
var _a, _b, _c, _d;
|
|
177
190
|
return {
|
|
178
191
|
asset: {
|
|
179
192
|
_id: asset.asset._id,
|
|
@@ -181,12 +194,7 @@ function convertAssetToPutAsset(asset) {
|
|
|
181
194
|
_name: asset.asset._name,
|
|
182
195
|
type: asset.asset.type,
|
|
183
196
|
labels: asset.asset.labels,
|
|
184
|
-
fields:
|
|
185
|
-
title: (_a = asset.asset.fields) == null ? void 0 : _a.title,
|
|
186
|
-
description: (_b = asset.asset.fields) == null ? void 0 : _b.description,
|
|
187
|
-
file: (_c = asset.asset.fields) == null ? void 0 : _c.file,
|
|
188
|
-
focalPoint: (_d = asset.asset.fields) == null ? void 0 : _d.focalPoint
|
|
189
|
-
}
|
|
197
|
+
fields: selectWritableAssetFields(asset.asset.fields)
|
|
190
198
|
},
|
|
191
199
|
projectId: asset.projectId
|
|
192
200
|
};
|
|
@@ -194,8 +202,10 @@ function convertAssetToPutAsset(asset) {
|
|
|
194
202
|
export {
|
|
195
203
|
AssetClient,
|
|
196
204
|
UncachedAssetClient,
|
|
205
|
+
WRITABLE_ASSET_FIELDS,
|
|
197
206
|
assetDefinitions,
|
|
198
207
|
convertAssetToPutAsset,
|
|
199
208
|
getAssetDefinitionType,
|
|
200
|
-
imageFrom
|
|
209
|
+
imageFrom,
|
|
210
|
+
selectWritableAssetFields
|
|
201
211
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/assets",
|
|
3
|
-
"version": "20.79.
|
|
3
|
+
"version": "20.79.2-alpha.19.sha-0b10e12c18",
|
|
4
4
|
"description": "Uniform Assets",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@uniformdev/context": "20.79.
|
|
41
|
-
"@uniformdev/files": "20.79.
|
|
40
|
+
"@uniformdev/context": "20.79.2-alpha.19.sha-0b10e12c18",
|
|
41
|
+
"@uniformdev/files": "20.79.2-alpha.19.sha-0b10e12c18"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"ts-xor": "^1.3.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "0b10e12c18b63e24d30690e6d596f723c22f38df"
|
|
47
47
|
}
|