@tailor-platform/sdk 0.21.2 → 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 +25 -0
- package/dist/cli/api.d.mts +1 -1
- package/dist/cli/api.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/configure/index.d.mts +2 -2
- package/dist/{index-CEJUQFNe.d.mts → index-DwAZDk6O.d.mts} +2 -2
- package/dist/{list-D_TfcRMd.mjs → list-ksRvpsz1.mjs} +39 -2
- package/dist/{list-D_TfcRMd.mjs.map → list-ksRvpsz1.mjs.map} +1 -1
- package/dist/{types-oYFwjNuW.d.mts → types-EKga-JDM.d.mts} +9 -9
- package/dist/utils/test/index.d.mts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
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
|
+
|
|
3
28
|
## 0.21.2
|
|
4
29
|
|
|
5
30
|
## 0.21.1
|
package/dist/cli/api.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
2
|
|
|
3
|
-
import { Ct as Resolver, J as OAuth2ClientInput, K as IdProviderConfig, M as TailorDBTypeConfig, d as AppConfig, h as Generator, m as CodeGeneratorBase, t as Executor } from "../types-
|
|
3
|
+
import { Ct as Resolver, J as OAuth2ClientInput, K as IdProviderConfig, M as TailorDBTypeConfig, d as AppConfig, h as Generator, m as CodeGeneratorBase, t as Executor } from "../types-EKga-JDM.mjs";
|
|
4
4
|
import "citty";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { OAuth2Client } from "@badgateway/oauth2-client";
|
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";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="./../user-defined.d.ts" />
|
|
2
2
|
|
|
3
|
-
import { $ as SCIMAttributeType, A as TailorDBType, B as AuthInvoker, C as ResolverExternalConfig, Ct as Resolver, D as ExecutorServiceInput, E as ExecutorServiceConfig, F as TailorTypePermission, G as IDToken, H as defineAuth, I as unsafeAllowAllGqlPermission, J as OAuth2ClientInput, K as IdProviderConfig, L as unsafeAllowAllTypePermission, N as PermissionCondition, O as TailorDBField, P as TailorTypeGqlPermission, Q as SCIMAttributeMapping, R as AuthConfig, S as defineIdp, St as QueryType, T as ResolverServiceInput, U as AuthServiceInput, V as AuthOwnConfig, W as BuiltinIdP, X as SAML, Y as OIDC, Z as SCIMAttribute, _ as WorkflowServiceInput, _t as AttributeList, at as UserAttributeListKey, b as IdPConfig, bt as unauthenticatedTailorUser, ct as ValueOperand, et as SCIMAuthorization, f as defineConfig, g as WorkflowServiceConfig, ht as Env, it as UserAttributeKey, j as db, k as TailorDBInstance, nt as SCIMResource, ot as UserAttributeMap, p as defineGenerators, q as OAuth2ClientGrantType, rt as TenantProviderConfig, st as UsernameFieldKey, tt as SCIMConfig, v as StaticWebsiteConfig, vt as AttributeMap, w as ResolverServiceConfig, x as IdPExternalConfig, xt as TailorField, y as defineStaticWebSite, yt as TailorUser, z as AuthExternalConfig } from "../types-
|
|
4
|
-
import { A as WORKFLOW_JOB_BRAND, C as GqlOperation, D as Workflow, E as WorkflowOperation, F as createWorkflowJob, I as createResolver, M as WorkflowJobContext, N as WorkflowJobInput, O as WorkflowConfig, P as WorkflowJobOutput, S as FunctionOperation, T as WebhookOperation, _ as ResolverExecutedTrigger, a as Trigger, b as recordUpdatedTrigger, c as IncomingWebhookTrigger, d as scheduleTrigger, f as RecordCreatedArgs, g as ResolverExecutedArgs, h as RecordUpdatedArgs, i as createExecutor, j as WorkflowJob, k as createWorkflow, l as incomingWebhookTrigger, m as RecordTrigger, n as output, o as IncomingWebhookArgs, p as RecordDeletedArgs, r as t, s as IncomingWebhookRequest, t as infer, u as ScheduleTrigger, v as recordCreatedTrigger, w as Operation, x as resolverExecutedTrigger, y as recordDeletedTrigger } from "../index-
|
|
3
|
+
import { $ as SCIMAttributeType, A as TailorDBType, B as AuthInvoker, C as ResolverExternalConfig, Ct as Resolver, D as ExecutorServiceInput, E as ExecutorServiceConfig, F as TailorTypePermission, G as IDToken, H as defineAuth, I as unsafeAllowAllGqlPermission, J as OAuth2ClientInput, K as IdProviderConfig, L as unsafeAllowAllTypePermission, N as PermissionCondition, O as TailorDBField, P as TailorTypeGqlPermission, Q as SCIMAttributeMapping, R as AuthConfig, S as defineIdp, St as QueryType, T as ResolverServiceInput, U as AuthServiceInput, V as AuthOwnConfig, W as BuiltinIdP, X as SAML, Y as OIDC, Z as SCIMAttribute, _ as WorkflowServiceInput, _t as AttributeList, at as UserAttributeListKey, b as IdPConfig, bt as unauthenticatedTailorUser, ct as ValueOperand, et as SCIMAuthorization, f as defineConfig, g as WorkflowServiceConfig, ht as Env, it as UserAttributeKey, j as db, k as TailorDBInstance, nt as SCIMResource, ot as UserAttributeMap, p as defineGenerators, q as OAuth2ClientGrantType, rt as TenantProviderConfig, st as UsernameFieldKey, tt as SCIMConfig, v as StaticWebsiteConfig, vt as AttributeMap, w as ResolverServiceConfig, x as IdPExternalConfig, xt as TailorField, y as defineStaticWebSite, yt as TailorUser, z as AuthExternalConfig } from "../types-EKga-JDM.mjs";
|
|
4
|
+
import { A as WORKFLOW_JOB_BRAND, C as GqlOperation, D as Workflow, E as WorkflowOperation, F as createWorkflowJob, I as createResolver, M as WorkflowJobContext, N as WorkflowJobInput, O as WorkflowConfig, P as WorkflowJobOutput, S as FunctionOperation, T as WebhookOperation, _ as ResolverExecutedTrigger, a as Trigger, b as recordUpdatedTrigger, c as IncomingWebhookTrigger, d as scheduleTrigger, f as RecordCreatedArgs, g as ResolverExecutedArgs, h as RecordUpdatedArgs, i as createExecutor, j as WorkflowJob, k as createWorkflow, l as incomingWebhookTrigger, m as RecordTrigger, n as output, o as IncomingWebhookArgs, p as RecordDeletedArgs, r as t, s as IncomingWebhookRequest, t as infer, u as ScheduleTrigger, v as recordCreatedTrigger, w as Operation, x as resolverExecutedTrigger, y as recordDeletedTrigger } from "../index-DwAZDk6O.mjs";
|
|
5
5
|
export { AttributeList, AttributeMap, AuthConfig, AuthExternalConfig, AuthInvoker, AuthOwnConfig, AuthServiceInput, BuiltinIdP, Env, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GqlOperation, IDToken, IdPConfig, IdPExternalConfig, IdProviderConfig, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, OAuth2ClientInput as OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverExternalConfig, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleTrigger, StaticWebsiteConfig, TailorDBField, TailorDBInstance, TailorDBType, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WORKFLOW_JOB_BRAND, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowJobInput, WorkflowJobOutput, WorkflowOperation, WorkflowServiceConfig, WorkflowServiceInput, createExecutor, createResolver, createWorkflow, createWorkflowJob, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./user-defined.d.ts" />
|
|
2
2
|
|
|
3
|
-
import { A as TailorDBType, B as AuthInvoker, Dt as output$1, Et as JsonCompatible, Tt as InferFieldsOutput, a as IncomingWebhookTrigger$1, c as ScheduleTriggerInput, dt as ArrayFieldOutput, ft as FieldMetadata, gt as TailorEnv, i as GqlOperation, l as WebhookOperation, lt as AllowedValues, mt as FieldOutput, n as ExecutorInput, o as RecordTrigger$1, pt as FieldOptions, r as FunctionOperation, s as ResolverExecutedTrigger$1, u as WorkflowOperation, ut as AllowedValuesOutput, wt as ResolverInput, xt as TailorField, yt as TailorUser } from "./types-
|
|
3
|
+
import { A as TailorDBType, B as AuthInvoker, Dt as output$1, Et as JsonCompatible, Tt as InferFieldsOutput, a as IncomingWebhookTrigger$1, c as ScheduleTriggerInput, dt as ArrayFieldOutput, ft as FieldMetadata, gt as TailorEnv, i as GqlOperation, l as WebhookOperation, lt as AllowedValues, mt as FieldOutput, n as ExecutorInput, o as RecordTrigger$1, pt as FieldOptions, r as FunctionOperation, s as ResolverExecutedTrigger$1, u as WorkflowOperation, ut as AllowedValuesOutput, wt as ResolverInput, xt as TailorField, yt as TailorUser } from "./types-EKga-JDM.mjs";
|
|
4
4
|
import { EmptyObject, JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
5
5
|
import { Client } from "@urql/core";
|
|
6
6
|
import { StandardCRON } from "ts-cron-validator";
|
|
@@ -351,4 +351,4 @@ declare namespace t {
|
|
|
351
351
|
}
|
|
352
352
|
//#endregion
|
|
353
353
|
export { WORKFLOW_JOB_BRAND as A, GqlOperation$1 as C, Workflow as D, WorkflowOperation$1 as E, createWorkflowJob as F, createResolver as I, WorkflowJobContext as M, WorkflowJobInput as N, WorkflowConfig as O, WorkflowJobOutput as P, FunctionOperation$1 as S, WebhookOperation$1 as T, ResolverExecutedTrigger as _, Trigger as a, recordUpdatedTrigger as b, IncomingWebhookTrigger as c, scheduleTrigger as d, RecordCreatedArgs as f, ResolverExecutedArgs as g, RecordUpdatedArgs as h, createExecutor as i, WorkflowJob as j, createWorkflow as k, incomingWebhookTrigger as l, RecordTrigger as m, output as n, IncomingWebhookArgs as o, RecordDeletedArgs as p, t as r, IncomingWebhookRequest as s, infer as t, ScheduleTrigger as u, recordCreatedTrigger as v, Operation as w, resolverExecutedTrigger as x, recordDeletedTrigger as y };
|
|
354
|
-
//# sourceMappingURL=index-
|
|
354
|
+
//# sourceMappingURL=index-DwAZDk6O.d.mts.map
|
|
@@ -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
|