@tailor-platform/sdk 1.65.0 → 1.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/{application-76hhIhnJ.mjs → application-DGDmL8i_.mjs} +31 -5
- package/dist/application-DGDmL8i_.mjs.map +1 -0
- package/dist/application-nTydHJm8.mjs +4 -0
- package/dist/cli/index.mjs +6 -6
- package/dist/cli/lib.d.mts +363 -356
- package/dist/cli/lib.mjs +3 -3
- package/dist/{client-CobIRHl-.mjs → client-F0a4cWUM.mjs} +3 -2
- package/dist/client-F0a4cWUM.mjs.map +1 -0
- package/dist/{client-C68VWo4g.mjs → client-boxXYevx.mjs} +1 -1
- package/dist/completion/zsh-worker.zsh +4043 -0
- package/dist/configure/index.d.mts +3 -3
- package/dist/configure/index.mjs +17 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crashreport-BhD0y14F.mjs → crashreport-0EHy-ayY.mjs} +2 -2
- package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-0EHy-ayY.mjs.map} +1 -1
- package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-Bf6uT6mf.mjs} +1 -1
- package/dist/{index-DcXIjt9F.d.mts → index-BdLqzJDu.d.mts} +16 -3
- package/dist/{runtime-C7qTBDD2.mjs → runtime-2nzOZCUb.mjs} +240 -89
- package/dist/runtime-2nzOZCUb.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-CCDsY0ce.d.mts → workflow.generated--1Qc15Et.d.mts} +22 -3
- package/docs/cli/completion.md +3 -0
- package/docs/services/aigateway.md +97 -0
- package/package.json +3 -3
- package/dist/application-76hhIhnJ.mjs.map +0 -1
- package/dist/application-av2raLs6.mjs +0 -4
- package/dist/client-CobIRHl-.mjs.map +0 -1
- package/dist/runtime-C7qTBDD2.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { t as db } from "./schema-1msIhXwA.mjs";
|
|
3
|
-
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-
|
|
3
|
+
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-F0a4cWUM.mjs";
|
|
4
4
|
import { t as assertDefined } from "./assert-CKfwrmCV.mjs";
|
|
5
5
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DpJyJvNz.mjs";
|
|
6
|
-
import { A as readPlatformConfig, C as loadConfig, D as loadConfigPath, E as loadAccessToken, N as writePlatformConfig, O as loadMachineUserName, S as hashFile, b as getDistDir, d as assertUniqueLocalTailorDBTypeNames, f as assertUniqueTailorDBTypeNamesWithExternal, h as platformBundleDefinePlugin, k as loadWorkspaceId, l as buildExecutorArgsExpr, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, u as buildResolverOperationHookExpr, y as createBundleCache } from "./application-
|
|
6
|
+
import { A as readPlatformConfig, C as loadConfig, D as loadConfigPath, E as loadAccessToken, N as writePlatformConfig, O as loadMachineUserName, S as hashFile, b as getDistDir, d as assertUniqueLocalTailorDBTypeNames, f as assertUniqueTailorDBTypeNamesWithExternal, h as platformBundleDefinePlugin, k as loadWorkspaceId, l as buildExecutorArgsExpr, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as HTTP_METHODS, t as defineApplication, u as buildResolverOperationHookExpr, y as createBundleCache } from "./application-DGDmL8i_.mjs";
|
|
7
7
|
import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-wI3Hvrgx.mjs";
|
|
8
8
|
import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
|
|
9
9
|
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
@@ -1806,6 +1806,219 @@ async function buildMetaRequest(params) {
|
|
|
1806
1806
|
};
|
|
1807
1807
|
}
|
|
1808
1808
|
|
|
1809
|
+
//#endregion
|
|
1810
|
+
//#region src/cli/commands/deploy/owned-resource.ts
|
|
1811
|
+
/**
|
|
1812
|
+
* Fetch a workspace-scoped resource list and attach SDK ownership metadata.
|
|
1813
|
+
* @template T
|
|
1814
|
+
* @param params - Resource fetch parameters
|
|
1815
|
+
* @param params.client - Operator client instance
|
|
1816
|
+
* @param params.workspaceId - Workspace ID
|
|
1817
|
+
* @param params.fetchPage - Function that fetches one resource page
|
|
1818
|
+
* @param params.getName - Function that extracts the resource name
|
|
1819
|
+
* @param params.getTrn - Function that builds the resource TRN
|
|
1820
|
+
* @returns Existing resources keyed by resource name, with SDK labels attached
|
|
1821
|
+
*/
|
|
1822
|
+
async function fetchExistingResourcesWithLabels(params) {
|
|
1823
|
+
const { client, workspaceId, fetchPage, getName, getTrn } = params;
|
|
1824
|
+
const withoutLabel = await fetchAll(async (pageToken, maxPageSize) => {
|
|
1825
|
+
try {
|
|
1826
|
+
return await fetchPage(pageToken, maxPageSize);
|
|
1827
|
+
} catch (error) {
|
|
1828
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
1829
|
+
throw error;
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
const existingResources = {};
|
|
1833
|
+
await Promise.all(withoutLabel.map(async (resource) => {
|
|
1834
|
+
const name = getName(resource);
|
|
1835
|
+
if (!name) return;
|
|
1836
|
+
const { metadata } = await client.getMetadata({ trn: getTrn(workspaceId, name) });
|
|
1837
|
+
existingResources[name] = {
|
|
1838
|
+
resource,
|
|
1839
|
+
label: metadata?.labels[sdkNameLabelKey],
|
|
1840
|
+
allLabels: metadata?.labels
|
|
1841
|
+
};
|
|
1842
|
+
}));
|
|
1843
|
+
return existingResources;
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Determine whether a same-named existing resource is managed by this app.
|
|
1847
|
+
* Records the user-facing confirmation data when ownership does not match.
|
|
1848
|
+
* @param params - Ownership classification inputs
|
|
1849
|
+
* @param params.labels - Existing resource labels
|
|
1850
|
+
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
1851
|
+
* @param params.appName - Current application name
|
|
1852
|
+
* @param params.appId - Current application id, when present
|
|
1853
|
+
* @param params.resourceType - Resource kind for confirmation messages
|
|
1854
|
+
* @param params.resourceName - Resource name for confirmation messages
|
|
1855
|
+
* @param params.conflicts - Conflict accumulator
|
|
1856
|
+
* @param params.unmanaged - Unmanaged-resource accumulator
|
|
1857
|
+
* @returns True when the resource is owned by the current app
|
|
1858
|
+
*/
|
|
1859
|
+
function trackDesiredResourceOwnership(params) {
|
|
1860
|
+
const { labels, ownerLabel, appName, appId, resourceType, resourceName, conflicts, unmanaged } = params;
|
|
1861
|
+
const owned = isOwnedByApp(labels, appName, appId);
|
|
1862
|
+
if (!owned) if (!ownerLabel) unmanaged.push({
|
|
1863
|
+
resourceType,
|
|
1864
|
+
resourceName
|
|
1865
|
+
});
|
|
1866
|
+
else conflicts.push({
|
|
1867
|
+
resourceType,
|
|
1868
|
+
resourceName,
|
|
1869
|
+
currentOwner: ownerLabel
|
|
1870
|
+
});
|
|
1871
|
+
return owned;
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Determine whether a remote-only resource is still owned by this app.
|
|
1875
|
+
* Also records other SDK owners so renamed-empty applications can be handled.
|
|
1876
|
+
* @param params - Ownership classification inputs
|
|
1877
|
+
* @param params.labels - Existing resource labels
|
|
1878
|
+
* @param params.ownerLabel - Existing `sdk-name` label, when present
|
|
1879
|
+
* @param params.appName - Current application name
|
|
1880
|
+
* @param params.appId - Current application id, when present
|
|
1881
|
+
* @param params.resourceOwners - Other-owner accumulator
|
|
1882
|
+
* @returns True when the resource is owned by the current app
|
|
1883
|
+
*/
|
|
1884
|
+
function trackRemainingResourceOwner(params) {
|
|
1885
|
+
const { labels, ownerLabel, appName, appId, resourceOwners } = params;
|
|
1886
|
+
const owned = isOwnedByApp(labels, appName, appId);
|
|
1887
|
+
if (ownerLabel && !owned) resourceOwners.add(ownerLabel);
|
|
1888
|
+
return owned;
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
//#endregion
|
|
1892
|
+
//#region src/cli/commands/deploy/aigateway.ts
|
|
1893
|
+
/**
|
|
1894
|
+
* Apply AI Gateway changes for the given phase.
|
|
1895
|
+
* @param client - Operator client instance
|
|
1896
|
+
* @param result - Planned AI Gateway changes
|
|
1897
|
+
* @param phase - Apply phase
|
|
1898
|
+
* @returns Promise that resolves when AI Gateways are applied
|
|
1899
|
+
*/
|
|
1900
|
+
async function applyAIGateway(client, result, phase = "create-update") {
|
|
1901
|
+
const { changeSet } = result;
|
|
1902
|
+
if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create) => {
|
|
1903
|
+
create.request.cors = await resolveStaticWebsiteUrls(client, assertDefined(create.request.workspaceId, "request missing workspaceId"), create.request.cors, "AIGateway CORS");
|
|
1904
|
+
await client.createAIGateway(create.request);
|
|
1905
|
+
await client.setMetadata(create.metaRequest);
|
|
1906
|
+
}), ...changeSet.updates.map(async (update) => {
|
|
1907
|
+
update.request.cors = await resolveStaticWebsiteUrls(client, assertDefined(update.request.workspaceId, "request missing workspaceId"), update.request.cors, "AIGateway CORS");
|
|
1908
|
+
await client.updateAIGateway(update.request);
|
|
1909
|
+
await client.setMetadata(update.metaRequest);
|
|
1910
|
+
})]);
|
|
1911
|
+
else await Promise.all(changeSet.deletes.map((del) => client.deleteAIGateway(del.request)));
|
|
1912
|
+
}
|
|
1913
|
+
function normalizeComparableAIGatewayShape(input) {
|
|
1914
|
+
return {
|
|
1915
|
+
authNamespace: input.authNamespace,
|
|
1916
|
+
cors: input.cors.toSorted()
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
function normalizeComparableAIGateway(input) {
|
|
1920
|
+
return normalizeComparableAIGatewayShape({
|
|
1921
|
+
authNamespace: input.authNamespace || "",
|
|
1922
|
+
cors: [...input.cors || []]
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function areAIGatewaysEqual(existing, desired) {
|
|
1926
|
+
return areNormalizedEqual(normalizeComparableAIGateway(existing), normalizeComparableAIGateway(desired));
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Plan AI Gateway changes based on current and desired state.
|
|
1930
|
+
* @param context - Planning context
|
|
1931
|
+
* @returns Planned changes
|
|
1932
|
+
*/
|
|
1933
|
+
async function planAIGateway(context) {
|
|
1934
|
+
const { client, workspaceId, application, forRemoval } = context;
|
|
1935
|
+
const changeSet = createChangeSet("AIGateways");
|
|
1936
|
+
const conflicts = [];
|
|
1937
|
+
const unmanaged = [];
|
|
1938
|
+
const resourceOwners = /* @__PURE__ */ new Set();
|
|
1939
|
+
const existingGateways = await fetchExistingResourcesWithLabels({
|
|
1940
|
+
client,
|
|
1941
|
+
workspaceId,
|
|
1942
|
+
fetchPage: async (pageToken, pageSize) => {
|
|
1943
|
+
const { aigateways, nextPageToken } = await client.listAIGateways({
|
|
1944
|
+
workspaceId,
|
|
1945
|
+
pageToken,
|
|
1946
|
+
pageSize
|
|
1947
|
+
});
|
|
1948
|
+
return [aigateways, nextPageToken];
|
|
1949
|
+
},
|
|
1950
|
+
getName: (resource) => resource.name,
|
|
1951
|
+
getTrn: (workspaceId, name) => resourceTrn(workspaceId, "aigateway", name)
|
|
1952
|
+
});
|
|
1953
|
+
const aiGatewayServices = forRemoval ? [] : application.aiGatewayServices;
|
|
1954
|
+
const expectedLocalWebsites = new Set(application.staticWebsiteServices.map((website) => website.name));
|
|
1955
|
+
for (const gatewayService of aiGatewayServices) {
|
|
1956
|
+
const config = gatewayService;
|
|
1957
|
+
const name = gatewayService.name;
|
|
1958
|
+
const existing = existingGateways[name];
|
|
1959
|
+
const metaRequest = await buildMetaRequest({
|
|
1960
|
+
trn: resourceTrn(workspaceId, "aigateway", name),
|
|
1961
|
+
appName: application.name,
|
|
1962
|
+
appId: application.id
|
|
1963
|
+
});
|
|
1964
|
+
const resolvedCors = await resolveStaticWebsiteUrls(client, workspaceId, config.cors ? [...config.cors] : [], "AIGateway CORS", { expectedLocalNames: expectedLocalWebsites });
|
|
1965
|
+
const desired = normalizeComparableAIGateway({
|
|
1966
|
+
...config,
|
|
1967
|
+
cors: resolvedCors
|
|
1968
|
+
});
|
|
1969
|
+
const request = {
|
|
1970
|
+
workspaceId,
|
|
1971
|
+
aigatewayName: name,
|
|
1972
|
+
authNamespace: config.authNamespace,
|
|
1973
|
+
cors: config.cors ? [...config.cors] : []
|
|
1974
|
+
};
|
|
1975
|
+
if (existing) {
|
|
1976
|
+
if (trackDesiredResourceOwnership({
|
|
1977
|
+
labels: existing.allLabels,
|
|
1978
|
+
ownerLabel: existing.label,
|
|
1979
|
+
appName: application.name,
|
|
1980
|
+
appId: application.id,
|
|
1981
|
+
resourceType: "AIGateway",
|
|
1982
|
+
resourceName: name,
|
|
1983
|
+
conflicts,
|
|
1984
|
+
unmanaged
|
|
1985
|
+
}) && hasMatchingSdkVersion(existing.allLabels, metaRequest.labels) && areAIGatewaysEqual(existing.resource, desired)) changeSet.unchanged.push({ name });
|
|
1986
|
+
else changeSet.updates.push({
|
|
1987
|
+
name,
|
|
1988
|
+
request,
|
|
1989
|
+
metaRequest
|
|
1990
|
+
});
|
|
1991
|
+
delete existingGateways[name];
|
|
1992
|
+
} else changeSet.creates.push({
|
|
1993
|
+
name,
|
|
1994
|
+
request,
|
|
1995
|
+
metaRequest
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
Object.entries(existingGateways).forEach(([name, entry]) => {
|
|
1999
|
+
const label = entry?.label;
|
|
2000
|
+
if (trackRemainingResourceOwner({
|
|
2001
|
+
labels: entry?.allLabels,
|
|
2002
|
+
ownerLabel: label,
|
|
2003
|
+
appName: application.name,
|
|
2004
|
+
appId: application.id,
|
|
2005
|
+
resourceOwners
|
|
2006
|
+
})) changeSet.deletes.push({
|
|
2007
|
+
name,
|
|
2008
|
+
request: {
|
|
2009
|
+
workspaceId,
|
|
2010
|
+
aigatewayName: name
|
|
2011
|
+
}
|
|
2012
|
+
});
|
|
2013
|
+
});
|
|
2014
|
+
return {
|
|
2015
|
+
changeSet,
|
|
2016
|
+
conflicts,
|
|
2017
|
+
unmanaged,
|
|
2018
|
+
resourceOwners
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
|
|
1809
2022
|
//#endregion
|
|
1810
2023
|
//#region src/cli/commands/deploy/application.ts
|
|
1811
2024
|
/**
|
|
@@ -4900,88 +5113,6 @@ function normalizeAuthInvoker(authInvoker, authNamespace, context) {
|
|
|
4900
5113
|
return authInvoker;
|
|
4901
5114
|
}
|
|
4902
5115
|
|
|
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
5116
|
//#endregion
|
|
4986
5117
|
//#region src/cli/commands/deploy/executor.ts
|
|
4987
5118
|
/**
|
|
@@ -10620,6 +10751,9 @@ async function shouldForceApplyAll(client, workspaceId, application, functionEnt
|
|
|
10620
10751
|
application.staticWebsiteServices.forEach((website) => {
|
|
10621
10752
|
candidateTrns.add(resourceTrn(workspaceId, "staticwebsite", website.name));
|
|
10622
10753
|
});
|
|
10754
|
+
application.aiGatewayServices.forEach((gateway) => {
|
|
10755
|
+
candidateTrns.add(resourceTrn(workspaceId, "aigateway", gateway.name));
|
|
10756
|
+
});
|
|
10623
10757
|
application.resolverServices.forEach((pipeline) => {
|
|
10624
10758
|
candidateTrns.add(resourceTrn(workspaceId, "pipeline", pipeline.namespace));
|
|
10625
10759
|
});
|
|
@@ -10698,6 +10832,7 @@ function printPlanResults(results) {
|
|
|
10698
10832
|
const authServiceActions = extractServiceActions(results.auth.changeSet.service);
|
|
10699
10833
|
results.staticWebsite.changeSet.print();
|
|
10700
10834
|
results.staticWebsite.customDomainChangeSet.print();
|
|
10835
|
+
results.aiGateway.changeSet.print();
|
|
10701
10836
|
results.app.print();
|
|
10702
10837
|
printGroupedDisplaySection("TailorDB", tailorDBEntries, tailorDBServiceActions);
|
|
10703
10838
|
printGroupedDisplaySection("Resolver", pipelineEntries, pipelineServiceActions);
|
|
@@ -10748,6 +10883,7 @@ function summarizePlanResults(results, displayEntries, serviceActions) {
|
|
|
10748
10883
|
otherChanges,
|
|
10749
10884
|
results.staticWebsite.changeSet,
|
|
10750
10885
|
results.staticWebsite.customDomainChangeSet,
|
|
10886
|
+
results.aiGateway.changeSet,
|
|
10751
10887
|
results.app,
|
|
10752
10888
|
results.secretManager.vaultChangeSet,
|
|
10753
10889
|
results.secretManager.secretChangeSet
|
|
@@ -10852,7 +10988,7 @@ async function deploy(options) {
|
|
|
10852
10988
|
const dryRun = options?.dryRun ?? false;
|
|
10853
10989
|
const yes = options?.yes ?? false;
|
|
10854
10990
|
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 () => {
|
|
10991
|
+
const { functionRegistry, tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
10856
10992
|
const idpUserTriggerTargets = collectIdpUserTriggerTargets(application);
|
|
10857
10993
|
const ctx = {
|
|
10858
10994
|
client,
|
|
@@ -10866,9 +11002,10 @@ async function deploy(options) {
|
|
|
10866
11002
|
};
|
|
10867
11003
|
const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, application.id, functionEntries));
|
|
10868
11004
|
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([
|
|
11005
|
+
const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
|
|
10870
11006
|
withSpan("plan.tailorDB", () => planTailorDB(ctx)),
|
|
10871
11007
|
withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
|
|
11008
|
+
withSpan("plan.aiGateway", () => planAIGateway(ctx)),
|
|
10872
11009
|
withSpan("plan.idp", () => planIdP(ctx)),
|
|
10873
11010
|
withSpan("plan.auth", () => planAuth(ctx)),
|
|
10874
11011
|
withSpan("plan.pipeline", () => planPipeline(ctx)),
|
|
@@ -10881,6 +11018,7 @@ async function deploy(options) {
|
|
|
10881
11018
|
functionRegistry,
|
|
10882
11019
|
tailorDB,
|
|
10883
11020
|
staticWebsite,
|
|
11021
|
+
aiGateway,
|
|
10884
11022
|
idp,
|
|
10885
11023
|
auth,
|
|
10886
11024
|
pipeline,
|
|
@@ -10895,6 +11033,7 @@ async function deploy(options) {
|
|
|
10895
11033
|
...functionRegistry.conflicts,
|
|
10896
11034
|
...tailorDB.conflicts,
|
|
10897
11035
|
...staticWebsite.conflicts,
|
|
11036
|
+
...aiGateway.conflicts,
|
|
10898
11037
|
...idp.conflicts,
|
|
10899
11038
|
...auth.conflicts,
|
|
10900
11039
|
...pipeline.conflicts,
|
|
@@ -10907,6 +11046,7 @@ async function deploy(options) {
|
|
|
10907
11046
|
...functionRegistry.unmanaged,
|
|
10908
11047
|
...tailorDB.unmanaged,
|
|
10909
11048
|
...staticWebsite.unmanaged,
|
|
11049
|
+
...aiGateway.unmanaged,
|
|
10910
11050
|
...idp.unmanaged,
|
|
10911
11051
|
...auth.unmanaged,
|
|
10912
11052
|
...pipeline.unmanaged,
|
|
@@ -10923,6 +11063,10 @@ async function deploy(options) {
|
|
|
10923
11063
|
resourceType: "StaticWebsite",
|
|
10924
11064
|
resourceName: del.name
|
|
10925
11065
|
});
|
|
11066
|
+
for (const del of aiGateway.changeSet.deletes) importantDeletions.push({
|
|
11067
|
+
resourceType: "AIGateway",
|
|
11068
|
+
resourceName: del.name
|
|
11069
|
+
});
|
|
10926
11070
|
for (const del of auth.changeSet.oauth2Client.deletes) importantDeletions.push({
|
|
10927
11071
|
resourceType: "OAuth2 client",
|
|
10928
11072
|
resourceName: del.name
|
|
@@ -10950,6 +11094,7 @@ async function deploy(options) {
|
|
|
10950
11094
|
...functionRegistry.resourceOwners,
|
|
10951
11095
|
...tailorDB.resourceOwners,
|
|
10952
11096
|
...staticWebsite.resourceOwners,
|
|
11097
|
+
...aiGateway.resourceOwners,
|
|
10953
11098
|
...idp.resourceOwners,
|
|
10954
11099
|
...auth.resourceOwners,
|
|
10955
11100
|
...pipeline.resourceOwners,
|
|
@@ -10971,6 +11116,7 @@ async function deploy(options) {
|
|
|
10971
11116
|
functionRegistry,
|
|
10972
11117
|
tailorDB,
|
|
10973
11118
|
staticWebsite,
|
|
11119
|
+
aiGateway,
|
|
10974
11120
|
idp,
|
|
10975
11121
|
auth,
|
|
10976
11122
|
pipeline,
|
|
@@ -11000,6 +11146,7 @@ async function deploy(options) {
|
|
|
11000
11146
|
await applySecretManager(client, secretManager, "create-update", application);
|
|
11001
11147
|
await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
|
|
11002
11148
|
await applyStaticWebsite(client, staticWebsite, "create-update");
|
|
11149
|
+
await applyAIGateway(client, aiGateway, "create-update");
|
|
11003
11150
|
await applyIdP(client, idp, "create-update");
|
|
11004
11151
|
await applyAuth(client, auth, "create-update");
|
|
11005
11152
|
await applyTailorDB(client, tailorDB, "create-update");
|
|
@@ -11019,6 +11166,7 @@ async function deploy(options) {
|
|
|
11019
11166
|
await applyWorkflow(client, workflow, "delete");
|
|
11020
11167
|
await applyExecutor(client, executor, "delete");
|
|
11021
11168
|
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
11169
|
+
await applyAIGateway(client, aiGateway, "delete");
|
|
11022
11170
|
await applySecretManager(client, secretManager, "delete");
|
|
11023
11171
|
});
|
|
11024
11172
|
await withSpan("apply.deleteApplication", () => applyApplication(client, app, "delete"));
|
|
@@ -14561,6 +14709,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14561
14709
|
};
|
|
14562
14710
|
const tailorDB = await planTailorDB(ctx);
|
|
14563
14711
|
const staticWebsite = await planStaticWebsite(ctx);
|
|
14712
|
+
const aiGateway = await planAIGateway(ctx);
|
|
14564
14713
|
const idp = await planIdP(ctx);
|
|
14565
14714
|
const auth = await planAuth(ctx);
|
|
14566
14715
|
const pipeline = await planPipeline(ctx);
|
|
@@ -14571,6 +14720,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14571
14720
|
const secretManager = await planSecretManager(ctx);
|
|
14572
14721
|
functionRegistry.changeSet.print();
|
|
14573
14722
|
staticWebsite.changeSet.print();
|
|
14723
|
+
aiGateway.changeSet.print();
|
|
14574
14724
|
app.print();
|
|
14575
14725
|
tailorDB.changeSet.service.print();
|
|
14576
14726
|
tailorDB.changeSet.type.print();
|
|
@@ -14593,11 +14743,12 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
14593
14743
|
auth.changeSet.connection.print();
|
|
14594
14744
|
secretManager.vaultChangeSet.print();
|
|
14595
14745
|
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;
|
|
14746
|
+
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
14747
|
if (confirm) await confirm();
|
|
14598
14748
|
await applyWorkflow(client, workflow, "delete");
|
|
14599
14749
|
await applyExecutor(client, executor, "delete");
|
|
14600
14750
|
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
14751
|
+
await applyAIGateway(client, aiGateway, "delete");
|
|
14601
14752
|
await applyApplication(client, app, "delete");
|
|
14602
14753
|
await applyPipeline(client, pipeline, "delete-resources");
|
|
14603
14754
|
await applyPipeline(client, pipeline, "delete-services");
|
|
@@ -15384,7 +15535,7 @@ async function generate(options) {
|
|
|
15384
15535
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
15385
15536
|
let pluginManager;
|
|
15386
15537
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
15387
|
-
const { defineApplication } = await import("./application-
|
|
15538
|
+
const { defineApplication } = await import("./application-nTydHJm8.mjs");
|
|
15388
15539
|
const application = defineApplication({
|
|
15389
15540
|
config,
|
|
15390
15541
|
pluginManager
|
|
@@ -17545,4 +17696,4 @@ function isDeno() {
|
|
|
17545
17696
|
|
|
17546
17697
|
//#endregion
|
|
17547
17698
|
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-
|
|
17699
|
+
//# sourceMappingURL=runtime-2nzOZCUb.mjs.map
|