@tailor-platform/sdk 1.11.0 → 1.12.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 (45) hide show
  1. package/CHANGELOG.md +34 -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 -757
  12. package/dist/configure/index.mjs.map +1 -1
  13. package/dist/env-4RO7szrH.d.mts +66 -0
  14. package/dist/{index-D8zIUsWi.d.mts → index-BBr_q3vB.d.mts} +20 -11
  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-B_W-UQnS.mjs} +1626 -390
  33. package/dist/update-B_W-UQnS.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 +2 -2
  38. package/docs/plugin/custom.md +389 -0
  39. package/docs/plugin/index.md +112 -0
  40. package/docs/services/workflow.md +28 -0
  41. package/package.json +16 -23
  42. package/dist/application-BKBo5tGD.mjs.map +0 -1
  43. package/dist/application-a12-7TT3.mjs +0 -4
  44. package/dist/update-D0muqqOP.mjs.map +0 -1
  45. /package/dist/{chunk-CIV_ash9.mjs → chunk-C3Kl5s5P.mjs} +0 -0
@@ -1,4 +1,5 @@
1
1
  /// <reference path="./user-defined.d.ts" />
2
+ import { o as InferredAttributeMap, s as TailorUser } from "./env-4RO7szrH.mjs";
2
3
  import { z } from "zod";
3
4
  import { IsAny, NonEmptyObject } from "type-fest";
4
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
@@ -79,69 +80,6 @@ type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ?
79
80
  value: infer K;
80
81
  } ? K : never : never;
81
82
  //#endregion
82
- //#region src/configure/types/user.d.ts
83
- interface AttributeMap {}
84
- interface AttributeList {
85
- __tuple?: [];
86
- }
87
- type InferredAttributeMap = keyof AttributeMap extends never ? Record<string, string | string[] | boolean | boolean[] | undefined> : AttributeMap;
88
- type InferredAttributeList = AttributeList["__tuple"] extends [] ? string[] : AttributeList["__tuple"];
89
- /** Represents a user in the Tailor platform. */
90
- type TailorUser = {
91
- /**
92
- * The ID of the user.
93
- * For unauthenticated users, this will be a nil UUID.
94
- */
95
- id: string;
96
- /**
97
- * The type of the user.
98
- * For unauthenticated users, this will be an empty string.
99
- */
100
- type: "user" | "machine_user" | "";
101
- /** The ID of the workspace the user belongs to. */
102
- workspaceId: string;
103
- /**
104
- * A map of the user's attributes.
105
- * For unauthenticated users, this will be null.
106
- */
107
- attributes: InferredAttributeMap | null;
108
- /**
109
- * A list of the user's attributes.
110
- * For unauthenticated users, this will be an empty array.
111
- */
112
- attributeList: InferredAttributeList;
113
- };
114
- /** Represents an unauthenticated user in the Tailor platform. */
115
- declare const unauthenticatedTailorUser: TailorUser;
116
- //#endregion
117
- //#region src/configure/types/actor.d.ts
118
- /** User type enum values from the Tailor Platform server. */
119
- type TailorActorType = "USER_TYPE_USER" | "USER_TYPE_MACHINE_USER" | "USER_TYPE_UNSPECIFIED";
120
- /** Represents an actor in event triggers. */
121
- type TailorActor = {
122
- /** The ID of the workspace the user belongs to. */
123
- workspaceId: string;
124
- /** The ID of the user. */
125
- userId: string;
126
- /**
127
- * A map of the user's attributes.
128
- * Maps from server's `attributeMap` field.
129
- */
130
- attributes: InferredAttributeMap | null;
131
- /**
132
- * A list of the user's attributes.
133
- * Maps from server's `attributes` field.
134
- */
135
- attributeList: InferredAttributeList;
136
- /** The type of the user. */
137
- userType: TailorActorType;
138
- };
139
- //#endregion
140
- //#region src/configure/types/env.d.ts
141
- interface Env {}
142
- /** Represents environment variables in the Tailor platform. */
143
- type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
144
- //#endregion
145
83
  //#region src/configure/types/helpers.d.ts
146
84
  type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
147
85
  type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
@@ -414,6 +352,11 @@ type TailorToTs = {
414
352
  interface FieldMetadata {
415
353
  description?: string;
416
354
  required?: boolean;
355
+ /**
356
+ * Marks a field as explicitly required.
357
+ * Used for plugin config schemas where fields are optional by default.
358
+ */
359
+ requiredExplicit?: boolean;
417
360
  array?: boolean;
418
361
  allowedValues?: AllowedValue[];
419
362
  validate?: FieldValidateInput<any>[];
@@ -428,6 +371,7 @@ interface DefinedFieldMetadata {
428
371
  }
429
372
  type FieldOptions = {
430
373
  optional?: boolean;
374
+ required?: boolean;
431
375
  array?: boolean;
432
376
  };
433
377
  type FieldOutput$1<T, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T, O>, O>;
@@ -613,6 +557,404 @@ interface TypeFeatures {
613
557
  gqlOperations?: GqlOperationsConfig;
614
558
  }
615
559
  //#endregion
560
+ //#region src/parser/plugin-config/types.d.ts
561
+ type TypeConfigRequired<PluginConfig$1 = unknown> = boolean | ((pluginConfig: PluginConfig$1 | undefined) => boolean);
562
+ /**
563
+ * Interface for plugin configuration mapping.
564
+ * Extend this interface via declaration merging to add typed plugin configs.
565
+ *
566
+ * The `Fields` type parameter provides field names from the type being configured,
567
+ * enabling type-safe field references in plugin configs.
568
+ * @example
569
+ * ```typescript
570
+ * // In your plugin package or types file:
571
+ * declare module "@tailor-platform/sdk" {
572
+ * interface PluginConfigs<Fields extends string> {
573
+ * "@my-company/i18n": {
574
+ * labels: Partial<Record<Fields, { ja: string; en: string }>>;
575
+ * };
576
+ * }
577
+ * }
578
+ * ```
579
+ */
580
+ interface PluginConfigs<Fields extends string = string> {}
581
+ /**
582
+ * Plugin attachment stored on TailorAnyDBType instances.
583
+ * This is the configuration passed via `.plugin()` method.
584
+ */
585
+ interface PluginAttachment {
586
+ pluginId: string;
587
+ config: unknown;
588
+ }
589
+ /**
590
+ * Context passed to plugin's process method
591
+ */
592
+ interface PluginProcessContext<Config = unknown, PluginConfig$1 = unknown> {
593
+ /** The raw TailorDB type being processed */
594
+ type: TailorAnyDBType;
595
+ /** Plugin-specific configuration passed via .plugin() method */
596
+ config: Config;
597
+ /** Plugin-level configuration passed via definePlugins() */
598
+ pluginConfig: PluginConfig$1;
599
+ /** Namespace of the TailorDB type */
600
+ namespace: string;
601
+ }
602
+ /**
603
+ * Plugin-generated type entry passed to processNamespace.
604
+ */
605
+ interface PluginNamespaceGeneratedTypeEntry {
606
+ type: TailorAnyDBType;
607
+ /** Plugin ID that generated this type */
608
+ pluginId: string;
609
+ /** Generated type kind for getGeneratedType() API (e.g., "request", "step") */
610
+ generatedTypeKind?: string;
611
+ /** Source type that triggered generation */
612
+ originalType: TailorAnyDBType;
613
+ }
614
+ /**
615
+ * Context passed to plugin's processNamespace method.
616
+ * Used for plugins that operate on a namespace without requiring a source type.
617
+ */
618
+ interface PluginNamespaceProcessContext<Config = unknown> {
619
+ /** Plugin-level configuration passed via definePlugins() */
620
+ pluginConfig: Config;
621
+ /** Target namespace for generated types */
622
+ namespace: string;
623
+ /** TailorDB types in the namespace (after type-attached processing) */
624
+ types: TailorAnyDBType[];
625
+ /** Plugin-generated types for type-attached plugins in the namespace */
626
+ generatedTypes: PluginNamespaceGeneratedTypeEntry[];
627
+ }
628
+ /**
629
+ * Interface representing a TailorDB type for plugin output.
630
+ * This interface is satisfied by db.type() instances.
631
+ */
632
+ interface TailorDBTypeForPlugin {
633
+ /** The name of the type */
634
+ readonly name: string;
635
+ /** The field definitions */
636
+ readonly fields: Record<string, unknown>;
637
+ }
638
+ /**
639
+ * Type generated by a plugin - use db.type() to create these.
640
+ */
641
+ type PluginGeneratedType = TailorDBTypeForPlugin;
642
+ /**
643
+ * Map of generated types keyed by kind identifier.
644
+ * The kind is used to generate distinct TypeScript type files for each generated type.
645
+ * @example
646
+ * ```typescript
647
+ * {
648
+ * request: changeRequest,
649
+ * step: changeStep,
650
+ * approval: changeApproval,
651
+ * }
652
+ * ```
653
+ */
654
+ type PluginGeneratedTypes = Record<string, PluginGeneratedType>;
655
+ /**
656
+ * Resolver definition generated by a plugin.
657
+ * Fields can be TailorDB field instances or raw field definitions.
658
+ */
659
+ interface PluginGeneratedResolver {
660
+ name: string;
661
+ operation: "query" | "mutation";
662
+ inputFields?: Record<string, unknown>;
663
+ outputFields: Record<string, unknown>;
664
+ /** Function body code as string */
665
+ body: string;
666
+ }
667
+ /**
668
+ * Record trigger configuration for plugin-generated executors
669
+ */
670
+ interface PluginRecordTriggerConfig {
671
+ kind: "recordCreated" | "recordUpdated" | "recordDeleted";
672
+ /** TailorDB type name for record triggers */
673
+ typeName: string;
674
+ }
675
+ /**
676
+ * Schedule trigger configuration for plugin-generated executors
677
+ */
678
+ interface PluginScheduleTriggerConfig {
679
+ kind: "schedule";
680
+ /** Cron expression */
681
+ cron: string;
682
+ /** Timezone (defaults to UTC) */
683
+ timezone?: string;
684
+ }
685
+ /**
686
+ * Incoming webhook trigger configuration for plugin-generated executors
687
+ */
688
+ interface PluginIncomingWebhookTriggerConfig {
689
+ kind: "incomingWebhook";
690
+ }
691
+ /**
692
+ * Trigger configuration for plugin-generated executors
693
+ */
694
+ type PluginTriggerConfig = PluginRecordTriggerConfig | PluginScheduleTriggerConfig | PluginIncomingWebhookTriggerConfig;
695
+ /**
696
+ * Inject value types supported for plugin executor injection.
697
+ * These values are serialized as const declarations in the generated file.
698
+ */
699
+ type PluginInjectValue = string | number | boolean | null;
700
+ /**
701
+ * Inject map for plugin executor.
702
+ * Keys become const variable names in the generated file.
703
+ */
704
+ type PluginInjectMap = Record<string, PluginInjectValue>;
705
+ /**
706
+ * Function operation configuration for plugin-generated executors
707
+ */
708
+ interface PluginFunctionOperationConfig {
709
+ kind: "function";
710
+ /** Function body code as string */
711
+ body: string;
712
+ /**
713
+ * Variables to inject into the generated file scope.
714
+ * These become const declarations at the top of the generated file,
715
+ * allowing the function body to reference them.
716
+ * @example { namespace: "tailordb", historyTypeName: "CustomerHistory" }
717
+ */
718
+ inject?: PluginInjectMap;
719
+ }
720
+ /**
721
+ * GraphQL operation configuration for plugin-generated executors
722
+ */
723
+ interface PluginGraphQLOperationConfig {
724
+ kind: "graphql";
725
+ /** GraphQL query string */
726
+ query: string;
727
+ /** App name for the GraphQL endpoint */
728
+ appName?: string;
729
+ /**
730
+ * Variables expression as a string function.
731
+ * Receives the executor args object and returns the variables object.
732
+ * @example "(args) => ({ input: { recordId: args.newRecord.id } })"
733
+ */
734
+ variables?: string;
735
+ }
736
+ /**
737
+ * Webhook operation configuration for plugin-generated executors
738
+ */
739
+ interface PluginWebhookOperationConfig {
740
+ kind: "webhook";
741
+ /** Webhook URL */
742
+ url: string;
743
+ }
744
+ /**
745
+ * Workflow operation configuration for plugin-generated executors
746
+ */
747
+ interface PluginWorkflowOperationConfig {
748
+ kind: "workflow";
749
+ /** Workflow name */
750
+ workflowName: string;
751
+ }
752
+ /**
753
+ * Operation configuration for plugin-generated executors
754
+ */
755
+ type PluginOperationConfig = PluginFunctionOperationConfig | PluginGraphQLOperationConfig | PluginWebhookOperationConfig | PluginWorkflowOperationConfig;
756
+ /**
757
+ * Context value types for plugin executor context.
758
+ * Supports primitive values and type references.
759
+ */
760
+ type PluginExecutorContextValue = TailorAnyDBType | string | number | boolean | null | undefined;
761
+ /**
762
+ * Base executor context that can include type references and other values.
763
+ * Type objects (TailorAnyDBType) will be handled specially by the generator
764
+ * to create appropriate import statements.
765
+ *
766
+ * Plugin authors should extend this interface for their specific context needs.
767
+ */
768
+ interface PluginExecutorContextBase {
769
+ /** Source type that the plugin is attached to. Null for namespace executors. */
770
+ sourceType: TailorAnyDBType | null;
771
+ /** TailorDB namespace for data operations */
772
+ namespace: string;
773
+ }
774
+ /**
775
+ * Flexible executor context type that allows additional properties.
776
+ * Used as the context type in PluginGeneratedExecutorWithFile.
777
+ */
778
+ type PluginExecutorContext = PluginExecutorContextBase & {
779
+ [key: string]: PluginExecutorContextValue;
780
+ };
781
+ /**
782
+ * Module shape returned by plugin executor resolve().
783
+ * The concrete context type is intentionally erased at this boundary.
784
+ */
785
+ interface PluginExecutorModule {
786
+ default: unknown;
787
+ }
788
+ /**
789
+ * Executor definition with dynamic import reference (new format).
790
+ * Used with withPluginContext for type-safe executor definitions in separate files.
791
+ */
792
+ interface PluginGeneratedExecutorWithFile<Ctx = PluginExecutorContext> {
793
+ /** Executor name (used for generated file name) */
794
+ name: string;
795
+ /**
796
+ * Resolver function for the executor module.
797
+ * Should return a dynamic import to the executor file.
798
+ * Relative import specifiers are resolved from the plugin's importPath base.
799
+ * @example `async () => await import("./executors/on-create")`
800
+ */
801
+ resolve: () => Promise<PluginExecutorModule>;
802
+ /**
803
+ * Context to pass to the executor factory.
804
+ * Can include TailorAnyDBType objects - these will be handled specially
805
+ * by the generator to create appropriate import statements.
806
+ */
807
+ context: Ctx;
808
+ }
809
+ /**
810
+ * Executor definition generated by a plugin (legacy format).
811
+ * @deprecated Use PluginGeneratedExecutorWithFile with withPluginContext instead.
812
+ */
813
+ interface PluginGeneratedExecutorLegacy {
814
+ name: string;
815
+ description?: string;
816
+ trigger: PluginTriggerConfig;
817
+ operation: PluginOperationConfig;
818
+ }
819
+ /**
820
+ * Executor definition generated by a plugin.
821
+ * Supports both legacy format (inline trigger/operation) and new format (executorFile/context).
822
+ */
823
+ type PluginGeneratedExecutor = PluginGeneratedExecutorWithFile | PluginGeneratedExecutorLegacy;
824
+ /**
825
+ * Extension options for modifying the source type
826
+ */
827
+ interface PluginExtends {
828
+ /**
829
+ * Fields to add to the source type.
830
+ * These fields will be merged into the original type's fields.
831
+ * Existing fields (from original definition or earlier plugins) take precedence.
832
+ */
833
+ fields?: Record<string, unknown>;
834
+ }
835
+ /**
836
+ * Output returned by a plugin's process method
837
+ */
838
+ interface PluginOutput {
839
+ /**
840
+ * Additional TailorDB types to generate, keyed by kind identifier.
841
+ * The kind is used to generate distinct TypeScript type files.
842
+ * @example { request: changeRequest, step: changeStep }
843
+ */
844
+ types?: PluginGeneratedTypes;
845
+ /** Additional resolvers to generate */
846
+ resolvers?: PluginGeneratedResolver[];
847
+ /** Additional executors to generate */
848
+ executors?: PluginGeneratedExecutor[];
849
+ /** Extensions to apply to the source type */
850
+ extends?: PluginExtends;
851
+ }
852
+ /**
853
+ * Output returned by a plugin's processNamespace method.
854
+ * Namespace plugins cannot extend a source type.
855
+ */
856
+ type NamespacePluginOutput = Omit<PluginOutput, "extends"> & {
857
+ extends?: never;
858
+ };
859
+ /**
860
+ * Base plugin interface that all plugins must implement
861
+ */
862
+ interface PluginBaseCommon<PluginConfig$1 = unknown> {
863
+ /** Unique identifier for the plugin */
864
+ readonly id: string;
865
+ /** Human-readable description of the plugin */
866
+ readonly description: string;
867
+ /**
868
+ * Import path for this plugin's public API.
869
+ * Used by code generators to create correct import statements
870
+ * (e.g., plugin executors and seed schema generation).
871
+ */
872
+ readonly importPath: string;
873
+ /**
874
+ * Schema defining the expected plugin-level configuration.
875
+ * Used to validate config passed via `definePlugins([plugin, config])`.
876
+ * If not provided, pluginConfig validation is skipped.
877
+ * @example
878
+ * ```typescript
879
+ * pluginConfigSchema: t.object({
880
+ * archiveTablePrefix: t.string({ optional: true }),
881
+ * defaultRetentionDays: t.int({ optional: true }),
882
+ * })
883
+ * ```
884
+ */
885
+ readonly pluginConfigSchema?: TailorAnyField;
886
+ /**
887
+ * Controls whether per-type plugin config is required when attaching via .plugin().
888
+ * If a function is provided, it receives pluginConfig from definePlugins().
889
+ * Default is optional when not provided.
890
+ */
891
+ readonly typeConfigRequired?: TypeConfigRequired<PluginConfig$1>;
892
+ /**
893
+ * Plugin-level configuration passed via definePlugins().
894
+ * This config is stored when the plugin is registered and made available
895
+ * to both process() and processNamespace() methods.
896
+ */
897
+ readonly pluginConfig?: PluginConfig$1;
898
+ /**
899
+ * TypeScript type template for generating type-safe plugin configuration.
900
+ * Use `Fields` to reference the field names of the type being configured.
901
+ * If not provided, the type is generated from configSchema.
902
+ * @example
903
+ * ```typescript
904
+ * // For field-aware configs:
905
+ * configTypeTemplate: "{ labels: Partial<Record<Fields, FieldLabel>>; typeLabel?: FieldLabel }"
906
+ * ```
907
+ */
908
+ readonly configTypeTemplate?: string;
909
+ /**
910
+ * Process a single TailorDB type and generate outputs.
911
+ * This method is called for each type that has this plugin attached via .plugin().
912
+ * @param context - Context containing the type, config, pluginConfig, and namespace
913
+ * @returns Plugin output with generated types, resolvers, and executors
914
+ */
915
+ process?(context: PluginProcessContext): PluginOutput | Promise<PluginOutput>;
916
+ /**
917
+ * Process plugin for a namespace without requiring a source type.
918
+ * This method is called once per namespace for plugins configured via definePlugins().
919
+ * Use this for plugins that generate types independently of user-defined types.
920
+ * @param context - Context containing the plugin config, namespace, and types
921
+ * @returns Plugin output with generated types, resolvers, and executors
922
+ */
923
+ processNamespace?(context: PluginNamespaceProcessContext): NamespacePluginOutput | Promise<NamespacePluginOutput>;
924
+ }
925
+ interface PluginBaseWithConfig<PluginConfig$1 = unknown> extends PluginBaseCommon<PluginConfig$1> {
926
+ /**
927
+ * Schema defining the expected per-type configuration for this plugin.
928
+ * Used to validate config passed via `.plugin({ pluginId: config })`.
929
+ * Uses the same field types as createResolver's input (t.string(), t.number(), etc.).
930
+ * @example
931
+ * ```typescript
932
+ * configSchema: t.object({
933
+ * archiveReason: t.bool({ optional: true }),
934
+ * })
935
+ * ```
936
+ */
937
+ readonly configSchema: TailorAnyField;
938
+ }
939
+ interface PluginBaseNamespace<PluginConfig$1 = unknown> extends PluginBaseCommon<PluginConfig$1> {
940
+ /** Namespace-only plugins do not accept per-type config. */
941
+ readonly configSchema?: undefined;
942
+ /** Namespace-only plugins cannot define process(). */
943
+ process?: never;
944
+ }
945
+ /**
946
+ * Base plugin interface that all plugins must implement
947
+ */
948
+ type PluginBase<PluginConfig$1 = unknown> = PluginBaseWithConfig<PluginConfig$1> | PluginBaseNamespace<PluginConfig$1>;
949
+ /**
950
+ * Plugin configuration input type for definePlugins()
951
+ * Can be:
952
+ * - A PluginBase object for custom plugins without configuration
953
+ * - A tuple [PluginBase, options] for custom plugins with configuration
954
+ * Options can be any value - the plugin's pluginConfigSchema handles validation.
955
+ */
956
+ type PluginConfig = PluginBase | readonly [PluginBase, unknown];
957
+ //#endregion
616
958
  //#region src/configure/services/tailordb/schema.d.ts
617
959
  interface RelationConfig<S extends RelationType, T extends TailorDBType$1> {
618
960
  type: S;
@@ -875,6 +1217,16 @@ interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any,
875
1217
  * Omit specific fields from the type
876
1218
  */
877
1219
  omitFields<K$1 extends keyof Fields>(keys: K$1[]): Omit<Fields, K$1>;
1220
+ /**
1221
+ * Plugin attachments for this type
1222
+ */
1223
+ readonly plugins: PluginAttachment[];
1224
+ /**
1225
+ * Attach a plugin to this type
1226
+ * @param config - Plugin configuration in the format { pluginId: config }
1227
+ * @returns The type with the plugin attached
1228
+ */
1229
+ plugin<P$1 extends keyof PluginConfigs<keyof Fields & string>>(config: { [K in P$1]: PluginConfigs<keyof Fields & string>[K$1] }): TailorDBType$1<Fields, User>;
878
1230
  }
879
1231
  type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType$1<Fields, User>;
880
1232
  declare const idField: TailorDBField<{
@@ -1156,9 +1508,9 @@ type UserAttributeListKey<User extends TailorDBInstance> = { [K in UserFieldKeys
1156
1508
  type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
1157
1509
  type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
1158
1510
  type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
1159
- type AttributeListToTuple<User extends TailorDBInstance, AttributeList$1 extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList$1]: AttributeList$1[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList$1[Index]> : never };
1160
- type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K] ? never : K }[keyof AttributeMap$1], UserAttributeKey<User>>;
1161
- type UserProfile<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[]> = {
1511
+ type AttributeListToTuple<User extends TailorDBInstance, AttributeList extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList]: AttributeList[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList[Index]> : never };
1512
+ type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap]-?: undefined extends AttributeMap[K] ? never : K }[keyof AttributeMap], UserAttributeKey<User>>;
1513
+ type UserProfile<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[]> = {
1162
1514
  /**
1163
1515
  * TailorDB namespace where the user type is defined.
1164
1516
  *
@@ -1168,8 +1520,8 @@ type UserProfile<User extends TailorDBInstance, AttributeMap$1 extends UserAttri
1168
1520
  namespace?: string;
1169
1521
  type: User;
1170
1522
  usernameField: UsernameFieldKey<User>;
1171
- attributes?: DisallowExtraKeys<AttributeMap$1, UserAttributeKey<User>>;
1172
- attributeList?: AttributeList$1;
1523
+ attributes?: DisallowExtraKeys<AttributeMap, UserAttributeKey<User>>;
1524
+ attributeList?: AttributeList;
1173
1525
  };
1174
1526
  type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
1175
1527
  type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
@@ -1181,33 +1533,33 @@ type MachineUserFromAttributes<Fields extends MachineUserAttributeFields> = (key
1181
1533
  }) & {
1182
1534
  attributeList?: string[];
1183
1535
  };
1184
- type MachineUser<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
1536
+ type MachineUser<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
1185
1537
  attributes: Record<string, AuthAttributeValue>;
1186
1538
  attributeList?: string[];
1187
- } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
1539
+ } : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
1188
1540
  attributes?: never;
1189
1541
  } : {
1190
- attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap$1>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap$1>>]?: never };
1191
- }) & ([] extends AttributeList$1 ? {
1542
+ attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
1543
+ }) & ([] extends AttributeList ? {
1192
1544
  attributeList?: never;
1193
1545
  } : {
1194
- attributeList: AttributeListToTuple<User, AttributeList$1>;
1546
+ attributeList: AttributeListToTuple<User, AttributeList>;
1195
1547
  }) : [MachineUserAttributes] extends [MachineUserAttributeFields] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
1196
1548
  attributes: Record<string, AuthAttributeValue>;
1197
1549
  attributeList?: string[];
1198
- } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
1550
+ } : (AttributeMapSelectedKeys<User, AttributeMap> extends never ? {
1199
1551
  attributes?: never;
1200
1552
  } : {
1201
- attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap$1>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap$1>>]?: never };
1202
- }) & ([] extends AttributeList$1 ? {
1553
+ attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap>>]?: never };
1554
+ }) & ([] extends AttributeList ? {
1203
1555
  attributeList?: never;
1204
1556
  } : {
1205
- attributeList: AttributeListToTuple<User, AttributeList$1>;
1557
+ attributeList: AttributeListToTuple<User, AttributeList>;
1206
1558
  });
1207
- type AuthServiceInput<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined> = {
1208
- userProfile?: UserProfile<User, AttributeMap$1, AttributeList$1>;
1559
+ type AuthServiceInput<User extends TailorDBInstance, AttributeMap extends UserAttributeMap<User>, AttributeList extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined> = {
1560
+ userProfile?: UserProfile<User, AttributeMap, AttributeList>;
1209
1561
  machineUserAttributes?: MachineUserAttributes;
1210
- machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap$1, AttributeList$1, MachineUserAttributes>>;
1562
+ machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap, AttributeList, MachineUserAttributes>>;
1211
1563
  oauth2Clients?: Record<string, OAuth2ClientInput>;
1212
1564
  idProvider?: IdProviderConfig;
1213
1565
  scim?: SCIMConfig;
@@ -1231,6 +1583,43 @@ type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
1231
1583
  type AuthConfig = AuthOwnConfig | AuthExternalConfig;
1232
1584
  //#endregion
1233
1585
  //#region src/parser/service/tailordb/types.d.ts
1586
+ /**
1587
+ * Source information for a user-defined TailorDB type.
1588
+ */
1589
+ interface UserDefinedTypeSource {
1590
+ /** File path to import from */
1591
+ filePath: string;
1592
+ /** Export name in the source file */
1593
+ exportName: string;
1594
+ /** Not present for user-defined types */
1595
+ pluginId?: never;
1596
+ }
1597
+ /**
1598
+ * Source information for a plugin-generated TailorDB type.
1599
+ */
1600
+ interface PluginGeneratedTypeSource {
1601
+ /** Not present for plugin-generated types */
1602
+ filePath?: never;
1603
+ /** Export name of the generated type */
1604
+ exportName: string;
1605
+ /** Plugin ID that generated this type */
1606
+ pluginId: string;
1607
+ /** Plugin import path for code generators */
1608
+ pluginImportPath: string;
1609
+ /** Original type's file path */
1610
+ originalFilePath: string;
1611
+ /** Original type's export name */
1612
+ originalExportName: string;
1613
+ /** Generated type kind for getGeneratedType() API (e.g., "request", "step") */
1614
+ generatedTypeKind?: string;
1615
+ /** Plugin config used to generate this type */
1616
+ pluginConfig?: unknown;
1617
+ }
1618
+ /**
1619
+ * Source information for a TailorDB type.
1620
+ * Discriminated union: use `pluginId` to distinguish between user-defined and plugin-generated types.
1621
+ */
1622
+ type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;
1234
1623
  /**
1235
1624
  * Parsed and normalized settings for TailorDB type.
1236
1625
  * gqlOperations is normalized from alias to object format.
@@ -1654,9 +2043,9 @@ type IdPOwnConfig = Omit<DefinedIdp<string, IdPInput, string>, "provider">;
1654
2043
  type IdPConfig = IdPOwnConfig | IdPExternalConfig;
1655
2044
  //#endregion
1656
2045
  //#region src/parser/app-config/types.d.ts
1657
- interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env$1 extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
2046
+ interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
1658
2047
  name: string;
1659
- env?: Env$1;
2048
+ env?: Env;
1660
2049
  cors?: string[];
1661
2050
  allowedIpAddresses?: string[];
1662
2051
  disableIntrospection?: boolean;
@@ -1772,5 +2161,5 @@ declare function createGeneratorConfigSchema(builtinGenerators: Map<string, (opt
1772
2161
  type GeneratorConfigSchemaType = ReturnType<typeof createGeneratorConfigSchema>;
1773
2162
  type Generator = z.output<GeneratorConfigSchemaType>;
1774
2163
  //#endregion
1775
- export { TailorDBInstance as $, AuthOwnConfig as A, unauthenticatedTailorUser as At, SCIMAttribute as B, ScheduleTriggerInput as C, output as Ct, AuthConfig as D, AttributeList as Dt, TailorDBType as E, TailorActor as Et, IdProviderConfig as F, SCIMResource as G, SCIMAttributeType as H, OAuth2ClientGrantType as I, UserAttributeListKey as J, TenantProviderConfig as K, OAuth2ClientInput as L, BuiltinIdP as M, AllowedValuesOutput as Mt, DefinedAuth as N, AuthExternalConfig as O, AttributeMap as Ot, IDToken as P, TailorDBField as Q, OIDC as R, ResolverExecutedTrigger as S, JsonCompatible as St, WorkflowOperation as T, TailorEnv as Tt, SCIMAuthorization as U, SCIMAttributeMapping as V, SCIMConfig as W, UsernameFieldKey as X, UserAttributeMap as Y, ValueOperand as Z, FunctionOperation as _, ResolverExternalConfig as _t, IdPExternalConfig as a, unsafeAllowAllGqlPermission as at, IncomingWebhookTrigger as b, ResolverServiceInput as bt, WorkflowServiceConfig as c, DefinedFieldMetadata as ct, defineStaticWebSite as d, FieldOutput$1 as dt, TailorDBType$1 as et, AuthAccessTokenTrigger as f, TailorFieldType as ft, ExecutorServiceInput as g, Resolver as gt, ExecutorServiceConfig as h, QueryType as ht, IdPConfig as i, TailorTypePermission as it, AuthServiceInput as j, AllowedValues as jt, AuthInvoker as k, TailorUser as kt, WorkflowServiceInput as l, FieldMetadata as lt, ExecutorInput as m, TailorField as mt, GeneratorConfig as n, PermissionCondition as nt, IdPInput as o, unsafeAllowAllTypePermission as ot, Executor as p, TailorAnyField as pt, UserAttributeKey as q, AppConfig as r, TailorTypeGqlPermission as rt, IdpDefinitionBrand as s, ArrayFieldOutput as st, Generator as t, db as tt, StaticWebsiteConfig as u, FieldOptions as ut, GqlOperation as v, ResolverInput as vt, WebhookOperation as w, Env as wt, RecordTrigger as x, InferFieldsOutput as xt, IdpUserTrigger as y, ResolverServiceConfig as yt, SAML as z };
1776
- //# sourceMappingURL=index-DcOTucF6.d.mts.map
2164
+ export { TailorAnyDBField as $, AuthInvoker as A, FieldMetadata as At, SAML as B, ResolverServiceConfig as Bt, ScheduleTriggerInput as C, PermissionCondition as Ct, TypeSourceInfoEntry as D, unsafeAllowAllTypePermission as Dt, TailorDBType as E, unsafeAllowAllGqlPermission as Et, IDToken as F, TailorField as Ft, SCIMConfig as G, AllowedValues as Gt, SCIMAttributeMapping as H, InferFieldsOutput as Ht, IdProviderConfig as I, QueryType as It, UserAttributeKey as J, SCIMResource as K, AllowedValuesOutput as Kt, OAuth2ClientGrantType as L, Resolver as Lt, AuthServiceInput as M, FieldOutput$1 as Mt, BuiltinIdP as N, TailorFieldType as Nt, AuthConfig as O, ArrayFieldOutput as Ot, DefinedAuth as P, TailorAnyField as Pt, ValueOperand as Q, OAuth2ClientInput as R, ResolverExternalConfig as Rt, ResolverExecutedTrigger as S, TailorDBTypeForPlugin as St, WorkflowOperation as T, TailorTypePermission as Tt, SCIMAttributeType as U, JsonCompatible as Ut, SCIMAttribute as V, ResolverServiceInput as Vt, SCIMAuthorization as W, output as Wt, UserAttributeMap as X, UserAttributeListKey as Y, UsernameFieldKey as Z, FunctionOperation as _, PluginGeneratedType as _t, IdPExternalConfig as a, NamespacePluginOutput as at, IncomingWebhookTrigger as b, PluginOutput as bt, WorkflowServiceConfig as c, PluginBaseNamespace as ct, defineStaticWebSite as d, PluginConfigs as dt, TailorAnyDBType as et, AuthAccessTokenTrigger as f, PluginExecutorContext as ft, ExecutorServiceInput as g, PluginGeneratedResolver as gt, ExecutorServiceConfig as h, PluginGeneratedExecutorWithFile as ht, IdPConfig as i, db as it, AuthOwnConfig as j, FieldOptions as jt, AuthExternalConfig as k, DefinedFieldMetadata as kt, WorkflowServiceInput as l, PluginBaseWithConfig as lt, ExecutorInput as m, PluginGeneratedExecutor as mt, GeneratorConfig as n, TailorDBInstance as nt, IdPInput as o, PluginAttachment as ot, Executor as p, PluginExecutorContextBase as pt, TenantProviderConfig as q, AppConfig as r, TailorDBType$1 as rt, IdpDefinitionBrand as s, PluginBase as st, Generator as t, TailorDBField as tt, StaticWebsiteConfig as u, PluginConfig as ut, GqlOperation as v, PluginNamespaceGeneratedTypeEntry as vt, WebhookOperation as w, TailorTypeGqlPermission as wt, RecordTrigger as x, PluginProcessContext as xt, IdpUserTrigger as y, PluginNamespaceProcessContext as yt, OIDC as z, ResolverInput as zt };
2165
+ //# sourceMappingURL=index-Bid18Opo.d.mts.map
@@ -1,4 +1,4 @@
1
- import { i as __require, n as __esmMin, o as __toESM, t as __commonJSMin } from "./chunk-CIV_ash9.mjs";
1
+ import { i as __require, n as __esmMin, o as __toESM, t as __commonJSMin } from "./chunk-C3Kl5s5P.mjs";
2
2
  import { createRequire } from "node:module";
3
3
 
4
4
  //#region ../../node_modules/jiti/dist/jiti.cjs
@@ -4479,4 +4479,4 @@ var init_jiti = __esmMin((() => {
4479
4479
  //#endregion
4480
4480
  init_jiti();
4481
4481
  export { createJiti };
4482
- //# sourceMappingURL=jiti-ygK9KoRA.mjs.map
4482
+ //# sourceMappingURL=jiti-DuCiUfMj.mjs.map