@tailor-platform/sdk 1.1.3 → 1.2.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#343](https://github.com/tailor-platform/sdk/pull/343) [`7264ef6`](https://github.com/tailor-platform/sdk/commit/7264ef6a1fbbb53c69aacccb2e50d500ab0e61c8) Thanks [@toiroakr](https://github.com/toiroakr)! - Add typed fields to `resolverExecutedTrigger` and `env` support for all executor args
8
+ - Add `success`, `result`, `error` fields to `ResolverExecutedArgs` with tagged union type
9
+ - Add `env: TailorEnv` to all trigger Args types and operation args
10
+
11
+ ### Patch Changes
12
+
13
+ - [#342](https://github.com/tailor-platform/sdk/pull/342) [`ec710be`](https://github.com/tailor-platform/sdk/commit/ec710be1aa2ff6f9b8f5d6816010340a95b6835e) Thanks [@toiroakr](https://github.com/toiroakr)! - fix(cli): unify table border style to single-line across all CLI commands
14
+ - Add `formatTable`, `formatKeyValueTable`, `formatTableWithHeaders` utility functions
15
+ - Add `formatValue` function for proper object/array formatting in tables
16
+ - Add ESLint rule to restrict direct `table` import
17
+ - Add tests for format utilities
18
+
19
+ - [#346](https://github.com/tailor-platform/sdk/pull/346) [`a8355bb`](https://github.com/tailor-platform/sdk/commit/a8355bb9aafbf6ea1da5167939cc429b4010462a) Thanks [@toiroakr](https://github.com/toiroakr)! - refactor(cli): improve stdout/stderr separation following clig.dev guidelines
20
+ - Add custom reporters (`IconReporter`, `PlainReporter`) to prevent extra newlines in piped environments
21
+ - All log methods (`info`, `success`, `warn`, `error`, `log`, `debug`) now output to stderr
22
+ - Rename `logger.data()` to `logger.out()` for primary program output to stdout
23
+ - `logger.out()` now accepts strings in addition to objects for table output
24
+
25
+ This separation allows clean command composition where stdout carries data output and stderr handles all messaging.
26
+
27
+ - [#345](https://github.com/tailor-platform/sdk/pull/345) [`f92d582`](https://github.com/tailor-platform/sdk/commit/f92d582c6b4c23163ba6d750251f7ed4fad4677b) Thanks [@toiroakr](https://github.com/toiroakr)! - fix: e2e tests incorrectly counting resources when multiple apps exist in workspace
28
+
29
+ Fixed an issue where e2e tests counted resources from other applications in the same workspace.
30
+ - Add metadata filtering by `sdk-name` label in e2e tests
31
+ - Set metadata on JobFunctions during apply and remove when no longer used
32
+
33
+ - [#355](https://github.com/tailor-platform/sdk/pull/355) [`c41a004`](https://github.com/tailor-platform/sdk/commit/c41a0044652f2c28d64ccd1f5af5a6db7a0450b8) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency aquaproj/aqua-registry to v4.451.1
34
+
35
+ - [#357](https://github.com/tailor-platform/sdk/pull/357) [`7bf2782`](https://github.com/tailor-platform/sdk/commit/7bf2782db414ba22e5e756fe7c72f4507815924c) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update pnpm to v10.27.0
36
+
3
37
  ## 1.1.3
4
38
 
5
39
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "../chunk-CIV_ash9.mjs";
3
3
  import "../config-Bc_PBkyF.mjs";
4
- import { $ as jsonArgs, A as printData, B as loadAccessToken, D as tokenCommand, G as fetchUserInfo, H as readPlatformConfig, I as loadConfig, J as readPackageJson, K as initOAuth2Client, M as generateCommand, O as listCommand$5, P as applyCommand, Q as deploymentArgs, R as apiCommand, S as listCommand$6, U as writePlatformConfig, V as loadWorkspaceId, W as fetchAll, X as commonArgs, Y as PATScope, Z as confirmationArgs, a as createCommand$3, d as listCommand$7, et as withCommonArgs, h as executionsCommand, l as startCommand, nt as logger, p as getCommand$2, q as initOperatorClient, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as workspaceArgs, w as getCommand$1, x as removeCommand, y as showCommand, z as fetchLatestToken } from "../list-BticEhbi.mjs";
4
+ import { $ as withCommonArgs, B as loadWorkspaceId, D as tokenCommand, F as loadConfig, G as initOAuth2Client, H as writePlatformConfig, J as PATScope, K as initOperatorClient, L as apiCommand, N as applyCommand, O as listCommand$5, Q as jsonArgs, R as fetchLatestToken, S as listCommand$6, U as fetchAll, V as readPlatformConfig, W as fetchUserInfo, X as confirmationArgs, Y as commonArgs, Z as deploymentArgs, a as createCommand$3, d as listCommand$7, et as workspaceArgs, h as executionsCommand, j as generateCommand, l as startCommand, p as getCommand$2, q as readPackageJson, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as logger, w as getCommand$1, x as removeCommand, y as showCommand, z as loadAccessToken } from "../list-9sLkfPfn.mjs";
5
5
  import { register } from "node:module";
6
6
  import { defineCommand, runCommand, runMain } from "citty";
7
7
  import { generateCodeVerifier } from "@badgateway/oauth2-client";
@@ -254,11 +254,12 @@ const createCommand$2 = defineCommand({
254
254
  };
255
255
  writePlatformConfig(config);
256
256
  if (!args.json) logger.success(`Profile "${args.name}" created successfully.`);
257
- printData({
257
+ const profileInfo = {
258
258
  name: args.name,
259
259
  user: args.user,
260
260
  workspaceId: args["workspace-id"]
261
- }, args.json);
261
+ };
262
+ logger.out(profileInfo);
262
263
  })
263
264
  });
264
265
 
@@ -297,7 +298,7 @@ const listCommand$4 = defineCommand({
297
298
  ...commonArgs,
298
299
  ...jsonArgs
299
300
  },
300
- run: withCommonArgs(async (args) => {
301
+ run: withCommonArgs(async () => {
301
302
  const config = readPlatformConfig();
302
303
  const profiles = Object.entries(config.profiles);
303
304
  if (profiles.length === 0) {
@@ -307,11 +308,12 @@ const listCommand$4 = defineCommand({
307
308
  `);
308
309
  return;
309
310
  }
310
- printData(profiles.map(([name, profile]) => ({
311
+ const profileInfos = profiles.map(([name, profile]) => ({
311
312
  name,
312
313
  user: profile.user,
313
314
  workspaceId: profile.workspace_id
314
- })), args.json);
315
+ }));
316
+ logger.out(profileInfos);
315
317
  })
316
318
  });
317
319
 
@@ -359,11 +361,12 @@ const updateCommand$1 = defineCommand({
359
361
  profile.workspace_id = newWorkspaceId;
360
362
  writePlatformConfig(config);
361
363
  if (!args.json) logger.success(`Profile "${args.name}" updated successfully`);
362
- printData({
364
+ const profileInfo = {
363
365
  name: args.name,
364
366
  user: newUser,
365
367
  workspaceId: newWorkspaceId
366
- }, args.json);
368
+ };
369
+ logger.out(profileInfo);
367
370
  })
368
371
  });
369
372
 
@@ -542,11 +545,12 @@ const listSecretCommand = defineCommand({
542
545
  },
543
546
  run: withCommonArgs(async (args) => {
544
547
  try {
545
- printData(await secretList({
548
+ const secrets = await secretList({
546
549
  workspaceId: args["workspace-id"],
547
550
  profile: args.profile,
548
551
  vaultName: args["vault-name"]
549
- }), args.json);
552
+ });
553
+ logger.out(secrets);
550
554
  } catch (error) {
551
555
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Vault "${args["vault-name"]}" not found.`);
552
556
  throw error;
@@ -710,10 +714,11 @@ const listCommand$3 = defineCommand({
710
714
  ...workspaceArgs
711
715
  },
712
716
  run: withCommonArgs(async (args) => {
713
- printData(await vaultList({
717
+ const vaults = await vaultList({
714
718
  workspaceId: args["workspace-id"],
715
719
  profile: args.profile
716
- }), args.json);
720
+ });
721
+ logger.out(vaults);
717
722
  })
718
723
  });
719
724
 
@@ -760,10 +765,10 @@ function createProgress(label, total) {
760
765
  const update = () => {
761
766
  current += 1;
762
767
  const percent = Math.round(current / total * 100);
763
- process.stdout.write(`\r${label} ${current}/${total} (${percent}%)`);
768
+ process.stderr.write(`\r${label} ${current}/${total} (${percent}%)`);
764
769
  };
765
770
  const finish = () => {
766
- process.stdout.write("\n");
771
+ process.stderr.write("\n");
767
772
  };
768
773
  return {
769
774
  update,
@@ -914,12 +919,12 @@ const deployCommand = defineCommand({
914
919
  });
915
920
  if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) throw new Error(`Directory not found or not a directory: ${dir}`);
916
921
  const { url, skippedFiles } = await withTimeout(deployStaticWebsite(client, workspaceId, name, dir, !args.json), 10 * 6e4, "Deployment timed out after 10 minutes.");
917
- if (args.json) printData({
922
+ if (args.json) logger.out({
918
923
  name,
919
924
  workspaceId,
920
925
  url,
921
926
  skippedFiles
922
- }, true);
927
+ });
923
928
  else {
924
929
  logger.success(`Static website "${name}" deployed successfully. URL: ${url}`);
925
930
  logSkippedFiles(skippedFiles);
@@ -960,13 +965,14 @@ const getCommand = defineCommand({
960
965
  name: args.name
961
966
  });
962
967
  if (!staticwebsite) throw new Error(notFoundErrorMessage);
963
- printData({
968
+ const info = {
964
969
  workspaceId,
965
970
  name: staticwebsite.name,
966
971
  description: staticwebsite.description,
967
972
  url: staticwebsite.url,
968
973
  allowedIpAddresses: args.json ? staticwebsite.allowedIpAddresses : staticwebsite.allowedIpAddresses.join("\n")
969
- }, args.json);
974
+ };
975
+ logger.out(info);
970
976
  } catch (error) {
971
977
  if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(notFoundErrorMessage);
972
978
  throw error;
@@ -1014,7 +1020,7 @@ const listCommand$2 = defineCommand({
1014
1020
  workspaceId: args["workspace-id"],
1015
1021
  profile: args.profile
1016
1022
  });
1017
- printData(args.json ? websites : websites.map(({ allowedIpAddresses, ...rest }) => {
1023
+ const formatted = args.json ? websites : websites.map(({ allowedIpAddresses, ...rest }) => {
1018
1024
  if (allowedIpAddresses.length === 0) return {
1019
1025
  ...rest,
1020
1026
  allowedIpAddresses: "No allowed IP addresses"
@@ -1025,7 +1031,8 @@ const listCommand$2 = defineCommand({
1025
1031
  ...rest,
1026
1032
  allowedIpAddresses: label
1027
1033
  };
1028
- }), args.json);
1034
+ });
1035
+ logger.out(formatted);
1029
1036
  })
1030
1037
  });
1031
1038
 
@@ -1266,7 +1273,7 @@ const listCommand$1 = defineCommand({
1266
1273
  return;
1267
1274
  }
1268
1275
  if (args.json) {
1269
- printData(users, args.json);
1276
+ logger.out(users);
1270
1277
  return;
1271
1278
  }
1272
1279
  users.forEach((user) => {
@@ -1297,13 +1304,13 @@ function getScopesFromWriteFlag(write) {
1297
1304
  function getScopeStringsFromWriteFlag(write) {
1298
1305
  return write ? ["read", "write"] : ["read"];
1299
1306
  }
1300
- function printCreatedToken(name, token, write, action, json) {
1307
+ function printCreatedToken(name, token, write, action) {
1301
1308
  const scopes = getScopeStringsFromWriteFlag(write);
1302
- if (json) printData({
1309
+ if (logger.jsonMode) logger.out({
1303
1310
  name,
1304
1311
  scopes,
1305
1312
  token
1306
- }, json);
1313
+ });
1307
1314
  else logger.log(ml`
1308
1315
  Personal access token ${action} successfully.
1309
1316
 
@@ -1350,7 +1357,7 @@ const createCommand = defineCommand({
1350
1357
  scopes
1351
1358
  });
1352
1359
  if (!result.accessToken) throw new Error("Failed to create personal access token");
1353
- printCreatedToken(args.name, result.accessToken, args.write, "created", args.json);
1360
+ printCreatedToken(args.name, result.accessToken, args.write, "created");
1354
1361
  })
1355
1362
  });
1356
1363
 
@@ -1410,7 +1417,8 @@ const listCommand = defineCommand({
1410
1417
  return;
1411
1418
  }
1412
1419
  if (args.json) {
1413
- printData(pats.map(transformPersonalAccessToken), args.json);
1420
+ const patInfos = pats.map(transformPersonalAccessToken);
1421
+ logger.out(patInfos);
1414
1422
  return;
1415
1423
  }
1416
1424
  const maxNameLength = Math.max(...pats.map((pat) => pat.name.length));
@@ -1458,7 +1466,7 @@ const updateCommand = defineCommand({
1458
1466
  scopes
1459
1467
  });
1460
1468
  if (!result.accessToken) throw new Error("Failed to create personal access token");
1461
- printCreatedToken(args.name, result.accessToken, args.write, "updated", args.json);
1469
+ printCreatedToken(args.name, result.accessToken, args.write, "updated");
1462
1470
  })
1463
1471
  });
1464
1472