@trayai/tray-sync-cli 1.0.9 → 1.0.10

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.
@@ -0,0 +1,35 @@
1
+ import { createTrayClientForRegion } from "../../api/trayClient.js";
2
+ import { resolveApiRegion, resolveApiToken } from "../../lib/apiAuth.js";
3
+ import { parseRegion } from "../../lib/regionParsing.js";
4
+ import { OutputFormats, parseFormat } from "../../lib/outputFormat.js";
5
+ import { FAILURE_ICON } from "../../views/icons.js";
6
+ export function realDeps() {
7
+ return {
8
+ env: process.env,
9
+ createClient: createTrayClientForRegion,
10
+ stdout: (line) => console.log(line),
11
+ stderr: (line) => console.error(line),
12
+ };
13
+ }
14
+ export function addCommonApiOptions(command) {
15
+ return command
16
+ .option("-r, --region <region>", "Tray region (falls back to TRAY_API_REGION)", parseRegion)
17
+ .option("-t, --token <token>", "Tray API token (falls back to TRAY_API_TOKEN)")
18
+ .option("--format <format>", "human or json", parseFormat, OutputFormats.HUMAN);
19
+ }
20
+ export async function runApiAction(deps, run) {
21
+ try {
22
+ process.exitCode = await run();
23
+ }
24
+ catch (err) {
25
+ const message = err instanceof Error ? err.message : String(err);
26
+ deps.stderr(`${FAILURE_ICON} ${message}`);
27
+ process.exitCode = 1;
28
+ }
29
+ }
30
+ export function apiClientFor(deps, options) {
31
+ const token = resolveApiToken({ tokenFlag: options.token, env: deps.env });
32
+ const region = resolveApiRegion({ regionFlag: options.region, env: deps.env });
33
+ return deps.createClient(region, token);
34
+ }
35
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,4 @@
1
+ export function printConfirmationJson(stdout, fields) {
2
+ stdout(JSON.stringify(fields, null, 2));
3
+ }
4
+ //# sourceMappingURL=shared.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayai/tray-sync-cli",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "CLI tool to clone Tray projects and related assets to a local directory, and promote them between Tray environments",
5
5
  "bin": {
6
6
  "tray": "dist/cli.js"