@tailor-platform/sdk 1.11.1 → 1.13.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/application-DM4zTgXU.mjs +4 -0
  3. package/dist/{application-BKBo5tGD.mjs → application-DnWZVbDO.mjs} +164 -26
  4. package/dist/application-DnWZVbDO.mjs.map +1 -0
  5. package/dist/cli/index.mjs +13 -19
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +149 -17
  8. package/dist/cli/lib.mjs +132 -4
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/configure/index.d.mts +4 -3
  11. package/dist/configure/index.mjs +16 -761
  12. package/dist/configure/index.mjs.map +1 -1
  13. package/dist/env-4RO7szrH.d.mts +66 -0
  14. package/dist/{index-DnoS_Mi4.d.mts → index-BBr_q3vB.d.mts} +12 -3
  15. package/dist/{index-DcOTucF6.d.mts → index-Bid18Opo.d.mts} +473 -84
  16. package/dist/{jiti-ygK9KoRA.mjs → jiti-DuCiUfMj.mjs} +2 -2
  17. package/dist/{jiti-ygK9KoRA.mjs.map → jiti-DuCiUfMj.mjs.map} +1 -1
  18. package/dist/{job-l-pIR9IY.mjs → job-zGAXCidt.mjs} +1 -1
  19. package/dist/{job-l-pIR9IY.mjs.map → job-zGAXCidt.mjs.map} +1 -1
  20. package/dist/kysely/index.d.mts +25 -0
  21. package/dist/kysely/index.mjs +27 -0
  22. package/dist/kysely/index.mjs.map +1 -0
  23. package/dist/plugin/index.d.mts +105 -0
  24. package/dist/plugin/index.mjs +45 -0
  25. package/dist/plugin/index.mjs.map +1 -0
  26. package/dist/schema-BmKdDzr1.mjs +784 -0
  27. package/dist/schema-BmKdDzr1.mjs.map +1 -0
  28. package/dist/{src-CG8kJBI9.mjs → src-QNTCsO6J.mjs} +2 -2
  29. package/dist/{src-CG8kJBI9.mjs.map → src-QNTCsO6J.mjs.map} +1 -1
  30. package/dist/types-r-ZratAg.mjs +13 -0
  31. package/dist/types-r-ZratAg.mjs.map +1 -0
  32. package/dist/{update-D0muqqOP.mjs → update-CUvANRhs.mjs} +1661 -413
  33. package/dist/update-CUvANRhs.mjs.map +1 -0
  34. package/dist/utils/test/index.d.mts +2 -2
  35. package/dist/utils/test/index.mjs +1 -1
  36. package/docs/cli/tailordb.md +0 -12
  37. package/docs/generator/builtin.md +26 -21
  38. package/docs/plugin/custom.md +389 -0
  39. package/docs/plugin/index.md +112 -0
  40. package/package.json +15 -23
  41. package/dist/application-BKBo5tGD.mjs.map +0 -1
  42. package/dist/application-a12-7TT3.mjs +0 -4
  43. package/dist/update-D0muqqOP.mjs.map +0 -1
  44. /package/dist/{chunk-CIV_ash9.mjs → chunk-C3Kl5s5P.mjs} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#580](https://github.com/tailor-platform/sdk/pull/580) [`74c2dfc`](https://github.com/tailor-platform/sdk/commit/74c2dfcb3e33d8d2548d7a948e5e322745e4a54c) Thanks [@toiroakr](https://github.com/toiroakr)! - Always generate exec.mjs for seed generator and add --machine-user option
8
+
9
+ - exec.mjs is now generated regardless of whether `machineUserName` is configured
10
+ - Added `--machine-user` (`-m`) CLI option to specify machine user at runtime
11
+ - CLI argument takes precedence over config default, allowing override
12
+ - Shows clear error message when machine user is not specified and not configured
13
+
14
+ ## 1.12.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [#579](https://github.com/tailor-platform/sdk/pull/579) [`1d37a95`](https://github.com/tailor-platform/sdk/commit/1d37a954208c1e6ae64bac7afda604311d95e2cc) Thanks [@dqn](https://github.com/dqn)! - Make TailorDBField fluent API immutable
19
+
20
+ Fluent methods (`description()`, `index()`, `unique()`, `hooks()`, `validate()`, `serial()`, `vector()`, `relation()`) now return new instances instead of mutating `this`, preventing shared field corruption when the same field is used across multiple types.
21
+
22
+ - [#575](https://github.com/tailor-platform/sdk/pull/575) [`43d4795`](https://github.com/tailor-platform/sdk/commit/43d4795543b1427edf661dc495e89e60a1406305) Thanks [@k1LoW](https://github.com/k1LoW)! - Handle OAuth2 client type changes with delete-recreate
23
+
24
+ OAuth2 clients cannot update their clientType in-place on the server. This change detects clientType changes and handles them as replace operations (delete then create) during the create-update phase. Also adds deletion warnings for OAuth2 clients similar to TailorDB types and StaticWebsites.
25
+
26
+ - [#556](https://github.com/tailor-platform/sdk/pull/556) [`b2183b3`](https://github.com/tailor-platform/sdk/commit/b2183b3975fa993d2a61035d90d6b6a4002a852a) Thanks [@toiroakr](https://github.com/toiroakr)! - feat: add TailorDB plugin system (beta), including plugin config, code generation, and apply integration.
27
+
28
+ ### Patch Changes
29
+
30
+ - [#564](https://github.com/tailor-platform/sdk/pull/564) [`6be4cac`](https://github.com/tailor-platform/sdk/commit/6be4cacd3037f6230be1f3ddc24fdb75629e4f2a) Thanks [@toiroakr](https://github.com/toiroakr)! - chore: add TailorDB migration e2e workflow and adjust apply ordering for migrations.
31
+
32
+ - [#563](https://github.com/tailor-platform/sdk/pull/563) [`15fa518`](https://github.com/tailor-platform/sdk/commit/15fa518f6b0de2daf43eb1d41b3991ac867ed11a) Thanks [@riku99](https://github.com/riku99)! - Bundle optional peer dependencies with the SDK
33
+
34
+ - [#574](https://github.com/tailor-platform/sdk/pull/574) [`6e5c4ee`](https://github.com/tailor-platform/sdk/commit/6e5c4eecedda91bd7544102b2c4e58bfe7eeff7d) Thanks [@riku99](https://github.com/riku99)! - Remove unnecessary tests
35
+
36
+ - [#576](https://github.com/tailor-platform/sdk/pull/576) [`b909cdb`](https://github.com/tailor-platform/sdk/commit/b909cdb24e2d415af26a0f2237dfd012b5a78692) Thanks [@dqn](https://github.com/dqn)! - Add automatic chunking for seed data to avoid gRPC message size limits
37
+
38
+ Large seed data that exceeds the 4MB gRPC message size limit is now automatically split into smaller chunks and sent in multiple requests.
39
+
3
40
  ## 1.11.1
4
41
 
5
42
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+ import "./chunk-C3Kl5s5P.mjs";
2
+ import { t as defineApplication } from "./application-DnWZVbDO.mjs";
3
+
4
+ export { defineApplication };
@@ -1,4 +1,5 @@
1
- import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-CIV_ash9.mjs";
1
+ import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-C3Kl5s5P.mjs";
2
+ import { t as isPluginGeneratedType } from "./types-r-ZratAg.mjs";
2
3
  import Module, { createRequire } from "node:module";
3
4
  import { z } from "zod";
4
5
  import * as fs$15 from "node:fs";
@@ -60,6 +61,7 @@ const symbols = {
60
61
  create: chalk.green("+"),
61
62
  update: chalk.yellow("~"),
62
63
  delete: chalk.red("-"),
64
+ replace: chalk.magenta("±"),
63
65
  bullet: chalk.gray("•"),
64
66
  arrow: chalk.gray("→")
65
67
  };
@@ -86250,7 +86252,7 @@ var require_config_loader = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86250
86252
  * @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
86251
86253
  */
86252
86254
  static async loadJiti() {
86253
- const { createJiti } = await import("./jiti-ygK9KoRA.mjs");
86255
+ const { createJiti } = await import("./jiti-DuCiUfMj.mjs");
86254
86256
  return {
86255
86257
  createJiti,
86256
86258
  version: require_package$1().version
@@ -86592,7 +86594,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86592
86594
  */
86593
86595
  async function globMatch({ basePath, pattern }) {
86594
86596
  let found = false;
86595
- const { hfs } = await import("./src-CG8kJBI9.mjs");
86597
+ const { hfs } = await import("./src-QNTCsO6J.mjs");
86596
86598
  const matcher = new Minimatch(normalizeToPosix(path$9.relative(basePath, pattern)), MINIMATCH_OPTIONS);
86597
86599
  const walkSettings = {
86598
86600
  directoryFilter(entry) {
@@ -86639,7 +86641,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86639
86641
  return new Minimatch(patternToUse, MINIMATCH_OPTIONS);
86640
86642
  });
86641
86643
  const unmatchedPatterns = new Set([...relativeToPatterns.keys()]);
86642
- const { hfs } = await import("./src-CG8kJBI9.mjs");
86644
+ const { hfs } = await import("./src-QNTCsO6J.mjs");
86643
86645
  const walk = hfs.walk(basePath, {
86644
86646
  async directoryFilter(entry) {
86645
86647
  if (!matchers.some((matcher) => matcher.match(entry.path, true))) return false;
@@ -97461,12 +97463,12 @@ function buildBackwardRelationships(types$2, namespace, typeSourceInfo) {
97461
97463
  for (const [targetTypeName, backwardNames] of Object.entries(backwardNameSources)) {
97462
97464
  const targetType = types$2[targetTypeName];
97463
97465
  const targetTypeSourceInfo = typeSourceInfo?.[targetTypeName];
97464
- const targetLocation = targetTypeSourceInfo ? ` (${targetTypeSourceInfo.filePath})` : "";
97466
+ const targetLocation = targetTypeSourceInfo ? isPluginGeneratedType(targetTypeSourceInfo) ? ` (plugin: ${targetTypeSourceInfo.pluginId})` : ` (${targetTypeSourceInfo.filePath})` : "";
97465
97467
  for (const [backwardName, sources] of Object.entries(backwardNames)) {
97466
97468
  if (sources.length > 1) {
97467
97469
  const sourceList = sources.map((s) => {
97468
97470
  const sourceInfo = typeSourceInfo?.[s.sourceType];
97469
- const location = sourceInfo ? ` (${sourceInfo.filePath})` : "";
97471
+ const location = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
97470
97472
  return `${s.sourceType}.${s.fieldName}${location}`;
97471
97473
  }).join(", ");
97472
97474
  errors.push(`Backward relation name "${backwardName}" on type "${targetTypeName}" is duplicated from: ${sourceList}. Use the "backward" option in .relation() to specify unique names.`);
@@ -97474,13 +97476,13 @@ function buildBackwardRelationships(types$2, namespace, typeSourceInfo) {
97474
97476
  if (backwardName in targetType.fields) {
97475
97477
  const source = sources[0];
97476
97478
  const sourceInfo = typeSourceInfo?.[source.sourceType];
97477
- const sourceLocation = sourceInfo ? ` (${sourceInfo.filePath})` : "";
97479
+ const sourceLocation = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
97478
97480
  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.`);
97479
97481
  }
97480
97482
  if (targetType.files && backwardName in targetType.files) {
97481
97483
  const source = sources[0];
97482
97484
  const sourceInfo = typeSourceInfo?.[source.sourceType];
97483
- const sourceLocation = sourceInfo ? ` (${sourceInfo.filePath})` : "";
97485
+ const sourceLocation = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
97484
97486
  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.`);
97485
97487
  }
97486
97488
  }
@@ -97502,7 +97504,7 @@ function validatePluralFormUniqueness(types$2, namespace, typeSourceInfo) {
97502
97504
  const singularQuery = inflection.camelize(parsedType.name, true);
97503
97505
  if (singularQuery === inflection.camelize(parsedType.pluralForm, true)) {
97504
97506
  const sourceInfo = typeSourceInfo?.[parsedType.name];
97505
- const location = sourceInfo ? ` (${sourceInfo.filePath})` : "";
97507
+ const location = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
97506
97508
  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.`);
97507
97509
  }
97508
97510
  }
@@ -97527,7 +97529,7 @@ function validatePluralFormUniqueness(types$2, namespace, typeSourceInfo) {
97527
97529
  for (const [queryName, sources] of duplicates) {
97528
97530
  const sourceList = sources.map((s) => {
97529
97531
  const sourceInfo = typeSourceInfo?.[s.typeName];
97530
- const location = sourceInfo ? ` (${sourceInfo.filePath})` : "";
97532
+ const location = sourceInfo ? isPluginGeneratedType(sourceInfo) ? ` (plugin: ${sourceInfo.pluginId})` : ` (${sourceInfo.filePath})` : "";
97531
97533
  return `"${s.typeName}"${location} (${s.kind})`;
97532
97534
  }).join(", ");
97533
97535
  errors.push(`GraphQL query field "${queryName}" conflicts between: ${sourceList}`);
@@ -97669,19 +97671,67 @@ const TailorDBServiceConfigSchema = z.object({
97669
97671
  //#region src/cli/application/tailordb/service.ts
97670
97672
  /**
97671
97673
  * Creates a new TailorDBService instance.
97672
- * @param namespace - The namespace for this TailorDB service
97673
- * @param config - The TailorDB service configuration
97674
+ * @param params - Parameters for creating the service
97674
97675
  * @returns A new TailorDBService instance
97675
97676
  */
97676
- function createTailorDBService(namespace, config) {
97677
+ function createTailorDBService(params) {
97678
+ const { namespace, config, pluginManager } = params;
97677
97679
  const rawTypes = {};
97678
97680
  let types$2 = {};
97679
97681
  const typeSourceInfo = {};
97682
+ const pluginAttachments = /* @__PURE__ */ new Map();
97680
97683
  const doParseTypes = () => {
97681
97684
  const allTypes = {};
97682
97685
  for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) allTypes[typeName] = type;
97683
97686
  types$2 = parseTypes(allTypes, namespace, typeSourceInfo);
97684
97687
  };
97688
+ /**
97689
+ * Process plugins for a type and add generated types to rawTypes
97690
+ * @param rawType - The raw TailorDB type being processed
97691
+ * @param attachments - Plugin attachments for this type
97692
+ * @param sourceFilePath - The file path where the type was loaded from
97693
+ */
97694
+ const processPluginsForType = async (rawType, attachments, sourceFilePath) => {
97695
+ if (!pluginManager) return;
97696
+ let currentType = rawType;
97697
+ for (const attachment of attachments) {
97698
+ const result = await pluginManager.processAttachment({
97699
+ type: currentType,
97700
+ config: attachment.config,
97701
+ namespace,
97702
+ pluginId: attachment.pluginId
97703
+ });
97704
+ if (!result.success) {
97705
+ logger.error(result.error);
97706
+ throw new Error(result.error);
97707
+ }
97708
+ const output = result.output;
97709
+ const extendFields = output.extends?.fields;
97710
+ if (extendFields && Object.keys(extendFields).length > 0) {
97711
+ const extendedType = pluginManager.extendType({
97712
+ originalType: currentType,
97713
+ extendFields,
97714
+ pluginId: attachment.pluginId
97715
+ });
97716
+ rawTypes[sourceFilePath][currentType.name] = extendedType;
97717
+ currentType = extendedType;
97718
+ logger.log(` Extended: ${styles.success(currentType.name)} with ${styles.highlight(Object.keys(extendFields).length.toString())} fields by plugin ${styles.info(attachment.pluginId)}`);
97719
+ }
97720
+ for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
97721
+ rawTypes[sourceFilePath][generatedType.name] = generatedType;
97722
+ typeSourceInfo[generatedType.name] = {
97723
+ exportName: generatedType.name,
97724
+ pluginId: attachment.pluginId,
97725
+ pluginImportPath: pluginManager.getPluginImportPath(attachment.pluginId) ?? "",
97726
+ originalFilePath: sourceFilePath,
97727
+ originalExportName: typeSourceInfo[rawType.name]?.exportName || rawType.name,
97728
+ generatedTypeKind: kind,
97729
+ pluginConfig: attachment.config
97730
+ };
97731
+ logger.log(` Generated: ${styles.success(generatedType.name)} by plugin ${styles.info(attachment.pluginId)}`);
97732
+ }
97733
+ }
97734
+ };
97685
97735
  const loadTypeFile = async (typeFile) => {
97686
97736
  rawTypes[typeFile] = {};
97687
97737
  const loadedTypes = {};
@@ -97699,6 +97749,11 @@ function createTailorDBService(namespace, config) {
97699
97749
  filePath: typeFile,
97700
97750
  exportName
97701
97751
  };
97752
+ if (exportedValue.plugins && Array.isArray(exportedValue.plugins) && exportedValue.plugins.length > 0) {
97753
+ pluginAttachments.set(exportedValue.name, [...exportedValue.plugins]);
97754
+ logger.log(` Plugin attachments: ${styles.info(exportedValue.plugins.map((p) => p.pluginId).join(", "))}`);
97755
+ await processPluginsForType(exportedValue, exportedValue.plugins, typeFile);
97756
+ }
97702
97757
  }
97703
97758
  } catch (error) {
97704
97759
  const relativePath = path$20.relative(process.cwd(), typeFile);
@@ -97713,15 +97768,74 @@ function createTailorDBService(namespace, config) {
97713
97768
  config,
97714
97769
  getTypes: () => types$2,
97715
97770
  getTypeSourceInfo: () => typeSourceInfo,
97771
+ getPluginAttachments: () => pluginAttachments,
97716
97772
  loadTypes: async () => {
97717
97773
  if (Object.keys(rawTypes).length > 0) return types$2;
97718
97774
  if (!config.files || config.files.length === 0) return;
97719
97775
  const typeFiles = loadFilesWithIgnores(config);
97720
97776
  logger.newline();
97721
97777
  logger.log(`Found ${styles.highlight(typeFiles.length.toString())} type files for TailorDB service ${styles.highlight(`"${namespace}"`)}`);
97722
- await Promise.all(typeFiles.map((typeFile) => loadTypeFile(typeFile)));
97778
+ if (pluginManager) for (const typeFile of typeFiles) await loadTypeFile(typeFile);
97779
+ else await Promise.all(typeFiles.map((typeFile) => loadTypeFile(typeFile)));
97723
97780
  doParseTypes();
97724
97781
  return types$2;
97782
+ },
97783
+ processNamespacePlugins: async () => {
97784
+ if (!pluginManager) return;
97785
+ const typeByName = /* @__PURE__ */ new Map();
97786
+ for (const typeMap of Object.values(rawTypes)) for (const [typeName, typeValue] of Object.entries(typeMap)) if (!typeByName.has(typeName)) typeByName.set(typeName, typeValue);
97787
+ const originalTypeBySourceKey = /* @__PURE__ */ new Map();
97788
+ for (const [typeName, source] of Object.entries(typeSourceInfo)) if ("filePath" in source && source.filePath && source.exportName) {
97789
+ const typeValue = typeByName.get(typeName);
97790
+ if (!typeValue) continue;
97791
+ const key = `${source.filePath}:${source.exportName}`;
97792
+ originalTypeBySourceKey.set(key, typeValue);
97793
+ }
97794
+ const namespaceTypes = [];
97795
+ const namespaceGeneratedTypes = [];
97796
+ for (const [typeName, typeValue] of typeByName.entries()) {
97797
+ const source = typeSourceInfo[typeName];
97798
+ if (!source) continue;
97799
+ if (isPluginGeneratedType(source)) {
97800
+ if (!Boolean(source.originalFilePath && source.originalExportName)) continue;
97801
+ const originalType = originalTypeBySourceKey.get(`${source.originalFilePath}:${source.originalExportName}`) ?? null;
97802
+ if (!originalType) continue;
97803
+ namespaceGeneratedTypes.push({
97804
+ type: typeValue,
97805
+ pluginId: source.pluginId,
97806
+ generatedTypeKind: source.generatedTypeKind,
97807
+ originalType
97808
+ });
97809
+ continue;
97810
+ }
97811
+ namespaceTypes.push(typeValue);
97812
+ }
97813
+ const results = await pluginManager.processNamespacePlugins(namespace, namespaceTypes, namespaceGeneratedTypes);
97814
+ const pluginGeneratedKey = "__plugin_generated__";
97815
+ if (!rawTypes[pluginGeneratedKey]) rawTypes[pluginGeneratedKey] = {};
97816
+ let hasGeneratedTypes = false;
97817
+ for (const { pluginId, config: config$1, result } of results) {
97818
+ if (!result.success) {
97819
+ logger.error(result.error);
97820
+ throw new Error(result.error);
97821
+ }
97822
+ const output = result.output;
97823
+ for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
97824
+ rawTypes[pluginGeneratedKey][generatedType.name] = generatedType;
97825
+ hasGeneratedTypes = true;
97826
+ typeSourceInfo[generatedType.name] = {
97827
+ exportName: generatedType.name,
97828
+ pluginId,
97829
+ pluginImportPath: pluginManager.getPluginImportPath(pluginId) ?? "",
97830
+ originalFilePath: "",
97831
+ originalExportName: "",
97832
+ generatedTypeKind: kind,
97833
+ pluginConfig: config$1
97834
+ };
97835
+ logger.log(` Generated: ${styles.success(generatedType.name)} by namespace plugin ${styles.info(pluginId)}`);
97836
+ }
97837
+ }
97838
+ if (hasGeneratedTypes) doParseTypes();
97725
97839
  }
97726
97840
  };
97727
97841
  }
@@ -98104,11 +98218,13 @@ const ExecutorSchema = z.object({
98104
98218
  //#region src/cli/application/executor/service.ts
98105
98219
  /**
98106
98220
  * Creates a new ExecutorService instance.
98107
- * @param config - The executor service configuration
98221
+ * @param params - Parameters for creating the service
98108
98222
  * @returns A new ExecutorService instance
98109
98223
  */
98110
- function createExecutorService(config) {
98224
+ function createExecutorService(params) {
98225
+ const { config } = params;
98111
98226
  const executors = {};
98227
+ const pluginExecutors = [];
98112
98228
  const loadExecutorForFile = async (executorFile) => {
98113
98229
  try {
98114
98230
  const executorModule = await import(pathToFileURL(executorFile).href);
@@ -98129,6 +98245,7 @@ function createExecutorService(config) {
98129
98245
  return {
98130
98246
  config,
98131
98247
  getExecutors: () => executors,
98248
+ getPluginExecutors: () => pluginExecutors,
98132
98249
  loadExecutors: async () => {
98133
98250
  if (Object.keys(executors).length > 0) return executors;
98134
98251
  if (!config.files || config.files.length === 0) return;
@@ -98137,6 +98254,19 @@ function createExecutorService(config) {
98137
98254
  logger.log(`Found ${styles.highlight(executorFiles.length.toString())} executor files`);
98138
98255
  await Promise.all(executorFiles.map((executorFile) => loadExecutorForFile(executorFile)));
98139
98256
  return executors;
98257
+ },
98258
+ loadPluginExecutorFiles: async (filePaths) => {
98259
+ if (filePaths.length === 0) return;
98260
+ logger.newline();
98261
+ logger.log(`Loading ${styles.highlight(filePaths.length.toString())} plugin-generated executor files`);
98262
+ for (const filePath of filePaths) {
98263
+ const executor = await loadExecutorForFile(filePath);
98264
+ if (executor) pluginExecutors.push({
98265
+ executor,
98266
+ pluginId: "plugin-generated",
98267
+ sourceTypeName: void 0
98268
+ });
98269
+ }
98140
98270
  }
98141
98271
  };
98142
98272
  }
@@ -98237,7 +98367,7 @@ const WorkflowSchema = z.object({
98237
98367
 
98238
98368
  //#endregion
98239
98369
  //#region src/cli/application/index.ts
98240
- function defineTailorDB(config) {
98370
+ function defineTailorDB(config, pluginManager) {
98241
98371
  const tailorDBServices = [];
98242
98372
  const externalTailorDBNamespaces = [];
98243
98373
  const subgraphs = [];
@@ -98249,7 +98379,11 @@ function defineTailorDB(config) {
98249
98379
  for (const [namespace, serviceConfig] of Object.entries(config)) {
98250
98380
  if ("external" in serviceConfig) externalTailorDBNamespaces.push(namespace);
98251
98381
  else {
98252
- const tailorDB = createTailorDBService(namespace, TailorDBServiceConfigSchema.parse(serviceConfig));
98382
+ const tailorDB = createTailorDBService({
98383
+ namespace,
98384
+ config: TailorDBServiceConfigSchema.parse(serviceConfig),
98385
+ pluginManager
98386
+ });
98253
98387
  tailorDBServices.push(tailorDB);
98254
98388
  }
98255
98389
  subgraphs.push({
@@ -98328,9 +98462,12 @@ function defineAuth(config, tailorDBServices, externalTailorDBNamespaces) {
98328
98462
  subgraphs
98329
98463
  };
98330
98464
  }
98331
- function defineExecutor(config) {
98465
+ function defineExecutor(config, pluginManager) {
98332
98466
  if (!config) return { executorService: void 0 };
98333
- return { executorService: createExecutorService(config) };
98467
+ return { executorService: createExecutorService({
98468
+ config,
98469
+ pluginManager
98470
+ }) };
98334
98471
  }
98335
98472
  function defineWorkflow(config) {
98336
98473
  return { workflowConfig: config };
@@ -98348,15 +98485,16 @@ function defineStaticWebsites(websites) {
98348
98485
  }
98349
98486
  /**
98350
98487
  * Define a Tailor application from the given configuration.
98351
- * @param config - Application configuration object
98488
+ * @param params - Parameters for defining the application
98352
98489
  * @returns Configured application instance
98353
98490
  */
98354
- function defineApplication(config) {
98355
- const tailordbResult = defineTailorDB(config.db);
98491
+ function defineApplication(params) {
98492
+ const { config, pluginManager } = params;
98493
+ const tailordbResult = defineTailorDB(config.db, pluginManager);
98356
98494
  const resolverResult = defineResolver(config.resolver);
98357
98495
  const idpResult = defineIdp(config.idp);
98358
98496
  const authResult = defineAuth(config.auth, tailordbResult.tailorDBServices, tailordbResult.externalTailorDBNamespaces);
98359
- const executorResult = defineExecutor(config.executor);
98497
+ const executorResult = defineExecutor(config.executor, pluginManager);
98360
98498
  const workflowResult = defineWorkflow(config.workflow);
98361
98499
  const staticWebsiteResult = defineStaticWebsites(config.staticWebsites);
98362
98500
  const subgraphs = [
@@ -98386,5 +98524,5 @@ function defineApplication(config) {
98386
98524
  }
98387
98525
 
98388
98526
  //#endregion
98389
- export { OAuth2ClientSchema as a, tailorUserMap as c, styles as d, symbols as f, ExecutorSchema as i, loadFilesWithIgnores as l, WorkflowJobSchema as n, ResolverSchema as o, WorkflowSchema as r, stringifyFunction as s, defineApplication as t, logger as u };
98390
- //# sourceMappingURL=application-BKBo5tGD.mjs.map
98527
+ export { ExecutorSchema as a, stringifyFunction as c, logger as d, styles as f, createExecutorService as i, tailorUserMap as l, WorkflowJobSchema as n, OAuth2ClientSchema as o, symbols as p, WorkflowSchema as r, ResolverSchema as s, defineApplication as t, loadFilesWithIgnores as u };
98528
+ //# sourceMappingURL=application-DnWZVbDO.mjs.map