@uniformdev/cli 20.49.3-alpha.9 → 20.49.4-alpha.102

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 +80 -34
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -1124,7 +1124,7 @@ import { PostHog } from "posthog-node";
1124
1124
  // package.json
1125
1125
  var package_default = {
1126
1126
  name: "@uniformdev/cli",
1127
- version: "20.49.2",
1127
+ version: "20.50.0",
1128
1128
  description: "Uniform command line interface tool",
1129
1129
  license: "SEE LICENSE IN LICENSE.txt",
1130
1130
  main: "./cli.js",
@@ -4665,7 +4665,10 @@ var ComponentPatternRemoveModule = {
4665
4665
  };
4666
4666
 
4667
4667
  // src/commands/canvas/commands/composition/unpublish.ts
4668
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2 } from "@uniformdev/canvas";
4668
+ import {
4669
+ ApiClientError,
4670
+ CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
4671
+ } from "@uniformdev/canvas";
4669
4672
  import { diffJson as diffJson2 } from "diff";
4670
4673
  var CompositionUnpublishModule = {
4671
4674
  command: "unpublish [ids]",
@@ -4679,15 +4682,15 @@ var CompositionUnpublishModule = {
4679
4682
  type: "string"
4680
4683
  }).option("all", {
4681
4684
  alias: ["a"],
4682
- describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
4685
+ describe: "Un-publishes all compositions. Use composition ID(s) to unpublish specific one(s) instead.",
4683
4686
  default: false,
4684
4687
  type: "boolean"
4685
4688
  }).option("onlyCompositions", {
4686
- describe: "Only publishing compositions and not patterns",
4689
+ describe: "Only un-publishing compositions and not patterns",
4687
4690
  default: false,
4688
4691
  type: "boolean"
4689
4692
  }).option("onlyPatterns", {
4690
- describe: "Only pulling patterns and not compositions",
4693
+ describe: "Only un-publishing patterns and not compositions",
4691
4694
  default: false,
4692
4695
  type: "boolean",
4693
4696
  hidden: true
@@ -4710,7 +4713,7 @@ var CompositionUnpublishModule = {
4710
4713
  verbose
4711
4714
  }) => {
4712
4715
  if (!all && !ids || all && ids) {
4713
- console.error(`Specify --all or composition ID(s) to publish.`);
4716
+ console.error(`Specify --all or composition ID(s) to unpublish.`);
4714
4717
  process.exit(1);
4715
4718
  }
4716
4719
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -4735,7 +4738,6 @@ var CompositionUnpublishModule = {
4735
4738
  patternType,
4736
4739
  verbose
4737
4740
  });
4738
- const actions = [];
4739
4741
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
4740
4742
  for await (const obj of target.objects) {
4741
4743
  if (Array.isArray(obj.id)) {
@@ -4744,15 +4746,30 @@ var CompositionUnpublishModule = {
4744
4746
  targetItems.set(obj.id, obj);
4745
4747
  }
4746
4748
  }
4749
+ const toUnpublish = [];
4747
4750
  for await (const sourceObject of source.objects) {
4751
+ toUnpublish.push(sourceObject);
4752
+ }
4753
+ const actions = [];
4754
+ for (const sourceObject of toUnpublish) {
4748
4755
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
4749
4756
  const targetObject = targetItems.get(id);
4750
4757
  if (!targetObject) {
4751
- console.log(`Composition ${id} was not found`);
4752
- return;
4758
+ console.log(`Composition ${id} did not have a draft (removing published)`);
4753
4759
  }
4754
4760
  if (!whatIf) {
4755
- actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
4761
+ actions.push(
4762
+ client.removeComposition({ ...parseCompositionSerializedId(id), state: CANVAS_PUBLISHED_STATE2 }).catch((err) => {
4763
+ const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
4764
+ if (isNotFound) {
4765
+ console.warn(
4766
+ `Composition ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
4767
+ );
4768
+ return;
4769
+ }
4770
+ throw err;
4771
+ })
4772
+ );
4756
4773
  }
4757
4774
  log2({
4758
4775
  action: "update",
@@ -4760,7 +4777,7 @@ var CompositionUnpublishModule = {
4760
4777
  providerId: sourceObject.providerId,
4761
4778
  displayName: sourceObject.displayName ?? sourceObject.providerId,
4762
4779
  whatIf,
4763
- diff: () => diffJson2(targetObject.object, sourceObject.object)
4780
+ diff: () => targetObject ? diffJson2(targetObject.object, sourceObject.object) : []
4764
4781
  });
4765
4782
  }
4766
4783
  await Promise.all(actions);
@@ -4780,7 +4797,7 @@ var ComponentPatternUnpublishModule = {
4780
4797
  type: "string"
4781
4798
  }).option("all", {
4782
4799
  alias: ["a"],
4783
- describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
4800
+ describe: "Un-publishes all component patterns. Use composition ID(s) to unpublish specific one(s) instead.",
4784
4801
  default: false,
4785
4802
  type: "boolean"
4786
4803
  }).option("onlyCompositions", {
@@ -5075,7 +5092,7 @@ var CompositionPatternUnpublishModule = {
5075
5092
  type: "string"
5076
5093
  }).option("all", {
5077
5094
  alias: ["a"],
5078
- describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
5095
+ describe: "Un-publishes all composition patterns. Use composition ID(s) to unpublish specific one(s) instead.",
5079
5096
  default: false,
5080
5097
  type: "boolean"
5081
5098
  }).option("onlyCompositions", {
@@ -5973,7 +5990,7 @@ var EntryListModule = {
5973
5990
  };
5974
5991
 
5975
5992
  // src/commands/canvas/entryEngineDataSource.ts
5976
- import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
5993
+ import { ApiClientError as ApiClientError2, convertEntryToPutEntry } from "@uniformdev/canvas";
5977
5994
 
5978
5995
  // src/commands/canvas/commands/entry/_util.ts
5979
5996
  var selectEntryIdentifier = (e) => {
@@ -6019,7 +6036,7 @@ function createEntryEngineDataSource({
6019
6036
  editions: "all"
6020
6037
  })).entries;
6021
6038
  } catch (error) {
6022
- if (error instanceof ApiClientError && error.errorMessage === "Entry not found or not published") {
6039
+ if (error instanceof ApiClientError2 && error.errorMessage === "Entry not found or not published") {
6023
6040
  return [];
6024
6041
  }
6025
6042
  throw error;
@@ -6365,7 +6382,7 @@ var EntryRemoveModule = {
6365
6382
  };
6366
6383
 
6367
6384
  // src/commands/canvas/commands/entry/unpublish.ts
6368
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6385
+ import { ApiClientError as ApiClientError3, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6369
6386
  import { diffJson as diffJson3 } from "diff";
6370
6387
  var EntryUnpublishModule = {
6371
6388
  command: "unpublish [ids]",
@@ -6389,7 +6406,7 @@ var EntryUnpublishModule = {
6389
6406
  ),
6390
6407
  handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6391
6408
  if (!all && !ids || all && ids) {
6392
- console.error(`Specify --all or entry ID(s) to publish.`);
6409
+ console.error(`Specify --all or entry ID(s) to unpublish.`);
6393
6410
  process.exit(1);
6394
6411
  }
6395
6412
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -6408,7 +6425,6 @@ var EntryUnpublishModule = {
6408
6425
  entryIDs: entryIDsArray,
6409
6426
  onlyEntries: true
6410
6427
  });
6411
- const actions = [];
6412
6428
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
6413
6429
  for await (const obj of target.objects) {
6414
6430
  if (Array.isArray(obj.id)) {
@@ -6417,15 +6433,30 @@ var EntryUnpublishModule = {
6417
6433
  targetItems.set(obj.id, obj);
6418
6434
  }
6419
6435
  }
6436
+ const toUnpublish = [];
6420
6437
  for await (const sourceObject of source.objects) {
6438
+ toUnpublish.push(sourceObject);
6439
+ }
6440
+ const actions = [];
6441
+ for (const sourceObject of toUnpublish) {
6421
6442
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
6422
6443
  const targetObject = targetItems.get(id);
6423
6444
  if (!targetObject) {
6424
- console.log(`Entry ${id} was not found`);
6425
- return;
6445
+ console.log(`Entry ${id} did not have a draft (removing published)`);
6426
6446
  }
6427
6447
  if (!whatIf) {
6428
- actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE3 }));
6448
+ actions.push(
6449
+ client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE3 }).catch((err) => {
6450
+ const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
6451
+ if (isNotFound) {
6452
+ console.warn(
6453
+ `Entry ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
6454
+ );
6455
+ return;
6456
+ }
6457
+ throw err;
6458
+ })
6459
+ );
6429
6460
  }
6430
6461
  log2({
6431
6462
  action: "update",
@@ -6433,7 +6464,7 @@ var EntryUnpublishModule = {
6433
6464
  providerId: sourceObject.providerId,
6434
6465
  displayName: sourceObject.displayName ?? sourceObject.providerId,
6435
6466
  whatIf,
6436
- diff: () => diffJson3(targetObject.object, sourceObject.object)
6467
+ diff: () => targetObject ? diffJson3(targetObject.object, sourceObject.object) : []
6437
6468
  });
6438
6469
  }
6439
6470
  await Promise.all(actions);
@@ -6923,11 +6954,11 @@ var EntryPatternRemoveModule = {
6923
6954
  };
6924
6955
 
6925
6956
  // src/commands/canvas/commands/entryPattern/unpublish.ts
6926
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
6957
+ import { ApiClientError as ApiClientError4, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
6927
6958
  import { diffJson as diffJson4 } from "diff";
6928
6959
  var EntryPatternUnpublishModule = {
6929
6960
  command: "unpublish [ids]",
6930
- describe: "Unpublish an entry patterns",
6961
+ describe: "Unpublish entry pattern(s)",
6931
6962
  builder: (yargs42) => withConfiguration(
6932
6963
  withDebugOptions(
6933
6964
  withApiOptions(
@@ -6947,7 +6978,7 @@ var EntryPatternUnpublishModule = {
6947
6978
  ),
6948
6979
  handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6949
6980
  if (!all && !ids || all && ids) {
6950
- console.error(`Specify --all or entry pattern ID(s) to publish.`);
6981
+ console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
6951
6982
  process.exit(1);
6952
6983
  }
6953
6984
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -6966,7 +6997,6 @@ var EntryPatternUnpublishModule = {
6966
6997
  entryIDs: entryIDsArray,
6967
6998
  onlyPatterns: true
6968
6999
  });
6969
- const actions = [];
6970
7000
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
6971
7001
  for await (const obj of target.objects) {
6972
7002
  if (Array.isArray(obj.id)) {
@@ -6975,15 +7005,30 @@ var EntryPatternUnpublishModule = {
6975
7005
  targetItems.set(obj.id, obj);
6976
7006
  }
6977
7007
  }
7008
+ const toUnpublish = [];
6978
7009
  for await (const sourceObject of source.objects) {
7010
+ toUnpublish.push(sourceObject);
7011
+ }
7012
+ const actions = [];
7013
+ for (const sourceObject of toUnpublish) {
6979
7014
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
6980
7015
  const targetObject = targetItems.get(id);
6981
7016
  if (!targetObject) {
6982
- console.log(`Entry pattern ${id} was not found`);
6983
- return;
7017
+ console.log(`Entry pattern ${id} did not have a draft (removing published)`);
6984
7018
  }
6985
7019
  if (!whatIf) {
6986
- actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE4 }));
7020
+ actions.push(
7021
+ client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
7022
+ const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
7023
+ if (isNotFound) {
7024
+ console.warn(
7025
+ `Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
7026
+ );
7027
+ return;
7028
+ }
7029
+ throw err;
7030
+ })
7031
+ );
6987
7032
  }
6988
7033
  log2({
6989
7034
  action: "update",
@@ -6991,9 +7036,10 @@ var EntryPatternUnpublishModule = {
6991
7036
  providerId: sourceObject.providerId,
6992
7037
  displayName: sourceObject.displayName ?? sourceObject.providerId,
6993
7038
  whatIf,
6994
- diff: () => diffJson4(targetObject.object, sourceObject.object)
7039
+ diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
6995
7040
  });
6996
7041
  }
7042
+ await Promise.all(actions);
6997
7043
  }
6998
7044
  };
6999
7045
 
@@ -8958,7 +9004,7 @@ var EnrichmentModule = {
8958
9004
  import yargs23 from "yargs";
8959
9005
 
8960
9006
  // src/commands/context/commands/manifest/get.ts
8961
- import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
9007
+ import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
8962
9008
  import { gray as gray4, green as green6, red as red6 } from "colorette";
8963
9009
  import { writeFile } from "fs";
8964
9010
  import { exit } from "process";
@@ -9009,7 +9055,7 @@ var ManifestGetModule = {
9009
9055
  }
9010
9056
  } catch (e) {
9011
9057
  let message;
9012
- if (e instanceof ApiClientError2) {
9058
+ if (e instanceof ApiClientError5) {
9013
9059
  if (e.statusCode === 403) {
9014
9060
  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.`;
9015
9061
  }
@@ -9025,7 +9071,7 @@ var ManifestGetModule = {
9025
9071
  };
9026
9072
 
9027
9073
  // src/commands/context/commands/manifest/publish.ts
9028
- import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9074
+ import { ApiClientError as ApiClientError6, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9029
9075
  import { gray as gray5, red as red7 } from "colorette";
9030
9076
  import { exit as exit2 } from "process";
9031
9077
  var ManifestPublishModule = {
@@ -9044,7 +9090,7 @@ var ManifestPublishModule = {
9044
9090
  await client.publish();
9045
9091
  } catch (e) {
9046
9092
  let message;
9047
- if (e instanceof ApiClientError3) {
9093
+ if (e instanceof ApiClientError6) {
9048
9094
  if (e.statusCode === 403) {
9049
9095
  message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
9050
9096
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.49.3-alpha.9+e5b9a8ca05",
3
+ "version": "20.49.4-alpha.102+140d1a56b4",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -28,13 +28,13 @@
28
28
  "dependencies": {
29
29
  "@inquirer/prompts": "^7.10.1",
30
30
  "@thi.ng/mime": "^2.2.23",
31
- "@uniformdev/assets": "20.49.3-alpha.9+e5b9a8ca05",
32
- "@uniformdev/canvas": "20.49.3-alpha.9+e5b9a8ca05",
33
- "@uniformdev/context": "20.49.3-alpha.9+e5b9a8ca05",
34
- "@uniformdev/files": "20.49.3-alpha.9+e5b9a8ca05",
35
- "@uniformdev/project-map": "20.49.3-alpha.9+e5b9a8ca05",
36
- "@uniformdev/redirect": "20.49.3-alpha.9+e5b9a8ca05",
37
- "@uniformdev/richtext": "20.49.3-alpha.9+e5b9a8ca05",
31
+ "@uniformdev/assets": "20.49.4-alpha.102+140d1a56b4",
32
+ "@uniformdev/canvas": "20.49.4-alpha.102+140d1a56b4",
33
+ "@uniformdev/context": "20.49.4-alpha.102+140d1a56b4",
34
+ "@uniformdev/files": "20.49.4-alpha.102+140d1a56b4",
35
+ "@uniformdev/project-map": "20.49.4-alpha.102+140d1a56b4",
36
+ "@uniformdev/redirect": "20.49.4-alpha.102+140d1a56b4",
37
+ "@uniformdev/richtext": "20.49.4-alpha.102+140d1a56b4",
38
38
  "call-bind": "^1.0.2",
39
39
  "colorette": "2.0.20",
40
40
  "cosmiconfig": "9.0.0",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "e5b9a8ca05d0b8b26886079b687417e53d44f9cb"
84
+ "gitHead": "140d1a56b4b45021216a166bcaf7ebe629681b0b"
85
85
  }