@uniformdev/cli 19.49.1 → 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
@@ -605,6 +605,13 @@ function createSyncEngineConsoleLogger(options) {
605
605
  );
606
606
  };
607
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
+ }
608
615
 
609
616
  // src/commands/canvas/commands/category/get.ts
610
617
  var CategoryGetModule = {
@@ -765,6 +772,7 @@ var CategoryPullModule = {
765
772
  target,
766
773
  mode,
767
774
  whatIf,
775
+ allowEmptySource: true,
768
776
  log: createSyncEngineConsoleLogger({ diffMode })
769
777
  });
770
778
  }
@@ -1071,6 +1079,7 @@ var ComponentPullModule = {
1071
1079
  target,
1072
1080
  mode,
1073
1081
  whatIf,
1082
+ allowEmptySource: true,
1074
1083
  log: createSyncEngineConsoleLogger({ diffMode })
1075
1084
  });
1076
1085
  }
@@ -1203,7 +1212,10 @@ import yargs3 from "yargs";
1203
1212
  import { UncachedCanvasClient as UncachedCanvasClient7 } from "@uniformdev/canvas";
1204
1213
 
1205
1214
  // src/commands/canvas/util.ts
1206
- import { CANVAS_DRAFT_STATE, CANVAS_PUBLISHED_STATE } from "@uniformdev/canvas";
1215
+ import {
1216
+ CANVAS_DRAFT_STATE,
1217
+ CANVAS_PUBLISHED_STATE
1218
+ } from "@uniformdev/canvas";
1207
1219
  function prepCompositionForDisk(composition) {
1208
1220
  const prepped = {
1209
1221
  ...composition
@@ -1479,7 +1491,6 @@ var CompositionPublishModule = {
1479
1491
  all,
1480
1492
  whatIf,
1481
1493
  project: projectId,
1482
- diff: diffMode,
1483
1494
  onlyCompositions,
1484
1495
  onlyPatterns
1485
1496
  }) => {
@@ -1510,7 +1521,7 @@ var CompositionPublishModule = {
1510
1521
  // Publishing is one-direction operation, so no need to support automatic un-publishing
1511
1522
  mode: "createOrUpdate",
1512
1523
  whatIf,
1513
- log: createSyncEngineConsoleLogger({ diffMode })
1524
+ log: createPublishStatusSyncEngineConsoleLogger({ status: "publish" })
1514
1525
  });
1515
1526
  }
1516
1527
  };
@@ -1588,8 +1599,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
1588
1599
  fileUploadQueue.add(async () => {
1589
1600
  try {
1590
1601
  const fileAlreadyExistsChecks = await Promise.all([
1591
- options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
1592
- 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)
1593
1604
  ]);
1594
1605
  if (fileAlreadyExistsChecks.some((check) => check !== null)) {
1595
1606
  return;
@@ -1621,13 +1632,12 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
1621
1632
  };
1622
1633
  }
1623
1634
  })();
1624
- const { id, method, uploadUrl } = await options.fileClient.createNewProjectFile({
1635
+ const { id, method, uploadUrl } = await options.fileClient.insert({
1625
1636
  name: fileName,
1626
1637
  mediaType: preferredType(url.split(".").at(-1) ?? ""),
1627
1638
  size: fileBuffer.length,
1628
1639
  width,
1629
1640
  height,
1630
- projectId: options.projectId,
1631
1641
  sourceId: hash
1632
1642
  });
1633
1643
  const uploadResponse = await fetch(uploadUrl, {
@@ -1639,8 +1649,8 @@ var extractAndUploadUniformFilesForObject = async (object, options) => {
1639
1649
  return;
1640
1650
  }
1641
1651
  const checkForFile = async () => {
1642
- const file = await options.fileClient.getFile({ id });
1643
- if (!file || file.state !== FILE_READY_STATE) {
1652
+ const file = await options.fileClient.get({ id });
1653
+ if (!file || file.state !== FILE_READY_STATE || !file.url) {
1644
1654
  await new Promise((resolve2) => setTimeout(resolve2, 500));
1645
1655
  return checkForFile();
1646
1656
  }
@@ -1674,8 +1684,8 @@ var swapOutUniformFileUrlsForTargetProject = async (object, options) => {
1674
1684
  fileUrlReplacementQueue.add(async () => {
1675
1685
  try {
1676
1686
  const fileAlreadyExistsChecks = await Promise.all([
1677
- options.fileClient.getFile({ projectId: options.projectId, url }).catch(() => null),
1678
- 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)
1679
1689
  ]);
1680
1690
  const file = fileAlreadyExistsChecks.find((check) => check !== null);
1681
1691
  if (!file) {
@@ -1778,6 +1788,7 @@ var CompositionPullModule = {
1778
1788
  target,
1779
1789
  mode,
1780
1790
  whatIf,
1791
+ allowEmptySource: true,
1781
1792
  log: createSyncEngineConsoleLogger({ diffMode }),
1782
1793
  onBeforeWriteObject: async (sourceObject) => {
1783
1794
  return extractAndDownloadUniformFilesForObject(sourceObject, {
@@ -1948,7 +1959,6 @@ var CompositionUnpublishModule = {
1948
1959
  onlyCompositions,
1949
1960
  onlyPatterns,
1950
1961
  project: projectId,
1951
- diff,
1952
1962
  whatIf
1953
1963
  }) => {
1954
1964
  if (!all && !ids || all && ids) {
@@ -1974,7 +1984,7 @@ var CompositionUnpublishModule = {
1974
1984
  onlyPatterns
1975
1985
  });
1976
1986
  const actions = [];
1977
- const log = createSyncEngineConsoleLogger({ diffMode: diff });
1987
+ const log = createPublishStatusSyncEngineConsoleLogger({ status: "unpublish" });
1978
1988
  for await (const obj of target.objects) {
1979
1989
  if (Array.isArray(obj.id)) {
1980
1990
  obj.id.forEach((o) => targetItems.set(o, obj));
@@ -2193,6 +2203,7 @@ var ContentTypePullModule = {
2193
2203
  target,
2194
2204
  mode,
2195
2205
  whatIf,
2206
+ allowEmptySource: true,
2196
2207
  log: createSyncEngineConsoleLogger({ diffMode })
2197
2208
  });
2198
2209
  }
@@ -2381,8 +2392,12 @@ function createDataTypeEngineDataSource({
2381
2392
  client
2382
2393
  }) {
2383
2394
  async function* getObjects() {
2395
+ var _a;
2384
2396
  const dataTypes = (await client.get()).results;
2385
2397
  for await (const dataType of dataTypes) {
2398
+ if (((_a = dataType.custom) == null ? void 0 : _a.uniformAutogenerated) === true) {
2399
+ continue;
2400
+ }
2386
2401
  const result = {
2387
2402
  id: selectIdentifier4(dataType),
2388
2403
  displayName: selectDisplayName4(dataType),
@@ -2484,6 +2499,7 @@ var DataTypePullModule = {
2484
2499
  target,
2485
2500
  mode,
2486
2501
  whatIf,
2502
+ allowEmptySource: true,
2487
2503
  log: createSyncEngineConsoleLogger({ diffMode })
2488
2504
  });
2489
2505
  }
@@ -2658,7 +2674,10 @@ var EntryListModule = {
2658
2674
  };
2659
2675
 
2660
2676
  // src/commands/canvas/commands/entry/pull.ts
2661
- 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";
2662
2681
 
2663
2682
  // src/commands/canvas/commands/entry/_util.ts
2664
2683
  var selectEntryIdentifier = (e) => e.entry._id;
@@ -2666,16 +2685,24 @@ var selectEntryDisplayName = (e) => `${e.entry._name ?? "Untitled"} (pid: ${e.en
2666
2685
 
2667
2686
  // src/commands/canvas/entryEngineDataSource.ts
2668
2687
  function createEntryEngineDataSource({
2669
- client
2688
+ client,
2689
+ state
2670
2690
  }) {
2691
+ const stateId = convertCompositionState(state);
2671
2692
  async function* getObjects() {
2672
- 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
+ });
2673
2700
  for await (const e of entries) {
2674
2701
  const result = {
2675
2702
  id: selectEntryIdentifier(e),
2676
2703
  displayName: selectEntryDisplayName(e),
2677
2704
  providerId: e.entry._id,
2678
- object: e
2705
+ object: prepCompositionForDisk(e)
2679
2706
  };
2680
2707
  yield result;
2681
2708
  }
@@ -2686,7 +2713,7 @@ function createEntryEngineDataSource({
2686
2713
  await client.deleteEntry({ entryId: providerId });
2687
2714
  },
2688
2715
  writeObject: async ({ object }) => {
2689
- await client.upsertEntry(object);
2716
+ await client.upsertEntry({ ...convertEntryToPutEntry(object), state: stateId });
2690
2717
  }
2691
2718
  };
2692
2719
  }
@@ -2698,28 +2725,30 @@ var EntryPullModule = {
2698
2725
  builder: (yargs25) => withConfiguration(
2699
2726
  withApiOptions(
2700
2727
  withProjectOptions(
2701
- withDiffOptions(
2702
- yargs25.positional("directory", {
2703
- 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.",
2704
- type: "string"
2705
- }).option("format", {
2706
- alias: ["f"],
2707
- describe: "Output format",
2708
- default: "yaml",
2709
- choices: ["yaml", "json"],
2710
- type: "string"
2711
- }).option("what-if", {
2712
- alias: ["w"],
2713
- describe: "What-if mode reports what would be done but changes no files",
2714
- default: false,
2715
- type: "boolean"
2716
- }).option("mode", {
2717
- alias: ["m"],
2718
- 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',
2719
- choices: ["create", "createOrUpdate", "mirror"],
2720
- default: "mirror",
2721
- type: "string"
2722
- })
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
+ )
2723
2752
  )
2724
2753
  )
2725
2754
  )
@@ -2732,18 +2761,19 @@ var EntryPullModule = {
2732
2761
  format,
2733
2762
  mode,
2734
2763
  whatIf,
2764
+ state,
2735
2765
  project: projectId,
2736
2766
  diff: diffMode
2737
2767
  }) => {
2738
2768
  const fetch3 = nodeFetchProxy(proxy);
2739
- const client = new ContentClient9({
2769
+ const client = new ContentClient10({
2740
2770
  apiKey,
2741
2771
  apiHost,
2742
2772
  fetch: fetch3,
2743
2773
  projectId,
2744
2774
  bypassCache: true
2745
2775
  });
2746
- const source = createEntryEngineDataSource({ client });
2776
+ const source = createEntryEngineDataSource({ client, state });
2747
2777
  let target;
2748
2778
  const isPackage = isPathAPackageFile(directory);
2749
2779
  if (isPackage) {
@@ -2770,35 +2800,38 @@ var EntryPullModule = {
2770
2800
  target,
2771
2801
  mode,
2772
2802
  whatIf,
2803
+ allowEmptySource: true,
2773
2804
  log: createSyncEngineConsoleLogger({ diffMode })
2774
2805
  });
2775
2806
  }
2776
2807
  };
2777
2808
 
2778
2809
  // src/commands/canvas/commands/entry/push.ts
2779
- import { ContentClient as ContentClient10 } from "@uniformdev/canvas";
2810
+ import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
2780
2811
  var EntryPushModule = {
2781
2812
  command: "push <directory>",
2782
2813
  describe: "Pushes all entries from files in a directory to Uniform",
2783
2814
  builder: (yargs25) => withConfiguration(
2784
2815
  withApiOptions(
2785
2816
  withProjectOptions(
2786
- withDiffOptions(
2787
- yargs25.positional("directory", {
2788
- describe: "Directory to read the entries from. If a filename is used, a package will be read instead.",
2789
- type: "string"
2790
- }).option("what-if", {
2791
- alias: ["w"],
2792
- describe: "What-if mode reports what would be done but changes nothing",
2793
- default: false,
2794
- type: "boolean"
2795
- }).option("mode", {
2796
- alias: ["m"],
2797
- 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',
2798
- choices: ["create", "createOrUpdate", "mirror"],
2799
- default: "mirror",
2800
- type: "string"
2801
- })
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
+ )
2802
2835
  )
2803
2836
  )
2804
2837
  )
@@ -2810,11 +2843,12 @@ var EntryPushModule = {
2810
2843
  directory,
2811
2844
  mode,
2812
2845
  whatIf,
2846
+ state,
2813
2847
  project: projectId,
2814
2848
  diff: diffMode
2815
2849
  }) => {
2816
2850
  const fetch3 = nodeFetchProxy(proxy);
2817
- const client = new ContentClient10({
2851
+ const client = new ContentClient11({
2818
2852
  apiKey,
2819
2853
  apiHost,
2820
2854
  fetch: fetch3,
@@ -2837,7 +2871,7 @@ var EntryPushModule = {
2837
2871
  selectDisplayName: selectEntryDisplayName
2838
2872
  });
2839
2873
  }
2840
- const target = createEntryEngineDataSource({ client });
2874
+ const target = createEntryEngineDataSource({ client, state });
2841
2875
  await syncEngine({
2842
2876
  source,
2843
2877
  target,
@@ -2849,7 +2883,7 @@ var EntryPushModule = {
2849
2883
  };
2850
2884
 
2851
2885
  // src/commands/canvas/commands/entry/remove.ts
2852
- import { ContentClient as ContentClient11 } from "@uniformdev/canvas";
2886
+ import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
2853
2887
  var EntryRemoveModule = {
2854
2888
  command: "remove <id>",
2855
2889
  aliases: ["delete", "rm"],
@@ -2863,13 +2897,13 @@ var EntryRemoveModule = {
2863
2897
  ),
2864
2898
  handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
2865
2899
  const fetch3 = nodeFetchProxy(proxy);
2866
- const client = new ContentClient11({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2900
+ const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2867
2901
  await client.deleteEntry({ entryId: id });
2868
2902
  }
2869
2903
  };
2870
2904
 
2871
2905
  // src/commands/canvas/commands/entry/update.ts
2872
- import { ContentClient as ContentClient12 } from "@uniformdev/canvas";
2906
+ import { ContentClient as ContentClient13 } from "@uniformdev/canvas";
2873
2907
  var EntryUpdateModule = {
2874
2908
  command: "update <filename>",
2875
2909
  aliases: ["put"],
@@ -2883,7 +2917,7 @@ var EntryUpdateModule = {
2883
2917
  ),
2884
2918
  handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
2885
2919
  const fetch3 = nodeFetchProxy(proxy);
2886
- const client = new ContentClient12({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2920
+ const client = new ContentClient13({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
2887
2921
  const file = readFileToObject(filename);
2888
2922
  await client.upsertEntry(file);
2889
2923
  }
@@ -4726,7 +4760,7 @@ import ora from "ora";
4726
4760
  var makeSpinner = () => {
4727
4761
  const spinners = [];
4728
4762
  const stopAllSpinners = () => spinners.forEach((spinner) => spinner.stop());
4729
- const spin = async (text) => {
4763
+ const spin2 = async (text) => {
4730
4764
  const spinner = ora(text).start();
4731
4765
  spinners.push(spinner);
4732
4766
  const minWait = new Promise((resolve2) => setTimeout(resolve2, 500));
@@ -4735,7 +4769,7 @@ var makeSpinner = () => {
4735
4769
  spinner.stop();
4736
4770
  };
4737
4771
  };
4738
- return { stopAllSpinners, spin };
4772
+ return { stopAllSpinners, spin: spin2 };
4739
4773
  };
4740
4774
 
4741
4775
  // src/telemetry/telemetry.ts
@@ -4745,7 +4779,7 @@ import { PostHog } from "posthog-node";
4745
4779
  // package.json
4746
4780
  var package_default = {
4747
4781
  name: "@uniformdev/cli",
4748
- version: "19.49.1",
4782
+ version: "19.56.0",
4749
4783
  description: "Uniform command line interface tool",
4750
4784
  license: "SEE LICENSE IN LICENSE.txt",
4751
4785
  main: "./cli.js",
@@ -4782,7 +4816,7 @@ var package_default = {
4782
4816
  "isomorphic-git": "1.24.5",
4783
4817
  "isomorphic-unfetch": "^3.1.0",
4784
4818
  "js-yaml": "^4.1.0",
4785
- jsonwebtoken: "9.0.1",
4819
+ jsonwebtoken: "9.0.2",
4786
4820
  "lodash.isequalwith": "^4.4.0",
4787
4821
  open: "9.1.0",
4788
4822
  ora: "6.3.1",
@@ -4794,9 +4828,9 @@ var package_default = {
4794
4828
  zod: "3.21.4"
4795
4829
  },
4796
4830
  devDependencies: {
4797
- "@types/diff": "5.0.3",
4831
+ "@types/diff": "5.0.4",
4798
4832
  "@types/inquirer": "9.0.3",
4799
- "@types/js-yaml": "4.0.5",
4833
+ "@types/js-yaml": "4.0.6",
4800
4834
  "@types/jsonwebtoken": "9.0.2",
4801
4835
  "@types/lodash.isequalwith": "4.4.7",
4802
4836
  "@types/node": "18.17.6",
@@ -5132,12 +5166,12 @@ import * as http from "isomorphic-git/http/node/index.js";
5132
5166
  import os from "os";
5133
5167
  import path2 from "path";
5134
5168
  async function cloneStarter({
5135
- spin,
5169
+ spin: spin2,
5136
5170
  githubPath,
5137
5171
  targetDir,
5138
5172
  dotEnvFile
5139
5173
  }) {
5140
- const done = await spin("Fetching starter code...");
5174
+ const done = await spin2("Fetching starter code...");
5141
5175
  const cloneDir = path2.join(os.tmpdir(), `uniform-new-${crypto2.randomBytes(20).toString("hex")}`);
5142
5176
  const [user, repo, ...pathSegments] = githubPath.split("/");
5143
5177
  try {
@@ -5187,7 +5221,7 @@ async function getOrCreateProject({
5187
5221
  user,
5188
5222
  explicitName,
5189
5223
  client,
5190
- spin,
5224
+ spin: spin2,
5191
5225
  checkTargetDir,
5192
5226
  explicitTargetDir,
5193
5227
  previewUrl,
@@ -5217,7 +5251,7 @@ async function getOrCreateProject({
5217
5251
  checkTargetDir,
5218
5252
  explicitTargetDir
5219
5253
  });
5220
- const projectId = await createProject({ client, projectName, spin, teamId, previewUrl });
5254
+ const projectId = await createProject({ client, projectName, spin: spin2, teamId, previewUrl });
5221
5255
  telemetry.send("project created", { projectId, targetDir });
5222
5256
  return {
5223
5257
  projectId,
@@ -5258,11 +5292,11 @@ async function getNewProjectName({
5258
5292
  async function createProject({
5259
5293
  projectName,
5260
5294
  teamId,
5261
- spin,
5295
+ spin: spin2,
5262
5296
  client,
5263
5297
  previewUrl
5264
5298
  }) {
5265
- const done = await spin("Creating your new project...");
5299
+ const done = await spin2("Creating your new project...");
5266
5300
  const projectId = await client.createProject(teamId, projectName, previewUrl);
5267
5301
  await done();
5268
5302
  return projectId;
@@ -5391,11 +5425,11 @@ var getUserInfo = async (baseUrl, authToken, subject) => {
5391
5425
  async function fetchUserAndEnsureFirstTeamExists({
5392
5426
  baseUrl,
5393
5427
  auth: { authToken, decoded },
5394
- spin,
5428
+ spin: spin2,
5395
5429
  telemetry
5396
5430
  }) {
5397
5431
  const uniformClient = createClient(baseUrl, authToken);
5398
- const done = await spin("Fetching user information...");
5432
+ const done = await spin2("Fetching user information...");
5399
5433
  let user = await getUserInfo(baseUrl, authToken, decoded.sub);
5400
5434
  if (user.teams.length < 1) {
5401
5435
  await uniformClient.createTeam(`${user.name}'s team`);
@@ -5408,7 +5442,7 @@ async function fetchUserAndEnsureFirstTeamExists({
5408
5442
 
5409
5443
  // src/commands/new/commands/new.ts
5410
5444
  async function newHandler({
5411
- spin,
5445
+ spin: spin2,
5412
5446
  projectName,
5413
5447
  apiHost,
5414
5448
  outputPath,
@@ -5420,7 +5454,7 @@ async function newHandler({
5420
5454
  const auth = await getBearerToken(apiHost);
5421
5455
  const { authToken } = auth;
5422
5456
  const uniformClient = createClient(apiHost, authToken);
5423
- const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
5457
+ const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin: spin2, telemetry });
5424
5458
  const { teamId } = await chooseTeam(
5425
5459
  user,
5426
5460
  `Hey ${user.name}! Choose a Uniform team for your new project`,
@@ -5519,7 +5553,7 @@ async function newHandler({
5519
5553
  client: uniformClient,
5520
5554
  createNew: true,
5521
5555
  chooseExisting: false,
5522
- spin,
5556
+ spin: spin2,
5523
5557
  teamId,
5524
5558
  user,
5525
5559
  explicitName: projectName,
@@ -5528,7 +5562,7 @@ async function newHandler({
5528
5562
  previewUrl: serverUrl + previewPath,
5529
5563
  telemetry
5530
5564
  });
5531
- let done = await spin("Generating API keys...");
5565
+ let done = await spin2("Generating API keys...");
5532
5566
  const { readApiKey, writeApiKey } = await uniformClient.createApiKeys(teamId, projectId);
5533
5567
  await done();
5534
5568
  const dotEnvFile = [
@@ -5546,7 +5580,7 @@ async function newHandler({
5546
5580
  if (githubUri.endsWith("commerce-starter")) {
5547
5581
  const stableFakecommerceId = "fakecommerce-d04dcf12-f811-401d-add8-1fb81cfdb8a5";
5548
5582
  const canaryFakecommerceId = "fakecommerce-f94cf199-7ea4-46ce-ae8b-825668bb79bc";
5549
- done = await spin("Installing Fake Commerce...");
5583
+ done = await spin2("Installing Fake Commerce...");
5550
5584
  await uniformClient.installIntegration({
5551
5585
  projectId,
5552
5586
  type: apiHost.includes("canary") ? canaryFakecommerceId : stableFakecommerceId
@@ -5556,7 +5590,7 @@ async function newHandler({
5556
5590
  const cloneStartTimestamp = Date.now();
5557
5591
  const { runNpmInstall } = await cloneStarter({
5558
5592
  githubPath: githubUri,
5559
- spin,
5593
+ spin: spin2,
5560
5594
  targetDir,
5561
5595
  dotEnvFile
5562
5596
  });
@@ -5564,7 +5598,7 @@ async function newHandler({
5564
5598
  const installStartTimestamp = Date.now();
5565
5599
  await runNpmInstall();
5566
5600
  telemetry.send("deps installed", { duration: Date.now() - installStartTimestamp });
5567
- done = await spin("Creating components and compositions");
5601
+ done = await spin2("Creating components and compositions");
5568
5602
  await runNpm(targetDir, ["run", "uniform:push"]);
5569
5603
  await runNpm(targetDir, ["run", "uniform:publish"]);
5570
5604
  await done();
@@ -5599,7 +5633,7 @@ import inquirer5 from "inquirer";
5599
5633
  import path4 from "path";
5600
5634
  import slugify2 from "slugify";
5601
5635
  async function newMeshIntegrationHandler({
5602
- spin,
5636
+ spin: spin2,
5603
5637
  apiHost,
5604
5638
  outputPath,
5605
5639
  telemetry
@@ -5608,7 +5642,7 @@ async function newMeshIntegrationHandler({
5608
5642
  const auth = await getBearerToken(apiHost);
5609
5643
  const { authToken } = auth;
5610
5644
  const uniformClient = createClient(apiHost, authToken);
5611
- const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin, telemetry });
5645
+ const user = await fetchUserAndEnsureFirstTeamExists({ auth, baseUrl: apiHost, spin: spin2, telemetry });
5612
5646
  const { teamId } = await chooseTeam(
5613
5647
  user,
5614
5648
  `Hey ${user.name}! Choose a Uniform team to register your integration`,
@@ -5633,10 +5667,10 @@ async function newMeshIntegrationHandler({
5633
5667
  const { targetDir, typeSlug } = validateIntegrationName(answer.name, outputPath);
5634
5668
  const { runNpmInstall } = await cloneStarter({
5635
5669
  githubPath: `uniformdev/examples/examples/mesh-integration`,
5636
- spin,
5670
+ spin: spin2,
5637
5671
  targetDir
5638
5672
  });
5639
- let done = await spin("Registering integration to team...");
5673
+ let done = await spin2("Registering integration to team...");
5640
5674
  const pathToManifest = path4.resolve(targetDir, "mesh-manifest.json");
5641
5675
  if (!existsSync3(pathToManifest)) {
5642
5676
  throw new Error("Invalid integration starter cloned: missing `mesh-manifest.json`");
@@ -5658,13 +5692,13 @@ async function newMeshIntegrationHandler({
5658
5692
  client: uniformClient,
5659
5693
  createNew: true,
5660
5694
  chooseExisting: true,
5661
- spin,
5695
+ spin: spin2,
5662
5696
  teamId,
5663
5697
  user,
5664
5698
  checkTargetDir: false,
5665
5699
  telemetry
5666
5700
  });
5667
- done = await spin("Installing integration to project...");
5701
+ done = await spin2("Installing integration to project...");
5668
5702
  await uniformClient.installIntegration({ projectId, type: typeSlug });
5669
5703
  await done();
5670
5704
  console.log(`
@@ -5734,10 +5768,10 @@ var NewCmd = {
5734
5768
  ),
5735
5769
  describe: "Start a new Uniform project",
5736
5770
  handler: async function({ name, apiHost, outputPath, disableTelemetry }) {
5737
- const { stopAllSpinners, spin } = makeSpinner();
5771
+ const { stopAllSpinners, spin: spin2 } = makeSpinner();
5738
5772
  const telemetry = new Telemetry("cli new", disableTelemetry || apiHost !== stableApiHost);
5739
5773
  try {
5740
- await newHandler({ spin, projectName: name, apiHost, outputPath, telemetry });
5774
+ await newHandler({ spin: spin2, projectName: name, apiHost, outputPath, telemetry });
5741
5775
  stopAllSpinners();
5742
5776
  process.exit(0);
5743
5777
  } catch (err) {
@@ -5771,10 +5805,10 @@ var NewMeshCmd = {
5771
5805
  ),
5772
5806
  describe: "Start a new Uniform project",
5773
5807
  handler: async function({ apiHost, outputPath, disableTelemetry }) {
5774
- const { stopAllSpinners, spin } = makeSpinner();
5808
+ const { stopAllSpinners, spin: spin2 } = makeSpinner();
5775
5809
  const telemetry = new Telemetry("cli new mesh", disableTelemetry || apiHost !== stableApiHost);
5776
5810
  try {
5777
- await newMeshIntegrationHandler({ spin, apiHost, outputPath, telemetry });
5811
+ await newMeshIntegrationHandler({ spin: spin2, apiHost, outputPath, telemetry });
5778
5812
  stopAllSpinners();
5779
5813
  process.exit(0);
5780
5814
  } catch (err) {
@@ -6854,6 +6888,31 @@ var RedirectCommand = {
6854
6888
  // src/commands/sync/index.ts
6855
6889
  import yargs23 from "yargs";
6856
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
+
6857
6916
  // src/commands/sync/commands/pull.ts
6858
6917
  var SyncPullModule = {
6859
6918
  command: "pull",
@@ -6887,7 +6946,9 @@ var SyncPullModule = {
6887
6946
  composition: CompositionPullModule,
6888
6947
  projectMapDefinition: ProjectMapDefinitionPullModule,
6889
6948
  projectMapNode: ProjectMapNodePullModule,
6890
- redirect: RedirectDefinitionPullModule
6949
+ redirect: RedirectDefinitionPullModule,
6950
+ entry: EntryPullModule,
6951
+ contentType: ContentTypePullModule
6891
6952
  }).filter(([entityType]) => {
6892
6953
  var _a, _b, _c, _d, _e, _f;
6893
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;
@@ -6898,15 +6959,22 @@ var SyncPullModule = {
6898
6959
  );
6899
6960
  }
6900
6961
  for (const [entityType, module3] of enabledEntities) {
6901
- await module3.handler({
6902
- ...otherParams,
6903
- state: 0,
6904
- format: getFormat(entityType, config2),
6905
- onlyCompositions: entityType === "composition" ? true : void 0,
6906
- onlyPatterns: entityType === "pattern" ? true : void 0,
6907
- mode: getPullMode(entityType, config2),
6908
- directory: getPullFilename(entityType, config2)
6909
- });
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
+ }
6910
6978
  }
6911
6979
  }
6912
6980
  };
@@ -6968,7 +7036,9 @@ var SyncPushModule = {
6968
7036
  composition: CompositionPushModule,
6969
7037
  projectMapDefinition: ProjectMapDefinitionPushModule,
6970
7038
  projectMapNode: ProjectMapNodePushModule,
6971
- redirect: RedirectDefinitionPushModule
7039
+ redirect: RedirectDefinitionPushModule,
7040
+ contentType: ContentTypePushModule,
7041
+ entry: EntryPushModule
6972
7042
  }).filter(([entityType]) => {
6973
7043
  var _a2, _b2, _c2, _d2, _e2, _f2;
6974
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;
@@ -6979,15 +7049,22 @@ var SyncPushModule = {
6979
7049
  );
6980
7050
  }
6981
7051
  for (const [entityType, module3] of enabledEntities) {
6982
- await module3.handler({
6983
- ...otherParams,
6984
- state: 0,
6985
- format: getFormat2(entityType, config2),
6986
- onlyCompositions: entityType === "composition" ? true : void 0,
6987
- onlyPatterns: entityType === "pattern" ? true : void 0,
6988
- mode: getPushMode(entityType, config2),
6989
- directory: getPushFilename(entityType, config2)
6990
- });
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
+ }
6991
7068
  }
6992
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)) {
6993
7070
  await PatternPublishModule.handler({ ...otherParams, all: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.49.1",
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.1",
21
- "@uniformdev/context": "19.49.1",
22
- "@uniformdev/files": "19.49.1",
23
- "@uniformdev/project-map": "19.49.1",
24
- "@uniformdev/redirect": "19.49.1",
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": "a14b97601fb78b44be7f0849841b9828dec0ea96"
69
+ "gitHead": "9773e3b65168255768f5cbecf2536988fa0e03af"
70
70
  }