@uniformdev/cli 20.67.1-alpha.22 → 20.67.1-alpha.27
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 +20 -72
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -724,7 +724,6 @@ function writeUniformPackage(filename, packageContents) {
|
|
|
724
724
|
// src/sync/syncEngine.ts
|
|
725
725
|
import { diffJson, diffLines } from "diff";
|
|
726
726
|
import mitt from "mitt";
|
|
727
|
-
import PQueue from "p-queue";
|
|
728
727
|
|
|
729
728
|
// src/sync/serializedDequal.ts
|
|
730
729
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -778,7 +777,6 @@ function serializedDequal(foo, bar) {
|
|
|
778
777
|
}
|
|
779
778
|
|
|
780
779
|
// src/sync/syncEngine.ts
|
|
781
|
-
var DEFAULT_SYNC_ACTION_CONCURRENCY = 10;
|
|
782
780
|
var syncEngineEvents = mitt();
|
|
783
781
|
async function syncEngine({
|
|
784
782
|
source,
|
|
@@ -792,8 +790,7 @@ async function syncEngine({
|
|
|
792
790
|
onBeforeProcessObject,
|
|
793
791
|
onBeforeCompareObjects,
|
|
794
792
|
onBeforeWriteObject,
|
|
795
|
-
onError
|
|
796
|
-
actionConcurrency = DEFAULT_SYNC_ACTION_CONCURRENCY
|
|
793
|
+
onError
|
|
797
794
|
//verbose = false,
|
|
798
795
|
}) {
|
|
799
796
|
const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
|
|
@@ -912,7 +909,7 @@ async function syncEngine({
|
|
|
912
909
|
deletes.push(() => processDelete(targetObject));
|
|
913
910
|
}
|
|
914
911
|
actions.push(
|
|
915
|
-
() =>
|
|
912
|
+
() => Promise.all(deletes.map((deleteFn) => deleteFn())).then(() => processUpsert(sourceObject, ids[0]))
|
|
916
913
|
);
|
|
917
914
|
} else {
|
|
918
915
|
actions.push(() => processUpsert(sourceObject, ids[0]));
|
|
@@ -931,18 +928,11 @@ async function syncEngine({
|
|
|
931
928
|
targetItems.forEach((object4) => {
|
|
932
929
|
deletes.push(() => processDelete(object4));
|
|
933
930
|
});
|
|
934
|
-
await
|
|
931
|
+
await Promise.all(deletes.map((d) => d()));
|
|
935
932
|
}
|
|
936
|
-
await
|
|
933
|
+
await Promise.all(actions.map((a) => a()));
|
|
937
934
|
await Promise.all([source.onSyncComplete?.(false), target.onSyncComplete?.(true)]);
|
|
938
935
|
}
|
|
939
|
-
var runSyncActions = async (actions, actionConcurrency) => {
|
|
940
|
-
if (actions.length === 0) {
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
|
-
const queue = new PQueue({ concurrency: actionConcurrency });
|
|
944
|
-
await queue.addAll(actions);
|
|
945
|
-
};
|
|
946
936
|
var SyncEngineError = class _SyncEngineError extends Error {
|
|
947
937
|
constructor(innerError, sourceObject) {
|
|
948
938
|
super(
|
|
@@ -2210,59 +2200,20 @@ import {
|
|
|
2210
2200
|
} from "@uniformdev/canvas";
|
|
2211
2201
|
import { isRichTextNodeType, isRichTextValue, walkRichTextTree } from "@uniformdev/richtext";
|
|
2212
2202
|
import fsj4 from "fs-jetpack";
|
|
2213
|
-
import
|
|
2203
|
+
import PQueue2 from "p-queue";
|
|
2214
2204
|
import { join as join10 } from "path";
|
|
2215
2205
|
|
|
2216
2206
|
// src/files/downloadFile.ts
|
|
2217
|
-
import { createWriteStream } from "fs";
|
|
2218
2207
|
import fsj2 from "fs-jetpack";
|
|
2219
|
-
import {
|
|
2220
|
-
import { Readable } from "stream";
|
|
2221
|
-
import { pipeline } from "stream/promises";
|
|
2222
|
-
var downloadedFilePathCacheByDirectory = /* @__PURE__ */ new Map();
|
|
2223
|
-
var getDownloadedFilePathCache = (filesDirectory) => {
|
|
2224
|
-
const cached = downloadedFilePathCacheByDirectory.get(filesDirectory);
|
|
2225
|
-
if (cached) {
|
|
2226
|
-
return cached;
|
|
2227
|
-
}
|
|
2228
|
-
const cache = fsj2.cwd(filesDirectory).findAsync({ files: true, directories: false }).then((paths) => new Set(paths)).catch(() => /* @__PURE__ */ new Set());
|
|
2229
|
-
downloadedFilePathCacheByDirectory.set(filesDirectory, cache);
|
|
2230
|
-
return cache;
|
|
2231
|
-
};
|
|
2232
|
-
var filePathMatchesSourceId = (filePath, sourceId) => filePath === sourceId || filePath.startsWith(`${sourceId}.`);
|
|
2233
|
-
var hasFilePathMatchingSourceId = (filePaths, sourceId) => {
|
|
2234
|
-
for (const filePath of filePaths) {
|
|
2235
|
-
if (filePathMatchesSourceId(filePath, sourceId)) {
|
|
2236
|
-
return true;
|
|
2237
|
-
}
|
|
2238
|
-
}
|
|
2239
|
-
return false;
|
|
2240
|
-
};
|
|
2241
|
-
var writeResponseBodyToFile = async (response, filePath) => {
|
|
2242
|
-
if (!response.body) {
|
|
2243
|
-
throw new Error("Response does not contain a body");
|
|
2244
|
-
}
|
|
2245
|
-
const tempFilePath = `${filePath}.${process.pid}.${Date.now()}.download`;
|
|
2246
|
-
await fsj2.dirAsync(dirname2(filePath));
|
|
2247
|
-
try {
|
|
2248
|
-
const responseBody = response.body;
|
|
2249
|
-
await pipeline(Readable.fromWeb(responseBody), createWriteStream(tempFilePath));
|
|
2250
|
-
await fsj2.moveAsync(tempFilePath, filePath, { overwrite: true });
|
|
2251
|
-
} catch (error) {
|
|
2252
|
-
await fsj2.removeAsync(tempFilePath).catch(() => void 0);
|
|
2253
|
-
throw error;
|
|
2254
|
-
}
|
|
2255
|
-
};
|
|
2208
|
+
import { join as join8 } from "path";
|
|
2256
2209
|
var downloadFile = async ({
|
|
2257
2210
|
fileClient,
|
|
2258
2211
|
fileUrl,
|
|
2259
2212
|
directory
|
|
2260
2213
|
}) => {
|
|
2261
2214
|
const writeDirectory = getFilesDirectory(directory);
|
|
2262
|
-
const filesDirectory = join8(writeDirectory, FILES_DIRECTORY_NAME);
|
|
2263
2215
|
const fileName = urlToFileName(fileUrl.toString());
|
|
2264
|
-
const
|
|
2265
|
-
const fileAlreadyExists = await fsj2.existsAsync(filePath);
|
|
2216
|
+
const fileAlreadyExists = await fsj2.existsAsync(join8(writeDirectory, FILES_DIRECTORY_NAME, fileName));
|
|
2266
2217
|
if (fileAlreadyExists) {
|
|
2267
2218
|
return { url: fileUrl };
|
|
2268
2219
|
}
|
|
@@ -2272,10 +2223,11 @@ var downloadFile = async ({
|
|
|
2272
2223
|
return null;
|
|
2273
2224
|
}
|
|
2274
2225
|
if (file.sourceId) {
|
|
2275
|
-
const sourceId = file.sourceId;
|
|
2276
2226
|
try {
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2227
|
+
const hashAlreadyExists = await fsj2.findAsync(join8(writeDirectory, FILES_DIRECTORY_NAME), {
|
|
2228
|
+
matching: [file.sourceId, `${file.sourceId}.*`]
|
|
2229
|
+
});
|
|
2230
|
+
if (hashAlreadyExists.length > 0) {
|
|
2279
2231
|
return { id: file.id, url: fileUrl };
|
|
2280
2232
|
}
|
|
2281
2233
|
} catch {
|
|
@@ -2286,12 +2238,8 @@ var downloadFile = async ({
|
|
|
2286
2238
|
if (!response.ok) {
|
|
2287
2239
|
return null;
|
|
2288
2240
|
}
|
|
2289
|
-
await
|
|
2290
|
-
|
|
2291
|
-
if (downloadedFilePathCache) {
|
|
2292
|
-
const downloadedFilePaths = await downloadedFilePathCache;
|
|
2293
|
-
downloadedFilePaths.add(fileName);
|
|
2294
|
-
}
|
|
2241
|
+
const fileBuffer = await response.arrayBuffer();
|
|
2242
|
+
await fsj2.writeAsync(join8(writeDirectory, FILES_DIRECTORY_NAME, fileName), Buffer.from(fileBuffer));
|
|
2295
2243
|
return { id: file.id, url: fileUrl };
|
|
2296
2244
|
};
|
|
2297
2245
|
|
|
@@ -2303,10 +2251,10 @@ import { createReadStream } from "fs";
|
|
|
2303
2251
|
import fsj3 from "fs-jetpack";
|
|
2304
2252
|
import { imageSizeFromFile } from "image-size/fromFile";
|
|
2305
2253
|
import normalizeNewline from "normalize-newline";
|
|
2306
|
-
import
|
|
2254
|
+
import PQueue from "p-queue";
|
|
2307
2255
|
import { join as join9 } from "path";
|
|
2308
2256
|
var uploadQueueByKey = /* @__PURE__ */ new Map();
|
|
2309
|
-
var fileUploadQueue = new
|
|
2257
|
+
var fileUploadQueue = new PQueue({ concurrency: 10 });
|
|
2310
2258
|
var uploadFile = async ({
|
|
2311
2259
|
fileClient,
|
|
2312
2260
|
fileUrl,
|
|
@@ -2486,9 +2434,9 @@ var walkFileUrlsForCompositionOrEntry = ({
|
|
|
2486
2434
|
};
|
|
2487
2435
|
|
|
2488
2436
|
// src/files/files.ts
|
|
2489
|
-
var fileDownloadQueue = new
|
|
2490
|
-
var fileUploadQueue2 = new
|
|
2491
|
-
var fileUrlReplacementQueue = new
|
|
2437
|
+
var fileDownloadQueue = new PQueue2({ concurrency: 10 });
|
|
2438
|
+
var fileUploadQueue2 = new PQueue2({ concurrency: 10 });
|
|
2439
|
+
var fileUrlReplacementQueue = new PQueue2({ concurrency: 10 });
|
|
2492
2440
|
var downloadFileForAsset = async ({
|
|
2493
2441
|
asset,
|
|
2494
2442
|
directory,
|
|
@@ -12834,7 +12782,7 @@ import yargs40 from "yargs";
|
|
|
12834
12782
|
|
|
12835
12783
|
// src/webhooksClient.ts
|
|
12836
12784
|
import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
|
|
12837
|
-
import
|
|
12785
|
+
import PQueue3 from "p-queue";
|
|
12838
12786
|
import { Svix } from "svix";
|
|
12839
12787
|
import * as z3 from "zod";
|
|
12840
12788
|
var WEBHOOKS_DASHBOARD_BASE_PATH = "/api/v1/svix-dashboard";
|
|
@@ -12882,7 +12830,7 @@ var WebhooksClient = class extends ApiClient4 {
|
|
|
12882
12830
|
};
|
|
12883
12831
|
}
|
|
12884
12832
|
async get() {
|
|
12885
|
-
const webhooksAPIQueue = new
|
|
12833
|
+
const webhooksAPIQueue = new PQueue3({ concurrency: 10 });
|
|
12886
12834
|
const { appId, token } = await this.getToken();
|
|
12887
12835
|
const svix = new Svix(token);
|
|
12888
12836
|
const getEndpoints = async ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/cli",
|
|
3
|
-
"version": "20.67.1-alpha.
|
|
3
|
+
"version": "20.67.1-alpha.27+003af30589",
|
|
4
4
|
"description": "Uniform command line interface tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./cli.js",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@inquirer/prompts": "^7.10.1",
|
|
29
29
|
"@thi.ng/mime": "^2.2.23",
|
|
30
|
-
"@uniformdev/assets": "20.67.1-alpha.
|
|
31
|
-
"@uniformdev/canvas": "20.67.1-alpha.
|
|
32
|
-
"@uniformdev/context": "20.67.1-alpha.
|
|
33
|
-
"@uniformdev/files": "20.67.1-alpha.
|
|
34
|
-
"@uniformdev/project-map": "20.67.1-alpha.
|
|
35
|
-
"@uniformdev/redirect": "20.67.1-alpha.
|
|
36
|
-
"@uniformdev/richtext": "20.67.1-alpha.
|
|
30
|
+
"@uniformdev/assets": "20.67.1-alpha.27+003af30589",
|
|
31
|
+
"@uniformdev/canvas": "20.67.1-alpha.27+003af30589",
|
|
32
|
+
"@uniformdev/context": "20.67.1-alpha.27+003af30589",
|
|
33
|
+
"@uniformdev/files": "20.67.1-alpha.27+003af30589",
|
|
34
|
+
"@uniformdev/project-map": "20.67.1-alpha.27+003af30589",
|
|
35
|
+
"@uniformdev/redirect": "20.67.1-alpha.27+003af30589",
|
|
36
|
+
"@uniformdev/richtext": "20.67.1-alpha.27+003af30589",
|
|
37
37
|
"call-bind": "^1.0.2",
|
|
38
38
|
"colorette": "2.0.20",
|
|
39
39
|
"cosmiconfig": "9.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "003af30589ea6dc98fb59f0dba35d82d4ee939d2"
|
|
84
84
|
}
|