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

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 +89 -70
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -244,24 +244,25 @@ async function syncEngine({
244
244
  const processDelete = async (object) => {
245
245
  if (deleteTracker.has(object)) return;
246
246
  deleteTracker.add(object);
247
- if (!whatIf) {
248
- try {
247
+ try {
248
+ if (!whatIf) {
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
- }
264
250
  }
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
+ });
265
266
  }
266
267
  };
267
268
  for await (const obj of target.objects) {
@@ -283,25 +284,26 @@ async function syncEngine({
283
284
  if (!compareContents(sourceObject, targetObject)) {
284
285
  if (mode === "createOrUpdate" || mode === "mirror") {
285
286
  const process2 = async (sourceObject2, targetObject2) => {
286
- if (!whatIf) {
287
- try {
287
+ try {
288
+ if (!whatIf) {
288
289
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2, targetObject2) : sourceObject2;
289
290
  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
- }
304
291
  }
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
+ });
305
307
  }
306
308
  };
307
309
  actions.push(process2(sourceObject, targetObject));
@@ -310,25 +312,26 @@ async function syncEngine({
310
312
  ids.forEach((i) => targetItems.delete(i));
311
313
  } else {
312
314
  const process2 = async (sourceObject2, id) => {
313
- if (!whatIf) {
314
- try {
315
+ try {
316
+ if (!whatIf) {
315
317
  const finalSourceObject = onBeforeWriteObject ? await onBeforeWriteObject(sourceObject2) : sourceObject2;
316
318
  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
- }
331
319
  }
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
+ });
332
335
  }
333
336
  };
334
337
  if (invalidTargetObjects.length > 0) {
@@ -1896,7 +1899,7 @@ var CompositionListModule = {
1896
1899
  const res = await client.getCompositionList({
1897
1900
  limit,
1898
1901
  offset,
1899
- search: search.length > 0 ? search : void 0,
1902
+ search: search && search.length > 0 ? search : void 0,
1900
1903
  pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
1901
1904
  patternType,
1902
1905
  state: convertStateOption(state),
@@ -3715,7 +3718,7 @@ var EntryListModule = {
3715
3718
  import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
3716
3719
 
3717
3720
  // src/commands/canvas/entryEngineDataSource.ts
3718
- import { convertEntryToPutEntry } from "@uniformdev/canvas";
3721
+ import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
3719
3722
 
3720
3723
  // src/commands/canvas/commands/entry/_util.ts
3721
3724
  var selectEntryIdentifier = (e) => e.entry._id;
@@ -3732,17 +3735,26 @@ function createEntryEngineDataSource({
3732
3735
  const stateId = convertStateOption(state);
3733
3736
  async function* getObjects() {
3734
3737
  const entries = paginateAsync(
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,
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
+ },
3746
3758
  { pageSize: 100 }
3747
3759
  );
3748
3760
  for await (const e of entries) {
@@ -6182,7 +6194,7 @@ var EnrichmentModule = {
6182
6194
  import yargs19 from "yargs";
6183
6195
 
6184
6196
  // src/commands/context/commands/manifest/get.ts
6185
- import { ApiClientError, UncachedManifestClient } from "@uniformdev/context/api";
6197
+ import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
6186
6198
  import { gray as gray2, green as green2, red as red3 } from "colorette";
6187
6199
  import { writeFile } from "fs";
6188
6200
  import { exit } from "process";
@@ -6233,7 +6245,7 @@ var ManifestGetModule = {
6233
6245
  }
6234
6246
  } catch (e) {
6235
6247
  let message;
6236
- if (e instanceof ApiClientError) {
6248
+ if (e instanceof ApiClientError2) {
6237
6249
  if (e.statusCode === 403) {
6238
6250
  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.`;
6239
6251
  }
@@ -6249,7 +6261,7 @@ var ManifestGetModule = {
6249
6261
  };
6250
6262
 
6251
6263
  // src/commands/context/commands/manifest/publish.ts
6252
- import { ApiClientError as ApiClientError2, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
6264
+ import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
6253
6265
  import { gray as gray3, red as red4 } from "colorette";
6254
6266
  import { exit as exit2 } from "process";
6255
6267
  var ManifestPublishModule = {
@@ -6268,7 +6280,7 @@ var ManifestPublishModule = {
6268
6280
  await client.publish();
6269
6281
  } catch (e) {
6270
6282
  let message;
6271
- if (e instanceof ApiClientError2) {
6283
+ if (e instanceof ApiClientError3) {
6272
6284
  if (e.statusCode === 403) {
6273
6285
  message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
6274
6286
  }
@@ -7474,7 +7486,7 @@ import { PostHog } from "posthog-node";
7474
7486
  // package.json
7475
7487
  var package_default = {
7476
7488
  name: "@uniformdev/cli",
7477
- version: "19.181.2",
7489
+ version: "19.183.0",
7478
7490
  description: "Uniform command line interface tool",
7479
7491
  license: "SEE LICENSE IN LICENSE.txt",
7480
7492
  main: "./cli.js",
@@ -10035,7 +10047,7 @@ var getMostRecent = async ({ full, scope }, distTag, timeout) => {
10035
10047
  var defaultConfig = {
10036
10048
  interval: 36e5,
10037
10049
  distTag: "latest",
10038
- timeout: 2e3
10050
+ timeout: 5e3
10039
10051
  };
10040
10052
  var getDetails = (name) => {
10041
10053
  const spec = {
@@ -10066,6 +10078,13 @@ async function updateCheck_default(pkg, config2 = {}) {
10066
10078
  ({ shouldCheck, latest } = await evaluateCache(file, time, interval));
10067
10079
  if (shouldCheck) {
10068
10080
  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
+ }
10069
10088
  await updateCache(file, latest, time);
10070
10089
  }
10071
10090
  const comparision = compareVersions(pkg.version, latest);
@@ -10079,19 +10098,19 @@ async function updateCheck_default(pkg, config2 = {}) {
10079
10098
  }
10080
10099
 
10081
10100
  // src/middleware/checkForUpdateMiddleware.ts
10082
- async function checkForUpdateMiddleware() {
10101
+ var checkForUpdateMiddleware = async ({ verbose }) => {
10083
10102
  try {
10084
10103
  if (process.env.NO_UPDATE_CHECK || process.env.CI) {
10085
10104
  return;
10086
10105
  }
10087
- const update = await updateCheck_default(package_default);
10106
+ const update = await updateCheck_default(package_default, { verbose });
10088
10107
  if (update) {
10089
10108
  logCallout(`${bold("Update Available:")} ${gray5(package_default.version)} \u226B ${green4(update.latest)}`);
10090
10109
  }
10091
10110
  } catch (e) {
10092
10111
  console.error(`There was an error checking for updates`, e);
10093
10112
  }
10094
- }
10113
+ };
10095
10114
 
10096
10115
  // src/middleware/checkLocalDepsVersionsMiddleware.ts
10097
10116
  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.181.3-alpha.0+a04bb53ba0",
3
+ "version": "19.183.1-alpha.4+0bd2420d3e",
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.181.3-alpha.0+a04bb53ba0",
31
- "@uniformdev/canvas": "19.181.3-alpha.0+a04bb53ba0",
32
- "@uniformdev/context": "19.181.3-alpha.0+a04bb53ba0",
33
- "@uniformdev/files": "19.181.3-alpha.0+a04bb53ba0",
34
- "@uniformdev/project-map": "19.181.3-alpha.0+a04bb53ba0",
35
- "@uniformdev/redirect": "19.181.3-alpha.0+a04bb53ba0",
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",
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": "a04bb53ba05f24066de3b279abc8442e3f3ec1cf"
81
+ "gitHead": "0bd2420d3eece2bc4092b180bb723fc1f3a47c83"
82
82
  }