@uniformdev/cli 20.74.6-alpha.3 → 20.74.6-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.
|
@@ -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.
|
|
24
|
+
version: "20.75.0",
|
|
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
|
|
165
|
-
|
|
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:
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
})
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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.",
|
|
@@ -403,18 +424,26 @@ async function* paginateAsync(fetchPage, options) {
|
|
|
403
424
|
if (pageSize < 1) {
|
|
404
425
|
throw new Error(`pageSize must be at least 1, got ${pageSize}`);
|
|
405
426
|
}
|
|
427
|
+
const { maxItems } = options;
|
|
406
428
|
let offset = 0;
|
|
429
|
+
let yielded = 0;
|
|
430
|
+
let limit = pageSize;
|
|
407
431
|
let pageData = [];
|
|
408
432
|
do {
|
|
433
|
+
limit = maxItems === void 0 ? pageSize : Math.min(pageSize, maxItems - yielded);
|
|
434
|
+
if (limit < 1) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
409
437
|
if (options.verbose) {
|
|
410
|
-
console.log(`Fetching ${options.entityName ?? "items"} batch: offset=${offset}, pageSize=${
|
|
438
|
+
console.log(`Fetching ${options.entityName ?? "items"} batch: offset=${offset}, pageSize=${limit}`);
|
|
411
439
|
}
|
|
412
|
-
pageData = await fetchPage(offset,
|
|
440
|
+
pageData = await fetchPage(offset, limit);
|
|
413
441
|
for (const item of pageData) {
|
|
414
442
|
yield item;
|
|
415
443
|
}
|
|
416
|
-
|
|
417
|
-
|
|
444
|
+
yielded += pageData.length;
|
|
445
|
+
offset += limit;
|
|
446
|
+
} while (pageData.length === limit);
|
|
418
447
|
}
|
|
419
448
|
var entityBatchSizeDefaults = {
|
|
420
449
|
composition: 100,
|
|
@@ -564,9 +593,11 @@ export {
|
|
|
564
593
|
package_default,
|
|
565
594
|
CLI_USER_AGENT,
|
|
566
595
|
withConfiguration,
|
|
596
|
+
maskApiKey,
|
|
567
597
|
withApiOptions,
|
|
568
598
|
withDebugOptions,
|
|
569
599
|
nodeFetchProxy,
|
|
600
|
+
exitOnCliError,
|
|
570
601
|
withProjectOptions,
|
|
571
602
|
withTeamOptions,
|
|
572
603
|
withFormatOptions,
|
package/dist/defaultConfig.d.mts
CHANGED
package/dist/defaultConfig.mjs
CHANGED
|
@@ -18,7 +18,11 @@ type EntityWithStateConfiguration = EntityConfiguration & Partial<StateArgs>;
|
|
|
18
18
|
*
|
|
19
19
|
* - `all`: publish every entity of this type in the project that has unpublished changes, whether or
|
|
20
20
|
* not it came from the push source. This is what `publish: true` has always done.
|
|
21
|
-
* - `pushed`: publish only the entities
|
|
21
|
+
* - `pushed`: publish only the entities this run actually created or updated. This is narrower than
|
|
22
|
+
* "everything in the push source": an entity whose preview copy already matches the source is not
|
|
23
|
+
* written, so it is not published either. A run that changes nothing therefore publishes nothing,
|
|
24
|
+
* which also means a failed publish is not retried by re-running an unchanged push. Use `all` when
|
|
25
|
+
* the publish set needs to converge on its own.
|
|
22
26
|
*/
|
|
23
27
|
type PublishScope = 'all' | 'pushed';
|
|
24
28
|
type PublishableEntitiesConfiguration = EntityWithStateConfiguration & {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { C as CLIConfiguration } from './index-
|
|
2
|
+
export { C as CLIConfiguration } from './index-FdhH3tn0.mjs';
|