@tailor-platform/sdk 0.23.0 → 0.23.2

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 0.23.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#296](https://github.com/tailor-platform/sdk/pull/296) [`adb9a9d`](https://github.com/tailor-platform/sdk/commit/adb9a9d5d6dad4b961fb8dd448ea2b08d610fc5b) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix service deletion order to prevent "used by gateway(s)" error
8
+
9
+ When deleting subgraph services (TailorDB, Pipeline, Auth, IdP), the deletion would fail with an error like "Failed to delete AuthService: auth xxx is used by gateway(s)" because the Application was still referencing them.
10
+
11
+ This fix separates the deletion phases:
12
+ - `delete-resources`: Deletes resources (types, resolvers, clients, etc.) before Application update
13
+ - `delete-services`: Deletes services after Application is deleted
14
+
15
+ This ensures services are deleted only after the Application no longer references them.
16
+
17
+ ## 0.23.1
18
+
19
+ ### Patch Changes
20
+
21
+ - [#294](https://github.com/tailor-platform/sdk/pull/294) [`91bafb7`](https://github.com/tailor-platform/sdk/commit/91bafb7d5b8d0c4b2c9fb9f8b9260e33c6213df0) Thanks [@remiposo](https://github.com/remiposo)! - feat: Support optional namespace for userProfile in auth config
22
+ - Auto-resolve namespace when only one TailorDB exists (including external)
23
+ - Allow explicit namespace specification when multiple TailorDBs exist
24
+
3
25
  ## 0.23.0
4
26
 
5
27
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "../chunk-DhYkiPYI.mjs";
3
3
  import "../config-CtRi0Lgg.mjs";
4
- import { $ as jsonArgs, A as printData, B as loadAccessToken, D as tokenCommand, G as fetchUserInfo, H as readPlatformConfig, I as loadConfig, J as readPackageJson, K as initOAuth2Client, M as generateCommand, O as listCommand$5, P as applyCommand, Q as deploymentArgs, R as apiCommand, S as listCommand$6, U as writePlatformConfig, V as loadWorkspaceId, W as fetchAll, X as commonArgs, Y as PATScope, Z as confirmationArgs, a as createCommand$3, d as listCommand$7, et as withCommonArgs, h as executionsCommand, l as startCommand, nt as logger, p as getCommand$2, q as initOperatorClient, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as workspaceArgs, w as getCommand$1, x as removeCommand, y as showCommand, z as fetchLatestToken } from "../list-DLqfJ2jD.mjs";
4
+ import { $ as jsonArgs, A as printData, B as loadAccessToken, D as tokenCommand, G as fetchUserInfo, H as readPlatformConfig, I as loadConfig, J as readPackageJson, K as initOAuth2Client, M as generateCommand, O as listCommand$5, P as applyCommand, Q as deploymentArgs, R as apiCommand, S as listCommand$6, U as writePlatformConfig, V as loadWorkspaceId, W as fetchAll, X as commonArgs, Y as PATScope, Z as confirmationArgs, a as createCommand$3, d as listCommand$7, et as withCommonArgs, h as executionsCommand, l as startCommand, nt as logger, p as getCommand$2, q as initOperatorClient, r as deleteCommand$3, s as resumeCommand, t as listCommand$8, tt as workspaceArgs, w as getCommand$1, x as removeCommand, y as showCommand, z as fetchLatestToken } from "../list-BvYJeydE.mjs";
5
5
  import { register } from "node:module";
6
6
  import { defineCommand, runCommand, runMain } from "citty";
7
7
  import { generateCodeVerifier } from "@badgateway/oauth2-client";
@@ -1,5 +1,6 @@
1
1
  /// <reference path="./../user-defined.d.ts" />
2
- import { J as IdProviderConfig, P as ParsedTailorDBType, X as OAuth2ClientInput, _t as Resolver, d as AppConfig, h as Generator, m as CodeGeneratorBase, t as Executor } from "../types-ClG0gN3S.mjs";
2
+ import { J as IdProviderConfig, P as ParsedTailorDBType, X as OAuth2ClientInput, _t as Resolver, d as AppConfig, h as Generator, m as CodeGeneratorBase, t as Executor } from "../types-CgO-wV9v.mjs";
3
+ import "citty";
3
4
  import { z } from "zod";
4
5
  import { OAuth2Client } from "@badgateway/oauth2-client";
5
6
  import "@bufbuild/protobuf/wkt";
package/dist/cli/lib.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../chunk-DhYkiPYI.mjs";
2
2
  import "../config-CtRi0Lgg.mjs";
3
- import { B as loadAccessToken, C as listOAuth2Clients, E as getMachineUserToken, F as generateUserTypes, I as loadConfig, L as apiCall, N as apply, T as getOAuth2Client, V as loadWorkspaceId, _ as listWorkflowExecutions, b as remove, c as resumeWorkflow, f as listWorkflows, g as getWorkflowExecution, i as deleteWorkspace, j as generate, k as listMachineUsers, m as getWorkflow, n as listWorkspaces, o as createWorkspace, u as startWorkflow, v as show } from "../list-DLqfJ2jD.mjs";
3
+ import { B as loadAccessToken, C as listOAuth2Clients, E as getMachineUserToken, F as generateUserTypes, I as loadConfig, L as apiCall, N as apply, T as getOAuth2Client, V as loadWorkspaceId, _ as listWorkflowExecutions, b as remove, c as resumeWorkflow, f as listWorkflows, g as getWorkflowExecution, i as deleteWorkspace, j as generate, k as listMachineUsers, m as getWorkflow, n as listWorkspaces, o as createWorkspace, u as startWorkflow, v as show } from "../list-BvYJeydE.mjs";
4
4
  import { register } from "node:module";
5
5
 
6
6
  //#region src/cli/lib.ts
@@ -1,4 +1,4 @@
1
1
  /// <reference path="./../user-defined.d.ts" />
2
- import { $ as SCIMAttribute, A as TailorDBType, B as AuthConfig, C as ResolverExternalConfig, D as ExecutorServiceInput, E as ExecutorServiceConfig, F as PermissionCondition, G as AuthServiceInput, H as AuthInvoker, I as TailorTypeGqlPermission, J as IdProviderConfig, K as BuiltinIdP, L as TailorTypePermission, O as TailorDBField, Q as SAML, R as unsafeAllowAllGqlPermission, S as defineIdp, T as ResolverServiceInput, U as AuthOwnConfig, V as AuthExternalConfig, W as defineAuth, X as OAuth2ClientInput, Y as OAuth2ClientGrantType, Z as OIDC, _ as WorkflowServiceInput, _t as Resolver, at as TenantProviderConfig, b as IdPConfig, ct as UserAttributeMap, dt as AttributeList, et as SCIMAttributeMapping, f as defineConfig, ft as AttributeMap, g as WorkflowServiceConfig, gt as QueryType, ht as TailorField, it as SCIMResource, j as db, k as TailorDBInstance, lt as UsernameFieldKey, mt as unauthenticatedTailorUser, nt as SCIMAuthorization, ot as UserAttributeKey, p as defineGenerators, pt as TailorUser, q as IDToken, rt as SCIMConfig, st as UserAttributeListKey, tt as SCIMAttributeType, ut as ValueOperand, v as StaticWebsiteConfig, w as ResolverServiceConfig, x as IdPExternalConfig, y as defineStaticWebSite, z as unsafeAllowAllTypePermission } from "../types-ClG0gN3S.mjs";
3
- import { A as WORKFLOW_JOB_BRAND, C as GqlOperation, D as Workflow, E as WorkflowOperation, F as createWorkflowJob, I as createResolver, L as Env, M as WorkflowJobContext, N as WorkflowJobInput, O as WorkflowConfig, P as WorkflowJobOutput, S as FunctionOperation, T as WebhookOperation, _ as ResolverExecutedTrigger, a as Trigger, b as recordUpdatedTrigger, c as IncomingWebhookTrigger, d as scheduleTrigger, f as RecordCreatedArgs, g as ResolverExecutedArgs, h as RecordUpdatedArgs, i as createExecutor, j as WorkflowJob, k as createWorkflow, l as incomingWebhookTrigger, m as RecordTrigger, n as output, o as IncomingWebhookArgs, p as RecordDeletedArgs, r as t, s as IncomingWebhookRequest, t as infer, u as ScheduleTrigger, v as recordCreatedTrigger, w as Operation, x as resolverExecutedTrigger, y as recordDeletedTrigger } from "../index-QGMXFOXH.mjs";
2
+ import { $ as SCIMAttribute, A as TailorDBType, B as AuthConfig, C as ResolverExternalConfig, D as ExecutorServiceInput, E as ExecutorServiceConfig, F as PermissionCondition, G as AuthServiceInput, H as AuthInvoker, I as TailorTypeGqlPermission, J as IdProviderConfig, K as BuiltinIdP, L as TailorTypePermission, O as TailorDBField, Q as SAML, R as unsafeAllowAllGqlPermission, S as defineIdp, T as ResolverServiceInput, U as AuthOwnConfig, V as AuthExternalConfig, W as defineAuth, X as OAuth2ClientInput, Y as OAuth2ClientGrantType, Z as OIDC, _ as WorkflowServiceInput, _t as Resolver, at as TenantProviderConfig, b as IdPConfig, ct as UserAttributeMap, dt as AttributeList, et as SCIMAttributeMapping, f as defineConfig, ft as AttributeMap, g as WorkflowServiceConfig, gt as QueryType, ht as TailorField, it as SCIMResource, j as db, k as TailorDBInstance, lt as UsernameFieldKey, mt as unauthenticatedTailorUser, nt as SCIMAuthorization, ot as UserAttributeKey, p as defineGenerators, pt as TailorUser, q as IDToken, rt as SCIMConfig, st as UserAttributeListKey, tt as SCIMAttributeType, ut as ValueOperand, v as StaticWebsiteConfig, w as ResolverServiceConfig, x as IdPExternalConfig, y as defineStaticWebSite, z as unsafeAllowAllTypePermission } from "../types-CgO-wV9v.mjs";
3
+ import { A as WORKFLOW_JOB_BRAND, C as GqlOperation, D as Workflow, E as WorkflowOperation, F as createWorkflowJob, I as createResolver, L as Env, M as WorkflowJobContext, N as WorkflowJobInput, O as WorkflowConfig, P as WorkflowJobOutput, S as FunctionOperation, T as WebhookOperation, _ as ResolverExecutedTrigger, a as Trigger, b as recordUpdatedTrigger, c as IncomingWebhookTrigger, d as scheduleTrigger, f as RecordCreatedArgs, g as ResolverExecutedArgs, h as RecordUpdatedArgs, i as createExecutor, j as WorkflowJob, k as createWorkflow, l as incomingWebhookTrigger, m as RecordTrigger, n as output, o as IncomingWebhookArgs, p as RecordDeletedArgs, r as t, s as IncomingWebhookRequest, t as infer, u as ScheduleTrigger, v as recordCreatedTrigger, w as Operation, x as resolverExecutedTrigger, y as recordDeletedTrigger } from "../index-CANeLBB6.mjs";
4
4
  export { AttributeList, AttributeMap, AuthConfig, AuthExternalConfig, AuthInvoker, AuthOwnConfig, AuthServiceInput, BuiltinIdP, Env, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GqlOperation, IDToken, IdPConfig, IdPExternalConfig, IdProviderConfig, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, OAuth2ClientInput as OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverExternalConfig, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleTrigger, StaticWebsiteConfig, TailorDBField, TailorDBInstance, TailorDBType, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WORKFLOW_JOB_BRAND, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowJobInput, WorkflowJobOutput, WorkflowOperation, WorkflowServiceConfig, WorkflowServiceInput, createExecutor, createResolver, createWorkflow, createWorkflowJob, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./user-defined.d.ts" />
2
- import { A as TailorDBType, Ct as InferFieldsOutput, H as AuthInvoker, M as AllowedValues, N as AllowedValuesOutput, St as FieldOutput, Tt as output$1, a as IncomingWebhookTrigger$1, bt as FieldMetadata, c as ScheduleTriggerInput, ht as TailorField, i as GqlOperation$1, l as WebhookOperation$1, n as ExecutorInput, o as RecordTrigger$1, pt as TailorUser, r as FunctionOperation$1, s as ResolverExecutedTrigger$1, u as WorkflowOperation$1, vt as ResolverInput, wt as JsonCompatible, xt as FieldOptions, yt as ArrayFieldOutput } from "./types-ClG0gN3S.mjs";
2
+ import { A as TailorDBType, Ct as InferFieldsOutput, H as AuthInvoker, M as AllowedValues, N as AllowedValuesOutput, St as FieldOutput, Tt as output$1, a as IncomingWebhookTrigger$1, bt as FieldMetadata, c as ScheduleTriggerInput, ht as TailorField, i as GqlOperation$1, l as WebhookOperation$1, n as ExecutorInput, o as RecordTrigger$1, pt as TailorUser, r as FunctionOperation$1, s as ResolverExecutedTrigger$1, u as WorkflowOperation$1, vt as ResolverInput, wt as JsonCompatible, xt as FieldOptions, yt as ArrayFieldOutput } from "./types-CgO-wV9v.mjs";
3
3
  import { EmptyObject, JsonPrimitive, Jsonifiable, Jsonify } from "type-fest";
4
4
  import { Client } from "@urql/core";
5
5
  import { StandardCRON } from "ts-cron-validator";
@@ -355,4 +355,4 @@ declare namespace t {
355
355
  }
356
356
  //#endregion
357
357
  export { WORKFLOW_JOB_BRAND as A, GqlOperation as C, Workflow as D, WorkflowOperation as E, createWorkflowJob as F, createResolver as I, Env as L, WorkflowJobContext as M, WorkflowJobInput as N, WorkflowConfig as O, WorkflowJobOutput as P, FunctionOperation as S, WebhookOperation as T, ResolverExecutedTrigger as _, Trigger as a, recordUpdatedTrigger as b, IncomingWebhookTrigger as c, scheduleTrigger as d, RecordCreatedArgs as f, ResolverExecutedArgs as g, RecordUpdatedArgs as h, createExecutor as i, WorkflowJob as j, createWorkflow as k, incomingWebhookTrigger as l, RecordTrigger as m, output as n, IncomingWebhookArgs as o, RecordDeletedArgs as p, t as r, IncomingWebhookRequest as s, infer as t, ScheduleTrigger as u, recordCreatedTrigger as v, Operation as w, resolverExecutedTrigger as x, recordDeletedTrigger as y };
358
- //# sourceMappingURL=index-QGMXFOXH.d.mts.map
358
+ //# sourceMappingURL=index-CANeLBB6.d.mts.map
@@ -1610,11 +1610,11 @@ const AuthConfigSchema = z.object({
1610
1610
  //#region src/cli/application/auth/service.ts
1611
1611
  var AuthService = class {
1612
1612
  _userProfile;
1613
- _tenantProvider;
1614
1613
  _parsedConfig;
1615
- constructor(config, tailorDBServices) {
1614
+ constructor(config, tailorDBServices, externalTailorDBNamespaces) {
1616
1615
  this.config = config;
1617
1616
  this.tailorDBServices = tailorDBServices;
1617
+ this.externalTailorDBNamespaces = externalTailorDBNamespaces;
1618
1618
  this._parsedConfig = {
1619
1619
  ...config,
1620
1620
  idProvider: IdProviderSchema.optional().parse(config.idProvider)
@@ -1623,46 +1623,45 @@ var AuthService = class {
1623
1623
  get userProfile() {
1624
1624
  return this._userProfile;
1625
1625
  }
1626
- get tenantProvider() {
1627
- return this._tenantProvider;
1628
- }
1629
1626
  get parsedConfig() {
1630
1627
  return this._parsedConfig;
1631
1628
  }
1629
+ /**
1630
+ * Resolves namespace for userProfile.
1631
+ *
1632
+ * Resolution priority:
1633
+ * 1. Explicit namespace in config
1634
+ * 2. Single TailorDB (regular or external) → use that namespace
1635
+ * 3. Multiple TailorDBs → search by type name (external cannot be searched)
1636
+ */
1632
1637
  async resolveNamespaces() {
1633
- await Promise.all(this.tailorDBServices.map((service) => service.loadTypes()));
1634
- if (this.tailorDBServices.length === 1) {
1635
- const singleNamespace = this.tailorDBServices[0].namespace;
1636
- this._userProfile = this.config.userProfile ? {
1638
+ if (!this.config.userProfile) return;
1639
+ if (this.config.userProfile.namespace) {
1640
+ this._userProfile = {
1637
1641
  ...this.config.userProfile,
1638
- namespace: singleNamespace
1639
- } : void 0;
1640
- this._tenantProvider = this.config.tenantProvider ? {
1641
- ...this.config.tenantProvider,
1642
- namespace: singleNamespace
1643
- } : void 0;
1642
+ namespace: this.config.userProfile.namespace
1643
+ };
1644
1644
  return;
1645
1645
  }
1646
- const userProfileTypeName = this.config.userProfile?.type && typeof this.config.userProfile.type === "object" && "name" in this.config.userProfile.type ? this.config.userProfile.type.name : void 0;
1647
- const tenantProviderTypeName = typeof this.config.tenantProvider?.type === "string" ? this.config.tenantProvider.type : void 0;
1646
+ const totalNamespaceCount = this.tailorDBServices.length + this.externalTailorDBNamespaces.length;
1648
1647
  let userProfileNamespace;
1649
- let tenantProviderNamespace;
1650
- for (const service of this.tailorDBServices) {
1651
- const types$2 = service.getTypes();
1652
- if (userProfileTypeName && !userProfileNamespace && Object.prototype.hasOwnProperty.call(types$2, userProfileTypeName)) userProfileNamespace = service.namespace;
1653
- if (tenantProviderTypeName && !tenantProviderNamespace && Object.prototype.hasOwnProperty.call(types$2, tenantProviderTypeName)) tenantProviderNamespace = service.namespace;
1654
- if (userProfileNamespace && tenantProviderNamespace) break;
1655
- }
1656
- if (this.config.userProfile && !userProfileNamespace) throw new Error(`userProfile type "${this.config.userProfile.type.name}" not found in any TailorDB namespace`);
1657
- if (this.config.tenantProvider && !tenantProviderNamespace) throw new Error(`tenantProvider type "${this.config.tenantProvider.type}" not found in any TailorDB namespace`);
1658
- this._userProfile = this.config.userProfile ? {
1648
+ if (totalNamespaceCount === 1) userProfileNamespace = this.tailorDBServices[0]?.namespace ?? this.externalTailorDBNamespaces[0];
1649
+ else {
1650
+ await Promise.all(this.tailorDBServices.map((service) => service.loadTypes()));
1651
+ const userProfileTypeName = typeof this.config.userProfile.type === "object" && "name" in this.config.userProfile.type ? this.config.userProfile.type.name : void 0;
1652
+ if (userProfileTypeName) for (const service of this.tailorDBServices) {
1653
+ const types$2 = service.getTypes();
1654
+ if (Object.prototype.hasOwnProperty.call(types$2, userProfileTypeName)) {
1655
+ userProfileNamespace = service.namespace;
1656
+ break;
1657
+ }
1658
+ }
1659
+ if (!userProfileNamespace) throw new Error(`userProfile type "${this.config.userProfile.type.name}" not found in any TailorDB namespace`);
1660
+ }
1661
+ this._userProfile = {
1659
1662
  ...this.config.userProfile,
1660
1663
  namespace: userProfileNamespace
1661
- } : void 0;
1662
- this._tenantProvider = this.config.tenantProvider ? {
1663
- ...this.config.tenantProvider,
1664
- namespace: tenantProviderNamespace
1665
- } : void 0;
1664
+ };
1666
1665
  }
1667
1666
  };
1668
1667
 
@@ -98423,6 +98422,7 @@ const StaticWebsiteSchema = z.object({
98423
98422
  //#region src/cli/application/index.ts
98424
98423
  var Application = class {
98425
98424
  _tailorDBServices = [];
98425
+ _externalTailorDBNamespaces = [];
98426
98426
  _resolverServices = [];
98427
98427
  _idpServices = [];
98428
98428
  _authService = void 0;
@@ -98448,6 +98448,9 @@ var Application = class {
98448
98448
  get tailorDBServices() {
98449
98449
  return this._tailorDBServices;
98450
98450
  }
98451
+ get externalTailorDBNamespaces() {
98452
+ return this._externalTailorDBNamespaces;
98453
+ }
98451
98454
  get resolverServices() {
98452
98455
  return this._resolverServices;
98453
98456
  }
@@ -98475,7 +98478,8 @@ var Application = class {
98475
98478
  defineTailorDB(config) {
98476
98479
  if (!config) return;
98477
98480
  for (const [namespace, serviceConfig] of Object.entries(config)) {
98478
- if (!("external" in serviceConfig)) {
98481
+ if ("external" in serviceConfig) this._externalTailorDBNamespaces.push(namespace);
98482
+ else {
98479
98483
  const tailorDB = new TailorDBService(namespace, serviceConfig);
98480
98484
  this._tailorDBServices.push(tailorDB);
98481
98485
  }
@@ -98508,7 +98512,7 @@ var Application = class {
98508
98512
  }
98509
98513
  defineAuth(config) {
98510
98514
  if (!config) return;
98511
- if (!("external" in config)) this._authService = new AuthService(config, this.tailorDBServices);
98515
+ if (!("external" in config)) this._authService = new AuthService(config, this.tailorDBServices, this.externalTailorDBNamespaces);
98512
98516
  this.addSubgraph("auth", config.name);
98513
98517
  }
98514
98518
  defineExecutor(config) {
@@ -100945,17 +100949,15 @@ async function applyIdP(client, result, phase = "create-update") {
100945
100949
  secretmanagerSecretValue: update.clientSecret
100946
100950
  });
100947
100951
  })]);
100948
- } else if (phase === "delete") {
100949
- await Promise.all(changeSet.client.deletes.map(async (del) => {
100950
- await client.deleteIdPClient(del.request);
100951
- const vaultName = `idp-${del.request.namespaceName}-${del.request.name}`;
100952
- await client.deleteSecretManagerVault({
100953
- workspaceId: del.request.workspaceId,
100954
- secretmanagerVaultName: vaultName
100955
- });
100956
- }));
100957
- await Promise.all(changeSet.service.deletes.map((del) => client.deleteIdPService(del.request)));
100958
- }
100952
+ } else if (phase === "delete-resources") await Promise.all(changeSet.client.deletes.map(async (del) => {
100953
+ await client.deleteIdPClient(del.request);
100954
+ const vaultName = `idp-${del.request.namespaceName}-${del.request.name}`;
100955
+ await client.deleteSecretManagerVault({
100956
+ workspaceId: del.request.workspaceId,
100957
+ secretmanagerVaultName: vaultName
100958
+ });
100959
+ }));
100960
+ else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteIdPService(del.request)));
100959
100961
  }
100960
100962
  async function planIdP({ client, workspaceId, application, forRemoval }) {
100961
100963
  const idps = forRemoval ? [] : application.idpServices;
@@ -101171,7 +101173,7 @@ async function applyAuth(client, result, phase = "create-update") {
101171
101173
  })]);
101172
101174
  await Promise.all([...changeSet.scim.creates.map((create$1) => client.createAuthSCIMConfig(create$1.request)), ...changeSet.scim.updates.map((update) => client.updateAuthSCIMConfig(update.request))]);
101173
101175
  await Promise.all([...changeSet.scimResource.creates.map((create$1) => client.createAuthSCIMResource(create$1.request)), ...changeSet.scimResource.updates.map((update) => client.updateAuthSCIMResource(update.request))]);
101174
- } else if (phase === "delete") {
101176
+ } else if (phase === "delete-resources") {
101175
101177
  await Promise.all(changeSet.scimResource.deletes.map((del) => client.deleteAuthSCIMResource(del.request)));
101176
101178
  await Promise.all(changeSet.scim.deletes.map((del) => client.deleteAuthSCIMConfig(del.request)));
101177
101179
  await Promise.all(changeSet.oauth2Client.deletes.map((del) => client.deleteAuthOAuth2Client(del.request)));
@@ -101179,8 +101181,7 @@ async function applyAuth(client, result, phase = "create-update") {
101179
101181
  await Promise.all(changeSet.tenantConfig.deletes.map((del) => client.deleteTenantConfig(del.request)));
101180
101182
  await Promise.all(changeSet.userProfileConfig.deletes.map((del) => client.deleteUserProfileConfig(del.request)));
101181
101183
  await Promise.all(changeSet.idpConfig.deletes.map((del) => client.deleteAuthIDPConfig(del.request)));
101182
- await Promise.all(changeSet.service.deletes.map((del) => client.deleteAuthService(del.request)));
101183
- }
101184
+ } else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteAuthService(del.request)));
101184
101185
  }
101185
101186
  async function planAuth({ client, workspaceId, application, forRemoval }) {
101186
101187
  const auths = [];
@@ -101536,24 +101537,24 @@ async function planTenantConfigs(client, workspaceId, auths, deletedServices) {
101536
101537
  });
101537
101538
  } catch (error) {
101538
101539
  if (error instanceof ConnectError && error.code === Code.NotFound) {
101539
- if (auth.tenantProvider) changeSet.creates.push({
101540
+ if (config.tenantProvider) changeSet.creates.push({
101540
101541
  name: name$1,
101541
101542
  request: {
101542
101543
  workspaceId,
101543
101544
  namespaceName: config.name,
101544
- tenantProviderConfig: protoTenantConfig(auth.tenantProvider)
101545
+ tenantProviderConfig: protoTenantConfig(config.tenantProvider)
101545
101546
  }
101546
101547
  });
101547
101548
  continue;
101548
101549
  }
101549
101550
  throw error;
101550
101551
  }
101551
- if (auth.tenantProvider) changeSet.updates.push({
101552
+ if (config.tenantProvider) changeSet.updates.push({
101552
101553
  name: name$1,
101553
101554
  request: {
101554
101555
  workspaceId,
101555
101556
  namespaceName: config.name,
101556
- tenantProviderConfig: protoTenantConfig(auth.tenantProvider)
101557
+ tenantProviderConfig: protoTenantConfig(config.tenantProvider)
101557
101558
  }
101558
101559
  });
101559
101560
  else changeSet.deletes.push({
@@ -102326,10 +102327,8 @@ async function applyPipeline(client, result, phase = "create-update") {
102326
102327
  await client.setMetadata(update.metaRequest);
102327
102328
  })]);
102328
102329
  await Promise.all([...changeSet.resolver.creates.map((create$1) => client.createPipelineResolver(create$1.request)), ...changeSet.resolver.updates.map((update) => client.updatePipelineResolver(update.request))]);
102329
- } else if (phase === "delete") {
102330
- await Promise.all(changeSet.resolver.deletes.map((del) => client.deletePipelineResolver(del.request)));
102331
- await Promise.all(changeSet.service.deletes.map((del) => client.deletePipelineService(del.request)));
102332
- }
102330
+ } else if (phase === "delete-resources") await Promise.all(changeSet.resolver.deletes.map((del) => client.deletePipelineResolver(del.request)));
102331
+ else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deletePipelineService(del.request)));
102333
102332
  }
102334
102333
  async function planPipeline({ client, workspaceId, application, forRemoval }) {
102335
102334
  const pipelines = [];
@@ -102677,11 +102676,10 @@ async function applyTailorDB(client, result, phase = "create-update") {
102677
102676
  }), ...changeSet.service.updates.map((update) => client.setMetadata(update.metaRequest))]);
102678
102677
  await Promise.all([...changeSet.type.creates.map((create$1) => client.createTailorDBType(create$1.request)), ...changeSet.type.updates.map((update) => client.updateTailorDBType(update.request))]);
102679
102678
  await Promise.all([...changeSet.gqlPermission.creates.map((create$1) => client.createTailorDBGQLPermission(create$1.request)), ...changeSet.gqlPermission.updates.map((update) => client.updateTailorDBGQLPermission(update.request))]);
102680
- } else if (phase === "delete") {
102679
+ } else if (phase === "delete-resources") {
102681
102680
  await Promise.all(changeSet.gqlPermission.deletes.map((del) => client.deleteTailorDBGQLPermission(del.request)));
102682
102681
  await Promise.all(changeSet.type.deletes.map((del) => client.deleteTailorDBType(del.request)));
102683
- await Promise.all(changeSet.service.deletes.map((del) => client.deleteTailorDBService(del.request)));
102684
- }
102682
+ } else if (phase === "delete-services") await Promise.all(changeSet.service.deletes.map((del) => client.deleteTailorDBService(del.request)));
102685
102683
  }
102686
102684
  async function planTailorDB({ client, workspaceId, application, forRemoval }) {
102687
102685
  const tailordbs = [];
@@ -103480,10 +103478,10 @@ async function apply(options) {
103480
103478
  await applyIdP(client, idp, "create-update");
103481
103479
  await applyAuth(client, auth, "create-update");
103482
103480
  await applyPipeline(client, pipeline, "create-update");
103483
- await applyPipeline(client, pipeline, "delete");
103484
- await applyAuth(client, auth, "delete");
103485
- await applyIdP(client, idp, "delete");
103486
- await applyTailorDB(client, tailorDB, "delete");
103481
+ await applyPipeline(client, pipeline, "delete-resources");
103482
+ await applyAuth(client, auth, "delete-resources");
103483
+ await applyIdP(client, idp, "delete-resources");
103484
+ await applyTailorDB(client, tailorDB, "delete-resources");
103487
103485
  await applyApplication(client, app, "create-update");
103488
103486
  await applyExecutor(client, executor, "create-update");
103489
103487
  await applyWorkflow(client, workflow, "create-update");
@@ -103491,6 +103489,10 @@ async function apply(options) {
103491
103489
  await applyExecutor(client, executor, "delete");
103492
103490
  await applyStaticWebsite(client, staticWebsite, "delete");
103493
103491
  await applyApplication(client, app, "delete");
103492
+ await applyPipeline(client, pipeline, "delete-services");
103493
+ await applyAuth(client, auth, "delete-services");
103494
+ await applyIdP(client, idp, "delete-services");
103495
+ await applyTailorDB(client, tailorDB, "delete-services");
103494
103496
  logger.success("Successfully applied changes.");
103495
103497
  }
103496
103498
  async function buildPipeline(namespace, config, triggerContext) {
@@ -104587,12 +104589,16 @@ async function execRemove(client, workspaceId, application, confirm) {
104587
104589
  if (confirm) await confirm();
104588
104590
  await applyWorkflow(client, workflow, "delete");
104589
104591
  await applyExecutor(client, executor, "delete");
104590
- await applyApplication(client, app, "delete");
104591
- await applyPipeline(client, pipeline, "delete");
104592
- await applyAuth(client, auth, "delete");
104593
- await applyIdP(client, idp, "delete");
104594
104592
  await applyStaticWebsite(client, staticWebsite, "delete");
104595
- await applyTailorDB(client, tailorDB, "delete");
104593
+ await applyApplication(client, app, "delete");
104594
+ await applyPipeline(client, pipeline, "delete-resources");
104595
+ await applyPipeline(client, pipeline, "delete-services");
104596
+ await applyAuth(client, auth, "delete-resources");
104597
+ await applyAuth(client, auth, "delete-services");
104598
+ await applyIdP(client, idp, "delete-resources");
104599
+ await applyIdP(client, idp, "delete-services");
104600
+ await applyTailorDB(client, tailorDB, "delete-resources");
104601
+ await applyTailorDB(client, tailorDB, "delete-services");
104596
104602
  }
104597
104603
  async function remove(options) {
104598
104604
  const { client, workspaceId, application } = await loadOptions$1(options);
@@ -105596,4 +105602,4 @@ const listCommand = defineCommand({
105596
105602
 
105597
105603
  //#endregion
105598
105604
  export { jsonArgs as $, printData as A, loadAccessToken as B, listOAuth2Clients as C, tokenCommand as D, getMachineUserToken as E, generateUserTypes as F, fetchUserInfo as G, readPlatformConfig as H, loadConfig as I, readPackageJson as J, initOAuth2Client as K, apiCall as L, generateCommand as M, apply as N, listCommand$3 as O, applyCommand as P, deploymentArgs as Q, apiCommand as R, listCommand$2 as S, getOAuth2Client as T, writePlatformConfig as U, loadWorkspaceId as V, fetchAll as W, commonArgs as X, PATScope as Y, confirmationArgs as Z, listWorkflowExecutions as _, createCommand as a, remove as b, resumeWorkflow as c, listCommand$1 as d, withCommonArgs as et, listWorkflows as f, getWorkflowExecution as g, executionsCommand as h, deleteWorkspace as i, generate as j, listMachineUsers as k, startCommand as l, getWorkflow as m, listWorkspaces as n, logger as nt, createWorkspace as o, getCommand as p, initOperatorClient as q, deleteCommand as r, resumeCommand as s, listCommand as t, workspaceArgs as tt, startWorkflow as u, show as v, getCommand$1 as w, removeCommand as x, showCommand as y, fetchLatestToken as z };
105599
- //# sourceMappingURL=list-DLqfJ2jD.mjs.map
105605
+ //# sourceMappingURL=list-BvYJeydE.mjs.map