@tailor-platform/sdk 0.22.0 → 0.22.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.
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __export, t as __commonJSMin } from "./chunk-DhYkiPYI.mjs";
2
- import { i as WORKFLOW_JOB_BRAND, r as getDistDir, u as tailorUserMap } from "./config-BGY8v5d7.mjs";
2
+ import { i as WORKFLOW_JOB_BRAND, r as getDistDir } from "./config-BYrX78K0.mjs";
3
3
  import Module, { createRequire } from "node:module";
4
4
  import { defineCommand } from "citty";
5
5
  import * as path$20 from "node:path";
@@ -1453,92 +1453,6 @@ const apiCommand = defineCommand({
1453
1453
  })
1454
1454
  });
1455
1455
 
1456
- //#endregion
1457
- //#region src/cli/application/auth/service.ts
1458
- var AuthService = class {
1459
- _userProfile;
1460
- _tenantProvider;
1461
- constructor(config, tailorDBServices) {
1462
- this.config = config;
1463
- this.tailorDBServices = tailorDBServices;
1464
- }
1465
- get userProfile() {
1466
- return this._userProfile;
1467
- }
1468
- get tenantProvider() {
1469
- return this._tenantProvider;
1470
- }
1471
- async resolveNamespaces() {
1472
- await Promise.all(this.tailorDBServices.map((service) => service.loadTypes()));
1473
- if (this.tailorDBServices.length === 1) {
1474
- const singleNamespace = this.tailorDBServices[0].namespace;
1475
- this._userProfile = this.config.userProfile ? {
1476
- ...this.config.userProfile,
1477
- namespace: singleNamespace
1478
- } : void 0;
1479
- this._tenantProvider = this.config.tenantProvider ? {
1480
- ...this.config.tenantProvider,
1481
- namespace: singleNamespace
1482
- } : void 0;
1483
- return;
1484
- }
1485
- 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;
1486
- const tenantProviderTypeName = typeof this.config.tenantProvider?.type === "string" ? this.config.tenantProvider.type : void 0;
1487
- let userProfileNamespace;
1488
- let tenantProviderNamespace;
1489
- for (const service of this.tailorDBServices) {
1490
- const types$2 = service.getTypes();
1491
- if (userProfileTypeName && !userProfileNamespace && Object.prototype.hasOwnProperty.call(types$2, userProfileTypeName)) userProfileNamespace = service.namespace;
1492
- if (tenantProviderTypeName && !tenantProviderNamespace && Object.prototype.hasOwnProperty.call(types$2, tenantProviderTypeName)) tenantProviderNamespace = service.namespace;
1493
- if (userProfileNamespace && tenantProviderNamespace) break;
1494
- }
1495
- if (this.config.userProfile && !userProfileNamespace) throw new Error(`userProfile type "${this.config.userProfile.type.name}" not found in any TailorDB namespace`);
1496
- if (this.config.tenantProvider && !tenantProviderNamespace) throw new Error(`tenantProvider type "${this.config.tenantProvider.type}" not found in any TailorDB namespace`);
1497
- this._userProfile = this.config.userProfile ? {
1498
- ...this.config.userProfile,
1499
- namespace: userProfileNamespace
1500
- } : void 0;
1501
- this._tenantProvider = this.config.tenantProvider ? {
1502
- ...this.config.tenantProvider,
1503
- namespace: tenantProviderNamespace
1504
- } : void 0;
1505
- }
1506
- };
1507
-
1508
- //#endregion
1509
- //#region src/cli/application/file-loader.ts
1510
- const DEFAULT_IGNORE_PATTERNS = ["**/*.test.ts", "**/*.spec.ts"];
1511
- /**
1512
- * Load files matching the given patterns, excluding files that match ignore patterns.
1513
- * By default, test files (*.test.ts, *.spec.ts) are excluded unless ignores is explicitly specified.
1514
- *
1515
- * @param config - Configuration with files patterns and optional ignores patterns
1516
- * @returns Array of absolute file paths
1517
- */
1518
- function loadFilesWithIgnores(config) {
1519
- const ignorePatterns = config.ignores ?? DEFAULT_IGNORE_PATTERNS;
1520
- const ignoreFiles = /* @__PURE__ */ new Set();
1521
- for (const ignorePattern of ignorePatterns) {
1522
- const absoluteIgnorePattern = path$20.resolve(process.cwd(), ignorePattern);
1523
- try {
1524
- fs$15.globSync(absoluteIgnorePattern).forEach((file) => ignoreFiles.add(file));
1525
- } catch (error) {
1526
- logger.warn(`Failed to glob ignore pattern "${ignorePattern}": ${String(error)}`);
1527
- }
1528
- }
1529
- const files = [];
1530
- for (const pattern of config.files) {
1531
- const absolutePattern = path$20.resolve(process.cwd(), pattern);
1532
- try {
1533
- const filteredFiles = fs$15.globSync(absolutePattern).filter((file) => !ignoreFiles.has(file));
1534
- files.push(...filteredFiles);
1535
- } catch (error) {
1536
- logger.warn(`Failed to glob pattern "${pattern}": ${String(error)}`);
1537
- }
1538
- }
1539
- return files;
1540
- }
1541
-
1542
1456
  //#endregion
1543
1457
  //#region src/parser/service/auth/schema.ts
1544
1458
  const AuthInvokerSchema = z.object({
@@ -1549,12 +1463,6 @@ const secretValueSchema = z.object({
1549
1463
  vaultName: z.string(),
1550
1464
  secretKey: z.string()
1551
1465
  });
1552
- const samlBaseSchema = z.object({
1553
- name: z.string(),
1554
- kind: z.literal("SAML"),
1555
- spCertBase64: secretValueSchema.optional(),
1556
- spKeyBase64: secretValueSchema.optional()
1557
- });
1558
1466
  const OIDCSchema = z.object({
1559
1467
  name: z.string(),
1560
1468
  kind: z.literal("OIDC"),
@@ -1564,7 +1472,10 @@ const OIDCSchema = z.object({
1564
1472
  issuerURL: z.string().optional(),
1565
1473
  usernameClaim: z.string().optional()
1566
1474
  });
1567
- const SAMLSchema = samlBaseSchema.extend({
1475
+ const SAMLSchema = z.object({
1476
+ name: z.string(),
1477
+ kind: z.literal("SAML"),
1478
+ enableSignRequest: z.boolean().default(false),
1568
1479
  metadataURL: z.string().optional(),
1569
1480
  rawMetadata: z.string().optional()
1570
1481
  }).refine((value) => {
@@ -1713,6 +1624,100 @@ const AuthConfigSchema = z.object({
1713
1624
  tenantProvider: TenantProviderSchema.optional()
1714
1625
  }).brand("AuthConfig");
1715
1626
 
1627
+ //#endregion
1628
+ //#region src/cli/application/auth/service.ts
1629
+ var AuthService = class {
1630
+ _userProfile;
1631
+ _tenantProvider;
1632
+ _parsedConfig;
1633
+ constructor(config, tailorDBServices) {
1634
+ this.config = config;
1635
+ this.tailorDBServices = tailorDBServices;
1636
+ this._parsedConfig = {
1637
+ ...config,
1638
+ idProvider: IdProviderSchema.optional().parse(config.idProvider)
1639
+ };
1640
+ }
1641
+ get userProfile() {
1642
+ return this._userProfile;
1643
+ }
1644
+ get tenantProvider() {
1645
+ return this._tenantProvider;
1646
+ }
1647
+ get parsedConfig() {
1648
+ return this._parsedConfig;
1649
+ }
1650
+ async resolveNamespaces() {
1651
+ await Promise.all(this.tailorDBServices.map((service) => service.loadTypes()));
1652
+ if (this.tailorDBServices.length === 1) {
1653
+ const singleNamespace = this.tailorDBServices[0].namespace;
1654
+ this._userProfile = this.config.userProfile ? {
1655
+ ...this.config.userProfile,
1656
+ namespace: singleNamespace
1657
+ } : void 0;
1658
+ this._tenantProvider = this.config.tenantProvider ? {
1659
+ ...this.config.tenantProvider,
1660
+ namespace: singleNamespace
1661
+ } : void 0;
1662
+ return;
1663
+ }
1664
+ 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;
1665
+ const tenantProviderTypeName = typeof this.config.tenantProvider?.type === "string" ? this.config.tenantProvider.type : void 0;
1666
+ let userProfileNamespace;
1667
+ let tenantProviderNamespace;
1668
+ for (const service of this.tailorDBServices) {
1669
+ const types$2 = service.getTypes();
1670
+ if (userProfileTypeName && !userProfileNamespace && Object.prototype.hasOwnProperty.call(types$2, userProfileTypeName)) userProfileNamespace = service.namespace;
1671
+ if (tenantProviderTypeName && !tenantProviderNamespace && Object.prototype.hasOwnProperty.call(types$2, tenantProviderTypeName)) tenantProviderNamespace = service.namespace;
1672
+ if (userProfileNamespace && tenantProviderNamespace) break;
1673
+ }
1674
+ if (this.config.userProfile && !userProfileNamespace) throw new Error(`userProfile type "${this.config.userProfile.type.name}" not found in any TailorDB namespace`);
1675
+ if (this.config.tenantProvider && !tenantProviderNamespace) throw new Error(`tenantProvider type "${this.config.tenantProvider.type}" not found in any TailorDB namespace`);
1676
+ this._userProfile = this.config.userProfile ? {
1677
+ ...this.config.userProfile,
1678
+ namespace: userProfileNamespace
1679
+ } : void 0;
1680
+ this._tenantProvider = this.config.tenantProvider ? {
1681
+ ...this.config.tenantProvider,
1682
+ namespace: tenantProviderNamespace
1683
+ } : void 0;
1684
+ }
1685
+ };
1686
+
1687
+ //#endregion
1688
+ //#region src/cli/application/file-loader.ts
1689
+ const DEFAULT_IGNORE_PATTERNS = ["**/*.test.ts", "**/*.spec.ts"];
1690
+ /**
1691
+ * Load files matching the given patterns, excluding files that match ignore patterns.
1692
+ * By default, test files (*.test.ts, *.spec.ts) are excluded unless ignores is explicitly specified.
1693
+ *
1694
+ * @param config - Configuration with files patterns and optional ignores patterns
1695
+ * @returns Array of absolute file paths
1696
+ */
1697
+ function loadFilesWithIgnores(config) {
1698
+ const ignorePatterns = config.ignores ?? DEFAULT_IGNORE_PATTERNS;
1699
+ const ignoreFiles = /* @__PURE__ */ new Set();
1700
+ for (const ignorePattern of ignorePatterns) {
1701
+ const absoluteIgnorePattern = path$20.resolve(process.cwd(), ignorePattern);
1702
+ try {
1703
+ fs$15.globSync(absoluteIgnorePattern).forEach((file) => ignoreFiles.add(file));
1704
+ } catch (error) {
1705
+ logger.warn(`Failed to glob ignore pattern "${ignorePattern}": ${String(error)}`);
1706
+ }
1707
+ }
1708
+ const files = [];
1709
+ for (const pattern of config.files) {
1710
+ const absolutePattern = path$20.resolve(process.cwd(), pattern);
1711
+ try {
1712
+ const filteredFiles = fs$15.globSync(absolutePattern).filter((file) => !ignoreFiles.has(file));
1713
+ files.push(...filteredFiles);
1714
+ } catch (error) {
1715
+ logger.warn(`Failed to glob pattern "${pattern}": ${String(error)}`);
1716
+ }
1717
+ }
1718
+ return files;
1719
+ }
1720
+
1716
1721
  //#endregion
1717
1722
  //#region src/parser/service/common.ts
1718
1723
  const functionSchema = z.custom((val) => typeof val === "function");
@@ -1915,6 +1920,65 @@ var ResolverService = class {
1915
1920
  }
1916
1921
  };
1917
1922
 
1923
+ //#endregion
1924
+ //#region src/parser/service/tailordb/field.ts
1925
+ const tailorUserMap = `{ id: user.id, type: user.type, workspaceId: user.workspace_id, attributes: user.attribute_map, attributeList: user.attributes }`;
1926
+ /**
1927
+ * Convert a function to a string representation.
1928
+ * Handles method shorthand syntax (e.g., `create() { ... }`) by converting it to
1929
+ * a function expression (e.g., `function create() { ... }`).
1930
+ */
1931
+ const stringifyFunction = (fn) => {
1932
+ const src = fn.toString().trim();
1933
+ if (/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*\(/.test(src) && !src.startsWith("function") && !src.startsWith("(") && !src.includes("=>")) return `function ${src}`;
1934
+ return src;
1935
+ };
1936
+ /**
1937
+ * Convert a hook function to a script expression.
1938
+ */
1939
+ const convertHookToExpr = (fn) => {
1940
+ return `(${stringifyFunction(fn)})({ value: _value, data: _data, user: ${tailorUserMap} })`;
1941
+ };
1942
+ /**
1943
+ * Parse TailorDBField into OperatorFieldConfig.
1944
+ * This transforms user-defined functions into script expressions.
1945
+ */
1946
+ function parseFieldConfig(field) {
1947
+ const metadata = field.metadata;
1948
+ const fieldType = field.type;
1949
+ const nestedFields = field.fields;
1950
+ return {
1951
+ type: fieldType,
1952
+ ...metadata,
1953
+ ...fieldType === "nested" && nestedFields && Object.keys(nestedFields).length > 0 ? { fields: Object.entries(nestedFields).reduce((acc, [key, nestedField]) => {
1954
+ acc[key] = parseFieldConfig(nestedField);
1955
+ return acc;
1956
+ }, {}) } : {},
1957
+ validate: metadata.validate?.map((v$1) => {
1958
+ const { fn, message } = typeof v$1 === "function" ? {
1959
+ fn: v$1,
1960
+ message: `failed by \`${v$1.toString().trim()}\``
1961
+ } : {
1962
+ fn: v$1[0],
1963
+ message: v$1[1]
1964
+ };
1965
+ return {
1966
+ script: { expr: `(${fn.toString().trim()})({ value: _value, data: _data, user: ${tailorUserMap} })` },
1967
+ errorMessage: message
1968
+ };
1969
+ }),
1970
+ hooks: metadata.hooks ? {
1971
+ create: metadata.hooks.create ? { expr: convertHookToExpr(metadata.hooks.create) } : void 0,
1972
+ update: metadata.hooks.update ? { expr: convertHookToExpr(metadata.hooks.update) } : void 0
1973
+ } : void 0,
1974
+ serial: metadata.serial ? {
1975
+ start: metadata.serial.start,
1976
+ maxValue: metadata.serial.maxValue,
1977
+ format: "format" in metadata.serial ? metadata.serial.format : void 0
1978
+ } : void 0
1979
+ };
1980
+ }
1981
+
1918
1982
  //#endregion
1919
1983
  //#region ../../node_modules/eslint/package.json
1920
1984
  var require_package$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -98114,13 +98178,12 @@ var TailorDBService = class {
98114
98178
  this.buildBackwardRelationships(this.types);
98115
98179
  }
98116
98180
  parseTailorDBType(type) {
98117
- const schema = type.metadata.schema;
98118
- const pluralForm = schema?.settings?.pluralForm || inflection.pluralize(type.name);
98181
+ const metadata = type.metadata;
98182
+ const pluralForm = metadata.settings?.pluralForm || inflection.pluralize(type.name);
98119
98183
  const fields = {};
98120
98184
  const forwardRelationships = {};
98121
98185
  for (const [fieldName, fieldDef] of Object.entries(type.fields)) {
98122
- const fieldConfig = schema.fields?.[fieldName];
98123
- if (!fieldConfig) continue;
98186
+ const fieldConfig = parseFieldConfig(fieldDef);
98124
98187
  ensureNoExternalVariablesInFieldScripts(type.name, fieldName, fieldConfig);
98125
98188
  const parsedField = {
98126
98189
  name: fieldName,
@@ -98155,14 +98218,14 @@ var TailorDBService = class {
98155
98218
  return {
98156
98219
  name: type.name,
98157
98220
  pluralForm,
98158
- description: schema?.description,
98221
+ description: metadata.description,
98159
98222
  fields,
98160
98223
  forwardRelationships,
98161
98224
  backwardRelationships: {},
98162
- settings: schema?.settings || {},
98163
- permissions: schema?.permissions || {},
98164
- indexes: schema?.indexes,
98165
- files: schema?.files
98225
+ settings: metadata.settings || {},
98226
+ permissions: metadata.permissions || {},
98227
+ indexes: metadata.indexes,
98228
+ files: metadata.files
98166
98229
  };
98167
98230
  }
98168
98231
  buildBackwardRelationships(types$2) {
@@ -99943,9 +100006,9 @@ var TypeProcessor = class {
99943
100006
  Serial: false
99944
100007
  }
99945
100008
  };
99946
- const fieldResults = Object.entries(fields).map(([fieldName, nestedFieldConfig]) => ({
100009
+ const fieldResults = Object.entries(fields).map(([fieldName, nestedOperatorFieldConfig]) => ({
99947
100010
  fieldName,
99948
- ...this.generateFieldType(nestedFieldConfig)
100011
+ ...this.generateFieldType(nestedOperatorFieldConfig)
99949
100012
  }));
99950
100013
  const fieldTypes = fieldResults.map((result) => `${result.fieldName}: ${result.type}`);
99951
100014
  const aggregatedUtilityTypes = fieldResults.reduce((acc, result) => ({
@@ -101051,7 +101114,8 @@ async function planServices$2(client, workspaceId, appName, auths) {
101051
101114
  label: metadata?.labels[sdkNameLabelKey]
101052
101115
  };
101053
101116
  }));
101054
- for (const { config } of auths) {
101117
+ for (const auth of auths) {
101118
+ const { parsedConfig: config } = auth;
101055
101119
  const existing = existingServices[config.name];
101056
101120
  const metaRequest = await buildMetaRequest(trn$5(workspaceId, config.name), appName);
101057
101121
  if (existing) {
@@ -101113,7 +101177,8 @@ async function planIdPConfigs(client, workspaceId, auths, deletedServices) {
101113
101177
  }
101114
101178
  });
101115
101179
  };
101116
- for (const { config } of auths) {
101180
+ for (const authService of auths) {
101181
+ const { parsedConfig: config } = authService;
101117
101182
  const existingIdPConfigs = await fetchIdPConfigs(config.name);
101118
101183
  const existingNameSet = /* @__PURE__ */ new Set();
101119
101184
  existingIdPConfigs.forEach((idpConfig$1) => {
@@ -101185,14 +101250,7 @@ function protoIdPConfig(idpConfig) {
101185
101250
  case: "saml",
101186
101251
  value: {
101187
101252
  ...idpConfig.metadataURL !== void 0 ? { metadataUrl: idpConfig.metadataURL } : { rawMetadata: idpConfig.rawMetadata },
101188
- ...idpConfig.spCertBase64 && { spCertBase64: {
101189
- vaultName: idpConfig.spCertBase64.vaultName,
101190
- secretKey: idpConfig.spCertBase64.secretKey
101191
- } },
101192
- ...idpConfig.spKeyBase64 && { spKeyBase64: {
101193
- vaultName: idpConfig.spKeyBase64.vaultName,
101194
- secretKey: idpConfig.spKeyBase64.secretKey
101195
- } }
101253
+ enableSignRequest: idpConfig.enableSignRequest
101196
101254
  }
101197
101255
  } }
101198
101256
  };
@@ -101255,11 +101313,12 @@ async function protoBuiltinIdPConfig(client, workspaceId, builtinIdPConfig) {
101255
101313
  async function planUserProfileConfigs(client, workspaceId, auths, deletedServices) {
101256
101314
  const changeSet = new ChangeSet("Auth userProfileConfigs");
101257
101315
  for (const auth of auths) {
101258
- const name$1 = `${auth.config.name}-user-profile-config`;
101316
+ const { parsedConfig: config } = auth;
101317
+ const name$1 = `${config.name}-user-profile-config`;
101259
101318
  try {
101260
101319
  await client.getUserProfileConfig({
101261
101320
  workspaceId,
101262
- namespaceName: auth.config.name
101321
+ namespaceName: config.name
101263
101322
  });
101264
101323
  } catch (error) {
101265
101324
  if (error instanceof ConnectError && error.code === Code.NotFound) {
@@ -101267,7 +101326,7 @@ async function planUserProfileConfigs(client, workspaceId, auths, deletedService
101267
101326
  name: name$1,
101268
101327
  request: {
101269
101328
  workspaceId,
101270
- namespaceName: auth.config.name,
101329
+ namespaceName: config.name,
101271
101330
  userProfileProviderConfig: protoUserProfileConfig(auth.userProfile)
101272
101331
  }
101273
101332
  });
@@ -101279,7 +101338,7 @@ async function planUserProfileConfigs(client, workspaceId, auths, deletedService
101279
101338
  name: name$1,
101280
101339
  request: {
101281
101340
  workspaceId,
101282
- namespaceName: auth.config.name,
101341
+ namespaceName: config.name,
101283
101342
  userProfileProviderConfig: protoUserProfileConfig(auth.userProfile)
101284
101343
  }
101285
101344
  });
@@ -101287,7 +101346,7 @@ async function planUserProfileConfigs(client, workspaceId, auths, deletedService
101287
101346
  name: name$1,
101288
101347
  request: {
101289
101348
  workspaceId,
101290
- namespaceName: auth.config.name
101349
+ namespaceName: config.name
101291
101350
  }
101292
101351
  });
101293
101352
  }
@@ -101332,11 +101391,12 @@ function protoUserProfileConfig(userProfile) {
101332
101391
  async function planTenantConfigs(client, workspaceId, auths, deletedServices) {
101333
101392
  const changeSet = new ChangeSet("Auth tenantConfigs");
101334
101393
  for (const auth of auths) {
101335
- const name$1 = `${auth.config.name}-tenant-config`;
101394
+ const { parsedConfig: config } = auth;
101395
+ const name$1 = `${config.name}-tenant-config`;
101336
101396
  try {
101337
101397
  await client.getTenantConfig({
101338
101398
  workspaceId,
101339
- namespaceName: auth.config.name
101399
+ namespaceName: config.name
101340
101400
  });
101341
101401
  } catch (error) {
101342
101402
  if (error instanceof ConnectError && error.code === Code.NotFound) {
@@ -101344,7 +101404,7 @@ async function planTenantConfigs(client, workspaceId, auths, deletedServices) {
101344
101404
  name: name$1,
101345
101405
  request: {
101346
101406
  workspaceId,
101347
- namespaceName: auth.config.name,
101407
+ namespaceName: config.name,
101348
101408
  tenantProviderConfig: protoTenantConfig(auth.tenantProvider)
101349
101409
  }
101350
101410
  });
@@ -101356,7 +101416,7 @@ async function planTenantConfigs(client, workspaceId, auths, deletedServices) {
101356
101416
  name: name$1,
101357
101417
  request: {
101358
101418
  workspaceId,
101359
- namespaceName: auth.config.name,
101419
+ namespaceName: config.name,
101360
101420
  tenantProviderConfig: protoTenantConfig(auth.tenantProvider)
101361
101421
  }
101362
101422
  });
@@ -101364,7 +101424,7 @@ async function planTenantConfigs(client, workspaceId, auths, deletedServices) {
101364
101424
  name: name$1,
101365
101425
  request: {
101366
101426
  workspaceId,
101367
- namespaceName: auth.config.name
101427
+ namespaceName: config.name
101368
101428
  }
101369
101429
  });
101370
101430
  }
@@ -101418,7 +101478,8 @@ async function planMachineUsers(client, workspaceId, auths, deletedServices) {
101418
101478
  }
101419
101479
  });
101420
101480
  };
101421
- for (const { config } of auths) {
101481
+ for (const auth of auths) {
101482
+ const { parsedConfig: config } = auth;
101422
101483
  const existingMachineUsers = await fetchMachineUsers(config.name);
101423
101484
  const existingNameSet = /* @__PURE__ */ new Set();
101424
101485
  existingMachineUsers.forEach((machineUser) => {
@@ -101495,7 +101556,8 @@ async function planOAuth2Clients(client, workspaceId, auths, deletedServices) {
101495
101556
  }
101496
101557
  });
101497
101558
  };
101498
- for (const { config } of auths) {
101559
+ for (const auth of auths) {
101560
+ const { parsedConfig: config } = auth;
101499
101561
  const existingOAuth2Clients = await fetchOAuth2Clients(config.name);
101500
101562
  const existingNameSet = /* @__PURE__ */ new Set();
101501
101563
  existingOAuth2Clients.forEach((oauth2Client) => {
@@ -101570,7 +101632,8 @@ function protoOAuth2Client(oauth2ClientName, oauth2Client) {
101570
101632
  }
101571
101633
  async function planSCIMConfigs(client, workspaceId, auths, deletedServices) {
101572
101634
  const changeSet = new ChangeSet("Auth scimConfigs");
101573
- for (const { config } of auths) {
101635
+ for (const auth of auths) {
101636
+ const { parsedConfig: config } = auth;
101574
101637
  const name$1 = `${config.name}-scim-config`;
101575
101638
  try {
101576
101639
  await client.getAuthSCIMConfig({
@@ -101664,7 +101727,8 @@ async function planSCIMResources(client, workspaceId, auths, deletedServices) {
101664
101727
  throw error;
101665
101728
  }
101666
101729
  };
101667
- for (const { config } of auths) {
101730
+ for (const auth of auths) {
101731
+ const { parsedConfig: config } = auth;
101668
101732
  const existingSCIMResources = await fetchSCIMResources(config.name);
101669
101733
  const existingNameSet = /* @__PURE__ */ new Set();
101670
101734
  existingSCIMResources.forEach((scimResource) => {
@@ -101850,20 +101914,6 @@ async function confirmImportantResourceDeletion(resources, yes) {
101850
101914
 
101851
101915
  //#endregion
101852
101916
  //#region src/cli/apply/services/executor.ts
101853
- /**
101854
- * Convert a function to a string representation.
101855
- * Handles method shorthand syntax (e.g., `requestBody() { ... }`) by converting it to
101856
- * a function expression (e.g., `function requestBody() { ... }`).
101857
- *
101858
- * TODO: This function should be moved to the parser module.
101859
- * The same function exists in `src/configure/services/tailordb/schema.ts`.
101860
- * These should be unified into a common utility in the parser layer.
101861
- */
101862
- const stringifyFunction = (fn) => {
101863
- const src = fn.toString().trim();
101864
- if (/^[a-zA-Z_$][a-zA-Z0-9_$]*\s*\(/.test(src) && !src.startsWith("function") && !src.startsWith("(") && !src.includes("=>")) return `function ${src}`;
101865
- return src;
101866
- };
101867
101917
  async function applyExecutor(client, result, phase = "create-update") {
101868
101918
  const { changeSet } = result;
101869
101919
  if (phase === "create-update") await Promise.all([...changeSet.creates.map(async (create$1) => {
@@ -102860,7 +102910,7 @@ function protoOperand(operand) {
102860
102910
  case: "oldRecordField",
102861
102911
  value: operand.oldRecord
102862
102912
  } };
102863
- else throw new Error(`Unknown operand: ${operand}`);
102913
+ else throw new Error(`Unknown operand: ${JSON.stringify(operand)}`);
102864
102914
  return { kind: {
102865
102915
  case: "value",
102866
102916
  value: fromJson(ValueSchema, operand)
@@ -103014,7 +103064,7 @@ function protoGqlOperand(operand) {
103014
103064
  case: "userField",
103015
103065
  value: operand.user
103016
103066
  } };
103017
- else throw new Error(`Unknown operand: ${operand}`);
103067
+ else throw new Error(`Unknown operand: ${JSON.stringify(operand)}`);
103018
103068
  return { kind: {
103019
103069
  case: "value",
103020
103070
  value: fromJson(ValueSchema, operand)
@@ -103933,7 +103983,7 @@ var GenerationManager = class {
103933
103983
  getAuthInput() {
103934
103984
  const authService = this.application.authService;
103935
103985
  if (!authService) return void 0;
103936
- const config = authService.config;
103986
+ const config = authService.parsedConfig;
103937
103987
  return {
103938
103988
  name: config.name,
103939
103989
  userProfile: authService.userProfile ? {
@@ -105408,4 +105458,4 @@ const listCommand = defineCommand({
105408
105458
 
105409
105459
  //#endregion
105410
105460
  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 };
105411
- //# sourceMappingURL=list-B11wQhss.mjs.map
105461
+ //# sourceMappingURL=list-CqNMJdug.mjs.map