@tailor-platform/sdk 1.30.0 → 1.31.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 (44) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +3 -1
  3. package/dist/{application-DAQVP9CS.mjs → application-B2-PymMz.mjs} +2 -2
  4. package/dist/{application-Bf8SUAtR.mjs → application-CASjzt3W.mjs} +253 -35
  5. package/dist/application-CASjzt3W.mjs.map +1 -0
  6. package/dist/cli/index.mjs +63 -63
  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-HvMUWjvV.d.mts → index-CdDzh-T2.d.mts} +2 -2
  21. package/dist/{index-rH_De6hM.d.mts → index-CxgBnxKM.d.mts} +2 -2
  22. package/dist/{index-DCEMVfJA.d.mts → index-D4Y81vh1.d.mts} +2 -2
  23. package/dist/{index-2WQbf_LH.d.mts → index-FZMBoUWm.d.mts} +2 -2
  24. package/dist/{index-BU7Cd5I4.d.mts → index-RXv15__b.d.mts} +4 -4
  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-Ofe7nHEG.mjs} +67 -39
  32. package/dist/runtime-Ofe7nHEG.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 +2 -2
  36. package/dist/{workflow.generated-C5wMcCjB.d.mts → workflow.generated-DMQ-cjyT.d.mts} +2 -2
  37. package/docs/quickstart.md +12 -0
  38. package/docs/services/resolver.md +59 -0
  39. package/docs/services/tailordb.md +78 -6
  40. package/package.json +14 -11
  41. package/dist/application-Bf8SUAtR.mjs.map +0 -1
  42. package/dist/client-CW4Oh3iz.mjs +0 -6
  43. package/dist/query-C3oQTLvb.mjs.map +0 -1
  44. package/dist/schema-BePzTFBV.mjs.map +0 -1
@@ -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-Ofe7nHEG.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-CASjzt3W.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
  });
@@ -629,7 +629,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
629
629
  useProfile: true,
630
630
  profile: args.profile
631
631
  }));
632
- const workspaceId = loadWorkspaceId({
632
+ const workspaceId = await loadWorkspaceId({
633
633
  workspaceId: args["workspace-id"],
634
634
  profile: args.profile
635
635
  });
@@ -821,7 +821,8 @@ const detectPackageManager = () => {
821
821
  const availablePMs = [
822
822
  "npm",
823
823
  "yarn",
824
- "pnpm"
824
+ "pnpm",
825
+ "bun"
825
826
  ];
826
827
  const userAgent = process.env.npm_config_user_agent;
827
828
  if (!userAgent) return;
@@ -883,15 +884,11 @@ const startAuthServer = async () => {
883
884
  codeVerifier
884
885
  });
885
886
  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
- };
887
+ const pfConfig = await readPlatformConfig();
888
+ await saveUserTokens(pfConfig, userInfo.email, {
889
+ accessToken: tokens.accessToken,
890
+ refreshToken: tokens.refreshToken ?? void 0
891
+ }, new Date(tokens.expiresAt).toISOString());
895
892
  pfConfig.current_user = userInfo.email;
896
893
  writePlatformConfig(pfConfig);
897
894
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -936,14 +933,8 @@ const startAuthServer = async () => {
936
933
  async function loginAsMachineUser(args) {
937
934
  const clientSecret = args.clientSecret ?? await prompt.password({ message: "Client secret" });
938
935
  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
- };
936
+ const pfConfig = await readPlatformConfig();
937
+ await saveUserTokens(pfConfig, args.clientId, { accessToken: tokens.accessToken }, new Date(tokens.expiresAt).toISOString());
947
938
  pfConfig.current_user = args.clientId;
948
939
  writePlatformConfig(pfConfig);
949
940
  }
@@ -983,19 +974,25 @@ const logoutCommand = defineAppCommand({
983
974
  description: "Logout from Tailor Platform.",
984
975
  args: z.object({}).strict(),
985
976
  run: async () => {
986
- const pfConfig = readPlatformConfig();
987
- const tokens = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
988
- if (!tokens) {
977
+ const pfConfig = await readPlatformConfig();
978
+ const userEntry = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
979
+ if (!userEntry) {
989
980
  logger.info("You are not logged in.");
990
981
  return;
991
982
  }
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);
983
+ try {
984
+ const { accessToken, refreshToken } = await resolveTokens(userEntry, pfConfig.current_user);
985
+ const client = initOAuth2Client();
986
+ const tokenTypeHint = refreshToken ? "refresh_token" : "access_token";
987
+ await client.revoke({
988
+ accessToken,
989
+ refreshToken: refreshToken ?? null,
990
+ expiresAt: Date.parse(userEntry.token_expires_at)
991
+ }, tokenTypeHint);
992
+ } catch (error) {
993
+ logger.warn(`Failed to revoke token: ${error instanceof Error ? error.message : error}`);
994
+ }
995
+ await deleteUserTokens(pfConfig, pfConfig.current_user);
999
996
  delete pfConfig.users[pfConfig.current_user];
1000
997
  pfConfig.current_user = null;
1001
998
  writePlatformConfig(pfConfig);
@@ -1039,7 +1036,7 @@ const openCommand = defineAppCommand({
1039
1036
  description: "Open Tailor Platform Console.",
1040
1037
  args: z.object({ ...deploymentArgs }).strict(),
1041
1038
  run: async (args) => {
1042
- const workspaceId = loadWorkspaceId({
1039
+ const workspaceId = await loadWorkspaceId({
1043
1040
  workspaceId: args["workspace-id"],
1044
1041
  profile: args.profile
1045
1042
  });
@@ -1110,7 +1107,7 @@ const createCommand$2 = defineAppCommand({
1110
1107
  })
1111
1108
  }).strict(),
1112
1109
  run: async (args) => {
1113
- const config = readPlatformConfig();
1110
+ const config = await readPlatformConfig();
1114
1111
  if (config.profiles[args.name]) throw new Error(`Profile "${args.name}" already exists.`);
1115
1112
  const client = await initOperatorClient(await fetchLatestToken(config, args.user));
1116
1113
  if (!(await fetchAll(async (pageToken, maxPageSize) => {
@@ -1145,7 +1142,7 @@ const deleteCommand$2 = defineAppCommand({
1145
1142
  description: "Profile name"
1146
1143
  }) }).strict(),
1147
1144
  run: async (args) => {
1148
- const config = readPlatformConfig();
1145
+ const config = await readPlatformConfig();
1149
1146
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1150
1147
  delete config.profiles[args.name];
1151
1148
  writePlatformConfig(config);
@@ -1160,7 +1157,7 @@ const listCommand$4 = defineAppCommand({
1160
1157
  description: "List all profiles.",
1161
1158
  args: z.object({}).strict(),
1162
1159
  run: async () => {
1163
- const config = readPlatformConfig();
1160
+ const config = await readPlatformConfig();
1164
1161
  const profiles = Object.entries(config.profiles);
1165
1162
  if (profiles.length === 0) {
1166
1163
  logger.info(ml`
@@ -1198,7 +1195,7 @@ const updateCommand$1 = defineAppCommand({
1198
1195
  })
1199
1196
  }).strict(),
1200
1197
  run: async (args) => {
1201
- const config = readPlatformConfig();
1198
+ const config = await readPlatformConfig();
1202
1199
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1203
1200
  if (!args.user && !args["workspace-id"]) throw new Error("Please provide at least one property to update.");
1204
1201
  const profile = config.profiles[args.name];
@@ -1339,7 +1336,7 @@ const createSecretCommand = defineAppCommand({
1339
1336
  useProfile: true,
1340
1337
  profile: args.profile
1341
1338
  }));
1342
- const workspaceId = loadWorkspaceId({
1339
+ const workspaceId = await loadWorkspaceId({
1343
1340
  workspaceId: args["workspace-id"],
1344
1341
  profile: args.profile
1345
1342
  });
@@ -1391,7 +1388,7 @@ const deleteSecretCommand = defineAppCommand({
1391
1388
  useProfile: true,
1392
1389
  profile: args.profile
1393
1390
  }));
1394
- const workspaceId = loadWorkspaceId({
1391
+ const workspaceId = await loadWorkspaceId({
1395
1392
  workspaceId: args["workspace-id"],
1396
1393
  profile: args.profile
1397
1394
  });
@@ -1443,7 +1440,7 @@ async function secretList(options) {
1443
1440
  useProfile: true,
1444
1441
  profile: options.profile
1445
1442
  }));
1446
- const workspaceId = loadWorkspaceId({
1443
+ const workspaceId = await loadWorkspaceId({
1447
1444
  workspaceId: options.workspaceId,
1448
1445
  profile: options.profile
1449
1446
  });
@@ -1494,7 +1491,7 @@ const updateSecretCommand = defineAppCommand({
1494
1491
  useProfile: true,
1495
1492
  profile: args.profile
1496
1493
  }));
1497
- const workspaceId = loadWorkspaceId({
1494
+ const workspaceId = await loadWorkspaceId({
1498
1495
  workspaceId: args["workspace-id"],
1499
1496
  profile: args.profile
1500
1497
  });
@@ -1549,7 +1546,7 @@ const createCommand$1 = defineAppCommand({
1549
1546
  useProfile: true,
1550
1547
  profile: args.profile
1551
1548
  }));
1552
- const workspaceId = loadWorkspaceId({
1549
+ const workspaceId = await loadWorkspaceId({
1553
1550
  workspaceId: args["workspace-id"],
1554
1551
  profile: args.profile
1555
1552
  });
@@ -1581,7 +1578,7 @@ const deleteCommand$1 = defineAppCommand({
1581
1578
  useProfile: true,
1582
1579
  profile: args.profile
1583
1580
  }));
1584
- const workspaceId = loadWorkspaceId({
1581
+ const workspaceId = await loadWorkspaceId({
1585
1582
  workspaceId: args["workspace-id"],
1586
1583
  profile: args.profile
1587
1584
  });
@@ -1629,7 +1626,7 @@ async function vaultList(options) {
1629
1626
  useProfile: true,
1630
1627
  profile: options?.profile
1631
1628
  }));
1632
- const workspaceId = loadWorkspaceId({
1629
+ const workspaceId = await loadWorkspaceId({
1633
1630
  workspaceId: options?.workspaceId,
1634
1631
  profile: options?.profile
1635
1632
  });
@@ -2015,7 +2012,7 @@ const deployCommand = defineAppCommand({
2015
2012
  }));
2016
2013
  const name = args.name;
2017
2014
  const dir = path.resolve(process.cwd(), args.dir);
2018
- const workspaceId = loadWorkspaceId({
2015
+ const workspaceId = await loadWorkspaceId({
2019
2016
  workspaceId: args["workspace-id"],
2020
2017
  profile: args.profile
2021
2018
  });
@@ -2051,7 +2048,7 @@ const getCommand = defineAppCommand({
2051
2048
  useProfile: true,
2052
2049
  profile: args.profile
2053
2050
  }));
2054
- const workspaceId = loadWorkspaceId({
2051
+ const workspaceId = await loadWorkspaceId({
2055
2052
  workspaceId: args["workspace-id"],
2056
2053
  profile: args.profile
2057
2054
  });
@@ -2089,7 +2086,7 @@ async function listStaticWebsites(options) {
2089
2086
  useProfile: true,
2090
2087
  profile: options?.profile
2091
2088
  }));
2092
- const workspaceId = loadWorkspaceId({
2089
+ const workspaceId = await loadWorkspaceId({
2093
2090
  workspaceId: options?.workspaceId,
2094
2091
  profile: options?.profile
2095
2092
  });
@@ -2332,7 +2329,7 @@ async function initErdContext(args) {
2332
2329
  useProfile: true,
2333
2330
  profile: args.profile
2334
2331
  }));
2335
- const workspaceId = loadWorkspaceId({
2332
+ const workspaceId = await loadWorkspaceId({
2336
2333
  workspaceId: args.workspaceId,
2337
2334
  profile: args.profile
2338
2335
  });
@@ -2672,7 +2669,7 @@ async function set(options) {
2672
2669
  useProfile: false,
2673
2670
  profile: options.profile
2674
2671
  }));
2675
- const trn = `${trnPrefix(loadWorkspaceId({
2672
+ const trn = `${trnPrefix(await loadWorkspaceId({
2676
2673
  workspaceId: options.workspaceId,
2677
2674
  profile: options.profile
2678
2675
  }))}:tailordb:${targetNamespace}`;
@@ -2762,7 +2759,7 @@ async function status(options) {
2762
2759
  useProfile: false,
2763
2760
  profile: options.profile
2764
2761
  }));
2765
- const workspaceId = loadWorkspaceId({
2762
+ const workspaceId = await loadWorkspaceId({
2766
2763
  workspaceId: options.workspaceId,
2767
2764
  profile: options.profile
2768
2765
  });
@@ -2854,7 +2851,7 @@ const currentCommand = defineAppCommand({
2854
2851
  description: "Show current user.",
2855
2852
  args: z.object({}).strict(),
2856
2853
  run: async () => {
2857
- const config = readPlatformConfig();
2854
+ const config = await readPlatformConfig();
2858
2855
  if (!config.current_user) throw new Error(ml`
2859
2856
  Current user not set.
2860
2857
  Please login first using 'tailor-sdk login' command to register a user.
@@ -2874,7 +2871,7 @@ const listCommand$1 = defineAppCommand({
2874
2871
  description: "List all users.",
2875
2872
  args: z.object({}).strict(),
2876
2873
  run: async (args) => {
2877
- const config = readPlatformConfig();
2874
+ const config = await readPlatformConfig();
2878
2875
  const users = Object.keys(config.users);
2879
2876
  if (users.length === 0) {
2880
2877
  logger.info(ml`
@@ -2966,7 +2963,7 @@ const createCommand = defineAppCommand({
2966
2963
  })
2967
2964
  }).strict(),
2968
2965
  run: async (args) => {
2969
- const config = readPlatformConfig();
2966
+ const config = await readPlatformConfig();
2970
2967
  if (!config.current_user) throw new Error(ml`
2971
2968
  No user logged in.
2972
2969
  Please login first using 'tailor-sdk login' command.
@@ -2992,7 +2989,7 @@ const deleteCommand = defineAppCommand({
2992
2989
  description: "Token name"
2993
2990
  }) }).strict(),
2994
2991
  run: async (args) => {
2995
- const config = readPlatformConfig();
2992
+ const config = await readPlatformConfig();
2996
2993
  if (!config.current_user) throw new Error(ml`
2997
2994
  No user logged in.
2998
2995
  Please login first using 'tailor-sdk login' command.
@@ -3009,7 +3006,7 @@ const listCommand = defineAppCommand({
3009
3006
  description: "List all personal access tokens.",
3010
3007
  args: z.object({}).strict(),
3011
3008
  run: async (args) => {
3012
- const config = readPlatformConfig();
3009
+ const config = await readPlatformConfig();
3013
3010
  if (!config.current_user) throw new Error(ml`
3014
3011
  No user logged in.
3015
3012
  Please login first using 'tailor-sdk login' command.
@@ -3060,7 +3057,7 @@ const updateCommand = defineAppCommand({
3060
3057
  })
3061
3058
  }).strict(),
3062
3059
  run: async (args) => {
3063
- const config = readPlatformConfig();
3060
+ const config = await readPlatformConfig();
3064
3061
  if (!config.current_user) throw new Error(ml`
3065
3062
  No user logged in.
3066
3063
  Please login first using 'tailor-sdk login' command.
@@ -3103,7 +3100,7 @@ const switchCommand = defineAppCommand({
3103
3100
  description: "User email"
3104
3101
  }) }).strict(),
3105
3102
  run: async (args) => {
3106
- const config = readPlatformConfig();
3103
+ const config = await readPlatformConfig();
3107
3104
  if (!config.users[args.user]) throw new Error(ml`
3108
3105
  User "${args.user}" not found.
3109
3106
  Please login first using 'tailor-sdk login' command to register this user.
@@ -3198,7 +3195,10 @@ const workspaceCommand = defineCommand({
3198
3195
 
3199
3196
  //#endregion
3200
3197
  //#region src/cli/index.ts
3201
- register("tsx", import.meta.url, { data: {} });
3198
+ if (!isNativeTypeScriptRuntime()) {
3199
+ const { register } = await import("node:module");
3200
+ register("tsx", import.meta.url, { data: {} });
3201
+ }
3202
3202
  initCrashReporting();
3203
3203
  const packageJson = await readPackageJson();
3204
3204
  const cliName = Object.keys(packageJson.bin ?? {})[0] || "tailor-sdk";
@@ -3246,7 +3246,7 @@ runMain(mainCommand, {
3246
3246
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3247
3247
  } else logger.error(`Unknown error: ${error}`);
3248
3248
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
3249
- const { reportCrash } = await import("../crash-report-CYrETw1c.mjs");
3249
+ const { reportCrash } = await import("../crash-report-BMEhRxeg.mjs");
3250
3250
  await reportCrash(error, "handledError");
3251
3251
  }
3252
3252
  }