@tailor-platform/sdk 1.3.0 → 1.4.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,38 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#452](https://github.com/tailor-platform/sdk/pull/452) [`2428441`](https://github.com/tailor-platform/sdk/commit/2428441fd9df34428520adc578c6016f448f776c) Thanks [@toiroakr](https://github.com/toiroakr)! - feat(seed): improve exec script with colors and embedded config
8
+
9
+ - Remove yaml package dependency by embedding entity config in exec.mjs
10
+ - Replace entityNamespaces with namespaceEntities (Map<namespace, entities[]>)
11
+ - Add --yes flag to skip confirmation prompts
12
+ - Use node:util styleText for colored output (cyan, green, red, yellow, dim)
13
+ - Remove config.yaml generation (no longer needed)
14
+ - Improve array formatting in namespaceEntities (one element per line)
15
+
16
+ ### Patch Changes
17
+
18
+ - [#453](https://github.com/tailor-platform/sdk/pull/453) [`9589142`](https://github.com/tailor-platform/sdk/commit/95891421eb3bcd645d6a15dbad2935fee9cd7a90) Thanks [@riku99](https://github.com/riku99)! - Updated jsdoc rules and jsdoc comments
19
+
20
+ - [#451](https://github.com/tailor-platform/sdk/pull/451) [`46b42c4`](https://github.com/tailor-platform/sdk/commit/46b42c4e157026b891490e9ebc080dc8bbf05513) Thanks [@k1LoW](https://github.com/k1LoW)! - Add `publishSessionEvents` option to auth configuration
21
+
22
+ - [#446](https://github.com/tailor-platform/sdk/pull/446) [`d57daaa`](https://github.com/tailor-platform/sdk/commit/d57daaaefa48744a0918a409f726564867759955) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency bufbuild/buf to v1.64.0
23
+
24
+ - [#447](https://github.com/tailor-platform/sdk/pull/447) [`58dc5e1`](https://github.com/tailor-platform/sdk/commit/58dc5e1ffefd3c483c4dcd244a45742c01c52918) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @jackchuka/gql-ingest to v3
25
+
26
+ - [#448](https://github.com/tailor-platform/sdk/pull/448) [`3e27e60`](https://github.com/tailor-platform/sdk/commit/3e27e60a639291b6efe0ceef9ff6321f01ada338) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency turbo to v2.7.5
27
+
28
+ - [#450](https://github.com/tailor-platform/sdk/pull/450) [`89e315c`](https://github.com/tailor-platform/sdk/commit/89e315c49c659790dc9448a90dcd89788ad7134e) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @typescript/native-preview to v7.0.0-dev.20260117.1
29
+
30
+ - [#454](https://github.com/tailor-platform/sdk/pull/454) [`e6bfac2`](https://github.com/tailor-platform/sdk/commit/e6bfac254900e301def16b8b7f9dbacea70e8fbf) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency aquaproj/aqua to v2.56.5
31
+
32
+ - [#455](https://github.com/tailor-platform/sdk/pull/455) [`386c5bf`](https://github.com/tailor-platform/sdk/commit/386c5bf728a1e9a95febb52468af6921718b22fe) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency aquaproj/aqua-registry to v4.459.0
33
+
34
+ - [#456](https://github.com/tailor-platform/sdk/pull/456) [`77ee396`](https://github.com/tailor-platform/sdk/commit/77ee396d645248dad1f201f7d219b036e66a6f93) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency eslint-plugin-jsdoc to v62.1.0
35
+
3
36
  ## 1.3.0
4
37
 
5
38
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "../chunk-CIV_ash9.mjs";
3
- import "../config-BmQRlW1j.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-BCl3ViG0.mjs";
3
+ import "../config-CBpYlVa-.mjs";
4
+ import { $ as deploymentArgs, A as listCommand$5, B as fetchLatestToken, C as removeCommand, E as getCommand$1, F as applyCommand, G as fetchAll, H as loadWorkspaceId, J as initOperatorClient, K as fetchUserInfo, L as loadConfig, N as generateCommand, Q as confirmationArgs, U as readPlatformConfig, V as loadAccessToken, W as writePlatformConfig, X as PATScope, Y as readPackageJson, Z as commonArgs, a as createCommand$3, d as listCommand$7, et as jsonArgs, h as executionsCommand, k as tokenCommand, l as startCommand, nt as workspaceArgs, p as getCommand$2, q as initOAuth2Client, r as deleteCommand$3, rt as logger, s as resumeCommand, t as listCommand$8, tt as withCommonArgs, w as listCommand$6, x as showCommand, y as truncateCommand, z as apiCommand } from "../list-1cs_CGF8.mjs";
5
5
  import { createRequire, register } from "node:module";
6
6
  import { defineCommand, runCommand, runMain } from "citty";
7
7
  import * as fs$1 from "node:fs";
@@ -518,8 +518,8 @@ function secretInfo(secret) {
518
518
  }
519
519
  /**
520
520
  * List secrets in a Secret Manager vault.
521
- * @param {SecretListOptions} options - Secret listing options
522
- * @returns {Promise<SecretInfo[]>} List of secrets
521
+ * @param options - Secret listing options
522
+ * @returns List of secrets
523
523
  */
524
524
  async function secretList(options) {
525
525
  const client = await initOperatorClient(await loadAccessToken({
@@ -695,8 +695,8 @@ function vaultInfo(vault) {
695
695
  }
696
696
  /**
697
697
  * List Secret Manager vaults in the workspace.
698
- * @param {VaultListOptions} [options] - Vault listing options
699
- * @returns {Promise<VaultInfo[]>} List of vaults
698
+ * @param options - Vault listing options
699
+ * @returns List of vaults
700
700
  */
701
701
  async function vaultList(options) {
702
702
  const client = await initOperatorClient(await loadAccessToken({
@@ -774,9 +774,9 @@ const secretCommand = defineCommand({
774
774
  //#region src/cli/utils/progress.ts
775
775
  /**
776
776
  * Create a simple progress reporter that writes updates to stderr.
777
- * @param {string} label - Label to prefix progress output
778
- * @param {number} total - Total number of steps
779
- * @returns {{ update: () => void; finish: () => void }} Progress helpers
777
+ * @param label - Label to prefix progress output
778
+ * @param total - Total number of steps
779
+ * @returns Progress helpers
780
780
  */
781
781
  function createProgress(label, total) {
782
782
  let current = 0;
@@ -796,10 +796,10 @@ function createProgress(label, total) {
796
796
  /**
797
797
  * Wrap a promise with a timeout, rejecting if the timeout elapses first.
798
798
  * @template T
799
- * @param {Promise<T>} p - Promise to await
800
- * @param {number} ms - Timeout in milliseconds
801
- * @param {string} message - Error message on timeout
802
- * @returns {Promise<T>} Result of the original promise if it completes in time
799
+ * @param p - Promise to await
800
+ * @param ms - Timeout in milliseconds
801
+ * @param message - Error message on timeout
802
+ * @returns Result of the original promise if it completes in time
803
803
  */
804
804
  async function withTimeout(p, ms, message) {
805
805
  return await Promise.race([p, setTimeout$1(ms).then(() => {
@@ -821,12 +821,12 @@ function shouldIgnoreFile(filePath) {
821
821
  }
822
822
  /**
823
823
  * Deploy a static website by creating a deployment, uploading files, and publishing it.
824
- * @param {OperatorClient} client - Operator client instance
825
- * @param {string} workspaceId - Workspace ID
826
- * @param {string} name - Static website name
827
- * @param {string} distDir - Directory containing static site files
828
- * @param {boolean} [showProgress=true] - Whether to show upload progress
829
- * @returns {Promise<DeployResult>} Deployment result with URL and skipped files
824
+ * @param client - Operator client instance
825
+ * @param workspaceId - Workspace ID
826
+ * @param name - Static website name
827
+ * @param distDir - Directory containing static site files
828
+ * @param showProgress - Whether to show upload progress
829
+ * @returns Deployment result with URL and skipped files
830
830
  */
831
831
  async function deployStaticWebsite(client, workspaceId, name, distDir, showProgress = true) {
832
832
  const { deploymentId } = await client.createDeployment({
@@ -864,9 +864,9 @@ async function uploadDirectory(client, workspaceId, deploymentId, rootDir, showP
864
864
  }
865
865
  /**
866
866
  * Recursively collect all deployable files under the given directory.
867
- * @param {string} rootDir - Root directory to scan
868
- * @param {string} [currentDir=""] - Current relative directory (for recursion)
869
- * @returns {Promise<string[]>} List of file paths relative to rootDir
867
+ * @param rootDir - Root directory to scan
868
+ * @param currentDir - Current relative directory (for recursion)
869
+ * @returns List of file paths relative to rootDir
870
870
  */
871
871
  async function collectFiles(rootDir, currentDir = "") {
872
872
  const dirPath = path.join(rootDir, currentDir);
@@ -920,8 +920,7 @@ async function uploadSingleFile(client, workspaceId, deploymentId, rootDir, file
920
920
  }
921
921
  /**
922
922
  * Log skipped files after a deployment, including reasons for skipping.
923
- * @param {string[]} skippedFiles - List of skipped file descriptions
924
- * @returns {void}
923
+ * @param skippedFiles - List of skipped file descriptions
925
924
  */
926
925
  function logSkippedFiles(skippedFiles) {
927
926
  if (skippedFiles.length === 0) return;
@@ -1029,10 +1028,8 @@ const getCommand = defineCommand({
1029
1028
  //#region src/cli/staticwebsite/list.ts
1030
1029
  /**
1031
1030
  * List static websites in the workspace.
1032
- * @param {{ workspaceId?: string; profile?: string }} [options] - Static website listing options
1033
- * @param {string} [options.workspaceId] - Workspace ID
1034
- * @param {string} [options.profile] - Workspace profile
1035
- * @returns {Promise<StaticWebsiteInfo[]>} List of static websites
1031
+ * @param options - Static website listing options
1032
+ * @returns List of static websites
1036
1033
  */
1037
1034
  async function listStaticWebsites(options) {
1038
1035
  const client = await initOperatorClient(await loadAccessToken({
@@ -1109,10 +1106,11 @@ const staticwebsiteCommand = defineCommand({
1109
1106
  //#region src/cli/utils/resolve-cli-bin.ts
1110
1107
  /**
1111
1108
  * Resolve a CLI binary path from the caller's project dependencies.
1112
- * @param {ResolveCliBinOptions} options - Resolution options for locating the CLI binary.
1113
- * @returns {string} Absolute path to the CLI binary entry.
1109
+ * @param options - Resolution options for locating the CLI binary.
1110
+ * @returns Absolute path to the CLI binary entry.
1114
1111
  */
1115
- function resolveCliBinPath({ cwd, packageName, binName, installHint }) {
1112
+ function resolveCliBinPath(options) {
1113
+ const { cwd, packageName, binName, installHint } = options;
1116
1114
  const projectPackageJsonPath = findUpSync("package.json", { cwd });
1117
1115
  if (!projectPackageJsonPath) throw new Error(`Failed to locate package.json from ${cwd}.`);
1118
1116
  const requireFromProject = createRequire(projectPackageJsonPath);
@@ -1131,9 +1129,9 @@ function resolveCliBinPath({ cwd, packageName, binName, installHint }) {
1131
1129
  //#region src/cli/tailordb/erd/schema.ts
1132
1130
  /**
1133
1131
  * Convert TailorDB field config to tbls column definition.
1134
- * @param {string} fieldName - Field name
1135
- * @param {TailorDBType_FieldConfig} fieldConfig - TailorDB field configuration
1136
- * @returns {TblsColumn} tbls column definition
1132
+ * @param fieldName - Field name
1133
+ * @param fieldConfig - TailorDB field configuration
1134
+ * @returns tbls column definition
1137
1135
  */
1138
1136
  function toTblsColumn(fieldName, fieldConfig) {
1139
1137
  const baseType = fieldConfig.type || "string";
@@ -1146,9 +1144,9 @@ function toTblsColumn(fieldName, fieldConfig) {
1146
1144
  }
1147
1145
  /**
1148
1146
  * Build tbls schema JSON from TailorDB types.
1149
- * @param {TailorDBProtoType[]} types - TailorDB types fetched from platform
1150
- * @param {string} namespace - TailorDB namespace
1151
- * @returns {TblsSchema} tbls-compatible schema representation
1147
+ * @param types - TailorDB types fetched from platform
1148
+ * @param namespace - TailorDB namespace
1149
+ * @returns tbls-compatible schema representation
1152
1150
  */
1153
1151
  function buildTblsSchema(types, namespace) {
1154
1152
  const tables = [];
@@ -1242,8 +1240,8 @@ function buildTblsSchema(types, namespace) {
1242
1240
  }
1243
1241
  /**
1244
1242
  * Export apply-applied TailorDB schema for a namespace as tbls-compatible JSON.
1245
- * @param {TailorDBSchemaOptions} options - Export options
1246
- * @returns {Promise<TblsSchema>} tbls schema representation
1243
+ * @param options - Export options
1244
+ * @returns tbls schema representation
1247
1245
  */
1248
1246
  async function exportTailorDBSchema(options) {
1249
1247
  const { client, workspaceId, namespace } = options;
@@ -1265,7 +1263,7 @@ async function exportTailorDBSchema(options) {
1265
1263
  }
1266
1264
  /**
1267
1265
  * Writes the TailorDB schema to a file in tbls-compatible JSON format.
1268
- * @param {WriteSchemaOptions} options - The options for writing the schema file.
1266
+ * @param options - The options for writing the schema file.
1269
1267
  */
1270
1268
  async function writeTblsSchemaToFile(options) {
1271
1269
  const schema = await exportTailorDBSchema(options);
@@ -1290,11 +1288,8 @@ function logErdBetaWarning() {
1290
1288
  //#region src/cli/tailordb/erd/utils.ts
1291
1289
  /**
1292
1290
  * Initialize shared ERD command context.
1293
- * @param {{ profile?: string; workspaceId?: string; config?: string }} args - CLI arguments.
1294
- * @param {string | undefined} args.profile - Workspace profile.
1295
- * @param {string | undefined} args.workspaceId - Workspace ID override.
1296
- * @param {string | undefined} args.config - Config path override.
1297
- * @returns {Promise<ErdCommandContext>} Initialized context.
1291
+ * @param args - CLI arguments.
1292
+ * @returns Initialized context.
1298
1293
  */
1299
1294
  async function initErdContext(args) {
1300
1295
  logErdBetaWarning();
@@ -1319,9 +1314,9 @@ async function initErdContext(args) {
1319
1314
  const DEFAULT_ERD_BASE_DIR = ".tailor-sdk/erd";
1320
1315
  /**
1321
1316
  * Resolve TailorDB config and namespace.
1322
- * @param {AppConfig} config - Loaded Tailor SDK config.
1323
- * @param {string | undefined} explicitNamespace - Namespace override.
1324
- * @returns {{ namespace: string; erdSite: string | undefined }} Resolved namespace and erdSite.
1317
+ * @param config - Loaded Tailor SDK config.
1318
+ * @param explicitNamespace - Namespace override.
1319
+ * @returns Resolved namespace and erdSite.
1325
1320
  */
1326
1321
  function resolveDbConfig(config, explicitNamespace) {
1327
1322
  const namespace = explicitNamespace ?? Object.keys(config.db ?? {})[0];
@@ -1335,8 +1330,8 @@ function resolveDbConfig(config, explicitNamespace) {
1335
1330
  }
1336
1331
  /**
1337
1332
  * Get all namespaces with erdSite configured.
1338
- * @param {AppConfig} config - Loaded Tailor SDK config.
1339
- * @returns {Array<{ namespace: string; erdSite: string }>} Namespaces with erdSite.
1333
+ * @param config - Loaded Tailor SDK config.
1334
+ * @returns Namespaces with erdSite.
1340
1335
  */
1341
1336
  function resolveAllErdSites(config) {
1342
1337
  const results = [];
@@ -1348,9 +1343,9 @@ function resolveAllErdSites(config) {
1348
1343
  }
1349
1344
  /**
1350
1345
  * Run the liam CLI to build an ERD static site from a schema file.
1351
- * @param {string} schemaPath - Path to the ERD schema JSON file
1352
- * @param {string} cwd - Working directory where liam will run (dist is created here)
1353
- * @returns {Promise<void>} Resolves when the build completes successfully
1346
+ * @param schemaPath - Path to the ERD schema JSON file
1347
+ * @param cwd - Working directory where liam will run (dist is created here)
1348
+ * @returns Resolves when the build completes successfully
1354
1349
  */
1355
1350
  async function runLiamBuild(schemaPath, cwd) {
1356
1351
  fs$1.mkdirSync(cwd, { recursive: true });
@@ -1395,7 +1390,7 @@ async function runLiamBuild(schemaPath, cwd) {
1395
1390
  }
1396
1391
  /**
1397
1392
  * Export TailorDB schema and build ERD artifacts via liam.
1398
- * @param {TailorDBSchemaOptions & { outputPath: string; erdDir: string }} options - Build options.
1393
+ * @param options - Build options.
1399
1394
  */
1400
1395
  async function prepareErdBuild(options) {
1401
1396
  await writeTblsSchemaToFile(options);
@@ -1403,13 +1398,8 @@ async function prepareErdBuild(options) {
1403
1398
  }
1404
1399
  /**
1405
1400
  * Prepare ERD builds for one or more namespaces.
1406
- * @param {{ client: OperatorClient; workspaceId: string; config: AppConfig; namespace?: string; outputDir?: string }} options - Build options.
1407
- * @param {OperatorClient} options.client - Operator client.
1408
- * @param {string} options.workspaceId - Workspace ID.
1409
- * @param {AppConfig} options.config - Loaded Tailor config.
1410
- * @param {string | undefined} options.namespace - Namespace override.
1411
- * @param {string | undefined} options.outputDir - Output directory override.
1412
- * @returns {Promise<ErdBuildResult[]>} Build results by namespace.
1401
+ * @param options - Build options.
1402
+ * @returns Build results by namespace.
1413
1403
  */
1414
1404
  async function prepareErdBuilds(options) {
1415
1405
  const { client, workspaceId, config } = options;
@@ -1622,177 +1612,6 @@ const erdCommand = defineCommand({
1622
1612
  }
1623
1613
  });
1624
1614
 
1625
- //#endregion
1626
- //#region src/cli/tailordb/truncate.ts
1627
- async function truncateSingleType(options, client) {
1628
- await client.truncateTailorDBType({
1629
- workspaceId: options.workspaceId,
1630
- namespaceName: options.namespaceName,
1631
- tailordbTypeName: options.typeName
1632
- });
1633
- logger.success(`Truncated type "${options.typeName}" in namespace "${options.namespaceName}"`);
1634
- }
1635
- async function truncateNamespace(workspaceId, namespaceName, client) {
1636
- await client.truncateTailorDBTypes({
1637
- workspaceId,
1638
- namespaceName
1639
- });
1640
- logger.success(`Truncated all types in namespace "${namespaceName}"`);
1641
- }
1642
- async function getAllNamespaces(configPath) {
1643
- const { config } = await loadConfig(configPath);
1644
- const namespaces = /* @__PURE__ */ new Set();
1645
- if (config.db) for (const [namespaceName] of Object.entries(config.db)) namespaces.add(namespaceName);
1646
- return Array.from(namespaces);
1647
- }
1648
- async function getTypeNamespace(workspaceId, typeName, client, configPath) {
1649
- const namespaces = await getAllNamespaces(configPath);
1650
- for (const namespace of namespaces) try {
1651
- const { tailordbTypes } = await client.listTailorDBTypes({
1652
- workspaceId,
1653
- namespaceName: namespace
1654
- });
1655
- if (tailordbTypes.some((type) => type.name === typeName)) return namespace;
1656
- } catch {
1657
- continue;
1658
- }
1659
- return null;
1660
- }
1661
- /**
1662
- * Truncate TailorDB data based on the given options.
1663
- * @param {TruncateOptions} [options] - Truncate options (all, namespace, or types)
1664
- * @returns {Promise<void>} Promise that resolves when truncation completes
1665
- */
1666
- async function truncate(options) {
1667
- const client = await initOperatorClient(await loadAccessToken({
1668
- useProfile: true,
1669
- profile: options?.profile
1670
- }));
1671
- const workspaceId = loadWorkspaceId({
1672
- workspaceId: options?.workspaceId,
1673
- profile: options?.profile
1674
- });
1675
- const hasTypes = options?.types && options.types.length > 0;
1676
- const hasNamespace = !!options?.namespace;
1677
- const hasAll = !!options?.all;
1678
- const optionCount = [
1679
- hasAll,
1680
- hasNamespace,
1681
- hasTypes
1682
- ].filter(Boolean).length;
1683
- if (optionCount === 0) throw new Error("Please specify one of: --all, --namespace <name>, or type names");
1684
- if (optionCount > 1) throw new Error("Options --all, --namespace, and type names are mutually exclusive. Please specify only one.");
1685
- const namespaces = await getAllNamespaces(options?.configPath);
1686
- if (hasAll) {
1687
- if (namespaces.length === 0) {
1688
- logger.warn("No namespaces found in config file.");
1689
- return;
1690
- }
1691
- if (!options?.yes) {
1692
- const namespaceList = namespaces.join(", ");
1693
- if (!await logger.prompt(`This will truncate ALL tables in the following namespaces: ${namespaceList}. Continue? (yes/no)`, {
1694
- type: "confirm",
1695
- initial: false
1696
- })) {
1697
- logger.info("Truncate cancelled.");
1698
- return;
1699
- }
1700
- }
1701
- for (const namespace of namespaces) await truncateNamespace(workspaceId, namespace, client);
1702
- logger.success("Truncated all tables in all namespaces");
1703
- return;
1704
- }
1705
- if (hasNamespace && options?.namespace) {
1706
- const namespace = options.namespace;
1707
- if (!namespaces.includes(namespace)) throw new Error(`Namespace "${namespace}" not found in config. Available namespaces: ${namespaces.join(", ")}`);
1708
- if (!options.yes) {
1709
- if (!await logger.prompt(`This will truncate ALL tables in namespace "${namespace}". Continue? (yes/no)`, {
1710
- type: "confirm",
1711
- initial: false
1712
- })) {
1713
- logger.info("Truncate cancelled.");
1714
- return;
1715
- }
1716
- }
1717
- await truncateNamespace(workspaceId, namespace, client);
1718
- return;
1719
- }
1720
- if (hasTypes && options?.types) {
1721
- const typeNames = options.types;
1722
- const typeNamespaceMap = /* @__PURE__ */ new Map();
1723
- const notFoundTypes = [];
1724
- for (const typeName of typeNames) {
1725
- const namespace = await getTypeNamespace(workspaceId, typeName, client, options.configPath);
1726
- if (namespace) typeNamespaceMap.set(typeName, namespace);
1727
- else notFoundTypes.push(typeName);
1728
- }
1729
- if (notFoundTypes.length > 0) throw new Error(`The following types were not found in any namespace: ${notFoundTypes.join(", ")}`);
1730
- if (!options.yes) {
1731
- const typeList = typeNames.join(", ");
1732
- if (!await logger.prompt(`This will truncate the following types: ${typeList}. Continue? (yes/no)`, {
1733
- type: "confirm",
1734
- initial: false
1735
- })) {
1736
- logger.info("Truncate cancelled.");
1737
- return;
1738
- }
1739
- }
1740
- for (const typeName of typeNames) {
1741
- const namespace = typeNamespaceMap.get(typeName);
1742
- if (!namespace) continue;
1743
- await truncateSingleType({
1744
- workspaceId,
1745
- namespaceName: namespace,
1746
- typeName
1747
- }, client);
1748
- }
1749
- }
1750
- }
1751
- const truncateCommand = defineCommand({
1752
- meta: {
1753
- name: "truncate",
1754
- description: "Truncate TailorDB tables"
1755
- },
1756
- args: {
1757
- ...commonArgs,
1758
- types: {
1759
- type: "positional",
1760
- description: "Type names to truncate",
1761
- required: false
1762
- },
1763
- all: {
1764
- type: "boolean",
1765
- description: "Truncate all tables in all namespaces",
1766
- default: false,
1767
- alias: "a"
1768
- },
1769
- namespace: {
1770
- type: "string",
1771
- description: "Truncate all tables in specified namespace",
1772
- alias: "n"
1773
- },
1774
- yes: {
1775
- type: "boolean",
1776
- description: "Skip confirmation prompt",
1777
- alias: "y",
1778
- default: false
1779
- },
1780
- ...deploymentArgs
1781
- },
1782
- run: withCommonArgs(async (args) => {
1783
- const types = args._.length > 0 ? args._.map((arg) => String(arg)).filter(Boolean) : void 0;
1784
- await truncate({
1785
- workspaceId: args["workspace-id"],
1786
- profile: args.profile,
1787
- configPath: args.config,
1788
- all: args.all,
1789
- namespace: args.namespace,
1790
- types,
1791
- yes: args.yes
1792
- });
1793
- })
1794
- });
1795
-
1796
1615
  //#endregion
1797
1616
  //#region src/cli/tailordb/index.ts
1798
1617
  const tailordbCommand = defineCommand({
@@ -1871,8 +1690,8 @@ function patScopeToString(scope) {
1871
1690
  }
1872
1691
  /**
1873
1692
  * Transform a PersonalAccessToken into CLI-friendly info.
1874
- * @param {PersonalAccessToken} pat - Personal access token resource
1875
- * @returns {PersonalAccessTokenInfo} Flattened token info
1693
+ * @param pat - Personal access token resource
1694
+ * @returns Flattened token info
1876
1695
  */
1877
1696
  function transformPersonalAccessToken(pat) {
1878
1697
  return {
@@ -1882,8 +1701,8 @@ function transformPersonalAccessToken(pat) {
1882
1701
  }
1883
1702
  /**
1884
1703
  * Get PAT scopes from a write flag.
1885
- * @param {boolean} write - Whether write access is required
1886
- * @returns {PATScope[]} Scopes to apply to the token
1704
+ * @param write - Whether write access is required
1705
+ * @returns Scopes to apply to the token
1887
1706
  */
1888
1707
  function getScopesFromWriteFlag(write) {
1889
1708
  return write ? [PATScope.PAT_SCOPE_READ, PATScope.PAT_SCOPE_WRITE] : [PATScope.PAT_SCOPE_READ];
@@ -1893,11 +1712,10 @@ function getScopeStringsFromWriteFlag(write) {
1893
1712
  }
1894
1713
  /**
1895
1714
  * Print the created or updated personal access token to the logger.
1896
- * @param {string} name - Token name
1897
- * @param {string} token - Token value
1898
- * @param {boolean} write - Whether the token has write scope
1899
- * @param {"created" | "updated"} action - Action performed
1900
- * @returns {void}
1715
+ * @param name - Token name
1716
+ * @param token - Token value
1717
+ * @param write - Whether the token has write scope
1718
+ * @param action - Action performed
1901
1719
  */
1902
1720
  function printCreatedToken(name, token, write, action) {
1903
1721
  const scopes = getScopeStringsFromWriteFlag(write);