@uniformdev/cli 20.49.5-alpha.10 → 20.49.5-alpha.13

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 +41 -97
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -2612,15 +2612,6 @@ var compareCompositionsOrEntriesWithoutAssetUrls = (source, target) => {
2612
2612
  removeUrlsFromAssetParameters(structuredClone(target.object))
2613
2613
  );
2614
2614
  };
2615
- var PUBLISH_TIMESTAMP_TOLERANCE_MS = 2e3;
2616
- var compareCompositionsOrEntriesWithoutAssetUrlsForPublishing = (source, target) => {
2617
- const sourceModified = new Date(source.object.modified).getTime();
2618
- const targetModified = new Date(target.object.modified).getTime();
2619
- if (sourceModified - targetModified > PUBLISH_TIMESTAMP_TOLERANCE_MS) {
2620
- return false;
2621
- }
2622
- return compareCompositionsOrEntriesWithoutAssetUrls(source, target);
2623
- };
2624
2615
  var removeUrlFromAsset = (asset) => {
2625
2616
  if (asset.asset.fields?.url?.value) {
2626
2617
  asset.asset.fields.url.value = "";
@@ -4210,7 +4201,7 @@ var CompositionPublishModule = {
4210
4201
  fileClient
4211
4202
  });
4212
4203
  },
4213
- compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
4204
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
4214
4205
  onBeforeWriteObject: async (sourceObject) => {
4215
4206
  return uploadFilesForCompositionOrEntry({
4216
4207
  entity: sourceObject,
@@ -4665,10 +4656,7 @@ var ComponentPatternRemoveModule = {
4665
4656
  };
4666
4657
 
4667
4658
  // src/commands/canvas/commands/composition/unpublish.ts
4668
- import {
4669
- ApiClientError,
4670
- CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
4671
- } from "@uniformdev/canvas";
4659
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2 } from "@uniformdev/canvas";
4672
4660
  import { diffJson as diffJson2 } from "diff";
4673
4661
  var CompositionUnpublishModule = {
4674
4662
  command: "unpublish [ids]",
@@ -4682,15 +4670,15 @@ var CompositionUnpublishModule = {
4682
4670
  type: "string"
4683
4671
  }).option("all", {
4684
4672
  alias: ["a"],
4685
- describe: "Un-publishes all compositions. Use composition ID(s) to unpublish specific one(s) instead.",
4673
+ describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
4686
4674
  default: false,
4687
4675
  type: "boolean"
4688
4676
  }).option("onlyCompositions", {
4689
- describe: "Only un-publishing compositions and not patterns",
4677
+ describe: "Only publishing compositions and not patterns",
4690
4678
  default: false,
4691
4679
  type: "boolean"
4692
4680
  }).option("onlyPatterns", {
4693
- describe: "Only un-publishing patterns and not compositions",
4681
+ describe: "Only pulling patterns and not compositions",
4694
4682
  default: false,
4695
4683
  type: "boolean",
4696
4684
  hidden: true
@@ -4713,7 +4701,7 @@ var CompositionUnpublishModule = {
4713
4701
  verbose
4714
4702
  }) => {
4715
4703
  if (!all && !ids || all && ids) {
4716
- console.error(`Specify --all or composition ID(s) to unpublish.`);
4704
+ console.error(`Specify --all or composition ID(s) to publish.`);
4717
4705
  process.exit(1);
4718
4706
  }
4719
4707
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -4738,6 +4726,7 @@ var CompositionUnpublishModule = {
4738
4726
  patternType,
4739
4727
  verbose
4740
4728
  });
4729
+ const actions = [];
4741
4730
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
4742
4731
  for await (const obj of target.objects) {
4743
4732
  if (Array.isArray(obj.id)) {
@@ -4746,30 +4735,16 @@ var CompositionUnpublishModule = {
4746
4735
  targetItems.set(obj.id, obj);
4747
4736
  }
4748
4737
  }
4749
- const toUnpublish = [];
4750
4738
  for await (const sourceObject of source.objects) {
4751
- toUnpublish.push(sourceObject);
4752
- }
4753
- const actions = [];
4754
- for (const sourceObject of toUnpublish) {
4755
4739
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
4756
4740
  const targetObject = targetItems.get(id);
4757
4741
  if (!targetObject) {
4758
- console.log(`Composition ${id} did not have a draft (removing published)`);
4742
+ console.log(`Composition ${id} was not found`);
4743
+ return;
4759
4744
  }
4745
+ console.log(`\u{1F41B} unpublishing composition: (id: ${id})`);
4760
4746
  if (!whatIf) {
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
- );
4747
+ actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
4773
4748
  }
4774
4749
  log2({
4775
4750
  action: "update",
@@ -4777,10 +4752,9 @@ var CompositionUnpublishModule = {
4777
4752
  providerId: sourceObject.providerId,
4778
4753
  displayName: sourceObject.displayName ?? sourceObject.providerId,
4779
4754
  whatIf,
4780
- diff: () => targetObject ? diffJson2(targetObject.object, sourceObject.object) : []
4755
+ diff: () => diffJson2(targetObject.object, sourceObject.object)
4781
4756
  });
4782
4757
  }
4783
- await Promise.all(actions);
4784
4758
  }
4785
4759
  };
4786
4760
 
@@ -4797,7 +4771,7 @@ var ComponentPatternUnpublishModule = {
4797
4771
  type: "string"
4798
4772
  }).option("all", {
4799
4773
  alias: ["a"],
4800
- describe: "Un-publishes all component patterns. Use composition ID(s) to unpublish specific one(s) instead.",
4774
+ describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
4801
4775
  default: false,
4802
4776
  type: "boolean"
4803
4777
  }).option("onlyCompositions", {
@@ -5092,7 +5066,7 @@ var CompositionPatternUnpublishModule = {
5092
5066
  type: "string"
5093
5067
  }).option("all", {
5094
5068
  alias: ["a"],
5095
- describe: "Un-publishes all composition patterns. Use composition ID(s) to unpublish specific one(s) instead.",
5069
+ describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
5096
5070
  default: false,
5097
5071
  type: "boolean"
5098
5072
  }).option("onlyCompositions", {
@@ -5990,7 +5964,7 @@ var EntryListModule = {
5990
5964
  };
5991
5965
 
5992
5966
  // src/commands/canvas/entryEngineDataSource.ts
5993
- import { ApiClientError as ApiClientError2, convertEntryToPutEntry } from "@uniformdev/canvas";
5967
+ import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
5994
5968
 
5995
5969
  // src/commands/canvas/commands/entry/_util.ts
5996
5970
  var selectEntryIdentifier = (e) => {
@@ -6036,7 +6010,7 @@ function createEntryEngineDataSource({
6036
6010
  editions: "all"
6037
6011
  })).entries;
6038
6012
  } catch (error) {
6039
- if (error instanceof ApiClientError2 && error.errorMessage === "Entry not found or not published") {
6013
+ if (error instanceof ApiClientError && error.errorMessage === "Entry not found or not published") {
6040
6014
  return [];
6041
6015
  }
6042
6016
  throw error;
@@ -6071,10 +6045,10 @@ var EntryPublishModule = {
6071
6045
  command: "publish [ids]",
6072
6046
  describe: "Publishes entry(ies)",
6073
6047
  builder: (yargs42) => withConfiguration(
6074
- withDebugOptions(
6075
- withDiffOptions(
6076
- withApiOptions(
6077
- withProjectOptions(
6048
+ withDiffOptions(
6049
+ withApiOptions(
6050
+ withProjectOptions(
6051
+ withDiffOptions(
6078
6052
  yargs42.positional("ids", {
6079
6053
  describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6080
6054
  type: "string"
@@ -6134,7 +6108,7 @@ var EntryPublishModule = {
6134
6108
  fileClient
6135
6109
  });
6136
6110
  },
6137
- compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
6111
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
6138
6112
  onBeforeWriteObject: async (sourceObject) => {
6139
6113
  return uploadFilesForCompositionOrEntry({
6140
6114
  entity: sourceObject,
@@ -6382,7 +6356,7 @@ var EntryRemoveModule = {
6382
6356
  };
6383
6357
 
6384
6358
  // src/commands/canvas/commands/entry/unpublish.ts
6385
- import { ApiClientError as ApiClientError3, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6359
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6386
6360
  import { diffJson as diffJson3 } from "diff";
6387
6361
  var EntryUnpublishModule = {
6388
6362
  command: "unpublish [ids]",
@@ -6406,7 +6380,7 @@ var EntryUnpublishModule = {
6406
6380
  ),
6407
6381
  handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6408
6382
  if (!all && !ids || all && ids) {
6409
- console.error(`Specify --all or entry ID(s) to unpublish.`);
6383
+ console.error(`Specify --all or entry ID(s) to publish.`);
6410
6384
  process.exit(1);
6411
6385
  }
6412
6386
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -6425,6 +6399,7 @@ var EntryUnpublishModule = {
6425
6399
  entryIDs: entryIDsArray,
6426
6400
  onlyEntries: true
6427
6401
  });
6402
+ const actions = [];
6428
6403
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
6429
6404
  for await (const obj of target.objects) {
6430
6405
  if (Array.isArray(obj.id)) {
@@ -6433,30 +6408,15 @@ var EntryUnpublishModule = {
6433
6408
  targetItems.set(obj.id, obj);
6434
6409
  }
6435
6410
  }
6436
- const toUnpublish = [];
6437
6411
  for await (const sourceObject of source.objects) {
6438
- toUnpublish.push(sourceObject);
6439
- }
6440
- const actions = [];
6441
- for (const sourceObject of toUnpublish) {
6442
6412
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
6443
6413
  const targetObject = targetItems.get(id);
6444
6414
  if (!targetObject) {
6445
- console.log(`Entry ${id} did not have a draft (removing published)`);
6415
+ console.log(`Entry ${id} was not found`);
6416
+ return;
6446
6417
  }
6447
6418
  if (!whatIf) {
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
- );
6419
+ actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE3 }));
6460
6420
  }
6461
6421
  log2({
6462
6422
  action: "update",
@@ -6464,10 +6424,9 @@ var EntryUnpublishModule = {
6464
6424
  providerId: sourceObject.providerId,
6465
6425
  displayName: sourceObject.displayName ?? sourceObject.providerId,
6466
6426
  whatIf,
6467
- diff: () => targetObject ? diffJson3(targetObject.object, sourceObject.object) : []
6427
+ diff: () => diffJson3(targetObject.object, sourceObject.object)
6468
6428
  });
6469
6429
  }
6470
- await Promise.all(actions);
6471
6430
  }
6472
6431
  };
6473
6432
 
@@ -6701,7 +6660,7 @@ var EntryPatternPublishModule = {
6701
6660
  fileClient
6702
6661
  });
6703
6662
  },
6704
- compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
6663
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
6705
6664
  onBeforeWriteObject: async (sourceObject) => {
6706
6665
  return uploadFilesForCompositionOrEntry({
6707
6666
  entity: sourceObject,
@@ -6954,11 +6913,11 @@ var EntryPatternRemoveModule = {
6954
6913
  };
6955
6914
 
6956
6915
  // src/commands/canvas/commands/entryPattern/unpublish.ts
6957
- import { ApiClientError as ApiClientError4, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
6916
+ import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
6958
6917
  import { diffJson as diffJson4 } from "diff";
6959
6918
  var EntryPatternUnpublishModule = {
6960
6919
  command: "unpublish [ids]",
6961
- describe: "Unpublish entry pattern(s)",
6920
+ describe: "Unpublish an entry patterns",
6962
6921
  builder: (yargs42) => withConfiguration(
6963
6922
  withDebugOptions(
6964
6923
  withApiOptions(
@@ -6978,7 +6937,7 @@ var EntryPatternUnpublishModule = {
6978
6937
  ),
6979
6938
  handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6980
6939
  if (!all && !ids || all && ids) {
6981
- console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
6940
+ console.error(`Specify --all or entry pattern ID(s) to publish.`);
6982
6941
  process.exit(1);
6983
6942
  }
6984
6943
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -6997,6 +6956,7 @@ var EntryPatternUnpublishModule = {
6997
6956
  entryIDs: entryIDsArray,
6998
6957
  onlyPatterns: true
6999
6958
  });
6959
+ const actions = [];
7000
6960
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
7001
6961
  for await (const obj of target.objects) {
7002
6962
  if (Array.isArray(obj.id)) {
@@ -7005,30 +6965,15 @@ var EntryPatternUnpublishModule = {
7005
6965
  targetItems.set(obj.id, obj);
7006
6966
  }
7007
6967
  }
7008
- const toUnpublish = [];
7009
6968
  for await (const sourceObject of source.objects) {
7010
- toUnpublish.push(sourceObject);
7011
- }
7012
- const actions = [];
7013
- for (const sourceObject of toUnpublish) {
7014
6969
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
7015
6970
  const targetObject = targetItems.get(id);
7016
6971
  if (!targetObject) {
7017
- console.log(`Entry pattern ${id} did not have a draft (removing published)`);
6972
+ console.log(`Entry pattern ${id} was not found`);
6973
+ return;
7018
6974
  }
7019
6975
  if (!whatIf) {
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
- );
6976
+ actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE4 }));
7032
6977
  }
7033
6978
  log2({
7034
6979
  action: "update",
@@ -7036,10 +6981,9 @@ var EntryPatternUnpublishModule = {
7036
6981
  providerId: sourceObject.providerId,
7037
6982
  displayName: sourceObject.displayName ?? sourceObject.providerId,
7038
6983
  whatIf,
7039
- diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
6984
+ diff: () => diffJson4(targetObject.object, sourceObject.object)
7040
6985
  });
7041
6986
  }
7042
- await Promise.all(actions);
7043
6987
  }
7044
6988
  };
7045
6989
 
@@ -9004,7 +8948,7 @@ var EnrichmentModule = {
9004
8948
  import yargs23 from "yargs";
9005
8949
 
9006
8950
  // src/commands/context/commands/manifest/get.ts
9007
- import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
8951
+ import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
9008
8952
  import { gray as gray4, green as green6, red as red6 } from "colorette";
9009
8953
  import { writeFile } from "fs";
9010
8954
  import { exit } from "process";
@@ -9055,7 +8999,7 @@ var ManifestGetModule = {
9055
8999
  }
9056
9000
  } catch (e) {
9057
9001
  let message;
9058
- if (e instanceof ApiClientError5) {
9002
+ if (e instanceof ApiClientError2) {
9059
9003
  if (e.statusCode === 403) {
9060
9004
  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.`;
9061
9005
  }
@@ -9071,7 +9015,7 @@ var ManifestGetModule = {
9071
9015
  };
9072
9016
 
9073
9017
  // src/commands/context/commands/manifest/publish.ts
9074
- import { ApiClientError as ApiClientError6, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9018
+ import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9075
9019
  import { gray as gray5, red as red7 } from "colorette";
9076
9020
  import { exit as exit2 } from "process";
9077
9021
  var ManifestPublishModule = {
@@ -9090,7 +9034,7 @@ var ManifestPublishModule = {
9090
9034
  await client.publish();
9091
9035
  } catch (e) {
9092
9036
  let message;
9093
- if (e instanceof ApiClientError6) {
9037
+ if (e instanceof ApiClientError3) {
9094
9038
  if (e.statusCode === 403) {
9095
9039
  message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
9096
9040
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.49.5-alpha.10+97590818af",
3
+ "version": "20.49.5-alpha.13+222687ec86",
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.5-alpha.10+97590818af",
32
- "@uniformdev/canvas": "20.49.5-alpha.10+97590818af",
33
- "@uniformdev/context": "20.49.5-alpha.10+97590818af",
34
- "@uniformdev/files": "20.49.5-alpha.10+97590818af",
35
- "@uniformdev/project-map": "20.49.5-alpha.10+97590818af",
36
- "@uniformdev/redirect": "20.49.5-alpha.10+97590818af",
37
- "@uniformdev/richtext": "20.49.5-alpha.10+97590818af",
31
+ "@uniformdev/assets": "20.49.5-alpha.13+222687ec86",
32
+ "@uniformdev/canvas": "20.49.5-alpha.13+222687ec86",
33
+ "@uniformdev/context": "20.49.5-alpha.13+222687ec86",
34
+ "@uniformdev/files": "20.49.5-alpha.13+222687ec86",
35
+ "@uniformdev/project-map": "20.49.5-alpha.13+222687ec86",
36
+ "@uniformdev/redirect": "20.49.5-alpha.13+222687ec86",
37
+ "@uniformdev/richtext": "20.49.5-alpha.13+222687ec86",
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": "97590818aff0ababfb057278ba981112e219bf43"
84
+ "gitHead": "222687ec86220f3721a34d2b8c64e909699ae83d"
85
85
  }