@uniformdev/cli 20.74.6-alpha.3 → 20.74.7

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.
@@ -21,7 +21,7 @@ import { dirname, extname, isAbsolute, resolve, sep } from "path";
21
21
  // package.json
22
22
  var package_default = {
23
23
  name: "@uniformdev/cli",
24
- version: "20.74.5",
24
+ version: "20.74.7",
25
25
  description: "Uniform command line interface tool",
26
26
  license: "SEE LICENSE IN LICENSE.txt",
27
27
  main: "./cli.js",
@@ -49,6 +49,7 @@ var package_default = {
49
49
  "@inquirer/prompts": "^8.5.2",
50
50
  "@thi.ng/mime": "^2.2.23",
51
51
  "@uniformdev/assets": "workspace:*",
52
+ "@uniformdev/automations-sdk": "workspace:*",
52
53
  "@uniformdev/canvas": "workspace:*",
53
54
  "@uniformdev/context": "workspace:*",
54
55
  "@uniformdev/files": "workspace:*",
@@ -65,8 +66,6 @@ var package_default = {
65
66
  execa: "5.1.1",
66
67
  "file-type": "^22.0.1",
67
68
  "fs-jetpack": "5.1.0",
68
- graphql: "17.0.1",
69
- "graphql-request": "7.4.0",
70
69
  "image-size": "2.0.2",
71
70
  "isomorphic-git": "1.38.5",
72
71
  "js-yaml": "^4.2.0",
@@ -161,12 +160,20 @@ function withConfiguration(yargs) {
161
160
  hidden: true
162
161
  });
163
162
  }
164
- function withApiOptions(yargs) {
165
- return yargs.option("apiKey", {
163
+ function maskApiKey(apiKey) {
164
+ const separatorIndex = apiKey.indexOf("1");
165
+ const prefix = separatorIndex > 0 ? apiKey.slice(0, separatorIndex) : apiKey.slice(0, 3);
166
+ return `${prefix}...${apiKey.slice(-4)}`;
167
+ }
168
+ function withApiOptions(yargs, { includeEdgeApiHost = false } = {}) {
169
+ const resolvedApiKey = process.env.UNIFORM_CLI_API_KEY ?? // deprecated
170
+ process.env.CANVAS_CLI_API_KEY ?? // deprecated
171
+ process.env.UPM_CLI_API_KEY ?? process.env.UNIFORM_API_KEY;
172
+ let result = yargs.option("apiKey", {
166
173
  describe: "Uniform API key. Defaults to UNIFORM_CLI_API_KEY or UNIFORM_API_KEY env. Supports dotenv.",
167
- default: process.env.UNIFORM_CLI_API_KEY ?? // deprecated
168
- process.env.CANVAS_CLI_API_KEY ?? // deprecated
169
- process.env.UPM_CLI_API_KEY ?? process.env.UNIFORM_API_KEY,
174
+ default: resolvedApiKey,
175
+ // Mask the resolved key in --help output so the secret is never printed verbatim.
176
+ defaultDescription: resolvedApiKey ? maskApiKey(resolvedApiKey) : void 0,
170
177
  demandOption: true,
171
178
  type: "string"
172
179
  }).option("apiHost", {
@@ -174,12 +181,16 @@ function withApiOptions(yargs) {
174
181
  default: process.env.UNIFORM_CLI_BASE_URL || "https://uniform.app",
175
182
  demandOption: true,
176
183
  type: "string"
177
- }).option("edgeApiHost", {
178
- describe: "Uniform edge host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env var or https://uniform.global. Supports dotenv.",
179
- default: process.env.UNIFORM_CLI_BASE_EDGE_URL || "https://uniform.global",
180
- demandOption: true,
181
- type: "string"
182
- }).option("proxy", {
184
+ });
185
+ if (includeEdgeApiHost) {
186
+ result = result.option("edgeApiHost", {
187
+ describe: "Uniform edge host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env var or https://uniform.global. Supports dotenv.",
188
+ default: process.env.UNIFORM_CLI_BASE_EDGE_URL || "https://uniform.global",
189
+ demandOption: true,
190
+ type: "string"
191
+ });
192
+ }
193
+ return result.option("proxy", {
183
194
  describe: "HTTPS proxy to use for Uniform API calls. Defaults to HTTPS_PROXY, https_proxy, ALL_PROXY, or all_proxy env vars (in that order). Supports dotenv.",
184
195
  default: process.env.HTTPS_PROXY || process.env.https_proxy || process.env.ALL_PROXY || process.env.all_proxy,
185
196
  type: "string"
@@ -282,6 +293,16 @@ ${e.message}`;
282
293
  }
283
294
  return wrappedFetch;
284
295
  }
296
+ function exitOnCliError(error) {
297
+ if (error instanceof ApiClientError) {
298
+ console.error(error.message);
299
+ } else if (error instanceof Error) {
300
+ console.error(error.message);
301
+ } else {
302
+ console.error(String(error));
303
+ }
304
+ process.exit(1);
305
+ }
285
306
  function withProjectOptions(yargs) {
286
307
  return yargs.option("project", {
287
308
  describe: "Uniform project ID. Defaults to UNIFORM_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
@@ -388,16 +409,6 @@ function readFileToObject(filename) {
388
409
  const file = readFileSync(filename, "utf8");
389
410
  return load(file, { filename, json: true });
390
411
  }
391
- var ENTITY_ID_CHUNK_SIZE = 100;
392
- function* chunkEntityIds(ids, chunkSize = ENTITY_ID_CHUNK_SIZE) {
393
- if (!ids) {
394
- yield void 0;
395
- return;
396
- }
397
- for (let index = 0; index < ids.length; index += chunkSize) {
398
- yield ids.slice(index, index + chunkSize);
399
- }
400
- }
401
412
  async function* paginateAsync(fetchPage, options) {
402
413
  const pageSize = options.pageSize ?? 100;
403
414
  if (pageSize < 1) {
@@ -450,21 +461,6 @@ function getEntityBatchSize(entityType, config) {
450
461
  }
451
462
  return entityBatchSizeDefaults[entityType];
452
463
  }
453
- function getPublishScope(entityType, config) {
454
- const publish = config.entitiesConfig?.[entityType]?.publish;
455
- if (!publish) {
456
- return void 0;
457
- }
458
- if (publish === true || publish === "all") {
459
- return "all";
460
- }
461
- if (publish === "pushed") {
462
- return "pushed";
463
- }
464
- throw new Error(
465
- `Invalid publish option '${publish}' for ${entityType}. Expected true, false, 'all', or 'pushed'.`
466
- );
467
- }
468
464
  function resolveEntityBatchSize({
469
465
  entityType,
470
466
  cliBatchSize,
@@ -564,9 +560,11 @@ export {
564
560
  package_default,
565
561
  CLI_USER_AGENT,
566
562
  withConfiguration,
563
+ maskApiKey,
567
564
  withApiOptions,
568
565
  withDebugOptions,
569
566
  nodeFetchProxy,
567
+ exitOnCliError,
570
568
  withProjectOptions,
571
569
  withTeamOptions,
572
570
  withFormatOptions,
@@ -574,11 +572,9 @@ export {
574
572
  isPathAPackageFile,
575
573
  emitWithFormat,
576
574
  readFileToObject,
577
- chunkEntityIds,
578
575
  paginateAsync,
579
576
  isPaginatedSyncEntity,
580
577
  getEntityBatchSize,
581
- getPublishScope,
582
578
  withBatchSizeOptions,
583
579
  applyDefaultSyncConfiguration,
584
580
  getEntityOption,
@@ -1,4 +1,4 @@
1
- import { C as CLIConfiguration, E as EntityTypes } from './index-CxaxRfj3.mjs';
1
+ import { C as CLIConfiguration, E as EntityTypes } from './index-DeoTNXj-.mjs';
2
2
 
3
3
  type UniformConfigAllOptions = {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "./chunk-IBJEWQVU.mjs";
1
+ import "./chunk-KCUEJ27O.mjs";
2
2
 
3
3
  // src/sync/allSerializableEntitiesConfig.ts
4
4
  var allSerializableEntitiesConfig = {
@@ -11,11 +11,11 @@ var allSerializableEntitiesConfig = {
11
11
  projectMapDefinition: {},
12
12
  projectMapNode: {},
13
13
  contentType: {},
14
- composition: { publish: "all" },
15
- entry: { publish: "all" },
16
- entryPattern: { publish: "all" },
17
- componentPattern: { publish: "all" },
18
- compositionPattern: { publish: "all" },
14
+ composition: { publish: true },
15
+ entry: { publish: true },
16
+ entryPattern: { publish: true },
17
+ componentPattern: { publish: true },
18
+ compositionPattern: { publish: true },
19
19
  asset: {},
20
20
  workflow: {},
21
21
  webhook: {},
@@ -13,17 +13,8 @@ type EntityConfiguration = {
13
13
  disabled?: true;
14
14
  };
15
15
  type EntityWithStateConfiguration = EntityConfiguration & Partial<StateArgs>;
16
- /**
17
- * What a push should publish once it has written its entities to preview.
18
- *
19
- * - `all`: publish every entity of this type in the project that has unpublished changes, whether or
20
- * not it came from the push source. This is what `publish: true` has always done.
21
- * - `pushed`: publish only the entities present in the push source (directory or package file).
22
- */
23
- type PublishScope = 'all' | 'pushed';
24
16
  type PublishableEntitiesConfiguration = EntityWithStateConfiguration & {
25
- /** `true` is an alias for `'all'`, kept for backwards compatibility. */
26
- publish?: boolean | PublishScope;
17
+ publish?: boolean;
27
18
  batchSize?: number;
28
19
  };
29
20
  type SerializationEntitiesConfiguration = Record<EntityTypes, {
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export { C as CLIConfiguration } from './index-CxaxRfj3.mjs';
2
+ export { C as CLIConfiguration } from './index-DeoTNXj-.mjs';