@tailor-platform/sdk 2.0.0-next.0 → 2.0.0-next.1
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 +105 -0
- package/dist/application-DB2r36Et.mjs +3 -0
- package/dist/{application-76hhIhnJ.mjs → application-DqS1yBg3.mjs} +217 -131
- package/dist/application-DqS1yBg3.mjs.map +1 -0
- package/dist/{assert-CKfwrmCV.mjs → assert-DBxo8jPo.mjs} +1 -2
- package/dist/{assert-CKfwrmCV.mjs.map → assert-DBxo8jPo.mjs.map} +1 -1
- package/dist/{authconnection-D8SJGMpj.mjs → authconnection-D2MhtTN5.mjs} +2 -3
- package/dist/{authconnection-D8SJGMpj.mjs.map → authconnection-D2MhtTN5.mjs.map} +1 -1
- package/dist/{authconnection-BIYzEh2p.d.mts → authconnection-DvUQAjQS.d.mts} +1 -1
- package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
- package/dist/{brand-DlnJ375c.mjs.map → brand-Eo4pLXPJ.mjs.map} +1 -1
- package/dist/cli/index.mjs +78 -131
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +619 -751
- package/dist/cli/lib.mjs +9 -10
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/{client-C68VWo4g.mjs → client-Dbohmtkv.mjs} +1 -2
- package/dist/{client-CobIRHl-.mjs → client-z_oHGVNy.mjs} +10 -7
- package/dist/client-z_oHGVNy.mjs.map +1 -0
- package/dist/completion/zsh-worker.zsh +4029 -0
- package/dist/configure/index.d.mts +8 -7
- package/dist/configure/index.mjs +27 -28
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{context-s0lxhu8_.mjs → context-Bd266-ru.mjs} +2 -3
- package/dist/{context-s0lxhu8_.mjs.map → context-Bd266-ru.mjs.map} +1 -1
- package/dist/{context-CUBwSBq4.d.mts → context-BuuIb8CC.d.mts} +1 -1
- package/dist/{crashreport-BhD0y14F.mjs → crashreport-BsjAkFWw.mjs} +19 -10
- package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-BsjAkFWw.mjs.map} +1 -1
- package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-pr6Rhvza.mjs} +1 -2
- package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -0
- package/dist/{errors-EsY4XO6O.mjs → errors-Dtf2WPaW.mjs} +1 -2
- package/dist/{errors-EsY4XO6O.mjs.map → errors-Dtf2WPaW.mjs.map} +1 -1
- package/dist/{field-C4zdJLW5.mjs → field-DOsJCPFa.mjs} +1 -2
- package/dist/field-DOsJCPFa.mjs.map +1 -0
- package/dist/{file-BzK8z3X-.d.mts → file-BB8Vs9O_.d.mts} +1 -1
- package/dist/{file-B58Dm-2P.mjs → file-_oUZo76X.mjs} +2 -3
- package/dist/{file-B58Dm-2P.mjs.map → file-_oUZo76X.mjs.map} +1 -1
- package/dist/{file-utils-BHPxPXmn.mjs → file-utils-DcyIPFQh.mjs} +2 -3
- package/dist/{file-utils-BHPxPXmn.mjs.map → file-utils-DcyIPFQh.mjs.map} +1 -1
- package/dist/{globals-ByrCoDip.mjs → globals-Crz8o65k.mjs} +53 -5
- package/dist/globals-Crz8o65k.mjs.map +1 -0
- package/dist/http-adapter.generated-WgMnb7Sb.d.mts +580 -0
- package/dist/{iconv-kwrmd1U_.d.mts → iconv-Co-TOPuH.d.mts} +1 -1
- package/dist/{iconv-DreIffeM.mjs → iconv-D2vi8G36.mjs} +2 -3
- package/dist/{iconv-DreIffeM.mjs.map → iconv-D2vi8G36.mjs.map} +1 -1
- package/dist/{idp-Ch95ag8h.mjs → idp-BDbK5gjm.mjs} +2 -3
- package/dist/{idp-Ch95ag8h.mjs.map → idp-BDbK5gjm.mjs.map} +1 -1
- package/dist/{idp-BlBPtXJ-.d.mts → idp-DrhVrLmV.d.mts} +1 -1
- package/dist/{index-CQZVJ5SX.d.mts → index-5vPyRu1y.d.mts} +2 -2
- package/dist/{index-CfRFkXIO.d.mts → index-B7AKc18V.d.mts} +2 -2
- package/dist/{index-CLxubakC.d.mts → index-BlpzXncY.d.mts} +38 -247
- package/dist/{index-DRhMpdnA.d.mts → index-CK7u9isy.d.mts} +8 -8
- package/dist/{index-DUupuPhZ.d.mts → index-CNYe5lnW.d.mts} +2 -2
- package/dist/{index-CPRnOjjt.d.mts → index-DjUdWlzf.d.mts} +2 -2
- package/dist/index-ZePLwxw7.d.mts +208 -0
- package/dist/{interceptor-DOqRkCya.mjs → interceptor-D-q1rvRl.mjs} +1 -2
- package/dist/{interceptor-DOqRkCya.mjs.map → interceptor-D-q1rvRl.mjs.map} +1 -1
- package/dist/{job-BpsFXPbi.mjs → job-fuc3j1Ma.mjs} +9 -10
- package/dist/job-fuc3j1Ma.mjs.map +1 -0
- package/dist/kysely/index.mjs +0 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-DR8uzZTA.mjs} +2 -3
- package/dist/kysely-type-DR8uzZTA.mjs.map +1 -0
- package/dist/{logger-DpJyJvNz.mjs → logger-CxF-Ex5d.mjs} +1 -2
- package/dist/{logger-DpJyJvNz.mjs.map → logger-CxF-Ex5d.mjs.map} +1 -1
- package/dist/{mock-DMgIygjE.mjs → mock-BjFj5o1I.mjs} +9 -11
- package/dist/mock-BjFj5o1I.mjs.map +1 -0
- package/dist/{multiline-Cf9ODpr1.mjs → multiline-sfHpTZZK.mjs} +1 -2
- package/dist/{multiline-Cf9ODpr1.mjs.map → multiline-sfHpTZZK.mjs.map} +1 -1
- package/dist/{package-json-DcQApfPQ.mjs → package-json-8b0O9TlX.mjs} +1 -2
- package/dist/{package-json-DcQApfPQ.mjs.map → package-json-8b0O9TlX.mjs.map} +1 -1
- package/dist/package-json-Cv2Z-TqQ.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -2
- package/dist/plugin/index.d.mts +1 -3
- package/dist/plugin/index.mjs +0 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/registry-DdsYlL_P.mjs +51 -0
- package/dist/registry-DdsYlL_P.mjs.map +1 -0
- package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-DmGr9zMw.mjs} +2 -3
- package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-DmGr9zMw.mjs.map} +1 -1
- package/dist/{chunk-BkoGK1jX.mjs → rolldown-runtime-DXywRVcq.mjs} +0 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/authconnection.mjs +1 -2
- package/dist/runtime/context.d.mts +1 -1
- package/dist/runtime/context.mjs +1 -2
- package/dist/runtime/file.d.mts +1 -1
- package/dist/runtime/file.mjs +1 -2
- package/dist/runtime/globals.d.mts +6 -39
- package/dist/runtime/globals.mjs +0 -1
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/iconv.mjs +1 -2
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/idp.mjs +1 -2
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.mjs +7 -8
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/secretmanager.mjs +1 -2
- package/dist/runtime/workflow.d.mts +1 -1
- package/dist/runtime/workflow.mjs +1 -2
- package/dist/{runtime-C7qTBDD2.mjs → runtime-n9NCkjee.mjs} +301 -317
- package/dist/runtime-n9NCkjee.mjs.map +1 -0
- package/dist/{schema-1msIhXwA.mjs → schema-BhkpP5Hw.mjs} +3 -4
- package/dist/schema-BhkpP5Hw.mjs.map +1 -0
- package/dist/{secret-file-CWzF8rry.mjs → secret-file-DBqZhjFQ.mjs} +1 -2
- package/dist/{secret-file-CWzF8rry.mjs.map → secret-file-DBqZhjFQ.mjs.map} +1 -1
- package/dist/{secretmanager-CKLB3wAQ.d.mts → secretmanager-B3n4KHfm.d.mts} +1 -1
- package/dist/{secretmanager-B9h-U_8U.mjs → secretmanager-BVxw3ih_.mjs} +2 -3
- package/dist/{secretmanager-B9h-U_8U.mjs.map → secretmanager-BVxw3ih_.mjs.map} +1 -1
- package/dist/seed/index.mjs +0 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-BH2FbrPV.mjs → seed-jf3008-h.mjs} +5 -16
- package/dist/seed-jf3008-h.mjs.map +1 -0
- package/dist/{service-wI3Hvrgx.mjs → service-CCL8ruDf.mjs} +3 -4
- package/dist/service-CCL8ruDf.mjs.map +1 -0
- package/dist/service-D6yonf2I.mjs +3 -0
- package/dist/{service-DMohAx8a2.mjs → service-DU1mVzri.mjs} +3 -4
- package/dist/service-DU1mVzri.mjs.map +1 -0
- package/dist/{telemetry-BQbbVo2t.mjs → telemetry-CdqJEzkj.mjs} +2 -3
- package/dist/{telemetry-BQbbVo2t.mjs.map → telemetry-CdqJEzkj.mjs.map} +1 -1
- package/dist/telemetry-ClwW5ohF.mjs +3 -0
- package/dist/test-env-key-D9kM6ETE.mjs +49 -0
- package/dist/test-env-key-D9kM6ETE.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/{types-CmzfQP_m.mjs → types-B2RpYyA_.mjs} +2 -3
- package/dist/types-B2RpYyA_.mjs.map +1 -0
- package/dist/types-ClhIrW_C.mjs +4 -0
- package/dist/{tailordb-BlBGmQK-.d.mts → types-DCUhgpyI.d.mts} +142 -221
- package/dist/{plugin-C_FyVSdl.d.mts → types-DhO_VEZd.d.mts} +119 -179
- package/dist/types-DwDgacni.d.mts +338 -0
- package/dist/utils/test/index.d.mts +4 -3
- package/dist/utils/test/index.mjs +1 -2
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +1 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +42 -5
- package/dist/vitest/index.mjs +133 -4
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.mjs +2 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/{workflow-CMamswkK.d.mts → workflow-BbKvGLQg.d.mts} +1 -1
- package/dist/{workflow--aPbA8Uq.mjs → workflow-DgemCAz3.mjs} +2 -3
- package/dist/{workflow--aPbA8Uq.mjs.map → workflow-DgemCAz3.mjs.map} +1 -1
- package/dist/workflow.generated-DtQwEo-x.d.mts +671 -0
- package/docs/cli/application.md +0 -2
- package/docs/cli/completion.md +3 -0
- package/docs/cli/crashreport.md +0 -2
- package/docs/cli/function.md +1 -1
- package/docs/cli/user.md +3 -3
- package/docs/cli/workspace.md +3 -3
- package/docs/configuration.md +0 -2
- package/docs/plugin/custom.md +2 -2
- package/docs/plugin/index.md +1 -1
- package/docs/runtime.md +3 -3
- package/docs/services/aigateway.md +97 -0
- package/docs/services/auth.md +19 -2
- package/docs/services/executor.md +0 -2
- package/docs/services/resolver.md +2 -4
- package/docs/services/tailordb.md +1 -1
- package/docs/services/workflow.md +13 -15
- package/docs/testing.md +18 -11
- package/package.json +13 -12
- package/dist/actor-J2gJ0eK5.d.mts +0 -24
- package/dist/application-76hhIhnJ.mjs.map +0 -1
- package/dist/application-av2raLs6.mjs +0 -4
- package/dist/cli/skills.d.mts +0 -1
- package/dist/cli/skills.mjs +0 -22
- package/dist/cli/skills.mjs.map +0 -1
- package/dist/client-CobIRHl-.mjs.map +0 -1
- package/dist/enum-constants-C7DaWeQo.mjs.map +0 -1
- package/dist/env-B-g-qgE4.d.mts +0 -7
- package/dist/field-C4zdJLW5.mjs.map +0 -1
- package/dist/globals-ByrCoDip.mjs.map +0 -1
- package/dist/job-BpsFXPbi.mjs.map +0 -1
- package/dist/kysely-type-D1e0Vwkd.mjs.map +0 -1
- package/dist/mock-DMgIygjE.mjs.map +0 -1
- package/dist/package-json-wzO6nV9O.mjs +0 -4
- package/dist/registry-D0uB0OrK.mjs +0 -178
- package/dist/registry-D0uB0OrK.mjs.map +0 -1
- package/dist/runtime-C7qTBDD2.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/seed-BH2FbrPV.mjs.map +0 -1
- package/dist/service-BHQIerYh.mjs +0 -4
- package/dist/service-DMohAx8a2.mjs.map +0 -1
- package/dist/service-wI3Hvrgx.mjs.map +0 -1
- package/dist/telemetry-w92bvGdC.mjs +0 -4
- package/dist/types-2Be3wSMc.mjs +0 -5
- package/dist/types-CmzfQP_m.mjs.map +0 -1
- package/dist/workflow.generated-Bf1tWylx.d.mts +0 -1416
- package/docs/generator/builtin.md +0 -257
- package/docs/generator/custom.md +0 -147
- package/docs/generator/index.md +0 -66
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-BH2FbrPV.mjs";
|
|
12
|
-
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
13
|
-
import { t as createCLIError } from "./errors-EsY4XO6O.mjs";
|
|
14
|
-
import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-CWzF8rry.mjs";
|
|
1
|
+
import { n as isSdkBranded } from "./brand-Eo4pLXPJ.mjs";
|
|
2
|
+
import { a as fetchAll, d as initOAuth2Client, l as fetchUserInfo } from "./client-z_oHGVNy.mjs";
|
|
3
|
+
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
4
|
+
import { a as parseBoolean, n as logger, r as styles } from "./logger-CxF-Ex5d.mjs";
|
|
5
|
+
import { a as TailorFieldSchema, i as AuthInvokerSchema, n as ExecutorSchema, o as loadFilesWithIgnores, r as AuthConfigSchema, s as functionSchema, t as createExecutorService } from "./service-CCL8ruDf.mjs";
|
|
6
|
+
import { t as multiline } from "./multiline-sfHpTZZK.mjs";
|
|
7
|
+
import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
8
|
+
import { t as createCLIError } from "./errors-Dtf2WPaW.mjs";
|
|
9
|
+
import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-DBqZhjFQ.mjs";
|
|
10
|
+
import { t as isPluginGeneratedType } from "./type-source-DH_LH20p.mjs";
|
|
15
11
|
import { builtinModules, createRequire } from "node:module";
|
|
16
12
|
import { z } from "zod";
|
|
17
13
|
import * as fs$1 from "node:fs";
|
|
@@ -83,46 +79,10 @@ const AppConfigSchema = z.object({
|
|
|
83
79
|
workflow: z.unknown().optional(),
|
|
84
80
|
httpAdapter: z.unknown().optional(),
|
|
85
81
|
staticWebsites: z.unknown().optional(),
|
|
82
|
+
aiGateways: z.unknown().optional(),
|
|
86
83
|
secrets: z.unknown().optional()
|
|
87
84
|
});
|
|
88
85
|
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/parser/generator-config/schema.ts
|
|
91
|
-
const DependencyKindSchema = z.enum([
|
|
92
|
-
"tailordb",
|
|
93
|
-
"resolver",
|
|
94
|
-
"executor"
|
|
95
|
-
]);
|
|
96
|
-
const KyselyTypeConfigSchema = z.tuple([z.literal("@tailor-platform/kysely-type"), z.object({ distPath: z.string() })]);
|
|
97
|
-
const SeedConfigSchema = z.tuple([z.literal("@tailor-platform/seed"), z.object({
|
|
98
|
-
distPath: z.string(),
|
|
99
|
-
machineUserName: z.string().optional(),
|
|
100
|
-
disableIdpUserSync: z.object({
|
|
101
|
-
userToIdp: z.boolean().optional(),
|
|
102
|
-
idpToUser: z.boolean().optional()
|
|
103
|
-
}).optional()
|
|
104
|
-
})]);
|
|
105
|
-
const EnumConstantsConfigSchema = z.tuple([z.literal("@tailor-platform/enum-constants"), z.object({ distPath: z.string() })]);
|
|
106
|
-
const FileUtilsConfigSchema = z.tuple([z.literal("@tailor-platform/file-utils"), z.object({ distPath: z.string() })]);
|
|
107
|
-
const CodeGeneratorSchema = z.object({
|
|
108
|
-
id: z.string(),
|
|
109
|
-
description: z.string(),
|
|
110
|
-
dependencies: z.array(DependencyKindSchema),
|
|
111
|
-
processType: z.function().optional(),
|
|
112
|
-
processResolver: z.function().optional(),
|
|
113
|
-
processExecutor: z.function().optional(),
|
|
114
|
-
processTailorDBNamespace: z.function().optional(),
|
|
115
|
-
processResolverNamespace: z.function().optional(),
|
|
116
|
-
aggregate: z.function({ output: z.any() })
|
|
117
|
-
});
|
|
118
|
-
const BaseGeneratorConfigSchema = z.union([
|
|
119
|
-
KyselyTypeConfigSchema,
|
|
120
|
-
SeedConfigSchema,
|
|
121
|
-
EnumConstantsConfigSchema,
|
|
122
|
-
FileUtilsConfigSchema,
|
|
123
|
-
CodeGeneratorSchema
|
|
124
|
-
]);
|
|
125
|
-
|
|
126
86
|
//#endregion
|
|
127
87
|
//#region src/parser/plugin-config/schema.ts
|
|
128
88
|
const PluginConfigSchema = z.object({
|
|
@@ -140,15 +100,6 @@ const PluginConfigSchema = z.object({
|
|
|
140
100
|
return !(p.onTypeLoaded || p.onNamespaceLoaded) || !!p.importPath;
|
|
141
101
|
}, { message: "importPath is required when plugin has definition-time hooks (onTypeLoaded/onNamespaceLoaded)" }).transform((plugin) => plugin);
|
|
142
102
|
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region src/plugin/builtin/registry.ts
|
|
145
|
-
const builtinPlugins = new Map([
|
|
146
|
-
[KyselyGeneratorID, (options) => kyselyTypePlugin(options)],
|
|
147
|
-
[SeedGeneratorID, (options) => seedPlugin(options)],
|
|
148
|
-
[EnumConstantsGeneratorID, (options) => enumConstantsPlugin(options)],
|
|
149
|
-
[FileUtilsGeneratorID, (options) => fileUtilsPlugin(options)]
|
|
150
|
-
]);
|
|
151
|
-
|
|
152
103
|
//#endregion
|
|
153
104
|
//#region src/cli/shared/token-store.ts
|
|
154
105
|
const SERVICE_NAME = "tailor-platform-cli";
|
|
@@ -237,14 +188,19 @@ const pfUserFileSchema = z.object({
|
|
|
237
188
|
refresh_token: z.string().optional()
|
|
238
189
|
});
|
|
239
190
|
const pfUserSchemaV2 = z.discriminatedUnion("storage", [pfUserKeyringSchema, pfUserFileSchema]);
|
|
191
|
+
const pfUserKeyringSchemaV3 = pfUserKeyringSchema.extend({ email: z.string().optional() });
|
|
192
|
+
const pfUserFileSchemaV3 = pfUserFileSchema.extend({ email: z.string().optional() });
|
|
193
|
+
const pfUserSchemaV3 = z.discriminatedUnion("storage", [pfUserKeyringSchemaV3, pfUserFileSchemaV3]);
|
|
240
194
|
const pfConfigSchemaV1 = z.object({
|
|
241
195
|
version: z.literal(1),
|
|
242
196
|
users: z.partialRecord(z.string(), pfUserSchemaV1),
|
|
243
197
|
profiles: z.partialRecord(z.string(), pfProfileSchema),
|
|
244
198
|
current_user: z.string().nullable()
|
|
245
199
|
});
|
|
246
|
-
const
|
|
200
|
+
const V2_CONFIG_VERSION = 2;
|
|
201
|
+
const LATEST_CONFIG_VERSION = 3;
|
|
247
202
|
const V2_MIN_SDK_VERSION = "1.29.0";
|
|
203
|
+
const V3_MIN_SDK_VERSION = "2.0.0";
|
|
248
204
|
const semverSchema = z.templateLiteral([
|
|
249
205
|
z.number().int(),
|
|
250
206
|
".",
|
|
@@ -253,7 +209,7 @@ const semverSchema = z.templateLiteral([
|
|
|
253
209
|
z.number().int()
|
|
254
210
|
]);
|
|
255
211
|
const pfConfigSchemaV2 = z.object({
|
|
256
|
-
version: z.literal(
|
|
212
|
+
version: z.literal(V2_CONFIG_VERSION),
|
|
257
213
|
min_sdk_version: semverSchema,
|
|
258
214
|
latest_version: z.number().int().optional(),
|
|
259
215
|
latest_min_sdk_version: semverSchema.optional(),
|
|
@@ -261,6 +217,15 @@ const pfConfigSchemaV2 = z.object({
|
|
|
261
217
|
profiles: z.partialRecord(z.string(), pfProfileSchema),
|
|
262
218
|
current_user: z.string().nullable()
|
|
263
219
|
});
|
|
220
|
+
const pfConfigSchemaV3 = z.object({
|
|
221
|
+
version: z.literal(LATEST_CONFIG_VERSION),
|
|
222
|
+
min_sdk_version: semverSchema,
|
|
223
|
+
latest_version: z.number().int().optional(),
|
|
224
|
+
latest_min_sdk_version: semverSchema.optional(),
|
|
225
|
+
users: z.partialRecord(z.string(), pfUserSchemaV3),
|
|
226
|
+
profiles: z.partialRecord(z.string(), pfProfileSchema),
|
|
227
|
+
current_user: z.string().nullable()
|
|
228
|
+
});
|
|
264
229
|
function platformConfigPath() {
|
|
265
230
|
if (!xdgConfig) throw new Error("User home directory not found");
|
|
266
231
|
return path.join(xdgConfig, "tailor-platform", "config.yaml");
|
|
@@ -284,13 +249,48 @@ function migrateV1ToV2(v1Config) {
|
|
|
284
249
|
};
|
|
285
250
|
}
|
|
286
251
|
return {
|
|
287
|
-
version:
|
|
252
|
+
version: V2_CONFIG_VERSION,
|
|
288
253
|
min_sdk_version: V2_MIN_SDK_VERSION,
|
|
289
254
|
users,
|
|
290
255
|
profiles: v1Config.profiles,
|
|
291
256
|
current_user: v1Config.current_user
|
|
292
257
|
};
|
|
293
258
|
}
|
|
259
|
+
function inferEmailFromUserId(user) {
|
|
260
|
+
return z.email().safeParse(user).success ? user : void 0;
|
|
261
|
+
}
|
|
262
|
+
function findConfigUserKey(config, user) {
|
|
263
|
+
if (config.users[user]) return user;
|
|
264
|
+
return Object.entries(config.users).find(([, entry]) => entry?.email === user)?.[0];
|
|
265
|
+
}
|
|
266
|
+
function migrateV2ToV3(v2Config) {
|
|
267
|
+
const users = {};
|
|
268
|
+
for (const [user, entry] of Object.entries(v2Config.users)) {
|
|
269
|
+
if (!entry) continue;
|
|
270
|
+
const email = inferEmailFromUserId(user);
|
|
271
|
+
users[user] = {
|
|
272
|
+
...entry,
|
|
273
|
+
...email ? { email } : {}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
version: LATEST_CONFIG_VERSION,
|
|
278
|
+
min_sdk_version: V3_MIN_SDK_VERSION,
|
|
279
|
+
users,
|
|
280
|
+
profiles: v2Config.profiles,
|
|
281
|
+
current_user: v2Config.current_user
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function migrateV1ToV3(v1Config) {
|
|
285
|
+
return migrateV2ToV3(migrateV1ToV2(v1Config));
|
|
286
|
+
}
|
|
287
|
+
async function warnIfNewerConfigAvailable(config) {
|
|
288
|
+
if (!config.latest_min_sdk_version) return;
|
|
289
|
+
if (lt((await readPackageJson()).version ?? "0.0.0", config.latest_min_sdk_version)) logger.warn(multiline`
|
|
290
|
+
A newer config version (${String(config.latest_version)}) is available.
|
|
291
|
+
Please update your SDK to >= ${config.latest_min_sdk_version}: pnpm update @tailor-platform/sdk
|
|
292
|
+
`);
|
|
293
|
+
}
|
|
294
294
|
/**
|
|
295
295
|
* Read Tailor Platform CLI configuration, migrating from tailorctl or v1 if necessary.
|
|
296
296
|
* @returns Parsed platform configuration
|
|
@@ -307,7 +307,7 @@ async function readPlatformConfig() {
|
|
|
307
307
|
current_user: null
|
|
308
308
|
};
|
|
309
309
|
writePlatformConfig(v1Config);
|
|
310
|
-
return
|
|
310
|
+
return migrateV1ToV3(v1Config);
|
|
311
311
|
}
|
|
312
312
|
const rawConfig = parseYAML(fs$1.readFileSync(configPath, "utf-8"));
|
|
313
313
|
tightenSecretFilePermissions(configPath);
|
|
@@ -320,18 +320,18 @@ async function readPlatformConfig() {
|
|
|
320
320
|
${updateHint}
|
|
321
321
|
`);
|
|
322
322
|
}
|
|
323
|
+
const v3Result = pfConfigSchemaV3.safeParse(rawConfig);
|
|
324
|
+
if (v3Result.success) {
|
|
325
|
+
await warnIfNewerConfigAvailable(v3Result.data);
|
|
326
|
+
return v3Result.data;
|
|
327
|
+
}
|
|
323
328
|
const v2Result = pfConfigSchemaV2.safeParse(rawConfig);
|
|
324
329
|
if (v2Result.success) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
A newer config version (${String(v2Result.data.latest_version)}) is available.
|
|
328
|
-
Please update your SDK to >= ${v2Result.data.latest_min_sdk_version}: pnpm update @tailor-platform/sdk
|
|
329
|
-
`);
|
|
330
|
-
}
|
|
331
|
-
return v2Result.data;
|
|
330
|
+
await warnIfNewerConfigAvailable(v2Result.data);
|
|
331
|
+
return migrateV2ToV3(v2Result.data);
|
|
332
332
|
}
|
|
333
333
|
const v1Result = pfConfigSchemaV1.safeParse(rawConfig);
|
|
334
|
-
if (v1Result.success) return
|
|
334
|
+
if (v1Result.success) return migrateV1ToV3(v1Result.data);
|
|
335
335
|
throw new Error(multiline`
|
|
336
336
|
Failed to parse config file at ${configPath}.
|
|
337
337
|
The file may be corrupted or created by an incompatible SDK version.
|
|
@@ -360,9 +360,9 @@ function toV1ForDisk(config) {
|
|
|
360
360
|
* By default, V2 configs are converted to V1 for backward compatibility, so an
|
|
361
361
|
* older SDK can still read the file. Configs containing a keyring user are kept
|
|
362
362
|
* as V2 regardless, because the keyring storage variant is not representable in
|
|
363
|
-
* V1 and downgrading it would silently drop the user's login.
|
|
364
|
-
*
|
|
365
|
-
*
|
|
363
|
+
* V1 and downgrading it would silently drop the user's login. V3 configs are
|
|
364
|
+
* kept as V3 because user keys are canonical subject IDs and may include email
|
|
365
|
+
* metadata that is not representable in older versions.
|
|
366
366
|
* Set TAILOR_USE_KEYRING to write V2 format unconditionally.
|
|
367
367
|
*
|
|
368
368
|
* The config file may contain access/refresh tokens when the OS keyring is
|
|
@@ -505,7 +505,7 @@ async function loadAccessToken(opts) {
|
|
|
505
505
|
`);
|
|
506
506
|
user = u;
|
|
507
507
|
}
|
|
508
|
-
return await fetchLatestToken(pfConfig, user);
|
|
508
|
+
return (await fetchLatestToken(pfConfig, user)).accessToken;
|
|
509
509
|
}
|
|
510
510
|
/**
|
|
511
511
|
* Resolve the actual token values for a user, reading from keyring or config as appropriate.
|
|
@@ -532,22 +532,26 @@ async function resolveTokens(userEntry, user) {
|
|
|
532
532
|
* @param config - Platform config
|
|
533
533
|
* @param user - User identifier
|
|
534
534
|
* @param tokens - Token data to save
|
|
535
|
-
* @param tokens.accessToken
|
|
536
|
-
* @param tokens.refreshToken
|
|
535
|
+
* @param tokens.accessToken - Access token to save
|
|
536
|
+
* @param tokens.refreshToken - Optional refresh token to save
|
|
537
537
|
* @param expiresAt - Token expiration date
|
|
538
|
+
* @param metadata - Optional user metadata to persist with the token entry
|
|
538
539
|
*/
|
|
539
|
-
async function saveUserTokens(config, user, tokens, expiresAt) {
|
|
540
|
+
async function saveUserTokens(config, user, tokens, expiresAt, metadata) {
|
|
541
|
+
const email = metadata?.email ?? config.users[user]?.email;
|
|
540
542
|
if (process.env.TAILOR_USE_KEYRING && await isKeyringAvailable()) {
|
|
541
543
|
await saveKeyringTokens(user, tokens);
|
|
542
544
|
config.users[user] = {
|
|
543
545
|
token_expires_at: expiresAt,
|
|
544
|
-
storage: "keyring"
|
|
546
|
+
storage: "keyring",
|
|
547
|
+
...email ? { email } : {}
|
|
545
548
|
};
|
|
546
549
|
} else config.users[user] = {
|
|
547
550
|
access_token: tokens.accessToken,
|
|
548
551
|
refresh_token: tokens.refreshToken,
|
|
549
552
|
token_expires_at: expiresAt,
|
|
550
|
-
storage: "file"
|
|
553
|
+
storage: "file",
|
|
554
|
+
...email ? { email } : {}
|
|
551
555
|
};
|
|
552
556
|
}
|
|
553
557
|
/**
|
|
@@ -558,20 +562,50 @@ async function saveUserTokens(config, user, tokens, expiresAt) {
|
|
|
558
562
|
async function deleteUserTokens(config, user) {
|
|
559
563
|
if (config.users[user]?.storage === "keyring") await deleteKeyringTokens(user);
|
|
560
564
|
}
|
|
565
|
+
function updateUserReferences(config, fromUser, toUser) {
|
|
566
|
+
if (fromUser === toUser) return;
|
|
567
|
+
if (config.current_user === fromUser) config.current_user = toUser;
|
|
568
|
+
for (const profile of Object.values(config.profiles)) if (profile?.user === fromUser) profile.user = toUser;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Remove a legacy alias after a canonical user ID has been written.
|
|
572
|
+
* @param config - Platform config
|
|
573
|
+
* @param legacyUser - Previous user key
|
|
574
|
+
* @param canonicalUser - Canonical user key
|
|
575
|
+
*/
|
|
576
|
+
async function removeLegacyUserAlias(config, legacyUser, canonicalUser) {
|
|
577
|
+
if (legacyUser === canonicalUser) return;
|
|
578
|
+
updateUserReferences(config, legacyUser, canonicalUser);
|
|
579
|
+
await deleteUserTokens(config, legacyUser);
|
|
580
|
+
delete config.users[legacyUser];
|
|
581
|
+
}
|
|
582
|
+
function shouldResolveSubjectOnRefresh(user, userEntry) {
|
|
583
|
+
return Boolean(userEntry.email || inferEmailFromUserId(user));
|
|
584
|
+
}
|
|
561
585
|
/**
|
|
562
586
|
* Fetch the latest access token, refreshing if necessary.
|
|
563
587
|
* @param config - Platform config
|
|
564
|
-
* @param user - User
|
|
565
|
-
* @returns Latest access token
|
|
588
|
+
* @param user - User identifier
|
|
589
|
+
* @returns Latest access token and the canonical user ID it is stored under
|
|
590
|
+
* (the resolved subject when a legacy email key was migrated during refresh,
|
|
591
|
+
* otherwise the matching config user)
|
|
566
592
|
*/
|
|
567
593
|
async function fetchLatestToken(config, user) {
|
|
568
|
-
const
|
|
594
|
+
const storedUser = findConfigUserKey(config, user);
|
|
595
|
+
if (!storedUser) throw new Error(multiline`
|
|
596
|
+
User "${user}" not found.
|
|
597
|
+
Please verify your user name and login using 'tailor-sdk login' command.
|
|
598
|
+
`);
|
|
599
|
+
const userEntry = config.users[storedUser];
|
|
569
600
|
if (!userEntry) throw new Error(multiline`
|
|
570
601
|
User "${user}" not found.
|
|
571
602
|
Please verify your user name and login using 'tailor-sdk login' command.
|
|
572
603
|
`);
|
|
573
|
-
const tokens = await resolveTokens(userEntry,
|
|
574
|
-
if (new Date(userEntry.token_expires_at) > /* @__PURE__ */ new Date()) return
|
|
604
|
+
const tokens = await resolveTokens(userEntry, storedUser);
|
|
605
|
+
if (new Date(userEntry.token_expires_at) > /* @__PURE__ */ new Date()) return {
|
|
606
|
+
accessToken: tokens.accessToken,
|
|
607
|
+
user: storedUser
|
|
608
|
+
};
|
|
575
609
|
if (!tokens.refreshToken) throw new Error(multiline`
|
|
576
610
|
Token expired.
|
|
577
611
|
Please run 'tailor-sdk login' and try again.
|
|
@@ -591,12 +625,27 @@ async function fetchLatestToken(config, user) {
|
|
|
591
625
|
`);
|
|
592
626
|
}
|
|
593
627
|
const newExpiresAt = new Date(assertDefined(resp.expiresAt, "token refresh response missing expiresAt")).toISOString();
|
|
594
|
-
|
|
628
|
+
let resolvedUser = storedUser;
|
|
629
|
+
const previousEmail = userEntry.email ?? inferEmailFromUserId(storedUser);
|
|
630
|
+
let email = previousEmail;
|
|
631
|
+
if (shouldResolveSubjectOnRefresh(storedUser, userEntry)) try {
|
|
632
|
+
const userInfo = await fetchUserInfo(resp.accessToken);
|
|
633
|
+
resolvedUser = userInfo.sub;
|
|
634
|
+
email = userInfo.email;
|
|
635
|
+
} catch (error) {
|
|
636
|
+
logger.debug(`Failed to resolve refreshed token user info: ${String(error)}`);
|
|
637
|
+
}
|
|
638
|
+
await saveUserTokens(config, resolvedUser, {
|
|
595
639
|
accessToken: resp.accessToken,
|
|
596
640
|
refreshToken: resp.refreshToken ?? void 0
|
|
597
|
-
}, newExpiresAt);
|
|
641
|
+
}, newExpiresAt, { email });
|
|
642
|
+
await removeLegacyUserAlias(config, storedUser, resolvedUser);
|
|
643
|
+
if (previousEmail && email && previousEmail !== email) logger.info(`Updated local user email from "${previousEmail}" to "${email}".`);
|
|
598
644
|
writePlatformConfig(config);
|
|
599
|
-
return
|
|
645
|
+
return {
|
|
646
|
+
accessToken: resp.accessToken,
|
|
647
|
+
user: resolvedUser
|
|
648
|
+
};
|
|
600
649
|
}
|
|
601
650
|
const DEFAULT_CONFIG_FILENAME = "tailor.config.ts";
|
|
602
651
|
/**
|
|
@@ -638,12 +687,11 @@ function installCliTailordbStub() {
|
|
|
638
687
|
|
|
639
688
|
//#endregion
|
|
640
689
|
//#region src/cli/shared/config-loader.ts
|
|
641
|
-
const GeneratorConfigSchema = CodeGeneratorSchema.brand("CodeGenerator");
|
|
642
690
|
/**
|
|
643
|
-
* Load Tailor configuration file and associated
|
|
691
|
+
* Load Tailor configuration file and associated plugins.
|
|
644
692
|
* @param configPath - Optional explicit config path
|
|
645
693
|
* @param options - Optional module import behavior.
|
|
646
|
-
* @returns Loaded config,
|
|
694
|
+
* @returns Loaded config, plugins, and config path
|
|
647
695
|
*/
|
|
648
696
|
async function loadConfig(configPath, options = {}) {
|
|
649
697
|
installCliTailordbStub();
|
|
@@ -660,34 +708,8 @@ async function loadConfig(configPath, options = {}) {
|
|
|
660
708
|
const issues = validated.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
|
|
661
709
|
throw new Error(`Invalid Tailor config in ${resolvedPath}:\n${issues}`);
|
|
662
710
|
}
|
|
663
|
-
const allGenerators = [];
|
|
664
711
|
const allPlugins = [];
|
|
665
712
|
for (const value of Object.values(configModule)) if (Array.isArray(value)) {
|
|
666
|
-
const generatorParsed = value.reduce((acc, item) => {
|
|
667
|
-
if (!acc.success) return acc;
|
|
668
|
-
const baseResult = BaseGeneratorConfigSchema.safeParse(item);
|
|
669
|
-
if (baseResult.success && Array.isArray(baseResult.data)) {
|
|
670
|
-
const [id, options] = baseResult.data;
|
|
671
|
-
const pluginFactory = builtinPlugins.get(id);
|
|
672
|
-
if (pluginFactory) {
|
|
673
|
-
acc.convertedPlugins.push(pluginFactory(options));
|
|
674
|
-
return acc;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
const result = GeneratorConfigSchema.safeParse(item);
|
|
678
|
-
if (result.success) acc.items.push(result.data);
|
|
679
|
-
else acc.success = false;
|
|
680
|
-
return acc;
|
|
681
|
-
}, {
|
|
682
|
-
success: true,
|
|
683
|
-
items: [],
|
|
684
|
-
convertedPlugins: []
|
|
685
|
-
});
|
|
686
|
-
if (generatorParsed.success && (generatorParsed.items.length > 0 || generatorParsed.convertedPlugins.length > 0)) {
|
|
687
|
-
allGenerators.push(...generatorParsed.items);
|
|
688
|
-
allPlugins.push(...generatorParsed.convertedPlugins);
|
|
689
|
-
continue;
|
|
690
|
-
}
|
|
691
713
|
const pluginParsed = value.reduce((acc, item) => {
|
|
692
714
|
if (!acc.success) return acc;
|
|
693
715
|
const result = PluginConfigSchema.safeParse(item);
|
|
@@ -705,7 +727,6 @@ async function loadConfig(configPath, options = {}) {
|
|
|
705
727
|
...configModule.default,
|
|
706
728
|
path: resolvedPath
|
|
707
729
|
},
|
|
708
|
-
generators: allGenerators,
|
|
709
730
|
plugins: allPlugins
|
|
710
731
|
};
|
|
711
732
|
}
|
|
@@ -906,7 +927,33 @@ function resolveRelativePluginImportPath(pluginImportPath, baseDirs) {
|
|
|
906
927
|
}
|
|
907
928
|
|
|
908
929
|
//#endregion
|
|
909
|
-
//#region src/
|
|
930
|
+
//#region src/plugin/guards.ts
|
|
931
|
+
/**
|
|
932
|
+
* Collects the generation-time dependency kinds a plugin requires.
|
|
933
|
+
* @param plugin - The plugin object to inspect.
|
|
934
|
+
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
935
|
+
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
936
|
+
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
937
|
+
* @returns Set of dependency kinds required by the plugin.
|
|
938
|
+
*/
|
|
939
|
+
function getPluginGenerationDependencies(plugin) {
|
|
940
|
+
const deps = /* @__PURE__ */ new Set();
|
|
941
|
+
if (plugin.onTailorDBReady) deps.add("tailordb");
|
|
942
|
+
if (plugin.onResolverReady) deps.add("resolver");
|
|
943
|
+
if (plugin.onExecutorReady) deps.add("executor");
|
|
944
|
+
return deps;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Checks if a plugin has any generation-time hooks.
|
|
948
|
+
* @param plugin - The plugin object to inspect.
|
|
949
|
+
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
950
|
+
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
951
|
+
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
952
|
+
* @returns True if the plugin has at least one generation hook.
|
|
953
|
+
*/
|
|
954
|
+
function hasGenerationHooks(plugin) {
|
|
955
|
+
return !!(plugin.onTailorDBReady || plugin.onResolverReady || plugin.onExecutorReady);
|
|
956
|
+
}
|
|
910
957
|
/**
|
|
911
958
|
* Checks if a plugin executor uses file-based resolution.
|
|
912
959
|
* @param executor - The plugin executor to check.
|
|
@@ -1921,14 +1968,14 @@ const NORMALIZER_IDENTIFIER = "__tailor_normalizeAuthInvoker";
|
|
|
1921
1968
|
/**
|
|
1922
1969
|
* Build the source text of the injected normalizer helper.
|
|
1923
1970
|
*
|
|
1924
|
-
* Accepts
|
|
1925
|
-
*
|
|
1971
|
+
* Accepts a plain string machine user name and returns the object form
|
|
1972
|
+
* expected by the platform RPC.
|
|
1926
1973
|
* The auth namespace is baked in at bundle time.
|
|
1927
1974
|
* @param authNamespace - Auth service namespace to embed
|
|
1928
1975
|
* @returns Source line defining the helper
|
|
1929
1976
|
*/
|
|
1930
1977
|
function buildNormalizerHelperSource(authNamespace) {
|
|
1931
|
-
return `const ${NORMALIZER_IDENTIFIER} = (
|
|
1978
|
+
return `const ${NORMALIZER_IDENTIFIER} = (machineUserName) => ({ namespace: ${JSON.stringify(authNamespace)}, machineUserName });\n`;
|
|
1932
1979
|
}
|
|
1933
1980
|
/**
|
|
1934
1981
|
* Extract authInvoker info from a config object expression
|
|
@@ -2188,7 +2235,7 @@ function transformFunctionTriggers(source, workflowNameMap, jobNameMap, workflow
|
|
|
2188
2235
|
} else if (call.kind === "job") {
|
|
2189
2236
|
const jobName = jobNameMap.get(call.identifierName);
|
|
2190
2237
|
if (jobName) {
|
|
2191
|
-
const transformedCall = `
|
|
2238
|
+
const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
|
|
2192
2239
|
replacements.push({
|
|
2193
2240
|
start: call.callRange.start,
|
|
2194
2241
|
end: call.callRange.end,
|
|
@@ -4055,7 +4102,7 @@ const HTTP_METHOD_KEYS = Object.keys(HTTP_METHODS);
|
|
|
4055
4102
|
|
|
4056
4103
|
//#endregion
|
|
4057
4104
|
//#region src/parser/service/http-adapter/schema.ts
|
|
4058
|
-
const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
4105
|
+
const NAME_PATTERN$1 = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
4059
4106
|
const inputHandlersSchema = z.strictObject({
|
|
4060
4107
|
get: functionSchema.optional().describe("Handler for GET requests"),
|
|
4061
4108
|
post: functionSchema.optional().describe("Handler for POST requests"),
|
|
@@ -4064,7 +4111,7 @@ const inputHandlersSchema = z.strictObject({
|
|
|
4064
4111
|
delete: functionSchema.optional().describe("Handler for DELETE requests")
|
|
4065
4112
|
}).refine((val) => Object.values(val).some((v) => v !== void 0), "input must declare at least one HTTP method handler").describe("Per-method functions that transform HTTP requests to GraphQL requests");
|
|
4066
4113
|
const HttpAdapterConfigSchema = z.strictObject({
|
|
4067
|
-
name: z.string().regex(NAME_PATTERN, "name must be 3-63 chars, lowercase alphanumeric with hyphens, not starting or ending with a hyphen").describe("Unique adapter name within the domain"),
|
|
4114
|
+
name: z.string().regex(NAME_PATTERN$1, "name must be 3-63 chars, lowercase alphanumeric with hyphens, not starting or ending with a hyphen").describe("Unique adapter name within the domain"),
|
|
4068
4115
|
pathPattern: z.string().min(1).describe("Path pattern with segment wildcards (trailing or single-segment)"),
|
|
4069
4116
|
enabled: z.boolean().default(true).describe("Whether the adapter is active"),
|
|
4070
4117
|
priority: z.number().int().min(0).default(0).describe("Matching priority; the lowest value wins when multiple adapters match"),
|
|
@@ -4667,7 +4714,7 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
|
|
|
4667
4714
|
if (isInsideRemovedRange(call.callRange.start)) continue;
|
|
4668
4715
|
const jobName = jobNameMap.get(call.identifierName);
|
|
4669
4716
|
if (jobName) {
|
|
4670
|
-
const transformedCall = `
|
|
4717
|
+
const transformedCall = `tailor.workflow.triggerJobFunction("${jobName}", ${call.argsText || "undefined"})`;
|
|
4671
4718
|
replacements.push({
|
|
4672
4719
|
start: call.callRange.start,
|
|
4673
4720
|
end: call.callRange.end,
|
|
@@ -5065,6 +5112,17 @@ async function loadFileContent(filePath) {
|
|
|
5065
5112
|
};
|
|
5066
5113
|
}
|
|
5067
5114
|
|
|
5115
|
+
//#endregion
|
|
5116
|
+
//#region src/cli/shared/auth-namespace.ts
|
|
5117
|
+
/**
|
|
5118
|
+
* Resolve the auth namespace configured for an application.
|
|
5119
|
+
* @param application - Loaded application with local or external Auth config
|
|
5120
|
+
* @returns Auth namespace, or undefined when no Auth config is present
|
|
5121
|
+
*/
|
|
5122
|
+
function getApplicationAuthNamespace(application) {
|
|
5123
|
+
return application.authService?.config.name ?? application.config?.auth?.name;
|
|
5124
|
+
}
|
|
5125
|
+
|
|
5068
5126
|
//#endregion
|
|
5069
5127
|
//#region src/cli/shared/inline-sourcemap.ts
|
|
5070
5128
|
/**
|
|
@@ -5084,6 +5142,16 @@ function resolveInlineSourcemap(configValue) {
|
|
|
5084
5142
|
return true;
|
|
5085
5143
|
}
|
|
5086
5144
|
|
|
5145
|
+
//#endregion
|
|
5146
|
+
//#region src/parser/service/aigateway/schema.ts
|
|
5147
|
+
const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,28}[a-z0-9]$/;
|
|
5148
|
+
const AUTH_NAMESPACE_PATTERN = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
5149
|
+
const AIGatewaySchema = z.object({
|
|
5150
|
+
name: z.string().regex(NAME_PATTERN, "Must be 3-30 lowercase alphanumeric characters or hyphens").describe("AI Gateway name"),
|
|
5151
|
+
authNamespace: z.string().regex(AUTH_NAMESPACE_PATTERN, "Must be 3-63 lowercase alphanumeric characters or hyphens").describe("Auth namespace used to resolve request tokens against the workspace's auth"),
|
|
5152
|
+
cors: z.array(z.string()).optional().describe("Allowed CORS origins for browser-based clients. Each entry is `*`, `http(s)://*`, `http(s)://*.example.com`, or `http(s)://app.example.com`, optionally with `:port`. Empty list disables cross-origin access.")
|
|
5153
|
+
}).brand("AIGatewayConfig");
|
|
5154
|
+
|
|
5087
5155
|
//#endregion
|
|
5088
5156
|
//#region src/parser/service/idp/schema.ts
|
|
5089
5157
|
/**
|
|
@@ -5376,6 +5444,17 @@ function defineStaticWebsites(websites) {
|
|
|
5376
5444
|
});
|
|
5377
5445
|
return staticWebsiteServices;
|
|
5378
5446
|
}
|
|
5447
|
+
function defineAIGateways(gateways) {
|
|
5448
|
+
const aiGatewayServices = [];
|
|
5449
|
+
const gatewayNames = /* @__PURE__ */ new Set();
|
|
5450
|
+
(gateways ?? []).forEach((config) => {
|
|
5451
|
+
const gateway = AIGatewaySchema.parse(config);
|
|
5452
|
+
if (gatewayNames.has(gateway.name)) throw new Error(`AI Gateway with name "${gateway.name}" already defined.`);
|
|
5453
|
+
gatewayNames.add(gateway.name);
|
|
5454
|
+
aiGatewayServices.push(gateway);
|
|
5455
|
+
});
|
|
5456
|
+
return aiGatewayServices;
|
|
5457
|
+
}
|
|
5379
5458
|
function parseSecretManager(config) {
|
|
5380
5459
|
if (!config) return {
|
|
5381
5460
|
secrets: [],
|
|
@@ -5404,6 +5483,7 @@ function defineServices(config, pluginManager) {
|
|
|
5404
5483
|
const idpResult = defineIdp(config.idp);
|
|
5405
5484
|
const authResult = defineAuth(config.auth, tailordbResult.tailorDBServices, tailordbResult.externalTailorDBNamespaces);
|
|
5406
5485
|
const staticWebsiteServices = defineStaticWebsites(config.staticWebsites);
|
|
5486
|
+
const aiGatewayServices = defineAIGateways(config.aiGateways);
|
|
5407
5487
|
const { secrets, ignoreNullishValues } = parseSecretManager(config.secrets);
|
|
5408
5488
|
return {
|
|
5409
5489
|
tailordbResult,
|
|
@@ -5411,6 +5491,7 @@ function defineServices(config, pluginManager) {
|
|
|
5411
5491
|
idpResult,
|
|
5412
5492
|
authResult,
|
|
5413
5493
|
staticWebsiteServices,
|
|
5494
|
+
aiGatewayServices,
|
|
5414
5495
|
secrets,
|
|
5415
5496
|
ignoreNullishValues
|
|
5416
5497
|
};
|
|
@@ -5435,6 +5516,7 @@ function buildApplication(params) {
|
|
|
5435
5516
|
workflowService: params.workflowService,
|
|
5436
5517
|
httpAdapterService: params.httpAdapterService,
|
|
5437
5518
|
staticWebsiteServices: params.staticWebsiteServices,
|
|
5519
|
+
aiGatewayServices: params.aiGatewayServices,
|
|
5438
5520
|
secrets: params.secrets,
|
|
5439
5521
|
ignoreNullishValues: params.ignoreNullishValues,
|
|
5440
5522
|
env: params.env,
|
|
@@ -5501,7 +5583,7 @@ function generatePluginFilesIfNeeded(pluginManager, tailorDBServices, configPath
|
|
|
5501
5583
|
*/
|
|
5502
5584
|
async function loadApplication(params) {
|
|
5503
5585
|
const { config, pluginManager, bundleCache } = params;
|
|
5504
|
-
const { tailordbResult, resolverResult, idpResult, authResult, staticWebsiteServices, secrets, ignoreNullishValues } = defineServices(config, pluginManager);
|
|
5586
|
+
const { tailordbResult, resolverResult, idpResult, authResult, staticWebsiteServices, aiGatewayServices, secrets, ignoreNullishValues } = defineServices(config, pluginManager);
|
|
5505
5587
|
for (const tailordb of tailordbResult.tailorDBServices) {
|
|
5506
5588
|
await tailordb.loadTypes();
|
|
5507
5589
|
await tailordb.processNamespacePlugins();
|
|
@@ -5513,7 +5595,10 @@ async function loadApplication(params) {
|
|
|
5513
5595
|
if (workflowService) await workflowService.loadWorkflows();
|
|
5514
5596
|
const httpAdapterService = defineHttpAdapterService(config.httpAdapter);
|
|
5515
5597
|
if (httpAdapterService) await httpAdapterService.loadAdapters();
|
|
5516
|
-
const triggerContext = await buildTriggerContext(config.workflow,
|
|
5598
|
+
const triggerContext = await buildTriggerContext(config.workflow, getApplicationAuthNamespace({
|
|
5599
|
+
authService: authResult.authService,
|
|
5600
|
+
config
|
|
5601
|
+
}));
|
|
5517
5602
|
const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
|
|
5518
5603
|
const bundleLogLevel = resolveBundleLogLevel(config.logLevel);
|
|
5519
5604
|
const bundledScripts = {
|
|
@@ -5579,6 +5664,7 @@ async function loadApplication(params) {
|
|
|
5579
5664
|
workflowService,
|
|
5580
5665
|
httpAdapterService,
|
|
5581
5666
|
staticWebsiteServices,
|
|
5667
|
+
aiGatewayServices,
|
|
5582
5668
|
secrets,
|
|
5583
5669
|
ignoreNullishValues,
|
|
5584
5670
|
env: config.env ?? {}
|
|
@@ -5590,5 +5676,5 @@ async function loadApplication(params) {
|
|
|
5590
5676
|
}
|
|
5591
5677
|
|
|
5592
5678
|
//#endregion
|
|
5593
|
-
export {
|
|
5594
|
-
//# sourceMappingURL=application-
|
|
5679
|
+
export { loadAccessToken as A, getDistDir as C, deleteUserTokens as D, loadConfig as E, removeLegacyUserAlias as F, resolveTokens as I, saveUserTokens as L, loadMachineUserName as M, loadWorkspaceId as N, fetchLatestToken as O, readPlatformConfig as P, writePlatformConfig as R, createBundleCache as S, hashFile as T, composeFunctionTreeshakeOptions as _, getApplicationAuthNamespace as a, getPluginGenerationDependencies as b, HTTP_METHODS as c, buildResolverOperationHookExpr as d, assertUniqueLocalTailorDBTypeNames as f, platformBundleDefinePlugin as g, stringifyFunction as h, resolveInlineSourcemap as i, loadConfigPath as j, findConfigUserKey as k, INVOKER_EXPR as l, TailorDBTypeSchema as m, generatePluginFilesIfNeeded as n, WorkflowJobSchema as o, assertUniqueTailorDBTypeNamesWithExternal as p, loadApplication as r, ResolverSchema as s, defineApplication as t, buildExecutorArgsExpr as u, createLogLevelTreeshakeOptions as v, hashContent as w, hasGenerationHooks as x, resolveBundleLogLevel as y };
|
|
5680
|
+
//# sourceMappingURL=application-DqS1yBg3.mjs.map
|