@uniformdev/cli 19.183.1-alpha.4 → 19.184.1-alpha.0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +69 -88
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -244,25 +244,24 @@ async function syncEngine({
244
244
  const processDelete = async (object) => {
245
245
  if (deleteTracker.has(object)) return;
246
246
  deleteTracker.add(object);
247
- try {
248
- if (!whatIf) {
247
+ if (!whatIf) {
248
+ try {
249
249
  await target.deleteObject(object.providerId, object);
250
+ log({
251
+ action: "delete",
252
+ id: object.id[0],
253
+ providerId: object.providerId,
254
+ displayName: object.displayName ?? object.providerId,
255
+ whatIf,
256
+ diff: diffLines(JSON.stringify(object.object, null, 2), "")
257
+ });
258
+ } catch (e) {
259
+ if (onError) {
260
+ onError(e, object);
261
+ } else {
262
+ throw new SyncEngineError(e, object);
263
+ }
250
264
  }
251
- } catch (e) {
252
- if (onError) {
253
- onError(e, object);
254
- } else {
255
- throw new SyncEngineError(e, object);
256
- }
257
- } finally {
258
- log({
259
- action: "delete",
260
- id: object.id[0],
261
- providerId: object.providerId,
262
- displayName: object.displayName ?? object.providerId,
263
- whatIf,
264
- diff: diffLines(JSON.stringify(object.object, null, 2), "")
265
- });
266
265
  }
267
266
  };
268
267
  for await (const obj of target.objects) {
@@ -284,26 +283,25 @@ async function syncEngine({
284
283
  if (!compareContents(sourceObject, targetObject)) {
285
284
  if (mode === "createOrUpdate" || mode === "mirror") {
286
285
  const process2 = async (sourceObject2, targetObject2) => {
287
- try {
288
- if (!whatIf) {
286
+ if (!whatIf) {
287
+ try {
289
288
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
290
289
  await target.writeObject(finalSourceObject, targetObject2);
290
+ log({
291
+ action: "update",
292
+ id: ids[0],
293
+ providerId: sourceObject2.providerId,
294
+ displayName: sourceObject2.displayName ?? sourceObject2.providerId,
295
+ whatIf,
296
+ diff: diffJson(targetObject2.object, sourceObject2.object)
297
+ });
298
+ } catch (e) {
299
+ if (onError) {
300
+ onError(e, sourceObject2);
301
+ } else {
302
+ throw new SyncEngineError(e, sourceObject2);
303
+ }
291
304
  }
292
- } catch (e) {
293
- if (onError) {
294
- onError(e, sourceObject2);
295
- } else {
296
- throw new SyncEngineError(e, sourceObject2);
297
- }
298
- } finally {
299
- log({
300
- action: "update",
301
- id: ids[0],
302
- providerId: sourceObject2.providerId,
303
- displayName: sourceObject2.displayName ?? sourceObject2.providerId,
304
- whatIf,
305
- diff: diffJson(targetObject2.object, sourceObject2.object)
306
- });
307
305
  }
308
306
  };
309
307
  actions.push(process2(sourceObject, targetObject));
@@ -312,26 +310,25 @@ async function syncEngine({
312
310
  ids.forEach((i) => targetItems.delete(i));
313
311
  } else {
314
312
  const process2 = async (sourceObject2, id) => {
315
- try {
316
- if (!whatIf) {
313
+ if (!whatIf) {
314
+ try {
317
315
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
318
316
  await target.writeObject(finalSourceObject);
317
+ log({
318
+ action: "create",
319
+ id,
320
+ providerId: id,
321
+ displayName: sourceObject2.displayName ?? sourceObject2.providerId,
322
+ whatIf,
323
+ diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
324
+ });
325
+ } catch (e) {
326
+ if (onError) {
327
+ onError(e, sourceObject2);
328
+ } else {
329
+ throw new SyncEngineError(e, sourceObject2);
330
+ }
319
331
  }
320
- } catch (e) {
321
- if (onError) {
322
- onError(e, sourceObject2);
323
- } else {
324
- throw new SyncEngineError(e, sourceObject2);
325
- }
326
- } finally {
327
- log({
328
- action: "create",
329
- id,
330
- providerId: id,
331
- displayName: sourceObject2.displayName ?? sourceObject2.providerId,
332
- whatIf,
333
- diff: diffLines("", JSON.stringify(sourceObject2.object, null, 2))
334
- });
335
332
  }
336
333
  };
337
334
  if (invalidTargetObjects.length > 0) {
@@ -3718,7 +3715,7 @@ var EntryListModule = {
3718
3715
  import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
3719
3716
 
3720
3717
  // src/commands/canvas/entryEngineDataSource.ts
3721
- import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
3718
+ import { convertEntryToPutEntry } from "@uniformdev/canvas";
3722
3719
 
3723
3720
  // src/commands/canvas/commands/entry/_util.ts
3724
3721
  var selectEntryIdentifier = (e) => e.entry._id;
@@ -3735,26 +3732,17 @@ function createEntryEngineDataSource({
3735
3732
  const stateId = convertStateOption(state);
3736
3733
  async function* getObjects() {
3737
3734
  const entries = paginateAsync(
3738
- async (offset, limit) => {
3739
- try {
3740
- return (await client.getEntries({
3741
- offset,
3742
- limit,
3743
- entryIDs,
3744
- pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
3745
- skipDataResolution: true,
3746
- skipOverridesResolution: true,
3747
- skipPatternResolution: true,
3748
- state: stateId,
3749
- withComponentIDs: true
3750
- })).entries;
3751
- } catch (error) {
3752
- if (error instanceof ApiClientError && error.errorMessage === "Entry not found or not published") {
3753
- return [];
3754
- }
3755
- throw error;
3756
- }
3757
- },
3735
+ async (offset, limit) => (await client.getEntries({
3736
+ offset,
3737
+ limit,
3738
+ entryIDs,
3739
+ pattern: onlyEntries ? false : onlyPatterns ? true : void 0,
3740
+ skipDataResolution: true,
3741
+ skipOverridesResolution: true,
3742
+ skipPatternResolution: true,
3743
+ state: stateId,
3744
+ withComponentIDs: true
3745
+ })).entries,
3758
3746
  { pageSize: 100 }
3759
3747
  );
3760
3748
  for await (const e of entries) {
@@ -6194,7 +6182,7 @@ var EnrichmentModule = {
6194
6182
  import yargs19 from "yargs";
6195
6183
 
6196
6184
  // src/commands/context/commands/manifest/get.ts
6197
- import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
6185
+ import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
6198
6186
  import { gray as gray2, green as green2, red as red3 } from "colorette";
6199
6187
  import { writeFile } from "fs";
6200
6188
  import { exit } from "process";
@@ -6245,7 +6233,7 @@ var ManifestGetModule = {
6245
6233
  }
6246
6234
  } catch (e) {
6247
6235
  let message;
6248
- if (e instanceof ApiClientError2) {
6236
+ if (e instanceof ApiClientError) {
6249
6237
  if (e.statusCode === 403) {
6250
6238
  message = `The API key ${apiKey} did not have permissions to fetch the manifest. Ensure ${preview ? "Uniform Context > Read Drafts" : "Uniform Context > Manifest > Read"} permissions are granted.`;
6251
6239
  }
@@ -6261,7 +6249,7 @@ var ManifestGetModule = {
6261
6249
  };
6262
6250
 
6263
6251
  // src/commands/context/commands/manifest/publish.ts
6264
- import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
6252
+ import { ApiClientError as ApiClientError2, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
6265
6253
  import { gray as gray3, red as red4 } from "colorette";
6266
6254
  import { exit as exit2 } from "process";
6267
6255
  var ManifestPublishModule = {
@@ -6280,7 +6268,7 @@ var ManifestPublishModule = {
6280
6268
  await client.publish();
6281
6269
  } catch (e) {
6282
6270
  let message;
6283
- if (e instanceof ApiClientError3) {
6271
+ if (e instanceof ApiClientError2) {
6284
6272
  if (e.statusCode === 403) {
6285
6273
  message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
6286
6274
  }
@@ -7486,7 +7474,7 @@ import { PostHog } from "posthog-node";
7486
7474
  // package.json
7487
7475
  var package_default = {
7488
7476
  name: "@uniformdev/cli",
7489
- version: "19.183.0",
7477
+ version: "19.184.0",
7490
7478
  description: "Uniform command line interface tool",
7491
7479
  license: "SEE LICENSE IN LICENSE.txt",
7492
7480
  main: "./cli.js",
@@ -10047,7 +10035,7 @@ var getMostRecent = async ({ full, scope }, distTag, timeout) => {
10047
10035
  var defaultConfig = {
10048
10036
  interval: 36e5,
10049
10037
  distTag: "latest",
10050
- timeout: 5e3
10038
+ timeout: 2e3
10051
10039
  };
10052
10040
  var getDetails = (name) => {
10053
10041
  const spec = {
@@ -10078,13 +10066,6 @@ async function updateCheck_default(pkg, config2 = {}) {
10078
10066
  ({ shouldCheck, latest } = await evaluateCache(file, time, interval));
10079
10067
  if (shouldCheck) {
10080
10068
  latest = await getMostRecent(details, distTag, timeout);
10081
- if (config2.verbose) {
10082
- console.log("CLI package latest version check", {
10083
- latest,
10084
- current: pkg.version,
10085
- tempFileWithLastUpdateCheck: file
10086
- });
10087
- }
10088
10069
  await updateCache(file, latest, time);
10089
10070
  }
10090
10071
  const comparision = compareVersions(pkg.version, latest);
@@ -10098,19 +10079,19 @@ async function updateCheck_default(pkg, config2 = {}) {
10098
10079
  }
10099
10080
 
10100
10081
  // src/middleware/checkForUpdateMiddleware.ts
10101
- var checkForUpdateMiddleware = async ({ verbose }) => {
10082
+ async function checkForUpdateMiddleware() {
10102
10083
  try {
10103
10084
  if (process.env.NO_UPDATE_CHECK || process.env.CI) {
10104
10085
  return;
10105
10086
  }
10106
- const update = await updateCheck_default(package_default, { verbose });
10087
+ const update = await updateCheck_default(package_default);
10107
10088
  if (update) {
10108
10089
  logCallout(`${bold("Update Available:")} ${gray5(package_default.version)} \u226B ${green4(update.latest)}`);
10109
10090
  }
10110
10091
  } catch (e) {
10111
10092
  console.error(`There was an error checking for updates`, e);
10112
10093
  }
10113
- };
10094
+ }
10114
10095
 
10115
10096
  // src/middleware/checkLocalDepsVersionsMiddleware.ts
10116
10097
  import { magenta, red as red6 } from "colorette";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.183.1-alpha.4+0bd2420d3e",
3
+ "version": "19.184.1-alpha.0+1f5a1fa7b2",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@thi.ng/mime": "^2.2.23",
30
- "@uniformdev/assets": "19.183.1-alpha.4+0bd2420d3e",
31
- "@uniformdev/canvas": "19.183.1-alpha.4+0bd2420d3e",
32
- "@uniformdev/context": "19.183.1-alpha.4+0bd2420d3e",
33
- "@uniformdev/files": "19.183.1-alpha.4+0bd2420d3e",
34
- "@uniformdev/project-map": "19.183.1-alpha.4+0bd2420d3e",
35
- "@uniformdev/redirect": "19.183.1-alpha.4+0bd2420d3e",
30
+ "@uniformdev/assets": "19.184.1-alpha.0+1f5a1fa7b2",
31
+ "@uniformdev/canvas": "19.184.1-alpha.0+1f5a1fa7b2",
32
+ "@uniformdev/context": "19.184.1-alpha.0+1f5a1fa7b2",
33
+ "@uniformdev/files": "19.184.1-alpha.0+1f5a1fa7b2",
34
+ "@uniformdev/project-map": "19.184.1-alpha.0+1f5a1fa7b2",
35
+ "@uniformdev/redirect": "19.184.1-alpha.0+1f5a1fa7b2",
36
36
  "call-bind": "^1.0.2",
37
37
  "colorette": "2.0.20",
38
38
  "cosmiconfig": "9.0.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "0bd2420d3eece2bc4092b180bb723fc1f3a47c83"
81
+ "gitHead": "1f5a1fa7b28d2161b8f29891a12a13d026766bc0"
82
82
  }