@tailor-platform/sdk 0.21.0 → 0.21.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,38 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 0.21.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#238](https://github.com/tailor-platform/sdk/pull/238) [`36639c6`](https://github.com/tailor-platform/sdk/commit/36639c6e1efee873eff89e61c59c60b8b22531a8) Thanks [@toiroakr](https://github.com/toiroakr)! - Improve Connect error messages in CLI
|
|
8
|
+
- Add `errorHandlingInterceptor` to enhance error messages from Connect protocol
|
|
9
|
+
- Error messages now include operation type, resource type, and request parameters
|
|
10
|
+
- Makes it easier to identify which resource caused validation errors
|
|
11
|
+
|
|
12
|
+
Before:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
ERROR [invalid_argument] validation error: namespace_name: value does not match regex pattern...
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
After:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
ERROR [invalid_argument] Failed to list TailorDBTypes: validation error: namespace_name: value does not match regex pattern...
|
|
22
|
+
Request: {
|
|
23
|
+
"namespaceName": "db",
|
|
24
|
+
...
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 0.21.2
|
|
29
|
+
|
|
30
|
+
## 0.21.1
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#233](https://github.com/tailor-platform/sdk/pull/233) [`475d368`](https://github.com/tailor-platform/sdk/commit/475d36848c35530cc302b82f365af4d4f84cb9a3) Thanks [@toiroakr](https://github.com/toiroakr)! - Remove setup-node from install-deps action and use standalone pnpm with pnpm env for Node.js installation
|
|
35
|
+
|
|
3
36
|
## 0.21.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/dist/cli/api.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as listOAuth2Clients, E as getMachineUserToken, G as loadWorkspaceId, H as loadConfig, N as apply, T as getOAuth2Client, V as generateUserTypes, W as loadAccessToken, _ as listWorkflowExecutions, b as remove, c as resumeWorkflow, f as listWorkflows, g as getWorkflowExecution, i as deleteWorkspace, j as generate, k as listMachineUsers, m as getWorkflow, n as listWorkspaces, o as createWorkspace, u as startWorkflow, v as show } from "../list-
|
|
1
|
+
import { C as listOAuth2Clients, E as getMachineUserToken, G as loadWorkspaceId, H as loadConfig, N as apply, T as getOAuth2Client, V as generateUserTypes, W as loadAccessToken, _ as listWorkflowExecutions, b as remove, c as resumeWorkflow, f as listWorkflows, g as getWorkflowExecution, i as deleteWorkspace, j as generate, k as listMachineUsers, m as getWorkflow, n as listWorkspaces, o as createWorkspace, u as startWorkflow, v as show } from "../list-ksRvpsz1.mjs";
|
|
2
2
|
import "../config-BGY8v5d7.mjs";
|
|
3
3
|
import { register } from "node:module";
|
|
4
4
|
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as PATScope, A as printData, B as workspaceArgs, D as tokenCommand, F as commonArgs, G as loadWorkspaceId, H as loadConfig, I as confirmationArgs, J as fetchAll, K as readPlatformConfig, L as deploymentArgs, M as generateCommand, O as listCommand$8, P as applyCommand, Q as readPackageJson, R as jsonArgs, S as listCommand$7, U as fetchLatestToken, W as loadAccessToken, X as initOAuth2Client, Y as fetchUserInfo, Z as initOperatorClient, a as createCommand, d as listCommand$1, et as logger, h as executionsCommand, l as startCommand, p as getCommand, q as writePlatformConfig, r as deleteCommand, s as resumeCommand, t as listCommand, w as getCommand$2, x as removeCommand, y as showCommand, z as withCommonArgs } from "../list-
|
|
2
|
+
import { $ as PATScope, A as printData, B as workspaceArgs, D as tokenCommand, F as commonArgs, G as loadWorkspaceId, H as loadConfig, I as confirmationArgs, J as fetchAll, K as readPlatformConfig, L as deploymentArgs, M as generateCommand, O as listCommand$8, P as applyCommand, Q as readPackageJson, R as jsonArgs, S as listCommand$7, U as fetchLatestToken, W as loadAccessToken, X as initOAuth2Client, Y as fetchUserInfo, Z as initOperatorClient, a as createCommand, d as listCommand$1, et as logger, h as executionsCommand, l as startCommand, p as getCommand, q as writePlatformConfig, r as deleteCommand, s as resumeCommand, t as listCommand, w as getCommand$2, x as removeCommand, y as showCommand, z as withCommonArgs } from "../list-ksRvpsz1.mjs";
|
|
3
3
|
import "../config-BGY8v5d7.mjs";
|
|
4
4
|
import { register } from "node:module";
|
|
5
5
|
import { defineCommand, runCommand, runMain } from "citty";
|
|
@@ -145516,7 +145516,8 @@ async function initOperatorClient(accessToken) {
|
|
|
145516
145516
|
interceptors: [
|
|
145517
145517
|
await userAgentInterceptor(),
|
|
145518
145518
|
await bearerTokenInterceptor(accessToken),
|
|
145519
|
-
retryInterceptor()
|
|
145519
|
+
retryInterceptor(),
|
|
145520
|
+
errorHandlingInterceptor()
|
|
145520
145521
|
]
|
|
145521
145522
|
}));
|
|
145522
145523
|
}
|
|
@@ -145567,6 +145568,42 @@ function isRetirable(error, idempotency) {
|
|
|
145567
145568
|
default: return false;
|
|
145568
145569
|
}
|
|
145569
145570
|
}
|
|
145571
|
+
function errorHandlingInterceptor() {
|
|
145572
|
+
return (next) => async (req) => {
|
|
145573
|
+
try {
|
|
145574
|
+
return await next(req);
|
|
145575
|
+
} catch (error) {
|
|
145576
|
+
if (error instanceof ConnectError) {
|
|
145577
|
+
const { operation, resourceType } = parseMethodName(req.method.name);
|
|
145578
|
+
const requestParams = formatRequestParams(req.message);
|
|
145579
|
+
throw new ConnectError(`Failed to ${operation} ${resourceType}: ${error.rawMessage}\nRequest: ${requestParams}`, error.code, error.metadata);
|
|
145580
|
+
}
|
|
145581
|
+
throw error;
|
|
145582
|
+
}
|
|
145583
|
+
};
|
|
145584
|
+
}
|
|
145585
|
+
/** @internal - exported for testing */
|
|
145586
|
+
function parseMethodName(methodName) {
|
|
145587
|
+
const match = methodName.match(/^(Create|Update|Delete|Set|List|Get)(.+)$/);
|
|
145588
|
+
if (!match) return {
|
|
145589
|
+
operation: "perform",
|
|
145590
|
+
resourceType: "resource"
|
|
145591
|
+
};
|
|
145592
|
+
const [, action, resource] = match;
|
|
145593
|
+
return {
|
|
145594
|
+
operation: action.toLowerCase(),
|
|
145595
|
+
resourceType: resource
|
|
145596
|
+
};
|
|
145597
|
+
}
|
|
145598
|
+
/** @internal - exported for testing */
|
|
145599
|
+
function formatRequestParams(message) {
|
|
145600
|
+
try {
|
|
145601
|
+
if (message && typeof message === "object" && "toJson" in message) return JSON.stringify(message.toJson(), null, 2);
|
|
145602
|
+
return JSON.stringify(message, null, 2);
|
|
145603
|
+
} catch {
|
|
145604
|
+
return "(unable to serialize request)";
|
|
145605
|
+
}
|
|
145606
|
+
}
|
|
145570
145607
|
async function fetchAll(fn) {
|
|
145571
145608
|
const items = [];
|
|
145572
145609
|
let pageToken = "";
|
|
@@ -151753,4 +151790,4 @@ const listCommand = defineCommand({
|
|
|
151753
151790
|
|
|
151754
151791
|
//#endregion
|
|
151755
151792
|
export { PATScope as $, printData as A, workspaceArgs as B, listOAuth2Clients as C, tokenCommand as D, getMachineUserToken as E, commonArgs as F, loadWorkspaceId as G, loadConfig as H, confirmationArgs as I, fetchAll as J, readPlatformConfig as K, deploymentArgs as L, generateCommand as M, apply as N, listCommand$3 as O, applyCommand as P, readPackageJson as Q, jsonArgs as R, listCommand$2 as S, getOAuth2Client as T, fetchLatestToken as U, generateUserTypes as V, loadAccessToken as W, initOAuth2Client as X, fetchUserInfo as Y, initOperatorClient as Z, listWorkflowExecutions as _, createCommand as a, remove as b, resumeWorkflow as c, listCommand$1 as d, logger as et, listWorkflows as f, getWorkflowExecution as g, executionsCommand as h, deleteWorkspace as i, generate as j, listMachineUsers as k, startCommand as l, getWorkflow as m, listWorkspaces as n, createWorkspace as o, getCommand as p, writePlatformConfig as q, deleteCommand as r, resumeCommand as s, listCommand as t, startWorkflow as u, show as v, getCommand$1 as w, removeCommand as x, showCommand as y, withCommonArgs as z };
|
|
151756
|
-
//# sourceMappingURL=list-
|
|
151793
|
+
//# sourceMappingURL=list-ksRvpsz1.mjs.map
|