@uniformdev/cli 20.80.2-alpha.14.sha-1c81418f05 → 20.80.2-alpha.22.sha-545d46ba66
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.
|
@@ -21,7 +21,7 @@ import { dirname, extname, isAbsolute, resolve, sep } from "path";
|
|
|
21
21
|
// package.json
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "@uniformdev/cli",
|
|
24
|
-
version: "20.
|
|
24
|
+
version: "20.80.1",
|
|
25
25
|
description: "Uniform command line interface tool",
|
|
26
26
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
27
27
|
main: "./cli.js",
|
package/dist/defaultConfig.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
withFormatOptions,
|
|
26
26
|
withProjectOptions,
|
|
27
27
|
withTeamOptions
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-U4K2JTQL.mjs";
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
import * as dotenv from "dotenv";
|
|
@@ -2814,18 +2814,20 @@ var downloadFile = async ({
|
|
|
2814
2814
|
fileClient,
|
|
2815
2815
|
fileUrl,
|
|
2816
2816
|
fileId,
|
|
2817
|
-
directory
|
|
2817
|
+
directory,
|
|
2818
|
+
expectedSize
|
|
2818
2819
|
}) => {
|
|
2819
2820
|
const writeDirectory = getFilesDirectory(directory);
|
|
2820
2821
|
const filesDirectory = join10(writeDirectory, FILES_DIRECTORY_NAME);
|
|
2821
2822
|
const fileName = urlToFileName(fileUrl.toString());
|
|
2822
2823
|
const filePath = join10(filesDirectory, fileName);
|
|
2823
2824
|
const fileAlreadyExists = await fsj2.existsAsync(filePath);
|
|
2824
|
-
|
|
2825
|
+
const localCopyIsStale = fileAlreadyExists && expectedSize !== void 0 && (await fsj2.inspectAsync(filePath))?.size !== expectedSize;
|
|
2826
|
+
if (fileAlreadyExists && !localCopyIsStale) {
|
|
2825
2827
|
return { id: fileId, url: fileUrl };
|
|
2826
2828
|
}
|
|
2827
2829
|
const file = await getFileMetadata({ fileClient, fileId, fileUrl });
|
|
2828
|
-
if (file?.sourceId) {
|
|
2830
|
+
if (!localCopyIsStale && file?.sourceId) {
|
|
2829
2831
|
const sourceId = file.sourceId;
|
|
2830
2832
|
try {
|
|
2831
2833
|
const downloadedFilePaths = await getDownloadedFilePathCache(filesDirectory);
|
|
@@ -2870,7 +2872,7 @@ var downloadFile = async ({
|
|
|
2870
2872
|
|
|
2871
2873
|
// src/files/uploadFile.ts
|
|
2872
2874
|
import { preferredType } from "@thi.ng/mime";
|
|
2873
|
-
import { FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
2875
|
+
import { FILE_MIME_TYPES_ALL, FILE_READY_STATE, getFileNameFromUrl } from "@uniformdev/files";
|
|
2874
2876
|
import { fileTypeFromFile } from "file-type";
|
|
2875
2877
|
import { createReadStream } from "fs";
|
|
2876
2878
|
import fsj3 from "fs-jetpack";
|
|
@@ -2885,6 +2887,7 @@ var uploadFile = async ({
|
|
|
2885
2887
|
fileUrl,
|
|
2886
2888
|
directory,
|
|
2887
2889
|
fileId,
|
|
2890
|
+
declaredMediaType,
|
|
2888
2891
|
warnIfLocalCopyMissing = true
|
|
2889
2892
|
}) => {
|
|
2890
2893
|
const key = `${fileId}-${fileUrl}`;
|
|
@@ -2893,6 +2896,7 @@ var uploadFile = async ({
|
|
|
2893
2896
|
return result2 ?? null;
|
|
2894
2897
|
}
|
|
2895
2898
|
const promise = fileUploadQueue.add(async () => {
|
|
2899
|
+
let uploadBody;
|
|
2896
2900
|
try {
|
|
2897
2901
|
const writeDirectory = getFilesDirectory(directory);
|
|
2898
2902
|
const hash = urlToHash(fileUrl);
|
|
@@ -2916,7 +2920,15 @@ var uploadFile = async ({
|
|
|
2916
2920
|
return null;
|
|
2917
2921
|
}
|
|
2918
2922
|
const fileName = getFileNameFromUrl(fileUrl);
|
|
2919
|
-
let mimeType =
|
|
2923
|
+
let mimeType = declaredMediaType && FILE_MIME_TYPES_ALL.includes(declaredMediaType) ? declaredMediaType : void 0;
|
|
2924
|
+
if (declaredMediaType && !mimeType) {
|
|
2925
|
+
console.warn(
|
|
2926
|
+
`Asset declares unsupported media type "${declaredMediaType}" for ${fileUrl}, detecting instead`
|
|
2927
|
+
);
|
|
2928
|
+
}
|
|
2929
|
+
if (!mimeType) {
|
|
2930
|
+
mimeType = expectedFilePath.endsWith(".svg") ? "image/svg+xml" : (await fileTypeFromFile(expectedFilePath))?.mime;
|
|
2931
|
+
}
|
|
2920
2932
|
if (!mimeType) {
|
|
2921
2933
|
mimeType = preferredType(fileUrl.split(".").at(-1) ?? "");
|
|
2922
2934
|
}
|
|
@@ -2926,7 +2938,6 @@ var uploadFile = async ({
|
|
|
2926
2938
|
if (mimeType === "audio/x-flac") {
|
|
2927
2939
|
mimeType = "audio/flac";
|
|
2928
2940
|
}
|
|
2929
|
-
let uploadBody;
|
|
2930
2941
|
let uploadSize = fileInspect.size;
|
|
2931
2942
|
if (mimeType === "image/svg+xml") {
|
|
2932
2943
|
const fileBuffer = await fsj3.readAsync(expectedFilePath, "buffer");
|
|
@@ -2942,6 +2953,7 @@ var uploadFile = async ({
|
|
|
2942
2953
|
uploadSize = uploadBody.length;
|
|
2943
2954
|
} else {
|
|
2944
2955
|
uploadBody = createReadStream(expectedFilePath);
|
|
2956
|
+
uploadBody.on("error", () => void 0);
|
|
2945
2957
|
}
|
|
2946
2958
|
const { width, height } = await (async () => {
|
|
2947
2959
|
if (!mimeType.startsWith("image/")) {
|
|
@@ -3002,6 +3014,9 @@ var uploadFile = async ({
|
|
|
3002
3014
|
return { id, url: uploadedFileUrl };
|
|
3003
3015
|
} catch (e) {
|
|
3004
3016
|
console.warn(`Failed to upload file ${fileUrl}`, e);
|
|
3017
|
+
if (uploadBody && "destroy" in uploadBody) {
|
|
3018
|
+
uploadBody.destroy();
|
|
3019
|
+
}
|
|
3005
3020
|
return null;
|
|
3006
3021
|
}
|
|
3007
3022
|
});
|
|
@@ -3085,7 +3100,7 @@ var downloadFileForAsset = async ({
|
|
|
3085
3100
|
if (!fileUrl) {
|
|
3086
3101
|
return null;
|
|
3087
3102
|
}
|
|
3088
|
-
return downloadFile({ fileUrl, fileId, directory, fileClient });
|
|
3103
|
+
return downloadFile({ fileUrl, fileId, directory, fileClient, expectedSize: fields.size?.value });
|
|
3089
3104
|
};
|
|
3090
3105
|
var uploadFileForAsset = async ({
|
|
3091
3106
|
asset,
|
|
@@ -3102,6 +3117,7 @@ var uploadFileForAsset = async ({
|
|
|
3102
3117
|
directory,
|
|
3103
3118
|
fileClient,
|
|
3104
3119
|
fileId,
|
|
3120
|
+
declaredMediaType: asset.asset.fields?.mediaType?.value,
|
|
3105
3121
|
warnIfLocalCopyMissing: false
|
|
3106
3122
|
});
|
|
3107
3123
|
};
|
|
@@ -3179,7 +3195,11 @@ var selectComparableAsset = ({ asset }) => ({
|
|
|
3179
3195
|
_name: asset._name,
|
|
3180
3196
|
_dataResources: asset._dataResources,
|
|
3181
3197
|
labels: asset.labels,
|
|
3182
|
-
fields:
|
|
3198
|
+
fields: {
|
|
3199
|
+
...selectWritableAssetFields(asset.fields),
|
|
3200
|
+
mediaType: asset.fields?.mediaType,
|
|
3201
|
+
size: asset.fields?.size
|
|
3202
|
+
}
|
|
3183
3203
|
});
|
|
3184
3204
|
var compareAssetsWithoutUrls = (source, target) => {
|
|
3185
3205
|
return serializedDequal(selectComparableAsset(source.object), selectComparableAsset(target.object));
|
|
@@ -4775,11 +4795,6 @@ var ComponentPatternListModule = {
|
|
|
4775
4795
|
)
|
|
4776
4796
|
};
|
|
4777
4797
|
|
|
4778
|
-
// src/commands/canvas/componentInstanceEngineDataSource.ts
|
|
4779
|
-
import {
|
|
4780
|
-
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
|
|
4781
|
-
} from "@uniformdev/canvas";
|
|
4782
|
-
|
|
4783
4798
|
// src/commands/canvas/commands/composition/_util.ts
|
|
4784
4799
|
var selectIdentifier3 = (response) => {
|
|
4785
4800
|
let baseId = response.composition._id;
|
|
@@ -4866,19 +4881,11 @@ function createComponentInstanceEngineDataSource({
|
|
|
4866
4881
|
name: "Uniform API",
|
|
4867
4882
|
objects: getObjects(),
|
|
4868
4883
|
deleteObject: async (providerId) => {
|
|
4869
|
-
const { id: compositionId } = parseSerializedId(providerId);
|
|
4870
|
-
const selector = { compositionId, editionId: toRawEntityId(providerId) };
|
|
4871
|
-
if (stateId === CANVAS_PUBLISHED_STATE2) {
|
|
4872
|
-
if (verbose) {
|
|
4873
|
-
console.log(`\u{1F41B} unpublish composition: (id: ${providerId})`);
|
|
4874
|
-
}
|
|
4875
|
-
await client.unpublish(selector);
|
|
4876
|
-
return;
|
|
4877
|
-
}
|
|
4878
4884
|
if (verbose) {
|
|
4879
4885
|
console.log(`\u{1F41B} delete composition: (id: ${providerId})`);
|
|
4880
4886
|
}
|
|
4881
|
-
|
|
4887
|
+
const { id: compositionId, editionId } = parseSerializedId(providerId);
|
|
4888
|
+
await client.remove({ compositionId, editionId });
|
|
4882
4889
|
},
|
|
4883
4890
|
writeObject: async (object4) => {
|
|
4884
4891
|
if (verbose) {
|
|
@@ -7129,11 +7136,7 @@ var EntryListModule = {
|
|
|
7129
7136
|
};
|
|
7130
7137
|
|
|
7131
7138
|
// src/commands/canvas/entryEngineDataSource.ts
|
|
7132
|
-
import {
|
|
7133
|
-
ApiClientError as ApiClientError2,
|
|
7134
|
-
CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3,
|
|
7135
|
-
convertEntryToPutEntry
|
|
7136
|
-
} from "@uniformdev/canvas";
|
|
7139
|
+
import { ApiClientError as ApiClientError2, convertEntryToPutEntry } from "@uniformdev/canvas";
|
|
7137
7140
|
|
|
7138
7141
|
// src/commands/canvas/commands/entry/_util.ts
|
|
7139
7142
|
var selectEntryIdentifier = (e) => {
|
|
@@ -7205,13 +7208,8 @@ function createEntryEngineDataSource({
|
|
|
7205
7208
|
name: "Uniform API",
|
|
7206
7209
|
objects: getObjects(),
|
|
7207
7210
|
deleteObject: async (providerId) => {
|
|
7208
|
-
const { id: entryId } = parseSerializedId(providerId);
|
|
7209
|
-
|
|
7210
|
-
if (stateId === CANVAS_PUBLISHED_STATE3) {
|
|
7211
|
-
await client.unpublish(selector);
|
|
7212
|
-
return;
|
|
7213
|
-
}
|
|
7214
|
-
await client.remove(selector);
|
|
7211
|
+
const { id: entryId, editionId } = parseSerializedId(providerId);
|
|
7212
|
+
await client.remove({ entryId, editionId });
|
|
7215
7213
|
},
|
|
7216
7214
|
writeObject: async ({ object: object4 }) => {
|
|
7217
7215
|
await client.save({ ...convertEntryToPutEntry(object4), state: stateId });
|
|
@@ -9530,6 +9528,7 @@ var PromptPushModule = {
|
|
|
9530
9528
|
proxy,
|
|
9531
9529
|
directory,
|
|
9532
9530
|
mode,
|
|
9531
|
+
whatIf,
|
|
9533
9532
|
project: projectId,
|
|
9534
9533
|
diff: diffMode,
|
|
9535
9534
|
allowEmptySource,
|
|
@@ -9565,6 +9564,7 @@ var PromptPushModule = {
|
|
|
9565
9564
|
source,
|
|
9566
9565
|
target,
|
|
9567
9566
|
mode,
|
|
9567
|
+
whatIf,
|
|
9568
9568
|
allowEmptySource,
|
|
9569
9569
|
log: createSyncEngineConsoleLogger({ diffMode })
|
|
9570
9570
|
});
|
|
@@ -13437,12 +13437,9 @@ var selectFilename2 = (source) => {
|
|
|
13437
13437
|
return cleanFileName(source.sourceUrl.substring(index + 1)) + `_${source.id}`;
|
|
13438
13438
|
};
|
|
13439
13439
|
var selectDisplayName17 = (source) => {
|
|
13440
|
-
if (typeof source.sourceUrl !== "string") {
|
|
13441
|
-
return `${source.id ?? "redirect"} (id: ${source.id})`;
|
|
13442
|
-
}
|
|
13443
13440
|
let pathName = source.sourceUrl;
|
|
13444
13441
|
if (pathName.length > 30) {
|
|
13445
|
-
const slashIndex =
|
|
13442
|
+
const slashIndex = source.sourceUrl.indexOf("/", source.sourceUrl.length - 30);
|
|
13446
13443
|
pathName = "..." + pathName.substring(slashIndex);
|
|
13447
13444
|
}
|
|
13448
13445
|
return `${pathName} (id: ${source.id})`;
|
|
@@ -13712,11 +13709,7 @@ var RedirectDefinitionUpdateModule = {
|
|
|
13712
13709
|
const fetch2 = nodeFetchProxy(proxy);
|
|
13713
13710
|
const client = getRedirectClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
13714
13711
|
const file = readFileToObject(filename);
|
|
13715
|
-
|
|
13716
|
-
console.error(`${filename} does not contain a YAML or JSON object`);
|
|
13717
|
-
process.exit(1);
|
|
13718
|
-
}
|
|
13719
|
-
await client.upsertRedirect("redirect" in file ? file.redirect : file);
|
|
13712
|
+
await client.upsertRedirect(file);
|
|
13720
13713
|
}
|
|
13721
13714
|
};
|
|
13722
13715
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "20.80.2-alpha.
|
|
3
|
+
"version": "20.80.2-alpha.22.sha-545d46ba66",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@inquirer/prompts": "^8.5.2",
|
|
29
29
|
"@thi.ng/mime": "^2.2.23",
|
|
30
|
-
"@uniformdev/assets": "20.80.2-alpha.
|
|
31
|
-
"@uniformdev/automations-sdk": "20.80.2-alpha.
|
|
32
|
-
"@uniformdev/canvas": "20.80.2-alpha.
|
|
33
|
-
"@uniformdev/context": "20.80.2-alpha.
|
|
34
|
-
"@uniformdev/files": "20.80.2-alpha.
|
|
35
|
-
"@uniformdev/project-map": "20.80.2-alpha.
|
|
36
|
-
"@uniformdev/redirect": "20.80.2-alpha.
|
|
37
|
-
"@uniformdev/richtext": "20.80.2-alpha.
|
|
30
|
+
"@uniformdev/assets": "20.80.2-alpha.22.sha-545d46ba66",
|
|
31
|
+
"@uniformdev/automations-sdk": "20.80.2-alpha.22.sha-545d46ba66",
|
|
32
|
+
"@uniformdev/canvas": "20.80.2-alpha.22.sha-545d46ba66",
|
|
33
|
+
"@uniformdev/context": "20.80.2-alpha.22.sha-545d46ba66",
|
|
34
|
+
"@uniformdev/files": "20.80.2-alpha.22.sha-545d46ba66",
|
|
35
|
+
"@uniformdev/project-map": "20.80.2-alpha.22.sha-545d46ba66",
|
|
36
|
+
"@uniformdev/redirect": "20.80.2-alpha.22.sha-545d46ba66",
|
|
37
|
+
"@uniformdev/richtext": "20.80.2-alpha.22.sha-545d46ba66",
|
|
38
38
|
"call-bind": "^1.0.2",
|
|
39
39
|
"colorette": "2.0.20",
|
|
40
40
|
"cosmiconfig": "9.0.2",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "545d46ba66a16e24a82d3f832ebf5ea342b79d56"
|
|
82
82
|
}
|