@uniformdev/cli 19.42.1-alpha.7 → 19.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +186 -19
  2. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -1408,13 +1408,13 @@ function createComponentInstanceEngineDataSource({
1408
1408
  // src/commands/canvas/commands/composition/publish.ts
1409
1409
  var CompositionPublishModule = {
1410
1410
  command: "publish [ids]",
1411
- describe: "Publishes compositions",
1411
+ describe: "Publishes composition(s)",
1412
1412
  builder: (yargs23) => withConfiguration(
1413
1413
  withApiOptions(
1414
1414
  withProjectOptions(
1415
1415
  withDiffOptions(
1416
1416
  yargs23.positional("ids", {
1417
- describe: "Publishes composition/pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
1417
+ describe: "Publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
1418
1418
  type: "string"
1419
1419
  }).option("all", {
1420
1420
  alias: ["a"],
@@ -1426,12 +1426,32 @@ var CompositionPublishModule = {
1426
1426
  describe: "What-if mode reports what would be done but does not perform any publishing",
1427
1427
  default: false,
1428
1428
  type: "boolean"
1429
+ }).option("onlyCompositions", {
1430
+ describe: "Only publishing compositions and not patterns",
1431
+ default: false,
1432
+ type: "boolean"
1433
+ }).option("onlyPatterns", {
1434
+ describe: "Only pulling patterns and not compositions",
1435
+ default: false,
1436
+ type: "boolean",
1437
+ hidden: true
1429
1438
  })
1430
1439
  )
1431
1440
  )
1432
1441
  )
1433
1442
  ),
1434
- handler: async ({ apiHost, apiKey, proxy, ids, all, whatIf, project: projectId, diff: diffMode }) => {
1443
+ handler: async ({
1444
+ apiHost,
1445
+ apiKey,
1446
+ proxy,
1447
+ ids,
1448
+ all,
1449
+ whatIf,
1450
+ project: projectId,
1451
+ diff: diffMode,
1452
+ onlyCompositions,
1453
+ onlyPatterns
1454
+ }) => {
1435
1455
  if (!all && !ids || all && ids) {
1436
1456
  console.error(`Specify --all or composition ID(s) to publish.`);
1437
1457
  process.exit(1);
@@ -1442,17 +1462,22 @@ var CompositionPublishModule = {
1442
1462
  const source = createComponentInstanceEngineDataSource({
1443
1463
  client,
1444
1464
  state: "preview",
1445
- compositionIDs: compositionIDsArray
1465
+ compositionIDs: compositionIDsArray,
1466
+ onlyCompositions,
1467
+ onlyPatterns
1446
1468
  });
1447
1469
  const target = createComponentInstanceEngineDataSource({
1448
1470
  client,
1449
1471
  state: "published",
1450
- compositionIDs: compositionIDsArray
1472
+ compositionIDs: compositionIDsArray,
1473
+ onlyCompositions,
1474
+ onlyPatterns
1451
1475
  });
1452
1476
  await syncEngine({
1453
1477
  source,
1454
1478
  target,
1455
- mode: "mirror",
1479
+ // Publishing is one-direction operation, so no need to support automatic un-publishing
1480
+ mode: "createOrUpdate",
1456
1481
  whatIf,
1457
1482
  log: createSyncEngineConsoleLogger({ diffMode })
1458
1483
  });
@@ -1849,23 +1874,99 @@ var CompositionRemoveModule = {
1849
1874
 
1850
1875
  // src/commands/canvas/commands/composition/unpublish.ts
1851
1876
  import { CANVAS_PUBLISHED_STATE as CANVAS_PUBLISHED_STATE2, UncachedCanvasClient as UncachedCanvasClient13 } from "@uniformdev/canvas";
1877
+ import { diffJson as diffJson2 } from "diff";
1852
1878
  var CompositionUnpublishModule = {
1853
- command: "unpublish <id>",
1854
- describe: "Unpublish a composition",
1879
+ command: "unpublish [ids]",
1880
+ describe: "Unpublish a composition(s)",
1855
1881
  builder: (yargs23) => withConfiguration(
1856
1882
  withApiOptions(
1857
1883
  withProjectOptions(
1858
- yargs23.positional("id", {
1859
- demandOption: true,
1860
- describe: "Composition/pattern public ID to unpublish"
1884
+ yargs23.positional("ids", {
1885
+ describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
1886
+ type: "string"
1887
+ }).option("all", {
1888
+ alias: ["a"],
1889
+ describe: "Un-publishes all compositions. Use compositionId to publish one instead.",
1890
+ default: false,
1891
+ type: "boolean"
1892
+ }).option("what-if", {
1893
+ alias: ["w"],
1894
+ describe: "What-if mode reports what would be done but does not perform any publishing",
1895
+ default: false,
1896
+ type: "boolean"
1897
+ }).option("onlyCompositions", {
1898
+ describe: "Only publishing compositions and not patterns",
1899
+ default: false,
1900
+ type: "boolean"
1901
+ }).option("onlyPatterns", {
1902
+ describe: "Only pulling patterns and not compositions",
1903
+ default: false,
1904
+ type: "boolean",
1905
+ hidden: true
1861
1906
  })
1862
1907
  )
1863
1908
  )
1864
1909
  ),
1865
- handler: async ({ apiHost, apiKey, proxy, id, project: projectId }) => {
1910
+ handler: async ({
1911
+ apiHost,
1912
+ apiKey,
1913
+ proxy,
1914
+ ids,
1915
+ all,
1916
+ onlyCompositions,
1917
+ onlyPatterns,
1918
+ project: projectId,
1919
+ diff,
1920
+ whatIf
1921
+ }) => {
1922
+ if (!all && !ids || all && ids) {
1923
+ console.error(`Specify --all or composition ID(s) to publish.`);
1924
+ process.exit(1);
1925
+ }
1926
+ const compositionIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
1927
+ const targetItems = /* @__PURE__ */ new Map();
1866
1928
  const fetch3 = nodeFetchProxy(proxy);
1867
1929
  const client = new UncachedCanvasClient13({ apiKey, apiHost, fetch: fetch3, projectId });
1868
- await client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 });
1930
+ const source = createComponentInstanceEngineDataSource({
1931
+ client,
1932
+ state: "published",
1933
+ compositionIDs: compositionIDsArray,
1934
+ onlyCompositions,
1935
+ onlyPatterns
1936
+ });
1937
+ const target = createComponentInstanceEngineDataSource({
1938
+ client,
1939
+ state: "preview",
1940
+ compositionIDs: compositionIDsArray,
1941
+ onlyCompositions,
1942
+ onlyPatterns
1943
+ });
1944
+ const actions = [];
1945
+ const log = createSyncEngineConsoleLogger({ diffMode: diff });
1946
+ for await (const obj of target.objects) {
1947
+ if (Array.isArray(obj.id)) {
1948
+ obj.id.forEach((o) => targetItems.set(o, obj));
1949
+ } else {
1950
+ targetItems.set(obj.id, obj);
1951
+ }
1952
+ }
1953
+ for await (const sourceObject of source.objects) {
1954
+ const id = Array.isArray(sourceObject.id) ? sourceObject.id[0] : sourceObject.id;
1955
+ const targetObject = targetItems.get(id);
1956
+ if (!targetObject) {
1957
+ console.log(`Composition ${id} was not found`);
1958
+ return;
1959
+ }
1960
+ actions.push(client.removeComposition({ compositionId: id, state: CANVAS_PUBLISHED_STATE2 }));
1961
+ log({
1962
+ action: "update",
1963
+ id,
1964
+ providerId: sourceObject.providerId,
1965
+ displayName: sourceObject.displayName ?? sourceObject.providerId,
1966
+ whatIf,
1967
+ diff: diffJson2(targetObject.object, sourceObject.object)
1968
+ });
1969
+ }
1869
1970
  }
1870
1971
  };
1871
1972
 
@@ -2249,7 +2350,43 @@ var PatternListModule = {
2249
2350
  // src/commands/canvas/commands/pattern/publish.ts
2250
2351
  var PatternPublishModule = {
2251
2352
  ...CompositionPublishModule,
2252
- describe: "Publishes patterns"
2353
+ describe: "Publishes pattern(s)",
2354
+ builder: (yargs23) => withConfiguration(
2355
+ withApiOptions(
2356
+ withProjectOptions(
2357
+ withDiffOptions(
2358
+ yargs23.positional("ids", {
2359
+ describe: "Publishes pattern(s) by ID. Comma-separate multiple IDs. Use --all to publish all instead.",
2360
+ type: "string"
2361
+ }).option("all", {
2362
+ alias: ["a"],
2363
+ describe: "Publishes all patterns. Use compositionId to publish one instead.",
2364
+ default: false,
2365
+ type: "boolean"
2366
+ }).option("what-if", {
2367
+ alias: ["w"],
2368
+ describe: "What-if mode reports what would be done but does not perform any un-publishing",
2369
+ default: false,
2370
+ type: "boolean"
2371
+ }).option("publishingState", {
2372
+ describe: 'Publishing state to update to. Can be "published" or "preview".',
2373
+ default: "published",
2374
+ type: "string",
2375
+ hidden: true
2376
+ }).option("onlyCompositions", {
2377
+ describe: "Only publishing compositions and not patterns",
2378
+ default: false,
2379
+ type: "boolean"
2380
+ }).option("onlyPatterns", {
2381
+ describe: "Only pulling patterns and not compositions",
2382
+ default: true,
2383
+ type: "boolean",
2384
+ hidden: true
2385
+ })
2386
+ )
2387
+ )
2388
+ )
2389
+ )
2253
2390
  };
2254
2391
 
2255
2392
  // src/commands/canvas/commands/pattern/pull.ts
@@ -2340,8 +2477,38 @@ var PatternRemoveModule = {
2340
2477
 
2341
2478
  // src/commands/canvas/commands/pattern/unpublish.ts
2342
2479
  var PatternUnpublishModule = {
2343
- ...CompositionUnpublishModule,
2344
- describe: "Unpublish a pattern"
2480
+ command: "unpublish [ids]",
2481
+ describe: "Unpublish a pattern(s)",
2482
+ builder: (yargs23) => withConfiguration(
2483
+ withApiOptions(
2484
+ withProjectOptions(
2485
+ yargs23.positional("ids", {
2486
+ describe: "Un-publishes composition(s) by ID. Comma-separate multiple IDs. Use --all to un-publish all instead.",
2487
+ type: "string"
2488
+ }).option("all", {
2489
+ alias: ["a"],
2490
+ describe: "Un-pPublishes all compositions. Use compositionId to publish one instead.",
2491
+ default: false,
2492
+ type: "boolean"
2493
+ }).option("what-if", {
2494
+ alias: ["w"],
2495
+ describe: "What-if mode reports what would be done but does not perform any publishing",
2496
+ default: false,
2497
+ type: "boolean"
2498
+ }).option("onlyCompositions", {
2499
+ describe: "Only publishing compositions and not patterns",
2500
+ default: false,
2501
+ type: "boolean"
2502
+ }).option("onlyPatterns", {
2503
+ describe: "Only pulling patterns and not compositions",
2504
+ default: true,
2505
+ type: "boolean",
2506
+ hidden: true
2507
+ })
2508
+ )
2509
+ )
2510
+ ),
2511
+ handler: CompositionUnpublishModule.handler
2345
2512
  };
2346
2513
 
2347
2514
  // src/commands/canvas/commands/pattern/update.ts
@@ -3974,7 +4141,7 @@ import { PostHog } from "posthog-node";
3974
4141
  // package.json
3975
4142
  var package_default = {
3976
4143
  name: "@uniformdev/cli",
3977
- version: "19.42.0",
4144
+ version: "19.45.1",
3978
4145
  description: "Uniform command line interface tool",
3979
4146
  license: "SEE LICENSE IN LICENSE.txt",
3980
4147
  main: "./cli.js",
@@ -4007,7 +4174,7 @@ var package_default = {
4007
4174
  "graphql-request": "6.1.0",
4008
4175
  "https-proxy-agent": "^7.0.0",
4009
4176
  "image-size": "^1.0.2",
4010
- inquirer: "9.2.9",
4177
+ inquirer: "9.2.10",
4011
4178
  "isomorphic-git": "1.24.5",
4012
4179
  "isomorphic-unfetch": "^3.1.0",
4013
4180
  "js-yaml": "^4.1.0",
@@ -4028,7 +4195,7 @@ var package_default = {
4028
4195
  "@types/js-yaml": "4.0.5",
4029
4196
  "@types/jsonwebtoken": "9.0.2",
4030
4197
  "@types/lodash.isequalwith": "4.4.7",
4031
- "@types/node": "18.17.1",
4198
+ "@types/node": "18.17.5",
4032
4199
  "@types/yargs": "17.0.24"
4033
4200
  },
4034
4201
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.42.1-alpha.7+1380aadd7",
3
+ "version": "19.45.1",
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.42.1-alpha.7+1380aadd7",
21
- "@uniformdev/context": "19.42.1-alpha.7+1380aadd7",
22
- "@uniformdev/files-sdk": "19.37.0",
23
- "@uniformdev/project-map": "19.42.1-alpha.7+1380aadd7",
24
- "@uniformdev/redirect": "19.42.1-alpha.7+1380aadd7",
20
+ "@uniformdev/canvas": "19.45.1",
21
+ "@uniformdev/context": "19.45.1",
22
+ "@uniformdev/files-sdk": "19.45.1",
23
+ "@uniformdev/project-map": "19.45.1",
24
+ "@uniformdev/redirect": "19.45.1",
25
25
  "colorette": "2.0.20",
26
26
  "cosmiconfig": "8.2.0",
27
27
  "cosmiconfig-typescript-loader": "5.0.0",
@@ -33,7 +33,7 @@
33
33
  "graphql-request": "6.1.0",
34
34
  "https-proxy-agent": "^7.0.0",
35
35
  "image-size": "^1.0.2",
36
- "inquirer": "9.2.9",
36
+ "inquirer": "9.2.10",
37
37
  "isomorphic-git": "1.24.5",
38
38
  "isomorphic-unfetch": "^3.1.0",
39
39
  "js-yaml": "^4.1.0",
@@ -54,7 +54,7 @@
54
54
  "@types/js-yaml": "4.0.5",
55
55
  "@types/jsonwebtoken": "9.0.2",
56
56
  "@types/lodash.isequalwith": "4.4.7",
57
- "@types/node": "18.17.1",
57
+ "@types/node": "18.17.5",
58
58
  "@types/yargs": "17.0.24"
59
59
  },
60
60
  "bin": {
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "1380aadd7c71f6f120f933a40e73e113518e3716"
69
+ "gitHead": "27d329b913db64152e9d49bcfa7dddf8b3b31bb6"
70
70
  }