@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,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import { r as withSpan } from "./telemetry-BQbbVo2t.mjs";
|
|
1
|
+
import { t as db } from "./schema-BhkpP5Hw.mjs";
|
|
2
|
+
import { $ as CreateExecutorExecutorRequestSchema, A as TailorDBGQLPermission_Permit, At as AuthSCIMAttribute_Type, B as UpdateSecretManagerSecretRequestSchema, Bt as Subgraph_ServiceType, C as WorkflowExecution_Status, Ct as AuthConnection_Type, D as UpdateTailorDBTypeRequestSchema, Dt as AuthOAuth2Client_ClientType, E as CreateTailorDBTypeRequestSchema, Et as AuthInvokerSchema, F as CreateStaticWebsiteRequestSchema, Ft as UserProfileProviderConfig_UserProfileProviderType, G as PipelineResolver_OperationType, H as CreatePipelineServiceRequestSchema, Ht as Condition_Operator, I as UpdateStaticWebsiteRequestSchema, It as CreateApplicationRequestSchema, J as IdPLang, K as CreateIdPServiceRequestSchema, Lt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, M as TailorDBType_Permission_Permit, Mt as AuthSCIMConfig_AuthorizationType, N as TailorDBType_PermitAction, O as TailorDBGQLPermission_Action, Ot as AuthOAuth2Client_GrantType, P as AddCustomDomainRequestSchema, Pt as TenantProviderConfig_TenantProviderType, R as CreateSecretManagerSecretRequestSchema, Rt as UpdateApplicationRequestSchema, S as UpdateWorkflowRequestSchema, St as UpdateUserProfileConfigRequestSchema, T as CreateTailorDBServiceRequestSchema, Tt as AuthIDPConfig_AuthType, U as UpdatePipelineResolverRequestSchema, Ut as FilterSchema, V as CreatePipelineResolverRequestSchema, Vt as ConditionSchema, W as UpdatePipelineServiceRequestSchema, Wt as PageDirection, X as IdPPermissionPermit, Y as IdPPermissionOperator, Z as FunctionExecution_Status, _ as userAgent, _t as UpdateAuthOAuth2ClientRequestSchema, a as fetchAll, at as CreateAuthHookRequestSchema, b as CreateWorkflowJobFunctionRequestSchema, bt as UpdateAuthServiceRequestSchema, ct as CreateAuthOAuth2ClientRequestSchema, dt as CreateAuthServiceRequestSchema, et as UpdateExecutorExecutorRequestSchema, f as initOperatorClient, ft as CreateTenantConfigRequestSchema, gt as UpdateAuthMachineUserRequestSchema, h as resolveStaticWebsiteUrls, ht as UpdateAuthIDPConfigRequestSchema, it as CreateAuthConnectionRequestSchema, j as TailorDBType_Permission_Operator, jt as AuthSCIMAttribute_Uniqueness, k as TailorDBGQLPermission_Operator, kt as AuthSCIMAttribute_Mutability, lt as CreateAuthSCIMConfigRequestSchema, m as platformBaseUrl, mt as UpdateAuthHookRequestSchema, nt as ExecutorTargetType, o as fetchMachineUserToken, ot as CreateAuthIDPConfigRequestSchema, pt as CreateUserProfileConfigRequestSchema, q as UpdateIdPServiceRequestSchema, rt as ExecutorTriggerType, s as fetchPaged, st as CreateAuthMachineUserRequestSchema, tt as ExecutorJobStatus, ut as CreateAuthSCIMResourceRequestSchema, v as OperatorService, vt as UpdateAuthSCIMConfigRequestSchema, w as WorkflowJobExecution_Status, wt as AuthHookPoint, x as CreateWorkflowRequestSchema, xt as UpdateTenantConfigRequestSchema, y as WorkspacePlatformUserRole, yt as UpdateAuthSCIMResourceRequestSchema, z as CreateSecretManagerVaultRequestSchema, zt as ApplicationSchemaUpdateAttemptStatus } from "./client-z_oHGVNy.mjs";
|
|
3
|
+
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
4
|
+
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-CxF-Ex5d.mjs";
|
|
5
|
+
import { A as loadAccessToken, C as getDistDir, E as loadConfig, M as loadMachineUserName, N as loadWorkspaceId, P as readPlatformConfig, R as writePlatformConfig, S as createBundleCache, T as hashFile, a as getApplicationAuthNamespace, b as getPluginGenerationDependencies, c as HTTP_METHODS, d as buildResolverOperationHookExpr, f as assertUniqueLocalTailorDBTypeNames, g as platformBundleDefinePlugin, h as stringifyFunction, j as loadConfigPath, m as TailorDBTypeSchema, n as generatePluginFilesIfNeeded, p as assertUniqueTailorDBTypeNamesWithExternal, r as loadApplication, t as defineApplication, u as buildExecutorArgsExpr, x as hasGenerationHooks } from "./application-DqS1yBg3.mjs";
|
|
6
|
+
import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-CCL8ruDf.mjs";
|
|
7
|
+
import { t as multiline } from "./multiline-sfHpTZZK.mjs";
|
|
8
|
+
import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
|
|
9
|
+
import { n as isCLIError, t as createCLIError } from "./errors-Dtf2WPaW.mjs";
|
|
10
|
+
import { r as withSpan } from "./telemetry-CdqJEzkj.mjs";
|
|
12
11
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
13
12
|
import { z } from "zod";
|
|
14
13
|
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
@@ -1240,35 +1239,6 @@ async function generateUserTypes(options) {
|
|
|
1240
1239
|
}
|
|
1241
1240
|
}
|
|
1242
1241
|
|
|
1243
|
-
//#endregion
|
|
1244
|
-
//#region src/types/plugin-generation.ts
|
|
1245
|
-
/**
|
|
1246
|
-
* Derives generation-time dependency set from hook presence on a plugin.
|
|
1247
|
-
* @param plugin - The plugin object to inspect.
|
|
1248
|
-
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
1249
|
-
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
1250
|
-
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
1251
|
-
* @returns Set of dependency kinds required by the plugin.
|
|
1252
|
-
*/
|
|
1253
|
-
function getPluginGenerationDependencies(plugin) {
|
|
1254
|
-
const deps = /* @__PURE__ */ new Set();
|
|
1255
|
-
if (plugin.onTailorDBReady) deps.add("tailordb");
|
|
1256
|
-
if (plugin.onResolverReady) deps.add("resolver");
|
|
1257
|
-
if (plugin.onExecutorReady) deps.add("executor");
|
|
1258
|
-
return deps;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Checks if a plugin has any generation-time hooks.
|
|
1262
|
-
* @param plugin - The plugin object to inspect.
|
|
1263
|
-
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
1264
|
-
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
1265
|
-
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
1266
|
-
* @returns True if the plugin has at least one generation hook.
|
|
1267
|
-
*/
|
|
1268
|
-
function hasGenerationHooks(plugin) {
|
|
1269
|
-
return !!(plugin.onTailorDBReady || plugin.onResolverReady || plugin.onExecutorReady);
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
1242
|
//#endregion
|
|
1273
1243
|
//#region src/plugin/manager.ts
|
|
1274
1244
|
/**
|
|
@@ -1806,6 +1776,219 @@ async function buildMetaRequest(params) {
|
|
|
1806
1776
|
};
|
|
1807
1777
|
}
|
|
1808
1778
|
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region src/cli/commands/deploy/owned-resource.ts
|
|
1781
|
+
/**
|
|
1782
|
+
* Fetch a workspace-scoped resource list and attach SDK ownership metadata.
|
|
1783
|
+
* @template T
|
|
1784
|
+
* @param params - Resource fetch parameters
|
|
1785
|
+
* @param params.client - Operator client instance
|
|
1786
|
+
* @param params.workspaceId - Workspace ID
|
|
1787
|
+
* @param params.fetchPage - Function that fetches one resource page
|
|
1788
|
+
* @param params.getName - Function that extracts the resource name
|
|
1789
|
+
* @param params.getTrn - Function that builds the resource TRN
|
|
1790
|
+
* @returns Existing resources keyed by resource name, with SDK labels attached
|
|
1791
|
+
*/
|
|
1792
|
+
async function fetchExistingResourcesWithLabels(params) {
|
|
1793
|
+
const { client, workspaceId, fetchPage, getName, getTrn } = params;
|
|
1794
|
+
const withoutLabel = await fetchAll(async (pageToken, maxPageSize) => {
|
|
1795
|
+
try {
|
|
1796
|
+
return await fetchPage(pageToken, maxPageSize);
|
|
1797
|
+
} catch (error) {
|
|
1798
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
1799
|
+
throw error;
|
|
1800
|
+
}
|
|
1801
|
+
});
|
|
1802
|
+
const existingResources = {};
|
|
1803
|
+
await Promise.all(withoutLabel.map(async (resource) => {
|
|
1804
|
+
const name = getName(resource);
|
|
1805
|
+
if (!name) return;
|
|
1806
|
+
const { metadata } = await client.getMetadata({ trn: getTrn(workspaceId, name) });
|
|
1807
|
+
existingResources[name] = {
|
|
1808
|
+
resource,
|
|
1809
|
+
label: metadata?.labels[sdkNameLabelKey],
|
|
1810
|
+
allLabels: metadata?.labels
|
|
1811
|
+
};
|
|
1812
|
+
}));
|
|
1813
|
+
return existingResources;
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Determine whether a same-named existing resource is managed by this app.
|
|
1817
|
+
* Records the user-facing confirmation data when ownership does not match.
|
|
1818
|
+
* @param params - Ownership classification inputs
|
|
1819
|
+
* @param params.labels - Existing resource labels
|
|
1820
|
+
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
1821
|
+
* @param params.appName - Current application name
|
|
1822
|
+
* @param params.appId - Current application id, when present
|
|
1823
|
+
* @param params.resourceType - Resource kind for confirmation messages
|
|
1824
|
+
* @param params.resourceName - Resource name for confirmation messages
|
|
1825
|
+
* @param params.conflicts - Conflict accumulator
|
|
1826
|
+
* @param params.unmanaged - Unmanaged-resource accumulator
|
|
1827
|
+
* @returns True when the resource is owned by the current app
|
|
1828
|
+
*/
|
|
1829
|
+
function trackDesiredResourceOwnership(params) {
|
|
1830
|
+
const { labels, ownerLabel, appName, appId, resourceType, resourceName, conflicts, unmanaged } = params;
|
|
1831
|
+
const owned = isOwnedByApp(labels, appName, appId);
|
|
1832
|
+
if (!owned) if (!ownerLabel) unmanaged.push({
|
|
1833
|
+
resourceType,
|
|
1834
|
+
resourceName
|
|
1835
|
+
});
|
|
1836
|
+
else conflicts.push({
|
|
1837
|
+
resourceType,
|
|
1838
|
+
resourceName,
|
|
1839
|
+
currentOwner: ownerLabel
|
|
1840
|
+
});
|
|
1841
|
+
return owned;
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Determine whether a remote-only resource is still owned by this app.
|
|
1845
|
+
* Also records other SDK owners so renamed-empty applications can be handled.
|
|
1846
|
+
* @param params - Ownership classification inputs
|
|
1847
|
+
* @param params.labels - Existing resource labels
|
|
1848
|
+
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
1849
|
+
* @param params.appName - Current application name
|
|
1850
|
+
* @param params.appId - Current application id, when present
|
|
1851
|
+
* @param params.resourceOwners - Other-owner accumulator
|
|
1852
|
+
* @returns True when the resource is owned by the current app
|
|
1853
|
+
*/
|
|
1854
|
+
function trackRemainingResourceOwner(params) {
|
|
1855
|
+
const { labels, ownerLabel, appName, appId, resourceOwners } = params;
|
|
1856
|
+
const owned = isOwnedByApp(labels, appName, appId);
|
|
1857
|
+
if (ownerLabel && !owned) resourceOwners.add(ownerLabel);
|
|
1858
|
+
return owned;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
//#endregion
|
|
1862
|
+
//#region src/cli/commands/deploy/aigateway.ts
|
|
1863
|
+
/**
|
|
1864
|
+
* Apply AI Gateway changes for the given phase.
|
|
1865
|
+
* @param client - Operator client instance
|
|
1866
|
+
* @param result - Planned AI Gateway changes
|
|
1867
|
+
* @param phase - Apply phase
|
|
1868
|
+
* @returns Promise that resolves when AI Gateways are applied
|
|
1869
|
+
*/
|
|
1870
|
+
async function applyAIGateway(client, result, phase = "create-update") {
|
|
1871
|
+
const { changeSet } = result;
|
|
1872
|
+
if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create) => {
|
|
1873
|
+
create.request.cors = await resolveStaticWebsiteUrls(client, assertDefined(create.request.workspaceId, "request missing workspaceId"), create.request.cors, "AIGateway CORS");
|
|
1874
|
+
await client.createAIGateway(create.request);
|
|
1875
|
+
await client.setMetadata(create.metaRequest);
|
|
1876
|
+
}), ...changeSet.updates.map(async (update) => {
|
|
1877
|
+
update.request.cors = await resolveStaticWebsiteUrls(client, assertDefined(update.request.workspaceId, "request missing workspaceId"), update.request.cors, "AIGateway CORS");
|
|
1878
|
+
await client.updateAIGateway(update.request);
|
|
1879
|
+
await client.setMetadata(update.metaRequest);
|
|
1880
|
+
})]);
|
|
1881
|
+
else await Promise.all(changeSet.deletes.map((del) => client.deleteAIGateway(del.request)));
|
|
1882
|
+
}
|
|
1883
|
+
function normalizeComparableAIGatewayShape(input) {
|
|
1884
|
+
return {
|
|
1885
|
+
authNamespace: input.authNamespace,
|
|
1886
|
+
cors: input.cors.toSorted()
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
function normalizeComparableAIGateway(input) {
|
|
1890
|
+
return normalizeComparableAIGatewayShape({
|
|
1891
|
+
authNamespace: input.authNamespace || "",
|
|
1892
|
+
cors: [...input.cors || []]
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
function areAIGatewaysEqual(existing, desired) {
|
|
1896
|
+
return areNormalizedEqual(normalizeComparableAIGateway(existing), normalizeComparableAIGateway(desired));
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Plan AI Gateway changes based on current and desired state.
|
|
1900
|
+
* @param context - Planning context
|
|
1901
|
+
* @returns Planned changes
|
|
1902
|
+
*/
|
|
1903
|
+
async function planAIGateway(context) {
|
|
1904
|
+
const { client, workspaceId, application, forRemoval } = context;
|
|
1905
|
+
const changeSet = createChangeSet("AIGateways");
|
|
1906
|
+
const conflicts = [];
|
|
1907
|
+
const unmanaged = [];
|
|
1908
|
+
const resourceOwners = /* @__PURE__ */ new Set();
|
|
1909
|
+
const existingGateways = await fetchExistingResourcesWithLabels({
|
|
1910
|
+
client,
|
|
1911
|
+
workspaceId,
|
|
1912
|
+
fetchPage: async (pageToken, pageSize) => {
|
|
1913
|
+
const { aigateways, nextPageToken } = await client.listAIGateways({
|
|
1914
|
+
workspaceId,
|
|
1915
|
+
pageToken,
|
|
1916
|
+
pageSize
|
|
1917
|
+
});
|
|
1918
|
+
return [aigateways, nextPageToken];
|
|
1919
|
+
},
|
|
1920
|
+
getName: (resource) => resource.name,
|
|
1921
|
+
getTrn: (workspaceId, name) => resourceTrn(workspaceId, "aigateway", name)
|
|
1922
|
+
});
|
|
1923
|
+
const aiGatewayServices = forRemoval ? [] : application.aiGatewayServices;
|
|
1924
|
+
const expectedLocalWebsites = new Set(application.staticWebsiteServices.map((website) => website.name));
|
|
1925
|
+
for (const gatewayService of aiGatewayServices) {
|
|
1926
|
+
const config = gatewayService;
|
|
1927
|
+
const name = gatewayService.name;
|
|
1928
|
+
const existing = existingGateways[name];
|
|
1929
|
+
const metaRequest = await buildMetaRequest({
|
|
1930
|
+
trn: resourceTrn(workspaceId, "aigateway", name),
|
|
1931
|
+
appName: application.name,
|
|
1932
|
+
appId: application.id
|
|
1933
|
+
});
|
|
1934
|
+
const resolvedCors = await resolveStaticWebsiteUrls(client, workspaceId, config.cors ? [...config.cors] : [], "AIGateway CORS", { expectedLocalNames: expectedLocalWebsites });
|
|
1935
|
+
const desired = normalizeComparableAIGateway({
|
|
1936
|
+
...config,
|
|
1937
|
+
cors: resolvedCors
|
|
1938
|
+
});
|
|
1939
|
+
const request = {
|
|
1940
|
+
workspaceId,
|
|
1941
|
+
aigatewayName: name,
|
|
1942
|
+
authNamespace: config.authNamespace,
|
|
1943
|
+
cors: config.cors ? [...config.cors] : []
|
|
1944
|
+
};
|
|
1945
|
+
if (existing) {
|
|
1946
|
+
if (trackDesiredResourceOwnership({
|
|
1947
|
+
labels: existing.allLabels,
|
|
1948
|
+
ownerLabel: existing.label,
|
|
1949
|
+
appName: application.name,
|
|
1950
|
+
appId: application.id,
|
|
1951
|
+
resourceType: "AIGateway",
|
|
1952
|
+
resourceName: name,
|
|
1953
|
+
conflicts,
|
|
1954
|
+
unmanaged
|
|
1955
|
+
}) && hasMatchingSdkVersion(existing.allLabels, metaRequest.labels) && areAIGatewaysEqual(existing.resource, desired)) changeSet.unchanged.push({ name });
|
|
1956
|
+
else changeSet.updates.push({
|
|
1957
|
+
name,
|
|
1958
|
+
request,
|
|
1959
|
+
metaRequest
|
|
1960
|
+
});
|
|
1961
|
+
delete existingGateways[name];
|
|
1962
|
+
} else changeSet.creates.push({
|
|
1963
|
+
name,
|
|
1964
|
+
request,
|
|
1965
|
+
metaRequest
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
Object.entries(existingGateways).forEach(([name, entry]) => {
|
|
1969
|
+
const label = entry?.label;
|
|
1970
|
+
if (trackRemainingResourceOwner({
|
|
1971
|
+
labels: entry?.allLabels,
|
|
1972
|
+
ownerLabel: label,
|
|
1973
|
+
appName: application.name,
|
|
1974
|
+
appId: application.id,
|
|
1975
|
+
resourceOwners
|
|
1976
|
+
})) changeSet.deletes.push({
|
|
1977
|
+
name,
|
|
1978
|
+
request: {
|
|
1979
|
+
workspaceId,
|
|
1980
|
+
aigatewayName: name
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1983
|
+
});
|
|
1984
|
+
return {
|
|
1985
|
+
changeSet,
|
|
1986
|
+
conflicts,
|
|
1987
|
+
unmanaged,
|
|
1988
|
+
resourceOwners
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1809
1992
|
//#endregion
|
|
1810
1993
|
//#region src/cli/commands/deploy/application.ts
|
|
1811
1994
|
/**
|
|
@@ -4707,7 +4890,7 @@ async function readConfigId(configPath) {
|
|
|
4707
4890
|
async function assertConfigIdInCI(configPath) {
|
|
4708
4891
|
const result = await readConfigId(configPath);
|
|
4709
4892
|
if (result === null) return;
|
|
4710
|
-
if (!result.id) throw new Error("tailor.config.ts is missing an 'id'. CI does not auto-generate one (each run would be treated as a separate app and break resource ownership). Run 'tailor-sdk setup github' or 'tailor-sdk
|
|
4893
|
+
if (!result.id) throw new Error("tailor.config.ts is missing an 'id'. CI does not auto-generate one (each run would be treated as a separate app and break resource ownership). Run 'tailor-sdk setup github' or 'tailor-sdk deploy' locally and commit the injected id.");
|
|
4711
4894
|
if (!uuidRegex.test(result.id)) throw new Error(`'id' in ${configPath} must be a UUID. To use this config for a separate app, delete it.`);
|
|
4712
4895
|
}
|
|
4713
4896
|
/**
|
|
@@ -4882,8 +5065,8 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
4882
5065
|
* Accepts either:
|
|
4883
5066
|
* - `undefined` — returns undefined
|
|
4884
5067
|
* - a plain string (machine user name) — expands to `{ namespace, machineUserName }` using `authNamespace`
|
|
4885
|
-
* - an object `{ namespace, machineUserName }` — returned as-is
|
|
4886
|
-
* @param authInvoker - String machine user name or object form
|
|
5068
|
+
* - an internal object `{ namespace, machineUserName }` — returned as-is
|
|
5069
|
+
* @param authInvoker - String machine user name or internal object form
|
|
4887
5070
|
* @param authNamespace - Auth service namespace (required when authInvoker is a string)
|
|
4888
5071
|
* @param context - Contextual label used in error messages (e.g. `resolver "foo"`)
|
|
4889
5072
|
* @returns Object form of auth invoker, or undefined
|
|
@@ -4891,7 +5074,7 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
4891
5074
|
function normalizeAuthInvoker(authInvoker, authNamespace, context) {
|
|
4892
5075
|
if (authInvoker === void 0) return void 0;
|
|
4893
5076
|
if (typeof authInvoker === "string") {
|
|
4894
|
-
if (!authNamespace) throw new Error(`${context} uses a string authInvoker ("${authInvoker}"), but no Auth service is configured. Configure an Auth service
|
|
5077
|
+
if (!authNamespace) throw new Error(`${context} uses a string authInvoker ("${authInvoker}"), but no Auth service is configured. Configure an Auth service before using authInvoker.`);
|
|
4895
5078
|
return {
|
|
4896
5079
|
namespace: authNamespace,
|
|
4897
5080
|
machineUserName: authInvoker
|
|
@@ -4900,88 +5083,6 @@ function normalizeAuthInvoker(authInvoker, authNamespace, context) {
|
|
|
4900
5083
|
return authInvoker;
|
|
4901
5084
|
}
|
|
4902
5085
|
|
|
4903
|
-
//#endregion
|
|
4904
|
-
//#region src/cli/commands/deploy/owned-resource.ts
|
|
4905
|
-
/**
|
|
4906
|
-
* Fetch a workspace-scoped resource list and attach SDK ownership metadata.
|
|
4907
|
-
* @template T
|
|
4908
|
-
* @param params - Resource fetch parameters
|
|
4909
|
-
* @param params.client - Operator client instance
|
|
4910
|
-
* @param params.workspaceId - Workspace ID
|
|
4911
|
-
* @param params.fetchPage - Function that fetches one resource page
|
|
4912
|
-
* @param params.getName - Function that extracts the resource name
|
|
4913
|
-
* @param params.getTrn - Function that builds the resource TRN
|
|
4914
|
-
* @returns Existing resources keyed by resource name, with SDK labels attached
|
|
4915
|
-
*/
|
|
4916
|
-
async function fetchExistingResourcesWithLabels(params) {
|
|
4917
|
-
const { client, workspaceId, fetchPage, getName, getTrn } = params;
|
|
4918
|
-
const withoutLabel = await fetchAll(async (pageToken, maxPageSize) => {
|
|
4919
|
-
try {
|
|
4920
|
-
return await fetchPage(pageToken, maxPageSize);
|
|
4921
|
-
} catch (error) {
|
|
4922
|
-
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
4923
|
-
throw error;
|
|
4924
|
-
}
|
|
4925
|
-
});
|
|
4926
|
-
const existingResources = {};
|
|
4927
|
-
await Promise.all(withoutLabel.map(async (resource) => {
|
|
4928
|
-
const name = getName(resource);
|
|
4929
|
-
if (!name) return;
|
|
4930
|
-
const { metadata } = await client.getMetadata({ trn: getTrn(workspaceId, name) });
|
|
4931
|
-
existingResources[name] = {
|
|
4932
|
-
resource,
|
|
4933
|
-
label: metadata?.labels[sdkNameLabelKey],
|
|
4934
|
-
allLabels: metadata?.labels
|
|
4935
|
-
};
|
|
4936
|
-
}));
|
|
4937
|
-
return existingResources;
|
|
4938
|
-
}
|
|
4939
|
-
/**
|
|
4940
|
-
* Determine whether a same-named existing resource is managed by this app.
|
|
4941
|
-
* Records the user-facing confirmation data when ownership does not match.
|
|
4942
|
-
* @param params - Ownership classification inputs
|
|
4943
|
-
* @param params.labels - Existing resource labels
|
|
4944
|
-
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
4945
|
-
* @param params.appName - Current application name
|
|
4946
|
-
* @param params.appId - Current application id, when present
|
|
4947
|
-
* @param params.resourceType - Resource kind for confirmation messages
|
|
4948
|
-
* @param params.resourceName - Resource name for confirmation messages
|
|
4949
|
-
* @param params.conflicts - Conflict accumulator
|
|
4950
|
-
* @param params.unmanaged - Unmanaged-resource accumulator
|
|
4951
|
-
* @returns True when the resource is owned by the current app
|
|
4952
|
-
*/
|
|
4953
|
-
function trackDesiredResourceOwnership(params) {
|
|
4954
|
-
const { labels, ownerLabel, appName, appId, resourceType, resourceName, conflicts, unmanaged } = params;
|
|
4955
|
-
const owned = isOwnedByApp(labels, appName, appId);
|
|
4956
|
-
if (!owned) if (!ownerLabel) unmanaged.push({
|
|
4957
|
-
resourceType,
|
|
4958
|
-
resourceName
|
|
4959
|
-
});
|
|
4960
|
-
else conflicts.push({
|
|
4961
|
-
resourceType,
|
|
4962
|
-
resourceName,
|
|
4963
|
-
currentOwner: ownerLabel
|
|
4964
|
-
});
|
|
4965
|
-
return owned;
|
|
4966
|
-
}
|
|
4967
|
-
/**
|
|
4968
|
-
* Determine whether a remote-only resource is still owned by this app.
|
|
4969
|
-
* Also records other SDK owners so renamed-empty applications can be handled.
|
|
4970
|
-
* @param params - Ownership classification inputs
|
|
4971
|
-
* @param params.labels - Existing resource labels
|
|
4972
|
-
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
4973
|
-
* @param params.appName - Current application name
|
|
4974
|
-
* @param params.appId - Current application id, when present
|
|
4975
|
-
* @param params.resourceOwners - Other-owner accumulator
|
|
4976
|
-
* @returns True when the resource is owned by the current app
|
|
4977
|
-
*/
|
|
4978
|
-
function trackRemainingResourceOwner(params) {
|
|
4979
|
-
const { labels, ownerLabel, appName, appId, resourceOwners } = params;
|
|
4980
|
-
const owned = isOwnedByApp(labels, appName, appId);
|
|
4981
|
-
if (ownerLabel && !owned) resourceOwners.add(ownerLabel);
|
|
4982
|
-
return owned;
|
|
4983
|
-
}
|
|
4984
|
-
|
|
4985
5086
|
//#endregion
|
|
4986
5087
|
//#region src/cli/commands/deploy/executor.ts
|
|
4987
5088
|
/**
|
|
@@ -5192,8 +5293,9 @@ function resolveIdpNamespace(application, executorName, idpName) {
|
|
|
5192
5293
|
return assertDefined(application.idpServices[0], "idp service missing").name;
|
|
5193
5294
|
}
|
|
5194
5295
|
function resolveAuthNamespace(application) {
|
|
5195
|
-
|
|
5196
|
-
|
|
5296
|
+
const authNamespace = getApplicationAuthNamespace(application);
|
|
5297
|
+
if (!authNamespace) throw new Error("No Auth service configured");
|
|
5298
|
+
return authNamespace;
|
|
5197
5299
|
}
|
|
5198
5300
|
function protoExecutor(application, executor) {
|
|
5199
5301
|
const appName = application.name;
|
|
@@ -5278,7 +5380,7 @@ function protoExecutor(application, executor) {
|
|
|
5278
5380
|
const target = executor.operation;
|
|
5279
5381
|
let targetType;
|
|
5280
5382
|
let targetConfig;
|
|
5281
|
-
const authNamespace = application
|
|
5383
|
+
const authNamespace = getApplicationAuthNamespace(application);
|
|
5282
5384
|
const invokerContext = `Executor "${executor.name}"`;
|
|
5283
5385
|
switch (target.kind) {
|
|
5284
5386
|
case "webhook":
|
|
@@ -5434,7 +5536,7 @@ async function planPipeline(context) {
|
|
|
5434
5536
|
}
|
|
5435
5537
|
const executors = forRemoval ? [] : Object.values(await application.executorService?.loadExecutors() ?? {});
|
|
5436
5538
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$1(client, workspaceId, application.name, application.id, pipelines);
|
|
5437
|
-
const { changeSet: resolverChangeSet } = await planResolvers(client, workspaceId, pipelines, executors, serviceChangeSet.deletes.map((del) => del.name), application.env, application
|
|
5539
|
+
const { changeSet: resolverChangeSet } = await planResolvers(client, workspaceId, pipelines, executors, serviceChangeSet.deletes.map((del) => del.name), application.env, getApplicationAuthNamespace(application), forceApplyAll);
|
|
5438
5540
|
return {
|
|
5439
5541
|
changeSet: {
|
|
5440
5542
|
service: serviceChangeSet,
|
|
@@ -6873,7 +6975,7 @@ function createSnapshotFieldConfig(field) {
|
|
|
6873
6975
|
}
|
|
6874
6976
|
/**
|
|
6875
6977
|
* Create a snapshot field config from an OperatorFieldConfig (for nested fields)
|
|
6876
|
-
* @param {import("@/
|
|
6978
|
+
* @param {import("@/parser/service/tailordb/types").OperatorFieldConfig} fieldConfig - Field configuration
|
|
6877
6979
|
* @returns {SnapshotFieldConfig} Snapshot field configuration
|
|
6878
6980
|
*/
|
|
6879
6981
|
function createSnapshotFieldConfigFromOperatorConfig(fieldConfig) {
|
|
@@ -10620,6 +10722,9 @@ async function shouldForceApplyAll(client, workspaceId, application, functionEnt
|
|
|
10620
10722
|
application.staticWebsiteServices.forEach((website) => {
|
|
10621
10723
|
candidateTrns.add(resourceTrn(workspaceId, "staticwebsite", website.name));
|
|
10622
10724
|
});
|
|
10725
|
+
application.aiGatewayServices.forEach((gateway) => {
|
|
10726
|
+
candidateTrns.add(resourceTrn(workspaceId, "aigateway", gateway.name));
|
|
10727
|
+
});
|
|
10623
10728
|
application.resolverServices.forEach((pipeline) => {
|
|
10624
10729
|
candidateTrns.add(resourceTrn(workspaceId, "pipeline", pipeline.namespace));
|
|
10625
10730
|
});
|
|
@@ -10698,6 +10803,7 @@ function printPlanResults(results) {
|
|
|
10698
10803
|
const authServiceActions = extractServiceActions(results.auth.changeSet.service);
|
|
10699
10804
|
results.staticWebsite.changeSet.print();
|
|
10700
10805
|
results.staticWebsite.customDomainChangeSet.print();
|
|
10806
|
+
results.aiGateway.changeSet.print();
|
|
10701
10807
|
results.app.print();
|
|
10702
10808
|
printGroupedDisplaySection("TailorDB", tailorDBEntries, tailorDBServiceActions);
|
|
10703
10809
|
printGroupedDisplaySection("Resolver", pipelineEntries, pipelineServiceActions);
|
|
@@ -10748,6 +10854,7 @@ function summarizePlanResults(results, displayEntries, serviceActions) {
|
|
|
10748
10854
|
otherChanges,
|
|
10749
10855
|
results.staticWebsite.changeSet,
|
|
10750
10856
|
results.staticWebsite.customDomainChangeSet,
|
|
10857
|
+
results.aiGateway.changeSet,
|
|
10751
10858
|
results.app,
|
|
10752
10859
|
results.secretManager.vaultChangeSet,
|
|
10753
10860
|
results.secretManager.secretChangeSet
|
|
@@ -10852,7 +10959,7 @@ async function deploy(options) {
|
|
|
10852
10959
|
const dryRun = options?.dryRun ?? false;
|
|
10853
10960
|
const yes = options?.yes ?? false;
|
|
10854
10961
|
const forceApplyAll = await withSpan("plan.detectSdkVersionChange", () => shouldForceApplyAll(client, workspaceId, application, functionEntries));
|
|
10855
|
-
const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
10962
|
+
const { functionRegistry, tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
10856
10963
|
const idpUserTriggerTargets = collectIdpUserTriggerTargets(application);
|
|
10857
10964
|
const ctx = {
|
|
10858
10965
|
client,
|
|
@@ -10866,9 +10973,10 @@ async function deploy(options) {
|
|
|
10866
10973
|
};
|
|
10867
10974
|
const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, application.id, functionEntries));
|
|
10868
10975
|
const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
|
|
10869
|
-
const [tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
|
|
10976
|
+
const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
|
|
10870
10977
|
withSpan("plan.tailorDB", () => planTailorDB(ctx)),
|
|
10871
10978
|
withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
|
|
10979
|
+
withSpan("plan.aiGateway", () => planAIGateway(ctx)),
|
|
10872
10980
|
withSpan("plan.idp", () => planIdP(ctx)),
|
|
10873
10981
|
withSpan("plan.auth", () => planAuth(ctx)),
|
|
10874
10982
|
withSpan("plan.pipeline", () => planPipeline(ctx)),
|
|
@@ -10881,6 +10989,7 @@ async function deploy(options) {
|
|
|
10881
10989
|
functionRegistry,
|
|
10882
10990
|
tailorDB,
|
|
10883
10991
|
staticWebsite,
|
|
10992
|
+
aiGateway,
|
|
10884
10993
|
idp,
|
|
10885
10994
|
auth,
|
|
10886
10995
|
pipeline,
|
|
@@ -10895,6 +11004,7 @@ async function deploy(options) {
|
|
|
10895
11004
|
...functionRegistry.conflicts,
|
|
10896
11005
|
...tailorDB.conflicts,
|
|
10897
11006
|
...staticWebsite.conflicts,
|
|
11007
|
+
...aiGateway.conflicts,
|
|
10898
11008
|
...idp.conflicts,
|
|
10899
11009
|
...auth.conflicts,
|
|
10900
11010
|
...pipeline.conflicts,
|
|
@@ -10907,6 +11017,7 @@ async function deploy(options) {
|
|
|
10907
11017
|
...functionRegistry.unmanaged,
|
|
10908
11018
|
...tailorDB.unmanaged,
|
|
10909
11019
|
...staticWebsite.unmanaged,
|
|
11020
|
+
...aiGateway.unmanaged,
|
|
10910
11021
|
...idp.unmanaged,
|
|
10911
11022
|
...auth.unmanaged,
|
|
10912
11023
|
...pipeline.unmanaged,
|
|
@@ -10923,6 +11034,10 @@ async function deploy(options) {
|
|
|
10923
11034
|
resourceType: "StaticWebsite",
|
|
10924
11035
|
resourceName: del.name
|
|
10925
11036
|
});
|
|
11037
|
+
for (const del of aiGateway.changeSet.deletes) importantDeletions.push({
|
|
11038
|
+
resourceType: "AIGateway",
|
|
11039
|
+
resourceName: del.name
|
|
11040
|
+
});
|
|
10926
11041
|
for (const del of auth.changeSet.oauth2Client.deletes) importantDeletions.push({
|
|
10927
11042
|
resourceType: "OAuth2 client",
|
|
10928
11043
|
resourceName: del.name
|
|
@@ -10950,6 +11065,7 @@ async function deploy(options) {
|
|
|
10950
11065
|
...functionRegistry.resourceOwners,
|
|
10951
11066
|
...tailorDB.resourceOwners,
|
|
10952
11067
|
...staticWebsite.resourceOwners,
|
|
11068
|
+
...aiGateway.resourceOwners,
|
|
10953
11069
|
...idp.resourceOwners,
|
|
10954
11070
|
...auth.resourceOwners,
|
|
10955
11071
|
...pipeline.resourceOwners,
|
|
@@ -10971,6 +11087,7 @@ async function deploy(options) {
|
|
|
10971
11087
|
functionRegistry,
|
|
10972
11088
|
tailorDB,
|
|
10973
11089
|
staticWebsite,
|
|
11090
|
+
aiGateway,
|
|
10974
11091
|
idp,
|
|
10975
11092
|
auth,
|
|
10976
11093
|
pipeline,
|
|
@@ -11000,6 +11117,7 @@ async function deploy(options) {
|
|
|
11000
11117
|
await applySecretManager(client, secretManager, "create-update", application);
|
|
11001
11118
|
await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
|
|
11002
11119
|
await applyStaticWebsite(client, staticWebsite, "create-update");
|
|
11120
|
+
await applyAIGateway(client, aiGateway, "create-update");
|
|
11003
11121
|
await applyIdP(client, idp, "create-update");
|
|
11004
11122
|
await applyAuth(client, auth, "create-update");
|
|
11005
11123
|
await applyTailorDB(client, tailorDB, "create-update");
|
|
@@ -11019,6 +11137,7 @@ async function deploy(options) {
|
|
|
11019
11137
|
await applyWorkflow(client, workflow, "delete");
|
|
11020
11138
|
await applyExecutor(client, executor, "delete");
|
|
11021
11139
|
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
11140
|
+
await applyAIGateway(client, aiGateway, "delete");
|
|
11022
11141
|
await applySecretManager(client, secretManager, "delete");
|
|
11023
11142
|
});
|
|
11024
11143
|
await withSpan("apply.deleteApplication", () => applyApplication(client, app, "delete"));
|
|
@@ -11968,6 +12087,16 @@ async function startWorkflowCore(options) {
|
|
|
11968
12087
|
throw error;
|
|
11969
12088
|
}
|
|
11970
12089
|
}
|
|
12090
|
+
async function resolveApplicationAuthNamespace(options) {
|
|
12091
|
+
const { config } = await loadConfig(options.configPath);
|
|
12092
|
+
const { application } = await options.client.getApplication({
|
|
12093
|
+
workspaceId: options.workspaceId,
|
|
12094
|
+
applicationName: config.name
|
|
12095
|
+
});
|
|
12096
|
+
const authNamespace = application?.authNamespace || config.auth?.name;
|
|
12097
|
+
if (!authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
12098
|
+
return authNamespace;
|
|
12099
|
+
}
|
|
11971
12100
|
async function startWorkflowByName(options) {
|
|
11972
12101
|
const machineUser = await loadMachineUserName({
|
|
11973
12102
|
machineUser: options.machineUser,
|
|
@@ -11979,18 +12108,17 @@ async function startWorkflowByName(options) {
|
|
|
11979
12108
|
workspaceId: options.workspaceId,
|
|
11980
12109
|
profile: options.profile
|
|
11981
12110
|
});
|
|
11982
|
-
const
|
|
11983
|
-
|
|
12111
|
+
const authNamespace = await resolveApplicationAuthNamespace({
|
|
12112
|
+
client,
|
|
11984
12113
|
workspaceId,
|
|
11985
|
-
|
|
12114
|
+
configPath: options.configPath
|
|
11986
12115
|
});
|
|
11987
|
-
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11988
12116
|
return await startWorkflowCore({
|
|
11989
12117
|
client,
|
|
11990
12118
|
workspaceId,
|
|
11991
12119
|
workflowName: options.name,
|
|
11992
12120
|
authInvoker: {
|
|
11993
|
-
namespace:
|
|
12121
|
+
namespace: authNamespace,
|
|
11994
12122
|
machineUserName: machineUser
|
|
11995
12123
|
},
|
|
11996
12124
|
arg: options.arg,
|
|
@@ -11999,14 +12127,24 @@ async function startWorkflowByName(options) {
|
|
|
11999
12127
|
}
|
|
12000
12128
|
async function startWorkflow(options) {
|
|
12001
12129
|
if ("name" in options) return await startWorkflowByName(options);
|
|
12130
|
+
const client = await initOperatorClient(await loadAccessToken({ profile: options.profile }));
|
|
12131
|
+
const workspaceId = await loadWorkspaceId({
|
|
12132
|
+
workspaceId: options.workspaceId,
|
|
12133
|
+
profile: options.profile
|
|
12134
|
+
});
|
|
12135
|
+
const authNamespace = await resolveApplicationAuthNamespace({
|
|
12136
|
+
client,
|
|
12137
|
+
workspaceId,
|
|
12138
|
+
configPath: options.configPath
|
|
12139
|
+
});
|
|
12002
12140
|
return await startWorkflowCore({
|
|
12003
|
-
client
|
|
12004
|
-
workspaceId
|
|
12005
|
-
workspaceId: options.workspaceId,
|
|
12006
|
-
profile: options.profile
|
|
12007
|
-
}),
|
|
12141
|
+
client,
|
|
12142
|
+
workspaceId,
|
|
12008
12143
|
workflowName: options.workflow.name,
|
|
12009
|
-
authInvoker:
|
|
12144
|
+
authInvoker: {
|
|
12145
|
+
namespace: authNamespace,
|
|
12146
|
+
machineUserName: options.authInvoker
|
|
12147
|
+
},
|
|
12010
12148
|
arg: options.arg,
|
|
12011
12149
|
interval: options.interval
|
|
12012
12150
|
});
|
|
@@ -12019,7 +12157,6 @@ const startCommand = defineAppCommand({
|
|
|
12019
12157
|
...nameArgs,
|
|
12020
12158
|
"machine-user": arg(z.string().optional(), {
|
|
12021
12159
|
alias: "m",
|
|
12022
|
-
hiddenAlias: "machineuser",
|
|
12023
12160
|
description: "Machine user name. Falls back to the active profile's default machine user.",
|
|
12024
12161
|
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
12025
12162
|
}),
|
|
@@ -12894,19 +13031,6 @@ const listCommand$8 = defineAppCommand({
|
|
|
12894
13031
|
}
|
|
12895
13032
|
});
|
|
12896
13033
|
|
|
12897
|
-
//#endregion
|
|
12898
|
-
//#region src/cli/commands/generate/types.ts
|
|
12899
|
-
/**
|
|
12900
|
-
* Type guard to check if a generator has a specific dependency.
|
|
12901
|
-
* @template D
|
|
12902
|
-
* @param generator - Code generator instance
|
|
12903
|
-
* @param dependency - Dependency kind to check
|
|
12904
|
-
* @returns True if the generator has the dependency
|
|
12905
|
-
*/
|
|
12906
|
-
function hasDependency(generator, dependency) {
|
|
12907
|
-
return generator.dependencies.includes(dependency);
|
|
12908
|
-
}
|
|
12909
|
-
|
|
12910
13034
|
//#endregion
|
|
12911
13035
|
//#region src/cli/commands/generate/watch/index.ts
|
|
12912
13036
|
/**
|
|
@@ -13295,12 +13419,11 @@ function createDependencyWatcher(options = {}) {
|
|
|
13295
13419
|
* @param params - Parameters for creating the generation manager
|
|
13296
13420
|
* @param params.application - Application instance to generate code for
|
|
13297
13421
|
* @param params.config - Loaded configuration
|
|
13298
|
-
* @param params.generators - Code generators to run
|
|
13299
13422
|
* @param params.pluginManager - Plugin manager for processing plugins
|
|
13300
13423
|
* @returns GenerationManager instance
|
|
13301
13424
|
*/
|
|
13302
13425
|
function createGenerationManager(params) {
|
|
13303
|
-
const { application, config,
|
|
13426
|
+
const { application, config, pluginManager } = params;
|
|
13304
13427
|
const baseDir = path.join(getDistDir(), "generated");
|
|
13305
13428
|
fs$1.mkdirSync(baseDir, { recursive: true });
|
|
13306
13429
|
const services = {
|
|
@@ -13309,11 +13432,7 @@ function createGenerationManager(params) {
|
|
|
13309
13432
|
executor: {}
|
|
13310
13433
|
};
|
|
13311
13434
|
let watcher = null;
|
|
13312
|
-
const generatorResults = {};
|
|
13313
13435
|
const generationPlugins = pluginManager?.getPluginsWithGenerationHooks() ?? [];
|
|
13314
|
-
function getReadyGenerators(dep) {
|
|
13315
|
-
return generators.filter((g) => g.dependencies.includes(dep));
|
|
13316
|
-
}
|
|
13317
13436
|
function getAuthInput() {
|
|
13318
13437
|
const authService = application.authService;
|
|
13319
13438
|
if (!authService) return void 0;
|
|
@@ -13331,98 +13450,6 @@ function createGenerationManager(params) {
|
|
|
13331
13450
|
idProvider: authConfig.idProvider
|
|
13332
13451
|
};
|
|
13333
13452
|
}
|
|
13334
|
-
async function processTailorDBNamespace(gen, namespace, typeInfo) {
|
|
13335
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13336
|
-
results.tailordbResults[namespace] = {};
|
|
13337
|
-
if (!gen.processType) return;
|
|
13338
|
-
const processType = gen.processType;
|
|
13339
|
-
await Promise.allSettled(Object.entries(typeInfo.types).map(async ([typeName, type]) => {
|
|
13340
|
-
try {
|
|
13341
|
-
assertDefined(results.tailordbResults[namespace], `tailordb results not initialized for namespace ${namespace}`)[typeName] = await processType({
|
|
13342
|
-
type,
|
|
13343
|
-
namespace,
|
|
13344
|
-
source: typeInfo.sourceInfo[typeName],
|
|
13345
|
-
plugins: typeInfo.pluginAttachments.get(typeName) ?? []
|
|
13346
|
-
});
|
|
13347
|
-
} catch (error) {
|
|
13348
|
-
logger.error(`Error processing type ${styles.bold(typeName)} in ${namespace} with generator ${gen.id}`);
|
|
13349
|
-
logger.error(String(error));
|
|
13350
|
-
}
|
|
13351
|
-
}));
|
|
13352
|
-
if ("processTailorDBNamespace" in gen && typeof gen.processTailorDBNamespace === "function") try {
|
|
13353
|
-
results.tailordbNamespaceResults[namespace] = await gen.processTailorDBNamespace({
|
|
13354
|
-
namespace,
|
|
13355
|
-
types: results.tailordbResults[namespace]
|
|
13356
|
-
});
|
|
13357
|
-
} catch (error) {
|
|
13358
|
-
logger.error(`Error processing TailorDB namespace ${styles.bold(namespace)} with generator ${gen.id}`);
|
|
13359
|
-
logger.error(String(error));
|
|
13360
|
-
}
|
|
13361
|
-
else results.tailordbNamespaceResults[namespace] = results.tailordbResults[namespace];
|
|
13362
|
-
}
|
|
13363
|
-
async function processResolverNamespace(gen, namespace, resolvers) {
|
|
13364
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13365
|
-
results.resolverResults[namespace] = {};
|
|
13366
|
-
if (!gen.processResolver) return;
|
|
13367
|
-
const processResolver = gen.processResolver;
|
|
13368
|
-
await Promise.allSettled(Object.entries(resolvers).map(async ([resolverName, resolver]) => {
|
|
13369
|
-
try {
|
|
13370
|
-
assertDefined(results.resolverResults[namespace], `resolver results not initialized for namespace ${namespace}`)[resolverName] = await processResolver({
|
|
13371
|
-
resolver,
|
|
13372
|
-
namespace
|
|
13373
|
-
});
|
|
13374
|
-
} catch (error) {
|
|
13375
|
-
logger.error(`Error processing resolver ${styles.bold(resolverName)} in ${namespace} with generator ${gen.id}`);
|
|
13376
|
-
logger.error(String(error));
|
|
13377
|
-
}
|
|
13378
|
-
}));
|
|
13379
|
-
if ("processResolverNamespace" in gen && typeof gen.processResolverNamespace === "function") try {
|
|
13380
|
-
results.resolverNamespaceResults[namespace] = await gen.processResolverNamespace({
|
|
13381
|
-
namespace,
|
|
13382
|
-
resolvers: results.resolverResults[namespace]
|
|
13383
|
-
});
|
|
13384
|
-
} catch (error) {
|
|
13385
|
-
logger.error(`Error processing Resolver namespace ${styles.bold(namespace)} with generator ${gen.id}`);
|
|
13386
|
-
logger.error(String(error));
|
|
13387
|
-
}
|
|
13388
|
-
else results.resolverNamespaceResults[namespace] = results.resolverResults[namespace];
|
|
13389
|
-
}
|
|
13390
|
-
async function processExecutors(gen) {
|
|
13391
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13392
|
-
if (!gen.processExecutor) return;
|
|
13393
|
-
const processExecutor = gen.processExecutor;
|
|
13394
|
-
await Promise.allSettled(Object.entries(services.executor).map(async ([executorId, executor]) => {
|
|
13395
|
-
try {
|
|
13396
|
-
results.executorResults[executorId] = await processExecutor(executor);
|
|
13397
|
-
} catch (error) {
|
|
13398
|
-
logger.error(`Error processing executor ${styles.bold(executor.name)} with generator ${gen.id}`);
|
|
13399
|
-
logger.error(String(error));
|
|
13400
|
-
}
|
|
13401
|
-
}));
|
|
13402
|
-
}
|
|
13403
|
-
async function aggregate(gen) {
|
|
13404
|
-
const results = assertDefined(generatorResults[gen.id], `generator result not initialized for ${gen.id}`);
|
|
13405
|
-
const tailordbResults = [];
|
|
13406
|
-
const resolverResults = [];
|
|
13407
|
-
for (const [namespace, types] of Object.entries(results.tailordbNamespaceResults)) tailordbResults.push({
|
|
13408
|
-
namespace,
|
|
13409
|
-
types
|
|
13410
|
-
});
|
|
13411
|
-
for (const [namespace, resolvers] of Object.entries(results.resolverNamespaceResults)) resolverResults.push({
|
|
13412
|
-
namespace,
|
|
13413
|
-
resolvers
|
|
13414
|
-
});
|
|
13415
|
-
const input = { auth: getAuthInput() };
|
|
13416
|
-
if (hasDependency(gen, "tailordb")) input.tailordb = tailordbResults;
|
|
13417
|
-
if (hasDependency(gen, "resolver")) input.resolver = resolverResults;
|
|
13418
|
-
if (hasDependency(gen, "executor")) input.executor = Object.values(results.executorResults);
|
|
13419
|
-
const result = await gen.aggregate({
|
|
13420
|
-
input,
|
|
13421
|
-
baseDir: path.join(baseDir, gen.id),
|
|
13422
|
-
configPath: config.path
|
|
13423
|
-
});
|
|
13424
|
-
await writeGeneratedFiles(gen.id, result);
|
|
13425
|
-
}
|
|
13426
13453
|
/**
|
|
13427
13454
|
* Build TailorDB namespace data array from loaded services.
|
|
13428
13455
|
* @returns Array of TailorDB namespace data
|
|
@@ -13517,8 +13544,8 @@ function createGenerationManager(params) {
|
|
|
13517
13544
|
}
|
|
13518
13545
|
/**
|
|
13519
13546
|
* Write generated files to disk.
|
|
13520
|
-
* @param sourceId -
|
|
13521
|
-
* @param result -
|
|
13547
|
+
* @param sourceId - Plugin ID for logging
|
|
13548
|
+
* @param result - Generation result containing files to write
|
|
13522
13549
|
*/
|
|
13523
13550
|
async function writeGeneratedFiles(sourceId, result) {
|
|
13524
13551
|
await Promise.all(result.files.map(async (file) => {
|
|
@@ -13552,36 +13579,6 @@ function createGenerationManager(params) {
|
|
|
13552
13579
|
});
|
|
13553
13580
|
}));
|
|
13554
13581
|
}
|
|
13555
|
-
async function processGenerator(gen) {
|
|
13556
|
-
generatorResults[gen.id] = {
|
|
13557
|
-
tailordbResults: {},
|
|
13558
|
-
resolverResults: {},
|
|
13559
|
-
tailordbNamespaceResults: {},
|
|
13560
|
-
resolverNamespaceResults: {},
|
|
13561
|
-
executorResults: {}
|
|
13562
|
-
};
|
|
13563
|
-
if (hasDependency(gen, "tailordb")) for (const [namespace, types] of Object.entries(services.tailordb)) await processTailorDBNamespace(gen, namespace, types);
|
|
13564
|
-
if (hasDependency(gen, "resolver")) for (const [namespace, resolvers] of Object.entries(services.resolver)) await processResolverNamespace(gen, namespace, resolvers);
|
|
13565
|
-
if (hasDependency(gen, "executor")) await processExecutors(gen);
|
|
13566
|
-
await aggregate(gen);
|
|
13567
|
-
}
|
|
13568
|
-
async function runGenerators(gens, watch) {
|
|
13569
|
-
const results = await Promise.allSettled(gens.map(async (gen) => {
|
|
13570
|
-
await withSpan(`generate.generator.${gen.id}`, async () => {
|
|
13571
|
-
try {
|
|
13572
|
-
await processGenerator(gen);
|
|
13573
|
-
} catch (error) {
|
|
13574
|
-
logger.error(`Error processing generator ${styles.bold(gen.id)}`);
|
|
13575
|
-
logger.error(String(error));
|
|
13576
|
-
if (!watch) throw error;
|
|
13577
|
-
}
|
|
13578
|
-
});
|
|
13579
|
-
}));
|
|
13580
|
-
if (!watch) {
|
|
13581
|
-
const failures = results.filter((r) => r.status === "rejected");
|
|
13582
|
-
if (failures.length > 0) throw new AggregateError(failures.map((f) => f.reason));
|
|
13583
|
-
}
|
|
13584
|
-
}
|
|
13585
13582
|
async function restartWatchProcess() {
|
|
13586
13583
|
logger.newline();
|
|
13587
13584
|
logger.info("Restarting watch process to clear module cache...", { mode: "stream" });
|
|
@@ -13609,14 +13606,7 @@ function createGenerationManager(params) {
|
|
|
13609
13606
|
return {
|
|
13610
13607
|
application,
|
|
13611
13608
|
baseDir,
|
|
13612
|
-
generators,
|
|
13613
13609
|
services,
|
|
13614
|
-
generatorResults,
|
|
13615
|
-
processGenerator,
|
|
13616
|
-
processTailorDBNamespace,
|
|
13617
|
-
processResolverNamespace,
|
|
13618
|
-
processExecutors,
|
|
13619
|
-
aggregate,
|
|
13620
13610
|
async generate(watch) {
|
|
13621
13611
|
logger.newline();
|
|
13622
13612
|
logger.log(`Generation for application: ${styles.highlight(application.config.name)}`);
|
|
@@ -13661,11 +13651,9 @@ function createGenerationManager(params) {
|
|
|
13661
13651
|
await withSpan("generate.resolveAuthNamespaces", async () => authService.resolveNamespaces());
|
|
13662
13652
|
}
|
|
13663
13653
|
if (app.tailorDBServices.length > 0 || pluginExecutorFiles.length > 0) logger.newline();
|
|
13664
|
-
|
|
13665
|
-
const hasOnTailorDBReady = generationPlugins.some((p) => p.onTailorDBReady != null);
|
|
13666
|
-
if (readyAfterTailorDB.length > 0 || hasOnTailorDBReady) {
|
|
13654
|
+
if (generationPlugins.some((p) => p.onTailorDBReady != null)) {
|
|
13667
13655
|
await withSpan("generate.onTailorDBReady", async () => {
|
|
13668
|
-
await
|
|
13656
|
+
await runPluginHook("onTailorDBReady", watch);
|
|
13669
13657
|
});
|
|
13670
13658
|
logger.newline();
|
|
13671
13659
|
}
|
|
@@ -13688,11 +13676,9 @@ function createGenerationManager(params) {
|
|
|
13688
13676
|
});
|
|
13689
13677
|
}
|
|
13690
13678
|
});
|
|
13691
|
-
|
|
13692
|
-
const hasOnResolverReady = generationPlugins.some((p) => p.onResolverReady != null);
|
|
13693
|
-
if (readyAfterResolvers.length > 0 || hasOnResolverReady) {
|
|
13679
|
+
if (generationPlugins.some((p) => p.onResolverReady != null)) {
|
|
13694
13680
|
await withSpan("generate.onResolversReady", async () => {
|
|
13695
|
-
await
|
|
13681
|
+
await runPluginHook("onResolverReady", watch);
|
|
13696
13682
|
});
|
|
13697
13683
|
logger.newline();
|
|
13698
13684
|
}
|
|
@@ -13706,11 +13692,9 @@ function createGenerationManager(params) {
|
|
|
13706
13692
|
services.executor[key] = executor;
|
|
13707
13693
|
});
|
|
13708
13694
|
});
|
|
13709
|
-
|
|
13710
|
-
const hasOnExecutorReady = generationPlugins.some((p) => p.onExecutorReady != null);
|
|
13711
|
-
if (readyAfterExecutors.length > 0 || hasOnExecutorReady) {
|
|
13695
|
+
if (generationPlugins.some((p) => p.onExecutorReady != null)) {
|
|
13712
13696
|
await withSpan("generate.onExecutorsReady", async () => {
|
|
13713
|
-
await
|
|
13697
|
+
await runPluginHook("onExecutorReady", watch);
|
|
13714
13698
|
});
|
|
13715
13699
|
logger.newline();
|
|
13716
13700
|
}
|
|
@@ -13735,18 +13719,17 @@ function createGenerationManager(params) {
|
|
|
13735
13719
|
};
|
|
13736
13720
|
}
|
|
13737
13721
|
/**
|
|
13738
|
-
* Run code generation using the Tailor configuration
|
|
13722
|
+
* Run code generation using the Tailor configuration.
|
|
13739
13723
|
* @param options - Generation options
|
|
13740
13724
|
* @returns Promise that resolves when generation (and watch, if enabled) completes
|
|
13741
13725
|
*/
|
|
13742
13726
|
async function generate$1(options) {
|
|
13743
13727
|
return withSpan("generate", async (rootSpan) => {
|
|
13744
|
-
const { config,
|
|
13728
|
+
const { config, plugins } = await withSpan("generate.loadConfig", async () => {
|
|
13745
13729
|
return loadConfig(options?.configPath);
|
|
13746
13730
|
});
|
|
13747
13731
|
const watch = options?.watch ?? false;
|
|
13748
13732
|
rootSpan.setAttribute("generate.watch", watch);
|
|
13749
|
-
rootSpan.setAttribute("generate.generators.count", generators.length);
|
|
13750
13733
|
await withSpan("generate.generateUserTypes", async () => generateUserTypes({
|
|
13751
13734
|
config,
|
|
13752
13735
|
configPath: config.path
|
|
@@ -13761,7 +13744,6 @@ async function generate$1(options) {
|
|
|
13761
13744
|
const manager = createGenerationManager({
|
|
13762
13745
|
application,
|
|
13763
13746
|
config,
|
|
13764
|
-
generators,
|
|
13765
13747
|
pluginManager
|
|
13766
13748
|
});
|
|
13767
13749
|
await manager.generate(watch);
|
|
@@ -14561,6 +14543,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14561
14543
|
};
|
|
14562
14544
|
const tailorDB = await planTailorDB(ctx);
|
|
14563
14545
|
const staticWebsite = await planStaticWebsite(ctx);
|
|
14546
|
+
const aiGateway = await planAIGateway(ctx);
|
|
14564
14547
|
const idp = await planIdP(ctx);
|
|
14565
14548
|
const auth = await planAuth(ctx);
|
|
14566
14549
|
const pipeline = await planPipeline(ctx);
|
|
@@ -14571,6 +14554,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14571
14554
|
const secretManager = await planSecretManager(ctx);
|
|
14572
14555
|
functionRegistry.changeSet.print();
|
|
14573
14556
|
staticWebsite.changeSet.print();
|
|
14557
|
+
aiGateway.changeSet.print();
|
|
14574
14558
|
app.print();
|
|
14575
14559
|
tailorDB.changeSet.service.print();
|
|
14576
14560
|
tailorDB.changeSet.type.print();
|
|
@@ -14593,11 +14577,12 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14593
14577
|
auth.changeSet.connection.print();
|
|
14594
14578
|
secretManager.vaultChangeSet.print();
|
|
14595
14579
|
secretManager.secretChangeSet.print();
|
|
14596
|
-
if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0 && secretManager.vaultChangeSet.deletes.length === 0 && secretManager.secretChangeSet.deletes.length === 0) return;
|
|
14580
|
+
if (tailorDB.changeSet.service.deletes.length === 0 && staticWebsite.changeSet.deletes.length === 0 && aiGateway.changeSet.deletes.length === 0 && idp.changeSet.service.deletes.length === 0 && auth.changeSet.service.deletes.length === 0 && pipeline.changeSet.service.deletes.length === 0 && app.deletes.length === 0 && executor.changeSet.deletes.length === 0 && workflow.changeSet.deletes.length === 0 && functionRegistry.changeSet.deletes.length === 0 && secretManager.vaultChangeSet.deletes.length === 0 && secretManager.secretChangeSet.deletes.length === 0) return;
|
|
14597
14581
|
if (confirm) await confirm();
|
|
14598
14582
|
await applyWorkflow(client, workflow, "delete");
|
|
14599
14583
|
await applyExecutor(client, executor, "delete");
|
|
14600
14584
|
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
14585
|
+
await applyAIGateway(client, aiGateway, "delete");
|
|
14601
14586
|
await applyApplication(client, app, "delete");
|
|
14602
14587
|
await applyPipeline(client, pipeline, "delete-resources");
|
|
14603
14588
|
await applyPipeline(client, pipeline, "delete-services");
|
|
@@ -15384,7 +15369,7 @@ async function generate(options) {
|
|
|
15384
15369
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
15385
15370
|
let pluginManager;
|
|
15386
15371
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
15387
|
-
const { defineApplication } = await import("./application-
|
|
15372
|
+
const { defineApplication } = await import("./application-DB2r36Et.mjs");
|
|
15388
15373
|
const application = defineApplication({
|
|
15389
15374
|
config,
|
|
15390
15375
|
pluginManager
|
|
@@ -16089,7 +16074,7 @@ const createCommand = defineAppCommand({
|
|
|
16089
16074
|
alias: "p",
|
|
16090
16075
|
description: "Profile name to create"
|
|
16091
16076
|
}),
|
|
16092
|
-
"profile-user": arg(z.string().optional(), { description: "User email for the profile (defaults to current user)" }),
|
|
16077
|
+
"profile-user": arg(z.string().optional(), { description: "User email address or machine user client ID for the profile (defaults to current user)" }),
|
|
16093
16078
|
permission: arg(z.enum(["write", "read"]).default("write"), { description: "Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active." })
|
|
16094
16079
|
}).strict(),
|
|
16095
16080
|
run: async (args) => {
|
|
@@ -17210,7 +17195,7 @@ async function runRepl(options) {
|
|
|
17210
17195
|
const execute = await prepareQueryExecutor(options);
|
|
17211
17196
|
const historyPath = getReplHistoryPath(options.engine, options.profile, options.workspaceId);
|
|
17212
17197
|
const validate = createReplValidator(options.engine);
|
|
17213
|
-
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-
|
|
17198
|
+
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-DmGr9zMw.mjs");
|
|
17214
17199
|
const highlight = options.engine === "sql" ? highlightSqlLine : highlightGraphqlLine;
|
|
17215
17200
|
const prompt = createPrompt({
|
|
17216
17201
|
prefix: "",
|
|
@@ -17378,7 +17363,6 @@ const queryCommand = defineAppCommand({
|
|
|
17378
17363
|
edit: arg(z.boolean().default(false), { description: "Open a temporary file in your editor; omit to start REPL mode" }),
|
|
17379
17364
|
"machine-user": arg(z.string().optional(), {
|
|
17380
17365
|
alias: "m",
|
|
17381
|
-
hiddenAlias: "machineuser",
|
|
17382
17366
|
description: "Machine user name for query execution. Falls back to the active profile's default machine user.",
|
|
17383
17367
|
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
17384
17368
|
}),
|
|
@@ -17545,4 +17529,4 @@ function isDeno() {
|
|
|
17545
17529
|
|
|
17546
17530
|
//#endregion
|
|
17547
17531
|
export { listCommand$5 as $, INITIAL_SCHEMA_NUMBER as $t, truncate as A, commonArgs as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, PluginManager as Cn, triggerExecutor as Ct, resumeWorkflow as D, apiCall as Dn, jobsCommand as Dt, resumeCommand as E, apiCommand as En, getExecutorJob as Et, writeDbTypesFile as F, pagedLogArgs as Fn, getWorkflowExecution as Ft, organizationTree as G, MIGRATION_LABEL_KEY as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, paginationArgs as In, listWorkflowExecutions as It, listOrganizations as J, compareSnapshotWithRemote as Jt, treeCommand as K, handleOptionalToRequiredError as Kt, openInConfiguredEditor as L, toPageDirection as Ln, functionExecutionStatusToString as Lt, generate as M, confirmationArgs as Mn, getCommand$5 as Mt, generateCommand as N, deploymentArgs as Nn, getWorkflow as Nt, listCommand$3 as O, assertWritable as On, listExecutorJobs as Ot, generateMigrationScript as P, isVerbose as Pn, executionsCommand as Pt, updateFolder as Q, DIFF_FILE_NAME as Qt, show as R, workspaceArgs as Rn, formatKeyValueTable as Rt, listApps as S, sdkNameLabelKey as Sn, triggerCommand as St, healthCommand as T, prompt as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, bundleMigrationScript as Wt, getOrganization as X, protoGqlPermission as Xt, getCommand$1 as Y, generateAllTypeManifestsFromSnapshot as Yt, updateCommand$2 as Z, DB_TYPES_FILE_NAME as Zt, getWorkspace as _, formatMigrationDiff as _n, listFunctionRegistries as _t, updateUser as a, createSnapshotFromLocalTypes as an, createCommand$1 as at, createCommand as b, ensureConfigId as bn, listWebhookExecutors as bt, listCommand as c, getMigrationFilePath as cn, listOAuth2Clients as ct, inviteUser as d, isValidMigrationNumber as dn, getMachineUserToken as dt, MIGRATE_FILE_NAME as en, listFolders as et, restoreCommand as f, loadDiff as fn, tokenCommand as ft, getCommand as g, formatDiffSummary as gn, listCommand$8 as gt, listWorkspaces as h, parseMigrationNumberArg as hn, generate$1 as ht, updateCommand as i, compareSnapshots as in, deleteFolder as it, truncateCommand as j, configArg as jn, startWorkflow as jt, listWorkflows as k, defineAppCommand as kn, watchExecutorJob as kt, listUsers as l, getMigrationFiles as ln, getCommand$3 as lt, listCommand$1 as m, formatMigrationNumber as mn, listMachineUsers as mt, query as n, assertValidMigrationFiles as nn, getFolder as nt, removeCommand as o, getLatestMigrationNumber as on, createFolder as ot, restoreWorkspace as p, reconstructSnapshotFromMigrations as pn, listCommand$7 as pt, listCommand$4 as q, parseMigrationLabelNumber as qt, queryCommand as r, compareLocalTypesWithSnapshot as rn, deleteCommand$1 as rt, removeUser as s, getMigrationDirPath as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, SCHEMA_FILE_NAME as tn, getCommand$2 as tt, inviteCommand as u, getNextMigrationNumber as un, getOAuth2Client as ut, deleteCommand as v, hasChanges as vn, getCommand$4 as vt, getAppHealth as w, generateUserTypes as wn, listCommand$9 as wt, createWorkspace as x, resourceTrn as xn, webhookCommand as xt, deleteWorkspace as y, getNamespacesWithMigrations as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
|
|
17548
|
-
//# sourceMappingURL=runtime-
|
|
17532
|
+
//# sourceMappingURL=runtime-n9NCkjee.mjs.map
|