@tailor-platform/sdk 1.37.0 → 1.39.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 +66 -0
- package/dist/application-C1ipG5Q6.mjs +4 -0
- package/dist/{application-qRGMV8Tr.mjs → application-DhQrXEld.mjs} +13 -5
- package/dist/{application-qRGMV8Tr.mjs.map → application-DhQrXEld.mjs.map} +1 -1
- package/dist/cli/index.mjs +364 -123
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +6 -6
- package/dist/cli/lib.mjs +3 -3
- package/dist/{client-424n_3T9.mjs → client-BWAbbA1C.mjs} +1 -1
- package/dist/{client-DllDLYmZ.mjs → client-xzPXtc_e.mjs} +9 -3
- package/dist/{client-DllDLYmZ.mjs.map → client-xzPXtc_e.mjs.map} +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +4 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-aHnky_xH.mjs → crash-report-BEAiCSCl.mjs} +1 -1
- package/dist/{crash-report-CDQ2JvgR.mjs → crash-report-DXhPL8Ue.mjs} +3 -3
- package/dist/{crash-report-CDQ2JvgR.mjs.map → crash-report-DXhPL8Ue.mjs.map} +1 -1
- package/dist/{env-04IQXqsl.d.mts → env-CgI46oPS.d.mts} +2 -2
- package/dist/errors-D9f2UJpT.mjs +43 -0
- package/dist/errors-D9f2UJpT.mjs.map +1 -0
- package/dist/{index-BVJQLjyN.d.mts → index-31hm0Fq7.d.mts} +23 -6
- package/dist/{index-DnIg_LfT.d.mts → index-B2tsEXdh.d.mts} +2 -2
- package/dist/{index-C3kcXHXJ.d.mts → index-DbzopC7M.d.mts} +2 -2
- package/dist/{index-CeS4FA9o.d.mts → index-DeBFa7oc.d.mts} +2 -2
- package/dist/{index-BUT18Kak.d.mts → index-y5790SX_.d.mts} +2 -2
- package/dist/{interceptor-dSNiQq71.mjs → interceptor-CzaH2Ur6.mjs} +1 -1
- package/dist/{interceptor-dSNiQq71.mjs.map → interceptor-CzaH2Ur6.mjs.map} +1 -1
- package/dist/{logger-C8qBDCKO.mjs → logger-5_JMzHmw.mjs} +42 -3
- package/dist/logger-5_JMzHmw.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{plugin-D6P4g_2L.d.mts → plugin-_K3ZfP8B.d.mts} +18 -3
- package/dist/{runtime-D9ejnCm6.mjs → runtime-DtSOnOHh.mjs} +32 -54
- package/dist/runtime-DtSOnOHh.mjs.map +1 -0
- package/dist/service-Bcp6JB3w.mjs +132 -0
- package/dist/service-Bcp6JB3w.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +6 -2
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/{workflow.generated-Bj_DVqGh.d.mts → workflow.generated-BxbnuzAE.d.mts} +2 -2
- package/docs/cli/function.md +42 -16
- package/docs/cli/upgrade.md +51 -0
- package/docs/cli/user.md +1 -1
- package/docs/cli/workflow.md +10 -10
- package/docs/cli-reference.md +24 -14
- package/docs/configuration.md +9 -7
- package/docs/generator/index.md +10 -0
- package/docs/services/executor.md +39 -0
- package/docs/services/tailordb.md +20 -0
- package/package.json +7 -7
- package/dist/application-ILhZq_oW.mjs +0 -4
- package/dist/logger-C8qBDCKO.mjs.map +0 -1
- package/dist/runtime-D9ejnCm6.mjs.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
|
|
4
|
+
//#region src/cli/shared/errors.ts
|
|
5
|
+
/**
|
|
6
|
+
* Format CLI error for output
|
|
7
|
+
* @param error - CLIError instance to format
|
|
8
|
+
* @returns Formatted error message
|
|
9
|
+
*/
|
|
10
|
+
function formatError(error) {
|
|
11
|
+
const parts = [chalk.red(`Error${error.code ? ` [${error.code}]` : ""}: ${error.message}`)];
|
|
12
|
+
if (error.details) parts.push(`\n ${chalk.gray("Details:")} ${error.details}`);
|
|
13
|
+
if (error.suggestion) parts.push(`\n ${chalk.cyan("Suggestion:")} ${error.suggestion}`);
|
|
14
|
+
if (error.command) parts.push(`\n ${chalk.gray("Help:")} Run \`tailor-sdk ${error.command} --help\` for usage information.`);
|
|
15
|
+
return parts.join("");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a CLI error with formatted output
|
|
19
|
+
* @param options - Options to construct a CLIError
|
|
20
|
+
* @returns Constructed CLIError instance
|
|
21
|
+
*/
|
|
22
|
+
function createCLIError(options) {
|
|
23
|
+
const error = new Error(options.message);
|
|
24
|
+
error.name = "CLIError";
|
|
25
|
+
error.code = options.code;
|
|
26
|
+
error.details = options.details;
|
|
27
|
+
error.suggestion = options.suggestion;
|
|
28
|
+
error.command = options.command;
|
|
29
|
+
error.format = () => formatError(error);
|
|
30
|
+
return error;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Type guard to check if an error is a CLIError
|
|
34
|
+
* @param error - Error to check
|
|
35
|
+
* @returns True if the error is a CLIError
|
|
36
|
+
*/
|
|
37
|
+
function isCLIError(error) {
|
|
38
|
+
return error instanceof Error && error.name === "CLIError";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { isCLIError as n, createCLIError as t };
|
|
43
|
+
//# sourceMappingURL=errors-D9f2UJpT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-D9f2UJpT.mjs","names":[],"sources":["../src/cli/shared/errors.ts"],"sourcesContent":["import chalk from \"chalk\";\n\n/**\n * Options for creating a CLI error\n */\nexport interface CLIErrorOptions {\n message: string;\n details?: string;\n suggestion?: string;\n command?: string;\n code?: string;\n}\n\n/**\n * CLI error interface with formatted output\n */\nexport interface CLIError extends Error {\n readonly code?: string;\n readonly details?: string;\n readonly suggestion?: string;\n readonly command?: string;\n format(): string;\n}\n\ntype CLIErrorInternal = Error & {\n code?: string;\n details?: string;\n suggestion?: string;\n command?: string;\n format(): string;\n};\n\n/**\n * Format CLI error for output\n * @param error - CLIError instance to format\n * @returns Formatted error message\n */\nfunction formatError(error: CLIError): string {\n const parts: string[] = [\n chalk.red(`Error${error.code ? ` [${error.code}]` : \"\"}: ${error.message}`),\n ];\n\n if (error.details) {\n parts.push(`\\n ${chalk.gray(\"Details:\")} ${error.details}`);\n }\n\n if (error.suggestion) {\n parts.push(`\\n ${chalk.cyan(\"Suggestion:\")} ${error.suggestion}`);\n }\n\n if (error.command) {\n parts.push(\n `\\n ${chalk.gray(\"Help:\")} Run \\`tailor-sdk ${error.command} --help\\` for usage information.`,\n );\n }\n\n return parts.join(\"\");\n}\n\n/**\n * Create a CLI error with formatted output\n * @param options - Options to construct a CLIError\n * @returns Constructed CLIError instance\n */\nfunction createCLIError(options: CLIErrorOptions): CLIError {\n const error = new Error(options.message) as CLIErrorInternal;\n error.name = \"CLIError\";\n error.code = options.code;\n error.details = options.details;\n error.suggestion = options.suggestion;\n error.command = options.command;\n error.format = () => formatError(error);\n return error;\n}\n\n/**\n * Type guard to check if an error is a CLIError\n * @param error - Error to check\n * @returns True if the error is a CLIError\n */\nexport function isCLIError(error: unknown): error is CLIError {\n return error instanceof Error && error.name === \"CLIError\";\n}\n\n// Re-export createCLIError as CLIError for backward compatibility\nexport { createCLIError as CLIError };\n"],"mappings":";;;;;;;;;AAqCA,SAAS,YAAY,OAAyB;CAC5C,MAAM,QAAkB,CACtB,MAAM,IAAI,QAAQ,MAAM,OAAO,KAAK,MAAM,KAAK,KAAK,GAAG,IAAI,MAAM,UAAU,CAC5E;AAED,KAAI,MAAM,QACR,OAAM,KAAK,OAAO,MAAM,KAAK,WAAW,CAAC,GAAG,MAAM,UAAU;AAG9D,KAAI,MAAM,WACR,OAAM,KAAK,OAAO,MAAM,KAAK,cAAc,CAAC,GAAG,MAAM,aAAa;AAGpE,KAAI,MAAM,QACR,OAAM,KACJ,OAAO,MAAM,KAAK,QAAQ,CAAC,oBAAoB,MAAM,QAAQ,kCAC9D;AAGH,QAAO,MAAM,KAAK,GAAG;;;;;;;AAQvB,SAAS,eAAe,SAAoC;CAC1D,MAAM,QAAQ,IAAI,MAAM,QAAQ,QAAQ;AACxC,OAAM,OAAO;AACb,OAAM,OAAO,QAAQ;AACrB,OAAM,UAAU,QAAQ;AACxB,OAAM,aAAa,QAAQ;AAC3B,OAAM,UAAU,QAAQ;AACxB,OAAM,eAAe,YAAY,MAAM;AACvC,QAAO;;;;;;;AAQT,SAAgB,WAAW,OAAmC;AAC5D,QAAO,iBAAiB,SAAS,MAAM,SAAS"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { $ as FieldOptions, At as
|
|
3
|
-
import { n as TailorEnv, r as TailorActor } from "./env-
|
|
4
|
-
import { _ as IdpDefinitionBrand, g as IdPUserField, n as AppConfig, t as RetryPolicy, x as IdPInput } from "./workflow.generated-
|
|
2
|
+
import { $ as FieldOptions, At as TailorDBTrigger$1, Ct as ExecutorInput, Dt as IncomingWebhookTrigger$1, Et as IdpUserTrigger$1, F as UserAttributeListKey, H as TailorDBInstance, I as UserAttributeMap, Mt as WorkflowOperation$1, Nt as AuthInvoker$1, Ot as ResolverExecutedTrigger$1, Q as FieldMetadata, Tt as GqlOperation$1, U as TailorDBType, X as ArrayFieldOutput, Z as DefinedFieldMetadata, at as JsonCompatible, bt as GeneratorConfig, dt as InferredAttributeMap, et as FieldOutput, ft as TailorUser, ht as AllowedValuesOutput, it as InferFieldsOutput, j as DefinedAuth, jt as WebhookOperation$1, k as AuthServiceInput, kt as ScheduleTriggerInput, mt as AllowedValues, n as Plugin, nt as TailorAnyField, ot as JsonValue, rt as TailorField, st as output$1, tt as TailorFieldType, vt as Resolver, wt as FunctionOperation$1, xt as AuthAccessTokenTrigger$1, yt as ResolverInput } from "./plugin-_K3ZfP8B.mjs";
|
|
3
|
+
import { n as TailorEnv, r as TailorActor } from "./env-CgI46oPS.mjs";
|
|
4
|
+
import { _ as IdpDefinitionBrand, g as IdPUserField, n as AppConfig, t as RetryPolicy, x as IdPInput } from "./workflow.generated-BxbnuzAE.mjs";
|
|
5
5
|
import * as _$zod from "zod";
|
|
6
6
|
import { JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
|
|
7
7
|
import { Client } from "@urql/core";
|
|
@@ -626,15 +626,32 @@ interface IncomingWebhookRequest {
|
|
|
626
626
|
body: Record<string, unknown>;
|
|
627
627
|
headers: Record<string, string>;
|
|
628
628
|
}
|
|
629
|
+
interface IncomingWebhookResponseConfig<Args> {
|
|
630
|
+
/**
|
|
631
|
+
* Expression that returns the webhook HTTP response body.
|
|
632
|
+
* Receives the same args as the executor operation.
|
|
633
|
+
*/
|
|
634
|
+
body?: (args: Args) => JsonValue;
|
|
635
|
+
/**
|
|
636
|
+
* HTTP status code for the response.
|
|
637
|
+
* If omitted and `body` is set, the platform uses 200.
|
|
638
|
+
*/
|
|
639
|
+
statusCode?: number;
|
|
640
|
+
}
|
|
641
|
+
type IncomingWebhookResponse<Args> = ((args: Args) => JsonValue) | IncomingWebhookResponseConfig<Args>;
|
|
642
|
+
interface IncomingWebhookTriggerOptions<Args> {
|
|
643
|
+
response?: IncomingWebhookResponse<Args>;
|
|
644
|
+
}
|
|
629
645
|
type IncomingWebhookTrigger<Args> = IncomingWebhookTrigger$1 & {
|
|
630
646
|
__args: Args;
|
|
631
647
|
};
|
|
632
648
|
/**
|
|
633
649
|
* Create a trigger for incoming webhook requests.
|
|
634
650
|
* @template T
|
|
651
|
+
* @param options - Optional trigger options including response configuration
|
|
635
652
|
* @returns Incoming webhook trigger
|
|
636
653
|
*/
|
|
637
|
-
declare function incomingWebhookTrigger<T extends IncomingWebhookRequest>(): IncomingWebhookTrigger<IncomingWebhookArgs<T>>;
|
|
654
|
+
declare function incomingWebhookTrigger<T extends IncomingWebhookRequest>(options?: IncomingWebhookTriggerOptions<IncomingWebhookArgs<T>>): IncomingWebhookTrigger<IncomingWebhookArgs<T>>;
|
|
638
655
|
//#endregion
|
|
639
656
|
//#region src/configure/services/executor/trigger/index.d.ts
|
|
640
657
|
type Trigger<Args> = TailorDBTrigger<Args> | ResolverExecutedTrigger<Args> | ScheduleTrigger<Args> | IncomingWebhookTrigger<Args> | IdpUserTrigger<Args> | AuthAccessTokenTrigger<Args>;
|
|
@@ -955,5 +972,5 @@ declare namespace t {
|
|
|
955
972
|
type infer<T> = TailorOutput<T>;
|
|
956
973
|
}
|
|
957
974
|
//#endregion
|
|
958
|
-
export {
|
|
959
|
-
//# sourceMappingURL=index-
|
|
975
|
+
export { GqlOperation as $, IdpUserDeletedArgs as A, authAccessTokenRefreshedTrigger as B, AuthAccessTokenArgs as C, AuthAccessTokenTrigger as D, AuthAccessTokenRevokedArgs as E, RecordUpdatedArgs as F, idpUserTrigger as G, authAccessTokenTrigger as H, ResolverExecutedArgs as I, recordDeletedTrigger as J, idpUserUpdatedTrigger as K, ResolverExecutedTrigger as L, IdpUserUpdatedArgs as M, RecordCreatedArgs as N, IdpUserArgs as O, RecordDeletedArgs as P, FunctionOperation as Q, TailorDBTrigger as R, scheduleTrigger as S, AuthAccessTokenRefreshedArgs as T, idpUserCreatedTrigger as U, authAccessTokenRevokedTrigger as V, idpUserDeletedTrigger as W, recordUpdatedTrigger as X, recordTrigger as Y, resolverExecutedTrigger as Z, IncomingWebhookTrigger as _, MachineUserNameRegistry as _t, defineGenerators as a, createWorkflow as at, ScheduleArgs as b, IdPPermission as c, WorkflowJobContext as ct, createExecutor as d, createWorkflowJob as dt, Operation as et, Trigger as f, QueryType as ft, IncomingWebhookResponseConfig as g, MachineUserName as gt, IncomingWebhookResponse as h, defineAuth as ht, defineConfig as i, WorkflowConfig as it, IdpUserTrigger as j, IdpUserCreatedArgs as k, IdPPermissionCondition as l, WorkflowJobInput as lt, IncomingWebhookRequest as m, AuthInvoker as mt, output as n, WorkflowOperation as nt, definePlugins as o, WORKFLOW_TEST_ENV_KEY as ot, IncomingWebhookArgs as p, createResolver as pt, recordCreatedTrigger as q, t as r, Workflow as rt, defineIdp as s, WorkflowJob as st, infer as t, WebhookOperation as tt, unsafeAllowAllIdPPermission as u, WorkflowJobOutput as ut, IncomingWebhookTriggerOptions as v, AuthAccessTokenIssuedArgs as w, ScheduleTrigger as x, incomingWebhookTrigger as y, authAccessTokenIssuedTrigger as z };
|
|
976
|
+
//# sourceMappingURL=index-31hm0Fq7.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as Plugin } from "./plugin-
|
|
2
|
+
import { n as Plugin } from "./plugin-_K3ZfP8B.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/seed/index.d.ts
|
|
5
5
|
/** Unique identifier for the seed generator plugin. */
|
|
@@ -18,4 +18,4 @@ type SeedPluginOptions = {
|
|
|
18
18
|
declare function seedPlugin(options: SeedPluginOptions): Plugin<unknown, SeedPluginOptions>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { seedPlugin as n, SeedGeneratorID as t };
|
|
21
|
-
//# sourceMappingURL=index-
|
|
21
|
+
//# sourceMappingURL=index-B2tsEXdh.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as Plugin } from "./plugin-
|
|
2
|
+
import { n as Plugin } from "./plugin-_K3ZfP8B.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/file-utils/index.d.ts
|
|
5
5
|
/** Unique identifier for the file utilities generator plugin. */
|
|
@@ -16,4 +16,4 @@ type FileUtilsPluginOptions = {
|
|
|
16
16
|
declare function fileUtilsPlugin(options: FileUtilsPluginOptions): Plugin<unknown, FileUtilsPluginOptions>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { fileUtilsPlugin as n, FileUtilsGeneratorID as t };
|
|
19
|
-
//# sourceMappingURL=index-
|
|
19
|
+
//# sourceMappingURL=index-DbzopC7M.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as Plugin } from "./plugin-
|
|
2
|
+
import { n as Plugin } from "./plugin-_K3ZfP8B.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/enum-constants/index.d.ts
|
|
5
5
|
/** Unique identifier for the enum constants generator plugin. */
|
|
@@ -16,4 +16,4 @@ type EnumConstantsPluginOptions = {
|
|
|
16
16
|
declare function enumConstantsPlugin(options: EnumConstantsPluginOptions): Plugin<unknown, EnumConstantsPluginOptions>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { enumConstantsPlugin as n, EnumConstantsGeneratorID as t };
|
|
19
|
-
//# sourceMappingURL=index-
|
|
19
|
+
//# sourceMappingURL=index-DeBFa7oc.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as Plugin } from "./plugin-
|
|
2
|
+
import { n as Plugin } from "./plugin-_K3ZfP8B.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/builtin/kysely-type/index.d.ts
|
|
5
5
|
/** Unique identifier for the Kysely type generator plugin. */
|
|
@@ -16,4 +16,4 @@ type KyselyTypePluginOptions = {
|
|
|
16
16
|
declare function kyselyTypePlugin(options: KyselyTypePluginOptions): Plugin<unknown, KyselyTypePluginOptions>;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { kyselyTypePlugin as n, KyselyGeneratorID as t };
|
|
19
|
-
//# sourceMappingURL=index-
|
|
19
|
+
//# sourceMappingURL=index-y5790SX_.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor-
|
|
1
|
+
{"version":3,"file":"interceptor-CzaH2Ur6.mjs","names":[],"sources":["../src/cli/telemetry/interceptor.ts"],"sourcesContent":["import { trace, SpanStatusCode } from \"@opentelemetry/api\";\nimport type { Interceptor } from \"@connectrpc/connect\";\n\n/**\n * Create a Connect-RPC interceptor that records OTLP spans for each RPC call.\n * When no TracerProvider is registered, the OTel API automatically provides\n * noop spans with zero overhead.\n * @returns Tracing interceptor\n */\nexport function createTracingInterceptor(): Interceptor {\n return (next) => async (req) => {\n const tracer = trace.getTracer(\"tailor-sdk\");\n\n return tracer.startActiveSpan(`rpc.${req.method.name}`, async (span) => {\n span.setAttribute(\"rpc.method\", req.method.name);\n span.setAttribute(\"rpc.service\", \"OperatorService\");\n span.setAttribute(\"rpc.system\", \"connect-rpc\");\n\n try {\n const response = await next(req);\n span.setStatus({ code: SpanStatusCode.OK });\n return response;\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n if (error instanceof Error) {\n span.recordException(error);\n }\n throw error;\n } finally {\n span.end();\n }\n });\n };\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,2BAAwC;AACtD,SAAQ,SAAS,OAAO,QAAQ;AAG9B,SAFe,MAAM,UAAU,aAAa,CAE9B,gBAAgB,OAAO,IAAI,OAAO,QAAQ,OAAO,SAAS;AACtE,QAAK,aAAa,cAAc,IAAI,OAAO,KAAK;AAChD,QAAK,aAAa,eAAe,kBAAkB;AACnD,QAAK,aAAa,cAAc,cAAc;AAE9C,OAAI;IACF,MAAM,WAAW,MAAM,KAAK,IAAI;AAChC,SAAK,UAAU,EAAE,MAAM,eAAe,IAAI,CAAC;AAC3C,WAAO;YACA,OAAO;AACd,SAAK,UAAU,EAAE,MAAM,eAAe,OAAO,CAAC;AAC9C,QAAI,iBAAiB,MACnB,MAAK,gBAAgB,MAAM;AAE7B,UAAM;aACE;AACR,SAAK,KAAK;;IAEZ"}
|
|
@@ -4,6 +4,45 @@ import chalk from "chalk";
|
|
|
4
4
|
import { formatDistanceToNowStrict } from "date-fns";
|
|
5
5
|
import { getBorderCharacters, table } from "table";
|
|
6
6
|
|
|
7
|
+
//#region src/cli/shared/parse-boolean.ts
|
|
8
|
+
const TRUTHY_VALUES = new Set([
|
|
9
|
+
"true",
|
|
10
|
+
"t",
|
|
11
|
+
"yes",
|
|
12
|
+
"y",
|
|
13
|
+
"on",
|
|
14
|
+
"1"
|
|
15
|
+
]);
|
|
16
|
+
const FALSY_VALUES = new Set([
|
|
17
|
+
"false",
|
|
18
|
+
"f",
|
|
19
|
+
"no",
|
|
20
|
+
"n",
|
|
21
|
+
"off",
|
|
22
|
+
"0"
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* Parse a string value as a boolean.
|
|
26
|
+
*
|
|
27
|
+
* Recognized values (case-insensitive, trimmed) follow Python's
|
|
28
|
+
* `distutils.util.strtobool` convention:
|
|
29
|
+
* - truthy: `true, t, yes, y, on, 1`
|
|
30
|
+
* - falsy: `false, f, no, n, off, 0`
|
|
31
|
+
*
|
|
32
|
+
* Undefined, empty strings, and unrecognized values return `undefined` so
|
|
33
|
+
* that callers can fall back to their own defaults.
|
|
34
|
+
* @param value - The input string (e.g. an environment variable or CLI flag value)
|
|
35
|
+
* @returns `true`, `false`, or `undefined` when the value is unset or unrecognized
|
|
36
|
+
*/
|
|
37
|
+
function parseBoolean(value) {
|
|
38
|
+
if (value === void 0) return void 0;
|
|
39
|
+
const normalized = value.trim().toLowerCase();
|
|
40
|
+
if (normalized === "") return void 0;
|
|
41
|
+
if (TRUTHY_VALUES.has(normalized)) return true;
|
|
42
|
+
if (FALSY_VALUES.has(normalized)) return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
7
46
|
//#region src/cli/shared/logger.ts
|
|
8
47
|
/**
|
|
9
48
|
* Error thrown when a prompt is attempted in a CI environment
|
|
@@ -128,7 +167,7 @@ const logger = {
|
|
|
128
167
|
process.stderr.write("\n");
|
|
129
168
|
},
|
|
130
169
|
debug(message) {
|
|
131
|
-
if (process.env.DEBUG ===
|
|
170
|
+
if (parseBoolean(process.env.DEBUG) === true) writeLog("log", styles.dim(message), { mode: "plain" });
|
|
132
171
|
},
|
|
133
172
|
out(data, options) {
|
|
134
173
|
if (typeof data === "string") {
|
|
@@ -178,5 +217,5 @@ const logger = {
|
|
|
178
217
|
};
|
|
179
218
|
|
|
180
219
|
//#endregion
|
|
181
|
-
export { symbols as i, logger as n, styles as r, CIPromptError as t };
|
|
182
|
-
//# sourceMappingURL=logger-
|
|
220
|
+
export { parseBoolean as a, symbols as i, logger as n, styles as r, CIPromptError as t };
|
|
221
|
+
//# sourceMappingURL=logger-5_JMzHmw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-5_JMzHmw.mjs","names":[],"sources":["../src/cli/shared/parse-boolean.ts","../src/cli/shared/logger.ts"],"sourcesContent":["const TRUTHY_VALUES = new Set([\"true\", \"t\", \"yes\", \"y\", \"on\", \"1\"]);\nconst FALSY_VALUES = new Set([\"false\", \"f\", \"no\", \"n\", \"off\", \"0\"]);\n\n/**\n * Parse a string value as a boolean.\n *\n * Recognized values (case-insensitive, trimmed) follow Python's\n * `distutils.util.strtobool` convention:\n * - truthy: `true, t, yes, y, on, 1`\n * - falsy: `false, f, no, n, off, 0`\n *\n * Undefined, empty strings, and unrecognized values return `undefined` so\n * that callers can fall back to their own defaults.\n * @param value - The input string (e.g. an environment variable or CLI flag value)\n * @returns `true`, `false`, or `undefined` when the value is unset or unrecognized\n */\nexport function parseBoolean(value: string | undefined): boolean | undefined {\n if (value === undefined) return undefined;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"\") return undefined;\n if (TRUTHY_VALUES.has(normalized)) return true;\n if (FALSY_VALUES.has(normalized)) return false;\n return undefined;\n}\n","import { formatWithOptions, type InspectOptions } from \"node:util\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns\";\nimport { getBorderCharacters, table } from \"table\";\nimport { parseBoolean } from \"./parse-boolean\";\n\n/**\n * Error thrown when a prompt is attempted in a CI environment\n */\nexport class CIPromptError extends Error {\n constructor(message?: string) {\n super(\n message ??\n \"Interactive prompts are not available in CI environments. Use --yes flag to skip confirmation prompts.\",\n );\n this.name = \"CIPromptError\";\n }\n}\n\n/**\n * Semantic style functions for inline text styling\n */\nexport const styles = {\n // Status colors\n success: chalk.green,\n error: chalk.red,\n warning: chalk.yellow,\n info: chalk.cyan,\n\n // Action colors (for change sets)\n create: chalk.green,\n update: chalk.yellow,\n delete: chalk.red,\n unchanged: chalk.gray,\n\n // Emphasis\n bold: chalk.bold,\n dim: chalk.gray,\n highlight: chalk.cyanBright,\n successBright: chalk.greenBright,\n errorBright: chalk.redBright,\n\n // Resource types\n resourceType: chalk.bold,\n resourceName: chalk.cyan,\n\n // File paths\n path: chalk.cyan,\n\n // Values\n value: chalk.white,\n placeholder: chalk.gray.italic,\n};\n\n/**\n * Standardized symbols for CLI output\n */\nexport const symbols = {\n success: chalk.green(\"\\u2713\"),\n error: chalk.red(\"\\u2716\"),\n warning: chalk.yellow(\"\\u26a0\"),\n info: chalk.cyan(\"i\"),\n create: chalk.green(\"+\"),\n update: chalk.yellow(\"~\"),\n delete: chalk.red(\"-\"),\n replace: chalk.magenta(\"\\u00b1\"),\n bullet: chalk.gray(\"\\u2022\"),\n arrow: chalk.gray(\"\\u2192\"),\n};\n\n/**\n * Log output modes\n */\nexport type LogMode = \"default\" | \"stream\" | \"plain\";\n\nexport interface LogOptions {\n /** Output mode (default: \"default\") */\n mode?: LogMode;\n /** Number of spaces to indent the entire line (default: 0) */\n indent?: number;\n}\n\n/** Field transformer function. null excludes the field from table output. */\nexport type FieldTransformer = ((value: unknown, item: object) => string) | null;\n\nexport interface OutOptions {\n /** Table display field transform/exclude settings. Only applied in table mode (not JSON). */\n display?: Record<string, FieldTransformer>;\n\n /** Show null values in table output (default: false) */\n showNull?: boolean;\n}\n\n// In JSON mode, all logs go to stderr to keep stdout clean for JSON data\nlet _jsonMode = false;\n\n// Type icons for log output\nconst TYPE_ICONS: Record<string, string> = {\n info: \"ℹ\",\n success: \"✔\",\n warn: \"⚠\",\n error: \"✖\",\n debug: \"⚙\",\n trace: \"→\",\n log: \"\",\n};\n\n// Color functions for icon and message text\nconst TYPE_COLORS: Record<string, (text: string) => string> = {\n info: chalk.cyan,\n success: chalk.green,\n warn: chalk.yellow,\n error: chalk.red,\n debug: chalk.gray,\n trace: chalk.gray,\n log: (text) => text,\n};\n\ninterface FormatLogLineOptions {\n mode: string;\n indent: number;\n type: string;\n message: string;\n timestamp?: string;\n}\n\n/**\n * Formats a log line with the appropriate prefix and indentation\n * @param opts - Formatting options\n * @returns Formatted log line\n */\nexport function formatLogLine(opts: FormatLogLineOptions): string {\n const { mode, indent, type, message, timestamp } = opts;\n const indentPrefix = indent > 0 ? \" \".repeat(indent) : \"\";\n const colorFn = TYPE_COLORS[type] || ((text: string) => text);\n\n // Plain mode: color only, no icon, no timestamp\n if (mode === \"plain\") {\n return `${indentPrefix}${colorFn(message)}\\n`;\n }\n\n // Default/Stream mode: with icon and color\n const icon = TYPE_ICONS[type] || \"\";\n const prefix = icon ? `${icon} ` : \"\";\n const coloredOutput = colorFn(`${prefix}${message}`);\n const timestampPrefix = timestamp ?? \"\";\n\n return `${indentPrefix}${timestampPrefix}${coloredOutput}\\n`;\n}\n\n/**\n * Writes a formatted log line to stderr.\n * @param type - Log type (info, success, warn, error, log)\n * @param message - Log message\n * @param opts - Log options (mode and indent)\n */\nfunction writeLog(type: string, message: string, opts?: LogOptions): void {\n const mode = opts?.mode ?? \"default\";\n const indent = opts?.indent ?? 0;\n const inspectOpts: InspectOptions = {\n breakLength: process.stdout.columns || 80,\n };\n const formattedMessage = formatWithOptions(inspectOpts, message);\n const timestamp = mode === \"stream\" ? `${new Date().toLocaleTimeString()} ` : \"\";\n const output = formatLogLine({ mode, indent, type, message: formattedMessage, timestamp });\n process.stderr.write(output);\n}\n\nexport const logger = {\n get jsonMode(): boolean {\n return _jsonMode;\n },\n set jsonMode(value: boolean) {\n _jsonMode = value;\n },\n\n info(message: string, opts?: LogOptions): void {\n writeLog(\"info\", message, opts);\n },\n\n success(message: string, opts?: LogOptions): void {\n writeLog(\"success\", message, opts);\n },\n\n warn(message: string, opts?: LogOptions): void {\n writeLog(\"warn\", message, opts);\n },\n\n error(message: string, opts?: LogOptions): void {\n writeLog(\"error\", message, opts);\n },\n\n log(message: string): void {\n writeLog(\"log\", message, { mode: \"plain\" });\n },\n\n newline(): void {\n process.stderr.write(\"\\n\");\n },\n\n debug(message: string): void {\n if (parseBoolean(process.env.DEBUG) === true) {\n writeLog(\"log\", styles.dim(message), { mode: \"plain\" });\n }\n },\n\n out(data: string | object | object[], options?: OutOptions): void {\n if (typeof data === \"string\") {\n process.stdout.write(data.endsWith(\"\\n\") ? data : data + \"\\n\");\n return;\n }\n\n if (this.jsonMode) {\n // eslint-disable-next-line no-restricted-syntax\n console.log(JSON.stringify(data));\n return;\n }\n\n const display = options?.display;\n\n // Helper to format a value for table display\n const formatValue = (value: unknown, pretty = false): string => {\n if (options?.showNull && value === null) return \"NULL\";\n if (value === null || value === undefined) return \"N/A\";\n if (value instanceof Date) {\n return formatDistanceToNowStrict(value, { addSuffix: true });\n }\n if (typeof value === \"object\") {\n return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);\n }\n return String(value);\n };\n\n // Helper to check if field should be excluded\n const isExcluded = (key: string): boolean => {\n return display !== undefined && key in display && display[key] === null;\n };\n\n // Helper to apply transformer or default formatting\n const transformValue = (key: string, value: unknown, item: object, pretty = false): string => {\n if (display && key in display) {\n const transformer = display[key];\n if (transformer) {\n return transformer(value, item);\n }\n }\n return formatValue(value, pretty);\n };\n\n if (!Array.isArray(data)) {\n const entries = Object.entries(data).filter(([key]) => !isExcluded(key));\n const formattedEntries = entries.map(([key, value]) => [\n key,\n transformValue(key, value, data, true),\n ]);\n const t = table(formattedEntries, {\n singleLine: false,\n border: getBorderCharacters(\"norc\"),\n });\n process.stdout.write(t);\n return;\n }\n\n if (data.length === 0) {\n return;\n }\n\n const allHeaders = Array.from(new Set(data.flatMap((item) => Object.keys(item))));\n const headers = allHeaders.filter((h) => !isExcluded(h));\n const rows = data.map((item) =>\n headers.map((header) =>\n transformValue(header, (item as Record<string, unknown>)[header], item),\n ),\n );\n\n const t = table([headers, ...rows], {\n border: getBorderCharacters(\"norc\"),\n drawHorizontalLine: (lineIndex, rowCount) => {\n return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;\n },\n });\n process.stdout.write(t);\n },\n};\n"],"mappings":"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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-
|
|
2
|
+
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "../../../index-DeBFa7oc.mjs";
|
|
3
3
|
export { EnumConstantsGeneratorID, enumConstantsPlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-
|
|
2
|
+
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "../../../index-DbzopC7M.mjs";
|
|
3
3
|
export { FileUtilsGeneratorID, fileUtilsPlugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-
|
|
2
|
+
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "../../../index-y5790SX_.mjs";
|
|
3
3
|
export { KyselyGeneratorID, kyselyTypePlugin };
|
package/dist/plugin/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import { B as TailorAnyDBType } from "../plugin-
|
|
3
|
-
import { n as TailorEnv, r as TailorActor } from "../env-
|
|
2
|
+
import { B as TailorAnyDBType } from "../plugin-_K3ZfP8B.mjs";
|
|
3
|
+
import { n as TailorEnv, r as TailorActor } from "../env-CgI46oPS.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin/with-context.d.ts
|
|
6
6
|
/**
|
|
@@ -196,7 +196,11 @@ type ScheduleTriggerInput = {
|
|
|
196
196
|
timezone?: string | undefined;
|
|
197
197
|
};
|
|
198
198
|
type IncomingWebhookTrigger = {
|
|
199
|
-
kind: "incomingWebhook";
|
|
199
|
+
kind: "incomingWebhook"; /** Response configuration */
|
|
200
|
+
response?: {
|
|
201
|
+
body?: Function | undefined;
|
|
202
|
+
statusCode?: number | undefined;
|
|
203
|
+
} | undefined;
|
|
200
204
|
};
|
|
201
205
|
type IdpUserTrigger = {
|
|
202
206
|
/** IdP user event trigger */kind: "idpUser"; /** IdP user event types to trigger on */
|
|
@@ -263,6 +267,10 @@ type ExecutorInput = {
|
|
|
263
267
|
timezone?: string | undefined;
|
|
264
268
|
} | {
|
|
265
269
|
kind: "incomingWebhook";
|
|
270
|
+
response?: {
|
|
271
|
+
body?: Function | undefined;
|
|
272
|
+
statusCode?: number | undefined;
|
|
273
|
+
} | undefined;
|
|
266
274
|
} | {
|
|
267
275
|
kind: "idpUser";
|
|
268
276
|
events: ("idp.user.created" | "idp.user.updated" | "idp.user.deleted")[];
|
|
@@ -292,6 +300,10 @@ type Executor = {
|
|
|
292
300
|
timezone: string;
|
|
293
301
|
} | {
|
|
294
302
|
kind: "incomingWebhook";
|
|
303
|
+
response?: {
|
|
304
|
+
body?: Function | undefined;
|
|
305
|
+
statusCode?: number | undefined;
|
|
306
|
+
} | undefined;
|
|
295
307
|
} | {
|
|
296
308
|
kind: "idpUser";
|
|
297
309
|
events: ("idp.user.created" | "idp.user.updated" | "idp.user.deleted")[];
|
|
@@ -450,6 +462,9 @@ type InferFieldsOutput<F extends Record<string, {
|
|
|
450
462
|
_output: any;
|
|
451
463
|
[key: string]: any;
|
|
452
464
|
}>> = DeepWritable<Prettify<NullableToOptional<{ [K in keyof F]: output<F[K]> }>>>;
|
|
465
|
+
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
466
|
+
[key: string]: JsonValue;
|
|
467
|
+
};
|
|
453
468
|
/**
|
|
454
469
|
* A looser version of JsonValue that accepts interfaces.
|
|
455
470
|
* TypeScript interfaces don't have index signatures by default,
|
|
@@ -2074,5 +2089,5 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
|
|
|
2074
2089
|
onExecutorReady?(context: ExecutorReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
2075
2090
|
}
|
|
2076
2091
|
//#endregion
|
|
2077
|
-
export { FieldOptions as $, BeforeLoginHookArgs as A,
|
|
2078
|
-
//# sourceMappingURL=plugin-
|
|
2092
|
+
export { FieldOptions as $, BeforeLoginHookArgs as A, TailorDBTrigger as At, TailorAnyDBType as B, SCIMAttribute as Bt, TailorDBType as C, ExecutorInput as Ct, AuthExternalConfig as D, IncomingWebhookTrigger as Dt, AuthConnectionTokenResult as E, IdpUserTrigger as Et, UserAttributeListKey as F, IDToken as Ft, PermissionCondition as G, TenantProvider as Gt, TailorDBInstance as H, SCIMAuthorization as Ht, UserAttributeMap as I, IdProvider as It, unsafeAllowAllGqlPermission as J, TailorTypeGqlPermission as K, UsernameFieldKey as L, OAuth2ClientInput as Lt, OAuth2ClientGrantType as M, WorkflowOperation as Mt, SCIMAttributeType as N, AuthInvoker as Nt, AuthOwnConfig as O, ResolverExecutedTrigger as Ot, UserAttributeKey as P, BuiltinIdP as Pt, FieldMetadata as Q, ValueOperand as R, OIDC as Rt, TailorDBServiceInput as S, Executor as St, AuthConfig as T, GqlOperation as Tt, TailorDBType$1 as U, SCIMConfig as Ut, TailorDBField as V, SCIMAttributeMapping as Vt, db as W, SCIMResource as Wt, ArrayFieldOutput as X, unsafeAllowAllTypePermission as Y, DefinedFieldMetadata as Z, GeneratorResult as _, AuthConnectionOAuth2Config as _t, PluginExecutorContext as a, JsonCompatible as at, TailorDBNamespaceData as b, GeneratorConfig as bt, PluginGeneratedExecutorWithFile as c, AttributeList as ct, PluginNamespaceProcessContext as d, InferredAttributeMap as dt, FieldOutput$1 as et, PluginOutput as f, TailorUser as ft, ExecutorReadyContext as g, AuthConnectionConfig as gt, TypePluginOutput as h, AllowedValuesOutput as ht, PluginConfigs as i, InferFieldsOutput as it, DefinedAuth as j, WebhookOperation as jt, AuthServiceInput as k, ScheduleTriggerInput as kt, PluginGeneratedResolver as l, AttributeMap as lt, TailorDBTypeForPlugin as m, AllowedValues as mt, Plugin as n, TailorAnyField as nt, PluginExecutorContextBase as o, JsonValue as ot, PluginProcessContext as p, unauthenticatedTailorUser as pt, TailorTypePermission as q, PluginAttachment as r, TailorField as rt, PluginGeneratedExecutor as s, output as st, NamespacePluginOutput as t, TailorFieldType as tt, PluginGeneratedType as u, InferredAttributeList as ut, ResolverNamespaceData as v, Resolver as vt, TypeSourceInfoEntry as w, FunctionOperation as wt, TailorDBReadyContext as x, AuthAccessTokenTrigger as xt, ResolverReadyContext as y, ResolverInput as yt, TailorAnyDBField as z, SAML as zt };
|
|
2093
|
+
//# sourceMappingURL=plugin-_K3ZfP8B.d.mts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as ExecutorJobStatus, B as AuthSCIMAttribute_Type, C as TailorDBType_PermitAction, D as IdPPermissionPermit, E as IdPPermissionOperator, F as AuthIDPConfig_AuthType, G as UserProfileProviderConfig_UserProfileProviderType, H as AuthSCIMConfig_AuthorizationType, I as AuthInvokerSchema, J as Condition_Operator, K as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, L as AuthOAuth2Client_ClientType, M as ExecutorTriggerType, N as AuthConnection_Type, O as FunctionExecution_Status, P as AuthHookPoint, Q as Subgraph_ServiceType, R as AuthOAuth2Client_GrantType, S as TailorDBType_Permission_Permit, T as IdPLang, V as AuthSCIMAttribute_Uniqueness, W as TenantProviderConfig_TenantProviderType, X as PageDirection, Y as FilterSchema, Z as ApplicationSchemaUpdateAttemptStatus, _ as WorkflowJobExecution_Status, a as fetchMachineUserToken, b as TailorDBGQLPermission_Permit, f as platformBaseUrl, g as WorkflowExecution_Status, h as WorkspacePlatformUserRole, i as fetchAll, j as ExecutorTargetType, m as userAgent, p as resolveStaticWebsiteUrls, q as ConditionSchema, u as initOperatorClient, v as TailorDBGQLPermission_Action, w as PipelineResolver_OperationType, x as TailorDBType_Permission_Operator, y as TailorDBGQLPermission_Operator, z as AuthSCIMAttribute_Mutability } from "./client-
|
|
2
|
+
import { A as ExecutorJobStatus, B as AuthSCIMAttribute_Type, C as TailorDBType_PermitAction, D as IdPPermissionPermit, E as IdPPermissionOperator, F as AuthIDPConfig_AuthType, G as UserProfileProviderConfig_UserProfileProviderType, H as AuthSCIMConfig_AuthorizationType, I as AuthInvokerSchema, J as Condition_Operator, K as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, L as AuthOAuth2Client_ClientType, M as ExecutorTriggerType, N as AuthConnection_Type, O as FunctionExecution_Status, P as AuthHookPoint, Q as Subgraph_ServiceType, R as AuthOAuth2Client_GrantType, S as TailorDBType_Permission_Permit, T as IdPLang, V as AuthSCIMAttribute_Uniqueness, W as TenantProviderConfig_TenantProviderType, X as PageDirection, Y as FilterSchema, Z as ApplicationSchemaUpdateAttemptStatus, _ as WorkflowJobExecution_Status, a as fetchMachineUserToken, b as TailorDBGQLPermission_Permit, f as platformBaseUrl, g as WorkflowExecution_Status, h as WorkspacePlatformUserRole, i as fetchAll, j as ExecutorTargetType, m as userAgent, p as resolveStaticWebsiteUrls, q as ConditionSchema, u as initOperatorClient, v as TailorDBGQLPermission_Action, w as PipelineResolver_OperationType, x as TailorDBType_Permission_Operator, y as TailorDBGQLPermission_Operator, z as AuthSCIMAttribute_Mutability } from "./client-xzPXtc_e.mjs";
|
|
3
3
|
import { t as db } from "./schema-CnwUqPyM.mjs";
|
|
4
|
-
import { i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-
|
|
4
|
+
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-5_JMzHmw.mjs";
|
|
5
5
|
import { t as readPackageJson } from "./package-json-BHViVisJ.mjs";
|
|
6
|
-
import { S as readPlatformConfig, T as writePlatformConfig, _ as hashFile, a as loadConfig, b as loadAccessToken, c as createExecutorService, d as TailorDBTypeSchema, f as stringifyFunction, g as getDistDir, h as createBundleCache, m as loadFilesWithIgnores, n as generatePluginFilesIfNeeded, p as tailorUserMap, r as loadApplication, t as defineApplication, u as OAuth2ClientSchema, x as loadWorkspaceId } from "./application-
|
|
6
|
+
import { S as readPlatformConfig, T as writePlatformConfig, _ as hashFile, a as loadConfig, b as loadAccessToken, c as createExecutorService, d as TailorDBTypeSchema, f as stringifyFunction, g as getDistDir, h as createBundleCache, m as loadFilesWithIgnores, n as generatePluginFilesIfNeeded, p as tailorUserMap, r as loadApplication, t as defineApplication, u as OAuth2ClientSchema, x as loadWorkspaceId } from "./application-DhQrXEld.mjs";
|
|
7
7
|
import { r as withSpan } from "./telemetry-DwHuiNiR.mjs";
|
|
8
|
+
import { n as isCLIError, t as createCLIError } from "./errors-D9f2UJpT.mjs";
|
|
8
9
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
import * as fs$1 from "node:fs";
|
|
11
12
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
12
13
|
import { parseEnv } from "node:util";
|
|
13
14
|
import * as path from "pathe";
|
|
14
|
-
import chalk from "chalk";
|
|
15
15
|
import { formatDistanceToNowStrict } from "date-fns";
|
|
16
16
|
import { getBorderCharacters, table } from "table";
|
|
17
17
|
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
@@ -544,10 +544,16 @@ function collectAttributesFromConfig(config) {
|
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
546
546
|
* Resolve the output path for the generated type definition file.
|
|
547
|
+
*
|
|
548
|
+
* When the `TAILOR_PLATFORM_SDK_DTS_PATH` environment variable is set, the value is
|
|
549
|
+
* used as the output path (resolved relative to cwd when relative).
|
|
550
|
+
* Otherwise, the file is written next to the config file as `tailor.d.ts`.
|
|
547
551
|
* @param configPath - Path to Tailor config file
|
|
548
552
|
* @returns Absolute path to the type definition file
|
|
549
553
|
*/
|
|
550
554
|
function resolveTypeDefinitionPath(configPath) {
|
|
555
|
+
const envPath = process.env.TAILOR_PLATFORM_SDK_DTS_PATH;
|
|
556
|
+
if (envPath) return path.resolve(envPath);
|
|
551
557
|
return path.join(path.dirname(path.resolve(configPath)), "tailor.d.ts");
|
|
552
558
|
}
|
|
553
559
|
/**
|
|
@@ -4055,7 +4061,10 @@ function normalizeComparableExecutor(executor) {
|
|
|
4055
4061
|
...normalized.triggerConfig,
|
|
4056
4062
|
config: {
|
|
4057
4063
|
...normalized.triggerConfig.config,
|
|
4058
|
-
value: {
|
|
4064
|
+
value: {
|
|
4065
|
+
...normalized.triggerConfig.config.value,
|
|
4066
|
+
secret: void 0
|
|
4067
|
+
}
|
|
4059
4068
|
}
|
|
4060
4069
|
} : normalized.triggerConfig?.config?.case === "event" ? {
|
|
4061
4070
|
...normalized.triggerConfig,
|
|
@@ -4167,7 +4176,10 @@ function protoExecutor(application, executor) {
|
|
|
4167
4176
|
triggerType = ExecutorTriggerType.INCOMING_WEBHOOK;
|
|
4168
4177
|
triggerConfig = { config: {
|
|
4169
4178
|
case: "incomingWebhook",
|
|
4170
|
-
value: {
|
|
4179
|
+
value: { ...trigger.response ? { response: {
|
|
4180
|
+
...trigger.response.body ? { body: { expr: `(${stringifyFunction(trigger.response.body)})(${argsExpr})` } } : {},
|
|
4181
|
+
...trigger.response.statusCode != null ? { statusCode: trigger.response.statusCode } : {}
|
|
4182
|
+
} } : {} }
|
|
4171
4183
|
} };
|
|
4172
4184
|
break;
|
|
4173
4185
|
case "idpUser":
|
|
@@ -8313,7 +8325,7 @@ async function apply(options) {
|
|
|
8313
8325
|
const { config, application, workflowBuildResult, bundledScripts, buildOnly } = await withSpan("build", async () => {
|
|
8314
8326
|
const { config, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
|
|
8315
8327
|
const dryRun = options?.dryRun ?? false;
|
|
8316
|
-
const buildOnly = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY ===
|
|
8328
|
+
const buildOnly = options?.buildOnly ?? parseBoolean(process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY) === true;
|
|
8317
8329
|
const noCache = options?.noCache ?? false;
|
|
8318
8330
|
const packageJson = await readPackageJson();
|
|
8319
8331
|
const cacheDir = path.resolve(getDistDir(), "cache");
|
|
@@ -9490,9 +9502,11 @@ const startCommand = defineAppCommand({
|
|
|
9490
9502
|
args: z.object({
|
|
9491
9503
|
...deploymentArgs,
|
|
9492
9504
|
...nameArgs,
|
|
9493
|
-
|
|
9505
|
+
"machine-user": arg(z.string(), {
|
|
9494
9506
|
alias: "m",
|
|
9495
|
-
|
|
9507
|
+
hiddenAlias: "machineuser",
|
|
9508
|
+
description: "Machine user name",
|
|
9509
|
+
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
9496
9510
|
}),
|
|
9497
9511
|
arg: arg(z.string().optional(), {
|
|
9498
9512
|
alias: "a",
|
|
@@ -9503,7 +9517,7 @@ const startCommand = defineAppCommand({
|
|
|
9503
9517
|
run: async (args) => {
|
|
9504
9518
|
const { executionId, wait } = await startWorkflowByName({
|
|
9505
9519
|
name: args.name,
|
|
9506
|
-
machineUser: args
|
|
9520
|
+
machineUser: args["machine-user"],
|
|
9507
9521
|
arg: args.arg,
|
|
9508
9522
|
workspaceId: args["workspace-id"],
|
|
9509
9523
|
profile: args.profile,
|
|
@@ -12604,7 +12618,7 @@ async function generate(options) {
|
|
|
12604
12618
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
12605
12619
|
let pluginManager;
|
|
12606
12620
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
12607
|
-
const { defineApplication } = await import("./application-
|
|
12621
|
+
const { defineApplication } = await import("./application-C1ipG5Q6.mjs");
|
|
12608
12622
|
const application = defineApplication({
|
|
12609
12623
|
config,
|
|
12610
12624
|
pluginManager
|
|
@@ -13918,44 +13932,6 @@ async function bundleQueryScript(engine) {
|
|
|
13918
13932
|
})).output[0].code;
|
|
13919
13933
|
}
|
|
13920
13934
|
|
|
13921
|
-
//#endregion
|
|
13922
|
-
//#region src/cli/shared/errors.ts
|
|
13923
|
-
/**
|
|
13924
|
-
* Format CLI error for output
|
|
13925
|
-
* @param error - CLIError instance to format
|
|
13926
|
-
* @returns Formatted error message
|
|
13927
|
-
*/
|
|
13928
|
-
function formatError(error) {
|
|
13929
|
-
const parts = [chalk.red(`Error${error.code ? ` [${error.code}]` : ""}: ${error.message}`)];
|
|
13930
|
-
if (error.details) parts.push(`\n ${chalk.gray("Details:")} ${error.details}`);
|
|
13931
|
-
if (error.suggestion) parts.push(`\n ${chalk.cyan("Suggestion:")} ${error.suggestion}`);
|
|
13932
|
-
if (error.command) parts.push(`\n ${chalk.gray("Help:")} Run \`tailor-sdk ${error.command} --help\` for usage information.`);
|
|
13933
|
-
return parts.join("");
|
|
13934
|
-
}
|
|
13935
|
-
/**
|
|
13936
|
-
* Create a CLI error with formatted output
|
|
13937
|
-
* @param options - Options to construct a CLIError
|
|
13938
|
-
* @returns Constructed CLIError instance
|
|
13939
|
-
*/
|
|
13940
|
-
function createCLIError(options) {
|
|
13941
|
-
const error = new Error(options.message);
|
|
13942
|
-
error.name = "CLIError";
|
|
13943
|
-
error.code = options.code;
|
|
13944
|
-
error.details = options.details;
|
|
13945
|
-
error.suggestion = options.suggestion;
|
|
13946
|
-
error.command = options.command;
|
|
13947
|
-
error.format = () => formatError(error);
|
|
13948
|
-
return error;
|
|
13949
|
-
}
|
|
13950
|
-
/**
|
|
13951
|
-
* Type guard to check if an error is a CLIError
|
|
13952
|
-
* @param error - Error to check
|
|
13953
|
-
* @returns True if the error is a CLIError
|
|
13954
|
-
*/
|
|
13955
|
-
function isCLIError(error) {
|
|
13956
|
-
return error instanceof Error && error.name === "CLIError";
|
|
13957
|
-
}
|
|
13958
|
-
|
|
13959
13935
|
//#endregion
|
|
13960
13936
|
//#region src/cli/query/errors.ts
|
|
13961
13937
|
function toErrorMessage(error) {
|
|
@@ -14644,9 +14620,11 @@ const queryCommand = defineAppCommand({
|
|
|
14644
14620
|
description: "Read query string from file; omit to start REPL mode"
|
|
14645
14621
|
}),
|
|
14646
14622
|
edit: arg(z.boolean().default(false), { description: "Open a temporary file in your editor; omit to start REPL mode" }),
|
|
14647
|
-
|
|
14623
|
+
"machine-user": arg(z.string(), {
|
|
14648
14624
|
alias: "m",
|
|
14649
|
-
|
|
14625
|
+
hiddenAlias: "machineuser",
|
|
14626
|
+
description: "Machine user name for query execution",
|
|
14627
|
+
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
14650
14628
|
})
|
|
14651
14629
|
}).superRefine((args, ctx) => {
|
|
14652
14630
|
if (args.query != null && args.file != null) ctx.addIssue({
|
|
@@ -14677,7 +14655,7 @@ const queryCommand = defineAppCommand({
|
|
|
14677
14655
|
profile: args.profile,
|
|
14678
14656
|
configPath: args.config,
|
|
14679
14657
|
engine: args.engine,
|
|
14680
|
-
machineUser: args
|
|
14658
|
+
machineUser: args["machine-user"]
|
|
14681
14659
|
};
|
|
14682
14660
|
if (mode.mode === "abort") {
|
|
14683
14661
|
logger.info("Editor closed without a query. Nothing was executed.");
|
|
@@ -14806,5 +14784,5 @@ function isDeno() {
|
|
|
14806
14784
|
}
|
|
14807
14785
|
|
|
14808
14786
|
//#endregion
|
|
14809
|
-
export {
|
|
14810
|
-
//# sourceMappingURL=runtime-
|
|
14787
|
+
export { deleteCommand$1 as $, isValidMigrationNumber as $t, truncate as A, formatKeyValueTable as At, updateOrganization as B, DIFF_FILE_NAME as Bt, listCommand$2 as C, startWorkflow as Ct, resumeWorkflow as D, getWorkflowExecution as Dt, resumeCommand as E, executionsCommand as Et, showCommand as F, waitForExecution$1 as Ft, getCommand$1 as G, compareSnapshots as Gt, treeCommand as H, MIGRATE_FILE_NAME as Ht, logBetaWarning as I, MIGRATION_LABEL_KEY as It, updateFolder as J, getLatestMigrationNumber as Jt, getOrganization as K, createSnapshotFromLocalTypes as Kt, remove as L, parseMigrationLabelNumber as Lt, generate as M, getExecutor as Mt, generateCommand as N, apply as Nt, listCommand$3 as O, listWorkflowExecutions as Ot, show as P, executeScript as Pt, getFolder as Q, getNextMigrationNumber as Qt, removeCommand$1 as R, bundleMigrationScript as Rt, listApps as S, startCommand as St, healthCommand as T, getWorkflow as Tt, listCommand$4 as U, SCHEMA_FILE_NAME as Ut, organizationTree as V, INITIAL_SCHEMA_NUMBER as Vt, listOrganizations as W, compareLocalTypesWithSnapshot as Wt, listFolders as X, getMigrationFilePath as Xt, listCommand$5 as Y, getMigrationDirPath as Yt, getCommand$2 as Z, getMigrationFiles as Zt, getWorkspace as _, workspaceArgs as _n, listExecutors as _t, updateUser as a, getNamespacesWithMigrations as an, getCommand$3 as at, createCommand as b, listExecutorJobs as bt, listCommand as c, trnPrefix as cn, tokenCommand as ct, inviteUser as d, apiCommand as dn, generate$1 as dt, loadDiff as en, deleteFolder as et, restoreCommand as f, defineAppCommand as fn, listWebhookExecutors as ft, getCommand as g, isVerbose as gn, listCommand$8 as gt, listWorkspaces as h, deploymentArgs as hn, triggerExecutor as ht, updateCommand as i, hasChanges as in, listOAuth2Clients as it, truncateCommand as j, getCommand$5 as jt, listWorkflows as k, functionExecutionStatusToString as kt, listUsers as l, generateUserTypes as ln, listCommand$7 as lt, listCommand$1 as m, confirmationArgs as mn, triggerCommand as mt, query as n, formatDiffSummary as nn, createFolder as nt, removeCommand as o, prompt as on, getOAuth2Client as ot, restoreWorkspace as p, commonArgs as pn, webhookCommand as pt, updateCommand$2 as q, formatMigrationNumber as qt, queryCommand as r, formatMigrationDiff as rn, listCommand$6 as rt, removeUser as s, sdkNameLabelKey as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, reconstructSnapshotFromMigrations as tn, createCommand$1 as tt, inviteCommand as u, apiCall as un, listMachineUsers as ut, deleteCommand as v, getExecutorJob as vt, getAppHealth as w, getCommand$4 as wt, createWorkspace as x, watchExecutorJob as xt, deleteWorkspace as y, jobsCommand as yt, updateCommand$1 as z, DB_TYPES_FILE_NAME as zt };
|
|
14788
|
+
//# sourceMappingURL=runtime-DtSOnOHh.mjs.map
|