@tailor-platform/sdk 1.2.1 → 1.2.3

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,29 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#378](https://github.com/tailor-platform/sdk/pull/378) [`20471c1`](https://github.com/tailor-platform/sdk/commit/20471c180df682a2b9ba6382039611b689ccb8e3) Thanks [@riku99](https://github.com/riku99)! - Enable the jsdoc/require-jsdoc rule
8
+
9
+ - [#362](https://github.com/tailor-platform/sdk/pull/362) [`e500267`](https://github.com/tailor-platform/sdk/commit/e5002677aded90ec8a4ab7113eb074dc537d456a) Thanks [@toiroakr](https://github.com/toiroakr)! - refactor: move relation logic from configure layer to parser layer
10
+
11
+ ## 1.2.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#369](https://github.com/tailor-platform/sdk/pull/369) [`202e5a7`](https://github.com/tailor-platform/sdk/commit/202e5a7f5c170de18d98255ca798d19552d2905d) Thanks [@toiroakr](https://github.com/toiroakr)! - Prevent index/unique settings on array fields with type-level constraints and runtime validation
16
+
17
+ - [#371](https://github.com/tailor-platform/sdk/pull/371) [`1c5f2a8`](https://github.com/tailor-platform/sdk/commit/1c5f2a897ef0b346a8de9cb71c7359e09724ac00) Thanks [@riku99](https://github.com/riku99)! - Enable selected JSDoc-related lint rules
18
+
19
+ - [#370](https://github.com/tailor-platform/sdk/pull/370) [`78d4667`](https://github.com/tailor-platform/sdk/commit/78d4667b7f8fc649dd1d1fe8e0aa70bf8c456be9) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency bufbuild/buf to v1.63.0
20
+
21
+ - [#374](https://github.com/tailor-platform/sdk/pull/374) [`8c4bff8`](https://github.com/tailor-platform/sdk/commit/8c4bff8db7dedba16ab6572473d7b93cf9ac2211) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): pin dependency oxlint-tsgolint to 0.10.1
22
+
23
+ - [#375](https://github.com/tailor-platform/sdk/pull/375) [`f42a755`](https://github.com/tailor-platform/sdk/commit/f42a7556785bf97f6aedb3dc03d398f0d38c492d) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @typescript/native-preview to v7.0.0-dev.20260103.1
24
+
25
+ - [#367](https://github.com/tailor-platform/sdk/pull/367) [`2edef96`](https://github.com/tailor-platform/sdk/commit/2edef96db3b1a6ed88e5fb1f64dab4e2d0dd7867) Thanks [@riku99](https://github.com/riku99)! - Use tsgo and tsgolint in packages/sdk and example
26
+
3
27
  ## 1.2.1
4
28
 
5
29
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "../chunk-CIV_ash9.mjs";
3
- import "../config-Bc_PBkyF.mjs";
4
- import { $ as withCommonArgs, B as loadWorkspaceId, D as tokenCommand, F as loadConfig, G as initOAuth2Client, H as writePlatformConfig, J as PATScope, K as initOperatorClient, L as apiCommand, N as applyCommand, O as listCommand$5, Q as jsonArgs, R as fetchLatestToken, S as listCommand$6, U as fetchAll, V as readPlatformConfig, W as fetchUserInfo, X as confirmationArgs, Y as commonArgs, Z as deploymentArgs, a as createCommand$3, d as listCommand$7, et as workspaceArgs, h as executionsCommand, j as generateCommand, l as startCommand, p as getCommand$2, q as readPackageJson, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as logger, w as getCommand$1, x as removeCommand, y as showCommand, z as loadAccessToken } from "../list-9sLkfPfn.mjs";
3
+ import "../config-CJPKA-ui.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-nW4EfF7C.mjs";
5
5
  import { register } from "node:module";
6
6
  import { defineCommand, runCommand, runMain } from "citty";
7
7
  import { generateCodeVerifier } from "@badgateway/oauth2-client";
@@ -514,6 +514,11 @@ function secretInfo(secret) {
514
514
  updatedAt: secret.updateTime ? timestampDate(secret.updateTime).toISOString() : "N/A"
515
515
  };
516
516
  }
517
+ /**
518
+ * List secrets in a Secret Manager vault.
519
+ * @param {SecretListOptions} options - Secret listing options
520
+ * @returns {Promise<SecretInfo[]>} List of secrets
521
+ */
517
522
  async function secretList(options) {
518
523
  const client = await initOperatorClient(await loadAccessToken({
519
524
  useProfile: true,
@@ -686,6 +691,11 @@ function vaultInfo(vault) {
686
691
  updatedAt: vault.updateTime ? timestampDate(vault.updateTime).toISOString() : "N/A"
687
692
  };
688
693
  }
694
+ /**
695
+ * List Secret Manager vaults in the workspace.
696
+ * @param {VaultListOptions} [options] - Vault listing options
697
+ * @returns {Promise<VaultInfo[]>} List of vaults
698
+ */
689
699
  async function vaultList(options) {
690
700
  const client = await initOperatorClient(await loadAccessToken({
691
701
  useProfile: true,
@@ -760,6 +770,12 @@ const secretCommand = defineCommand({
760
770
 
761
771
  //#endregion
762
772
  //#region src/cli/utils/progress.ts
773
+ /**
774
+ * Create a simple progress reporter that writes updates to stderr.
775
+ * @param {string} label - Label to prefix progress output
776
+ * @param {number} total - Total number of steps
777
+ * @returns {{ update: () => void; finish: () => void }} Progress helpers
778
+ */
763
779
  function createProgress(label, total) {
764
780
  let current = 0;
765
781
  const update = () => {
@@ -775,6 +791,14 @@ function createProgress(label, total) {
775
791
  finish
776
792
  };
777
793
  }
794
+ /**
795
+ * Wrap a promise with a timeout, rejecting if the timeout elapses first.
796
+ * @template T
797
+ * @param {Promise<T>} p - Promise to await
798
+ * @param {number} ms - Timeout in milliseconds
799
+ * @param {string} message - Error message on timeout
800
+ * @returns {Promise<T>} Result of the original promise if it completes in time
801
+ */
778
802
  async function withTimeout(p, ms, message) {
779
803
  return await Promise.race([p, setTimeout$1(ms).then(() => {
780
804
  throw new Error(message);
@@ -982,6 +1006,11 @@ const getCommand = defineCommand({
982
1006
 
983
1007
  //#endregion
984
1008
  //#region src/cli/staticwebsite/list.ts
1009
+ /**
1010
+ * List static websites in the workspace.
1011
+ * @param {{ workspaceId?: string; profile?: string }} [options] - Static website listing options
1012
+ * @returns {Promise<StaticWebsiteInfo[]>} List of static websites
1013
+ */
985
1014
  async function listStaticWebsites(options) {
986
1015
  const client = await initOperatorClient(await loadAccessToken({
987
1016
  useProfile: true,
@@ -1089,6 +1118,11 @@ async function getTypeNamespace(workspaceId, typeName, client, configPath) {
1089
1118
  }
1090
1119
  return null;
1091
1120
  }
1121
+ /**
1122
+ * Truncate TailorDB data based on the given options.
1123
+ * @param {TruncateOptions} [options] - Truncate options (all, namespace, or types)
1124
+ * @returns {Promise<void>} Promise that resolves when truncation completes
1125
+ */
1092
1126
  async function truncate(options) {
1093
1127
  const client = await initOperatorClient(await loadAccessToken({
1094
1128
  useProfile: true,
@@ -1292,18 +1326,36 @@ function patScopeToString(scope) {
1292
1326
  default: return "unknown";
1293
1327
  }
1294
1328
  }
1329
+ /**
1330
+ * Transform a PersonalAccessToken into CLI-friendly info.
1331
+ * @param {PersonalAccessToken} pat - Personal access token resource
1332
+ * @returns {PersonalAccessTokenInfo} Flattened token info
1333
+ */
1295
1334
  function transformPersonalAccessToken(pat) {
1296
1335
  return {
1297
1336
  name: pat.name,
1298
1337
  scopes: pat.scopes.map(patScopeToString)
1299
1338
  };
1300
1339
  }
1340
+ /**
1341
+ * Get PAT scopes from a write flag.
1342
+ * @param {boolean} write - Whether write access is required
1343
+ * @returns {PATScope[]} Scopes to apply to the token
1344
+ */
1301
1345
  function getScopesFromWriteFlag(write) {
1302
1346
  return write ? [PATScope.PAT_SCOPE_READ, PATScope.PAT_SCOPE_WRITE] : [PATScope.PAT_SCOPE_READ];
1303
1347
  }
1304
1348
  function getScopeStringsFromWriteFlag(write) {
1305
1349
  return write ? ["read", "write"] : ["read"];
1306
1350
  }
1351
+ /**
1352
+ * Print the created or updated personal access token to the logger.
1353
+ * @param {string} name - Token name
1354
+ * @param {string} token - Token value
1355
+ * @param {boolean} write - Whether the token has write scope
1356
+ * @param {"created" | "updated"} action - Action performed
1357
+ * @returns {void}
1358
+ */
1307
1359
  function printCreatedToken(name, token, write, action) {
1308
1360
  const scopes = getScopeStringsFromWriteFlag(write);
1309
1361
  if (logger.jsonMode) logger.out({