@uniformdev/cli 19.137.1-alpha.4 → 19.137.1-alpha.5

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 +79 -40
  2. package/package.json +8 -8
package/dist/index.mjs CHANGED
@@ -1023,15 +1023,15 @@ function prepCompositionForDisk(composition) {
1023
1023
  delete prepped.state;
1024
1024
  return prepped;
1025
1025
  }
1026
- function withStateOptions(yargs33) {
1026
+ function withStateOptions(yargs33, defaultState = "preview") {
1027
1027
  return yargs33.option("state", {
1028
1028
  type: "string",
1029
- describe: `Composition state to fetch.`,
1029
+ describe: `State to fetch.`,
1030
1030
  choices: ["preview", "published"],
1031
- default: "preview"
1031
+ default: defaultState
1032
1032
  });
1033
1033
  }
1034
- function convertCompositionState(state) {
1034
+ function convertStateOption(state) {
1035
1035
  const number = Number(state);
1036
1036
  if (!isNaN(number)) {
1037
1037
  return number;
@@ -2020,7 +2020,7 @@ var CompositionGetModule = {
2020
2020
  const res = prepCompositionForDisk(
2021
2021
  await client.getCompositionById({
2022
2022
  compositionId: id,
2023
- state: convertCompositionState(state),
2023
+ state: convertStateOption(state),
2024
2024
  skipPatternResolution: !resolvePatterns,
2025
2025
  skipOverridesResolution: !resolveOverrides,
2026
2026
  withComponentIDs: componentIDs,
@@ -2106,7 +2106,7 @@ var CompositionListModule = {
2106
2106
  limit,
2107
2107
  offset,
2108
2108
  pattern: onlyCompositions ? false : onlyPatterns ? true : void 0,
2109
- state: convertCompositionState(state),
2109
+ state: convertStateOption(state),
2110
2110
  skipPatternResolution: !resolvePatterns,
2111
2111
  withComponentIDs: componentIDs,
2112
2112
  skipOverridesResolution: !resolveOverrides
@@ -2173,7 +2173,7 @@ function createComponentInstanceEngineDataSource({
2173
2173
  onlyPatterns,
2174
2174
  ...clientOptions
2175
2175
  }) {
2176
- const stateId = convertCompositionState(state);
2176
+ const stateId = convertStateOption(state);
2177
2177
  async function* getObjects() {
2178
2178
  const componentInstances = paginateAsync(
2179
2179
  async (offset, limit) => (await client.getCompositionList({
@@ -2792,7 +2792,7 @@ var CompositionUpdateModule = {
2792
2792
  const fetch3 = nodeFetchProxy(proxy);
2793
2793
  const client = new UncachedCanvasClient14({ apiKey, apiHost, fetch: fetch3, projectId });
2794
2794
  const file = readFileToObject(filename);
2795
- await client.updateComposition({ ...file, state: convertCompositionState(state) });
2795
+ await client.updateComposition({ ...file, state: convertStateOption(state) });
2796
2796
  }
2797
2797
  };
2798
2798
 
@@ -3502,19 +3502,34 @@ var EntryGetModule = {
3502
3502
  withFormatOptions(
3503
3503
  withApiOptions(
3504
3504
  withProjectOptions(
3505
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3506
- yargs33.positional("id", { demandOption: true, describe: "Entry public ID to fetch" })
3505
+ withStateOptions(
3506
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3507
+ yargs33.positional("id", { demandOption: true, describe: "Entry public ID to fetch" }),
3508
+ // for backwards compatibility, we default to the "published" state, unlike compositions
3509
+ "published"
3510
+ )
3507
3511
  )
3508
3512
  )
3509
3513
  )
3510
3514
  ),
3511
- handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
3515
+ handler: async ({
3516
+ apiHost,
3517
+ edgeApiHost,
3518
+ apiKey,
3519
+ proxy,
3520
+ id,
3521
+ format,
3522
+ filename,
3523
+ project: projectId,
3524
+ state
3525
+ }) => {
3512
3526
  const fetch3 = nodeFetchProxy(proxy);
3513
- const client = new ContentClient7({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3527
+ const client = new ContentClient7({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
3514
3528
  const res = await client.getEntries({
3515
3529
  offset: 0,
3516
3530
  limit: 1,
3517
3531
  entryIDs: [id],
3532
+ state: convertStateOption(state),
3518
3533
  skipOverridesResolution: true,
3519
3534
  skipPatternResolution: true,
3520
3535
  skipDataResolution: true
@@ -3531,13 +3546,26 @@ import { ContentClient as ContentClient8 } from "@uniformdev/canvas";
3531
3546
  var EntryListModule = {
3532
3547
  command: "list",
3533
3548
  describe: "List entries",
3534
- builder: (yargs33) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs33)))),
3535
- handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
3549
+ builder: (yargs33) => withConfiguration(
3550
+ withFormatOptions(
3551
+ withApiOptions(
3552
+ withProjectOptions(
3553
+ withStateOptions(
3554
+ yargs33,
3555
+ // for backwards compatibility, we default to the "published" state, unlike compositions
3556
+ "published"
3557
+ )
3558
+ )
3559
+ )
3560
+ )
3561
+ ),
3562
+ handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
3536
3563
  const fetch3 = nodeFetchProxy(proxy);
3537
- const client = new ContentClient8({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3564
+ const client = new ContentClient8({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
3538
3565
  const res = await client.getEntries({
3539
3566
  offset: 0,
3540
3567
  limit: 1e3,
3568
+ state: convertStateOption(state),
3541
3569
  skipOverridesResolution: true,
3542
3570
  skipPatternResolution: true,
3543
3571
  skipDataResolution: true
@@ -3564,7 +3592,7 @@ function createEntryEngineDataSource({
3564
3592
  onlyPatterns,
3565
3593
  entryIDs
3566
3594
  }) {
3567
- const stateId = convertCompositionState(state);
3595
+ const stateId = convertStateOption(state);
3568
3596
  async function* getObjects() {
3569
3597
  const entries = paginateAsync(
3570
3598
  async (offset, limit) => (await client.getEntries({
@@ -3627,14 +3655,14 @@ var EntryPublishModule = {
3627
3655
  )
3628
3656
  )
3629
3657
  ),
3630
- handler: async ({ apiHost, apiKey, proxy, ids, all, whatIf, project: projectId }) => {
3658
+ handler: async ({ apiHost, edgeApiHost, apiKey, proxy, ids, all, whatIf, project: projectId }) => {
3631
3659
  if (!all && !ids || all && ids) {
3632
3660
  console.error(`Specify --all or entry ID(s) to publish.`);
3633
3661
  process.exit(1);
3634
3662
  }
3635
3663
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
3636
3664
  const fetch3 = nodeFetchProxy(proxy);
3637
- const client = new ContentClient10({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3665
+ const client = new ContentClient10({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
3638
3666
  const source = createEntryEngineDataSource({
3639
3667
  client,
3640
3668
  state: "preview",
@@ -3717,7 +3745,7 @@ var EntryPullModule = {
3717
3745
  bypassCache: true
3718
3746
  });
3719
3747
  const fileClient = new UncachedFileClient5({ apiKey, apiHost, fetch: fetch3, projectId });
3720
- const source = createEntryEngineDataSource({ client, state });
3748
+ const source = createEntryEngineDataSource({ client, state, onlyEntries: true });
3721
3749
  let target;
3722
3750
  const isPackage = isPathAPackageFile(directory);
3723
3751
  if (isPackage) {
@@ -3829,7 +3857,7 @@ var EntryPushModule = {
3829
3857
  selectDisplayName: selectEntryDisplayName
3830
3858
  });
3831
3859
  }
3832
- const target = createEntryEngineDataSource({ client, state });
3860
+ const target = createEntryEngineDataSource({ client, state, onlyEntries: true });
3833
3861
  const fileClient = new UncachedFileClient6({ apiKey, apiHost, fetch: fetch3, projectId });
3834
3862
  await syncEngine({
3835
3863
  source,
@@ -3958,15 +3986,17 @@ var EntryUpdateModule = {
3958
3986
  builder: (yargs33) => withConfiguration(
3959
3987
  withApiOptions(
3960
3988
  withProjectOptions(
3961
- yargs33.positional("filename", { demandOption: true, describe: "Entry file to put" })
3989
+ withStateOptions(
3990
+ yargs33.positional("filename", { demandOption: true, describe: "Entry file to put" })
3991
+ )
3962
3992
  )
3963
3993
  )
3964
3994
  ),
3965
- handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
3995
+ handler: async ({ apiHost, edgeApiHost, apiKey, proxy, filename, project: projectId, state }) => {
3966
3996
  const fetch3 = nodeFetchProxy(proxy);
3967
- const client = new ContentClient15({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
3997
+ const client = new ContentClient15({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
3968
3998
  const file = readFileToObject(filename);
3969
- await client.upsertEntry(file);
3999
+ await client.upsertEntry({ ...file, state: convertStateOption(state) });
3970
4000
  }
3971
4001
  };
3972
4002
 
@@ -3992,22 +4022,26 @@ var EntryPatternGetModule = {
3992
4022
  withFormatOptions(
3993
4023
  withApiOptions(
3994
4024
  withProjectOptions(
3995
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3996
- yargs33.positional("id", {
3997
- demandOption: true,
3998
- describe: "Entry pattern public ID to fetch"
3999
- })
4025
+ withStateOptions(
4026
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4027
+ yargs33.positional("id", {
4028
+ demandOption: true,
4029
+ describe: "Entry pattern public ID to fetch"
4030
+ }),
4031
+ "published"
4032
+ )
4000
4033
  )
4001
4034
  )
4002
4035
  )
4003
4036
  ),
4004
- handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId }) => {
4037
+ handler: async ({ apiHost, apiKey, proxy, id, format, filename, project: projectId, state }) => {
4005
4038
  const fetch3 = nodeFetchProxy(proxy);
4006
4039
  const client = new ContentClient16({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4007
4040
  const res = await client.getEntries({
4008
4041
  offset: 0,
4009
4042
  limit: 1,
4010
4043
  entryIDs: [id],
4044
+ state: convertStateOption(state),
4011
4045
  skipOverridesResolution: true,
4012
4046
  skipPatternResolution: true,
4013
4047
  skipDataResolution: true,
@@ -4025,13 +4059,16 @@ import { ContentClient as ContentClient17 } from "@uniformdev/canvas";
4025
4059
  var EntryPatternListModule = {
4026
4060
  command: "list",
4027
4061
  describe: "List entry patterns",
4028
- builder: (yargs33) => withConfiguration(withFormatOptions(withApiOptions(withProjectOptions(yargs33)))),
4029
- handler: async ({ apiHost, apiKey, proxy, format, filename, project: projectId }) => {
4062
+ builder: (yargs33) => withConfiguration(
4063
+ withFormatOptions(withApiOptions(withProjectOptions(withStateOptions(yargs33, "published"))))
4064
+ ),
4065
+ handler: async ({ apiHost, edgeApiHost, apiKey, proxy, format, filename, project: projectId, state }) => {
4030
4066
  const fetch3 = nodeFetchProxy(proxy);
4031
- const client = new ContentClient17({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4067
+ const client = new ContentClient17({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4032
4068
  const res = await client.getEntries({
4033
4069
  offset: 0,
4034
4070
  limit: 1e3,
4071
+ state: convertStateOption(state),
4035
4072
  skipOverridesResolution: true,
4036
4073
  skipPatternResolution: true,
4037
4074
  skipDataResolution: true,
@@ -4068,14 +4105,14 @@ var EntryPatternPublishModule = {
4068
4105
  )
4069
4106
  )
4070
4107
  ),
4071
- handler: async ({ apiHost, apiKey, proxy, ids, all, whatIf, project: projectId }) => {
4108
+ handler: async ({ apiHost, edgeApiHost, apiKey, proxy, ids, all, whatIf, project: projectId }) => {
4072
4109
  if (!all && !ids || all && ids) {
4073
4110
  console.error(`Specify --all or entry pattern ID(s) to publish.`);
4074
4111
  process.exit(1);
4075
4112
  }
4076
4113
  const entryIDsArray = ids ? ids.split(",").map((id) => id.trim()) : void 0;
4077
4114
  const fetch3 = nodeFetchProxy(proxy);
4078
- const client = new ContentClient18({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4115
+ const client = new ContentClient18({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4079
4116
  const source = createEntryEngineDataSource({
4080
4117
  client,
4081
4118
  state: "preview",
@@ -4399,15 +4436,17 @@ var EntryPatternUpdateModule = {
4399
4436
  builder: (yargs33) => withConfiguration(
4400
4437
  withApiOptions(
4401
4438
  withProjectOptions(
4402
- yargs33.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
4439
+ withStateOptions(
4440
+ yargs33.positional("filename", { demandOption: true, describe: "Entry pattern file to put" })
4441
+ )
4403
4442
  )
4404
4443
  )
4405
4444
  ),
4406
- handler: async ({ apiHost, apiKey, proxy, filename, project: projectId }) => {
4445
+ handler: async ({ apiHost, edgeApiHost, apiKey, proxy, filename, project: projectId, state }) => {
4407
4446
  const fetch3 = nodeFetchProxy(proxy);
4408
- const client = new ContentClient23({ apiKey, apiHost, fetch: fetch3, projectId, bypassCache: true });
4447
+ const client = new ContentClient23({ apiKey, apiHost, edgeApiHost, fetch: fetch3, projectId, bypassCache: true });
4409
4448
  const file = readFileToObject(filename);
4410
- await client.upsertEntry(file);
4449
+ await client.upsertEntry({ ...file, state: convertStateOption(state) });
4411
4450
  }
4412
4451
  };
4413
4452
 
@@ -8328,7 +8367,7 @@ var ProjectMapNodeListModule = {
8328
8367
  handler: async ({ apiHost, apiKey, proxy, projectMapId, format, filename, project: projectId, state }) => {
8329
8368
  const fetch3 = nodeFetchProxy(proxy);
8330
8369
  const client = new UncachedProjectMapClient8({ apiKey, apiHost, fetch: fetch3, projectId });
8331
- const res = await client.getNodes({ projectMapId, state: convertCompositionState(state) });
8370
+ const res = await client.getNodes({ projectMapId, state: convertStateOption(state) });
8332
8371
  emitWithFormat({ nodes: res.nodes ?? [], projectMapId }, format, filename);
8333
8372
  }
8334
8373
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.137.1-alpha.4+bdc62fd037",
3
+ "version": "19.137.1-alpha.5+fa91392efc",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -17,12 +17,12 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@thi.ng/mime": "^2.2.23",
20
- "@uniformdev/assets": "19.137.1-alpha.4+bdc62fd037",
21
- "@uniformdev/canvas": "19.137.1-alpha.4+bdc62fd037",
22
- "@uniformdev/context": "19.137.1-alpha.4+bdc62fd037",
23
- "@uniformdev/files": "19.137.1-alpha.4+bdc62fd037",
24
- "@uniformdev/project-map": "19.137.1-alpha.4+bdc62fd037",
25
- "@uniformdev/redirect": "19.137.1-alpha.4+bdc62fd037",
20
+ "@uniformdev/assets": "19.137.1-alpha.5+fa91392efc",
21
+ "@uniformdev/canvas": "19.137.1-alpha.5+fa91392efc",
22
+ "@uniformdev/context": "19.137.1-alpha.5+fa91392efc",
23
+ "@uniformdev/files": "19.137.1-alpha.5+fa91392efc",
24
+ "@uniformdev/project-map": "19.137.1-alpha.5+fa91392efc",
25
+ "@uniformdev/redirect": "19.137.1-alpha.5+fa91392efc",
26
26
  "call-bind": "^1.0.2",
27
27
  "colorette": "2.0.20",
28
28
  "cosmiconfig": "8.3.6",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "bdc62fd0375ddb45642066f8a7c3f06c27ee469b"
71
+ "gitHead": "fa91392efc2406c097c600632f557ffdd6211eb2"
72
72
  }