@hey-api/openapi-ts 0.86.2 → 0.86.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { IProject, Project, Selector, Symbol, SymbolIn } from "@hey-api/codegen-core";
2
1
  import fs from "node:fs";
3
2
  import * as typescript0 from "typescript";
4
3
  import ts from "typescript";
4
+ import { IProject, Project, Selector, Symbol, SymbolIn } from "@hey-api/codegen-core";
5
5
  import { RangeOptions, SemVer } from "semver";
6
6
 
7
7
  //#region rolldown:runtime
@@ -2946,52 +2946,7 @@ type Package = {
2946
2946
  satisfies: (nameOrVersion: string | SemVer, range: string, optionsOrLoose?: boolean | RangeOptions) => boolean;
2947
2947
  };
2948
2948
  //#endregion
2949
- //#region src/utils/logger.d.ts
2950
- declare class Logger {
2951
- private events;
2952
- private end;
2953
- report(print?: boolean): PerformanceMeasure | undefined;
2954
- private reportEvent;
2955
- private start;
2956
- private storeEvent;
2957
- timeEvent(name: string): {
2958
- mark: PerformanceMark;
2959
- timeEnd: () => void;
2960
- };
2961
- }
2962
- //#endregion
2963
- //#region src/openApi/shared/utils/graph.d.ts
2964
- /**
2965
- * Represents the possible access scopes for OpenAPI nodes.
2966
- * - 'normal': Default scope for regular nodes.
2967
- * - 'read': Node is read-only (e.g., readOnly: true).
2968
- * - 'write': Node is write-only (e.g., writeOnly: true).
2969
- */
2970
- type Scope = 'normal' | 'read' | 'write';
2971
- /**
2972
- * Information about a node in the OpenAPI graph.
2973
- *
2974
- * @property deprecated - Whether the node is deprecated. Optional.
2975
- * @property key - The property name or array index in the parent, or null for root.
2976
- * @property node - The actual object at this pointer in the spec.
2977
- * @property parentPointer - The JSON Pointer of the parent node, or null for root.
2978
- * @property scopes - The set of access scopes for this node, if any. Optional.
2979
- * @property tags - The set of tags for this node, if any. Optional.
2980
- */
2981
- type NodeInfo = {
2982
- /** Whether the node is deprecated. Optional. */
2983
- deprecated?: boolean;
2984
- /** The property name or array index in the parent, or null for root. */
2985
- key: string | number | null;
2986
- /** The actual object at this pointer in the spec. */
2987
- node: unknown;
2988
- /** The JSON Pointer of the parent node, or null for root. */
2989
- parentPointer: string | null;
2990
- /** The set of access scopes for this node, if any. Optional. */
2991
- scopes?: Set<Scope>;
2992
- /** The set of tags for this node, if any. Optional. */
2993
- tags?: Set<string>;
2994
- };
2949
+ //#region src/graph/types/graph.d.ts
2995
2950
  /**
2996
2951
  * The main graph structure for OpenAPI node analysis.
2997
2952
  *
@@ -3027,6 +2982,79 @@ type Graph = {
3027
2982
  */
3028
2983
  transitiveDependencies: Map<string, Set<string>>;
3029
2984
  };
2985
+ /**
2986
+ * Information about a node in the OpenAPI graph.
2987
+ *
2988
+ * @property deprecated - Whether the node is deprecated. Optional.
2989
+ * @property key - The property name or array index in the parent, or null for root.
2990
+ * @property node - The actual object at this pointer in the spec.
2991
+ * @property parentPointer - The JSON Pointer of the parent node, or null for root.
2992
+ * @property scopes - The set of access scopes for this node, if any. Optional.
2993
+ * @property tags - The set of tags for this node, if any. Optional.
2994
+ */
2995
+ type NodeInfo = {
2996
+ /** Whether the node is deprecated. Optional. */
2997
+ deprecated?: boolean;
2998
+ /** The property name or array index in the parent, or null for root. */
2999
+ key: string | number | null;
3000
+ /** The actual object at this pointer in the spec. */
3001
+ node: unknown;
3002
+ /** The JSON Pointer of the parent node, or null for root. */
3003
+ parentPointer: string | null;
3004
+ /** The set of access scopes for this node, if any. Optional. */
3005
+ scopes?: Set<Scope>;
3006
+ /** The set of tags for this node, if any. Optional. */
3007
+ tags?: Set<string>;
3008
+ };
3009
+ //#endregion
3010
+ //#region src/graph/types/walk.d.ts
3011
+ type GetPointerPriorityFn = (pointer: string) => number;
3012
+ type MatchPointerToGroupFn<T$1 extends string = string> = (pointer: string, kind?: T$1) => PointerGroupMatch<T$1>;
3013
+ type PointerGroupMatch<T$1 extends string = string> = {
3014
+ kind: T$1;
3015
+ matched: true;
3016
+ } | {
3017
+ kind?: undefined;
3018
+ matched: false;
3019
+ };
3020
+ type WalkOptions<T$1 extends string = string> = {
3021
+ /**
3022
+ * Optional priority function used to compute a numeric priority for each
3023
+ * pointer. Lower values are emitted earlier. Useful to customize ordering
3024
+ * beyond the built-in group preferences.
3025
+ */
3026
+ getPointerPriority?: GetPointerPriorityFn;
3027
+ /**
3028
+ * Optional function to match a pointer to a group name.
3029
+ *
3030
+ * @param pointer The pointer string
3031
+ * @returns The group name, or undefined if no match
3032
+ */
3033
+ matchPointerToGroup?: MatchPointerToGroupFn<T$1>;
3034
+ /**
3035
+ * Order of walking schemas.
3036
+ *
3037
+ * The "declarations" option ensures that schemas are walked in the order
3038
+ * they are declared in the input document. This is useful for scenarios where
3039
+ * the order of declaration matters, such as when generating code that relies
3040
+ * on the sequence of schema definitions.
3041
+ *
3042
+ * The "topological" option ensures that schemas are walked in an order
3043
+ * where dependencies are visited before the schemas that depend on them.
3044
+ * This is useful for scenarios where you need to process or generate
3045
+ * schemas in a way that respects their interdependencies.
3046
+ *
3047
+ * @default 'topological'
3048
+ */
3049
+ order?: 'declarations' | 'topological';
3050
+ /**
3051
+ * Optional grouping preference for walking. When provided, walk function
3052
+ * will prefer emitting kinds listed earlier in this array when it is safe
3053
+ * to do so (it will only apply the preference when doing so does not
3054
+ * violate dependency ordering).
3055
+ */
3056
+ preferGroups?: ReadonlyArray<T$1>;
3057
+ };
3030
3058
  //#endregion
3031
3059
  //#region src/config/utils/config.d.ts
3032
3060
  type ObjectType<T$1> = Extract<T$1, Record<string, any>> extends never ? Record<string, any> : Extract<T$1, Record<string, any>>;
@@ -6557,7 +6585,7 @@ interface OpenApiV3_1_XTypes {
6557
6585
  }
6558
6586
  //#endregion
6559
6587
  //#region src/openApi/types.d.ts
6560
- declare namespace OpenApi$1 {
6588
+ declare namespace OpenApi$3 {
6561
6589
  export type V2_0_X = OpenApiV2_0_X;
6562
6590
  export type V3_0_X = OpenApiV3_0_X;
6563
6591
  export type V3_1_X = OpenApiV3_1_X;
@@ -6590,6 +6618,322 @@ declare namespace OpenApiSchemaObject {
6590
6618
  export type V3_1_X = OpenApiV3_1_XTypes['SchemaObject'];
6591
6619
  }
6592
6620
  //#endregion
6621
+ //#region src/ir/graph.d.ts
6622
+ declare const irTopLevelKinds: readonly ["operation", "parameter", "requestBody", "schema", "server", "webhook"];
6623
+ type IrTopLevelKind = (typeof irTopLevelKinds)[number];
6624
+ //#endregion
6625
+ //#region src/plugins/shared/types/instance.d.ts
6626
+ type WalkEvents = {
6627
+ _path: ReadonlyArray<string | number>;
6628
+ method: keyof IR$1.PathItemObject;
6629
+ operation: IR$1.OperationObject;
6630
+ path: string;
6631
+ type: Extract<IrTopLevelKind, 'operation'>;
6632
+ } | {
6633
+ $ref: string;
6634
+ _path: ReadonlyArray<string | number>;
6635
+ name: string;
6636
+ parameter: IR$1.ParameterObject;
6637
+ type: Extract<IrTopLevelKind, 'parameter'>;
6638
+ } | {
6639
+ $ref: string;
6640
+ _path: ReadonlyArray<string | number>;
6641
+ name: string;
6642
+ requestBody: IR$1.RequestBodyObject;
6643
+ type: Extract<IrTopLevelKind, 'requestBody'>;
6644
+ } | {
6645
+ $ref: string;
6646
+ _path: ReadonlyArray<string | number>;
6647
+ name: string;
6648
+ schema: IR$1.SchemaObject;
6649
+ type: Extract<IrTopLevelKind, 'schema'>;
6650
+ } | {
6651
+ _path: ReadonlyArray<string | number>;
6652
+ server: IR$1.ServerObject;
6653
+ type: Extract<IrTopLevelKind, 'server'>;
6654
+ } | {
6655
+ _path: ReadonlyArray<string | number>;
6656
+ key: string;
6657
+ method: keyof IR$1.PathItemObject;
6658
+ operation: IR$1.OperationObject;
6659
+ type: Extract<IrTopLevelKind, 'webhook'>;
6660
+ };
6661
+ type WalkEvent<T$1 extends IrTopLevelKind = IrTopLevelKind> = Extract<WalkEvents, {
6662
+ type: T$1;
6663
+ }>;
6664
+ //#endregion
6665
+ //#region src/plugins/shared/utils/instance.d.ts
6666
+ declare class PluginInstance<T$1 extends Plugin.Types = Plugin.Types> {
6667
+ api: T$1['api'];
6668
+ config: Omit<T$1['resolvedConfig'], 'name' | 'output'>;
6669
+ context: IR$1.Context;
6670
+ dependencies: Required<Plugin.Config<T$1>>['dependencies'];
6671
+ private eventHooks;
6672
+ gen: IProject;
6673
+ private handler;
6674
+ name: T$1['resolvedConfig']['name'];
6675
+ output: string;
6676
+ /**
6677
+ * The package metadata and utilities for the current context, constructed
6678
+ * from the provided dependencies. Used for managing package-related
6679
+ * information such as name, version, and dependency resolution during
6680
+ * code generation.
6681
+ */
6682
+ package: IR$1.Context['package'];
6683
+ constructor(props: Pick<Required<Plugin.Config<T$1>>, 'config' | 'dependencies' | 'handler'> & {
6684
+ api?: T$1['api'];
6685
+ context: IR$1.Context<OpenApi$3.V2_0_X | OpenApi$3.V3_0_X | OpenApi$3.V3_1_X>;
6686
+ gen: IProject;
6687
+ name: string;
6688
+ output: string;
6689
+ });
6690
+ /**
6691
+ * Iterates over various input elements as specified by the event types, in
6692
+ * a specific order: servers, schemas, parameters, request bodies, then
6693
+ * operations.
6694
+ *
6695
+ * This ensures, for example, that schemas are always processed before
6696
+ * operations, which may reference them.
6697
+ *
6698
+ * @template T - The event type(s) to yield. Defaults to all event types.
6699
+ * @param events - The event types to walk over. If none are provided, all event types are included.
6700
+ * @param callback - Function to execute for each event.
6701
+ *
6702
+ * @example
6703
+ * // Iterate over all operations and schemas
6704
+ * plugin.forEach('operation', 'schema', (event) => {
6705
+ * if (event.type === 'operation') {
6706
+ * // handle operation
6707
+ * } else if (event.type === 'schema') {
6708
+ * // handle schema
6709
+ * }
6710
+ * });
6711
+ */
6712
+ forEach<T extends IrTopLevelKind = IrTopLevelKind>(...args: [...events: ReadonlyArray<T$1>, callback: (event: WalkEvent<T$1>) => void]): void;
6713
+ forEach<T extends IrTopLevelKind = IrTopLevelKind>(...args: [...events: ReadonlyArray<T$1>, callback: (event: WalkEvent<T$1>) => void, options: WalkOptions<T$1>]): void;
6714
+ /**
6715
+ * Retrieves a registered plugin instance by its name from the context. This
6716
+ * allows plugins to access other plugins that have been registered in the
6717
+ * same context, enabling cross-plugin communication and dependencies.
6718
+ *
6719
+ * @param name Plugin name as defined in the configuration.
6720
+ * @returns The plugin instance if found, undefined otherwise.
6721
+ */
6722
+ getPlugin<T extends keyof PluginConfigMap>(name: T$1): T$1 extends any ? PluginInstance<PluginConfigMap[T$1]> | undefined : never;
6723
+ /**
6724
+ * Retrieves a registered plugin instance by its name from the context. This
6725
+ * allows plugins to access other plugins that have been registered in the
6726
+ * same context, enabling cross-plugin communication and dependencies.
6727
+ *
6728
+ * @param name Plugin name as defined in the configuration.
6729
+ * @returns The plugin instance if found, throw otherwise.
6730
+ */
6731
+ getPluginOrThrow<T extends keyof PluginConfigMap>(name: T$1): T$1 extends any ? PluginInstance<PluginConfigMap[T$1]> : never;
6732
+ getSymbol(symbolIdOrSelector: number | Selector): Symbol | undefined;
6733
+ hooks: {
6734
+ operation: {
6735
+ isMutation: (operation: IR$1.OperationObject) => boolean;
6736
+ isQuery: (operation: IR$1.OperationObject) => boolean;
6737
+ };
6738
+ };
6739
+ isSymbolRegistered(symbolIdOrSelector: number | Selector): boolean;
6740
+ referenceSymbol(symbolIdOrSelector: number | Selector): Symbol;
6741
+ registerSymbol(symbol: SymbolIn): Symbol;
6742
+ /**
6743
+ * Executes plugin's handler function.
6744
+ */
6745
+ run(): Promise<void>;
6746
+ setSymbolValue(symbol: Symbol, value: unknown): void;
6747
+ private buildEventHooks;
6748
+ private forEachError;
6749
+ private getSymbolFilePath;
6750
+ private isOperationKind;
6751
+ }
6752
+ //#endregion
6753
+ //#region src/parser/types/hooks.d.ts
6754
+ type Hooks = {
6755
+ /**
6756
+ * Event hooks.
6757
+ */
6758
+ events?: {
6759
+ /**
6760
+ * Triggered after executing a plugin handler.
6761
+ *
6762
+ * @param args Arguments object.
6763
+ * @returns void
6764
+ */
6765
+ 'plugin:handler:after'?: (args: {
6766
+ /** Plugin that just executed. */
6767
+ plugin: PluginInstance;
6768
+ }) => void;
6769
+ /**
6770
+ * Triggered before executing a plugin handler.
6771
+ *
6772
+ * @param args Arguments object.
6773
+ * @returns void
6774
+ */
6775
+ 'plugin:handler:before'?: (args: {
6776
+ /** Plugin about to execute. */
6777
+ plugin: PluginInstance;
6778
+ }) => void;
6779
+ /**
6780
+ * Triggered after registering a symbol.
6781
+ *
6782
+ * You can use this to perform actions after a symbol is registered.
6783
+ *
6784
+ * @param args Arguments object.
6785
+ * @returns void
6786
+ */
6787
+ 'symbol:register:after'?: (args: {
6788
+ /** Plugin that registered the symbol. */
6789
+ plugin: PluginInstance;
6790
+ /** The registered symbol. */
6791
+ symbol: Symbol;
6792
+ }) => void;
6793
+ /**
6794
+ * Triggered before registering a symbol.
6795
+ *
6796
+ * You can use this to modify the symbol before it's registered.
6797
+ *
6798
+ * @param args Arguments object.
6799
+ * @returns void
6800
+ */
6801
+ 'symbol:register:before'?: (args: {
6802
+ /** Plugin registering the symbol. */
6803
+ plugin: PluginInstance;
6804
+ /** Symbol to register. */
6805
+ symbol: SymbolIn;
6806
+ }) => void;
6807
+ /**
6808
+ * Triggered after setting a symbol value.
6809
+ *
6810
+ * You can use this to perform actions after a symbol's value is set.
6811
+ *
6812
+ * @param args Arguments object.
6813
+ * @returns void
6814
+ */
6815
+ 'symbol:setValue:after'?: (args: {
6816
+ /** Plugin that set the symbol value. */
6817
+ plugin: PluginInstance;
6818
+ /** The symbol. */
6819
+ symbol: Symbol;
6820
+ /** The value that was set. */
6821
+ value: unknown;
6822
+ }) => void;
6823
+ /**
6824
+ * Triggered before setting a symbol value.
6825
+ *
6826
+ * You can use this to modify the value before it's set.
6827
+ *
6828
+ * @param args Arguments object.
6829
+ * @returns void
6830
+ */
6831
+ 'symbol:setValue:before'?: (args: {
6832
+ /** Plugin setting the symbol value. */
6833
+ plugin: PluginInstance;
6834
+ /** The symbol. */
6835
+ symbol: Symbol;
6836
+ /** The value to set. */
6837
+ value: unknown;
6838
+ }) => void;
6839
+ };
6840
+ /**
6841
+ * Hooks specifically for overriding operations behavior.
6842
+ *
6843
+ * Use these to classify operations, decide which outputs to generate,
6844
+ * or apply custom behavior to individual operations.
6845
+ */
6846
+ operations?: {
6847
+ /**
6848
+ * Classify the given operation into one or more kinds.
6849
+ *
6850
+ * Each kind determines how we treat the operation (e.g., generating queries or mutations).
6851
+ *
6852
+ * **Default behavior:**
6853
+ * - GET → 'query'
6854
+ * - DELETE, PATCH, POST, PUT → 'mutation'
6855
+ *
6856
+ * **Resolution order:**
6857
+ * 1. If `isQuery` or `isMutation` returns `true` or `false`, that overrides `getKind`.
6858
+ * 2. If `isQuery` or `isMutation` returns `undefined`, the result of `getKind` is used.
6859
+ *
6860
+ * @param operation - The operation object to classify.
6861
+ * @returns An array containing one or more of 'query' or 'mutation', or undefined to fallback to default behavior.
6862
+ * @example
6863
+ * ```ts
6864
+ * getKind: (operation) => {
6865
+ * if (operation.method === 'get' && operation.path === '/search') {
6866
+ * return ['query', 'mutation'];
6867
+ * }
6868
+ * return; // fallback to default behavior
6869
+ * }
6870
+ * ```
6871
+ */
6872
+ getKind?: (operation: IROperationObject) => ReadonlyArray<'mutation' | 'query'> | undefined;
6873
+ /**
6874
+ * Check if the given operation should be treated as a mutation.
6875
+ *
6876
+ * This affects which outputs are generated for the operation.
6877
+ *
6878
+ * **Default behavior:** DELETE, PATCH, POST, and PUT operations are treated as mutations.
6879
+ *
6880
+ * **Resolution order:** If this returns `true` or `false`, it overrides `getKind`.
6881
+ * If it returns `undefined`, `getKind` is used instead.
6882
+ *
6883
+ * @param operation - The operation object to check.
6884
+ * @returns true if the operation is a mutation, false otherwise, or undefined to fallback to `getKind`.
6885
+ * @example
6886
+ * ```ts
6887
+ * isMutation: (operation) => {
6888
+ * if (operation.method === 'post' && operation.path === '/search') {
6889
+ * return true;
6890
+ * }
6891
+ * return; // fallback to default behavior
6892
+ * }
6893
+ * ```
6894
+ */
6895
+ isMutation?: (operation: IROperationObject) => boolean | undefined;
6896
+ /**
6897
+ * Check if the given operation should be treated as a query.
6898
+ *
6899
+ * This affects which outputs are generated for the operation.
6900
+ *
6901
+ * **Default behavior:** GET operations are treated as queries.
6902
+ *
6903
+ * **Resolution order:** If this returns `true` or `false`, it overrides `getKind`.
6904
+ * If it returns `undefined`, `getKind` is used instead.
6905
+ *
6906
+ * @param operation - The operation object to check.
6907
+ * @returns true if the operation is a query, false otherwise, or undefined to fallback to `getKind`.
6908
+ * @example
6909
+ * ```ts
6910
+ * isQuery: (operation) => {
6911
+ * if (operation.method === 'post' && operation.path === '/search') {
6912
+ * return true;
6913
+ * }
6914
+ * return; // fallback to default behavior
6915
+ * }
6916
+ * ```
6917
+ */
6918
+ isQuery?: (operation: IROperationObject) => boolean | undefined;
6919
+ };
6920
+ /**
6921
+ * Hooks specifically for overriding symbols behavior.
6922
+ *
6923
+ * Use these to customize file placement.
6924
+ */
6925
+ symbols?: {
6926
+ /**
6927
+ * Optional output strategy to override default plugin behavior.
6928
+ *
6929
+ * Use this to route generated symbols to specific files.
6930
+ *
6931
+ * @returns The file path to output the symbol to, or undefined to fallback to default behavior.
6932
+ */
6933
+ getFilePath?: (symbol: Symbol) => string | undefined;
6934
+ };
6935
+ };
6936
+ //#endregion
6593
6937
  //#region src/types/parser.d.ts
6594
6938
  type EnumsMode = 'inline' | 'root';
6595
6939
  type UserParser = {
@@ -6604,7 +6948,7 @@ type UserParser = {
6604
6948
  * Use these to classify resources, control which outputs are generated,
6605
6949
  * or provide custom behavior for specific resources.
6606
6950
  */
6607
- hooks?: IR$1.Hooks;
6951
+ hooks?: Hooks;
6608
6952
  /**
6609
6953
  * Pagination configuration.
6610
6954
  */
@@ -6776,7 +7120,7 @@ type Parser = {
6776
7120
  * Use these to classify resources, control which outputs are generated,
6777
7121
  * or provide custom behavior for specific resources.
6778
7122
  */
6779
- hooks: IR$1.Hooks;
7123
+ hooks: Hooks;
6780
7124
  /**
6781
7125
  * Pagination configuration.
6782
7126
  */
@@ -7401,6 +7745,20 @@ interface Client$2 {
7401
7745
  version: string;
7402
7746
  }
7403
7747
  //#endregion
7748
+ //#region src/utils/logger.d.ts
7749
+ declare class Logger {
7750
+ private events;
7751
+ private end;
7752
+ report(print?: boolean): PerformanceMeasure | undefined;
7753
+ private reportEvent;
7754
+ private start;
7755
+ private storeEvent;
7756
+ timeEvent(name: string): {
7757
+ mark: PerformanceMark;
7758
+ timeEnd: () => void;
7759
+ };
7760
+ }
7761
+ //#endregion
7404
7762
  //#region src/openApi/v2/interfaces/OpenApiExternalDocs.d.ts
7405
7763
  /**
7406
7764
  * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#external-documentation-object
@@ -7685,7 +8043,7 @@ interface OpenApiTag$1 {
7685
8043
  /**
7686
8044
  * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md
7687
8045
  */
7688
- interface OpenApi$2 {
8046
+ interface OpenApi$1 {
7689
8047
  basePath?: string;
7690
8048
  consumes?: string[];
7691
8049
  definitions?: Dictionary<OpenApiSchema>;
@@ -7973,7 +8331,7 @@ interface OpenApiTag {
7973
8331
  /**
7974
8332
  * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md
7975
8333
  */
7976
- interface OpenApi$3 {
8334
+ interface OpenApi$2 {
7977
8335
  components?: OpenApiComponents;
7978
8336
  externalDocs?: OpenApiExternalDocs;
7979
8337
  info: OpenApiInfo;
@@ -7985,7 +8343,7 @@ interface OpenApi$3 {
7985
8343
  }
7986
8344
  //#endregion
7987
8345
  //#region src/openApi/common/interfaces/OpenApi.d.ts
7988
- type OpenApi = OpenApi$2 | OpenApi$3;
8346
+ type OpenApi = OpenApi$1 | OpenApi$2;
7989
8347
  //#endregion
7990
8348
  //#region src/openApi/index.d.ts
7991
8349
  /**
@@ -8005,160 +8363,6 @@ declare const parseOpenApiSpec: ({
8005
8363
  spec: unknown;
8006
8364
  }) => IR$1.Context | undefined;
8007
8365
  //#endregion
8008
- //#region src/ir/graph.d.ts
8009
- declare const irTopLevelKinds: readonly ["operation", "parameter", "requestBody", "schema", "server", "webhook"];
8010
- type IrTopLevelKind = (typeof irTopLevelKinds)[number];
8011
- //#endregion
8012
- //#region src/plugins/shared/types/instance.d.ts
8013
- type WalkEvents = {
8014
- _path: ReadonlyArray<string | number>;
8015
- method: keyof IR$1.PathItemObject;
8016
- operation: IR$1.OperationObject;
8017
- path: string;
8018
- type: Extract<IrTopLevelKind, 'operation'>;
8019
- } | {
8020
- $ref: string;
8021
- _path: ReadonlyArray<string | number>;
8022
- name: string;
8023
- parameter: IR$1.ParameterObject;
8024
- type: Extract<IrTopLevelKind, 'parameter'>;
8025
- } | {
8026
- $ref: string;
8027
- _path: ReadonlyArray<string | number>;
8028
- name: string;
8029
- requestBody: IR$1.RequestBodyObject;
8030
- type: Extract<IrTopLevelKind, 'requestBody'>;
8031
- } | {
8032
- $ref: string;
8033
- _path: ReadonlyArray<string | number>;
8034
- name: string;
8035
- schema: IR$1.SchemaObject;
8036
- type: Extract<IrTopLevelKind, 'schema'>;
8037
- } | {
8038
- _path: ReadonlyArray<string | number>;
8039
- server: IR$1.ServerObject;
8040
- type: Extract<IrTopLevelKind, 'server'>;
8041
- } | {
8042
- _path: ReadonlyArray<string | number>;
8043
- key: string;
8044
- method: keyof IR$1.PathItemObject;
8045
- operation: IR$1.OperationObject;
8046
- type: Extract<IrTopLevelKind, 'webhook'>;
8047
- };
8048
- type WalkEvent<T$1 extends IrTopLevelKind = IrTopLevelKind> = Extract<WalkEvents, {
8049
- type: T$1;
8050
- }>;
8051
- type WalkOptions = {
8052
- /**
8053
- * Order of walking schemas.
8054
- *
8055
- * The "declarations" option ensures that schemas are walked in the order
8056
- * they are declared in the input document. This is useful for scenarios where
8057
- * the order of declaration matters, such as when generating code that relies
8058
- * on the sequence of schema definitions.
8059
- *
8060
- * The "topological" option ensures that schemas are walked in an order
8061
- * where dependencies are visited before the schemas that depend on them.
8062
- * This is useful for scenarios where you need to process or generate
8063
- * schemas in a way that respects their interdependencies.
8064
- *
8065
- * @default 'topological'
8066
- */
8067
- order?: 'declarations' | 'topological';
8068
- };
8069
- //#endregion
8070
- //#region src/plugins/shared/utils/instance.d.ts
8071
- declare class PluginInstance<T$1 extends Plugin.Types = Plugin.Types> {
8072
- api: T$1['api'];
8073
- config: Omit<T$1['resolvedConfig'], 'name' | 'output'>;
8074
- context: IR$1.Context;
8075
- dependencies: Required<Plugin.Config<T$1>>['dependencies'];
8076
- gen: IProject;
8077
- private handler;
8078
- name: T$1['resolvedConfig']['name'];
8079
- output: string;
8080
- /**
8081
- * The package metadata and utilities for the current context, constructed
8082
- * from the provided dependencies. Used for managing package-related
8083
- * information such as name, version, and dependency resolution during
8084
- * code generation.
8085
- */
8086
- package: IR$1.Context['package'];
8087
- constructor(props: Pick<Required<Plugin.Config<T$1>>, 'config' | 'dependencies' | 'handler'> & {
8088
- api?: T$1['api'];
8089
- context: IR$1.Context<OpenApi$1.V2_0_X | OpenApi$1.V3_0_X | OpenApi$1.V3_1_X>;
8090
- gen: IProject;
8091
- name: string;
8092
- output: string;
8093
- });
8094
- /**
8095
- * Iterates over various input elements as specified by the event types, in
8096
- * a specific order: servers, schemas, parameters, request bodies, then
8097
- * operations.
8098
- *
8099
- * This ensures, for example, that schemas are always processed before
8100
- * operations, which may reference them.
8101
- *
8102
- * @template T - The event type(s) to yield. Defaults to all event types.
8103
- * @param events - The event types to walk over. If none are provided, all event types are included.
8104
- * @param callback - Function to execute for each event.
8105
- *
8106
- * @example
8107
- * // Iterate over all operations and schemas
8108
- * plugin.forEach('operation', 'schema', (event) => {
8109
- * if (event.type === 'operation') {
8110
- * // handle operation
8111
- * } else if (event.type === 'schema') {
8112
- * // handle schema
8113
- * }
8114
- * });
8115
- */
8116
- forEach<T extends IrTopLevelKind = IrTopLevelKind>(...args: [...events: ReadonlyArray<T$1>, callback: (event: WalkEvent<T$1>) => void]): void;
8117
- forEach<T extends IrTopLevelKind = IrTopLevelKind>(...args: [...events: ReadonlyArray<T$1>, callback: (event: WalkEvent<T$1>) => void, options: WalkOptions]): void;
8118
- private forEachError;
8119
- /**
8120
- * Retrieves a registered plugin instance by its name from the context. This
8121
- * allows plugins to access other plugins that have been registered in the
8122
- * same context, enabling cross-plugin communication and dependencies.
8123
- *
8124
- * @param name Plugin name as defined in the configuration.
8125
- * @returns The plugin instance if found, undefined otherwise.
8126
- */
8127
- getPlugin<T extends keyof PluginConfigMap>(name: T$1): T$1 extends any ? PluginInstance<PluginConfigMap[T$1]> | undefined : never;
8128
- /**
8129
- * Retrieves a registered plugin instance by its name from the context. This
8130
- * allows plugins to access other plugins that have been registered in the
8131
- * same context, enabling cross-plugin communication and dependencies.
8132
- *
8133
- * @param name Plugin name as defined in the configuration.
8134
- * @returns The plugin instance if found, throw otherwise.
8135
- */
8136
- getPluginOrThrow<T extends keyof PluginConfigMap>(name: T$1): T$1 extends any ? PluginInstance<PluginConfigMap[T$1]> : never;
8137
- getSymbol(symbolIdOrSelector: number | Selector): Symbol | undefined;
8138
- private getSymbolFilePath;
8139
- getSymbolValue(idOrSymbol: number | Symbol): unknown;
8140
- hasSymbolValue(idOrSymbol: number | Symbol): boolean;
8141
- hooks: {
8142
- operation: {
8143
- isMutation: (operation: IR$1.OperationObject) => boolean;
8144
- isQuery: (operation: IR$1.OperationObject) => boolean;
8145
- };
8146
- symbol: {
8147
- getFilePath: (symbol: Symbol) => string | undefined;
8148
- };
8149
- };
8150
- private isOperationKind;
8151
- isSymbolRegistered(symbolIdOrSelector: number | Selector): boolean;
8152
- referenceSymbol(symbolIdOrSelector: number | Selector): Symbol;
8153
- registerSymbol(symbol: SymbolIn): Symbol;
8154
- /**
8155
- * Executes plugin's handler function.
8156
- */
8157
- run(): Promise<void>;
8158
- setSymbolValue(idOrSymbol: number | Symbol, value: unknown): Map<number, unknown>;
8159
- private symbolToId;
8160
- }
8161
- //#endregion
8162
8366
  //#region src/types/client.d.ts
8163
8367
  interface Operation extends Omit<Operation$1, 'tags'> {
8164
8368
  service: string;
@@ -8198,7 +8402,7 @@ type BaseConfig = {
8198
8402
  * Use these to classify resources, control which outputs are generated,
8199
8403
  * or provide custom behavior for specific resources.
8200
8404
  */
8201
- '~hooks'?: IR$1.Hooks;
8405
+ '~hooks'?: Hooks;
8202
8406
  };
8203
8407
 
8204
8408
  /**
@@ -15848,97 +16052,6 @@ interface IRComponentsObject {
15848
16052
  requestBodies?: Record<string, IRRequestBodyObject>;
15849
16053
  schemas?: Record<string, IRSchemaObject>;
15850
16054
  }
15851
- interface IRHooks {
15852
- /**
15853
- * Hooks specifically for overriding operations behavior.
15854
- *
15855
- * Use these to classify operations, decide which outputs to generate,
15856
- * or apply custom behavior to individual operations.
15857
- */
15858
- operations?: {
15859
- /**
15860
- * Classify the given operation into one or more kinds.
15861
- *
15862
- * Each kind determines how we treat the operation (e.g., generating queries or mutations).
15863
- *
15864
- * **Default behavior:**
15865
- * - GET → 'query'
15866
- * - DELETE, PATCH, POST, PUT → 'mutation'
15867
- *
15868
- * **Resolution order:**
15869
- * 1. If `isQuery` or `isMutation` returns `true` or `false`, that overrides `getKind`.
15870
- * 2. If `isQuery` or `isMutation` returns `undefined`, the result of `getKind` is used.
15871
- *
15872
- * @param operation - The operation object to classify.
15873
- * @returns An array containing one or more of 'query' or 'mutation', or undefined to fallback to default behavior.
15874
- * @example
15875
- * getKind: (operation) => {
15876
- * if (operation.method === 'get' && operation.path === '/search') {
15877
- * return ['query', 'mutation'];
15878
- * }
15879
- * return; // fallback to default behavior
15880
- * }
15881
- */
15882
- getKind?: (operation: IROperationObject) => ReadonlyArray<'mutation' | 'query'> | undefined;
15883
- /**
15884
- * Check if the given operation should be treated as a mutation.
15885
- *
15886
- * This affects which outputs are generated for the operation.
15887
- *
15888
- * **Default behavior:** DELETE, PATCH, POST, and PUT operations are treated as mutations.
15889
- *
15890
- * **Resolution order:** If this returns `true` or `false`, it overrides `getKind`.
15891
- * If it returns `undefined`, `getKind` is used instead.
15892
- *
15893
- * @param operation - The operation object to check.
15894
- * @returns true if the operation is a mutation, false otherwise, or undefined to fallback to `getKind`.
15895
- * @example
15896
- * isMutation: (operation) => {
15897
- * if (operation.method === 'post' && operation.path === '/search') {
15898
- * return true;
15899
- * }
15900
- * return; // fallback to default behavior
15901
- }
15902
- */
15903
- isMutation?: (operation: IROperationObject) => boolean | undefined;
15904
- /**
15905
- * Check if the given operation should be treated as a query.
15906
- *
15907
- * This affects which outputs are generated for the operation.
15908
- *
15909
- * **Default behavior:** GET operations are treated as queries.
15910
- *
15911
- * **Resolution order:** If this returns `true` or `false`, it overrides `getKind`.
15912
- * If it returns `undefined`, `getKind` is used instead.
15913
- *
15914
- * @param operation - The operation object to check.
15915
- * @returns true if the operation is a query, false otherwise, or undefined to fallback to `getKind`.
15916
- * @example
15917
- * isQuery: (operation) => {
15918
- * if (operation.method === 'post' && operation.path === '/search') {
15919
- * return true;
15920
- * }
15921
- * return; // fallback to default behavior
15922
- }
15923
- */
15924
- isQuery?: (operation: IROperationObject) => boolean | undefined;
15925
- };
15926
- /**
15927
- * Hooks specifically for overriding symbols behavior.
15928
- *
15929
- * Use these to customize file placement.
15930
- */
15931
- symbols?: {
15932
- /**
15933
- * Optional output strategy to override default plugin behavior.
15934
- *
15935
- * Use this to route generated symbols to specific files.
15936
- *
15937
- * @returns The file path to output the symbol to, or undefined to fallback to default behavior.
15938
- */
15939
- getFilePath?: (symbol: Symbol) => string | undefined;
15940
- };
15941
- }
15942
16055
  interface IROperationObject {
15943
16056
  body?: IRBodyObject;
15944
16057
  deprecated?: boolean;
@@ -16081,7 +16194,6 @@ declare namespace IR$1 {
16081
16194
  export type BodyObject = IRBodyObject;
16082
16195
  export type ComponentsObject = IRComponentsObject;
16083
16196
  export type Context<Spec extends Record<string, any> = any> = IRContext<Spec>;
16084
- export type Hooks = IRHooks;
16085
16197
  export type Model = IRModel;
16086
16198
  export type OperationObject = IROperationObject;
16087
16199
  export type ParameterObject = IRParameterObject;
@@ -16120,5 +16232,5 @@ interface WatchValues {
16120
16232
  lastValue?: string;
16121
16233
  }
16122
16234
  //#endregion
16123
- export { StringCase as C, MaybeArray as D, LazyOrAsync as E, OpenApiSchemaObject as S, Logger as T, OpenApiMetaObject as _, ExpressionTransformer as a, OpenApiRequestBodyObject as b, Client as c, Plugin as d, Client$1 as f, OpenApi$1 as g, UserConfig$27 as h, TypeTransformer as i, PluginHandler as l, Config$1 as m, WatchValues as n, compiler as o, parseOpenApiSpec as p, IR$1 as r, tsc as s, LegacyIR as t, DefinePlugin as u, OpenApiOperationObject as v, Input as w, OpenApiResponseObject as x, OpenApiParameterObject as y };
16124
- //# sourceMappingURL=types-BT1ededZ.d.cts.map
16235
+ export { OpenApiSchemaObject as C, MaybeArray as D, LazyOrAsync as E, OpenApiResponseObject as S, Input as T, OpenApi$3 as _, ExpressionTransformer as a, OpenApiParameterObject as b, Client as c, Plugin as d, Client$1 as f, UserConfig$27 as g, Config$1 as h, TypeTransformer as i, PluginHandler as l, Logger as m, WatchValues as n, compiler as o, parseOpenApiSpec as p, IR$1 as r, tsc as s, LegacyIR as t, DefinePlugin as u, OpenApiMetaObject as v, StringCase as w, OpenApiRequestBodyObject as x, OpenApiOperationObject as y };
16236
+ //# sourceMappingURL=types-CBGf9bNY.d.cts.map