@tailor-platform/sdk 1.29.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 (47) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +3 -1
  3. package/dist/{application-Dl1d7w-b.mjs → application-B2-PymMz.mjs} +2 -2
  4. package/dist/{application-Clwpv84E.mjs → application-CASjzt3W.mjs} +341 -107
  5. package/dist/application-CASjzt3W.mjs.map +1 -0
  6. package/dist/cli/index.mjs +127 -96
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +210 -45
  9. package/dist/cli/lib.mjs +29 -29
  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-BuMbIknz.d.mts → env-BgdHfWDn.d.mts} +2 -2
  20. package/dist/{index-D1AM_02Y.d.mts → index-CdDzh-T2.d.mts} +2 -2
  21. package/dist/{index-CyapgSFI.d.mts → index-CxgBnxKM.d.mts} +2 -2
  22. package/dist/{index-B0Lrzywd.d.mts → index-D4Y81vh1.d.mts} +2 -2
  23. package/dist/{index-CbnLNm14.d.mts → index-FZMBoUWm.d.mts} +2 -2
  24. package/dist/{index-cD9sQLTh.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-D3a0-qe0.d.mts → plugin-DyVYXZWz.d.mts} +8 -8
  31. package/dist/{query-B1-hq2Hm.mjs → runtime-Ofe7nHEG.mjs} +667 -143
  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-BsgIlrH-.d.mts → workflow.generated-DMQ-cjyT.d.mts} +2 -2
  37. package/docs/cli/function.md +1 -1
  38. package/docs/cli/organization.md +426 -0
  39. package/docs/cli-reference.md +20 -2
  40. package/docs/quickstart.md +12 -0
  41. package/docs/services/resolver.md +59 -0
  42. package/docs/services/tailordb.md +78 -6
  43. package/package.json +15 -12
  44. package/dist/application-Clwpv84E.mjs.map +0 -1
  45. package/dist/client-CW4Oh3iz.mjs +0 -6
  46. package/dist/query-B1-hq2Hm.mjs.map +0 -1
  47. 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 { $t as workspaceArgs, C as listCommand$10, E as resumeCommand, F as showCommand, Ft as isValidMigrationNumber, G as listCommand$7, Ht as prompt, I as logBetaWarning, It as loadDiff, Jt as defineAppCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$9, Q as listCommand$6, Qt as isVerbose, R as removeCommand$1, T as healthCommand, Ut as sdkNameLabelKey, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, Wt as trnPrefix, X as triggerCommand, Xt as confirmationArgs, Y as webhookCommand, Yt as commonArgs, Zt as deploymentArgs, b as createCommand$3, c as listCommand$11, ct as executionsCommand, dt as functionExecutionStatusToString, f as restoreCommand, ft as formatKeyValueTable, g as getCommand$4, gt as executeScript, ht as apply, i as updateCommand$2, it as startCommand, j as truncateCommand, kt as formatMigrationNumber, m as listCommand$12, n as queryCommand, o as removeCommand, ot as getCommand$3, pt as getCommand$1, q as generate, qt as apiCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$8 } from "../query-B1-hq2Hm.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-Clwpv84E.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
  });
@@ -324,7 +324,6 @@ async function bundleForTestRun(options) {
324
324
  const baseName = `test-run--${detected.name}`;
325
325
  const scriptName = `${baseName}.js`;
326
326
  const entryPath = path.join(outputDir, `${baseName}.entry.js`);
327
- const outputPath = path.join(outputDir, scriptName);
328
327
  const entryContent = generateEntry(detected, sourceFile, env, machineUser, workspaceId);
329
328
  fs$1.writeFileSync(entryPath, entryContent);
330
329
  let tsconfig;
@@ -333,25 +332,24 @@ async function bundleForTestRun(options) {
333
332
  } catch {
334
333
  tsconfig = void 0;
335
334
  }
336
- await rolldown.build(rolldown.defineConfig({
337
- input: entryPath,
338
- output: {
339
- file: outputPath,
340
- format: "esm",
341
- sourcemap: inlineSourcemap ? "inline" : true,
342
- minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
343
- codeSplitting: false
344
- },
345
- tsconfig,
346
- treeshake: {
347
- moduleSideEffects: false,
348
- annotations: true,
349
- unknownGlobalSideEffects: false
350
- },
351
- logLevel: "silent"
352
- }));
353
335
  return {
354
- bundledCode: fs$1.readFileSync(outputPath, "utf-8"),
336
+ bundledCode: (await rolldown.build({
337
+ input: entryPath,
338
+ write: false,
339
+ output: {
340
+ format: "esm",
341
+ sourcemap: inlineSourcemap ? "inline" : true,
342
+ minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
343
+ codeSplitting: false
344
+ },
345
+ tsconfig,
346
+ treeshake: {
347
+ moduleSideEffects: false,
348
+ annotations: true,
349
+ unknownGlobalSideEffects: false
350
+ },
351
+ logLevel: "silent"
352
+ })).output[0].code,
355
353
  scriptName
356
354
  };
357
355
  }
@@ -617,7 +615,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
617
615
  desc: "Run a specific workflow job by name"
618
616
  },
619
617
  {
620
- cmd: ".tailor-sdk/resolvers/add.js --arg '{\"input\":{\"a\":1,\"b\":2}}'",
618
+ cmd: "build/resolvers/add.js --arg '{\"input\":{\"a\":1,\"b\":2}}'",
621
619
  desc: "Run a pre-bundled .js file directly"
622
620
  }
623
621
  ],
@@ -631,7 +629,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
631
629
  useProfile: true,
632
630
  profile: args.profile
633
631
  }));
634
- const workspaceId = loadWorkspaceId({
632
+ const workspaceId = await loadWorkspaceId({
635
633
  workspaceId: args["workspace-id"],
636
634
  profile: args.profile
637
635
  });
@@ -823,7 +821,8 @@ const detectPackageManager = () => {
823
821
  const availablePMs = [
824
822
  "npm",
825
823
  "yarn",
826
- "pnpm"
824
+ "pnpm",
825
+ "bun"
827
826
  ];
828
827
  const userAgent = process.env.npm_config_user_agent;
829
828
  if (!userAgent) return;
@@ -885,15 +884,11 @@ const startAuthServer = async () => {
885
884
  codeVerifier
886
885
  });
887
886
  const userInfo = await fetchUserInfo(tokens.accessToken);
888
- const pfConfig = readPlatformConfig();
889
- pfConfig.users = {
890
- ...pfConfig.users,
891
- [userInfo.email]: {
892
- access_token: tokens.accessToken,
893
- refresh_token: tokens.refreshToken,
894
- token_expires_at: new Date(tokens.expiresAt).toISOString()
895
- }
896
- };
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());
897
892
  pfConfig.current_user = userInfo.email;
898
893
  writePlatformConfig(pfConfig);
899
894
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -938,14 +933,8 @@ const startAuthServer = async () => {
938
933
  async function loginAsMachineUser(args) {
939
934
  const clientSecret = args.clientSecret ?? await prompt.password({ message: "Client secret" });
940
935
  const tokens = await fetchPlatformMachineUserToken(args.clientId, clientSecret);
941
- const pfConfig = readPlatformConfig();
942
- pfConfig.users = {
943
- ...pfConfig.users,
944
- [args.clientId]: {
945
- access_token: tokens.accessToken,
946
- token_expires_at: new Date(tokens.expiresAt).toISOString()
947
- }
948
- };
936
+ const pfConfig = await readPlatformConfig();
937
+ await saveUserTokens(pfConfig, args.clientId, { accessToken: tokens.accessToken }, new Date(tokens.expiresAt).toISOString());
949
938
  pfConfig.current_user = args.clientId;
950
939
  writePlatformConfig(pfConfig);
951
940
  }
@@ -985,19 +974,25 @@ const logoutCommand = defineAppCommand({
985
974
  description: "Logout from Tailor Platform.",
986
975
  args: z.object({}).strict(),
987
976
  run: async () => {
988
- const pfConfig = readPlatformConfig();
989
- const tokens = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
990
- if (!tokens) {
977
+ const pfConfig = await readPlatformConfig();
978
+ const userEntry = pfConfig.current_user ? pfConfig.users[pfConfig.current_user] : void 0;
979
+ if (!userEntry) {
991
980
  logger.info("You are not logged in.");
992
981
  return;
993
982
  }
994
- const client = initOAuth2Client();
995
- const tokenTypeHint = tokens.refresh_token ? "refresh_token" : "access_token";
996
- client.revoke({
997
- accessToken: tokens.access_token,
998
- refreshToken: tokens.refresh_token ?? null,
999
- expiresAt: Date.parse(tokens.token_expires_at)
1000
- }, 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);
1001
996
  delete pfConfig.users[pfConfig.current_user];
1002
997
  pfConfig.current_user = null;
1003
998
  writePlatformConfig(pfConfig);
@@ -1041,7 +1036,7 @@ const openCommand = defineAppCommand({
1041
1036
  description: "Open Tailor Platform Console.",
1042
1037
  args: z.object({ ...deploymentArgs }).strict(),
1043
1038
  run: async (args) => {
1044
- const workspaceId = loadWorkspaceId({
1039
+ const workspaceId = await loadWorkspaceId({
1045
1040
  workspaceId: args["workspace-id"],
1046
1041
  profile: args.profile
1047
1042
  });
@@ -1061,6 +1056,37 @@ const openCommand = defineAppCommand({
1061
1056
  }
1062
1057
  });
1063
1058
 
1059
+ //#endregion
1060
+ //#region src/cli/commands/organization/folder/index.ts
1061
+ const folderCommand = defineCommand({
1062
+ name: "folder",
1063
+ description: "Manage organization folders.",
1064
+ subCommands: {
1065
+ create: createCommand$3,
1066
+ delete: deleteCommand$3,
1067
+ get: getCommand$3,
1068
+ list: listCommand$9,
1069
+ update: updateCommand$2
1070
+ }
1071
+ });
1072
+
1073
+ //#endregion
1074
+ //#region src/cli/commands/organization/index.ts
1075
+ const organizationCommand = defineCommand({
1076
+ name: "organization",
1077
+ description: "Manage Tailor Platform organizations.",
1078
+ subCommands: {
1079
+ folder: folderCommand,
1080
+ get: getCommand$4,
1081
+ list: listCommand$10,
1082
+ tree: treeCommand,
1083
+ update: updateCommand$3
1084
+ },
1085
+ async run() {
1086
+ await runCommand(listCommand$10, []);
1087
+ }
1088
+ });
1089
+
1064
1090
  //#endregion
1065
1091
  //#region src/cli/commands/profile/create.ts
1066
1092
  const createCommand$2 = defineAppCommand({
@@ -1081,7 +1107,7 @@ const createCommand$2 = defineAppCommand({
1081
1107
  })
1082
1108
  }).strict(),
1083
1109
  run: async (args) => {
1084
- const config = readPlatformConfig();
1110
+ const config = await readPlatformConfig();
1085
1111
  if (config.profiles[args.name]) throw new Error(`Profile "${args.name}" already exists.`);
1086
1112
  const client = await initOperatorClient(await fetchLatestToken(config, args.user));
1087
1113
  if (!(await fetchAll(async (pageToken, maxPageSize) => {
@@ -1116,7 +1142,7 @@ const deleteCommand$2 = defineAppCommand({
1116
1142
  description: "Profile name"
1117
1143
  }) }).strict(),
1118
1144
  run: async (args) => {
1119
- const config = readPlatformConfig();
1145
+ const config = await readPlatformConfig();
1120
1146
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1121
1147
  delete config.profiles[args.name];
1122
1148
  writePlatformConfig(config);
@@ -1131,7 +1157,7 @@ const listCommand$4 = defineAppCommand({
1131
1157
  description: "List all profiles.",
1132
1158
  args: z.object({}).strict(),
1133
1159
  run: async () => {
1134
- const config = readPlatformConfig();
1160
+ const config = await readPlatformConfig();
1135
1161
  const profiles = Object.entries(config.profiles);
1136
1162
  if (profiles.length === 0) {
1137
1163
  logger.info(ml`
@@ -1169,7 +1195,7 @@ const updateCommand$1 = defineAppCommand({
1169
1195
  })
1170
1196
  }).strict(),
1171
1197
  run: async (args) => {
1172
- const config = readPlatformConfig();
1198
+ const config = await readPlatformConfig();
1173
1199
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1174
1200
  if (!args.user && !args["workspace-id"]) throw new Error("Please provide at least one property to update.");
1175
1201
  const profile = config.profiles[args.name];
@@ -1310,7 +1336,7 @@ const createSecretCommand = defineAppCommand({
1310
1336
  useProfile: true,
1311
1337
  profile: args.profile
1312
1338
  }));
1313
- const workspaceId = loadWorkspaceId({
1339
+ const workspaceId = await loadWorkspaceId({
1314
1340
  workspaceId: args["workspace-id"],
1315
1341
  profile: args.profile
1316
1342
  });
@@ -1362,7 +1388,7 @@ const deleteSecretCommand = defineAppCommand({
1362
1388
  useProfile: true,
1363
1389
  profile: args.profile
1364
1390
  }));
1365
- const workspaceId = loadWorkspaceId({
1391
+ const workspaceId = await loadWorkspaceId({
1366
1392
  workspaceId: args["workspace-id"],
1367
1393
  profile: args.profile
1368
1394
  });
@@ -1414,7 +1440,7 @@ async function secretList(options) {
1414
1440
  useProfile: true,
1415
1441
  profile: options.profile
1416
1442
  }));
1417
- const workspaceId = loadWorkspaceId({
1443
+ const workspaceId = await loadWorkspaceId({
1418
1444
  workspaceId: options.workspaceId,
1419
1445
  profile: options.profile
1420
1446
  });
@@ -1465,7 +1491,7 @@ const updateSecretCommand = defineAppCommand({
1465
1491
  useProfile: true,
1466
1492
  profile: args.profile
1467
1493
  }));
1468
- const workspaceId = loadWorkspaceId({
1494
+ const workspaceId = await loadWorkspaceId({
1469
1495
  workspaceId: args["workspace-id"],
1470
1496
  profile: args.profile
1471
1497
  });
@@ -1520,7 +1546,7 @@ const createCommand$1 = defineAppCommand({
1520
1546
  useProfile: true,
1521
1547
  profile: args.profile
1522
1548
  }));
1523
- const workspaceId = loadWorkspaceId({
1549
+ const workspaceId = await loadWorkspaceId({
1524
1550
  workspaceId: args["workspace-id"],
1525
1551
  profile: args.profile
1526
1552
  });
@@ -1552,7 +1578,7 @@ const deleteCommand$1 = defineAppCommand({
1552
1578
  useProfile: true,
1553
1579
  profile: args.profile
1554
1580
  }));
1555
- const workspaceId = loadWorkspaceId({
1581
+ const workspaceId = await loadWorkspaceId({
1556
1582
  workspaceId: args["workspace-id"],
1557
1583
  profile: args.profile
1558
1584
  });
@@ -1600,7 +1626,7 @@ async function vaultList(options) {
1600
1626
  useProfile: true,
1601
1627
  profile: options?.profile
1602
1628
  }));
1603
- const workspaceId = loadWorkspaceId({
1629
+ const workspaceId = await loadWorkspaceId({
1604
1630
  workspaceId: options?.workspaceId,
1605
1631
  profile: options?.profile
1606
1632
  });
@@ -1986,7 +2012,7 @@ const deployCommand = defineAppCommand({
1986
2012
  }));
1987
2013
  const name = args.name;
1988
2014
  const dir = path.resolve(process.cwd(), args.dir);
1989
- const workspaceId = loadWorkspaceId({
2015
+ const workspaceId = await loadWorkspaceId({
1990
2016
  workspaceId: args["workspace-id"],
1991
2017
  profile: args.profile
1992
2018
  });
@@ -2022,7 +2048,7 @@ const getCommand = defineAppCommand({
2022
2048
  useProfile: true,
2023
2049
  profile: args.profile
2024
2050
  }));
2025
- const workspaceId = loadWorkspaceId({
2051
+ const workspaceId = await loadWorkspaceId({
2026
2052
  workspaceId: args["workspace-id"],
2027
2053
  profile: args.profile
2028
2054
  });
@@ -2060,7 +2086,7 @@ async function listStaticWebsites(options) {
2060
2086
  useProfile: true,
2061
2087
  profile: options?.profile
2062
2088
  }));
2063
- const workspaceId = loadWorkspaceId({
2089
+ const workspaceId = await loadWorkspaceId({
2064
2090
  workspaceId: options?.workspaceId,
2065
2091
  profile: options?.profile
2066
2092
  });
@@ -2303,7 +2329,7 @@ async function initErdContext(args) {
2303
2329
  useProfile: true,
2304
2330
  profile: args.profile
2305
2331
  }));
2306
- const workspaceId = loadWorkspaceId({
2332
+ const workspaceId = await loadWorkspaceId({
2307
2333
  workspaceId: args.workspaceId,
2308
2334
  profile: args.profile
2309
2335
  });
@@ -2643,7 +2669,7 @@ async function set(options) {
2643
2669
  useProfile: false,
2644
2670
  profile: options.profile
2645
2671
  }));
2646
- const trn = `${trnPrefix(loadWorkspaceId({
2672
+ const trn = `${trnPrefix(await loadWorkspaceId({
2647
2673
  workspaceId: options.workspaceId,
2648
2674
  profile: options.profile
2649
2675
  }))}:tailordb:${targetNamespace}`;
@@ -2733,7 +2759,7 @@ async function status(options) {
2733
2759
  useProfile: false,
2734
2760
  profile: options.profile
2735
2761
  }));
2736
- const workspaceId = loadWorkspaceId({
2762
+ const workspaceId = await loadWorkspaceId({
2737
2763
  workspaceId: options.workspaceId,
2738
2764
  profile: options.profile
2739
2765
  });
@@ -2825,7 +2851,7 @@ const currentCommand = defineAppCommand({
2825
2851
  description: "Show current user.",
2826
2852
  args: z.object({}).strict(),
2827
2853
  run: async () => {
2828
- const config = readPlatformConfig();
2854
+ const config = await readPlatformConfig();
2829
2855
  if (!config.current_user) throw new Error(ml`
2830
2856
  Current user not set.
2831
2857
  Please login first using 'tailor-sdk login' command to register a user.
@@ -2845,7 +2871,7 @@ const listCommand$1 = defineAppCommand({
2845
2871
  description: "List all users.",
2846
2872
  args: z.object({}).strict(),
2847
2873
  run: async (args) => {
2848
- const config = readPlatformConfig();
2874
+ const config = await readPlatformConfig();
2849
2875
  const users = Object.keys(config.users);
2850
2876
  if (users.length === 0) {
2851
2877
  logger.info(ml`
@@ -2937,7 +2963,7 @@ const createCommand = defineAppCommand({
2937
2963
  })
2938
2964
  }).strict(),
2939
2965
  run: async (args) => {
2940
- const config = readPlatformConfig();
2966
+ const config = await readPlatformConfig();
2941
2967
  if (!config.current_user) throw new Error(ml`
2942
2968
  No user logged in.
2943
2969
  Please login first using 'tailor-sdk login' command.
@@ -2963,7 +2989,7 @@ const deleteCommand = defineAppCommand({
2963
2989
  description: "Token name"
2964
2990
  }) }).strict(),
2965
2991
  run: async (args) => {
2966
- const config = readPlatformConfig();
2992
+ const config = await readPlatformConfig();
2967
2993
  if (!config.current_user) throw new Error(ml`
2968
2994
  No user logged in.
2969
2995
  Please login first using 'tailor-sdk login' command.
@@ -2980,7 +3006,7 @@ const listCommand = defineAppCommand({
2980
3006
  description: "List all personal access tokens.",
2981
3007
  args: z.object({}).strict(),
2982
3008
  run: async (args) => {
2983
- const config = readPlatformConfig();
3009
+ const config = await readPlatformConfig();
2984
3010
  if (!config.current_user) throw new Error(ml`
2985
3011
  No user logged in.
2986
3012
  Please login first using 'tailor-sdk login' command.
@@ -3031,7 +3057,7 @@ const updateCommand = defineAppCommand({
3031
3057
  })
3032
3058
  }).strict(),
3033
3059
  run: async (args) => {
3034
- const config = readPlatformConfig();
3060
+ const config = await readPlatformConfig();
3035
3061
  if (!config.current_user) throw new Error(ml`
3036
3062
  No user logged in.
3037
3063
  Please login first using 'tailor-sdk login' command.
@@ -3074,7 +3100,7 @@ const switchCommand = defineAppCommand({
3074
3100
  description: "User email"
3075
3101
  }) }).strict(),
3076
3102
  run: async (args) => {
3077
- const config = readPlatformConfig();
3103
+ const config = await readPlatformConfig();
3078
3104
  if (!config.users[args.user]) throw new Error(ml`
3079
3105
  User "${args.user}" not found.
3080
3106
  Please login first using 'tailor-sdk login' command to register this user.
@@ -3107,14 +3133,14 @@ const workflowCommand = defineCommand({
3107
3133
  name: "workflow",
3108
3134
  description: "Manage workflows and workflow executions.",
3109
3135
  subCommands: {
3110
- list: listCommand$9,
3111
- get: getCommand$3,
3136
+ list: listCommand$11,
3137
+ get: getCommand$5,
3112
3138
  start: startCommand,
3113
3139
  executions: executionsCommand,
3114
3140
  resume: resumeCommand
3115
3141
  },
3116
3142
  async run() {
3117
- await runCommand(listCommand$9, []);
3143
+ await runCommand(listCommand$11, []);
3118
3144
  }
3119
3145
  });
3120
3146
 
@@ -3125,10 +3151,10 @@ const appCommand = defineCommand({
3125
3151
  description: "Manage workspace applications",
3126
3152
  subCommands: {
3127
3153
  health: healthCommand,
3128
- list: listCommand$10
3154
+ list: listCommand$12
3129
3155
  },
3130
3156
  async run() {
3131
- await runCommand(listCommand$10, []);
3157
+ await runCommand(listCommand$12, []);
3132
3158
  }
3133
3159
  });
3134
3160
 
@@ -3139,12 +3165,12 @@ const userCommand = defineCommand({
3139
3165
  description: "Manage workspace users",
3140
3166
  subCommands: {
3141
3167
  invite: inviteCommand,
3142
- list: listCommand$11,
3168
+ list: listCommand$13,
3143
3169
  remove: removeCommand,
3144
- update: updateCommand$2
3170
+ update: updateCommand$4
3145
3171
  },
3146
3172
  async run() {
3147
- await runCommand(listCommand$11, []);
3173
+ await runCommand(listCommand$13, []);
3148
3174
  }
3149
3175
  });
3150
3176
 
@@ -3155,21 +3181,24 @@ const workspaceCommand = defineCommand({
3155
3181
  description: "Manage Tailor Platform workspaces.",
3156
3182
  subCommands: {
3157
3183
  app: appCommand,
3158
- create: createCommand$3,
3159
- delete: deleteCommand$3,
3160
- get: getCommand$4,
3161
- list: listCommand$12,
3184
+ create: createCommand$4,
3185
+ delete: deleteCommand$4,
3186
+ get: getCommand$6,
3187
+ list: listCommand$14,
3162
3188
  restore: restoreCommand,
3163
3189
  user: userCommand
3164
3190
  },
3165
3191
  async run() {
3166
- await runCommand(listCommand$12, []);
3192
+ await runCommand(listCommand$14, []);
3167
3193
  }
3168
3194
  });
3169
3195
 
3170
3196
  //#endregion
3171
3197
  //#region src/cli/index.ts
3172
- register("tsx", import.meta.url, { data: {} });
3198
+ if (!isNativeTypeScriptRuntime()) {
3199
+ const { register } = await import("node:module");
3200
+ register("tsx", import.meta.url, { data: {} });
3201
+ }
3173
3202
  initCrashReporting();
3174
3203
  const packageJson = await readPackageJson();
3175
3204
  const cliName = Object.keys(packageJson.bin ?? {})[0] || "tailor-sdk";
@@ -3189,6 +3218,7 @@ const mainCommand = withCompletionCommand(defineCommand({
3189
3218
  machineuser: machineuserCommand,
3190
3219
  oauth2client: oauth2clientCommand,
3191
3220
  open: openCommand,
3221
+ organization: organizationCommand,
3192
3222
  profile: profileCommand,
3193
3223
  query: queryCommand,
3194
3224
  remove: removeCommand$1,
@@ -3205,6 +3235,7 @@ const mainCommand = withCompletionCommand(defineCommand({
3205
3235
  runMain(mainCommand, {
3206
3236
  version: packageJson.version,
3207
3237
  globalArgs: z.object(commonArgs),
3238
+ displayErrors: false,
3208
3239
  cleanup: async ({ error }) => {
3209
3240
  if (error) {
3210
3241
  if (isCLIError(error)) {
@@ -3215,7 +3246,7 @@ runMain(mainCommand, {
3215
3246
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3216
3247
  } else logger.error(`Unknown error: ${error}`);
3217
3248
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
3218
- const { reportCrash } = await import("../crash-report-CYrETw1c.mjs");
3249
+ const { reportCrash } = await import("../crash-report-BMEhRxeg.mjs");
3219
3250
  await reportCrash(error, "handledError");
3220
3251
  }
3221
3252
  }