@tailor-platform/sdk 1.60.1 → 1.60.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,13 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.60.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1399](https://github.com/tailor-platform/sdk/pull/1399) [`4b1c61c`](https://github.com/tailor-platform/sdk/commit/4b1c61c51a2c8367ab50b3cd8144a0bfb9074fc1) Thanks [@dqn](https://github.com/dqn)! - Reject duplicate TailorDB type names across application namespaces, including deployed external TailorDB namespaces checked at deploy time. Projects that currently reuse a type name across namespaces will fail validation on the next `generate` or `deploy`; rename the duplicated types before upgrading.
8
+
9
+ - [#1406](https://github.com/tailor-platform/sdk/pull/1406) [`a10389f`](https://github.com/tailor-platform/sdk/commit/a10389f7498f9817f7dbf235a64496e83e024a85) Thanks [@dqn](https://github.com/dqn)! - Clarify how non-secret runtime `env` values defined in `defineConfig()` are passed to resolvers, executors, workflow jobs, auth hooks, TailorDB migrations, and `function test-run`.
10
+
3
11
  ## 1.60.1
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-pusdxz35.mjs";
3
+
4
+ export { defineApplication };
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { n as isSdkBranded } from "./brand-DlnJ375c.mjs";
3
- import { d as initOAuth2Client } from "./client-W5P4NYYX.mjs";
3
+ import { a as fetchAll, d as initOAuth2Client } from "./client-W5P4NYYX.mjs";
4
4
  import { a as parseBoolean, n as logger, r as styles } from "./logger-DpJyJvNz.mjs";
5
5
  import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-C7DaWeQo.mjs";
6
6
  import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
@@ -21,6 +21,7 @@ import { parseTOML, parseYAML, stringifyYAML } from "confbox";
21
21
  import { findUpSync } from "find-up-simple";
22
22
  import { lt } from "semver";
23
23
  import { xdgConfig } from "xdg-basedir";
24
+ import { Code, ConnectError } from "@connectrpc/connect";
24
25
  import { resolveTSConfig } from "pkg-types";
25
26
  import * as crypto from "node:crypto";
26
27
  import * as rolldown from "rolldown";
@@ -2698,7 +2699,7 @@ function applyRelationMetadataToFieldConfig(fieldConfig, metadata) {
2698
2699
  * @returns Parsed types
2699
2700
  */
2700
2701
  function parseTypes(rawTypes, namespace, typeSourceInfo) {
2701
- const types = {};
2702
+ const types = createRecord();
2702
2703
  const allTypeNames = new Set(Object.keys(rawTypes));
2703
2704
  for (const [typeName, type] of Object.entries(rawTypes)) types[typeName] = parseTailorDBType(type, allTypeNames, rawTypes);
2704
2705
  buildBackwardRelationships(types, namespace, typeSourceInfo);
@@ -2715,8 +2716,8 @@ function parseTypes(rawTypes, namespace, typeSourceInfo) {
2715
2716
  function parseTailorDBType(type, allTypeNames, rawTypes) {
2716
2717
  const metadata = type.metadata;
2717
2718
  const pluralForm = metadata.settings?.pluralForm || inflection.pluralize(type.name);
2718
- const fields = {};
2719
- const forwardRelationships = {};
2719
+ const fields = createRecord();
2720
+ const forwardRelationships = createRecord();
2720
2721
  for (const [fieldName, fieldDef] of Object.entries(type.fields)) {
2721
2722
  let fieldConfig = parseFieldConfig(fieldDef);
2722
2723
  const rawRelation = fieldConfig.rawRelation;
@@ -2762,7 +2763,7 @@ function parseTailorDBType(type, allTypeNames, rawTypes) {
2762
2763
  description: metadata.description,
2763
2764
  fields,
2764
2765
  forwardRelationships,
2765
- backwardRelationships: {},
2766
+ backwardRelationships: createRecord(),
2766
2767
  settings: metadata.settings || {},
2767
2768
  permissions: parsePermissions(metadata.permissions || {}),
2768
2769
  indexes: metadata.indexes,
@@ -2777,8 +2778,8 @@ function parseTailorDBType(type, allTypeNames, rawTypes) {
2777
2778
  * @param typeSourceInfo - Optional type source information
2778
2779
  */
2779
2780
  function buildBackwardRelationships(types, namespace, typeSourceInfo) {
2780
- const backwardNameSources = {};
2781
- for (const typeName of Object.keys(types)) backwardNameSources[typeName] = {};
2781
+ const backwardNameSources = Object.create(null);
2782
+ for (const typeName of Object.keys(types)) backwardNameSources[typeName] = Object.create(null);
2782
2783
  for (const [typeName, type] of Object.entries(types)) for (const [otherTypeName, otherType] of Object.entries(types)) for (const [fieldName, field] of Object.entries(otherType.fields)) if (field.relation && field.relation.targetType === typeName) {
2783
2784
  let backwardName = field.relation.backwardName;
2784
2785
  if (!backwardName) {
@@ -2802,26 +2803,26 @@ function buildBackwardRelationships(types, namespace, typeSourceInfo) {
2802
2803
  const errors = [];
2803
2804
  for (const [targetTypeName, backwardNames] of Object.entries(backwardNameSources)) {
2804
2805
  const targetType = types[targetTypeName];
2805
- const targetTypeSourceInfo = typeSourceInfo?.[targetTypeName];
2806
+ const targetTypeSourceInfo = getTypeSourceInfo(typeSourceInfo, targetTypeName);
2806
2807
  const targetLocation = targetTypeSourceInfo ? isPluginGeneratedType(targetTypeSourceInfo) ? ` (plugin: ${targetTypeSourceInfo.pluginId})` : ` (${targetTypeSourceInfo.filePath})` : "";
2807
2808
  for (const [backwardName, sources] of Object.entries(backwardNames)) {
2808
2809
  if (sources.length > 1) {
2809
2810
  const sourceList = sources.map((s) => {
2810
- const sourceInfo = typeSourceInfo?.[s.sourceType];
2811
+ const sourceInfo = getTypeSourceInfo(typeSourceInfo, s.sourceType);
2811
2812
  const location = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
2812
2813
  return `${s.sourceType}.${s.fieldName}${location}`;
2813
2814
  }).join(", ");
2814
2815
  errors.push(`Backward relation name "${backwardName}" on type "${targetTypeName}" is duplicated from: ${sourceList}. Use the "backward" option in .relation() to specify unique names.`);
2815
2816
  }
2816
- if (backwardName in targetType.fields) {
2817
+ if (Object.hasOwn(targetType.fields, backwardName)) {
2817
2818
  const source = sources[0];
2818
- const sourceInfo = typeSourceInfo?.[source.sourceType];
2819
+ const sourceInfo = getTypeSourceInfo(typeSourceInfo, source.sourceType);
2819
2820
  const sourceLocation = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
2820
2821
  errors.push(`Backward relation name "${backwardName}" from ${source.sourceType}.${source.fieldName}${sourceLocation} conflicts with existing field "${backwardName}" on type "${targetTypeName}"${targetLocation}. Use the "backward" option in .relation() to specify a different name.`);
2821
2822
  }
2822
- if (targetType.files && backwardName in targetType.files) {
2823
+ if (targetType.files && Object.hasOwn(targetType.files, backwardName)) {
2823
2824
  const source = sources[0];
2824
- const sourceInfo = typeSourceInfo?.[source.sourceType];
2825
+ const sourceInfo = getTypeSourceInfo(typeSourceInfo, source.sourceType);
2825
2826
  const sourceLocation = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
2826
2827
  errors.push(`Backward relation name "${backwardName}" from ${source.sourceType}.${source.fieldName}${sourceLocation} conflicts with files field "${backwardName}" on type "${targetTypeName}"${targetLocation}. Use the "backward" option in .relation() to specify a different name.`);
2827
2828
  }
@@ -2843,32 +2844,34 @@ function validatePluralFormUniqueness(types, namespace, typeSourceInfo) {
2843
2844
  for (const [, parsedType] of Object.entries(types)) {
2844
2845
  const singularQuery = inflection.camelize(parsedType.name, true);
2845
2846
  if (singularQuery === inflection.camelize(parsedType.pluralForm, true)) {
2846
- const sourceInfo = typeSourceInfo?.[parsedType.name];
2847
+ const sourceInfo = getTypeSourceInfo(typeSourceInfo, parsedType.name);
2847
2848
  const location = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
2848
2849
  errors.push(`Type "${parsedType.name}"${location} has identical singular and plural query names "${singularQuery}". Use db.type(["${parsedType.name}", "UniquePluralForm"], {...}) to set a unique pluralForm.`);
2849
2850
  }
2850
2851
  }
2851
- const queryNameToSource = {};
2852
+ const queryNameToSource = /* @__PURE__ */ new Map();
2852
2853
  for (const parsedType of Object.values(types)) {
2853
2854
  const singularQuery = inflection.camelize(parsedType.name, true);
2854
2855
  const pluralQuery = inflection.camelize(parsedType.pluralForm, true);
2855
- if (!queryNameToSource[singularQuery]) queryNameToSource[singularQuery] = [];
2856
- queryNameToSource[singularQuery].push({
2856
+ const singularSources = queryNameToSource.get(singularQuery) ?? [];
2857
+ singularSources.push({
2857
2858
  typeName: parsedType.name,
2858
2859
  kind: "singular"
2859
2860
  });
2861
+ queryNameToSource.set(singularQuery, singularSources);
2860
2862
  if (singularQuery !== pluralQuery) {
2861
- if (!queryNameToSource[pluralQuery]) queryNameToSource[pluralQuery] = [];
2862
- queryNameToSource[pluralQuery].push({
2863
+ const pluralSources = queryNameToSource.get(pluralQuery) ?? [];
2864
+ pluralSources.push({
2863
2865
  typeName: parsedType.name,
2864
2866
  kind: "plural"
2865
2867
  });
2868
+ queryNameToSource.set(pluralQuery, pluralSources);
2866
2869
  }
2867
2870
  }
2868
- const duplicates = Object.entries(queryNameToSource).filter(([, sources]) => sources.length > 1);
2871
+ const duplicates = [...queryNameToSource].filter(([, sources]) => sources.length > 1);
2869
2872
  for (const [queryName, sources] of duplicates) {
2870
2873
  const sourceList = sources.map((s) => {
2871
- const sourceInfo = typeSourceInfo?.[s.typeName];
2874
+ const sourceInfo = getTypeSourceInfo(typeSourceInfo, s.typeName);
2872
2875
  const location = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
2873
2876
  return `"${s.typeName}"${location} (${s.kind})`;
2874
2877
  }).join(", ");
@@ -2876,6 +2879,12 @@ function validatePluralFormUniqueness(types, namespace, typeSourceInfo) {
2876
2879
  }
2877
2880
  if (errors.length > 0) throw new Error(`GraphQL field name conflicts detected in TailorDB service "${namespace}".\n${errors.map((e) => ` - ${e}`).join("\n")}`);
2878
2881
  }
2882
+ function getTypeSourceInfo(typeSourceInfo, typeName) {
2883
+ return typeSourceInfo && Object.hasOwn(typeSourceInfo, typeName) ? typeSourceInfo[typeName] : void 0;
2884
+ }
2885
+ function createRecord() {
2886
+ return Object.create(null);
2887
+ }
2879
2888
 
2880
2889
  //#endregion
2881
2890
  //#region src/parser/service/tailordb/schema.ts
@@ -3453,6 +3462,110 @@ async function precompileTailorDBTypeScripts(type, sourceFilePath, tsconfig) {
3453
3462
  }
3454
3463
  }
3455
3464
 
3465
+ //#endregion
3466
+ //#region src/cli/services/tailordb/type-name-validation.ts
3467
+ /**
3468
+ * Format a TailorDB type source for validation errors.
3469
+ * @param sourceInfo - Source information captured when loading the type
3470
+ * @returns Human-readable source detail
3471
+ */
3472
+ function formatTailorDBTypeSourceInfo(sourceInfo) {
3473
+ if (!sourceInfo) return;
3474
+ if (isPluginGeneratedType(sourceInfo)) {
3475
+ const parts = [`plugin ${sourceInfo.pluginId}`];
3476
+ if (sourceInfo.generatedTypeKind) parts.push(`kind ${sourceInfo.generatedTypeKind}`);
3477
+ if (sourceInfo.originalFilePath) parts.push(`source ${sourceInfo.originalFilePath}`);
3478
+ if (sourceInfo.originalExportName) parts.push(`export ${sourceInfo.originalExportName}`);
3479
+ return parts.join(", ");
3480
+ }
3481
+ return `${sourceInfo.filePath} export ${sourceInfo.exportName}`;
3482
+ }
3483
+ /**
3484
+ * Collect TailorDB type-name sources from loaded local services.
3485
+ * @param args - Collection inputs
3486
+ * @returns Type-name sources for local services
3487
+ */
3488
+ function collectLocalTailorDBTypeNameSources(args) {
3489
+ const sources = [];
3490
+ for (const service of args.tailorDBServices) for (const typeName of Object.keys(service.types)) sources.push({
3491
+ namespace: service.namespace,
3492
+ typeName,
3493
+ kind: "local",
3494
+ detail: formatTailorDBTypeSourceInfo(service.typeSourceInfo[typeName])
3495
+ });
3496
+ return sources;
3497
+ }
3498
+ /**
3499
+ * Fetch TailorDB type-name sources for external namespaces.
3500
+ * @param args - Fetch inputs
3501
+ * @returns Type-name sources for external services
3502
+ */
3503
+ async function fetchExternalTailorDBTypeNameSources(args) {
3504
+ return (await Promise.all(args.externalTailorDBNamespaces.map(async (namespace) => {
3505
+ const sources = [];
3506
+ const tailordbTypes = await fetchAll(async (pageToken, maxPageSize) => {
3507
+ try {
3508
+ const { tailordbTypes, nextPageToken } = await args.client.listTailorDBTypes({
3509
+ workspaceId: args.workspaceId,
3510
+ namespaceName: namespace,
3511
+ pageToken,
3512
+ pageSize: maxPageSize
3513
+ });
3514
+ return [tailordbTypes, nextPageToken ?? ""];
3515
+ } catch (error) {
3516
+ if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
3517
+ throw error;
3518
+ }
3519
+ });
3520
+ for (const type of tailordbTypes) sources.push({
3521
+ namespace,
3522
+ typeName: type.name,
3523
+ kind: "external"
3524
+ });
3525
+ return sources;
3526
+ }))).flat();
3527
+ }
3528
+ /**
3529
+ * Assert that TailorDB type names are unique across all supplied sources.
3530
+ * @param args - Validation inputs
3531
+ */
3532
+ function assertUniqueTailorDBTypeNames(args) {
3533
+ const sourcesByTypeName = /* @__PURE__ */ new Map();
3534
+ for (const source of args.sources) {
3535
+ const existing = sourcesByTypeName.get(source.typeName);
3536
+ if (existing) existing.push(source);
3537
+ else sourcesByTypeName.set(source.typeName, [source]);
3538
+ }
3539
+ const errors = [];
3540
+ for (const [typeName, sources] of sourcesByTypeName) {
3541
+ if (sources.length <= 1) continue;
3542
+ const sourceList = sources.map(formatTailorDBTypeNameSource).join(", ");
3543
+ errors.push(`Type "${typeName}" is defined more than once: ${sourceList}`);
3544
+ }
3545
+ if (errors.length > 0) throw new Error(`Duplicate TailorDB type names detected.
3546
+ ${errors.map((error) => ` - ${error}`).join("\n")}\nTailorDB type names must be unique across all TailorDB namespaces in an application.`);
3547
+ }
3548
+ /**
3549
+ * Assert local TailorDB type names are unique.
3550
+ * @param args - Validation inputs
3551
+ */
3552
+ function assertUniqueLocalTailorDBTypeNames(args) {
3553
+ assertUniqueTailorDBTypeNames({ sources: collectLocalTailorDBTypeNameSources(args) });
3554
+ }
3555
+ /**
3556
+ * Assert TailorDB type names are unique across local and external namespaces.
3557
+ * @param args - Validation inputs
3558
+ */
3559
+ async function assertUniqueTailorDBTypeNamesWithExternal(args) {
3560
+ const localSources = collectLocalTailorDBTypeNameSources(args);
3561
+ const externalSources = args.externalTailorDBNamespaces.length > 0 ? await fetchExternalTailorDBTypeNameSources(args) : [];
3562
+ assertUniqueTailorDBTypeNames({ sources: [...localSources, ...externalSources] });
3563
+ }
3564
+ function formatTailorDBTypeNameSource(source) {
3565
+ const namespaceLabel = source.kind === "external" ? `external namespace "${source.namespace}"` : `namespace "${source.namespace}"`;
3566
+ return source.detail ? `${namespaceLabel} (${source.detail})` : namespaceLabel;
3567
+ }
3568
+
3456
3569
  //#endregion
3457
3570
  //#region src/cli/services/tailordb/service.ts
3458
3571
  /**
@@ -3462,13 +3575,24 @@ async function precompileTailorDBTypeScripts(type, sourceFilePath, tsconfig) {
3462
3575
  */
3463
3576
  function createTailorDBService(params) {
3464
3577
  const { namespace, config, pluginManager } = params;
3465
- const rawTypes = {};
3578
+ const createRawTypesByName = () => Object.create(null);
3579
+ const rawTypes = Object.create(null);
3466
3580
  let types = {};
3467
- const typeSourceInfo = {};
3581
+ const typeSourceInfo = Object.create(null);
3468
3582
  const pluginAttachments = /* @__PURE__ */ new Map();
3469
3583
  let loadPromise;
3584
+ const registerRawType = (rawTypesKey, typeName, type, sourceInfo) => {
3585
+ const existingSourceInfo = Object.hasOwn(typeSourceInfo, typeName) ? typeSourceInfo[typeName] : void 0;
3586
+ if (existingSourceInfo) {
3587
+ const firstSource = formatTailorDBTypeSourceInfo(existingSourceInfo) ?? "unknown source";
3588
+ const secondSource = formatTailorDBTypeSourceInfo(sourceInfo) ?? "unknown source";
3589
+ throw new Error(`Duplicate TailorDB type name "${typeName}" detected in TailorDB service "${namespace}". First: ${firstSource}. Second: ${secondSource}. TailorDB type names must be unique across all TailorDB files in a service.`);
3590
+ }
3591
+ rawTypes[rawTypesKey][typeName] = type;
3592
+ typeSourceInfo[typeName] = sourceInfo;
3593
+ };
3470
3594
  const doParseTypes = () => {
3471
- const allTypes = {};
3595
+ const allTypes = createRawTypesByName();
3472
3596
  for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) allTypes[typeName] = type;
3473
3597
  types = parseTypes(allTypes, namespace, typeSourceInfo);
3474
3598
  };
@@ -3493,8 +3617,7 @@ function createTailorDBService(params) {
3493
3617
  });
3494
3618
  if (extendedType) rawTypes[sourceFilePath][rawType.name] = extendedType;
3495
3619
  for (const gen of generatedTypes) {
3496
- rawTypes[sourceFilePath][gen.typeName] = gen.type;
3497
- typeSourceInfo[gen.typeName] = {
3620
+ const sourceInfo = {
3498
3621
  exportName: gen.typeName,
3499
3622
  pluginId: gen.pluginId,
3500
3623
  pluginImportPath: gen.pluginImportPath,
@@ -3504,13 +3627,14 @@ function createTailorDBService(params) {
3504
3627
  pluginConfig: gen.pluginConfig,
3505
3628
  namespace
3506
3629
  };
3630
+ registerRawType(sourceFilePath, gen.typeName, gen.type, sourceInfo);
3507
3631
  }
3508
3632
  for (const ev of events) if (ev.kind === "extended") logger.log(` Extended: ${styles.success(ev.typeName)} with ${styles.highlight(ev.fieldCount.toString())} fields by plugin ${styles.info(ev.pluginId)}`);
3509
3633
  else logger.log(` Generated: ${styles.success(ev.typeName)} by plugin ${styles.info(ev.pluginId)}`);
3510
3634
  };
3511
3635
  const loadTypeFile = async (typeFile, tsconfig) => {
3512
- rawTypes[typeFile] = {};
3513
- const loadedTypes = {};
3636
+ rawTypes[typeFile] = createRawTypesByName();
3637
+ const loadedTypes = createRawTypesByName();
3514
3638
  try {
3515
3639
  const module = await import(pathToFileURL(typeFile).href);
3516
3640
  for (const exportName of Object.keys(module)) {
@@ -3523,12 +3647,11 @@ function createTailorDBService(params) {
3523
3647
  const relativePath = path.relative(process.cwd(), typeFile);
3524
3648
  logger.log(`Type: ${styles.successBright(`"${result.data.name}"`)} loaded from ${styles.path(relativePath)}`);
3525
3649
  await precompileTailorDBTypeScripts(result.data, typeFile, tsconfig);
3526
- rawTypes[typeFile][result.data.name] = result.data;
3527
3650
  loadedTypes[result.data.name] = result.data;
3528
- typeSourceInfo[result.data.name] = {
3651
+ registerRawType(typeFile, result.data.name, result.data, {
3529
3652
  filePath: typeFile,
3530
3653
  exportName
3531
- };
3654
+ });
3532
3655
  if (exportedValue.plugins && Array.isArray(exportedValue.plugins) && exportedValue.plugins.length > 0) {
3533
3656
  pluginAttachments.set(exportedValue.name, [...exportedValue.plugins]);
3534
3657
  logger.log(` Plugin attachments: ${styles.info(exportedValue.plugins.map((p) => p.pluginId).join(", "))}`);
@@ -3558,7 +3681,7 @@ function createTailorDBService(params) {
3558
3681
  loadTypes: async () => {
3559
3682
  if (!loadPromise) loadPromise = (async () => {
3560
3683
  if (!config.files || config.files.length === 0) return;
3561
- const typeFiles = loadFilesWithIgnores(config);
3684
+ const typeFiles = [...new Set(loadFilesWithIgnores(config))];
3562
3685
  let tsconfig;
3563
3686
  try {
3564
3687
  tsconfig = await resolveTSConfig();
@@ -3579,31 +3702,38 @@ function createTailorDBService(params) {
3579
3702
  if (!pluginManager) return;
3580
3703
  const results = await pluginManager.processNamespacePlugins(namespace);
3581
3704
  const pluginGeneratedKey = "__plugin_generated__";
3582
- if (!rawTypes[pluginGeneratedKey]) rawTypes[pluginGeneratedKey] = {};
3583
- let hasGeneratedTypes = false;
3584
- for (const { pluginId, config, result } of results) {
3705
+ const successfulResults = results.map(({ pluginId, config, result }) => {
3585
3706
  if (!result.success) {
3586
3707
  logger.error(result.error);
3587
3708
  throw new Error(result.error);
3588
3709
  }
3589
- const output = result.output;
3590
- for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
3591
- rawTypes[pluginGeneratedKey][generatedType.name] = generatedType;
3592
- hasGeneratedTypes = true;
3593
- typeSourceInfo[generatedType.name] = {
3594
- exportName: generatedType.name,
3595
- pluginId,
3596
- pluginImportPath: pluginManager.getPluginImportPath(pluginId) ?? "",
3597
- originalFilePath: "",
3598
- originalExportName: "",
3599
- generatedTypeKind: kind,
3600
- pluginConfig: config,
3601
- namespace
3602
- };
3603
- logger.log(` Generated: ${styles.success(generatedType.name)} by namespace plugin ${styles.info(pluginId)}`);
3604
- }
3710
+ return {
3711
+ pluginId,
3712
+ config,
3713
+ output: result.output
3714
+ };
3715
+ });
3716
+ const previousGeneratedTypes = rawTypes[pluginGeneratedKey];
3717
+ const hadPreviousGeneratedTypes = previousGeneratedTypes !== void 0 && Object.keys(previousGeneratedTypes).length > 0;
3718
+ if (previousGeneratedTypes) for (const typeName of Object.keys(previousGeneratedTypes)) delete typeSourceInfo[typeName];
3719
+ rawTypes[pluginGeneratedKey] = createRawTypesByName();
3720
+ let hasGeneratedTypes = false;
3721
+ for (const { pluginId, config, output } of successfulResults) for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
3722
+ const sourceInfo = {
3723
+ exportName: generatedType.name,
3724
+ pluginId,
3725
+ pluginImportPath: pluginManager.getPluginImportPath(pluginId) ?? "",
3726
+ originalFilePath: "",
3727
+ originalExportName: "",
3728
+ generatedTypeKind: kind,
3729
+ pluginConfig: config,
3730
+ namespace
3731
+ };
3732
+ registerRawType(pluginGeneratedKey, generatedType.name, generatedType, sourceInfo);
3733
+ hasGeneratedTypes = true;
3734
+ logger.log(` Generated: ${styles.success(generatedType.name)} by namespace plugin ${styles.info(pluginId)}`);
3605
3735
  }
3606
- if (hasGeneratedTypes) doParseTypes();
3736
+ if (hasGeneratedTypes || hadPreviousGeneratedTypes) doParseTypes();
3607
3737
  }
3608
3738
  };
3609
3739
  }
@@ -5775,6 +5905,7 @@ async function loadApplication(params) {
5775
5905
  await tailordb.loadTypes();
5776
5906
  await tailordb.processNamespacePlugins();
5777
5907
  }
5908
+ assertUniqueLocalTailorDBTypeNames({ tailorDBServices: tailordbResult.tailorDBServices });
5778
5909
  const pluginExecutorFiles = generatePluginFilesIfNeeded(pluginManager, tailordbResult.tailorDBServices, config.path);
5779
5910
  const executorService = defineExecutor(config.executor, pluginExecutorFiles.length > 0);
5780
5911
  const workflowService = defineWorkflow(config.workflow);
@@ -5858,5 +5989,5 @@ async function loadApplication(params) {
5858
5989
  }
5859
5990
 
5860
5991
  //#endregion
5861
- export { readPlatformConfig as A, hashFile as C, loadAccessToken as D, fetchLatestToken as E, saveUserTokens as M, writePlatformConfig as N, loadConfigPath as O, hashContent as S, deleteUserTokens as T, composeFunctionTreeshakeOptions as _, WorkflowJobSchema as a, createBundleCache as b, createExecutorService as c, buildExecutorArgsExpr as d, buildResolverOperationHookExpr as f, platformBundleDefinePlugin as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, resolveTokens as j, loadWorkspaceId as k, ExecutorSchema as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, INVOKER_EXPR as u, createLogLevelTreeshakeOptions as v, loadConfig as w, getDistDir as x, resolveBundleLogLevel as y };
5862
- //# sourceMappingURL=application-FnWOxBk7.mjs.map
5992
+ export { loadConfigPath as A, getDistDir as C, deleteUserTokens as D, loadConfig as E, writePlatformConfig as F, readPlatformConfig as M, resolveTokens as N, fetchLatestToken as O, saveUserTokens as P, createBundleCache as S, hashFile as T, loadFilesWithIgnores as _, WorkflowJobSchema as a, createLogLevelTreeshakeOptions as b, createExecutorService as c, buildExecutorArgsExpr as d, buildResolverOperationHookExpr as f, stringifyFunction as g, TailorDBTypeSchema as h, resolveInlineSourcemap as i, loadWorkspaceId as j, loadAccessToken as k, ExecutorSchema as l, assertUniqueTailorDBTypeNamesWithExternal as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, assertUniqueLocalTailorDBTypeNames as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, INVOKER_EXPR as u, platformBundleDefinePlugin as v, hashContent as w, resolveBundleLogLevel as x, composeFunctionTreeshakeOptions as y };
5993
+ //# sourceMappingURL=application-pusdxz35.mjs.map