@uniformdev/cli 20.49.4 → 20.49.5-alpha.11

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.
@@ -1,4 +1,4 @@
1
- import { C as CLIConfiguration, E as EntityTypes } from './index-ZI3elAaF.mjs';
1
+ import { C as CLIConfiguration, E as EntityTypes } from './index-fzc0-h1F.mjs';
2
2
 
3
3
  type UniformConfigAllOptions = {
4
4
  /**
@@ -6,12 +6,27 @@ type StateArgs = {
6
6
  type SyncMode = 'mirror' | 'createOrUpdate' | 'create';
7
7
  type EntityTypes = 'aggregate' | 'asset' | 'category' | 'workflow' | 'webhook' | 'component' | 'composition' | 'contentType' | 'dataType' | 'enrichment' | 'entry' | 'entryPattern' | 'locale' | 'componentPattern' | 'compositionPattern' | 'policyDocument' | 'projectMapDefinition' | 'projectMapNode' | 'previewUrl' | 'previewViewport' | 'prompt' | 'quirk' | 'redirect' | 'signal' | 'test';
8
8
  type SyncFileFormat = 'yaml' | 'json';
9
- type EntityConfiguration = {
9
+ type EntityConfigurationBase = {
10
10
  mode?: SyncMode;
11
11
  directory?: string;
12
12
  format?: SyncFileFormat;
13
13
  disabled?: true;
14
14
  };
15
+ type EntityFilterInclude = {
16
+ /** If set, only entities whose ID matches one of these values will be synced. Cannot be combined with `exclude`. */
17
+ include: string[];
18
+ exclude?: never;
19
+ };
20
+ type EntityFilterExclude = {
21
+ include?: never;
22
+ /** If set, entities whose ID matches one of these values will be excluded from sync. Cannot be combined with `include`. */
23
+ exclude: string[];
24
+ };
25
+ type EntityFilterNone = {
26
+ include?: never;
27
+ exclude?: never;
28
+ };
29
+ type EntityConfiguration = EntityConfigurationBase & (EntityFilterInclude | EntityFilterExclude | EntityFilterNone);
15
30
  type EntityWithStateConfiguration = EntityConfiguration & Partial<StateArgs>;
16
31
  type PublishableEntitiesConfiguration = EntityWithStateConfiguration & {
17
32
  publish?: boolean;
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export { C as CLIConfiguration } from './index-ZI3elAaF.mjs';
2
+ export { C as CLIConfiguration } from './index-fzc0-h1F.mjs';
package/dist/index.mjs CHANGED
@@ -558,6 +558,34 @@ async function createArraySyncEngineDataSource({
558
558
  };
559
559
  }
560
560
 
561
+ // src/sync/entityFilter.ts
562
+ function resolveEntityFilter(entityConfig, operation) {
563
+ const directional = entityConfig?.[operation];
564
+ const include = directional?.include ?? entityConfig?.include;
565
+ const exclude = directional?.exclude ?? entityConfig?.exclude;
566
+ return createEntityFilter(include, exclude);
567
+ }
568
+ function createEntityFilter(include, exclude) {
569
+ if (include?.length && exclude?.length) {
570
+ throw new Error("Entity filter cannot have both `include` and `exclude` defined. Use one or the other.");
571
+ }
572
+ if (!include?.length && !exclude?.length) {
573
+ return void 0;
574
+ }
575
+ if (include?.length) {
576
+ const includeSet = new Set(include);
577
+ return (obj) => {
578
+ const ids = Array.isArray(obj.id) ? obj.id : [obj.id];
579
+ return ids.some((id) => includeSet.has(id));
580
+ };
581
+ }
582
+ const excludeSet = new Set(exclude);
583
+ return (obj) => {
584
+ const ids = Array.isArray(obj.id) ? obj.id : [obj.id];
585
+ return !ids.some((id) => excludeSet.has(id));
586
+ };
587
+ }
588
+
561
589
  // src/sync/fileSyncEngineDataSource.ts
562
590
  import { red } from "colorette";
563
591
  import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
@@ -656,9 +684,13 @@ async function createFileSyncEngineDataSource({
656
684
  const fullFilename = join(directory, filename);
657
685
  try {
658
686
  const contents = readFileToObject(fullFilename);
687
+ const id = selectIdentifier18(contents);
688
+ if (id === void 0 || id === null || Array.isArray(id) && id.length === 0) {
689
+ throw new Error(`File does not contain a valid identifier.`);
690
+ }
659
691
  const displayName = selectDisplayName18(contents);
660
692
  const object4 = {
661
- id: selectIdentifier18(contents),
693
+ id,
662
694
  displayName: Array.isArray(displayName) ? displayName[0] : displayName,
663
695
  providerId: fullFilename,
664
696
  object: omit(contents, ["$schema"])
@@ -773,6 +805,16 @@ function serializedDequal(foo, bar) {
773
805
 
774
806
  // src/sync/syncEngine.ts
775
807
  var syncEngineEvents = mitt();
808
+ var _syncObjectFilter;
809
+ async function withSyncEngineFilter(filter, fn) {
810
+ const prev = _syncObjectFilter;
811
+ _syncObjectFilter = filter;
812
+ try {
813
+ return await fn();
814
+ } finally {
815
+ _syncObjectFilter = prev;
816
+ }
817
+ }
776
818
  async function syncEngine({
777
819
  source,
778
820
  target,
@@ -789,8 +831,10 @@ async function syncEngine({
789
831
  //verbose = false,
790
832
  }) {
791
833
  const status = new ReactiveStatusUpdate((status2) => syncEngineEvents.emit("statusUpdate", status2));
834
+ const objectFilter = _syncObjectFilter;
792
835
  const targetItems = /* @__PURE__ */ new Map();
793
836
  const deleteTracker = /* @__PURE__ */ new Set();
837
+ const getFirstId = (id) => Array.isArray(id) ? id[0] : id;
794
838
  const processDelete = async (object4) => {
795
839
  if (deleteTracker.has(object4)) return;
796
840
  deleteTracker.add(object4);
@@ -808,7 +852,7 @@ async function syncEngine({
808
852
  } finally {
809
853
  log2({
810
854
  action: "delete",
811
- id: object4.id[0],
855
+ id: getFirstId(object4.id),
812
856
  providerId: object4.providerId,
813
857
  displayName: object4.displayName ?? object4.providerId,
814
858
  whatIf,
@@ -817,6 +861,9 @@ async function syncEngine({
817
861
  }
818
862
  };
819
863
  for await (const obj of target.objects) {
864
+ if (objectFilter && !objectFilter(obj)) {
865
+ continue;
866
+ }
820
867
  status.fetched++;
821
868
  if (Array.isArray(obj.id)) {
822
869
  obj.id.forEach((o) => targetItems.set(o, obj));
@@ -827,6 +874,9 @@ async function syncEngine({
827
874
  const actions = [];
828
875
  let sourceHasItems = false;
829
876
  for await (let sourceObject of source.objects) {
877
+ if (objectFilter && !objectFilter(sourceObject)) {
878
+ continue;
879
+ }
830
880
  sourceHasItems = true;
831
881
  if (onBeforeProcessObject) {
832
882
  await onBeforeProcessObject(sourceObject);
@@ -2612,6 +2662,15 @@ var compareCompositionsOrEntriesWithoutAssetUrls = (source, target) => {
2612
2662
  removeUrlsFromAssetParameters(structuredClone(target.object))
2613
2663
  );
2614
2664
  };
2665
+ var PUBLISH_TIMESTAMP_TOLERANCE_MS = 2e3;
2666
+ var compareCompositionsOrEntriesWithoutAssetUrlsForPublishing = (source, target) => {
2667
+ const sourceModified = new Date(source.object.modified).getTime();
2668
+ const targetModified = new Date(target.object.modified).getTime();
2669
+ if (sourceModified - targetModified > PUBLISH_TIMESTAMP_TOLERANCE_MS) {
2670
+ return false;
2671
+ }
2672
+ return compareCompositionsOrEntriesWithoutAssetUrls(source, target);
2673
+ };
2615
2674
  var removeUrlFromAsset = (asset) => {
2616
2675
  if (asset.asset.fields?.url?.value) {
2617
2676
  asset.asset.fields.url.value = "";
@@ -4201,7 +4260,7 @@ var CompositionPublishModule = {
4201
4260
  fileClient
4202
4261
  });
4203
4262
  },
4204
- compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
4263
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
4205
4264
  onBeforeWriteObject: async (sourceObject) => {
4206
4265
  return uploadFilesForCompositionOrEntry({
4207
4266
  entity: sourceObject,
@@ -4656,7 +4715,10 @@ var ComponentPatternRemoveModule = {
4656
4715
  };
4657
4716
 
4658
4717
  // src/commands/canvas/commands/composition/unpublish.ts
4659
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2 } from "@uniformdev/canvas";
4718
+ import {
4719
+ ApiClientError,
4720
+ CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2
4721
+ } from "@uniformdev/canvas";
4660
4722
  import { diffJson as diffJson2 } from "diff";
4661
4723
  var CompositionUnpublishModule = {
4662
4724
  command: "unpublish [ids]",
@@ -4670,15 +4732,15 @@ var CompositionUnpublishModule = {
4670
4732
  type: "string"
4671
4733
  }).option("all", {
4672
4734
  alias: ["a"],
4673
- describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
4735
+ describe: "Un-publishes all compositions. Use composition ID(s) to unpublish specific one(s) instead.",
4674
4736
  default: false,
4675
4737
  type: "boolean"
4676
4738
  }).option("onlyCompositions", {
4677
- describe: "Only publishing compositions and not patterns",
4739
+ describe: "Only un-publishing compositions and not patterns",
4678
4740
  default: false,
4679
4741
  type: "boolean"
4680
4742
  }).option("onlyPatterns", {
4681
- describe: "Only pulling patterns and not compositions",
4743
+ describe: "Only un-publishing patterns and not compositions",
4682
4744
  default: false,
4683
4745
  type: "boolean",
4684
4746
  hidden: true
@@ -4701,7 +4763,7 @@ var CompositionUnpublishModule = {
4701
4763
  verbose
4702
4764
  }) => {
4703
4765
  if (!all && !ids || all && ids) {
4704
- console.error(`Specify --all or composition ID(s) to publish.`);
4766
+ console.error(`Specify --all or composition ID(s) to unpublish.`);
4705
4767
  process.exit(1);
4706
4768
  }
4707
4769
  const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -4726,7 +4788,6 @@ var CompositionUnpublishModule = {
4726
4788
  patternType,
4727
4789
  verbose
4728
4790
  });
4729
- const actions = [];
4730
4791
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
4731
4792
  for await (const obj of target.objects) {
4732
4793
  if (Array.isArray(obj.id)) {
@@ -4735,16 +4796,30 @@ var CompositionUnpublishModule = {
4735
4796
  targetItems.set(obj.id, obj);
4736
4797
  }
4737
4798
  }
4799
+ const toUnpublish = [];
4738
4800
  for await (const sourceObject of source.objects) {
4801
+ toUnpublish.push(sourceObject);
4802
+ }
4803
+ const actions = [];
4804
+ for (const sourceObject of toUnpublish) {
4739
4805
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
4740
4806
  const targetObject = targetItems.get(id);
4741
4807
  if (!targetObject) {
4742
- console.log(`Composition ${id} was not found`);
4743
- return;
4808
+ console.log(`Composition ${id} did not have a draft (removing published)`);
4744
4809
  }
4745
- console.log(`\u{1F41B} unpublishing composition: (id: ${id})`);
4746
4810
  if (!whatIf) {
4747
- actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
4811
+ actions.push(
4812
+ client.removeComposition({ ...parseCompositionSerializedId(id), state: CANVAS_PUBLISHED_STATE2 }).catch((err) => {
4813
+ const isNotFound = err instanceof ApiClientError && err.statusCode === 404;
4814
+ if (isNotFound) {
4815
+ console.warn(
4816
+ `Composition ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
4817
+ );
4818
+ return;
4819
+ }
4820
+ throw err;
4821
+ })
4822
+ );
4748
4823
  }
4749
4824
  log2({
4750
4825
  action: "update",
@@ -4752,9 +4827,10 @@ var CompositionUnpublishModule = {
4752
4827
  providerId: sourceObject.providerId,
4753
4828
  displayName: sourceObject.displayName ?? sourceObject.providerId,
4754
4829
  whatIf,
4755
- diff: () => diffJson2(targetObject.object, sourceObject.object)
4830
+ diff: () => targetObject ? diffJson2(targetObject.object, sourceObject.object) : []
4756
4831
  });
4757
4832
  }
4833
+ await Promise.all(actions);
4758
4834
  }
4759
4835
  };
4760
4836
 
@@ -4771,7 +4847,7 @@ var ComponentPatternUnpublishModule = {
4771
4847
  type: "string"
4772
4848
  }).option("all", {
4773
4849
  alias: ["a"],
4774
- describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
4850
+ describe: "Un-publishes all component patterns. Use composition ID(s) to unpublish specific one(s) instead.",
4775
4851
  default: false,
4776
4852
  type: "boolean"
4777
4853
  }).option("onlyCompositions", {
@@ -5066,7 +5142,7 @@ var CompositionPatternUnpublishModule = {
5066
5142
  type: "string"
5067
5143
  }).option("all", {
5068
5144
  alias: ["a"],
5069
- describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
5145
+ describe: "Un-publishes all composition patterns. Use composition ID(s) to unpublish specific one(s) instead.",
5070
5146
  default: false,
5071
5147
  type: "boolean"
5072
5148
  }).option("onlyCompositions", {
@@ -5964,7 +6040,7 @@ var EntryListModule = {
5964
6040
  };
5965
6041
 
5966
6042
  // src/commands/canvas/entryEngineDataSource.ts
5967
- import { ApiClientError, convertEntryToPutEntry } from "@uniformdev/canvas";
6043
+ import { ApiClientError as ApiClientError2, convertEntryToPutEntry } from "@uniformdev/canvas";
5968
6044
 
5969
6045
  // src/commands/canvas/commands/entry/_util.ts
5970
6046
  var selectEntryIdentifier = (e) => {
@@ -6010,7 +6086,7 @@ function createEntryEngineDataSource({
6010
6086
  editions: "all"
6011
6087
  })).entries;
6012
6088
  } catch (error) {
6013
- if (error instanceof ApiClientError && error.errorMessage === "Entry not found or not published") {
6089
+ if (error instanceof ApiClientError2 && error.errorMessage === "Entry not found or not published") {
6014
6090
  return [];
6015
6091
  }
6016
6092
  throw error;
@@ -6045,10 +6121,10 @@ var EntryPublishModule = {
6045
6121
  command: "publish [ids]",
6046
6122
  describe: "Publishes entry(ies)",
6047
6123
  builder: (yargs42) => withConfiguration(
6048
- withDiffOptions(
6049
- withApiOptions(
6050
- withProjectOptions(
6051
- withDiffOptions(
6124
+ withDebugOptions(
6125
+ withDiffOptions(
6126
+ withApiOptions(
6127
+ withProjectOptions(
6052
6128
  yargs42.positional("ids", {
6053
6129
  describe: "Publishes entry(ies) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
6054
6130
  type: "string"
@@ -6108,7 +6184,7 @@ var EntryPublishModule = {
6108
6184
  fileClient
6109
6185
  });
6110
6186
  },
6111
- compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
6187
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
6112
6188
  onBeforeWriteObject: async (sourceObject) => {
6113
6189
  return uploadFilesForCompositionOrEntry({
6114
6190
  entity: sourceObject,
@@ -6356,7 +6432,7 @@ var EntryRemoveModule = {
6356
6432
  };
6357
6433
 
6358
6434
  // src/commands/canvas/commands/entry/unpublish.ts
6359
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6435
+ import { ApiClientError as ApiClientError3, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE3 } from "@uniformdev/canvas";
6360
6436
  import { diffJson as diffJson3 } from "diff";
6361
6437
  var EntryUnpublishModule = {
6362
6438
  command: "unpublish [ids]",
@@ -6380,7 +6456,7 @@ var EntryUnpublishModule = {
6380
6456
  ),
6381
6457
  handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6382
6458
  if (!all && !ids || all && ids) {
6383
- console.error(`Specify --all or entry ID(s) to publish.`);
6459
+ console.error(`Specify --all or entry ID(s) to unpublish.`);
6384
6460
  process.exit(1);
6385
6461
  }
6386
6462
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -6399,7 +6475,6 @@ var EntryUnpublishModule = {
6399
6475
  entryIDs: entryIDsArray,
6400
6476
  onlyEntries: true
6401
6477
  });
6402
- const actions = [];
6403
6478
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
6404
6479
  for await (const obj of target.objects) {
6405
6480
  if (Array.isArray(obj.id)) {
@@ -6408,15 +6483,30 @@ var EntryUnpublishModule = {
6408
6483
  targetItems.set(obj.id, obj);
6409
6484
  }
6410
6485
  }
6486
+ const toUnpublish = [];
6411
6487
  for await (const sourceObject of source.objects) {
6488
+ toUnpublish.push(sourceObject);
6489
+ }
6490
+ const actions = [];
6491
+ for (const sourceObject of toUnpublish) {
6412
6492
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
6413
6493
  const targetObject = targetItems.get(id);
6414
6494
  if (!targetObject) {
6415
- console.log(`Entry ${id} was not found`);
6416
- return;
6495
+ console.log(`Entry ${id} did not have a draft (removing published)`);
6417
6496
  }
6418
6497
  if (!whatIf) {
6419
- actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE3 }));
6498
+ actions.push(
6499
+ client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE3 }).catch((err) => {
6500
+ const isNotFound = err instanceof ApiClientError3 && err.statusCode === 404;
6501
+ if (isNotFound) {
6502
+ console.warn(
6503
+ `Entry ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
6504
+ );
6505
+ return;
6506
+ }
6507
+ throw err;
6508
+ })
6509
+ );
6420
6510
  }
6421
6511
  log2({
6422
6512
  action: "update",
@@ -6424,9 +6514,10 @@ var EntryUnpublishModule = {
6424
6514
  providerId: sourceObject.providerId,
6425
6515
  displayName: sourceObject.displayName ?? sourceObject.providerId,
6426
6516
  whatIf,
6427
- diff: () => diffJson3(targetObject.object, sourceObject.object)
6517
+ diff: () => targetObject ? diffJson3(targetObject.object, sourceObject.object) : []
6428
6518
  });
6429
6519
  }
6520
+ await Promise.all(actions);
6430
6521
  }
6431
6522
  };
6432
6523
 
@@ -6660,7 +6751,7 @@ var EntryPatternPublishModule = {
6660
6751
  fileClient
6661
6752
  });
6662
6753
  },
6663
- compareContents: compareCompositionsOrEntriesWithoutAssetUrls,
6754
+ compareContents: compareCompositionsOrEntriesWithoutAssetUrlsForPublishing,
6664
6755
  onBeforeWriteObject: async (sourceObject) => {
6665
6756
  return uploadFilesForCompositionOrEntry({
6666
6757
  entity: sourceObject,
@@ -6913,11 +7004,11 @@ var EntryPatternRemoveModule = {
6913
7004
  };
6914
7005
 
6915
7006
  // src/commands/canvas/commands/entryPattern/unpublish.ts
6916
- import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
7007
+ import { ApiClientError as ApiClientError4, CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE4 } from "@uniformdev/canvas";
6917
7008
  import { diffJson as diffJson4 } from "diff";
6918
7009
  var EntryPatternUnpublishModule = {
6919
7010
  command: "unpublish [ids]",
6920
- describe: "Unpublish an entry patterns",
7011
+ describe: "Unpublish entry pattern(s)",
6921
7012
  builder: (yargs42) => withConfiguration(
6922
7013
  withDebugOptions(
6923
7014
  withApiOptions(
@@ -6937,7 +7028,7 @@ var EntryPatternUnpublishModule = {
6937
7028
  ),
6938
7029
  handler: async ({ apiHost, apiKey, proxy, ids, all, project: projectId, whatIf, verbose }) => {
6939
7030
  if (!all && !ids || all && ids) {
6940
- console.error(`Specify --all or entry pattern ID(s) to publish.`);
7031
+ console.error(`Specify --all or entry pattern ID(s) to unpublish.`);
6941
7032
  process.exit(1);
6942
7033
  }
6943
7034
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
@@ -6956,7 +7047,6 @@ var EntryPatternUnpublishModule = {
6956
7047
  entryIDs: entryIDsArray,
6957
7048
  onlyPatterns: true
6958
7049
  });
6959
- const actions = [];
6960
7050
  const log2 = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
6961
7051
  for await (const obj of target.objects) {
6962
7052
  if (Array.isArray(obj.id)) {
@@ -6965,15 +7055,30 @@ var EntryPatternUnpublishModule = {
6965
7055
  targetItems.set(obj.id, obj);
6966
7056
  }
6967
7057
  }
7058
+ const toUnpublish = [];
6968
7059
  for await (const sourceObject of source.objects) {
7060
+ toUnpublish.push(sourceObject);
7061
+ }
7062
+ const actions = [];
7063
+ for (const sourceObject of toUnpublish) {
6969
7064
  const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
6970
7065
  const targetObject = targetItems.get(id);
6971
7066
  if (!targetObject) {
6972
- console.log(`Entry pattern ${id} was not found`);
6973
- return;
7067
+ console.log(`Entry pattern ${id} did not have a draft (removing published)`);
6974
7068
  }
6975
7069
  if (!whatIf) {
6976
- actions.push(client.deleteEntry({ entryId: id, state: CANVAS_PUBLISHED_STATE4 }));
7070
+ actions.push(
7071
+ client.deleteEntry({ ...parseEntrySerializedId(id), state: CANVAS_PUBLISHED_STATE4 }).catch((err) => {
7072
+ const isNotFound = err instanceof ApiClientError4 && err.statusCode === 404;
7073
+ if (isNotFound) {
7074
+ console.warn(
7075
+ `Entry pattern ${id} was not found when unpublishing (may already be unpublished or orphaned); skipping.`
7076
+ );
7077
+ return;
7078
+ }
7079
+ throw err;
7080
+ })
7081
+ );
6977
7082
  }
6978
7083
  log2({
6979
7084
  action: "update",
@@ -6981,9 +7086,10 @@ var EntryPatternUnpublishModule = {
6981
7086
  providerId: sourceObject.providerId,
6982
7087
  displayName: sourceObject.displayName ?? sourceObject.providerId,
6983
7088
  whatIf,
6984
- diff: () => diffJson4(targetObject.object, sourceObject.object)
7089
+ diff: () => targetObject ? diffJson4(targetObject.object, sourceObject.object) : []
6985
7090
  });
6986
7091
  }
7092
+ await Promise.all(actions);
6987
7093
  }
6988
7094
  };
6989
7095
 
@@ -8948,7 +9054,7 @@ var EnrichmentModule = {
8948
9054
  import yargs23 from "yargs";
8949
9055
 
8950
9056
  // src/commands/context/commands/manifest/get.ts
8951
- import { ApiClientError as ApiClientError2, UncachedManifestClient } from "@uniformdev/context/api";
9057
+ import { ApiClientError as ApiClientError5, UncachedManifestClient } from "@uniformdev/context/api";
8952
9058
  import { gray as gray4, green as green6, red as red6 } from "colorette";
8953
9059
  import { writeFile } from "fs";
8954
9060
  import { exit } from "process";
@@ -8999,7 +9105,7 @@ var ManifestGetModule = {
8999
9105
  }
9000
9106
  } catch (e) {
9001
9107
  let message;
9002
- if (e instanceof ApiClientError2) {
9108
+ if (e instanceof ApiClientError5) {
9003
9109
  if (e.statusCode === 403) {
9004
9110
  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.`;
9005
9111
  }
@@ -9015,7 +9121,7 @@ var ManifestGetModule = {
9015
9121
  };
9016
9122
 
9017
9123
  // src/commands/context/commands/manifest/publish.ts
9018
- import { ApiClientError as ApiClientError3, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9124
+ import { ApiClientError as ApiClientError6, UncachedManifestClient as UncachedManifestClient2 } from "@uniformdev/context/api";
9019
9125
  import { gray as gray5, red as red7 } from "colorette";
9020
9126
  import { exit as exit2 } from "process";
9021
9127
  var ManifestPublishModule = {
@@ -9034,7 +9140,7 @@ var ManifestPublishModule = {
9034
9140
  await client.publish();
9035
9141
  } catch (e) {
9036
9142
  let message;
9037
- if (e instanceof ApiClientError3) {
9143
+ if (e instanceof ApiClientError6) {
9038
9144
  if (e.statusCode === 403) {
9039
9145
  message = `The API key ${apiKey} did not have permissions to publish the manifest. Ensure Uniform Context > Manifest > Publish permissions are granted.`;
9040
9146
  }
@@ -12648,19 +12754,23 @@ var SyncPullModule = {
12648
12754
  return entityConfig2 !== void 0 && "state" in entityConfig2;
12649
12755
  };
12650
12756
  const entityConfig = config2.entitiesConfig?.[entityType];
12757
+ const entityFilter = resolveEntityFilter(entityConfig, "pull");
12651
12758
  try {
12652
12759
  await spinPromise(
12653
- module.handler({
12654
- ...otherParams,
12655
- state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
12656
- format: getFormat(entityType, config2),
12657
- onlyCompositions: entityType === "composition" ? true : void 0,
12658
- onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
12659
- patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
12660
- mode: getPullMode(entityType, config2),
12661
- directory: getPullFilename(entityType, config2),
12662
- allowEmptySource: config2.allowEmptySource
12663
- }),
12760
+ withSyncEngineFilter(
12761
+ entityFilter,
12762
+ () => module.handler({
12763
+ ...otherParams,
12764
+ state: entityConfigSupportsPullState(entityConfig) ? entityConfig.state ?? 0 : 0,
12765
+ format: getFormat(entityType, config2),
12766
+ onlyCompositions: entityType === "composition" ? true : void 0,
12767
+ onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
12768
+ patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
12769
+ mode: getPullMode(entityType, config2),
12770
+ directory: getPullFilename(entityType, config2),
12771
+ allowEmptySource: config2.allowEmptySource
12772
+ })
12773
+ ),
12664
12774
  {
12665
12775
  text: `${entityType}\u2026`,
12666
12776
  successText: entityType,
@@ -12812,19 +12922,24 @@ var SyncPushModule = {
12812
12922
  );
12813
12923
  }
12814
12924
  for (const [entityType, module] of enabledEntities) {
12925
+ const entityConfig = config2.entitiesConfig?.[entityType];
12926
+ const entityFilter = resolveEntityFilter(entityConfig, "push");
12815
12927
  try {
12816
12928
  await spinPromise(
12817
- module.handler({
12818
- ...otherParams,
12819
- state: 0,
12820
- format: getFormat2(entityType, config2),
12821
- onlyCompositions: entityType === "composition" ? true : void 0,
12822
- onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
12823
- patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
12824
- mode: getPushMode(entityType, config2),
12825
- directory: getPushFilename(entityType, config2),
12826
- allowEmptySource: config2.allowEmptySource
12827
- }),
12929
+ withSyncEngineFilter(
12930
+ entityFilter,
12931
+ () => module.handler({
12932
+ ...otherParams,
12933
+ state: 0,
12934
+ format: getFormat2(entityType, config2),
12935
+ onlyCompositions: entityType === "composition" ? true : void 0,
12936
+ onlyPatterns: ["pattern", "componentPattern", "compositionPattern"].includes(entityType) ? true : void 0,
12937
+ patternType: entityType === "compositionPattern" ? "composition" : entityType === "componentPattern" ? "component" : void 0,
12938
+ mode: getPushMode(entityType, config2),
12939
+ directory: getPushFilename(entityType, config2),
12940
+ allowEmptySource: config2.allowEmptySource
12941
+ })
12942
+ ),
12828
12943
  {
12829
12944
  text: `${entityType}...`,
12830
12945
  successText: entityType,
@@ -12840,15 +12955,19 @@ var SyncPushModule = {
12840
12955
  }
12841
12956
  }
12842
12957
  if (config2.entitiesConfig?.componentPattern && config2.entitiesConfig?.componentPattern?.push?.disabled !== true && config2.entitiesConfig?.componentPattern?.publish) {
12958
+ const publishFilter = resolveEntityFilter(config2.entitiesConfig.componentPattern, "push");
12843
12959
  try {
12844
12960
  await spinPromise(
12845
- ComponentPatternPublishModule.handler({
12846
- ...otherParams,
12847
- patternType: "component",
12848
- onlyPatterns: true,
12849
- all: true,
12850
- directory: getPushFilename("componentPattern", config2)
12851
- }),
12961
+ withSyncEngineFilter(
12962
+ publishFilter,
12963
+ () => ComponentPatternPublishModule.handler({
12964
+ ...otherParams,
12965
+ patternType: "component",
12966
+ onlyPatterns: true,
12967
+ all: true,
12968
+ directory: getPushFilename("componentPattern", config2)
12969
+ })
12970
+ ),
12852
12971
  {
12853
12972
  text: "publishing component patterns...",
12854
12973
  successText: "published component patterns",
@@ -12864,15 +12983,19 @@ var SyncPushModule = {
12864
12983
  }
12865
12984
  }
12866
12985
  if (config2.entitiesConfig?.compositionPattern && config2.entitiesConfig?.compositionPattern?.push?.disabled !== true && config2.entitiesConfig?.compositionPattern?.publish) {
12986
+ const publishFilter = resolveEntityFilter(config2.entitiesConfig.compositionPattern, "push");
12867
12987
  try {
12868
12988
  await spinPromise(
12869
- CompositionPatternPublishModule.handler({
12870
- ...otherParams,
12871
- all: true,
12872
- onlyPatterns: true,
12873
- patternType: "composition",
12874
- directory: getPushFilename("compositionPattern", config2)
12875
- }),
12989
+ withSyncEngineFilter(
12990
+ publishFilter,
12991
+ () => CompositionPatternPublishModule.handler({
12992
+ ...otherParams,
12993
+ all: true,
12994
+ onlyPatterns: true,
12995
+ patternType: "composition",
12996
+ directory: getPushFilename("compositionPattern", config2)
12997
+ })
12998
+ ),
12876
12999
  {
12877
13000
  text: "publishing composition patterns...",
12878
13001
  successText: "published composition patterns",
@@ -12888,14 +13011,18 @@ var SyncPushModule = {
12888
13011
  }
12889
13012
  }
12890
13013
  if (config2.entitiesConfig?.composition && config2.entitiesConfig?.composition?.push?.disabled !== true && config2.entitiesConfig?.composition?.publish) {
13014
+ const publishFilter = resolveEntityFilter(config2.entitiesConfig.composition, "push");
12891
13015
  try {
12892
13016
  await spinPromise(
12893
- CompositionPublishModule.handler({
12894
- ...otherParams,
12895
- all: true,
12896
- onlyCompositions: true,
12897
- directory: getPushFilename("composition", config2)
12898
- }),
13017
+ withSyncEngineFilter(
13018
+ publishFilter,
13019
+ () => CompositionPublishModule.handler({
13020
+ ...otherParams,
13021
+ all: true,
13022
+ onlyCompositions: true,
13023
+ directory: getPushFilename("composition", config2)
13024
+ })
13025
+ ),
12899
13026
  {
12900
13027
  text: "publishing compositions...",
12901
13028
  successText: "published compositions",
@@ -12911,13 +13038,17 @@ var SyncPushModule = {
12911
13038
  }
12912
13039
  }
12913
13040
  if (config2.entitiesConfig?.entry && config2.entitiesConfig?.entry?.push?.disabled !== true && config2.entitiesConfig?.entry?.publish) {
13041
+ const publishFilter = resolveEntityFilter(config2.entitiesConfig.entry, "push");
12914
13042
  try {
12915
13043
  await spinPromise(
12916
- EntryPublishModule.handler({
12917
- ...otherParams,
12918
- all: true,
12919
- directory: getPushFilename("entry", config2)
12920
- }),
13044
+ withSyncEngineFilter(
13045
+ publishFilter,
13046
+ () => EntryPublishModule.handler({
13047
+ ...otherParams,
13048
+ all: true,
13049
+ directory: getPushFilename("entry", config2)
13050
+ })
13051
+ ),
12921
13052
  {
12922
13053
  text: "publishing entries...",
12923
13054
  successText: "published entries",
@@ -12933,13 +13064,17 @@ var SyncPushModule = {
12933
13064
  }
12934
13065
  }
12935
13066
  if (config2.entitiesConfig?.entryPattern && config2.entitiesConfig?.entryPattern?.push?.disabled !== true && config2.entitiesConfig?.entryPattern?.publish) {
13067
+ const publishFilter = resolveEntityFilter(config2.entitiesConfig.entryPattern, "push");
12936
13068
  try {
12937
13069
  await spinPromise(
12938
- EntryPatternPublishModule.handler({
12939
- ...otherParams,
12940
- all: true,
12941
- directory: getPushFilename("entryPattern", config2)
12942
- }),
13070
+ withSyncEngineFilter(
13071
+ publishFilter,
13072
+ () => EntryPatternPublishModule.handler({
13073
+ ...otherParams,
13074
+ all: true,
13075
+ directory: getPushFilename("entryPattern", config2)
13076
+ })
13077
+ ),
12943
13078
  {
12944
13079
  text: "publishing entry patterns...",
12945
13080
  successText: "published entry patterns",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.49.4",
3
+ "version": "20.49.5-alpha.11+4c766b7688",
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.4",
32
- "@uniformdev/canvas": "20.49.4",
33
- "@uniformdev/context": "20.49.4",
34
- "@uniformdev/files": "20.49.4",
35
- "@uniformdev/project-map": "20.49.4",
36
- "@uniformdev/redirect": "20.49.4",
37
- "@uniformdev/richtext": "20.49.4",
31
+ "@uniformdev/assets": "20.49.5-alpha.11+4c766b7688",
32
+ "@uniformdev/canvas": "20.49.5-alpha.11+4c766b7688",
33
+ "@uniformdev/context": "20.49.5-alpha.11+4c766b7688",
34
+ "@uniformdev/files": "20.49.5-alpha.11+4c766b7688",
35
+ "@uniformdev/project-map": "20.49.5-alpha.11+4c766b7688",
36
+ "@uniformdev/redirect": "20.49.5-alpha.11+4c766b7688",
37
+ "@uniformdev/richtext": "20.49.5-alpha.11+4c766b7688",
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": "dd6064aa91e338a5c00f5f362bbf8fc6ad975cc2"
84
+ "gitHead": "4c766b76885644538ea47a284a10cdb1ffc31388"
85
85
  }