@uniformdev/cli 20.74.6-alpha.6 → 20.74.7-alpha.14.sha-79426f9415
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.mjs
CHANGED
|
@@ -3,13 +3,11 @@ import {
|
|
|
3
3
|
CLI_USER_AGENT,
|
|
4
4
|
__require,
|
|
5
5
|
applyDefaultSyncConfiguration,
|
|
6
|
-
chunkEntityIds,
|
|
7
6
|
emitWithFormat,
|
|
8
7
|
exitOnCliError,
|
|
9
8
|
getDirectoryOrFilename,
|
|
10
9
|
getEntityBatchSize,
|
|
11
10
|
getEntityOption,
|
|
12
|
-
getPublishScope,
|
|
13
11
|
isPaginatedSyncEntity,
|
|
14
12
|
isPathAPackageFile,
|
|
15
13
|
maskApiKey,
|
|
@@ -25,7 +23,7 @@ import {
|
|
|
25
23
|
withFormatOptions,
|
|
26
24
|
withProjectOptions,
|
|
27
25
|
withTeamOptions
|
|
28
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4FPNEXON.mjs";
|
|
29
27
|
|
|
30
28
|
// src/index.ts
|
|
31
29
|
import * as dotenv from "dotenv";
|
|
@@ -288,6 +286,11 @@ var ENVIRONMENT_HOSTS = {
|
|
|
288
286
|
api: "https://eu.uniform.app",
|
|
289
287
|
global: "https://eu.uniform.global",
|
|
290
288
|
ai: "https://ai.eu.uniform.global"
|
|
289
|
+
},
|
|
290
|
+
eu2: {
|
|
291
|
+
api: "https://eu2.uniform.app",
|
|
292
|
+
global: "https://eu2.uniform.global",
|
|
293
|
+
ai: "https://ai.eu2.uniform.global"
|
|
291
294
|
}
|
|
292
295
|
};
|
|
293
296
|
async function selectEnvironment(explicitParams) {
|
|
@@ -307,6 +310,10 @@ async function selectEnvironment(explicitParams) {
|
|
|
307
310
|
{
|
|
308
311
|
name: "EU (eu.uniform.app)",
|
|
309
312
|
value: "eu"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "EU2 (eu2.uniform.app)",
|
|
316
|
+
value: "eu2"
|
|
310
317
|
}
|
|
311
318
|
],
|
|
312
319
|
default: "usa"
|
|
@@ -872,7 +879,6 @@ async function syncEngine({
|
|
|
872
879
|
await target.writeObject(finalSourceObject, targetObject2);
|
|
873
880
|
status.changesApplied++;
|
|
874
881
|
}
|
|
875
|
-
syncEngineEvents.emit("objectWritten", { id: ids[0], action: "update" });
|
|
876
882
|
} catch (e) {
|
|
877
883
|
if (onError) {
|
|
878
884
|
onError(e, sourceObject2);
|
|
@@ -908,7 +914,6 @@ async function syncEngine({
|
|
|
908
914
|
await target.writeObject(finalSourceObject);
|
|
909
915
|
status.changesApplied++;
|
|
910
916
|
}
|
|
911
|
-
syncEngineEvents.emit("objectWritten", { id, action: "create" });
|
|
912
917
|
} catch (e) {
|
|
913
918
|
if (onError) {
|
|
914
919
|
onError(e, sourceObject2);
|
|
@@ -2745,9 +2750,32 @@ var writeResponseBodyToFile = async (response, filePath) => {
|
|
|
2745
2750
|
throw error;
|
|
2746
2751
|
}
|
|
2747
2752
|
};
|
|
2753
|
+
var getFileMetadata = async ({
|
|
2754
|
+
fileClient,
|
|
2755
|
+
fileId,
|
|
2756
|
+
fileUrl
|
|
2757
|
+
}) => {
|
|
2758
|
+
if (fileId) {
|
|
2759
|
+
const fileById = await fileClient.get({ id: fileId }).catch(() => null);
|
|
2760
|
+
if (fileById) {
|
|
2761
|
+
return fileById;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
return fileClient.get({ url: fileUrl }).catch(() => null);
|
|
2765
|
+
};
|
|
2766
|
+
var logDownloadFailure = ({
|
|
2767
|
+
fileUrl,
|
|
2768
|
+
filePath,
|
|
2769
|
+
status
|
|
2770
|
+
}) => {
|
|
2771
|
+
console.warn(
|
|
2772
|
+
`Failed to download file ${fileUrl} (HTTP status: ${status}; expected local path: ${filePath})`
|
|
2773
|
+
);
|
|
2774
|
+
};
|
|
2748
2775
|
var downloadFile = async ({
|
|
2749
2776
|
fileClient,
|
|
2750
2777
|
fileUrl,
|
|
2778
|
+
fileId,
|
|
2751
2779
|
directory
|
|
2752
2780
|
}) => {
|
|
2753
2781
|
const writeDirectory = getFilesDirectory(directory);
|
|
@@ -2756,14 +2784,10 @@ var downloadFile = async ({
|
|
|
2756
2784
|
const filePath = join10(filesDirectory, fileName);
|
|
2757
2785
|
const fileAlreadyExists = await fsj2.existsAsync(filePath);
|
|
2758
2786
|
if (fileAlreadyExists) {
|
|
2759
|
-
return { url: fileUrl };
|
|
2760
|
-
}
|
|
2761
|
-
const file = await fileClient.get({ url: fileUrl }).catch(() => null);
|
|
2762
|
-
if (!file) {
|
|
2763
|
-
console.warn(`Skipping file ${fileUrl} as it does not exist in the project anymore`);
|
|
2764
|
-
return null;
|
|
2787
|
+
return { id: fileId, url: fileUrl };
|
|
2765
2788
|
}
|
|
2766
|
-
|
|
2789
|
+
const file = await getFileMetadata({ fileClient, fileId, fileUrl });
|
|
2790
|
+
if (file?.sourceId) {
|
|
2767
2791
|
const sourceId = file.sourceId;
|
|
2768
2792
|
try {
|
|
2769
2793
|
const downloadedFilePaths = await getDownloadedFilePathCache(filesDirectory);
|
|
@@ -2774,17 +2798,36 @@ var downloadFile = async ({
|
|
|
2774
2798
|
}
|
|
2775
2799
|
}
|
|
2776
2800
|
const fetchUrl = `${fileUrl}?format=original`;
|
|
2777
|
-
const
|
|
2801
|
+
const preserveWarningOnlyFailure = !file;
|
|
2802
|
+
let response;
|
|
2803
|
+
try {
|
|
2804
|
+
response = await fetch(fetchUrl);
|
|
2805
|
+
} catch (error) {
|
|
2806
|
+
logDownloadFailure({ fileUrl, filePath, status: "unavailable" });
|
|
2807
|
+
if (preserveWarningOnlyFailure) {
|
|
2808
|
+
return null;
|
|
2809
|
+
}
|
|
2810
|
+
throw error;
|
|
2811
|
+
}
|
|
2778
2812
|
if (!response.ok) {
|
|
2813
|
+
logDownloadFailure({ fileUrl, filePath, status: response.status });
|
|
2779
2814
|
return null;
|
|
2780
2815
|
}
|
|
2781
|
-
|
|
2816
|
+
try {
|
|
2817
|
+
await writeResponseBodyToFile(response, filePath);
|
|
2818
|
+
} catch (error) {
|
|
2819
|
+
logDownloadFailure({ fileUrl, filePath, status: response.status });
|
|
2820
|
+
if (preserveWarningOnlyFailure) {
|
|
2821
|
+
return null;
|
|
2822
|
+
}
|
|
2823
|
+
throw error;
|
|
2824
|
+
}
|
|
2782
2825
|
const downloadedFilePathCache = downloadedFilePathCacheByDirectory.get(filesDirectory);
|
|
2783
2826
|
if (downloadedFilePathCache) {
|
|
2784
2827
|
const downloadedFilePaths = await downloadedFilePathCache;
|
|
2785
2828
|
downloadedFilePaths.add(fileName);
|
|
2786
2829
|
}
|
|
2787
|
-
return { id: file
|
|
2830
|
+
return { id: file?.id ?? fileId, url: fileUrl };
|
|
2788
2831
|
};
|
|
2789
2832
|
|
|
2790
2833
|
// src/files/uploadFile.ts
|
|
@@ -2799,11 +2842,24 @@ import PQueue2 from "p-queue";
|
|
|
2799
2842
|
import { join as join11 } from "path";
|
|
2800
2843
|
var uploadQueueByKey = /* @__PURE__ */ new Map();
|
|
2801
2844
|
var fileUploadQueue = new PQueue2({ concurrency: 10 });
|
|
2845
|
+
var IMAGE_SIZE_SAFE_MEDIA_TYPES = /* @__PURE__ */ new Set([
|
|
2846
|
+
"image/png",
|
|
2847
|
+
"image/apng",
|
|
2848
|
+
"image/jpeg",
|
|
2849
|
+
"image/jpg",
|
|
2850
|
+
"image/jfif",
|
|
2851
|
+
"image/pjpeg",
|
|
2852
|
+
"image/pjp",
|
|
2853
|
+
"image/gif",
|
|
2854
|
+
"image/webp",
|
|
2855
|
+
"image/svg+xml"
|
|
2856
|
+
]);
|
|
2802
2857
|
var uploadFile = async ({
|
|
2803
2858
|
fileClient,
|
|
2804
2859
|
fileUrl,
|
|
2805
2860
|
directory,
|
|
2806
|
-
fileId
|
|
2861
|
+
fileId,
|
|
2862
|
+
warnIfLocalCopyMissing = true
|
|
2807
2863
|
}) => {
|
|
2808
2864
|
const key = `${fileId}-${fileUrl}`;
|
|
2809
2865
|
if (uploadQueueByKey.has(key)) {
|
|
@@ -2826,9 +2882,11 @@ var uploadFile = async ({
|
|
|
2826
2882
|
const expectedFilePath = join11(writeDirectory, FILES_DIRECTORY_NAME, localFileName);
|
|
2827
2883
|
const fileInspect = await fsj3.inspectAsync(expectedFilePath);
|
|
2828
2884
|
if (fileInspect?.type !== "file") {
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2885
|
+
if (warnIfLocalCopyMissing) {
|
|
2886
|
+
console.warn(
|
|
2887
|
+
`Skipping file ${fileUrl} as we couldn't find a local copy (looked at ${expectedFilePath})`
|
|
2888
|
+
);
|
|
2889
|
+
}
|
|
2832
2890
|
return null;
|
|
2833
2891
|
}
|
|
2834
2892
|
const fileName = getFileNameFromUrl(fileUrl);
|
|
@@ -2860,7 +2918,7 @@ var uploadFile = async ({
|
|
|
2860
2918
|
uploadBody = createReadStream(expectedFilePath);
|
|
2861
2919
|
}
|
|
2862
2920
|
const { width, height } = await (async () => {
|
|
2863
|
-
if (!
|
|
2921
|
+
if (!IMAGE_SIZE_SAFE_MEDIA_TYPES.has(mimeType)) {
|
|
2864
2922
|
return {
|
|
2865
2923
|
width: void 0,
|
|
2866
2924
|
height: void 0
|
|
@@ -2989,27 +3047,37 @@ var downloadFileForAsset = async ({
|
|
|
2989
3047
|
directory,
|
|
2990
3048
|
fileClient
|
|
2991
3049
|
}) => {
|
|
2992
|
-
|
|
3050
|
+
const fields = asset.asset.fields;
|
|
3051
|
+
if (!fields) {
|
|
2993
3052
|
return null;
|
|
2994
3053
|
}
|
|
2995
|
-
const fileId =
|
|
2996
|
-
|
|
2997
|
-
if (fileId === "" || fileUrl === "") {
|
|
3054
|
+
const fileId = fields.file?.value;
|
|
3055
|
+
if (!fileId) {
|
|
2998
3056
|
return null;
|
|
2999
3057
|
}
|
|
3000
|
-
|
|
3058
|
+
const fileUrl = fields.url?.value;
|
|
3059
|
+
if (!fileUrl) {
|
|
3060
|
+
return null;
|
|
3061
|
+
}
|
|
3062
|
+
return downloadFile({ fileUrl, fileId, directory, fileClient });
|
|
3001
3063
|
};
|
|
3002
3064
|
var uploadFileForAsset = async ({
|
|
3003
3065
|
asset,
|
|
3004
3066
|
directory,
|
|
3005
3067
|
fileClient
|
|
3006
3068
|
}) => {
|
|
3007
|
-
|
|
3069
|
+
const fileId = asset.asset.fields?.file?.value;
|
|
3070
|
+
const fileUrl = asset.asset.fields?.url?.value;
|
|
3071
|
+
if (fileId === void 0 || !fileUrl) {
|
|
3008
3072
|
return null;
|
|
3009
3073
|
}
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3074
|
+
return uploadFile({
|
|
3075
|
+
fileUrl,
|
|
3076
|
+
directory,
|
|
3077
|
+
fileClient,
|
|
3078
|
+
fileId,
|
|
3079
|
+
warnIfLocalCopyMissing: false
|
|
3080
|
+
});
|
|
3013
3081
|
};
|
|
3014
3082
|
var removeUrlsFromAssetParameters = (entity) => {
|
|
3015
3083
|
const treeWalker = ({ node }) => {
|
|
@@ -3311,6 +3379,25 @@ function writeCanvasPackage(filename, packageContents) {
|
|
|
3311
3379
|
|
|
3312
3380
|
// src/commands/canvas/commands/asset/pull.ts
|
|
3313
3381
|
var ASSET_PULL_ACTION_CONCURRENCY = 10;
|
|
3382
|
+
var prepareAssetForPull = async ({
|
|
3383
|
+
sourceObject,
|
|
3384
|
+
directory,
|
|
3385
|
+
fileClient
|
|
3386
|
+
}) => {
|
|
3387
|
+
delete sourceObject.object.asset._author;
|
|
3388
|
+
if (!sourceObject.object.asset.fields?.file) {
|
|
3389
|
+
return sourceObject;
|
|
3390
|
+
}
|
|
3391
|
+
const downloadedFile = await downloadFileForAsset({
|
|
3392
|
+
asset: sourceObject.object,
|
|
3393
|
+
directory,
|
|
3394
|
+
fileClient
|
|
3395
|
+
});
|
|
3396
|
+
if (downloadedFile?.id) {
|
|
3397
|
+
sourceObject.object.asset.fields.file.value = downloadedFile.id;
|
|
3398
|
+
}
|
|
3399
|
+
return sourceObject;
|
|
3400
|
+
};
|
|
3314
3401
|
var AssetPullModule = {
|
|
3315
3402
|
command: "pull <directory>",
|
|
3316
3403
|
describe: "Pulls all assets to local files in a directory",
|
|
@@ -3417,27 +3504,70 @@ var AssetPullModule = {
|
|
|
3417
3504
|
return sourceObject;
|
|
3418
3505
|
},
|
|
3419
3506
|
compareContents: compareAssetsWithoutUrls,
|
|
3420
|
-
onBeforeWriteObject:
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
const downloadedFile = await downloadFileForAsset({
|
|
3426
|
-
asset: sourceObject.object,
|
|
3427
|
-
directory,
|
|
3428
|
-
fileClient
|
|
3429
|
-
});
|
|
3430
|
-
if (downloadedFile?.id) {
|
|
3431
|
-
sourceObject.object.asset.fields.file.value = downloadedFile.id;
|
|
3432
|
-
}
|
|
3433
|
-
return sourceObject;
|
|
3434
|
-
}
|
|
3507
|
+
onBeforeWriteObject: (sourceObject) => prepareAssetForPull({
|
|
3508
|
+
sourceObject,
|
|
3509
|
+
directory,
|
|
3510
|
+
fileClient
|
|
3511
|
+
})
|
|
3435
3512
|
});
|
|
3436
3513
|
}
|
|
3437
3514
|
};
|
|
3438
3515
|
|
|
3439
3516
|
// src/commands/canvas/commands/asset/push.ts
|
|
3517
|
+
import { join as join13 } from "path";
|
|
3440
3518
|
var ASSET_PUSH_ACTION_CONCURRENCY = 10;
|
|
3519
|
+
var getExpectedFilePath = (directory, fileUrl) => {
|
|
3520
|
+
if (!fileUrl) {
|
|
3521
|
+
return "Unavailable because the asset has no file URL";
|
|
3522
|
+
}
|
|
3523
|
+
try {
|
|
3524
|
+
return join13(getFilesDirectory(directory), FILES_DIRECTORY_NAME, urlToFileName(fileUrl));
|
|
3525
|
+
} catch {
|
|
3526
|
+
return "Unavailable because the asset file URL is invalid";
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3529
|
+
var prepareAssetForPush = async ({
|
|
3530
|
+
sourceObject,
|
|
3531
|
+
directory,
|
|
3532
|
+
fileClient,
|
|
3533
|
+
targetProjectId
|
|
3534
|
+
}) => {
|
|
3535
|
+
const fields = sourceObject.object.asset.fields;
|
|
3536
|
+
const fileId = fields?.file?.value;
|
|
3537
|
+
if (!fields || !fileId) {
|
|
3538
|
+
return sourceObject;
|
|
3539
|
+
}
|
|
3540
|
+
const uploadedFile = await uploadFileForAsset({
|
|
3541
|
+
asset: sourceObject.object,
|
|
3542
|
+
directory,
|
|
3543
|
+
fileClient
|
|
3544
|
+
});
|
|
3545
|
+
if (!uploadedFile) {
|
|
3546
|
+
const assetId = sourceObject.object.asset._id;
|
|
3547
|
+
const fileUrl = fields.url?.value;
|
|
3548
|
+
const expectedFilePath = getExpectedFilePath(directory, fileUrl);
|
|
3549
|
+
throw new Error(
|
|
3550
|
+
[
|
|
3551
|
+
`Unable to push asset "${sourceObject.displayName ?? assetId}" (${assetId}) because its file could not be uploaded.`,
|
|
3552
|
+
`Source project ID: ${sourceObject.object.projectId ?? "Unavailable"}`,
|
|
3553
|
+
`Target project ID: ${targetProjectId}`,
|
|
3554
|
+
`File ID: ${fileId}`,
|
|
3555
|
+
`File URL: ${fileUrl || "Missing"}`,
|
|
3556
|
+
`Expected local path: ${expectedFilePath}`,
|
|
3557
|
+
`Remove the asset with the ID ${assetId} before pushing again.`
|
|
3558
|
+
].join("\n")
|
|
3559
|
+
);
|
|
3560
|
+
}
|
|
3561
|
+
fields.file = {
|
|
3562
|
+
type: "file",
|
|
3563
|
+
value: uploadedFile.id
|
|
3564
|
+
};
|
|
3565
|
+
fields.url = {
|
|
3566
|
+
type: "text",
|
|
3567
|
+
value: uploadedFile.url
|
|
3568
|
+
};
|
|
3569
|
+
return sourceObject;
|
|
3570
|
+
};
|
|
3441
3571
|
var AssetPushModule = {
|
|
3442
3572
|
command: "push <directory>",
|
|
3443
3573
|
describe: "Pushes all assets from files in a directory to Uniform",
|
|
@@ -3523,27 +3653,12 @@ var AssetPushModule = {
|
|
|
3523
3653
|
return sourceObject;
|
|
3524
3654
|
},
|
|
3525
3655
|
compareContents: compareAssetsWithoutUrls,
|
|
3526
|
-
onBeforeWriteObject:
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
if (uploadedFile !== null) {
|
|
3533
|
-
if (sourceObject.object.asset.fields === void 0) {
|
|
3534
|
-
sourceObject.object.asset.fields = {};
|
|
3535
|
-
}
|
|
3536
|
-
sourceObject.object.asset.fields.file = {
|
|
3537
|
-
type: "file",
|
|
3538
|
-
value: uploadedFile.id
|
|
3539
|
-
};
|
|
3540
|
-
sourceObject.object.asset.fields.url = {
|
|
3541
|
-
type: "text",
|
|
3542
|
-
value: uploadedFile.url
|
|
3543
|
-
};
|
|
3544
|
-
}
|
|
3545
|
-
return sourceObject;
|
|
3546
|
-
}
|
|
3656
|
+
onBeforeWriteObject: (sourceObject) => prepareAssetForPush({
|
|
3657
|
+
sourceObject,
|
|
3658
|
+
directory,
|
|
3659
|
+
fileClient,
|
|
3660
|
+
targetProjectId: projectId
|
|
3661
|
+
})
|
|
3547
3662
|
});
|
|
3548
3663
|
}
|
|
3549
3664
|
};
|
|
@@ -4644,28 +4759,16 @@ var selectIdentifier3 = (response) => {
|
|
|
4644
4759
|
}
|
|
4645
4760
|
return baseId;
|
|
4646
4761
|
};
|
|
4762
|
+
function parseCompositionSerializedId(providerId) {
|
|
4763
|
+
const [compositionId, editionId] = providerId.split(" (");
|
|
4764
|
+
return { compositionId, editionId: editionId?.slice(0, -1) };
|
|
4765
|
+
}
|
|
4647
4766
|
var selectDisplayName3 = (component) => {
|
|
4648
4767
|
const name = component.composition._name ?? component.composition._slug ?? component.composition._id;
|
|
4649
4768
|
const edition = component.editionId ? component.editionName ?? component.editionId : void 0;
|
|
4650
4769
|
return `${name} (pid: ${component.composition._id}${edition ? `, edition: ${edition}` : ""})`;
|
|
4651
4770
|
};
|
|
4652
4771
|
|
|
4653
|
-
// src/commands/canvas/util/serializedIds.ts
|
|
4654
|
-
function parseSerializedId(serializedId) {
|
|
4655
|
-
const [id, editionId] = serializedId.split(" (");
|
|
4656
|
-
return { id, editionId: editionId?.slice(0, -1) };
|
|
4657
|
-
}
|
|
4658
|
-
function splitSerializedIds(ids) {
|
|
4659
|
-
return ids.split(",").map((id) => id.trim()).filter(Boolean);
|
|
4660
|
-
}
|
|
4661
|
-
function toRawEntityIds(serializedIds) {
|
|
4662
|
-
return Array.from(new Set(serializedIds.map(toRawEntityId)));
|
|
4663
|
-
}
|
|
4664
|
-
function toRawEntityId(serializedId) {
|
|
4665
|
-
const { id, editionId } = parseSerializedId(serializedId);
|
|
4666
|
-
return editionId ?? id;
|
|
4667
|
-
}
|
|
4668
|
-
|
|
4669
4772
|
// src/commands/canvas/componentInstanceEngineDataSource.ts
|
|
4670
4773
|
function createComponentInstanceEngineDataSource({
|
|
4671
4774
|
client,
|
|
@@ -4675,47 +4778,36 @@ function createComponentInstanceEngineDataSource({
|
|
|
4675
4778
|
patternType,
|
|
4676
4779
|
verbose,
|
|
4677
4780
|
batchSize,
|
|
4678
|
-
editions = "all",
|
|
4679
4781
|
...clientOptions
|
|
4680
4782
|
}) {
|
|
4681
4783
|
const stateId = convertStateOption(state);
|
|
4682
4784
|
async function* getObjects() {
|
|
4683
|
-
const
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
state: stateId,
|
|
4694
|
-
patternType,
|
|
4695
|
-
editions
|
|
4696
|
-
};
|
|
4697
|
-
if (verbose) {
|
|
4698
|
-
console.log(`\u{1F41B} pull compositions: `, parameters);
|
|
4699
|
-
}
|
|
4700
|
-
return (await client.list(parameters)).compositions;
|
|
4701
|
-
},
|
|
4702
|
-
{
|
|
4703
|
-
pageSize,
|
|
4704
|
-
verbose,
|
|
4705
|
-
entityName: "compositions",
|
|
4706
|
-
// a raw id resolves to exactly one row, so the chunk bounds the result
|
|
4707
|
-
maxItems: editions === "raw" ? compositionIDsChunk?.length : void 0
|
|
4708
|
-
}
|
|
4709
|
-
);
|
|
4710
|
-
for await (const compositionListItem of componentInstances) {
|
|
4711
|
-
const result = {
|
|
4712
|
-
id: selectIdentifier3(compositionListItem),
|
|
4713
|
-
displayName: selectDisplayName3(compositionListItem),
|
|
4714
|
-
providerId: selectIdentifier3(compositionListItem),
|
|
4715
|
-
object: prepCompositionForDisk(compositionListItem)
|
|
4785
|
+
const componentInstances = paginateAsync(
|
|
4786
|
+
async (offset, limit2) => {
|
|
4787
|
+
const parameters = {
|
|
4788
|
+
...clientOptions,
|
|
4789
|
+
limit: limit2,
|
|
4790
|
+
offset,
|
|
4791
|
+
pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
|
|
4792
|
+
state: stateId,
|
|
4793
|
+
patternType,
|
|
4794
|
+
editions: "all"
|
|
4716
4795
|
};
|
|
4717
|
-
|
|
4718
|
-
|
|
4796
|
+
if (verbose) {
|
|
4797
|
+
console.log(`\u{1F41B} pull compositions: `, parameters);
|
|
4798
|
+
}
|
|
4799
|
+
return (await client.list(parameters)).compositions;
|
|
4800
|
+
},
|
|
4801
|
+
{ pageSize: batchSize ?? 100, verbose, entityName: "compositions" }
|
|
4802
|
+
);
|
|
4803
|
+
for await (const compositionListItem of componentInstances) {
|
|
4804
|
+
const result = {
|
|
4805
|
+
id: selectIdentifier3(compositionListItem),
|
|
4806
|
+
displayName: selectDisplayName3(compositionListItem),
|
|
4807
|
+
providerId: selectIdentifier3(compositionListItem),
|
|
4808
|
+
object: prepCompositionForDisk(compositionListItem)
|
|
4809
|
+
};
|
|
4810
|
+
yield result;
|
|
4719
4811
|
}
|
|
4720
4812
|
}
|
|
4721
4813
|
return {
|
|
@@ -4723,10 +4815,9 @@ function createComponentInstanceEngineDataSource({
|
|
|
4723
4815
|
objects: getObjects(),
|
|
4724
4816
|
deleteObject: async (providerId) => {
|
|
4725
4817
|
if (verbose) {
|
|
4726
|
-
console.log(`\u{1F41B} delete composition: (id: ${providerId})`);
|
|
4818
|
+
console.log(`\u{1F41B} delete composition: (id: ${parseCompositionSerializedId(providerId)})`);
|
|
4727
4819
|
}
|
|
4728
|
-
|
|
4729
|
-
await client.remove({ compositionId, editionId });
|
|
4820
|
+
await client.remove(parseCompositionSerializedId(providerId));
|
|
4730
4821
|
},
|
|
4731
4822
|
writeObject: async (object4) => {
|
|
4732
4823
|
if (verbose) {
|
|
@@ -4791,23 +4882,29 @@ var CompositionPublishModule = {
|
|
|
4791
4882
|
console.error(`Specify --all or composition ID(s) to publish.`);
|
|
4792
4883
|
process.exit(1);
|
|
4793
4884
|
}
|
|
4794
|
-
const
|
|
4885
|
+
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
4795
4886
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
4796
4887
|
const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
4797
|
-
const
|
|
4888
|
+
const source = createComponentInstanceEngineDataSource({
|
|
4798
4889
|
client,
|
|
4799
|
-
state,
|
|
4800
|
-
compositionIDs,
|
|
4801
|
-
|
|
4802
|
-
|
|
4890
|
+
state: "preview",
|
|
4891
|
+
compositionIDs: compositionIDsArray,
|
|
4892
|
+
onlyCompositions,
|
|
4893
|
+
onlyPatterns,
|
|
4894
|
+
patternType,
|
|
4895
|
+
verbose,
|
|
4896
|
+
batchSize: resolvedBatchSize
|
|
4897
|
+
});
|
|
4898
|
+
const target = createComponentInstanceEngineDataSource({
|
|
4899
|
+
client,
|
|
4900
|
+
state: "published",
|
|
4901
|
+
compositionIDs: compositionIDsArray,
|
|
4803
4902
|
onlyCompositions,
|
|
4804
4903
|
onlyPatterns,
|
|
4805
4904
|
patternType,
|
|
4806
4905
|
verbose,
|
|
4807
4906
|
batchSize: resolvedBatchSize
|
|
4808
4907
|
});
|
|
4809
|
-
const source = createDataSource("preview");
|
|
4810
|
-
const target = createDataSource("published");
|
|
4811
4908
|
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
4812
4909
|
await syncEngine({
|
|
4813
4910
|
source,
|
|
@@ -5364,7 +5461,7 @@ var CompositionUnpublishModule = {
|
|
|
5364
5461
|
console.error(`Specify --all or composition ID(s) to unpublish.`);
|
|
5365
5462
|
process.exit(1);
|
|
5366
5463
|
}
|
|
5367
|
-
const compositionIDsArray = ids ?
|
|
5464
|
+
const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
5368
5465
|
const targetItems = /* @__PURE__ */ new Map();
|
|
5369
5466
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
5370
5467
|
const client = getCompositionManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -5372,8 +5469,6 @@ var CompositionUnpublishModule = {
|
|
|
5372
5469
|
client,
|
|
5373
5470
|
state: "published",
|
|
5374
5471
|
compositionIDs: compositionIDsArray,
|
|
5375
|
-
// matched exactly as publish matches them, so the two stay inverses
|
|
5376
|
-
editions: compositionIDsArray ? "raw" : "all",
|
|
5377
5472
|
onlyCompositions,
|
|
5378
5473
|
onlyPatterns,
|
|
5379
5474
|
patternType,
|
|
@@ -5384,8 +5479,6 @@ var CompositionUnpublishModule = {
|
|
|
5384
5479
|
client,
|
|
5385
5480
|
state: "preview",
|
|
5386
5481
|
compositionIDs: compositionIDsArray,
|
|
5387
|
-
// matched exactly as publish matches them, so the two stay inverses
|
|
5388
|
-
editions: compositionIDsArray ? "raw" : "all",
|
|
5389
5482
|
onlyCompositions,
|
|
5390
5483
|
onlyPatterns,
|
|
5391
5484
|
patternType,
|
|
@@ -5412,9 +5505,8 @@ var CompositionUnpublishModule = {
|
|
|
5412
5505
|
console.log(`Composition ${id} did not have a draft (removing published)`);
|
|
5413
5506
|
}
|
|
5414
5507
|
if (!whatIf) {
|
|
5415
|
-
const { id: compositionId } = parseSerializedId(id);
|
|
5416
5508
|
actions.push(
|
|
5417
|
-
client.unpublish(
|
|
5509
|
+
client.unpublish(parseCompositionSerializedId(id)).catch((err) => {
|
|
5418
5510
|
const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
|
|
5419
5511
|
if (isNotFound) {
|
|
5420
5512
|
console.warn(
|
|
@@ -6695,6 +6787,10 @@ var selectEntryIdentifier = (e) => {
|
|
|
6695
6787
|
}
|
|
6696
6788
|
return baseId;
|
|
6697
6789
|
};
|
|
6790
|
+
function parseEntrySerializedId(providerId) {
|
|
6791
|
+
const [entryId, editionId] = providerId.split(" (");
|
|
6792
|
+
return { entryId, editionId: editionId?.slice(0, -1) };
|
|
6793
|
+
}
|
|
6698
6794
|
var selectEntryDisplayName = (e) => {
|
|
6699
6795
|
const name = e.entry._name ?? "Untitled";
|
|
6700
6796
|
const edition = e.editionId ? e.editionName ?? e.editionId : void 0;
|
|
@@ -6709,56 +6805,45 @@ function createEntryEngineDataSource({
|
|
|
6709
6805
|
onlyPatterns,
|
|
6710
6806
|
entryIDs,
|
|
6711
6807
|
batchSize,
|
|
6712
|
-
verbose
|
|
6713
|
-
editions = "all"
|
|
6808
|
+
verbose
|
|
6714
6809
|
}) {
|
|
6715
6810
|
const stateId = convertStateOption(state);
|
|
6716
6811
|
async function* getObjects() {
|
|
6717
|
-
const
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
if (error instanceof ApiClientError2 && error.errorMessage?.startsWith("Entry not found")) {
|
|
6732
|
-
return [];
|
|
6733
|
-
}
|
|
6734
|
-
throw error;
|
|
6812
|
+
const entries = paginateAsync(
|
|
6813
|
+
async (offset, limit2) => {
|
|
6814
|
+
try {
|
|
6815
|
+
return (await client.list({
|
|
6816
|
+
offset,
|
|
6817
|
+
limit: limit2,
|
|
6818
|
+
entryIDs,
|
|
6819
|
+
pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
|
|
6820
|
+
state: stateId,
|
|
6821
|
+
editions: "all"
|
|
6822
|
+
})).entries;
|
|
6823
|
+
} catch (error) {
|
|
6824
|
+
if (error instanceof ApiClientError2 && error.errorMessage === "Entry not found or not published") {
|
|
6825
|
+
return [];
|
|
6735
6826
|
}
|
|
6736
|
-
|
|
6737
|
-
{
|
|
6738
|
-
pageSize,
|
|
6739
|
-
verbose,
|
|
6740
|
-
entityName: "entries",
|
|
6741
|
-
// a raw id resolves to exactly one row, so the chunk bounds the result
|
|
6742
|
-
maxItems: editions === "raw" ? entryIDsChunk?.length : void 0
|
|
6827
|
+
throw error;
|
|
6743
6828
|
}
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
}
|
|
6829
|
+
},
|
|
6830
|
+
{ pageSize: batchSize ?? 100, verbose, entityName: "entries" }
|
|
6831
|
+
);
|
|
6832
|
+
for await (const e of entries) {
|
|
6833
|
+
const result = {
|
|
6834
|
+
id: selectEntryIdentifier(e),
|
|
6835
|
+
displayName: selectEntryDisplayName(e),
|
|
6836
|
+
providerId: selectEntryIdentifier(e),
|
|
6837
|
+
object: prepCompositionForDisk(e)
|
|
6838
|
+
};
|
|
6839
|
+
yield result;
|
|
6754
6840
|
}
|
|
6755
6841
|
}
|
|
6756
6842
|
return {
|
|
6757
6843
|
name: "Uniform API",
|
|
6758
6844
|
objects: getObjects(),
|
|
6759
6845
|
deleteObject: async (providerId) => {
|
|
6760
|
-
|
|
6761
|
-
await client.remove({ entryId, editionId });
|
|
6846
|
+
await client.remove(parseEntrySerializedId(providerId));
|
|
6762
6847
|
},
|
|
6763
6848
|
writeObject: async ({ object: object4 }) => {
|
|
6764
6849
|
await client.save({ ...convertEntryToPutEntry(object4), state: stateId });
|
|
@@ -6808,21 +6893,23 @@ var EntryPublishModule = {
|
|
|
6808
6893
|
console.error(`Specify --all or entry ID(s) to publish.`);
|
|
6809
6894
|
process.exit(1);
|
|
6810
6895
|
}
|
|
6811
|
-
const
|
|
6896
|
+
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
6812
6897
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
6813
6898
|
const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
6814
|
-
const
|
|
6899
|
+
const source = createEntryEngineDataSource({
|
|
6815
6900
|
client,
|
|
6816
|
-
state,
|
|
6817
|
-
entryIDs,
|
|
6818
|
-
|
|
6819
|
-
|
|
6901
|
+
state: "preview",
|
|
6902
|
+
entryIDs: entryIDsArray,
|
|
6903
|
+
onlyEntries: true,
|
|
6904
|
+
batchSize: resolvedBatchSize
|
|
6905
|
+
});
|
|
6906
|
+
const target = createEntryEngineDataSource({
|
|
6907
|
+
client,
|
|
6908
|
+
state: "published",
|
|
6909
|
+
entryIDs: entryIDsArray,
|
|
6820
6910
|
onlyEntries: true,
|
|
6821
|
-
verbose,
|
|
6822
6911
|
batchSize: resolvedBatchSize
|
|
6823
6912
|
});
|
|
6824
|
-
const source = createDataSource("preview");
|
|
6825
|
-
const target = createDataSource("published");
|
|
6826
6913
|
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
6827
6914
|
await syncEngine({
|
|
6828
6915
|
source,
|
|
@@ -7168,7 +7255,7 @@ var EntryUnpublishModule = {
|
|
|
7168
7255
|
console.error(`Specify --all or entry ID(s) to unpublish.`);
|
|
7169
7256
|
process.exit(1);
|
|
7170
7257
|
}
|
|
7171
|
-
const entryIDsArray = ids ?
|
|
7258
|
+
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
7172
7259
|
const targetItems = /* @__PURE__ */ new Map();
|
|
7173
7260
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
7174
7261
|
const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -7176,8 +7263,6 @@ var EntryUnpublishModule = {
|
|
|
7176
7263
|
client,
|
|
7177
7264
|
state: "published",
|
|
7178
7265
|
entryIDs: entryIDsArray,
|
|
7179
|
-
// matched exactly as publish matches them, so the two stay inverses
|
|
7180
|
-
editions: entryIDsArray ? "raw" : "all",
|
|
7181
7266
|
onlyEntries: true,
|
|
7182
7267
|
batchSize: resolvedBatchSize
|
|
7183
7268
|
});
|
|
@@ -7185,8 +7270,6 @@ var EntryUnpublishModule = {
|
|
|
7185
7270
|
client,
|
|
7186
7271
|
state: "preview",
|
|
7187
7272
|
entryIDs: entryIDsArray,
|
|
7188
|
-
// matched exactly as publish matches them, so the two stay inverses
|
|
7189
|
-
editions: entryIDsArray ? "raw" : "all",
|
|
7190
7273
|
onlyEntries: true,
|
|
7191
7274
|
batchSize: resolvedBatchSize
|
|
7192
7275
|
});
|
|
@@ -7210,9 +7293,8 @@ var EntryUnpublishModule = {
|
|
|
7210
7293
|
console.log(`Entry ${id} did not have a draft (removing published)`);
|
|
7211
7294
|
}
|
|
7212
7295
|
if (!whatIf) {
|
|
7213
|
-
const { id: entryId } = parseSerializedId(id);
|
|
7214
7296
|
actions.push(
|
|
7215
|
-
client.unpublish(
|
|
7297
|
+
client.unpublish(parseEntrySerializedId(id)).catch((err) => {
|
|
7216
7298
|
const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
|
|
7217
7299
|
if (isNotFound) {
|
|
7218
7300
|
console.warn(
|
|
@@ -7405,21 +7487,23 @@ var EntryPatternPublishModule = {
|
|
|
7405
7487
|
console.error(`Specify --all or entry pattern ID(s) to publish.`);
|
|
7406
7488
|
process.exit(1);
|
|
7407
7489
|
}
|
|
7408
|
-
const
|
|
7490
|
+
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
7409
7491
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
7410
7492
|
const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
7411
|
-
const
|
|
7493
|
+
const source = createEntryEngineDataSource({
|
|
7412
7494
|
client,
|
|
7413
|
-
state,
|
|
7414
|
-
entryIDs,
|
|
7415
|
-
|
|
7416
|
-
|
|
7495
|
+
state: "preview",
|
|
7496
|
+
entryIDs: entryIDsArray,
|
|
7497
|
+
onlyPatterns: true,
|
|
7498
|
+
batchSize: resolvedBatchSize
|
|
7499
|
+
});
|
|
7500
|
+
const target = createEntryEngineDataSource({
|
|
7501
|
+
client,
|
|
7502
|
+
state: "published",
|
|
7503
|
+
entryIDs: entryIDsArray,
|
|
7417
7504
|
onlyPatterns: true,
|
|
7418
|
-
verbose,
|
|
7419
7505
|
batchSize: resolvedBatchSize
|
|
7420
7506
|
});
|
|
7421
|
-
const source = createDataSource("preview");
|
|
7422
|
-
const target = createDataSource("published");
|
|
7423
7507
|
const fileClient = getFileClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
7424
7508
|
await syncEngine({
|
|
7425
7509
|
source,
|
|
@@ -7739,7 +7823,7 @@ var EntryPatternUnpublishModule = {
|
|
|
7739
7823
|
console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
|
|
7740
7824
|
process.exit(1);
|
|
7741
7825
|
}
|
|
7742
|
-
const entryIDsArray = ids ?
|
|
7826
|
+
const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
|
|
7743
7827
|
const targetItems = /* @__PURE__ */ new Map();
|
|
7744
7828
|
const fetch2 = nodeFetchProxy(proxy, verbose);
|
|
7745
7829
|
const client = getEntryManagementClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
|
@@ -7747,8 +7831,6 @@ var EntryPatternUnpublishModule = {
|
|
|
7747
7831
|
client,
|
|
7748
7832
|
state: "published",
|
|
7749
7833
|
entryIDs: entryIDsArray,
|
|
7750
|
-
// matched exactly as publish matches them, so the two stay inverses
|
|
7751
|
-
editions: entryIDsArray ? "raw" : "all",
|
|
7752
7834
|
onlyPatterns: true,
|
|
7753
7835
|
batchSize: resolvedBatchSize
|
|
7754
7836
|
});
|
|
@@ -7756,8 +7838,6 @@ var EntryPatternUnpublishModule = {
|
|
|
7756
7838
|
client,
|
|
7757
7839
|
state: "preview",
|
|
7758
7840
|
entryIDs: entryIDsArray,
|
|
7759
|
-
// matched exactly as publish matches them, so the two stay inverses
|
|
7760
|
-
editions: entryIDsArray ? "raw" : "all",
|
|
7761
7841
|
onlyPatterns: true,
|
|
7762
7842
|
batchSize: resolvedBatchSize
|
|
7763
7843
|
});
|
|
@@ -7781,9 +7861,8 @@ var EntryPatternUnpublishModule = {
|
|
|
7781
7861
|
console.log(`Entry pattern ${id} did not have a draft (removing published)`);
|
|
7782
7862
|
}
|
|
7783
7863
|
if (!whatIf) {
|
|
7784
|
-
const { id: entryId } = parseSerializedId(id);
|
|
7785
7864
|
actions.push(
|
|
7786
|
-
client.unpublish(
|
|
7865
|
+
client.unpublish(parseEntrySerializedId(id)).catch((err) => {
|
|
7787
7866
|
const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
|
|
7788
7867
|
if (isNotFound) {
|
|
7789
7868
|
console.warn(
|
|
@@ -12109,7 +12188,7 @@ var PolicyDocumentsPullModule = {
|
|
|
12109
12188
|
// src/commands/policy-documents/commands/push.ts
|
|
12110
12189
|
import { existsSync as existsSync8, mkdirSync as mkdirSync4 } from "fs";
|
|
12111
12190
|
import { readdir as readdir2 } from "fs/promises";
|
|
12112
|
-
import { extname as extname3, join as
|
|
12191
|
+
import { extname as extname3, join as join14 } from "path";
|
|
12113
12192
|
async function readLocalPolicyDocuments(directory, format, verbose) {
|
|
12114
12193
|
const files = await readdir2(directory);
|
|
12115
12194
|
const policyDocuments = {};
|
|
@@ -12119,7 +12198,7 @@ async function readLocalPolicyDocuments(directory, format, verbose) {
|
|
|
12119
12198
|
if (ext !== `.${format}` && ext !== ".yaml" && ext !== ".yml" && ext !== ".json") {
|
|
12120
12199
|
continue;
|
|
12121
12200
|
}
|
|
12122
|
-
const filePath =
|
|
12201
|
+
const filePath = join14(directory, filename);
|
|
12123
12202
|
try {
|
|
12124
12203
|
let roleId = filename.replace(ext, "");
|
|
12125
12204
|
const fileContent = readFileToObject(filePath);
|
|
@@ -13556,7 +13635,7 @@ var WebhookPullModule = {
|
|
|
13556
13635
|
// src/commands/sync/commands/util.ts
|
|
13557
13636
|
import ora2 from "ora";
|
|
13558
13637
|
async function spinPromise(action, options) {
|
|
13559
|
-
const { failText } = options;
|
|
13638
|
+
const { successText, failText } = typeof options === "object" ? options : { successText: void 0, failText: void 0 };
|
|
13560
13639
|
const spinner = ora2(options).start();
|
|
13561
13640
|
const consoleReplay = [];
|
|
13562
13641
|
const revertLog = patchConsole({
|
|
@@ -13594,7 +13673,6 @@ async function spinPromise(action, options) {
|
|
|
13594
13673
|
process.on("SIGINT", executeReplayOnSigint);
|
|
13595
13674
|
try {
|
|
13596
13675
|
const result = await action;
|
|
13597
|
-
const successText = typeof options.successText === "function" ? options.successText(result) : options.successText;
|
|
13598
13676
|
const finalStatusText = spinner.text.startsWith(options.text) && spinner.text.length > options.text.length ? spinner.text.slice(options.text.length).trim() : `\u2699\uFE0F compared: ${numPad(0)} changes: 0`;
|
|
13599
13677
|
const padding = " ".repeat(Math.max(4, 40 - successText.length));
|
|
13600
13678
|
spinner.succeed(successText + padding + finalStatusText);
|
|
@@ -13876,115 +13954,160 @@ var SyncPushModule = {
|
|
|
13876
13954
|
"No entities were configured to be pushed. Please make sure you have configuration file and at least one entity type is enabled."
|
|
13877
13955
|
);
|
|
13878
13956
|
}
|
|
13879
|
-
const
|
|
13880
|
-
for (const { entityType } of publishableEntities) {
|
|
13957
|
+
for (const [entityType, module] of enabledEntities) {
|
|
13881
13958
|
try {
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13959
|
+
await spinPromise(
|
|
13960
|
+
module.handler({
|
|
13961
|
+
...otherParams,
|
|
13962
|
+
state: 0,
|
|
13963
|
+
format: getFormat2(entityType, config2),
|
|
13964
|
+
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
13965
|
+
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
13966
|
+
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
|
|
13967
|
+
mode: getPushMode(entityType, config2),
|
|
13968
|
+
directory: getPushFilename(entityType, config2),
|
|
13969
|
+
allowEmptySource: config2.allowEmptySource,
|
|
13970
|
+
...isPaginatedSyncEntity(entityType) ? { resolvedBatchSize: getEntityBatchSize(entityType, config2) } : {}
|
|
13971
|
+
}),
|
|
13972
|
+
{
|
|
13973
|
+
text: `${entityType}...`,
|
|
13974
|
+
successText: entityType,
|
|
13975
|
+
failText(error) {
|
|
13976
|
+
return `${entityType}
|
|
13977
|
+
|
|
13978
|
+
${error.stack ?? error.message}`;
|
|
13979
|
+
}
|
|
13980
|
+
}
|
|
13981
|
+
);
|
|
13982
|
+
} catch {
|
|
13885
13983
|
process.exit(1);
|
|
13886
13984
|
}
|
|
13887
13985
|
}
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
const entityConfig = config2.entitiesConfig?.[entityType];
|
|
13913
|
-
const scope = publishScopes.get(entityType);
|
|
13914
|
-
if (entityConfig?.disabled === true || entityConfig?.push?.disabled === true || !scope) {
|
|
13915
|
-
continue;
|
|
13986
|
+
if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
|
|
13987
|
+
try {
|
|
13988
|
+
await spinPromise(
|
|
13989
|
+
ComponentPatternPublishModule.handler({
|
|
13990
|
+
...otherParams,
|
|
13991
|
+
serialization: config2,
|
|
13992
|
+
patternType: "component",
|
|
13993
|
+
onlyPatterns: true,
|
|
13994
|
+
all: true,
|
|
13995
|
+
directory: getPushFilename("componentPattern", config2),
|
|
13996
|
+
resolvedBatchSize: getEntityBatchSize("componentPattern", config2)
|
|
13997
|
+
}),
|
|
13998
|
+
{
|
|
13999
|
+
text: "publishing component patterns...",
|
|
14000
|
+
successText: "published component patterns",
|
|
14001
|
+
failText(error) {
|
|
14002
|
+
return `publishing component patterns
|
|
14003
|
+
|
|
14004
|
+
${error.stack ?? error.message}`;
|
|
14005
|
+
}
|
|
14006
|
+
}
|
|
14007
|
+
);
|
|
14008
|
+
} catch {
|
|
14009
|
+
process.exit(1);
|
|
13916
14010
|
}
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
14011
|
+
}
|
|
14012
|
+
if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
|
|
14013
|
+
try {
|
|
14014
|
+
await spinPromise(
|
|
14015
|
+
CompositionPatternPublishModule.handler({
|
|
14016
|
+
...otherParams,
|
|
14017
|
+
serialization: config2,
|
|
14018
|
+
all: true,
|
|
14019
|
+
onlyPatterns: true,
|
|
14020
|
+
patternType: "composition",
|
|
14021
|
+
directory: getPushFilename("compositionPattern", config2),
|
|
14022
|
+
resolvedBatchSize: getEntityBatchSize("compositionPattern", config2)
|
|
14023
|
+
}),
|
|
14024
|
+
{
|
|
14025
|
+
text: "publishing composition patterns...",
|
|
14026
|
+
successText: "published composition patterns",
|
|
14027
|
+
failText(error) {
|
|
14028
|
+
return `publishing composition patterns
|
|
14029
|
+
|
|
14030
|
+
${error.stack ?? error.message}`;
|
|
14031
|
+
}
|
|
13926
14032
|
}
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
14033
|
+
);
|
|
14034
|
+
} catch {
|
|
14035
|
+
process.exit(1);
|
|
14036
|
+
}
|
|
14037
|
+
}
|
|
14038
|
+
if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
|
|
14039
|
+
try {
|
|
14040
|
+
await spinPromise(
|
|
14041
|
+
CompositionPublishModule.handler({
|
|
14042
|
+
...otherParams,
|
|
14043
|
+
serialization: config2,
|
|
14044
|
+
all: true,
|
|
14045
|
+
onlyCompositions: true,
|
|
14046
|
+
directory: getPushFilename("composition", config2),
|
|
14047
|
+
resolvedBatchSize: getEntityBatchSize("composition", config2)
|
|
14048
|
+
}),
|
|
14049
|
+
{
|
|
14050
|
+
text: "publishing compositions...",
|
|
14051
|
+
successText: "published compositions",
|
|
14052
|
+
failText(error) {
|
|
14053
|
+
return `publishing compositions
|
|
14054
|
+
|
|
14055
|
+
${error.stack ?? error.message}`;
|
|
13932
14056
|
}
|
|
13933
|
-
ids = written.join(",");
|
|
13934
14057
|
}
|
|
13935
|
-
|
|
14058
|
+
);
|
|
14059
|
+
} catch {
|
|
14060
|
+
process.exit(1);
|
|
14061
|
+
}
|
|
14062
|
+
}
|
|
14063
|
+
if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
|
|
14064
|
+
try {
|
|
14065
|
+
await spinPromise(
|
|
14066
|
+
EntryPublishModule.handler({
|
|
13936
14067
|
...otherParams,
|
|
13937
14068
|
serialization: config2,
|
|
13938
|
-
all:
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
14069
|
+
all: true,
|
|
14070
|
+
directory: getPushFilename("entry", config2),
|
|
14071
|
+
resolvedBatchSize: getEntityBatchSize("entry", config2)
|
|
14072
|
+
}),
|
|
14073
|
+
{
|
|
14074
|
+
text: "publishing entries...",
|
|
14075
|
+
successText: "published entries",
|
|
14076
|
+
failText(error) {
|
|
14077
|
+
return `publishing entries
|
|
14078
|
+
|
|
14079
|
+
${error.stack ?? error.message}`;
|
|
14080
|
+
}
|
|
14081
|
+
}
|
|
14082
|
+
);
|
|
14083
|
+
} catch {
|
|
14084
|
+
process.exit(1);
|
|
14085
|
+
}
|
|
13947
14086
|
}
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
{ entityType: "entryPattern", module: EntryPatternPublishModule, label: "entry patterns" }
|
|
13964
|
-
];
|
|
13965
|
-
var getEntityDiscriminators = (entityType) => ({
|
|
13966
|
-
onlyCompositions: entityType === "composition" ? true : void 0,
|
|
13967
|
-
onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
|
|
13968
|
-
patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0
|
|
13969
|
-
});
|
|
13970
|
-
var runStep = async ({
|
|
13971
|
-
text,
|
|
13972
|
-
successText,
|
|
13973
|
-
failLabel,
|
|
13974
|
-
run
|
|
13975
|
-
}) => {
|
|
13976
|
-
try {
|
|
13977
|
-
await spinPromise(run(), {
|
|
13978
|
-
text,
|
|
13979
|
-
successText,
|
|
13980
|
-
failText(error) {
|
|
13981
|
-
return `${failLabel}
|
|
14087
|
+
if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
|
|
14088
|
+
try {
|
|
14089
|
+
await spinPromise(
|
|
14090
|
+
EntryPatternPublishModule.handler({
|
|
14091
|
+
...otherParams,
|
|
14092
|
+
serialization: config2,
|
|
14093
|
+
all: true,
|
|
14094
|
+
directory: getPushFilename("entryPattern", config2),
|
|
14095
|
+
resolvedBatchSize: getEntityBatchSize("entryPattern", config2)
|
|
14096
|
+
}),
|
|
14097
|
+
{
|
|
14098
|
+
text: "publishing entry patterns...",
|
|
14099
|
+
successText: "published entry patterns",
|
|
14100
|
+
failText(error) {
|
|
14101
|
+
return `publishing entry patterns
|
|
13982
14102
|
|
|
13983
14103
|
${error.stack ?? error.message}`;
|
|
14104
|
+
}
|
|
14105
|
+
}
|
|
14106
|
+
);
|
|
14107
|
+
} catch {
|
|
14108
|
+
process.exit(1);
|
|
13984
14109
|
}
|
|
13985
|
-
}
|
|
13986
|
-
} catch {
|
|
13987
|
-
process.exit(1);
|
|
14110
|
+
}
|
|
13988
14111
|
}
|
|
13989
14112
|
};
|
|
13990
14113
|
var getPushMode = (entityType, config2) => {
|
|
@@ -14083,14 +14206,14 @@ import { existsSync as existsSync9, promises as fs8 } from "fs";
|
|
|
14083
14206
|
import { get as getHttp } from "http";
|
|
14084
14207
|
import { get as getHttps } from "https";
|
|
14085
14208
|
import { tmpdir as tmpdir2 } from "os";
|
|
14086
|
-
import { join as
|
|
14209
|
+
import { join as join15 } from "path";
|
|
14087
14210
|
import registryUrl from "registry-url";
|
|
14088
14211
|
import { URL as URL2 } from "url";
|
|
14089
14212
|
var compareVersions = (a, b) => a.localeCompare(b, "en-US", { numeric: true });
|
|
14090
14213
|
var encode = (value) => encodeURIComponent(value).replace(/^%40/, "@");
|
|
14091
14214
|
var getFile = async (details, distTag) => {
|
|
14092
14215
|
const rootDir = tmpdir2();
|
|
14093
|
-
const subDir =
|
|
14216
|
+
const subDir = join15(rootDir, "update-check");
|
|
14094
14217
|
if (!existsSync9(subDir)) {
|
|
14095
14218
|
await fs8.mkdir(subDir);
|
|
14096
14219
|
}
|
|
@@ -14098,7 +14221,7 @@ var getFile = async (details, distTag) => {
|
|
|
14098
14221
|
if (details.scope) {
|
|
14099
14222
|
name = `${details.scope}-${name}`;
|
|
14100
14223
|
}
|
|
14101
|
-
return
|
|
14224
|
+
return join15(subDir, name);
|
|
14102
14225
|
};
|
|
14103
14226
|
var evaluateCache = async (file, time, interval) => {
|
|
14104
14227
|
if (existsSync9(file)) {
|
|
@@ -14253,7 +14376,7 @@ var checkForUpdateMiddleware = async ({ verbose }) => {
|
|
|
14253
14376
|
|
|
14254
14377
|
// src/middleware/checkLocalDepsVersionsMiddleware.ts
|
|
14255
14378
|
import { magenta, red as red8 } from "colorette";
|
|
14256
|
-
import { join as
|
|
14379
|
+
import { join as join16 } from "path";
|
|
14257
14380
|
var uniformStrictVersions = [
|
|
14258
14381
|
"@uniformdev/canvas",
|
|
14259
14382
|
"@uniformdev/canvas-next",
|
|
@@ -14275,7 +14398,7 @@ var checkLocalDepsVersions = async (args) => {
|
|
|
14275
14398
|
try {
|
|
14276
14399
|
let isOutside = false;
|
|
14277
14400
|
let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
|
|
14278
|
-
const localPackages = await tryReadJSON(
|
|
14401
|
+
const localPackages = await tryReadJSON(join16(process.cwd(), "package.json"));
|
|
14279
14402
|
if (!localPackages) return;
|
|
14280
14403
|
let firstVersion;
|
|
14281
14404
|
const allDependencies = {
|