@tailor-platform/sdk 1.30.0 → 1.32.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +3 -1
  3. package/dist/{application-Bf8SUAtR.mjs → application-B8vok3w2.mjs} +257 -42
  4. package/dist/application-B8vok3w2.mjs.map +1 -0
  5. package/dist/{application-DAQVP9CS.mjs → application-DHifc-oA.mjs} +2 -2
  6. package/dist/cli/index.mjs +67 -70
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +8 -8
  9. package/dist/cli/lib.mjs +8 -6
  10. package/dist/cli/lib.mjs.map +1 -1
  11. package/dist/client-B0wrLUVK.mjs +6 -0
  12. package/dist/{client-CZmQBXAY.mjs → client-DfdgRZlQ.mjs} +25 -13
  13. package/dist/{client-CZmQBXAY.mjs.map → client-DfdgRZlQ.mjs.map} +1 -1
  14. package/dist/configure/index.d.mts +4 -4
  15. package/dist/configure/index.mjs +1 -1
  16. package/dist/{crash-report-CYrETw1c.mjs → crash-report-BMEhRxeg.mjs} +1 -1
  17. package/dist/{crash-report-DizNMVnm.mjs → crash-report-wNxS0IUJ.mjs} +2 -2
  18. package/dist/{crash-report-DizNMVnm.mjs.map → crash-report-wNxS0IUJ.mjs.map} +1 -1
  19. package/dist/{env-DiWYe80_.d.mts → env-BgdHfWDn.d.mts} +2 -2
  20. package/dist/{index-BU7Cd5I4.d.mts → index-BAud4CE7.d.mts} +15 -15
  21. package/dist/{index-HvMUWjvV.d.mts → index-CdDzh-T2.d.mts} +2 -2
  22. package/dist/{index-rH_De6hM.d.mts → index-CxgBnxKM.d.mts} +2 -2
  23. package/dist/{index-DCEMVfJA.d.mts → index-D4Y81vh1.d.mts} +2 -2
  24. package/dist/{index-2WQbf_LH.d.mts → index-FZMBoUWm.d.mts} +2 -2
  25. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  26. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  27. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  28. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  29. package/dist/plugin/index.d.mts +2 -2
  30. package/dist/{plugin-C-UdAM8C.d.mts → plugin-DyVYXZWz.d.mts} +7 -7
  31. package/dist/{query-C3oQTLvb.mjs → runtime-DbX_UxlC.mjs} +67 -39
  32. package/dist/runtime-DbX_UxlC.mjs.map +1 -0
  33. package/dist/{schema-BePzTFBV.mjs → schema-CNWt2FKQ.mjs} +3 -14
  34. package/dist/schema-CNWt2FKQ.mjs.map +1 -0
  35. package/dist/utils/test/index.d.mts +8 -3
  36. package/dist/utils/test/index.mjs +15 -1
  37. package/dist/utils/test/index.mjs.map +1 -1
  38. package/dist/{workflow.generated-C5wMcCjB.d.mts → workflow.generated-DMQ-cjyT.d.mts} +2 -2
  39. package/docs/quickstart.md +12 -0
  40. package/docs/services/resolver.md +72 -0
  41. package/docs/services/tailordb.md +78 -6
  42. package/package.json +15 -12
  43. package/dist/application-Bf8SUAtR.mjs.map +0 -1
  44. package/dist/client-CW4Oh3iz.mjs +0 -6
  45. package/dist/query-C3oQTLvb.mjs.map +0 -1
  46. package/dist/schema-BePzTFBV.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import "./chunk-DEt8GZDa.mjs";
2
2
  import "./brand-GZnI4eYb.mjs";
3
3
  import "./logger-CqezTedh.mjs";
4
- import "./client-CZmQBXAY.mjs";
4
+ import "./client-DfdgRZlQ.mjs";
5
5
  import "./package-json-D3x2nBPB.mjs";
6
- import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-Bf8SUAtR.mjs";
6
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-B8vok3w2.mjs";
7
7
  import "./seed-CWkIDWMb.mjs";
8
8
  import "./file-utils-Bctuzn3x.mjs";
9
9
  import "./kysely-type-B_IecdK9.mjs";
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import "../chunk-DEt8GZDa.mjs";
3
- import "../schema-BePzTFBV.mjs";
3
+ import "../schema-CNWt2FKQ.mjs";
4
4
  import "../brand-GZnI4eYb.mjs";
5
5
  import { n as logger, r as styles } from "../logger-CqezTedh.mjs";
6
- import { $ as deleteCommand$3, $t as isValidMigrationNumber, At as formatKeyValueTable, C as listCommand$12, E as resumeCommand, Et as executionsCommand, F as showCommand, G as getCommand$4, H as treeCommand, I as logBetaWarning, Lt as parseMigrationLabelNumber, N as generateCommand$1, Nt as apply, O as listCommand$11, Pt as executeScript, R as removeCommand$1, St as startCommand, T as healthCommand, U as listCommand$10, Xt as getMigrationFilePath, Y as listCommand$9, Z as getCommand$3, Zt as getMigrationFiles, _n as workspaceArgs, an as getNamespacesWithMigrations, at as getCommand$2, b as createCommand$4, c as listCommand$13, cn as trnPrefix, ct as tokenCommand, dn as apiCommand, dt as generate, en as loadDiff, f as restoreCommand, fn as defineAppCommand, g as getCommand$6, gn as isVerbose, gt as listCommand$6, hn as deploymentArgs, i as updateCommand$4, j as truncateCommand, jt as getCommand$1, kt as functionExecutionStatusToString, lt as listCommand$7, m as listCommand$14, mn as confirmationArgs, mt as triggerCommand, n as queryCommand, o as removeCommand, on as prompt, pn as commonArgs, pt as webhookCommand, q as updateCommand$2, qt as formatMigrationNumber, r as isCLIError, rt as listCommand$8, sn as sdkNameLabelKey, tt as createCommand$3, u as inviteCommand, v as deleteCommand$4, wt as getCommand$5, yt as jobsCommand, z as updateCommand$3 } from "../query-C3oQTLvb.mjs";
7
- import { E as FunctionExecution_Type, M as AuthInvokerSchema, a as fetchPlatformMachineUserToken, c as initOAuth2Client, l as initOperatorClient, n as closeConnectionPool, o as fetchUserInfo, p as userAgent, r as fetchAll, z as PATScope } from "../client-CZmQBXAY.mjs";
6
+ import { At as functionExecutionStatusToString, B as updateCommand$3, Ct as startCommand, D as resumeCommand, Dt as executionsCommand, E as healthCommand, Ft as executeScript, I as showCommand, J as updateCommand$2, Jt as formatMigrationNumber, K as getCommand$4, L as logBetaWarning, M as truncateCommand, Mt as getCommand$1, P as generateCommand$1, Pt as apply, Q as getCommand$3, Qt as getMigrationFiles, Rt as parseMigrationLabelNumber, Tt as getCommand$5, U as treeCommand, W as listCommand$10, X as listCommand$9, Zt as getMigrationFilePath, _ as getCommand$6, _n as isVerbose, _t as listCommand$6, a as updateCommand$4, bt as jobsCommand, cn as sdkNameLabelKey, d as inviteCommand, en as isValidMigrationNumber, et as deleteCommand$3, fn as apiCommand, ft as generate, gn as deploymentArgs, h as listCommand$14, hn as confirmationArgs, ht as triggerCommand, i as isCLIError, it as listCommand$8, jt as formatKeyValueTable, k as listCommand$11, l as listCommand$13, ln as trnPrefix, lt as tokenCommand, mn as commonArgs, mt as webhookCommand, nt as createCommand$3, on as getNamespacesWithMigrations, ot as getCommand$2, p as restoreCommand, pn as defineAppCommand, r as queryCommand, s as removeCommand, sn as prompt, t as isNativeTypeScriptRuntime, tn as loadDiff, ut as listCommand$7, vn as workspaceArgs, w as listCommand$12, x as createCommand$4, y as deleteCommand$4, z as removeCommand$1 } from "../runtime-DbX_UxlC.mjs";
7
+ import { B as PATScope, D as FunctionExecution_Type, N as AuthInvokerSchema, i as fetchAll, l as initOAuth2Client, m as userAgent, n as closeConnectionPool, o as fetchPlatformMachineUserToken, s as fetchUserInfo, u as initOperatorClient } from "../client-DfdgRZlQ.mjs";
8
8
  import { t as readPackageJson } from "../package-json-D3x2nBPB.mjs";
9
- import { S as writePlatformConfig, a as loadConfig, b as loadWorkspaceId, c as ExecutorSchema, g as getDistDir, i as resolveInlineSourcemap, o as WorkflowJobSchema, u as ResolverSchema, v as fetchLatestToken, x as readPlatformConfig, y as loadAccessToken } from "../application-Bf8SUAtR.mjs";
9
+ import { C as resolveTokens, S as readPlatformConfig, T as writePlatformConfig, a as loadConfig, b as loadAccessToken, c as ExecutorSchema, g as getDistDir, i as resolveInlineSourcemap, o as WorkflowJobSchema, u as ResolverSchema, v as deleteUserTokens, w as saveUserTokens, x as loadWorkspaceId, y as fetchLatestToken } from "../application-B8vok3w2.mjs";
10
10
  import "../seed-CWkIDWMb.mjs";
11
11
  import "../file-utils-Bctuzn3x.mjs";
12
12
  import "../kysely-type-B_IecdK9.mjs";
13
13
  import "../telemetry-BSUlYTs-.mjs";
14
- import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-DizNMVnm.mjs";
15
- import { createRequire, register } from "node:module";
14
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-wNxS0IUJ.mjs";
15
+ import { createRequire } from "node:module";
16
16
  import { arg, defineCommand, runCommand, runMain } from "politty";
17
17
  import { withCompletionCommand } from "politty/completion";
18
18
  import { z } from "zod";
@@ -271,7 +271,7 @@ const logsCommand = defineAppCommand({
271
271
  useProfile: true,
272
272
  profile: args.profile
273
273
  }));
274
- const workspaceId = loadWorkspaceId({
274
+ const workspaceId = await loadWorkspaceId({
275
275
  workspaceId: args["workspace-id"],
276
276
  profile: args.profile
277
277
  });
@@ -393,13 +393,10 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
393
393
  });
394
394
 
395
395
  if (result.issues) {
396
- const errorMessages = result.issues
397
- .map(issue => {
398
- const path = issue.path ? issue.path.join('.') : '';
399
- return path ? \` \${path}: \${issue.message}\` : issue.message;
400
- })
401
- .join('\\n');
402
- throw new Error(\`Failed to input validation:\\n\${errorMessages}\`);
396
+ throw new TailorErrors(result.issues.map(issue => ({
397
+ message: issue.message,
398
+ path: issue.path ?? [],
399
+ })));
403
400
  }
404
401
  }
405
402
 
@@ -629,7 +626,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
629
626
  useProfile: true,
630
627
  profile: args.profile
631
628
  }));
632
- const workspaceId = loadWorkspaceId({
629
+ const workspaceId = await loadWorkspaceId({
633
630
  workspaceId: args["workspace-id"],
634
631
  profile: args.profile
635
632
  });
@@ -821,7 +818,8 @@ const detectPackageManager = () => {
821
818
  const availablePMs = [
822
819
  "npm",
823
820
  "yarn",
824
- "pnpm"
821
+ "pnpm",
822
+ "bun"
825
823
  ];
826
824
  const userAgent = process.env.npm_config_user_agent;
827
825
  if (!userAgent) return;
@@ -883,15 +881,11 @@ const startAuthServer = async () => {
883
881
  codeVerifier
884
882
  });
885
883
  const userInfo = await fetchUserInfo(tokens.accessToken);
886
- const pfConfig = readPlatformConfig();
887
- pfConfig.users = {
888
- ...pfConfig.users,
889
- [userInfo.email]: {
890
- access_token: tokens.accessToken,
891
- refresh_token: tokens.refreshToken,
892
- token_expires_at: new Date(tokens.expiresAt).toISOString()
893
- }
894
- };
884
+ const pfConfig = await readPlatformConfig();
885
+ await saveUserTokens(pfConfig, userInfo.email, {
886
+ accessToken: tokens.accessToken,
887
+ refreshToken: tokens.refreshToken ?? void 0
888
+ }, new Date(tokens.expiresAt).toISOString());
895
889
  pfConfig.current_user = userInfo.email;
896
890
  writePlatformConfig(pfConfig);
897
891
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -936,14 +930,8 @@ const startAuthServer = async () => {
936
930
  async function loginAsMachineUser(args) {
937
931
  const clientSecret = args.clientSecret ?? await prompt.password({ message: "Client secret" });
938
932
  const tokens = await fetchPlatformMachineUserToken(args.clientId, clientSecret);
939
- const pfConfig = readPlatformConfig();
940
- pfConfig.users = {
941
- ...pfConfig.users,
942
- [args.clientId]: {
943
- access_token: tokens.accessToken,
944
- token_expires_at: new Date(tokens.expiresAt).toISOString()
945
- }
946
- };
933
+ const pfConfig = await readPlatformConfig();
934
+ await saveUserTokens(pfConfig, args.clientId, { accessToken: tokens.accessToken }, new Date(tokens.expiresAt).toISOString());
947
935
  pfConfig.current_user = args.clientId;
948
936
  writePlatformConfig(pfConfig);
949
937
  }
@@ -983,19 +971,25 @@ const logoutCommand = defineAppCommand({
983
971
  description: "Logout from Tailor Platform.",
984
972
  args: z.object({}).strict(),
985
973
  run: async () => {
986
- const pfConfig = readPlatformConfig();
987
- const tokens = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
988
- if (!tokens) {
974
+ const pfConfig = await readPlatformConfig();
975
+ const userEntry = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
976
+ if (!userEntry) {
989
977
  logger.info("You are not logged in.");
990
978
  return;
991
979
  }
992
- const client = initOAuth2Client();
993
- const tokenTypeHint = tokens.refresh_token ? "refresh_token" : "access_token";
994
- client.revoke({
995
- accessToken: tokens.access_token,
996
- refreshToken: tokens.refresh_token ?? null,
997
- expiresAt: Date.parse(tokens.token_expires_at)
998
- }, tokenTypeHint);
980
+ try {
981
+ const { accessToken, refreshToken } = await resolveTokens(userEntry, pfConfig.current_user);
982
+ const client = initOAuth2Client();
983
+ const tokenTypeHint = refreshToken ? "refresh_token" : "access_token";
984
+ await client.revoke({
985
+ accessToken,
986
+ refreshToken: refreshToken ?? null,
987
+ expiresAt: Date.parse(userEntry.token_expires_at)
988
+ }, tokenTypeHint);
989
+ } catch (error) {
990
+ logger.warn(`Failed to revoke token: ${error instanceof Error ? error.message : error}`);
991
+ }
992
+ await deleteUserTokens(pfConfig, pfConfig.current_user);
999
993
  delete pfConfig.users[pfConfig.current_user];
1000
994
  pfConfig.current_user = null;
1001
995
  writePlatformConfig(pfConfig);
@@ -1039,7 +1033,7 @@ const openCommand = defineAppCommand({
1039
1033
  description: "Open Tailor Platform Console.",
1040
1034
  args: z.object({ ...deploymentArgs }).strict(),
1041
1035
  run: async (args) => {
1042
- const workspaceId = loadWorkspaceId({
1036
+ const workspaceId = await loadWorkspaceId({
1043
1037
  workspaceId: args["workspace-id"],
1044
1038
  profile: args.profile
1045
1039
  });
@@ -1110,7 +1104,7 @@ const createCommand$2 = defineAppCommand({
1110
1104
  })
1111
1105
  }).strict(),
1112
1106
  run: async (args) => {
1113
- const config = readPlatformConfig();
1107
+ const config = await readPlatformConfig();
1114
1108
  if (config.profiles[args.name]) throw new Error(`Profile "${args.name}" already exists.`);
1115
1109
  const client = await initOperatorClient(await fetchLatestToken(config, args.user));
1116
1110
  if (!(await fetchAll(async (pageToken, maxPageSize) => {
@@ -1145,7 +1139,7 @@ const deleteCommand$2 = defineAppCommand({
1145
1139
  description: "Profile name"
1146
1140
  }) }).strict(),
1147
1141
  run: async (args) => {
1148
- const config = readPlatformConfig();
1142
+ const config = await readPlatformConfig();
1149
1143
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1150
1144
  delete config.profiles[args.name];
1151
1145
  writePlatformConfig(config);
@@ -1160,7 +1154,7 @@ const listCommand$4 = defineAppCommand({
1160
1154
  description: "List all profiles.",
1161
1155
  args: z.object({}).strict(),
1162
1156
  run: async () => {
1163
- const config = readPlatformConfig();
1157
+ const config = await readPlatformConfig();
1164
1158
  const profiles = Object.entries(config.profiles);
1165
1159
  if (profiles.length === 0) {
1166
1160
  logger.info(ml`
@@ -1198,7 +1192,7 @@ const updateCommand$1 = defineAppCommand({
1198
1192
  })
1199
1193
  }).strict(),
1200
1194
  run: async (args) => {
1201
- const config = readPlatformConfig();
1195
+ const config = await readPlatformConfig();
1202
1196
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1203
1197
  if (!args.user && !args["workspace-id"]) throw new Error("Please provide at least one property to update.");
1204
1198
  const profile = config.profiles[args.name];
@@ -1339,7 +1333,7 @@ const createSecretCommand = defineAppCommand({
1339
1333
  useProfile: true,
1340
1334
  profile: args.profile
1341
1335
  }));
1342
- const workspaceId = loadWorkspaceId({
1336
+ const workspaceId = await loadWorkspaceId({
1343
1337
  workspaceId: args["workspace-id"],
1344
1338
  profile: args.profile
1345
1339
  });
@@ -1391,7 +1385,7 @@ const deleteSecretCommand = defineAppCommand({
1391
1385
  useProfile: true,
1392
1386
  profile: args.profile
1393
1387
  }));
1394
- const workspaceId = loadWorkspaceId({
1388
+ const workspaceId = await loadWorkspaceId({
1395
1389
  workspaceId: args["workspace-id"],
1396
1390
  profile: args.profile
1397
1391
  });
@@ -1443,7 +1437,7 @@ async function secretList(options) {
1443
1437
  useProfile: true,
1444
1438
  profile: options.profile
1445
1439
  }));
1446
- const workspaceId = loadWorkspaceId({
1440
+ const workspaceId = await loadWorkspaceId({
1447
1441
  workspaceId: options.workspaceId,
1448
1442
  profile: options.profile
1449
1443
  });
@@ -1494,7 +1488,7 @@ const updateSecretCommand = defineAppCommand({
1494
1488
  useProfile: true,
1495
1489
  profile: args.profile
1496
1490
  }));
1497
- const workspaceId = loadWorkspaceId({
1491
+ const workspaceId = await loadWorkspaceId({
1498
1492
  workspaceId: args["workspace-id"],
1499
1493
  profile: args.profile
1500
1494
  });
@@ -1549,7 +1543,7 @@ const createCommand$1 = defineAppCommand({
1549
1543
  useProfile: true,
1550
1544
  profile: args.profile
1551
1545
  }));
1552
- const workspaceId = loadWorkspaceId({
1546
+ const workspaceId = await loadWorkspaceId({
1553
1547
  workspaceId: args["workspace-id"],
1554
1548
  profile: args.profile
1555
1549
  });
@@ -1581,7 +1575,7 @@ const deleteCommand$1 = defineAppCommand({
1581
1575
  useProfile: true,
1582
1576
  profile: args.profile
1583
1577
  }));
1584
- const workspaceId = loadWorkspaceId({
1578
+ const workspaceId = await loadWorkspaceId({
1585
1579
  workspaceId: args["workspace-id"],
1586
1580
  profile: args.profile
1587
1581
  });
@@ -1629,7 +1623,7 @@ async function vaultList(options) {
1629
1623
  useProfile: true,
1630
1624
  profile: options?.profile
1631
1625
  }));
1632
- const workspaceId = loadWorkspaceId({
1626
+ const workspaceId = await loadWorkspaceId({
1633
1627
  workspaceId: options?.workspaceId,
1634
1628
  profile: options?.profile
1635
1629
  });
@@ -2015,7 +2009,7 @@ const deployCommand = defineAppCommand({
2015
2009
  }));
2016
2010
  const name = args.name;
2017
2011
  const dir = path.resolve(process.cwd(), args.dir);
2018
- const workspaceId = loadWorkspaceId({
2012
+ const workspaceId = await loadWorkspaceId({
2019
2013
  workspaceId: args["workspace-id"],
2020
2014
  profile: args.profile
2021
2015
  });
@@ -2051,7 +2045,7 @@ const getCommand = defineAppCommand({
2051
2045
  useProfile: true,
2052
2046
  profile: args.profile
2053
2047
  }));
2054
- const workspaceId = loadWorkspaceId({
2048
+ const workspaceId = await loadWorkspaceId({
2055
2049
  workspaceId: args["workspace-id"],
2056
2050
  profile: args.profile
2057
2051
  });
@@ -2089,7 +2083,7 @@ async function listStaticWebsites(options) {
2089
2083
  useProfile: true,
2090
2084
  profile: options?.profile
2091
2085
  }));
2092
- const workspaceId = loadWorkspaceId({
2086
+ const workspaceId = await loadWorkspaceId({
2093
2087
  workspaceId: options?.workspaceId,
2094
2088
  profile: options?.profile
2095
2089
  });
@@ -2332,7 +2326,7 @@ async function initErdContext(args) {
2332
2326
  useProfile: true,
2333
2327
  profile: args.profile
2334
2328
  }));
2335
- const workspaceId = loadWorkspaceId({
2329
+ const workspaceId = await loadWorkspaceId({
2336
2330
  workspaceId: args.workspaceId,
2337
2331
  profile: args.profile
2338
2332
  });
@@ -2672,7 +2666,7 @@ async function set(options) {
2672
2666
  useProfile: false,
2673
2667
  profile: options.profile
2674
2668
  }));
2675
- const trn = `${trnPrefix(loadWorkspaceId({
2669
+ const trn = `${trnPrefix(await loadWorkspaceId({
2676
2670
  workspaceId: options.workspaceId,
2677
2671
  profile: options.profile
2678
2672
  }))}:tailordb:${targetNamespace}`;
@@ -2762,7 +2756,7 @@ async function status(options) {
2762
2756
  useProfile: false,
2763
2757
  profile: options.profile
2764
2758
  }));
2765
- const workspaceId = loadWorkspaceId({
2759
+ const workspaceId = await loadWorkspaceId({
2766
2760
  workspaceId: options.workspaceId,
2767
2761
  profile: options.profile
2768
2762
  });
@@ -2854,7 +2848,7 @@ const currentCommand = defineAppCommand({
2854
2848
  description: "Show current user.",
2855
2849
  args: z.object({}).strict(),
2856
2850
  run: async () => {
2857
- const config = readPlatformConfig();
2851
+ const config = await readPlatformConfig();
2858
2852
  if (!config.current_user) throw new Error(ml`
2859
2853
  Current user not set.
2860
2854
  Please login first using 'tailor-sdk login' command to register a user.
@@ -2874,7 +2868,7 @@ const listCommand$1 = defineAppCommand({
2874
2868
  description: "List all users.",
2875
2869
  args: z.object({}).strict(),
2876
2870
  run: async (args) => {
2877
- const config = readPlatformConfig();
2871
+ const config = await readPlatformConfig();
2878
2872
  const users = Object.keys(config.users);
2879
2873
  if (users.length === 0) {
2880
2874
  logger.info(ml`
@@ -2966,7 +2960,7 @@ const createCommand = defineAppCommand({
2966
2960
  })
2967
2961
  }).strict(),
2968
2962
  run: async (args) => {
2969
- const config = readPlatformConfig();
2963
+ const config = await readPlatformConfig();
2970
2964
  if (!config.current_user) throw new Error(ml`
2971
2965
  No user logged in.
2972
2966
  Please login first using 'tailor-sdk login' command.
@@ -2992,7 +2986,7 @@ const deleteCommand = defineAppCommand({
2992
2986
  description: "Token name"
2993
2987
  }) }).strict(),
2994
2988
  run: async (args) => {
2995
- const config = readPlatformConfig();
2989
+ const config = await readPlatformConfig();
2996
2990
  if (!config.current_user) throw new Error(ml`
2997
2991
  No user logged in.
2998
2992
  Please login first using 'tailor-sdk login' command.
@@ -3009,7 +3003,7 @@ const listCommand = defineAppCommand({
3009
3003
  description: "List all personal access tokens.",
3010
3004
  args: z.object({}).strict(),
3011
3005
  run: async (args) => {
3012
- const config = readPlatformConfig();
3006
+ const config = await readPlatformConfig();
3013
3007
  if (!config.current_user) throw new Error(ml`
3014
3008
  No user logged in.
3015
3009
  Please login first using 'tailor-sdk login' command.
@@ -3060,7 +3054,7 @@ const updateCommand = defineAppCommand({
3060
3054
  })
3061
3055
  }).strict(),
3062
3056
  run: async (args) => {
3063
- const config = readPlatformConfig();
3057
+ const config = await readPlatformConfig();
3064
3058
  if (!config.current_user) throw new Error(ml`
3065
3059
  No user logged in.
3066
3060
  Please login first using 'tailor-sdk login' command.
@@ -3103,7 +3097,7 @@ const switchCommand = defineAppCommand({
3103
3097
  description: "User email"
3104
3098
  }) }).strict(),
3105
3099
  run: async (args) => {
3106
- const config = readPlatformConfig();
3100
+ const config = await readPlatformConfig();
3107
3101
  if (!config.users[args.user]) throw new Error(ml`
3108
3102
  User "${args.user}" not found.
3109
3103
  Please login first using 'tailor-sdk login' command to register this user.
@@ -3198,7 +3192,10 @@ const workspaceCommand = defineCommand({
3198
3192
 
3199
3193
  //#endregion
3200
3194
  //#region src/cli/index.ts
3201
- register("tsx", import.meta.url, { data: {} });
3195
+ if (!isNativeTypeScriptRuntime()) {
3196
+ const { register } = await import("node:module");
3197
+ register("tsx", import.meta.url, { data: {} });
3198
+ }
3202
3199
  initCrashReporting();
3203
3200
  const packageJson = await readPackageJson();
3204
3201
  const cliName = Object.keys(packageJson.bin ?? {})[0] || "tailor-sdk";
@@ -3246,7 +3243,7 @@ runMain(mainCommand, {
3246
3243
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3247
3244
  } else logger.error(`Unknown error: ${error}`);
3248
3245
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
3249
- const { reportCrash } = await import("../crash-report-CYrETw1c.mjs");
3246
+ const { reportCrash } = await import("../crash-report-BMEhRxeg.mjs");
3250
3247
  await reportCrash(error, "handledError");
3251
3248
  }
3252
3249
  }