@tailor-platform/sdk 1.14.1 → 1.14.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +19 -0
  3. package/dist/application-BznueWxG.mjs +4 -0
  4. package/dist/{application-DnWZVbDO.mjs → application-DhwHYQ3H.mjs} +95 -44
  5. package/dist/application-DhwHYQ3H.mjs.map +1 -0
  6. package/dist/cli/index.mjs +4 -4
  7. package/dist/cli/lib.d.mts +12 -49
  8. package/dist/cli/lib.mjs +4 -4
  9. package/dist/cli/skills.d.mts +2 -0
  10. package/dist/cli/skills.mjs +51 -0
  11. package/dist/cli/skills.mjs.map +1 -0
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +2 -2
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/index-YzESrtj0.d.mts +396 -0
  16. package/dist/{index-BlUBAAvu.d.mts → index-q3n7wQOs.d.mts} +5 -4
  17. package/dist/{jiti-DuCiUfMj.mjs → jiti-BrELlEYT.mjs} +2 -2
  18. package/dist/{jiti-DuCiUfMj.mjs.map → jiti-BrELlEYT.mjs.map} +1 -1
  19. package/dist/{job-zGAXCidt.mjs → job-XiwGyFJt.mjs} +1 -1
  20. package/dist/{job-zGAXCidt.mjs.map → job-XiwGyFJt.mjs.map} +1 -1
  21. package/dist/plugin/index.d.mts +16 -2
  22. package/dist/plugin/index.mjs +208 -1
  23. package/dist/plugin/index.mjs.map +1 -1
  24. package/dist/{schema-BmKdDzr1.mjs → schema-DRYB-nzA.mjs} +1 -1
  25. package/dist/{schema-BmKdDzr1.mjs.map → schema-DRYB-nzA.mjs.map} +1 -1
  26. package/dist/{src-QNTCsO6J.mjs → src-DMROgdcL.mjs} +2 -2
  27. package/dist/{src-QNTCsO6J.mjs.map → src-DMROgdcL.mjs.map} +1 -1
  28. package/dist/{index-Bid18Opo.d.mts → types-DbvONSS-.d.mts} +570 -454
  29. package/dist/{types-r-ZratAg.mjs → types-b-ig8nW_.mjs} +1 -1
  30. package/dist/types-b-ig8nW_.mjs.map +1 -0
  31. package/dist/{update-2eb6jz9o.mjs → update-Dm8ERWHJ.mjs} +79 -90
  32. package/dist/update-Dm8ERWHJ.mjs.map +1 -0
  33. package/dist/utils/test/index.d.mts +3 -3
  34. package/dist/utils/test/index.mjs +1 -1
  35. package/docs/plugin/custom.md +105 -49
  36. package/docs/plugin/index.md +2 -2
  37. package/package.json +5 -3
  38. package/skills/tailor-sdk/SKILL.md +34 -0
  39. package/dist/application-DM4zTgXU.mjs +0 -4
  40. package/dist/application-DnWZVbDO.mjs.map +0 -1
  41. package/dist/env-4RO7szrH.d.mts +0 -66
  42. package/dist/types-r-ZratAg.mjs.map +0 -1
  43. package/dist/update-2eb6jz9o.mjs.map +0 -1
  44. /package/dist/{chunk-C3Kl5s5P.mjs → chunk-GMkBE123.mjs} +0 -0
@@ -10,4 +10,4 @@ function isPluginGeneratedType(source) {
10
10
 
11
11
  //#endregion
12
12
  export { isPluginGeneratedType as t };
13
- //# sourceMappingURL=types-r-ZratAg.mjs.map
13
+ //# sourceMappingURL=types-b-ig8nW_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-b-ig8nW_.mjs","names":[],"sources":["../src/parser/service/tailordb/types.ts"],"sourcesContent":["import type { RelationType } from \"./relation\";\nimport type {\n DBFieldMetadataSchema,\n RawRelationConfigSchema,\n RawPermissionsSchema,\n TailorDBTypeSchema,\n TailorDBServiceConfig as TailorDBServiceConfigType,\n TailorDBTypeSettingsSchema,\n} from \"./schema\";\nimport type { GqlOperationsConfig } from \"@/configure/services/tailordb\";\nimport type { ValueOperand } from \"@/parser/service/auth/types\";\nimport type { z } from \"zod\";\n\nexport type { RelationType } from \"./relation\";\nexport type { TypeSourceInfo } from \"./type-parser\";\n\n// ========================================\n// Source info type for TailorDB types\n// ========================================\n\n/**\n * Source information for a user-defined TailorDB type.\n */\nexport interface UserDefinedTypeSource {\n /** File path to import from */\n filePath: string;\n /** Export name in the source file */\n exportName: string;\n /** Not present for user-defined types */\n pluginId?: never;\n}\n\n/**\n * Source information for a plugin-generated TailorDB type.\n */\nexport interface PluginGeneratedTypeSource {\n /** Not present for plugin-generated types */\n filePath?: never;\n /** Export name of the generated type */\n exportName: string;\n /** Plugin ID that generated this type */\n pluginId: string;\n /** Plugin import path for code generators */\n pluginImportPath: string;\n /** Original type's file path */\n originalFilePath: string;\n /** Original type's export name */\n originalExportName: string;\n /** Generated type kind for getGeneratedType() API (e.g., \"request\", \"step\") */\n generatedTypeKind?: string;\n /** Plugin config used to generate this type */\n pluginConfig?: unknown;\n /** Namespace where this type was generated */\n namespace?: string;\n}\n\n/**\n * Source information for a TailorDB type.\n * Discriminated union: use `pluginId` to distinguish between user-defined and plugin-generated types.\n */\nexport type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;\n\n/**\n * Type guard to check if source is plugin-generated\n * @param source - Type source info to check\n * @returns True if source is plugin-generated\n */\nexport function isPluginGeneratedType(\n source: TypeSourceInfoEntry,\n): source is PluginGeneratedTypeSource {\n return source.pluginId !== undefined;\n}\n\nexport type {\n TailorAnyDBField,\n TailorAnyDBType,\n TailorDBField,\n DBFieldMetadata,\n Hook,\n TailorTypePermission,\n TailorTypeGqlPermission,\n GqlOperationsConfig,\n GqlOperations,\n} from \"@/configure/services/tailordb\";\nexport type {\n TailorDBServiceConfigInput,\n TailorDBServiceConfig,\n TailorDBExternalConfig,\n TailorDBServiceInput,\n} from \"./schema\";\n\n/**\n * Parsed and normalized settings for TailorDB type.\n * gqlOperations is normalized from alias to object format.\n * @public\n */\nexport type TailorDBTypeParsedSettings = z.output<typeof TailorDBTypeSettingsSchema>;\n\n/**\n * Migration configuration for TailorDB\n * @public\n */\nexport type TailorDBMigrationConfig = NonNullable<TailorDBServiceConfigType[\"migration\"]>;\n\nexport type TailorDBTypeSchemaOutput = z.output<typeof TailorDBTypeSchema>;\n\nexport type DBFieldMetadataOutput = z.output<typeof DBFieldMetadataSchema>;\nexport type RawRelationConfigOutput = z.output<typeof RawRelationConfigSchema>;\n\nexport type RawPermissions = z.output<typeof RawPermissionsSchema>;\n\nexport type TailorDBFieldOutput = {\n type: string;\n fields?: Record<string, TailorDBFieldOutput>;\n metadata: DBFieldMetadataOutput;\n rawRelation?: RawRelationConfigOutput;\n};\n\nexport interface Script {\n expr: string;\n}\n\nexport interface EnumValue {\n value: string;\n description?: string;\n}\n\ninterface OperatorValidateConfig {\n script: Script;\n errorMessage: string;\n}\n\ninterface OperatorFieldHook {\n create?: Script;\n update?: Script;\n}\n\n/**\n * Raw relation config stored in configure layer, processed in parser layer.\n * This is the serialized form of RelationConfig from schema.ts where\n * the TailorDBType reference is replaced with the type name string.\n */\nexport interface RawRelationConfig {\n type: RelationType;\n toward: {\n type: string;\n as?: string;\n key?: string;\n };\n backward?: string;\n}\n\nexport interface OperatorFieldConfig {\n type: string;\n required?: boolean;\n description?: string;\n allowedValues?: EnumValue[];\n array?: boolean;\n index?: boolean;\n unique?: boolean;\n vector?: boolean;\n foreignKey?: boolean;\n foreignKeyType?: string;\n foreignKeyField?: string;\n rawRelation?: RawRelationConfig;\n validate?: OperatorValidateConfig[];\n hooks?: OperatorFieldHook;\n serial?: {\n start: number;\n maxValue?: number;\n format?: string;\n };\n fields?: Record<string, OperatorFieldConfig>;\n}\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\ntype StandardPermissionOperator = \"eq\" | \"ne\" | \"in\" | \"nin\";\n\ntype UserOperand = {\n user: string;\n};\n\ntype RecordOperand<Update extends boolean = false> = Update extends true\n ? { oldRecord: string } | { newRecord: string }\n : { record: string };\n\nexport type PermissionOperand<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = UserOperand | ValueOperand | (Level extends \"record\" ? RecordOperand<Update> : never);\n\nexport type StandardPermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = readonly [\n PermissionOperand<Level, Update>,\n StandardPermissionOperator,\n PermissionOperand<Level, Update>,\n];\n\nexport type StandardActionPermission<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = {\n conditions: readonly StandardPermissionCondition<Level, Update>[];\n description?: string;\n permit: \"allow\" | \"deny\";\n};\n\nexport type StandardTailorTypePermission = {\n create: readonly StandardActionPermission<\"record\", false>[];\n read: readonly StandardActionPermission<\"record\", false>[];\n update: readonly StandardActionPermission<\"record\", true>[];\n delete: readonly StandardActionPermission<\"record\", false>[];\n};\n\nexport type StandardGqlPermissionPolicy = {\n conditions: readonly StandardPermissionCondition<\"gql\">[];\n actions: readonly [\"all\"] | readonly GqlPermissionAction[];\n permit: \"allow\" | \"deny\";\n description?: string;\n};\n\nexport type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];\n\nexport interface Permissions {\n record?: StandardTailorTypePermission;\n gql?: StandardTailorTypeGqlPermission;\n}\n\nexport interface TailorDBTypeMetadata {\n name: string;\n description?: string;\n settings?: {\n pluralForm?: string;\n aggregation?: boolean;\n bulkUpsert?: boolean;\n gqlOperations?: GqlOperationsConfig;\n };\n permissions: RawPermissions;\n files: Record<string, string>;\n indexes?: Record<\n string,\n {\n fields: string[];\n unique?: boolean;\n }\n >;\n}\n\n/**\n * Parsed and normalized TailorDB field information\n */\nexport interface ParsedField {\n name: string;\n config: OperatorFieldConfig;\n relation?: {\n targetType: string;\n forwardName: string;\n backwardName: string;\n key: string;\n unique: boolean;\n };\n}\n\n/**\n * Parsed and normalized TailorDB relationship information\n */\nexport interface ParsedRelationship {\n name: string;\n targetType: string;\n targetField: string;\n sourceField: string;\n isArray: boolean;\n description: string;\n}\n\n/**\n * Parsed and normalized TailorDB type information\n */\nexport interface TailorDBType {\n name: string;\n pluralForm: string;\n description?: string;\n fields: Record<string, ParsedField>;\n forwardRelationships: Record<string, ParsedRelationship>;\n backwardRelationships: Record<string, ParsedRelationship>;\n settings: TailorDBTypeParsedSettings;\n permissions: Permissions;\n indexes?: TailorDBTypeMetadata[\"indexes\"];\n files?: TailorDBTypeMetadata[\"files\"];\n}\n"],"mappings":";;;;;;AAmEA,SAAgB,sBACd,QACqC;AACrC,QAAO,OAAO,aAAa"}
@@ -1,6 +1,6 @@
1
- import { t as isPluginGeneratedType } from "./types-r-ZratAg.mjs";
2
- import { t as db } from "./schema-BmKdDzr1.mjs";
3
- import { a as ExecutorSchema, c as stringifyFunction, d as logger, f as styles, i as createExecutorService, l as tailorUserMap, n as WorkflowJobSchema, o as OAuth2ClientSchema, p as symbols, r as WorkflowSchema, s as ResolverSchema, t as defineApplication, u as loadFilesWithIgnores } from "./application-DnWZVbDO.mjs";
1
+ import { t as isPluginGeneratedType } from "./types-b-ig8nW_.mjs";
2
+ import { t as db } from "./schema-DRYB-nzA.mjs";
3
+ import { a as ExecutorSchema, c as TailorFieldSchema, d as tailorUserMap, f as loadFilesWithIgnores, h as symbols, i as createExecutorService, l as functionSchema, m as styles, n as WorkflowJobSchema, o as OAuth2ClientSchema, p as logger, r as WorkflowSchema, s as ResolverSchema, t as defineApplication, u as stringifyFunction } from "./application-DhwHYQ3H.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { cloneDeep } from "es-toolkit";
6
6
  import { arg, defineCommand, runCommand } from "politty";
@@ -522,7 +522,7 @@ const file_tailor_v1_function_registry = /* @__PURE__ */ fileDesc("CiF0YWlsb3Ivd
522
522
  /**
523
523
  * Describes the file tailor/v1/idp_resource.proto.
524
524
  */
525
- const file_tailor_v1_idp_resource = /* @__PURE__ */ fileDesc("Chx0YWlsb3IvdjEvaWRwX3Jlc291cmNlLnByb3RvEgl0YWlsb3IudjEi3gEKCklkUFNlcnZpY2USJwoJbmFtZXNwYWNlGAEgASgLMhQudGFpbG9yLnYxLk5hbWVzcGFjZRIVCg1hdXRob3JpemF0aW9uGAIgASgJEhkKDHByb3Zp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twYXNzd29yZF9sZW5ndGhfY29uc2lzdGVuY3kSRXBhc3N3b3JkX21pbl9sZW5ndGggbXVzdCBiZSBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gcGFzc3dvcmRfbWF4X2xlbmd0aBqDASh0aGlzLnBhc3N3b3JkX21pbl9sZW5ndGggPT0gMCA/IDYgOiB0aGlzLnBhc3N3b3JkX21pbl9sZW5ndGgpIDw9ICh0aGlzLnBhc3N3b3JkX21heF9sZW5ndGggPT0gMCA/IDQwOTYgOiB0aGlzLnBhc3N3b3JkX21heF9sZW5ndGgpGsYBCi9hbGxvd2VkX2VtYWlsX2RvbWFpbnNfcmVxdWlyZXNfZW1haWxfaWRlbnRpZmllchJJYWxsb3dlZF9lbWFpbF9kb21haW5zIGNhbm5vdCBiZSBzZXQgd2hlbiB1c2Vfbm9uX2VtYWlsX2lkZW50aWZpZXIgaXMgdHJ1ZRpIdGhpcy5hbGxvd2VkX2VtYWlsX2RvbWFpbnMuc2l6ZSgpID09IDAgfHwgIXRoaXMudXNlX25vbl9lbWFpbF9pZGVudGlmaWVyGrYBCixhbGxvd19nb29nbGVfb2F1dGhfcmVxdWlyZXNfZW1haWxfaWRlbnRpZmllchJKYWxsb3dfZ29vZ2xlX29hdXRoIGNhbm5vdCBiZSBlbmFibGVkIHdoZW4gdXNlX25vbl9lbWFpbF9pZGVudGlmaWVyIGlzIHRydWUaOiF0aGlzLmFsbG93X2dvb2dsZV9vYXV0aCB8fCAhdGhpcy51c2Vfbm9uX2VtYWlsX2lkZW50aWZpZXIqSAoHSWRQTGFuZxIZChVJRF9QX0xBTkdfVU5TUEVDSUZJRUQQABIQCgxJRF9QX0xBTkdfRU4QARIQCgxJRF9QX0xBTkdfSkEQAmIGcHJvdG8z", [
526
526
  file_buf_validate_validate,
527
527
  file_google_api_field_behavior,
528
528
  file_tailor_v1_resource
@@ -2736,31 +2736,25 @@ z.object({
2736
2736
  resolvers: z.array(PluginGeneratedResolverSchema).optional(),
2737
2737
  executors: z.array(PluginGeneratedExecutorSchema).optional()
2738
2738
  });
2739
+ const tailorAnyFieldSchema = z.custom((val) => TailorFieldSchema.safeParse(val).success);
2739
2740
  const CustomPluginSchema = z.object({
2740
2741
  id: z.string(),
2741
2742
  description: z.string(),
2742
2743
  importPath: z.string(),
2743
- configSchema: z.any().optional(),
2744
- pluginConfigSchema: z.any().optional(),
2745
- pluginConfig: z.any().optional(),
2746
- process: z.any().optional(),
2747
- processNamespace: z.any().optional()
2744
+ configSchema: tailorAnyFieldSchema.optional(),
2745
+ pluginConfigSchema: tailorAnyFieldSchema.optional(),
2746
+ pluginConfig: z.unknown().optional(),
2747
+ processType: functionSchema.optional(),
2748
+ processNamespace: functionSchema.optional(),
2749
+ typeConfigRequired: z.union([z.boolean(), functionSchema]).optional(),
2750
+ configTypeTemplate: z.string().optional()
2748
2751
  }).superRefine((plugin, ctx) => {
2749
- if (plugin.process && !plugin.configSchema) ctx.addIssue({
2752
+ if (plugin.processType && !plugin.configSchema) ctx.addIssue({
2750
2753
  code: z.ZodIssueCode.custom,
2751
- message: "process requires configSchema to be defined.",
2754
+ message: "processType requires configSchema to be defined.",
2752
2755
  path: ["configSchema"]
2753
2756
  });
2754
2757
  }).passthrough();
2755
- const CustomPluginTupleSchema = z.tuple([CustomPluginSchema, z.unknown()]);
2756
- /**
2757
- * Type guard to check if a value is a PluginBase object
2758
- * @param value - Value to check
2759
- * @returns True if value is a PluginBase object
2760
- */
2761
- function isPluginBase(value) {
2762
- return CustomPluginSchema.safeParse(value).success;
2763
- }
2764
2758
  function normalizePluginConfigSchema(schema) {
2765
2759
  const seen = /* @__PURE__ */ new Set();
2766
2760
  const stack = [schema];
@@ -2777,7 +2771,7 @@ function normalizePluginConfigSchema(schema) {
2777
2771
  function clonePluginConfigSchema(schema) {
2778
2772
  return cloneDeep(schema);
2779
2773
  }
2780
- function normalizePluginBase(plugin) {
2774
+ function normalizePlugin(plugin) {
2781
2775
  let normalized = plugin;
2782
2776
  if (normalized.configSchema) {
2783
2777
  const clonedConfigSchema = clonePluginConfigSchema(normalized.configSchema);
@@ -2824,20 +2818,10 @@ function validatePluginConfig$1(config, schema) {
2824
2818
  }
2825
2819
  /**
2826
2820
  * Creates a PluginConfigSchema for custom plugins
2827
- * @returns Plugin config schema that validates and transforms PluginBase instances
2821
+ * @returns Plugin config schema that validates and transforms Plugin instances
2828
2822
  */
2829
2823
  function createPluginConfigSchema() {
2830
- return z.union([CustomPluginSchema, CustomPluginTupleSchema]).transform((plugin) => {
2831
- if (Array.isArray(plugin)) {
2832
- const [first, options] = plugin;
2833
- if (isPluginBase(first)) return normalizePluginBase({
2834
- ...first,
2835
- pluginConfig: options
2836
- });
2837
- throw new Error(`Invalid plugin configuration: expected PluginBase object`);
2838
- }
2839
- return normalizePluginBase(plugin);
2840
- }).brand("Plugin");
2824
+ return CustomPluginSchema.transform((plugin) => normalizePlugin(plugin)).brand("Plugin");
2841
2825
  }
2842
2826
 
2843
2827
  //#endregion
@@ -3367,32 +3351,6 @@ function createKyselyGenerator(options) {
3367
3351
  };
3368
3352
  }
3369
3353
 
3370
- //#endregion
3371
- //#region src/cli/utils/plugin-import.ts
3372
- /**
3373
- * Collect base directories for resolving plugin import paths.
3374
- * @param configPath - Path to tailor.config.ts
3375
- * @returns Ordered list of base directories
3376
- */
3377
- function getPluginImportBaseDirs(configPath) {
3378
- if (configPath) return [path.dirname(configPath)];
3379
- return [process.cwd()];
3380
- }
3381
- /**
3382
- * Resolve a relative plugin import path against candidate base directories.
3383
- * @param pluginImportPath - Relative plugin import path
3384
- * @param baseDirs - Candidate base directories
3385
- * @returns Absolute path if found, otherwise null
3386
- */
3387
- function resolveRelativePluginImportPath(pluginImportPath, baseDirs) {
3388
- if (!pluginImportPath.startsWith(".")) return null;
3389
- for (const baseDir of baseDirs) {
3390
- const absolutePath = path.resolve(baseDir, pluginImportPath);
3391
- if (fs$2.existsSync(absolutePath)) return absolutePath;
3392
- }
3393
- return null;
3394
- }
3395
-
3396
3354
  //#endregion
3397
3355
  //#region src/cli/generator/builtin/seed/idp-user-processor.ts
3398
3356
  /**
@@ -3681,7 +3639,7 @@ function generateLinesDbSchemaFile(metadata, importPath) {
3681
3639
  function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
3682
3640
  const { typeName, exportName, optionalFields, omitFields, foreignKeys, indexes, pluginSource } = metadata;
3683
3641
  if (!pluginSource) throw new Error(`pluginSource is required for plugin-generated type "${typeName}"`);
3684
- const { pluginImportPath, originalImportPath } = params;
3642
+ const { configImportPath, originalImportPath } = params;
3685
3643
  const schemaTypeCode = ml`
3686
3644
  const schemaType = t.object({
3687
3645
  ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),
@@ -3690,13 +3648,15 @@ function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
3690
3648
  `;
3691
3649
  const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);
3692
3650
  if (pluginSource.originalExportName && originalImportPath && pluginSource.generatedTypeKind) return ml`
3651
+ import { join } from "node:path";
3693
3652
  import { t } from "@tailor-platform/sdk";
3653
+ import { getGeneratedType } from "@tailor-platform/sdk/plugin";
3694
3654
  import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
3695
3655
  import { defineSchema } from "@toiroakr/lines-db";
3696
- import { getGeneratedType } from "${pluginImportPath}";
3697
3656
  import { ${pluginSource.originalExportName} } from "${originalImportPath}";
3698
3657
 
3699
- const ${exportName} = getGeneratedType(${pluginSource.originalExportName}, "${pluginSource.generatedTypeKind}");
3658
+ const configPath = join(import.meta.dirname, "${configImportPath}");
3659
+ const ${exportName} = await getGeneratedType(configPath, "${pluginSource.pluginId}", ${pluginSource.originalExportName}, "${pluginSource.generatedTypeKind}");
3700
3660
 
3701
3661
  ${schemaTypeCode}
3702
3662
 
@@ -3709,12 +3669,14 @@ function generateLinesDbSchemaFileWithPluginAPI(metadata, params) {
3709
3669
  `;
3710
3670
  if (!pluginSource.generatedTypeKind) throw new Error(`Namespace plugin "${pluginSource.pluginId}" must provide generatedTypeKind for type "${typeName}"`);
3711
3671
  return ml`
3672
+ import { join } from "node:path";
3712
3673
  import { t } from "@tailor-platform/sdk";
3674
+ import { getGeneratedType } from "@tailor-platform/sdk/plugin";
3713
3675
  import { createTailorDBHook, createStandardSchema } from "@tailor-platform/sdk/test";
3714
3676
  import { defineSchema } from "@toiroakr/lines-db";
3715
- import { getGeneratedType } from "${pluginImportPath}";
3716
3677
 
3717
- const ${exportName} = getGeneratedType(null, "${pluginSource.generatedTypeKind}");
3678
+ const configPath = join(import.meta.dirname, "${configImportPath}");
3679
+ const ${exportName} = await getGeneratedType(configPath, "${pluginSource.pluginId}", null, "${pluginSource.generatedTypeKind}");
3718
3680
 
3719
3681
  ${schemaTypeCode}
3720
3682
 
@@ -4371,7 +4333,6 @@ function createSeedGenerator(options) {
4371
4333
  processTailorDBNamespace: ({ types }) => types,
4372
4334
  aggregate: ({ input, configPath }) => {
4373
4335
  const files = [];
4374
- const pluginImportBaseDirs = getPluginImportBaseDirs(configPath);
4375
4336
  const namespaceConfigs = [];
4376
4337
  for (const nsResult of input.tailordb) {
4377
4338
  if (!nsResult.types) continue;
@@ -4394,14 +4355,8 @@ function createSeedGenerator(options) {
4394
4355
  const relativePath = path.relative(path.dirname(schemaOutputPath), linesDb.pluginSource.originalFilePath);
4395
4356
  originalImportPath = relativePath.replace(/\.ts$/, "").startsWith(".") ? relativePath.replace(/\.ts$/, "") : `./${relativePath.replace(/\.ts$/, "")}`;
4396
4357
  }
4397
- let pluginImportPath = linesDb.pluginSource.pluginImportPath;
4398
- if (pluginImportPath.startsWith("./") || pluginImportPath.startsWith("../")) {
4399
- const resolvedPluginPath = resolveRelativePluginImportPath(pluginImportPath, pluginImportBaseDirs) ?? path.resolve(pluginImportBaseDirs[0] ?? process.cwd(), pluginImportPath);
4400
- const relativePluginPath = path.relative(path.dirname(schemaOutputPath), resolvedPluginPath);
4401
- pluginImportPath = relativePluginPath.startsWith(".") ? relativePluginPath : `./${relativePluginPath}`;
4402
- }
4403
4358
  const schemaContent = generateLinesDbSchemaFileWithPluginAPI(linesDb, {
4404
- pluginImportPath,
4359
+ configImportPath: path.relative(path.dirname(schemaOutputPath), configPath),
4405
4360
  originalImportPath
4406
4361
  });
4407
4362
  files.push({
@@ -4519,6 +4474,32 @@ async function loadConfig(configPath) {
4519
4474
  };
4520
4475
  }
4521
4476
 
4477
+ //#endregion
4478
+ //#region src/cli/utils/plugin-import.ts
4479
+ /**
4480
+ * Collect base directories for resolving plugin import paths.
4481
+ * @param configPath - Path to tailor.config.ts
4482
+ * @returns Ordered list of base directories
4483
+ */
4484
+ function getPluginImportBaseDirs(configPath) {
4485
+ if (configPath) return [path.dirname(configPath)];
4486
+ return [process.cwd()];
4487
+ }
4488
+ /**
4489
+ * Resolve a relative plugin import path against candidate base directories.
4490
+ * @param pluginImportPath - Relative plugin import path
4491
+ * @param baseDirs - Candidate base directories
4492
+ * @returns Absolute path if found, otherwise null
4493
+ */
4494
+ function resolveRelativePluginImportPath(pluginImportPath, baseDirs) {
4495
+ if (!pluginImportPath.startsWith(".")) return null;
4496
+ for (const baseDir of baseDirs) {
4497
+ const absolutePath = path.resolve(baseDir, pluginImportPath);
4498
+ if (fs$2.existsSync(absolutePath)) return absolutePath;
4499
+ }
4500
+ return null;
4501
+ }
4502
+
4522
4503
  //#endregion
4523
4504
  //#region src/parser/plugin-config/types.ts
4524
4505
  /**
@@ -5305,29 +5286,29 @@ var PluginManager = class {
5305
5286
  error: `Plugin "${context.pluginId}" not found`
5306
5287
  };
5307
5288
  const typeConfigRequired = plugin.typeConfigRequired;
5308
- if ((typeof typeConfigRequired === "function" ? typeConfigRequired(plugin.pluginConfig) : typeConfigRequired === true) && (context.config === void 0 || context.config === null)) return {
5289
+ if ((typeof typeConfigRequired === "function" ? typeConfigRequired(plugin.pluginConfig) : typeConfigRequired === true) && (context.typeConfig === void 0 || context.typeConfig === null)) return {
5309
5290
  success: false,
5310
- error: `Plugin "${plugin.id}" requires config, but none was provided for type "${context.type.name}".`
5291
+ error: `Plugin "${plugin.id}" requires typeConfig, but none was provided for type "${context.type.name}".`
5311
5292
  };
5312
5293
  if (plugin.configSchema) {
5313
- const validationErrors = validatePluginConfig(context.config, plugin.configSchema);
5294
+ const validationErrors = validatePluginConfig(context.typeConfig, plugin.configSchema);
5314
5295
  if (validationErrors.length > 0) {
5315
5296
  const errorDetails = validationErrors.map((e) => e.field ? `${e.field}: ${e.message}` : e.message).join("; ");
5316
5297
  return {
5317
5298
  success: false,
5318
- error: `Invalid config for plugin "${plugin.id}" on type "${context.type.name}": ${errorDetails}`
5299
+ error: `Invalid typeConfig for plugin "${plugin.id}" on type "${context.type.name}": ${errorDetails}`
5319
5300
  };
5320
5301
  }
5321
5302
  }
5322
- if (!plugin.process) return {
5303
+ if (!plugin.processType) return {
5323
5304
  success: false,
5324
- error: `Plugin "${plugin.id}" does not support type-attached processing (missing process method). Use processNamespace via definePlugins() instead.`
5305
+ error: `Plugin "${plugin.id}" does not support type-attached processing (missing processType method). Use processNamespace via definePlugins() instead.`
5325
5306
  };
5326
5307
  let output;
5327
5308
  try {
5328
- output = await plugin.process({
5309
+ output = await plugin.processType({
5329
5310
  type: context.type,
5330
- config: context.config,
5311
+ typeConfig: context.typeConfig,
5331
5312
  pluginConfig: plugin.pluginConfig,
5332
5313
  namespace: context.namespace
5333
5314
  });
@@ -5345,7 +5326,9 @@ var PluginManager = class {
5345
5326
  pluginImportPath: importPath,
5346
5327
  sourceTypeName: context.type.name,
5347
5328
  kind,
5348
- type
5329
+ type,
5330
+ namespace: context.namespace,
5331
+ pluginConfig: plugin.pluginConfig
5349
5332
  });
5350
5333
  }
5351
5334
  if (output.executors && output.executors.length > 0) for (const executor of output.executors) this.generatedExecutors.push({
@@ -5363,11 +5346,9 @@ var PluginManager = class {
5363
5346
  * Process namespace plugins that don't require a source type.
5364
5347
  * This method is called once per namespace for plugins with processNamespace method.
5365
5348
  * @param namespace - The target namespace for generated types
5366
- * @param types - TailorDB types in the namespace (after type-attached processing)
5367
- * @param generatedTypes - Plugin-generated types in the namespace
5368
5349
  * @returns Array of results with plugin outputs and configs
5369
5350
  */
5370
- async processNamespacePlugins(namespace, types, generatedTypes) {
5351
+ async processNamespacePlugins(namespace) {
5371
5352
  const results = [];
5372
5353
  for (const [pluginId, plugin] of this.plugins) {
5373
5354
  if (!plugin.processNamespace) continue;
@@ -5389,9 +5370,7 @@ var PluginManager = class {
5389
5370
  }
5390
5371
  const context = {
5391
5372
  pluginConfig: config,
5392
- namespace,
5393
- types,
5394
- generatedTypes
5373
+ namespace
5395
5374
  };
5396
5375
  let output;
5397
5376
  try {
@@ -5429,7 +5408,9 @@ var PluginManager = class {
5429
5408
  pluginImportPath: importPath,
5430
5409
  sourceTypeName: "(namespace)",
5431
5410
  kind,
5432
- type
5411
+ type,
5412
+ namespace,
5413
+ pluginConfig: plugin.pluginConfig
5433
5414
  });
5434
5415
  }
5435
5416
  }
@@ -5459,6 +5440,14 @@ var PluginManager = class {
5459
5440
  return this.plugins.size;
5460
5441
  }
5461
5442
  /**
5443
+ * Get a plugin by its ID
5444
+ * @param pluginId - The plugin ID to look up
5445
+ * @returns The plugin instance, or undefined if not found
5446
+ */
5447
+ getPlugin(pluginId) {
5448
+ return this.plugins.get(pluginId);
5449
+ }
5450
+ /**
5462
5451
  * Get the import path for a plugin
5463
5452
  * @param pluginId - The plugin ID to look up
5464
5453
  * @returns The plugin's import path, or undefined if not found
@@ -14216,7 +14205,7 @@ async function generate(options) {
14216
14205
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
14217
14206
  let pluginManager;
14218
14207
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
14219
- const { defineApplication: defineApplication$1 } = await import("./application-DM4zTgXU.mjs");
14208
+ const { defineApplication: defineApplication$1 } = await import("./application-BznueWxG.mjs");
14220
14209
  const application = defineApplication$1({
14221
14210
  config,
14222
14211
  pluginManager
@@ -15427,4 +15416,4 @@ const updateCommand = defineCommand({
15427
15416
 
15428
15417
  //#endregion
15429
15418
  export { jobsCommand as $, initOperatorClient as $t, generateCommand as A, getMigrationFiles as At, getMachineUserToken as B, generateUserTypes as Bt, resumeCommand as C, compareLocalTypesWithSnapshot as Ct, truncate as D, getLatestMigrationNumber as Dt, listWorkflows as E, formatMigrationNumber as Et, removeCommand$1 as F, formatDiffSummary as Ft, generateCommand$1 as G, fetchLatestToken as Gt, listCommand$5 as H, getDistDir as Ht, listCommand$4 as I, formatMigrationDiff as It, triggerCommand as J, readPlatformConfig as Jt, listWebhookExecutors as K, loadAccessToken as Kt, listOAuth2Clients as L, hasChanges as Lt, show as M, isValidMigrationNumber as Mt, showCommand as N, loadDiff as Nt, truncateCommand as O, getMigrationDirPath as Ot, remove as P, reconstructSnapshotFromMigrations as Pt, getExecutorJob as Q, initOAuth2Client as Qt, getCommand$1 as R, getNamespacesWithMigrations as Rt, healthCommand as S, SCHEMA_FILE_NAME as St, listCommand$3 as T, createSnapshotFromLocalTypes as Tt, listMachineUsers as U, apiCall as Ut, tokenCommand as V, loadConfig as Vt, generate$1 as W, apiCommand as Wt, listCommand$6 as X, fetchAll as Xt, triggerExecutor as Y, writePlatformConfig as Yt, listExecutors as Z, fetchUserInfo as Zt, createCommand as _, bundleMigrationScript as _t, listCommand as a, jsonArgs as an, getWorkflow as at, listCommand$2 as b, INITIAL_SCHEMA_NUMBER as bt, inviteUser as c, listWorkflowExecutions as ct, listCommand$1 as d, apply as dt, readPackageJson as en, listExecutorJobs as et, listWorkspaces as f, applyCommand as ft, deleteWorkspace as g, parseMigrationLabelNumber as gt, deleteCommand as h, MIGRATION_LABEL_KEY as ht, removeUser as i, deploymentArgs as in, getCommand$2 as it, logBetaWarning as j, getNextMigrationNumber as jt, generate as k, getMigrationFilePath as kt, restoreCommand as l, getCommand$3 as lt, getWorkspace as m, waitForExecution$1 as mt, updateUser as n, commonArgs as nn, startCommand as nt, listUsers as o, withCommonArgs as on, executionsCommand as ot, getCommand as p, executeScript as pt, webhookCommand as q, loadWorkspaceId as qt, removeCommand as r, confirmationArgs as rn, startWorkflow as rt, inviteCommand as s, workspaceArgs as sn, getWorkflowExecution as st, updateCommand as t, PATScope as tn, watchExecutorJob as tt, restoreWorkspace as u, getExecutor as ut, createWorkspace as v, DB_TYPES_FILE_NAME as vt, resumeWorkflow as w, compareSnapshots as wt, getAppHealth as x, MIGRATE_FILE_NAME as xt, listApps as y, DIFF_FILE_NAME as yt, getOAuth2Client as z, trnPrefix as zt };
15430
- //# sourceMappingURL=update-2eb6jz9o.mjs.map
15419
+ //# sourceMappingURL=update-Dm8ERWHJ.mjs.map