@uniformdev/cli 19.49.0 → 19.49.4-alpha.67

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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  type SyncMode = 'mirror' | 'createOrUpdate' | 'create';
3
- type EntityTypes = 'category' | 'dataType' | 'quirk' | 'test' | 'signal' | 'enrichment' | 'aggregate' | 'component' | 'composition' | 'pattern' | 'projectMapDefinition' | 'projectMapNode' | 'redirect';
3
+ type EntityTypes = 'category' | 'dataType' | 'quirk' | 'test' | 'signal' | 'enrichment' | 'aggregate' | 'component' | 'composition' | 'pattern' | 'projectMapDefinition' | 'projectMapNode' | 'redirect' | 'entry' | 'contentType';
4
4
  type SyncFileFormat = 'yaml' | 'json';
5
5
  type EntityConfiguration = {
6
6
  mode?: SyncMode;
package/dist/index.mjs CHANGED
@@ -1,5 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // ../../node_modules/.pnpm/tsup@7.2.0_postcss@8.4.28_ts-node@10.9.1_typescript@5.1.6/node_modules/tsup/assets/esm_shims.js
4
+ import { fileURLToPath } from "url";
5
+ import path from "path";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+
3
10
  // src/index.ts
4
11
  import * as dotenv from "dotenv";
5
12
  import yargs24 from "yargs";
@@ -70,7 +77,7 @@ async function createArraySyncEngineDataSource({
70
77
 
71
78
  // src/sync/fileSyncEngineDataSource.ts
72
79
  import { red } from "colorette";
73
- import { existsSync, mkdirSync } from "fs";
80
+ import { existsSync, mkdirSync as mkdirSync2 } from "fs";
74
81
  import { readdir, unlink } from "fs/promises";
75
82
  import { extname as extname2, join } from "path";
76
83
 
@@ -114,11 +121,11 @@ var loadConfig = (configPath) => {
114
121
  };
115
122
 
116
123
  // src/sync/util.ts
117
- import { readFileSync, writeFileSync } from "fs";
124
+ import { mkdirSync, readFileSync, writeFileSync } from "fs";
118
125
  import httpsProxyAgent from "https-proxy-agent";
119
126
  import unfetch from "isomorphic-unfetch";
120
127
  import { dump, load } from "js-yaml";
121
- import { extname } from "path";
128
+ import { dirname, extname, isAbsolute, resolve, sep } from "path";
122
129
  function withConfiguration(yargs25) {
123
130
  return yargs25.option("serialization", {
124
131
  skipValidation: true,
@@ -198,8 +205,8 @@ function withDiffOptions(yargs25) {
198
205
  alias: ["d"]
199
206
  });
200
207
  }
201
- function isPathAPackageFile(path4) {
202
- const extension = extname(path4);
208
+ function isPathAPackageFile(path5) {
209
+ const extension = extname(path5);
203
210
  return extension === ".yaml" || extension === ".yml" || extension === ".json";
204
211
  }
205
212
  function emitWithFormat(object, format, filename) {
@@ -229,11 +236,35 @@ ${content}`;
229
236
  throw new Error(`Unsupported format: ${format}`);
230
237
  }
231
238
  if (filename) {
239
+ const directory = dirname(filename);
240
+ mkDirByPathSync(directory);
232
241
  writeFileSync(filename, content, "utf8");
233
242
  } else {
234
243
  console.log(content);
235
244
  }
236
245
  }
246
+ function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) {
247
+ const initDir = isAbsolute(targetDir) ? sep : "";
248
+ const baseDir = isRelativeToScript ? __dirname : ".";
249
+ return targetDir.split(sep).reduce((parentDir, childDir) => {
250
+ const curDir = resolve(baseDir, parentDir, childDir);
251
+ try {
252
+ mkdirSync(curDir);
253
+ } catch (err) {
254
+ if (err.code === "EEXIST") {
255
+ return curDir;
256
+ }
257
+ if (err.code === "ENOENT") {
258
+ throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`);
259
+ }
260
+ const caughtErr = ["EACCES", "EPERM", "EISDIR"].indexOf(err.code) > -1;
261
+ if (!caughtErr || caughtErr && curDir === resolve(targetDir)) {
262
+ throw err;
263
+ }
264
+ }
265
+ return curDir;
266
+ }, initDir);
267
+ }
237
268
  function readFileToObject(filename) {
238
269
  const file = readFileSync(filename, "utf8");
239
270
  return load(file, { filename, json: true });
@@ -328,7 +359,7 @@ async function createFileSyncEngineDataSource({
328
359
  }) {
329
360
  const dirExists = existsSync(directory);
330
361
  if (!dirExists) {
331
- mkdirSync(directory, { recursive: true });
362
+ mkdirSync2(directory, { recursive: true });
332
363
  }
333
364
  const rawFilenames = await readdir(directory, "utf-8");
334
365
  const filenames = new Set(
@@ -574,6 +605,13 @@ function createSyncEngineConsoleLogger(options) {
574
605
  );
575
606
  };
576
607
  }
608
+ function createPublishStatusSyncEngineConsoleLogger(options) {
609
+ const { indent, prefix, status } = options ?? {};
610
+ return function syncEngineConsoleLogger({ displayName, whatIf }) {
611
+ const actionTag = status === "publish" ? green("[P]") : yellow("[U]");
612
+ console.log(`${indent ?? ""}${whatIf ? gray("[WHATIF]") : ""}${actionTag}${prefix ?? ""} ${displayName}`);
613
+ };
614
+ }
577
615
 
578
616
  // src/commands/canvas/commands/category/get.ts
579
617
  var CategoryGetModule = {
@@ -734,6 +772,7 @@ var CategoryPullModule = {
734
772
  target,
735
773
  mode,
736
774
  whatIf,
775
+ allowEmptySource: true,
737
776
  log: createSyncEngineConsoleLogger({ diffMode })
738
777
  });
739
778
  }
@@ -1040,6 +1079,7 @@ var ComponentPullModule = {
1040
1079
  target,
1041
1080
  mode,
1042
1081
  whatIf,
1082
+ allowEmptySource: true,
1043
1083
  log: createSyncEngineConsoleLogger({ diffMode })
1044
1084
  });
1045
1085
  }
@@ -1172,7 +1212,10 @@ import yargs3 from "yargs";
1172
1212
  import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
1173
1213
 
1174
1214
  // src/commands/canvas/util.ts
1175
- import { CANVAS_DRAFT_STATE, CANVAS_PUBLISHED_STATE } from "@uniformdev/canvas";
1215
+ import {
1216
+ CANVAS_DRAFT_STATE,
1217
+ CANVAS_PUBLISHED_STATE
1218
+ } from "@uniformdev/canvas";
1176
1219
  function prepCompositionForDisk(composition) {
1177
1220
  const prepped = {
1178
1221
  ...composition
@@ -1448,7 +1491,6 @@ var CompositionPublishModule = {
1448
1491
  all,
1449
1492
  whatIf,
1450
1493
  project: projectId,
1451
- diff: diffMode,
1452
1494
  onlyCompositions,
1453
1495
  onlyPatterns
1454
1496
  }) => {
@@ -1479,7 +1521,7 @@ var CompositionPublishModule = {
1479
1521
  // Publishing is one-direction operation, so no need to support automatic un-publishing
1480
1522
  mode: "createOrUpdate",
1481
1523
  whatIf,
1482
- log: createSyncEngineConsoleLogger({ diffMode })
1524
+ log: createPublishStatusSyncEngineConsoleLogger({ status: "publish" })
1483
1525
  });
1484
1526
  }
1485
1527
  };
@@ -1557,8 +1599,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
1557
1599
  fileUploadQueue.add(async () => {
1558
1600
  try {
1559
1601
  const fileAlreadyExistsChecks = await Promise.all([
1560
- options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
1561
- options.fileClient.getFile({ projectId: options.projectId, sourceId: hash }).catch(() => null)
1602
+ options.fileClient.get({ url }).catch(() => null),
1603
+ options.fileClient.get({ sourceId: hash }).catch(() => null)
1562
1604
  ]);
1563
1605
  if (fileAlreadyExistsChecks.some((check) => check !== null)) {
1564
1606
  return;
@@ -1590,13 +1632,12 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
1590
1632
  };
1591
1633
  }
1592
1634
  })();
1593
- const { id, method, uploadUrl } = await options.fileClient.createNewProjectFile({
1635
+ const { id, method, uploadUrl } = await options.fileClient.insert({
1594
1636
  name: fileName,
1595
1637
  mediaType: preferredType(url.split(".").at(-1) ?? ""),
1596
1638
  size: fileBuffer.length,
1597
1639
  width,
1598
1640
  height,
1599
- projectId: options.projectId,
1600
1641
  sourceId: hash
1601
1642
  });
1602
1643
  const uploadResponse = await fetch(uploadUrl, {
@@ -1608,9 +1649,9 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
1608
1649
  return;
1609
1650
  }
1610
1651
  const checkForFile = async () => {
1611
- const file = await options.fileClient.getFile({ id });
1612
- if (!file || file.state !== FILE_READY_STATE) {
1613
- await new Promise((resolve) => setTimeout(resolve, 500));
1652
+ const file = await options.fileClient.get({ id });
1653
+ if (!file || file.state !== FILE_READY_STATE || !file.url) {
1654
+ await new Promise((resolve2) => setTimeout(resolve2, 500));
1614
1655
  return checkForFile();
1615
1656
  }
1616
1657
  return file.url;
@@ -1643,8 +1684,8 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
1643
1684
  fileUrlReplacementQueue.add(async () => {
1644
1685
  try {
1645
1686
  const fileAlreadyExistsChecks = await Promise.all([
1646
- options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
1647
- options.fileClient.getFile({ projectId: options.projectId, sourceId: hash }).catch(() => null)
1687
+ options.fileClient.get({ url }).catch(() => null),
1688
+ options.fileClient.get({ sourceId: hash }).catch(() => null)
1648
1689
  ]);
1649
1690
  const file = fileAlreadyExistsChecks.find((check) => check !== null);
1650
1691
  if (!file) {
@@ -1747,6 +1788,7 @@ var CompositionPullModule = {
1747
1788
  target,
1748
1789
  mode,
1749
1790
  whatIf,
1791
+ allowEmptySource: true,
1750
1792
  log: createSyncEngineConsoleLogger({ diffMode }),
1751
1793
  onBeforeWriteObject: async (sourceObject) => {
1752
1794
  return extractAndDownloadUniformFilesForObject(sourceObject, {
@@ -1917,7 +1959,6 @@ var CompositionUnpublishModule = {
1917
1959
  onlyCompositions,
1918
1960
  onlyPatterns,
1919
1961
  project: projectId,
1920
- diff,
1921
1962
  whatIf
1922
1963
  }) => {
1923
1964
  if (!all && !ids || all && ids) {
@@ -1943,7 +1984,7 @@ var CompositionUnpublishModule = {
1943
1984
  onlyPatterns
1944
1985
  });
1945
1986
  const actions = [];
1946
- const log = createSyncEngineConsoleLogger({ diffMode: diff });
1987
+ const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
1947
1988
  for await (const obj of target.objects) {
1948
1989
  if (Array.isArray(obj.id)) {
1949
1990
  obj.id.forEach((o) => targetItems.set(o, obj));
@@ -2162,6 +2203,7 @@ var ContentTypePullModule = {
2162
2203
  target,
2163
2204
  mode,
2164
2205
  whatIf,
2206
+ allowEmptySource: true,
2165
2207
  log: createSyncEngineConsoleLogger({ diffMode })
2166
2208
  });
2167
2209
  }
@@ -2350,8 +2392,12 @@ function createDataTypeEngineDataSource({
2350
2392
  client
2351
2393
  }) {
2352
2394
  async function* getObjects() {
2395
+ var _a;
2353
2396
  const dataTypes = (await client.get()).results;
2354
2397
  for await (const dataType of dataTypes) {
2398
+ if (((_a = dataType.custom) == null ? void 0 : _a.uniformAutogenerated) === true) {
2399
+ continue;
2400
+ }
2355
2401
  const result = {
2356
2402
  id: selectIdentifier4(dataType),
2357
2403
  displayName: selectDisplayName4(dataType),
@@ -2453,6 +2499,7 @@ var DataTypePullModule = {
2453
2499
  target,
2454
2500
  mode,
2455
2501
  whatIf,
2502
+ allowEmptySource: true,
2456
2503
  log: createSyncEngineConsoleLogger({ diffMode })
2457
2504
  });
2458
2505
  }
@@ -2627,7 +2674,10 @@ var EntryListModule = {
2627
2674
  };
2628
2675
 
2629
2676
  // src/commands/canvas/commands/entry/pull.ts
2630
- import { ContentClient as ContentClient9 } from "@uniformdev/canvas";
2677
+ import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
2678
+
2679
+ // src/commands/canvas/entryEngineDataSource.ts
2680
+ import { convertEntryToPutEntry } from "@uniformdev/canvas";
2631
2681
 
2632
2682
  // src/commands/canvas/commands/entry/_util.ts
2633
2683
  var selectEntryIdentifier = (e) => e.entry._id;
@@ -2635,16 +2685,24 @@ var selectEntryDisplayName = (e) => `${e.entry._name ?? "Untitled"} (pid: ${e.en
2635
2685
 
2636
2686
  // src/commands/canvas/entryEngineDataSource.ts
2637
2687
  function createEntryEngineDataSource({
2638
- client
2688
+ client,
2689
+ state
2639
2690
  }) {
2691
+ const stateId = convertCompositionState(state);
2640
2692
  async function* getObjects() {
2641
- const { entries } = await client.getEntries({ offset: 0, limit: 1e3 });
2693
+ const { entries } = await client.getEntries({
2694
+ offset: 0,
2695
+ limit: 1e3,
2696
+ skipDataResolution: true,
2697
+ state: stateId,
2698
+ withComponentIDs: true
2699
+ });
2642
2700
  for await (const e of entries) {
2643
2701
  const result = {
2644
2702
  id: selectEntryIdentifier(e),
2645
2703
  displayName: selectEntryDisplayName(e),
2646
2704
  providerId: e.entry._id,
2647
- object: e
2705
+ object: prepCompositionForDisk(e)
2648
2706
  };
2649
2707
  yield result;
2650
2708
  }
@@ -2655,7 +2713,7 @@ function createEntryEngineDataSource({
2655
2713
  await client.deleteEntry({ entryId: providerId });
2656
2714
  },
2657
2715
  writeObject: async ({ object }) => {
2658
- await client.upsertEntry(object);
2716
+ await client.upsertEntry({ ...convertEntryToPutEntry(object), state: stateId });
2659
2717
  }
2660
2718
  };
2661
2719
  }
@@ -2667,28 +2725,30 @@ var EntryPullModule = {
2667
2725
  builder: (yargs25) => withConfiguration(
2668
2726
  withApiOptions(
2669
2727
  withProjectOptions(
2670
- withDiffOptions(
2671
- yargs25.positional("directory", {
2672
- describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2673
- type: "string"
2674
- }).option("format", {
2675
- alias: ["f"],
2676
- describe: "Output format",
2677
- default: "yaml",
2678
- choices: ["yaml", "json"],
2679
- type: "string"
2680
- }).option("what-if", {
2681
- alias: ["w"],
2682
- describe: "What-if mode reports what would be done but changes no files",
2683
- default: false,
2684
- type: "boolean"
2685
- }).option("mode", {
2686
- alias: ["m"],
2687
- describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
2688
- choices: ["create", "createOrUpdate", "mirror"],
2689
- default: "mirror",
2690
- type: "string"
2691
- })
2728
+ withStateOptions(
2729
+ withDiffOptions(
2730
+ yargs25.positional("directory", {
2731
+ describe: "Directory to save the entries to. If a filename ending in yaml or json is used, a package file will be created instead of files in the directory.",
2732
+ type: "string"
2733
+ }).option("format", {
2734
+ alias: ["f"],
2735
+ describe: "Output format",
2736
+ default: "yaml",
2737
+ choices: ["yaml", "json"],
2738
+ type: "string"
2739
+ }).option("what-if", {
2740
+ alias: ["w"],
2741
+ describe: "What-if mode reports what would be done but changes no files",
2742
+ default: false,
2743
+ type: "boolean"
2744
+ }).option("mode", {
2745
+ alias: ["m"],
2746
+ describe: 'What kind of changes can be made. "create" = create new files, update nothing. "createOrUpdate" = create new files, update existing, delete nothing. "mirror" = create, update, and delete to mirror state',
2747
+ choices: ["create", "createOrUpdate", "mirror"],
2748
+ default: "mirror",
2749
+ type: "string"
2750
+ })
2751
+ )
2692
2752
  )
2693
2753
  )
2694
2754
  )
@@ -2701,18 +2761,19 @@ var EntryPullModule = {
2701
2761
  format,
2702
2762
  mode,
2703
2763
  whatIf,
2764
+ state,
2704
2765
  project: projectId,
2705
2766
  diff: diffMode
2706
2767
  }) => {
2707
2768
  const fetch3 = nodeFetchProxy(proxy);
2708
- const client = new ContentClient9({
2769
+ const client = new ContentClient10({
2709
2770
  apiKey,
2710
2771
  apiHost,
2711
2772
  fetch: fetch3,
2712
2773
  projectId,
2713
2774
  bypassCache: true
2714
2775
  });
2715
- const source = createEntryEngineDataSource({ client });
2776
+ const source = createEntryEngineDataSource({ client, state });
2716
2777
  let target;
2717
2778
  const isPackage = isPathAPackageFile(directory);
2718
2779
  if (isPackage) {
@@ -2739,35 +2800,38 @@ var EntryPullModule = {
2739
2800
  target,
2740
2801
  mode,
2741
2802
  whatIf,
2803
+ allowEmptySource: true,
2742
2804
  log: createSyncEngineConsoleLogger({ diffMode })
2743
2805
  });
2744
2806
  }
2745
2807
  };
2746
2808
 
2747
2809
  // src/commands/canvas/commands/entry/push.ts
2748
- import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
2810
+ import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
2749
2811
  var EntryPushModule = {
2750
2812
  command: "push <directory>",
2751
2813
  describe: "Pushes all entries from files in a directory to Uniform",
2752
2814
  builder: (yargs25) => withConfiguration(
2753
2815
  withApiOptions(
2754
2816
  withProjectOptions(
2755
- withDiffOptions(
2756
- yargs25.positional("directory", {
2757
- describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
2758
- type: "string"
2759
- }).option("what-if", {
2760
- alias: ["w"],
2761
- describe: "What-if mode reports what would be done but changes nothing",
2762
- default: false,
2763
- type: "boolean"
2764
- }).option("mode", {
2765
- alias: ["m"],
2766
- describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
2767
- choices: ["create", "createOrUpdate", "mirror"],
2768
- default: "mirror",
2769
- type: "string"
2770
- })
2817
+ withStateOptions(
2818
+ withDiffOptions(
2819
+ yargs25.positional("directory", {
2820
+ describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
2821
+ type: "string"
2822
+ }).option("what-if", {
2823
+ alias: ["w"],
2824
+ describe: "What-if mode reports what would be done but changes nothing",
2825
+ default: false,
2826
+ type: "boolean"
2827
+ }).option("mode", {
2828
+ alias: ["m"],
2829
+ describe: 'What kind of changes can be made. "create" = create new, update nothing. "createOrUpdate" = create new, update existing, delete nothing. "mirror" = create, update, and delete',
2830
+ choices: ["create", "createOrUpdate", "mirror"],
2831
+ default: "mirror",
2832
+ type: "string"
2833
+ })
2834
+ )
2771
2835
  )
2772
2836
  )
2773
2837
  )
@@ -2779,11 +2843,12 @@ var EntryPushModule = {
2779
2843
  directory,
2780
2844
  mode,
2781
2845
  whatIf,
2846
+ state,
2782
2847
  project: projectId,
2783
2848
  diff: diffMode
2784
2849
  }) => {
2785
2850
  const fetch3 = nodeFetchProxy(proxy);
2786
- const client = new ContentClient10({
2851
+ const client = new ContentClient11({
2787
2852
  apiKey,
2788
2853
  apiHost,
2789
2854
  fetch: fetch3,
@@ -2806,7 +2871,7 @@ var EntryPushModule = {
2806
2871
  selectDisplayName: selectEntryDisplayName
2807
2872
  });
2808
2873
  }
2809
- const target = createEntryEngineDataSource({ client });
2874
+ const target = createEntryEngineDataSource({ client, state });
2810
2875
  await syncEngine({
2811
2876
  source,
2812
2877
  target,
@@ -2818,7 +2883,7 @@ var EntryPushModule = {
2818
2883
  };
2819
2884
 
2820
2885
  // src/commands/canvas/commands/entry/remove.ts
2821
- import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
2886
+ import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
2822
2887
  var EntryRemoveModule = {
2823
2888
  command: "remove <id>",
2824
2889
  aliases: ["delete", "rm"],
@@ -2832,13 +2897,13 @@ var EntryRemoveModule = {
2832
2897
  ),
2833
2898
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
2834
2899
  const fetch3 = nodeFetchProxy(proxy);
2835
- const client = new ContentClient11({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2900
+ const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2836
2901
  await client.deleteEntry({ entryId: id });
2837
2902
  }
2838
2903
  };
2839
2904
 
2840
2905
  // src/commands/canvas/commands/entry/update.ts
2841
- import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
2906
+ import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
2842
2907
  var EntryUpdateModule = {
2843
2908
  command: "update <filename>",
2844
2909
  aliases: ["put"],
@@ -2852,7 +2917,7 @@ var EntryUpdateModule = {
2852
2917
  ),
2853
2918
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
2854
2919
  const fetch3 = nodeFetchProxy(proxy);
2855
- const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2920
+ const client = new ContentClient13({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2856
2921
  const file = readFileToObject(filename);
2857
2922
  await client.upsertEntry(file);
2858
2923
  }
@@ -4695,16 +4760,16 @@ import ora from "ora";
4695
4760
  var makeSpinner = () => {
4696
4761
  const spinners = [];
4697
4762
  const stopAllSpinners = () => spinners.forEach((spinner) => spinner.stop());
4698
- const spin = async (text) => {
4763
+ const spin2 = async (text) => {
4699
4764
  const spinner = ora(text).start();
4700
4765
  spinners.push(spinner);
4701
- const minWait = new Promise((resolve) => setTimeout(resolve, 500));
4766
+ const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
4702
4767
  return async () => {
4703
4768
  await minWait;
4704
4769
  spinner.stop();
4705
4770
  };
4706
4771
  };
4707
- return { stopAllSpinners, spin };
4772
+ return { stopAllSpinners, spin: spin2 };
4708
4773
  };
4709
4774
 
4710
4775
  // src/telemetry/telemetry.ts
@@ -4714,7 +4779,7 @@ import { PostHog } from "posthog-node";
4714
4779
  // package.json
4715
4780
  var package_default = {
4716
4781
  name: "@uniformdev/cli",
4717
- version: "19.49.0",
4782
+ version: "19.56.0",
4718
4783
  description: "Uniform command line interface tool",
4719
4784
  license: "SEE LICENSE IN LICENSE.txt",
4720
4785
  main: "./cli.js",
@@ -4751,7 +4816,7 @@ var package_default = {
4751
4816
  "isomorphic-git": "1.24.5",
4752
4817
  "isomorphic-unfetch": "^3.1.0",
4753
4818
  "js-yaml": "^4.1.0",
4754
- jsonwebtoken: "9.0.1",
4819
+ jsonwebtoken: "9.0.2",
4755
4820
  "lodash.isequalwith": "^4.4.0",
4756
4821
  open: "9.1.0",
4757
4822
  ora: "6.3.1",
@@ -4763,9 +4828,9 @@ var package_default = {
4763
4828
  zod: "3.21.4"
4764
4829
  },
4765
4830
  devDependencies: {
4766
- "@types/diff": "5.0.3",
4831
+ "@types/diff": "5.0.4",
4767
4832
  "@types/inquirer": "9.0.3",
4768
- "@types/js-yaml": "4.0.5",
4833
+ "@types/js-yaml": "4.0.6",
4769
4834
  "@types/jsonwebtoken": "9.0.2",
4770
4835
  "@types/lodash.isequalwith": "4.4.7",
4771
4836
  "@types/node": "18.17.6",
@@ -4840,7 +4905,7 @@ import jwt from "jsonwebtoken";
4840
4905
  import open from "open";
4841
4906
 
4842
4907
  // src/url.ts
4843
- var makeUrl = (baseUrl, path4) => [baseUrl.trim().replace(/\/+$/, ""), path4.trim().replace(/^\/+/, "")].join("/");
4908
+ var makeUrl = (baseUrl, path5) => [baseUrl.trim().replace(/\/+$/, ""), path5.trim().replace(/^\/+/, "")].join("/");
4844
4909
 
4845
4910
  // src/auth/getBearerToken.ts
4846
4911
  async function getBearerToken(baseUrl) {
@@ -4912,7 +4977,9 @@ var WRITE_PERMISSIONS = [
4912
4977
  "OPT_DELETE_TESTS",
4913
4978
  "RDT_UPDATE",
4914
4979
  "RDT_CREATE",
4915
- "RDT_DELETE"
4980
+ "RDT_DELETE",
4981
+ "UPM_DATATYPE",
4982
+ "UPM_DATACONN"
4916
4983
  ];
4917
4984
  var makeApiKey = (teamId, projectId, name, permissions) => ({
4918
4985
  name,
@@ -4943,8 +5010,8 @@ var getLimitsSchema = z.object({
4943
5010
  })
4944
5011
  });
4945
5012
  var createClient = (baseUrl, authToken) => {
4946
- const request2 = async (path4, opts, allowedNon2xxStatusCodes = []) => {
4947
- const res = await fetch(makeUrl(baseUrl, path4), {
5013
+ const request2 = async (path5, opts, allowedNon2xxStatusCodes = []) => {
5014
+ const res = await fetch(makeUrl(baseUrl, path5), {
4948
5015
  ...opts,
4949
5016
  headers: { Authorization: `Bearer ${authToken}` }
4950
5017
  });
@@ -4952,18 +5019,18 @@ var createClient = (baseUrl, authToken) => {
4952
5019
  return res;
4953
5020
  } else {
4954
5021
  throw new Error(
4955
- `Non-2xx API response: ${opts.method} ${path4} responded with ${res.status} ${res.statusText}`
5022
+ `Non-2xx API response: ${opts.method} ${path5} responded with ${res.status} ${res.statusText}`
4956
5023
  );
4957
5024
  }
4958
5025
  };
4959
- const requestJson = async (path4, opts, schema2, allowedNon2xxStatusCodes = []) => {
4960
- const res = await request2(path4, opts, allowedNon2xxStatusCodes);
5026
+ const requestJson = async (path5, opts, schema2, allowedNon2xxStatusCodes = []) => {
5027
+ const res = await request2(path5, opts, allowedNon2xxStatusCodes);
4961
5028
  const data = await res.json();
4962
5029
  const parseResult = schema2.safeParse(data);
4963
5030
  if (parseResult.success) {
4964
5031
  return parseResult.data;
4965
5032
  } else {
4966
- throw new Error(`Invalid ${opts.method} ${path4} response: ${parseResult.error.message}`);
5033
+ throw new Error(`Invalid ${opts.method} ${path5} response: ${parseResult.error.message}`);
4967
5034
  }
4968
5035
  };
4969
5036
  return {
@@ -5097,15 +5164,15 @@ import fsj2 from "fs-jetpack";
5097
5164
  import * as git from "isomorphic-git";
5098
5165
  import * as http from "isomorphic-git/http/node/index.js";
5099
5166
  import os from "os";
5100
- import path from "path";
5167
+ import path2 from "path";
5101
5168
  async function cloneStarter({
5102
- spin,
5169
+ spin: spin2,
5103
5170
  githubPath,
5104
5171
  targetDir,
5105
5172
  dotEnvFile
5106
5173
  }) {
5107
- const done = await spin("Fetching starter code...");
5108
- const cloneDir = path.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
5174
+ const done = await spin2("Fetching starter code...");
5175
+ const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
5109
5176
  const [user, repo, ...pathSegments] = githubPath.split("/");
5110
5177
  try {
5111
5178
  await git.clone({
@@ -5123,10 +5190,10 @@ async function cloneStarter({
5123
5190
  if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
5124
5191
  throw new Error(`"${targetDir}" is not empty`);
5125
5192
  }
5126
- const starterDir = path.join(cloneDir, ...pathSegments);
5193
+ const starterDir = path2.join(cloneDir, ...pathSegments);
5127
5194
  fsj2.copy(starterDir, targetDir, { overwrite: true });
5128
5195
  if (dotEnvFile) {
5129
- fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
5196
+ fs3.writeFileSync(path2.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
5130
5197
  }
5131
5198
  console.log(`
5132
5199
  Your project now lives in ${targetDir} \u2728`);
@@ -5142,9 +5209,9 @@ Installing project dependencies...
5142
5209
  }
5143
5210
 
5144
5211
  // src/projects/getOrCreateProject.ts
5145
- import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
5212
+ import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync3 } from "fs";
5146
5213
  import inquirer2 from "inquirer";
5147
- import path2 from "path";
5214
+ import path3 from "path";
5148
5215
  import slugify from "slugify";
5149
5216
  var newProjectId = "$new";
5150
5217
  async function getOrCreateProject({
@@ -5154,7 +5221,7 @@ async function getOrCreateProject({
5154
5221
  user,
5155
5222
  explicitName,
5156
5223
  client,
5157
- spin,
5224
+ spin: spin2,
5158
5225
  checkTargetDir,
5159
5226
  explicitTargetDir,
5160
5227
  previewUrl,
@@ -5184,7 +5251,7 @@ async function getOrCreateProject({
5184
5251
  checkTargetDir,
5185
5252
  explicitTargetDir
5186
5253
  });
5187
- const projectId = await createProject({ client, projectName, spin, teamId, previewUrl });
5254
+ const projectId = await createProject({ client, projectName, spin: spin2, teamId, previewUrl });
5188
5255
  telemetry.send("project created", { projectId, targetDir });
5189
5256
  return {
5190
5257
  projectId,
@@ -5225,11 +5292,11 @@ async function getNewProjectName({
5225
5292
  async function createProject({
5226
5293
  projectName,
5227
5294
  teamId,
5228
- spin,
5295
+ spin: spin2,
5229
5296
  client,
5230
5297
  previewUrl
5231
5298
  }) {
5232
- const done = await spin("Creating your new project...");
5299
+ const done = await spin2("Creating your new project...");
5233
5300
  const projectId = await client.createProject(teamId, projectName, previewUrl);
5234
5301
  await done();
5235
5302
  return projectId;
@@ -5267,10 +5334,10 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
5267
5334
  if (checkTargetDir) {
5268
5335
  let targetDir = explicitTargetDir ?? process.cwd();
5269
5336
  if (!existsSync2(targetDir)) {
5270
- mkdirSync2(targetDir, { recursive: true });
5337
+ mkdirSync3(targetDir, { recursive: true });
5271
5338
  }
5272
5339
  if (fs4.readdirSync(targetDir).length > 0) {
5273
- targetDir = path2.resolve(targetDir, projectNameSlug);
5340
+ targetDir = path3.resolve(targetDir, projectNameSlug);
5274
5341
  if (fs4.existsSync(targetDir)) {
5275
5342
  throw new Error(`${targetDir} already exists, choose a different name.`);
5276
5343
  }
@@ -5358,11 +5425,11 @@ var getUserInfo = async (baseUrl, authToken, subject) => {
5358
5425
  async function fetchUserAndEnsureFirstTeamExists({
5359
5426
  baseUrl,
5360
5427
  auth: { authToken, decoded },
5361
- spin,
5428
+ spin: spin2,
5362
5429
  telemetry
5363
5430
  }) {
5364
5431
  const uniformClient = createClient(baseUrl, authToken);
5365
- const done = await spin("Fetching user information...");
5432
+ const done = await spin2("Fetching user information...");
5366
5433
  let user = await getUserInfo(baseUrl, authToken, decoded.sub);
5367
5434
  if (user.teams.length < 1) {
5368
5435
  await uniformClient.createTeam(`${user.name}'s team`);
@@ -5375,7 +5442,7 @@ async function fetchUserAndEnsureFirstTeamExists({
5375
5442
 
5376
5443
  // src/commands/new/commands/new.ts
5377
5444
  async function newHandler({
5378
- spin,
5445
+ spin: spin2,
5379
5446
  projectName,
5380
5447
  apiHost,
5381
5448
  outputPath,
@@ -5387,7 +5454,7 @@ async function newHandler({
5387
5454
  const auth = await getBearerToken(apiHost);
5388
5455
  const { authToken } = auth;
5389
5456
  const uniformClient = createClient(apiHost, authToken);
5390
- const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
5457
+ const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin: spin2, telemetry });
5391
5458
  const { teamId } = await chooseTeam(
5392
5459
  user,
5393
5460
  `Hey ${user.name}! Choose a Uniform team for your new project`,
@@ -5486,7 +5553,7 @@ async function newHandler({
5486
5553
  client: uniformClient,
5487
5554
  createNew: true,
5488
5555
  chooseExisting: false,
5489
- spin,
5556
+ spin: spin2,
5490
5557
  teamId,
5491
5558
  user,
5492
5559
  explicitName: projectName,
@@ -5495,7 +5562,7 @@ async function newHandler({
5495
5562
  previewUrl: serverUrl + previewPath,
5496
5563
  telemetry
5497
5564
  });
5498
- let done = await spin("Generating API keys...");
5565
+ let done = await spin2("Generating API keys...");
5499
5566
  const { readApiKey, writeApiKey } = await uniformClient.createApiKeys(teamId, projectId);
5500
5567
  await done();
5501
5568
  const dotEnvFile = [
@@ -5513,7 +5580,7 @@ async function newHandler({
5513
5580
  if (githubUri.endsWith("commerce-starter")) {
5514
5581
  const stableFakecommerceId = "fakecommerce-d04dcf12-f811-401d-add8-1fb81cfdb8a5";
5515
5582
  const canaryFakecommerceId = "fakecommerce-f94cf199-7ea4-46ce-ae8b-825668bb79bc";
5516
- done = await spin("Installing Fake Commerce...");
5583
+ done = await spin2("Installing Fake Commerce...");
5517
5584
  await uniformClient.installIntegration({
5518
5585
  projectId,
5519
5586
  type: apiHost.includes("canary") ? canaryFakecommerceId : stableFakecommerceId
@@ -5523,7 +5590,7 @@ async function newHandler({
5523
5590
  const cloneStartTimestamp = Date.now();
5524
5591
  const { runNpmInstall } = await cloneStarter({
5525
5592
  githubPath: githubUri,
5526
- spin,
5593
+ spin: spin2,
5527
5594
  targetDir,
5528
5595
  dotEnvFile
5529
5596
  });
@@ -5531,7 +5598,7 @@ async function newHandler({
5531
5598
  const installStartTimestamp = Date.now();
5532
5599
  await runNpmInstall();
5533
5600
  telemetry.send("deps installed", { duration: Date.now() - installStartTimestamp });
5534
- done = await spin("Creating components and compositions");
5601
+ done = await spin2("Creating components and compositions");
5535
5602
  await runNpm(targetDir, ["run", "uniform:push"]);
5536
5603
  await runNpm(targetDir, ["run", "uniform:publish"]);
5537
5604
  await done();
@@ -5561,12 +5628,12 @@ npm run dev
5561
5628
  }
5562
5629
 
5563
5630
  // src/commands/new/commands/new-mesh-integration.ts
5564
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, readdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
5631
+ import { existsSync as existsSync3, mkdirSync as mkdirSync4, readdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
5565
5632
  import inquirer5 from "inquirer";
5566
- import path3 from "path";
5633
+ import path4 from "path";
5567
5634
  import slugify2 from "slugify";
5568
5635
  async function newMeshIntegrationHandler({
5569
- spin,
5636
+ spin: spin2,
5570
5637
  apiHost,
5571
5638
  outputPath,
5572
5639
  telemetry
@@ -5575,7 +5642,7 @@ async function newMeshIntegrationHandler({
5575
5642
  const auth = await getBearerToken(apiHost);
5576
5643
  const { authToken } = auth;
5577
5644
  const uniformClient = createClient(apiHost, authToken);
5578
- const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
5645
+ const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin: spin2, telemetry });
5579
5646
  const { teamId } = await chooseTeam(
5580
5647
  user,
5581
5648
  `Hey ${user.name}! Choose a Uniform team to register your integration`,
@@ -5600,11 +5667,11 @@ async function newMeshIntegrationHandler({
5600
5667
  const { targetDir, typeSlug } = validateIntegrationName(answer.name, outputPath);
5601
5668
  const { runNpmInstall } = await cloneStarter({
5602
5669
  githubPath: `uniformdev/examples/examples/mesh-integration`,
5603
- spin,
5670
+ spin: spin2,
5604
5671
  targetDir
5605
5672
  });
5606
- let done = await spin("Registering integration to team...");
5607
- const pathToManifest = path3.resolve(targetDir, "mesh-manifest.json");
5673
+ let done = await spin2("Registering integration to team...");
5674
+ const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
5608
5675
  if (!existsSync3(pathToManifest)) {
5609
5676
  throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
5610
5677
  }
@@ -5613,7 +5680,7 @@ async function newMeshIntegrationHandler({
5613
5680
  manifestJson.type = typeSlug;
5614
5681
  manifestJson.displayName = name;
5615
5682
  writeFileSync2(pathToManifest, JSON.stringify(manifestJson, null, 2), "utf-8");
5616
- const packageJsonPath = path3.resolve(targetDir, "package.json");
5683
+ const packageJsonPath = path4.resolve(targetDir, "package.json");
5617
5684
  const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
5618
5685
  packageJson.name = typeSlug;
5619
5686
  writeFileSync2(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
@@ -5625,13 +5692,13 @@ async function newMeshIntegrationHandler({
5625
5692
  client: uniformClient,
5626
5693
  createNew: true,
5627
5694
  chooseExisting: true,
5628
- spin,
5695
+ spin: spin2,
5629
5696
  teamId,
5630
5697
  user,
5631
5698
  checkTargetDir: false,
5632
5699
  telemetry
5633
5700
  });
5634
- done = await spin("Installing integration to project...");
5701
+ done = await spin2("Installing integration to project...");
5635
5702
  await uniformClient.installIntegration({ projectId, type: typeSlug });
5636
5703
  await done();
5637
5704
  console.log(`
@@ -5660,10 +5727,10 @@ function validateIntegrationName(integrationName, explicitOutputPath) {
5660
5727
  }
5661
5728
  let targetDir = explicitOutputPath ?? process.cwd();
5662
5729
  if (!existsSync3(targetDir)) {
5663
- mkdirSync3(targetDir, { recursive: true });
5730
+ mkdirSync4(targetDir, { recursive: true });
5664
5731
  }
5665
5732
  if (readdirSync(targetDir).length > 0) {
5666
- targetDir = path3.resolve(targetDir, typeSlug);
5733
+ targetDir = path4.resolve(targetDir, typeSlug);
5667
5734
  if (existsSync3(targetDir)) {
5668
5735
  throw new Error(`${targetDir} directory already exists, choose a different name.`);
5669
5736
  }
@@ -5701,10 +5768,10 @@ var NewCmd = {
5701
5768
  ),
5702
5769
  describe: "Start a new Uniform project",
5703
5770
  handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
5704
- const { stopAllSpinners, spin } = makeSpinner();
5771
+ const { stopAllSpinners, spin: spin2 } = makeSpinner();
5705
5772
  const telemetry = new Telemetry("cli new", disableTelemetry || apiHost !== stableApiHost);
5706
5773
  try {
5707
- await newHandler({ spin, projectName: name, apiHost, outputPath, telemetry });
5774
+ await newHandler({ spin: spin2, projectName: name, apiHost, outputPath, telemetry });
5708
5775
  stopAllSpinners();
5709
5776
  process.exit(0);
5710
5777
  } catch (err) {
@@ -5738,10 +5805,10 @@ var NewMeshCmd = {
5738
5805
  ),
5739
5806
  describe: "Start a new Uniform project",
5740
5807
  handler: async function({ apiHost, outputPath, disableTelemetry }) {
5741
- const { stopAllSpinners, spin } = makeSpinner();
5808
+ const { stopAllSpinners, spin: spin2 } = makeSpinner();
5742
5809
  const telemetry = new Telemetry("cli new mesh", disableTelemetry || apiHost !== stableApiHost);
5743
5810
  try {
5744
- await newMeshIntegrationHandler({ spin, apiHost, outputPath, telemetry });
5811
+ await newMeshIntegrationHandler({ spin: spin2, apiHost, outputPath, telemetry });
5745
5812
  stopAllSpinners();
5746
5813
  process.exit(0);
5747
5814
  } catch (err) {
@@ -6821,6 +6888,31 @@ var RedirectCommand = {
6821
6888
  // src/commands/sync/index.ts
6822
6889
  import yargs23 from "yargs";
6823
6890
 
6891
+ // src/commands/sync/commands/util.ts
6892
+ import ora2 from "ora";
6893
+ function spin(entityType) {
6894
+ const spinner = ora2(entityType).start();
6895
+ const consoleLog = console.log;
6896
+ console.log = (...text) => {
6897
+ if (text.length === 1 && typeof text[0] === "string") {
6898
+ spinner.text += "\n" + text;
6899
+ } else {
6900
+ consoleLog(...text);
6901
+ }
6902
+ };
6903
+ return {
6904
+ ...spinner,
6905
+ stop: () => {
6906
+ spinner.stop();
6907
+ console.log = consoleLog;
6908
+ },
6909
+ succeed() {
6910
+ spinner.succeed();
6911
+ console.log = consoleLog;
6912
+ }
6913
+ };
6914
+ }
6915
+
6824
6916
  // src/commands/sync/commands/pull.ts
6825
6917
  var SyncPullModule = {
6826
6918
  command: "pull",
@@ -6854,21 +6946,35 @@ var SyncPullModule = {
6854
6946
  composition: CompositionPullModule,
6855
6947
  projectMapDefinition: ProjectMapDefinitionPullModule,
6856
6948
  projectMapNode: ProjectMapNodePullModule,
6857
- redirect: RedirectDefinitionPullModule
6949
+ redirect: RedirectDefinitionPullModule,
6950
+ entry: EntryPullModule,
6951
+ contentType: ContentTypePullModule
6858
6952
  }).filter(([entityType]) => {
6859
6953
  var _a, _b, _c, _d, _e, _f;
6860
6954
  return Boolean((_a = config2.entitiesConfig) == null ? void 0 : _a[entityType]) && ((_c = (_b = config2.entitiesConfig) == null ? void 0 : _b[entityType]) == null ? void 0 : _c.disabled) !== true && ((_f = (_e = (_d = config2.entitiesConfig) == null ? void 0 : _d[entityType]) == null ? void 0 : _e.pull) == null ? void 0 : _f.disabled) !== true;
6861
6955
  });
6956
+ if (enabledEntities.length === 0) {
6957
+ throw new Error(
6958
+ "No entity types were configured to be pulled. Please make sure you have configuration file (e.g. uniform.config.ts) and at least one entity type is enabled."
6959
+ );
6960
+ }
6862
6961
  for (const [entityType, module3] of enabledEntities) {
6863
- await module3.handler({
6864
- ...otherParams,
6865
- state: 0,
6866
- format: getFormat(entityType, config2),
6867
- onlyCompositions: entityType === "composition" ? true : void 0,
6868
- onlyPatterns: entityType === "pattern" ? true : void 0,
6869
- mode: getPullMode(entityType, config2),
6870
- directory: getPullFilename(entityType, config2)
6871
- });
6962
+ const spinner = spin(entityType);
6963
+ try {
6964
+ await module3.handler({
6965
+ ...otherParams,
6966
+ state: 0,
6967
+ format: getFormat(entityType, config2),
6968
+ onlyCompositions: entityType === "composition" ? true : void 0,
6969
+ onlyPatterns: entityType === "pattern" ? true : void 0,
6970
+ mode: getPullMode(entityType, config2),
6971
+ directory: getPullFilename(entityType, config2)
6972
+ });
6973
+ spinner.succeed();
6974
+ } catch (e) {
6975
+ spinner.stop();
6976
+ throw e;
6977
+ }
6872
6978
  }
6873
6979
  }
6874
6980
  };
@@ -6930,21 +7036,35 @@ var SyncPushModule = {
6930
7036
  composition: CompositionPushModule,
6931
7037
  projectMapDefinition: ProjectMapDefinitionPushModule,
6932
7038
  projectMapNode: ProjectMapNodePushModule,
6933
- redirect: RedirectDefinitionPushModule
7039
+ redirect: RedirectDefinitionPushModule,
7040
+ contentType: ContentTypePushModule,
7041
+ entry: EntryPushModule
6934
7042
  }).filter(([entityType]) => {
6935
7043
  var _a2, _b2, _c2, _d2, _e2, _f2;
6936
7044
  return Boolean((_a2 = config2.entitiesConfig) == null ? void 0 : _a2[entityType]) && ((_c2 = (_b2 = config2.entitiesConfig) == null ? void 0 : _b2[entityType]) == null ? void 0 : _c2.disabled) !== true && ((_f2 = (_e2 = (_d2 = config2.entitiesConfig) == null ? void 0 : _d2[entityType]) == null ? void 0 : _e2.push) == null ? void 0 : _f2.disabled) !== true;
6937
7045
  });
7046
+ if (enabledEntities.length === 0) {
7047
+ throw new Error(
7048
+ "No entities were configured to be pushed. Please make sure you have configuration file and at least one entity type is enabled."
7049
+ );
7050
+ }
6938
7051
  for (const [entityType, module3] of enabledEntities) {
6939
- await module3.handler({
6940
- ...otherParams,
6941
- state: 0,
6942
- format: getFormat2(entityType, config2),
6943
- onlyCompositions: entityType === "composition" ? true : void 0,
6944
- onlyPatterns: entityType === "pattern" ? true : void 0,
6945
- mode: getPushMode(entityType, config2),
6946
- directory: getPushFilename(entityType, config2)
6947
- });
7052
+ const spinner = spin(entityType);
7053
+ try {
7054
+ await module3.handler({
7055
+ ...otherParams,
7056
+ state: 0,
7057
+ format: getFormat2(entityType, config2),
7058
+ onlyCompositions: entityType === "composition" ? true : void 0,
7059
+ onlyPatterns: entityType === "pattern" ? true : void 0,
7060
+ mode: getPushMode(entityType, config2),
7061
+ directory: getPushFilename(entityType, config2)
7062
+ });
7063
+ spinner.succeed();
7064
+ } catch (e) {
7065
+ spinner.stop();
7066
+ throw e;
7067
+ }
6948
7068
  }
6949
7069
  if (((_a = config2.entitiesConfig) == null ? void 0 : _a.pattern) && ((_d = (_c = (_b = config2.entitiesConfig) == null ? void 0 : _b.pattern) == null ? void 0 : _c.push) == null ? void 0 : _d.disabled) !== true && ((_f = (_e = config2.entitiesConfig) == null ? void 0 : _e.pattern) == null ? void 0 : _f.publish)) {
6950
7070
  await PatternPublishModule.handler({ ...otherParams, all: true });
@@ -7032,14 +7152,14 @@ import { join as join3 } from "path";
7032
7152
 
7033
7153
  // src/fs.ts
7034
7154
  import { promises as fs5 } from "fs";
7035
- async function readJSON(path4) {
7036
- const fileContents = await fs5.readFile(path4, "utf-8");
7155
+ async function readJSON(path5) {
7156
+ const fileContents = await fs5.readFile(path5, "utf-8");
7037
7157
  return JSON.parse(fileContents);
7038
7158
  }
7039
- async function tryReadJSON(path4, missingValue = null) {
7159
+ async function tryReadJSON(path5, missingValue = null) {
7040
7160
  try {
7041
- const stat = await fs5.stat(path4);
7042
- return stat.isFile() ? await readJSON(path4) : missingValue;
7161
+ const stat = await fs5.stat(path5);
7162
+ return stat.isFile() ? await readJSON(path5) : missingValue;
7043
7163
  } catch (e) {
7044
7164
  return missingValue;
7045
7165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.49.0",
3
+ "version": "19.49.4-alpha.67+9773e3b65",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -17,11 +17,11 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@thi.ng/mime": "^2.2.23",
20
- "@uniformdev/canvas": "19.49.0",
21
- "@uniformdev/context": "19.49.0",
22
- "@uniformdev/files": "19.49.0",
23
- "@uniformdev/project-map": "19.49.0",
24
- "@uniformdev/redirect": "19.49.0",
20
+ "@uniformdev/canvas": "19.49.4-alpha.67+9773e3b65",
21
+ "@uniformdev/context": "19.49.4-alpha.67+9773e3b65",
22
+ "@uniformdev/files": "19.49.4-alpha.67+9773e3b65",
23
+ "@uniformdev/project-map": "19.49.4-alpha.67+9773e3b65",
24
+ "@uniformdev/redirect": "19.49.4-alpha.67+9773e3b65",
25
25
  "colorette": "2.0.20",
26
26
  "cosmiconfig": "8.2.0",
27
27
  "cosmiconfig-typescript-loader": "5.0.0",
@@ -37,7 +37,7 @@
37
37
  "isomorphic-git": "1.24.5",
38
38
  "isomorphic-unfetch": "^3.1.0",
39
39
  "js-yaml": "^4.1.0",
40
- "jsonwebtoken": "9.0.1",
40
+ "jsonwebtoken": "9.0.2",
41
41
  "lodash.isequalwith": "^4.4.0",
42
42
  "open": "9.1.0",
43
43
  "ora": "6.3.1",
@@ -49,9 +49,9 @@
49
49
  "zod": "3.21.4"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/diff": "5.0.3",
52
+ "@types/diff": "5.0.4",
53
53
  "@types/inquirer": "9.0.3",
54
- "@types/js-yaml": "4.0.5",
54
+ "@types/js-yaml": "4.0.6",
55
55
  "@types/jsonwebtoken": "9.0.2",
56
56
  "@types/lodash.isequalwith": "4.4.7",
57
57
  "@types/node": "18.17.6",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "7aaac583f8003f3e510e6a68a76828a32cbf451d"
69
+ "gitHead": "9773e3b65168255768f5cbecf2536988fa0e03af"
70
70
  }