@hey-api/openapi-ts 0.86.12 → 0.87.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.
- package/README.md +8 -14
- package/dist/{types-Dh80P1tV.d.cts → config-B2o9ax_a.d.cts} +137 -1627
- package/dist/{types-BRmx9r9T.d.ts → config-oAoGatJ7.d.ts} +143 -1631
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +443 -12
- package/dist/index.d.ts +432 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +38 -1
- package/dist/internal.d.ts +38 -1
- package/dist/internal.js +1 -1
- package/dist/openApi-BWD76jue.cjs +21 -0
- package/dist/openApi-BWD76jue.cjs.map +1 -0
- package/dist/openApi-DXfWYPpF.js +21 -0
- package/dist/openApi-DXfWYPpF.js.map +1 -0
- package/dist/run.cjs +1 -1
- package/dist/run.cjs.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/src-CTUbY-zd.js +11 -0
- package/dist/src-CTUbY-zd.js.map +1 -0
- package/dist/src-H1fIt1p4.cjs +19 -0
- package/dist/src-H1fIt1p4.cjs.map +1 -0
- package/package.json +1 -4
- package/dist/getSpec-1BMHZkPH.js +0 -25
- package/dist/getSpec-1BMHZkPH.js.map +0 -1
- package/dist/getSpec-xn4as4li.cjs +0 -25
- package/dist/getSpec-xn4as4li.cjs.map +0 -1
- package/dist/src-CQ_69Vcm.js +0 -1310
- package/dist/src-CQ_69Vcm.js.map +0 -1
- package/dist/src-DptUs1Ky.cjs +0 -1318
- package/dist/src-DptUs1Ky.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openApi-DXfWYPpF.js","names":["__filename","__dirname","path","registryRegExp","getRegistryUrl","parseShorthand","queryParams: string | undefined","registryRegExp","getRegistryUrl","namespace","parseShorthand","defaultWatch: Watch","inputs: Array<Input>","input: Input","logs: Config['logs']","a: Partial<UserConfig>","b: Partial<UserConfig>","merged: UserConfig","valueToObject: ValueToObject","mappers","fields","defaultValue","defaultConfig","Api","uniqueItems: Array<IR.SchemaObject>","typeIds: Array<string>","path","result: OperationResponsesMap","errors: Omit<IR.SchemaObject, 'properties'> &\n Pick<Required<IR.SchemaObject>, 'properties'>","responses: Omit<IR.SchemaObject, 'properties'> &\n Pick<Required<IR.SchemaObject>, 'properties'>","defaultResponse: IR.ResponseObject | undefined","nodeName","assignment: ObjectAssignment","initializer: ts.Expression | undefined","identifiers","members: Array<ts.EnumMember>","exportType","spans: Array<ts.TemplateLiteralTypeSpan>","namespaceBinding: ImportExportItemObject | undefined","elements: Array<ts.ImportSpecifier>","modifiers: Array<ts.ModifierLike>","heritageClauses: Array<ts.HeritageClause>","path","propertyTypes: Array<ts.TypeNode>","members: Array<ts.TypeElement | ts.MappedTypeNode>","modifiers: readonly ts.Modifier[] | undefined","questionToken: ts.QuestionToken | undefined","type: ts.TypeNode | undefined","modifiers: ReadonlyArray<ts.Modifier> | undefined","nodes: Array<ts.TypeNode>","types.createAnonymousFunction","types.createArrayLiteralExpression","types.createArrowFunction","types.createAsExpression","types.createAssignment","types.createAwaitExpression","transform.createBinaryExpression","types.createBlock","module.createCallExpression","classes.createClassDeclaration","types.createConditionalExpression","module.createConstVariable","classes.createConstructorDeclaration","types.createEnumDeclaration","module.createExportAllDeclaration","module.createNamedExportDeclarations","convert.expressionToStatement","types.createForOfStatement","types.createFunctionTypeNode","types.createGetAccessorDeclaration","utils.createIdentifier","transform.createIfStatement","types.createIndexedAccessTypeNode","utils.isTsNode","types.createKeywordTypeNode","types.createLiteralTypeNode","types.createMappedTypeNode","classes.createMethodDeclaration","module.createNamedImportDeclarations","types.createNamespaceDeclaration","types.createNewExpression","utils.tsNodeToString","types.createNull","types.createObjectType","utils.ots","types.createParameterDeclaration","types.createPropertyAccessExpression","transform.createPropertyAccessExpressions","types.createPropertyAssignment","utils.createPropertyDeclaration","types.createRegularExpressionLiteral","_return.createReturnFunctionCall","_return.createReturnStatement","_return.createReturnVariable","transform.createSafeAccessExpression","types.createStringLiteral","types.createTemplateLiteralType","utils.createThis","transform.createArrayMapTransform","transform.createArrayTransformMutation","transform.createDateTransformMutation","transform.createFunctionTransformMutation","transform.createDateTransformerExpression","types.createTypeAliasDeclaration","typedef.createTypeArrayNode","typedef.createTypeInterfaceNode","typedef.createTypeIntersectionNode","types.createTypeNode","types.createTypeOfExpression","types.createTypeOperatorNode","types.createTypeParameterDeclaration","types.createTypeParenthesizedNode","typedef.createTypeRecordNode","types.createTypeReferenceNode","typedef.createTypeTupleNode","typedef.createTypeUnionNode","types.toExpression","auth: Array<Auth>","path","nameToLocations: Record<string, Set<Location>>","signatureParameters: SignatureParameters","fields: Array<Field>","signatureParameter: SignatureParameter","className: string | undefined","methodName: string | undefined","classCandidates: Array<string>","path","dataType","result: OperationParameters","flatParamsTypeProperties: Array<Property>","requestOptions: Array<ObjectValue>","parameterSerializers: Array<ObjectValue>","query: SymbolMeta","responseTypeValue: ReturnType<typeof getResponseType> | undefined","statements: Array<ts.Statement>","args: Array<unknown>","config: Array<unknown>","obj: Array<Record<string, unknown>>","headersValue: Array<unknown>","clientExpression: ts.Expression","types: Array<string | ts.StringLiteral>","comments: Array<string>","clientExpression: ts.Expression","createHttpRequests: AngularCommonPlugin['Handler']","methodAccess: ts.Expression","createHttpResources: AngularCommonPlugin['Handler']","handler: AngularCommonPlugin['Handler']","defaultConfig: AngularCommonPlugin['Config']","Api","defineConfig","renamed: Map<string, string> | undefined","dirPath","errorResponse: Url","path","createClient: PluginHandler","defaultValues: Array<unknown>","Api","defaultConfig: HeyApiClientAngularPlugin['Config']","Api","defineConfig","defaultConfig","Api","defaultConfig: HeyApiClientAxiosPlugin['Config']","Api","defineConfig","defaultConfig","Api","defaultConfig: HeyApiClientFetchPlugin['Config']","Api","defineConfig","defaultConfig","Api","defaultConfig: HeyApiClientNextPlugin['Config']","Api","defineConfig","defaultConfig","Api","defaultConfig: HeyApiClientNuxtPlugin['Config']","Api","defineConfig","defaultConfig","Api","defaultConfig: HeyApiClientOfetchPlugin['Config']","Api","defineConfig","defaultConfig","Api","satisfies: typeof semver.satisfies","handler: HeyApiSchemasPlugin['Handler']","defaultConfig: HeyApiSchemasPlugin['Config']","Api","defineConfig","defaultConfig","Api","subClassReferenceNode:\n | ts.GetAccessorDeclaration\n | ts.PropertyDeclaration","handlerV1: HeyApiSdkPlugin['Handler']","handler: HeyApiSdkPlugin['Handler']","handlerV1","defaultConfig: HeyApiSdkPlugin['Config']","Api","defineConfig","defaultConfig","Api","bigIntExpressions: ExpressionTransformer","dateExpressions: ExpressionTransformer","query: SymbolMeta","nodes: Array<ts.Expression | ts.Statement>","arrayNodes: Array<ts.Expression | ts.Statement>","handler: HeyApiTransformersPlugin['Handler']","defaultConfig: HeyApiTransformersPlugin['Config']","Api","defineConfig","defaultConfig","types: Array<ts.TypeNode>","comments: Array<string>","typeofItems: Array<\n | 'bigint'\n | 'boolean'\n | 'function'\n | 'number'\n | 'object'\n | 'string'\n | 'symbol'\n | 'undefined'\n >","key: string | undefined","node","type","irSchema: IR.SchemaObject","properties: Record<string, IR.SchemaObject>","required: Array<string>","operationToDataType","data: IR.SchemaObject","dataRequired: Array<string>","irSchemaToAst","type","node","data: IR.SchemaObject","dataRequired: Array<string>","type","irSchemaToAst","node","arrayToAst","itemTypes: Array<ts.TypeNode>","irSchemaToAst","booleanToAst","enumToAst","irSchemaToAst","neverToAst","nullToAst","numberToAst","objectToAst","indexKey: ts.TypeReferenceNode | undefined","indexProperty: Property | undefined","schemaProperties: Array<Property>","indexPropertyItems: Array<IR.SchemaObject>","irSchemaToAst","stringToAst","query: SymbolMeta","queryTypeId: SymbolMeta","symbolTypeId","tupleToAst","itemTypes: Array<ts.Expression | ts.TypeNode>","irSchemaToAst","undefinedToAst","unknownToAst","voidToAst","irSchemaWithTypeToAst","arrayToAst","booleanToAst","enumToAst","numberToAst","neverToAst","nullToAst","objectToAst","stringToAst","tupleToAst","undefinedToAst","unknownToAst","voidToAst","irSchemaToAst","irSchemaWithTypeToAst","itemTypes: Array<ts.TypeNode>","handleComponent","handlerV1: HeyApiTypeScriptPlugin['Handler']","servers: Array<IR.ServerObject>","webhookNames: Array<string>","Api","irSchemaToAstV1","handler: HeyApiTypeScriptPlugin['Handler']","handlerV1","defaultConfig: HeyApiTypeScriptPlugin['Config']","Api","defineConfig","defaultConfig","Api","handleMeta","useTypeData","useTypeError","typeErrorName: string | undefined","useTypeResponse","createMutationOptions","useTypeData","useTypeError","useTypeResponse","fnOptions","statements: Array<ts.Statement>","mutationOptionsObj: Array<{ key: string; value: ts.Expression }>","handleMeta","TOptionsType","optionsIdentifier","createQueryKeyFunction","createQueryKeyLiteral","tagsExpression: Expression | undefined","createQueryKeyType","properties: Array<Property>","queryKeyStatement","useTypeData","optionsParamName","createQueryOptions","keyExpression: ts.Expression","queryKeyStatement","tagsExpr: ts.Expression | undefined","useTypeData","statements: Array<ts.Statement>","queryOptionsObj: Array<{ key: string; value: ts.Expression }>","handleMeta","handler: PiniaColadaPlugin['Handler']","defaultConfig: PiniaColadaPlugin['Config']","Api","handler","defineConfig","defaultConfig","typeErrorName: string | undefined","tagsExpression: Expression | undefined","properties: Array<Property>","statements: Array<ts.Statement>","infiniteQueryOptionsObj: Array<{ key: string; value: ts.Expression }>","fnOptions","statements: Array<ts.Statement>","mutationOptionsObj: Array<{ key: string; value: ts.Expression }>","optionsParamName","statements: Array<ts.Statement>","queryOptionsObj: Array<{ key: string; value: ts.Expression }>","handler: PluginHandler","Api","defaultConfig: TanStackAngularQueryPlugin['Config']","Api","handler","defineConfig","defaultConfig","Api","defaultConfig: TanStackReactQueryPlugin['Config']","Api","handler","defineConfig","defaultConfig","Api","defaultConfig: TanStackSolidQueryPlugin['Config']","Api","handler","defineConfig","defaultConfig","Api","defaultConfig: TanStackSvelteQueryPlugin['Config']","Api","handler","defineConfig","defaultConfig","Api","defaultConfig: TanStackVueQueryPlugin['Config']","Api","handler","defineConfig","defaultConfig","Api","identifiers","exportAst","identifiers","nullToAst","result: Partial<Omit<Ast, 'typeName'>>","identifiers","objectToAst","result: Partial<Omit<Ast, 'typeName'>>","properties: Array<ts.PropertyAssignment | ts.GetAccessorDeclaration>","irSchemaToAst","propertyName:\n | ts.ComputedPropertyName\n | ts.StringLiteral\n | ts.NumericLiteral\n | string","stringToAst","result: Partial<Omit<Ast, 'typeName'>>","identifiers","irSchemaWithTypeToAst","nullToAst","objectToAst","stringToAst","irSchemaToAst","ast: Partial<Ast>","query: SymbolMeta","irSchemaWithTypeToAst","handleComponent","handlerV2: ArktypePlugin['Handler']","handler: ArktypePlugin['Handler']","defaultConfig: ArktypePlugin['Config']","Api","fields","defaultValue","defineConfig","defaultConfig","Api","properties: Array<Property>","errorsTypeReference: ts.TypeReferenceNode | undefined","responsesTypeReference: ts.TypeReferenceNode | undefined","handler: FastifyPlugin['Handler']","routeHandlers: Array<Property>","defaultConfig: FastifyPlugin['Config']","Api","defineConfig","defaultConfig","identifiers","identifiers","Api","identifiers","exportAst","identifiers","numberParameter","irOperationToAst","schemaData: IR.SchemaObject","properties: Record<string, IR.SchemaObject>","required: Array<string>","path","irWebhookToAst","schemaData: IR.SchemaObject","properties: Record<string, IR.SchemaObject>","required: Array<string>","unknownToAst","identifiers","arrayToAst","result: Omit<Ast, 'typeName'>","identifiers","unknownToAst","irSchemaToAst","booleanToAst","identifiers","enumToAst","enumMembers: Array<ts.LiteralExpression>","unknownToAst","identifiers","neverToAst","identifiers","nullToAst","identifiers","numberToAst","identifiers","pipes: Array<ts.CallExpression>","numberParameter","objectToAst","result: Partial<Omit<Ast, 'typeName'>>","properties: Array<ts.PropertyAssignment>","irSchemaToAst","identifiers","stringToAst","identifiers","pipes: Array<ts.CallExpression>","expression","tupleToAst","result: Partial<Omit<Ast, 'typeName'>>","identifiers","irSchemaToAst","unknownToAst","undefinedToAst","identifiers","voidToAst","identifiers","irSchemaWithTypeToAst","arrayToAst","booleanToAst","enumToAst","numberToAst","neverToAst","nullToAst","objectToAst","stringToAst","tupleToAst","undefinedToAst","unknownToAst","voidToAst","irSchemaToAst","ast: Ast","query: SymbolMeta","identifiers","irSchemaWithTypeToAst","callParameter: ts.Expression | undefined","numberParameter","handleComponent","handlerV1: ValibotPlugin['Handler']","handler: ValibotPlugin['Handler']","defaultConfig: ValibotPlugin['Config']","Api","defineConfig","defaultConfig","schemaData: IR.SchemaObject","properties: Record<string, IR.SchemaObject>","required: Array<string>","path","schemaData: IR.SchemaObject","properties: Record<string, IR.SchemaObject>","required: Array<string>","unknownToAst","result: Partial<Omit<Ast, 'typeName'>>","arrayToAst","result: Partial<Omit<Ast, 'typeName'>>","unknownToAst","irSchemaToAst","intersectionExpression: ts.Expression","checks: Array<ts.Expression>","booleanToAst","result: Partial<Omit<Ast, 'typeName'>>","enumToAst","result: Partial<Omit<Ast, 'typeName'>>","enumMembers: Array<ts.LiteralExpression>","literalMembers: Array<ts.CallExpression>","unknownToAst","neverToAst","result: Partial<Omit<Ast, 'typeName'>>","nullToAst","result: Partial<Omit<Ast, 'typeName'>>","numberToAst","result: Partial<Omit<Ast, 'typeName'>>","checks: Array<ts.Expression>","objectToAst","result: Partial<Omit<Ast, 'typeName'>>","properties: Array<ts.PropertyAssignment | ts.GetAccessorDeclaration>","irSchemaToAst","stringToAst","result: Partial<Omit<Ast, 'typeName'>>","dateTimeOptions: { key: string; value: boolean }[]","checks: Array<ts.Expression>","tupleToAst","result: Partial<Omit<Ast, 'typeName'>>","tupleElements","tupleElements: Array<ts.Expression>","irSchemaToAst","undefinedToAst","result: Partial<Omit<Ast, 'typeName'>>","voidToAst","result: Partial<Omit<Ast, 'typeName'>>","irSchemaWithTypeToAst","arrayToAst","booleanToAst","enumToAst","numberToAst","neverToAst","nullToAst","objectToAst","stringToAst","tupleToAst","undefinedToAst","unknownToAst","voidToAst","irSchemaToAst","ast: Partial<Ast>","query: SymbolMeta","irSchemaWithTypeToAst","schema","handleComponent","handlerMini: ZodPlugin['Handler']","unknownToAst","arrayToAst","arrayExpression: ts.CallExpression | undefined","unknownToAst","irSchemaToAst","intersectionExpression: ts.Expression","booleanToAst","enumToAst","enumMembers: Array<ts.LiteralExpression>","literalMembers: Array<ts.CallExpression>","unknownToAst","enumExpression: ts.CallExpression","neverToAst","nullToAst","numberToAst","objectToAst","properties: Array<ts.PropertyAssignment>","irSchemaToAst","stringToAst","dateTimeOptions: { key: string; value: boolean }[]","tupleToAst","tupleElements","tupleElements: Array<ts.Expression>","irSchemaToAst","undefinedToAst","voidToAst","irSchemaWithTypeToAst","arrayToAst","booleanToAst","enumToAst","numberToAst","neverToAst","nullToAst","objectToAst","stringToAst","tupleToAst","undefinedToAst","unknownToAst","voidToAst","irSchemaToAst","ast: Partial<Ast>","query: SymbolMeta","irSchemaWithTypeToAst","handleComponent","handlerV3: ZodPlugin['Handler']","result: Partial<Omit<Ast, 'typeName'>>","result: Partial<Omit<Ast, 'typeName'>>","intersectionExpression: ts.Expression","result: Partial<Omit<Ast, 'typeName'>>","result: Partial<Omit<Ast, 'typeName'>>","enumMembers: Array<ts.LiteralExpression>","literalMembers: Array<ts.CallExpression>","result: Partial<Omit<Ast, 'typeName'>>","result: Partial<Omit<Ast, 'typeName'>>","result: Partial<Omit<Ast, 'typeName'>>","result: Partial<Omit<Ast, 'typeName'>>","properties: Array<ts.PropertyAssignment | ts.GetAccessorDeclaration>","result: Partial<Omit<Ast, 'typeName'>>","dateTimeOptions: { key: string; value: boolean }[]","result: Partial<Omit<Ast, 'typeName'>>","tupleElements","tupleElements: Array<ts.Expression>","result: Partial<Omit<Ast, 'typeName'>>","result: Partial<Omit<Ast, 'typeName'>>","ast: Partial<Ast>","query: SymbolMeta","schema","handlerV4: ZodPlugin['Handler']","handler: ZodPlugin['Handler']","defaultConfig: ZodPlugin['Config']","fields","defaultValue","defaultConfig","defaultPluginConfigs: {\n [K in PluginNames]: Plugin.Config<PluginConfigMap[K]>;\n}","angularCommon","heyApiClientAngular","heyApiClientAxios","heyApiClientFetch","heyApiClientNext","heyApiClientNuxt","heyApiClientOfetch","heyApiSchemas","heyApiSdk","heyApiTransformers","heyApiTypeScript","piniaColada","tanStackAngularQuery","tanStackReactQuery","tanStackSolidQuery","tanStackSvelteQuery","tanStackVueQuery","plugins: Config['plugins']","context: PluginContext","userPlugin","defaultConfig","defaultPlugin","userPluginsConfig: Config['plugins']","definedPlugins: UserConfig['plugins']","configs: Array<UserConfig>","dependencies: Record<string, string>","configurationFile: string | undefined","results: Array<ArrayOnly<ConfigResult>>","errors: Array<Error>","plugins: Pick<Config, 'plugins' | 'pluginOrder'>","config: Config","joinedValues","values: string[]","search: string[]","entries: Array<[string, string]>","arrayBuffer: ArrayBuffer | undefined","hasChanged: boolean | undefined","response: Response | undefined","imports: Map<string, Binding>","exports: Map<string, Binding>","lines: Array<string>","specifiers: Array<ts.ExportSpecifier>","namespaceBinding: string | undefined","finalAlias: string | undefined","name","path","specifiers: Array<ts.ImportSpecifier>","defaultBinding: ts.Identifier | undefined","namedImports: Array<{\n isTypeOnly: boolean;\n name: string;\n propertyName: ts.ModuleExportName | undefined;\n }>","isTypeOnly","declIndex: Map<string, number>","walkDeclarations: WalkFn","walkTopological: WalkFn","order: Array<string>","getGroup: GetPointerPriorityFn","walk: WalkFn","matchIrPointerToGroup: MatchPointerToGroupFn<IrTopLevelKind>","patterns: Record<IrTopLevelKind, RegExp>","kind","kindPriority: KindPriority","partial: Partial<KindPriority>","getIrPointerPriority: GetPointerPriorityFn","defaultGetKind: Required<Required<Hooks>['operations']>['getKind']","callback: (event: WalkEvent<TKind>) => void","events: ReadonlyArray<TKind>","options: WalkOptions<TKind>","event: WalkEvent | undefined","baseEvent: BaseEvent","symbolIn: SymbolIn","result: EventHooks","result: string","path","namespace","keys: Array<string>","regexps: Array<RegExp>","path","filters: Filters","dependencies: Set<string> | undefined","resourceMetadata: ResourceMetadata","path","namespace","path","walkSchemas","path","rootEnums: Record<string, unknown>","rootEnumSignatures: Record<string, string>","inlineEnums: Array<{\n key: string | number | null;\n node: unknown;\n parent: unknown;\n path: ReadonlyArray<string | number>;\n signature: string;\n }>","signatureToName: Record<string, string | undefined>","signatureToSchema: Record<string, unknown>","path","childResult: Partial<PointerDependenciesResult>","worklist: Set<string>","graph: Graph","walk","path","deprecated: boolean | undefined","tags: Set<string> | undefined","cache: Cache","path","originals: OriginalSchemas","split: SplitSchemas","deepEqual","walk","path","filterSpec","filtered: typeof spec.definitions","path","contentToSchema","mediaTypeObjects","objects: Array<Content>","values: Array<string>","getSchemaType","parseSchemaJsDoc","parseSchemaMeta","parseArray","schemaItems: Array<IR.SchemaObject>","schemaToIrSchema","parseBoolean","parseNumber","parseObject","schemaProperties: Record<string, IR.SchemaObject>","parseString","initIrSchema","irSchema: IR.SchemaObject","parseAllOf","valueSchemas: ReadonlyArray<IR.SchemaObject>","irDiscriminatorSchema: IR.SchemaObject","parseOneType","nestedItems: Array<IR.SchemaObject>","parseEnum","enumType: SchemaType<SchemaObject> | 'null' | undefined","parseRef","irSchema","parseNullableType","typeIrSchema: IR.SchemaObject","parseType","parseUnknown","parseSchema","isPaginationType","paginationField","name","getSchemaType","parseOperationJsDoc","initIrOperation","irOperation: IR.OperationObject","operationToIrOperation","requestBodyObject: IRBodyObject","requestBodyObjectRequired: Array<string>","schema: SchemaObject","mediaTypeObjects","content","paginationField","schemaToIrSchema","contentToSchema","securitySchemeObjects: Map<string, IR.SecurityObject>","irSecuritySchemeObject: IR.SecurityObject | undefined","parsePathOperation","path","defaultExplode","defaultStyle","parametersArrayToObject","parametersObject: IR.ParametersObject","parameterToIrParameter","finalSchema: SchemaObject","paginationField","irParameter: IR.ParameterObject","schemaToIrSchema","parseServers","schemes: ReadonlyArray<string>","path","validateOpenApiSpec","issues: Array<ValidatorIssue>","path","validateOpenApiSpec","state: State","path","commonOperation: OperationObject","operationArgs: Omit<\n Parameters<typeof parsePathOperation>[0],\n 'method'\n >","parametersArrayToObject","filterSpec","filtered: typeof spec.components.parameters","filtered: typeof spec.components.requestBodies","filtered: typeof spec.components.responses","filtered: typeof spec.components.schemas","path","contentToSchema","mediaTypeObjects","objects: Array<Content>","parseSchemaJsDoc","parseSchemaMeta","parseArray","schemaItems: Array<IR.SchemaObject>","schemaToIrSchema","parseBoolean","parseNumber","parseObject","schemaProperties: Record<string, IR.SchemaObject>","parseString","initIrSchema","irSchema: IR.SchemaObject","parseAllOf","valueSchemas: ReadonlyArray<IR.SchemaObject>","irDiscriminatorSchema: IR.SchemaObject","parseOneType","nestedItems: Array<IR.SchemaObject>","parseAnyOf","parseEnum","enumType: SchemaType<SchemaObject> | 'null' | undefined","parseOneOf","parseRef","irSchema","typeIrSchema: IR.SchemaObject","parseType","parseUnknown","parseSchema","isPaginationType","paginationField","refSchema: SchemaObject | ReferenceObject | undefined","mediaTypeObjects","content","name","parseOperationJsDoc","initIrOperation","irOperation: IR.OperationObject","operationToIrOperation","mediaTypeObjects","content","paginationField","schemaToIrSchema","contentToSchema","securitySchemeObjects: Map<string, IR.SecurityObject>","parsePathOperation","path","defaultAllowReserved","defaultExplode","defaultStyle","parametersArrayToObject","parametersObject: IR.ParametersObject","parameterToIrParameter","mediaTypeObjects","content","finalSchema: SchemaObject","paginationField","irParameter: IR.ParameterObject","schemaToIrSchema","parseParameter","requestBodyToIrRequestBody","mediaTypeObjects","content","irRequestBody: IR.RequestBodyObject","schemaToIrSchema","parseRequestBody","parseServers","validateOpenApiSpec","issues: Array<ValidatorIssue>","path","validateOpenApiSpec","state: State","path","operationArgs: Omit<\n Parameters<typeof parsePathOperation>[0],\n 'method' | 'operation'\n > & {\n operation: Omit<\n Parameters<typeof parsePathOperation>[0]['operation'],\n 'responses'\n >;\n }","parametersArrayToObject","filtered: typeof spec.components.parameters","filtered: typeof spec.components.requestBodies","filtered: typeof spec.components.responses","filtered: typeof spec.components.schemas","path","objects: Array<Content>","schemaItems: Array<IR.SchemaObject>","schemaProperties: Record<string, IR.SchemaObject>","patternProperties: Record<string, IR.SchemaObject>","irSchema: IR.SchemaObject","valueSchemas: ReadonlyArray<IR.SchemaObject>","irDiscriminatorSchema: IR.SchemaObject","nestedItems: Array<IR.SchemaObject>","enumType: SchemaType<SchemaObject> | undefined","irSchema","irRefSchema: IR.SchemaObject","typeIrSchema: IR.SchemaObject","refSchema: SchemaObject | undefined","content","name","schema","irOperation: IR.OperationObject","content","securitySchemeObjects: Map<string, IR.SecurityObject>","path","parametersObject: IR.ParametersObject","content","finalSchema: SchemaObject","irParameter: IR.ParameterObject","content","irRequestBody: IR.RequestBodyObject","issues: Array<ValidatorIssue>","path","state: Parameters<typeof parseWebhookOperation>[0]['state']","operationArgs: Omit<\n Parameters<typeof parseWebhookOperation>[0],\n 'method'\n >","state: State","path","operationArgs: Omit<\n Parameters<typeof parsePathOperation>[0],\n 'method'\n >"],"sources":["../src/generate/tsConfig.ts","../src/generate/utils.ts","../src/error.ts","../src/utils/input/heyApi.ts","../src/utils/input/readme.ts","../src/utils/input/scalar.ts","../src/utils/input/index.ts","../src/config/input.ts","../src/config/logs.ts","../src/config/merge.ts","../src/config/utils/config.ts","../src/config/output.ts","../src/config/packages.ts","../src/config/parser.ts","../src/plugins/shared/utils/config.ts","../src/plugins/@angular/common/api.ts","../src/utils/stringCase.ts","../src/openApi/shared/utils/name.ts","../src/ir/parameter.ts","../src/ir/schema.ts","../src/ir/utils.ts","../src/ir/operation.ts","../src/openApi/common/parser/sanitize.ts","../src/plugins/@hey-api/client-core/utils.ts","../src/plugins/shared/utils/refs.ts","../src/utils/regexp.ts","../src/utils/escape.ts","../src/tsc/utils.ts","../src/tsc/types.ts","../src/tsc/module.ts","../src/tsc/classes.ts","../src/tsc/convert.ts","../src/tsc/return.ts","../src/tsc/transform.ts","../src/tsc/typedef.ts","../src/tsc/index.ts","../src/utils/transform.ts","../src/plugins/@hey-api/sdk/shared/auth.ts","../src/plugins/@hey-api/sdk/shared/constants.ts","../src/utils/ref.ts","../src/plugins/@hey-api/sdk/shared/signature.ts","../src/plugins/@hey-api/sdk/shared/validator.ts","../src/plugins/@hey-api/sdk/shared/operation.ts","../src/plugins/shared/utils/operation.ts","../src/plugins/@angular/common/httpRequests.ts","../src/plugins/@angular/common/httpResources.ts","../src/plugins/@angular/common/plugin.ts","../src/plugins/@angular/common/config.ts","../src/plugins/@hey-api/client-core/config.ts","../src/generate/client.ts","../src/utils/url.ts","../src/plugins/@hey-api/client-core/client.ts","../src/plugins/@hey-api/client-core/createClientConfig.ts","../src/plugins/@hey-api/client-core/plugin.ts","../src/plugins/@hey-api/client-angular/api.ts","../src/plugins/@hey-api/client-angular/config.ts","../src/plugins/@hey-api/client-axios/api.ts","../src/plugins/@hey-api/client-axios/config.ts","../src/plugins/@hey-api/client-fetch/api.ts","../src/plugins/@hey-api/client-fetch/config.ts","../src/plugins/@hey-api/client-next/api.ts","../src/plugins/@hey-api/client-next/config.ts","../src/plugins/@hey-api/client-nuxt/api.ts","../src/plugins/@hey-api/client-nuxt/config.ts","../src/plugins/@hey-api/client-ofetch/api.ts","../src/plugins/@hey-api/client-ofetch/config.ts","../src/plugins/@hey-api/schemas/api.ts","../src/config/utils/package.ts","../src/openApi/shared/utils/identifier.ts","../src/plugins/@hey-api/schemas/plugin.ts","../src/plugins/@hey-api/schemas/config.ts","../src/plugins/@hey-api/sdk/api.ts","../src/plugins/@hey-api/sdk/shared/class.ts","../src/plugins/@hey-api/sdk/shared/functions.ts","../src/plugins/@hey-api/sdk/shared/typeOptions.ts","../src/plugins/@hey-api/sdk/v1/plugin.ts","../src/plugins/@hey-api/sdk/plugin.ts","../src/plugins/@hey-api/sdk/config.ts","../src/plugins/@hey-api/transformers/api.ts","../src/plugins/@hey-api/transformers/expressions.ts","../src/plugins/@hey-api/transformers/plugin.ts","../src/plugins/@hey-api/transformers/config.ts","../src/plugins/@hey-api/typescript/shared/clientOptions.ts","../src/plugins/shared/utils/schema.ts","../src/plugins/@hey-api/typescript/shared/export.ts","../src/plugins/@hey-api/typescript/shared/operation.ts","../src/plugins/@hey-api/typescript/shared/webhook.ts","../src/plugins/@hey-api/typescript/shared/webhooks.ts","../src/plugins/@hey-api/typescript/v1/toAst/array.ts","../src/plugins/@hey-api/typescript/v1/toAst/boolean.ts","../src/plugins/@hey-api/typescript/v1/toAst/enum.ts","../src/plugins/@hey-api/typescript/v1/toAst/never.ts","../src/plugins/@hey-api/typescript/v1/toAst/null.ts","../src/plugins/@hey-api/typescript/v1/toAst/number.ts","../src/plugins/shared/utils/case.ts","../src/plugins/@hey-api/typescript/v1/toAst/object.ts","../src/plugins/@hey-api/typescript/v1/toAst/string.ts","../src/plugins/@hey-api/typescript/v1/toAst/tuple.ts","../src/plugins/@hey-api/typescript/v1/toAst/undefined.ts","../src/plugins/@hey-api/typescript/v1/toAst/unknown.ts","../src/plugins/@hey-api/typescript/v1/toAst/void.ts","../src/plugins/@hey-api/typescript/v1/toAst/index.ts","../src/plugins/@hey-api/typescript/v1/plugin.ts","../src/plugins/@hey-api/typescript/api.ts","../src/plugins/@hey-api/typescript/plugin.ts","../src/plugins/@hey-api/typescript/config.ts","../src/plugins/@pinia/colada/api.ts","../src/plugins/@pinia/colada/meta.ts","../src/plugins/@pinia/colada/useType.ts","../src/plugins/@pinia/colada/utils.ts","../src/plugins/@pinia/colada/mutationOptions.ts","../src/plugins/@pinia/colada/queryKey.ts","../src/plugins/@pinia/colada/queryOptions.ts","../src/plugins/@pinia/colada/plugin.ts","../src/plugins/@pinia/colada/config.ts","../src/plugins/@tanstack/query-core/meta.ts","../src/plugins/@tanstack/query-core/useType.ts","../src/plugins/@tanstack/query-core/queryKey.ts","../src/plugins/@tanstack/query-core/infiniteQueryOptions.ts","../src/plugins/@tanstack/query-core/mutationOptions.ts","../src/plugins/@tanstack/query-core/queryOptions.ts","../src/plugins/@tanstack/query-core/useQuery.ts","../src/plugins/@tanstack/query-core/plugin.ts","../src/plugins/@tanstack/angular-query-experimental/api.ts","../src/plugins/@tanstack/angular-query-experimental/config.ts","../src/plugins/@tanstack/react-query/api.ts","../src/plugins/@tanstack/react-query/config.ts","../src/plugins/@tanstack/solid-query/api.ts","../src/plugins/@tanstack/solid-query/config.ts","../src/plugins/@tanstack/svelte-query/api.ts","../src/plugins/@tanstack/svelte-query/config.ts","../src/plugins/@tanstack/vue-query/api.ts","../src/plugins/@tanstack/vue-query/config.ts","../src/plugins/arktype/v2/api.ts","../src/plugins/arktype/api.ts","../src/plugins/arktype/constants.ts","../src/plugins/arktype/shared/export.ts","../src/plugins/arktype/v2/toAst/null.ts","../src/plugins/arktype/v2/toAst/object.ts","../src/plugins/arktype/v2/toAst/string.ts","../src/plugins/arktype/v2/toAst/index.ts","../src/plugins/arktype/v2/plugin.ts","../src/plugins/arktype/plugin.ts","../src/plugins/arktype/config.ts","../src/plugins/fastify/api.ts","../src/plugins/fastify/plugin.ts","../src/plugins/fastify/config.ts","../src/plugins/valibot/v1/constants.ts","../src/plugins/valibot/v1/api.ts","../src/plugins/valibot/api.ts","../src/plugins/valibot/shared/pipesToAst.ts","../src/plugins/valibot/shared/export.ts","../src/plugins/valibot/shared/numbers.ts","../src/plugins/valibot/shared/operation.ts","../src/plugins/valibot/shared/webhook.ts","../src/plugins/valibot/v1/toAst/unknown.ts","../src/plugins/valibot/v1/toAst/array.ts","../src/plugins/valibot/v1/toAst/boolean.ts","../src/plugins/valibot/v1/toAst/enum.ts","../src/plugins/valibot/v1/toAst/never.ts","../src/plugins/valibot/v1/toAst/null.ts","../src/plugins/valibot/v1/toAst/number.ts","../src/plugins/valibot/v1/toAst/object.ts","../src/plugins/valibot/v1/toAst/string.ts","../src/plugins/valibot/v1/toAst/tuple.ts","../src/plugins/valibot/v1/toAst/undefined.ts","../src/plugins/valibot/v1/toAst/void.ts","../src/plugins/valibot/v1/toAst/index.ts","../src/plugins/valibot/v1/plugin.ts","../src/plugins/valibot/plugin.ts","../src/plugins/valibot/config.ts","../src/plugins/zod/constants.ts","../src/plugins/zod/mini/api.ts","../src/plugins/zod/v3/api.ts","../src/plugins/zod/v4/api.ts","../src/plugins/zod/api.ts","../src/plugins/zod/shared/export.ts","../src/plugins/zod/shared/module.ts","../src/plugins/zod/shared/numbers.ts","../src/plugins/zod/shared/operation.ts","../src/plugins/zod/shared/webhook.ts","../src/plugins/zod/mini/toAst/unknown.ts","../src/plugins/zod/mini/toAst/array.ts","../src/plugins/zod/mini/toAst/boolean.ts","../src/plugins/zod/mini/toAst/enum.ts","../src/plugins/zod/mini/toAst/never.ts","../src/plugins/zod/mini/toAst/null.ts","../src/plugins/zod/mini/toAst/number.ts","../src/plugins/zod/mini/toAst/object.ts","../src/plugins/zod/mini/toAst/string.ts","../src/plugins/zod/mini/toAst/tuple.ts","../src/plugins/zod/mini/toAst/undefined.ts","../src/plugins/zod/mini/toAst/void.ts","../src/plugins/zod/mini/toAst/index.ts","../src/plugins/zod/mini/plugin.ts","../src/plugins/zod/v3/toAst/unknown.ts","../src/plugins/zod/v3/toAst/array.ts","../src/plugins/zod/v3/toAst/boolean.ts","../src/plugins/zod/v3/toAst/enum.ts","../src/plugins/zod/v3/toAst/never.ts","../src/plugins/zod/v3/toAst/null.ts","../src/plugins/zod/v3/toAst/number.ts","../src/plugins/zod/v3/toAst/object.ts","../src/plugins/zod/v3/toAst/string.ts","../src/plugins/zod/v3/toAst/tuple.ts","../src/plugins/zod/v3/toAst/undefined.ts","../src/plugins/zod/v3/toAst/void.ts","../src/plugins/zod/v3/toAst/index.ts","../src/plugins/zod/v3/plugin.ts","../src/plugins/zod/v4/toAst/unknown.ts","../src/plugins/zod/v4/toAst/array.ts","../src/plugins/zod/v4/toAst/boolean.ts","../src/plugins/zod/v4/toAst/enum.ts","../src/plugins/zod/v4/toAst/never.ts","../src/plugins/zod/v4/toAst/null.ts","../src/plugins/zod/v4/toAst/number.ts","../src/plugins/zod/v4/toAst/object.ts","../src/plugins/zod/v4/toAst/string.ts","../src/plugins/zod/v4/toAst/tuple.ts","../src/plugins/zod/v4/toAst/undefined.ts","../src/plugins/zod/v4/toAst/void.ts","../src/plugins/zod/v4/toAst/index.ts","../src/plugins/zod/v4/plugin.ts","../src/plugins/zod/plugin.ts","../src/plugins/zod/config.ts","../src/plugins/config.ts","../src/config/plugins.ts","../src/config/init.ts","../src/plugins/@hey-api/client-core/bundle/params.ts","../src/plugins/@hey-api/client-core/bundle/pathSerializer.ts","../src/plugins/@hey-api/client-fetch/bundle/utils.ts","../src/getSpec.ts","../src/generate/renderer.ts","../src/utils/minHeap.ts","../src/graph/walk.ts","../src/ir/graph.ts","../src/plugins/shared/utils/instance.ts","../src/ir/context.ts","../src/openApi/shared/utils/operation.ts","../src/openApi/shared/utils/filter.ts","../src/openApi/shared/graph/meta.ts","../src/openApi/shared/utils/schema.ts","../src/openApi/shared/utils/schemaChildRelationships.ts","../src/openApi/shared/utils/transforms.ts","../src/openApi/shared/transforms/utils.ts","../src/openApi/shared/transforms/enums.ts","../src/openApi/shared/transforms/propertiesRequiredByDefault.ts","../src/openApi/shared/utils/deepEqual.ts","../src/openApi/shared/utils/graph.ts","../src/openApi/shared/transforms/readWrite.ts","../src/openApi/shared/transforms/index.ts","../src/openApi/shared/utils/parameter.ts","../src/openApi/shared/utils/validator.ts","../src/openApi/2.0.x/parser/filter.ts","../src/ir/mediaType.ts","../src/openApi/2.0.x/parser/mediaType.ts","../src/ir/pagination.ts","../src/openApi/shared/utils/discriminator.ts","../src/openApi/2.0.x/parser/schema.ts","../src/openApi/2.0.x/parser/pagination.ts","../src/openApi/2.0.x/parser/operation.ts","../src/openApi/2.0.x/parser/parameter.ts","../src/openApi/2.0.x/parser/server.ts","../src/openApi/2.0.x/parser/validate.ts","../src/openApi/2.0.x/parser/index.ts","../src/openApi/3.0.x/parser/filter.ts","../src/openApi/3.0.x/parser/mediaType.ts","../src/openApi/3.0.x/parser/schema.ts","../src/openApi/3.0.x/parser/pagination.ts","../src/openApi/3.0.x/parser/operation.ts","../src/openApi/3.0.x/parser/parameter.ts","../src/openApi/3.0.x/parser/requestBody.ts","../src/openApi/3.0.x/parser/server.ts","../src/openApi/3.0.x/parser/validate.ts","../src/openApi/3.0.x/parser/index.ts","../src/openApi/3.1.x/parser/filter.ts","../src/openApi/3.1.x/parser/mediaType.ts","../src/openApi/3.1.x/parser/schema.ts","../src/openApi/3.1.x/parser/pagination.ts","../src/openApi/3.1.x/parser/operation.ts","../src/openApi/3.1.x/parser/parameter.ts","../src/openApi/3.1.x/parser/requestBody.ts","../src/openApi/3.1.x/parser/server.ts","../src/openApi/3.1.x/parser/validate.ts","../src/openApi/3.1.x/parser/webhook.ts","../src/openApi/3.1.x/parser/index.ts","../src/openApi/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport ts from 'typescript';\n\nimport type { UserOutput } from '~/types/output';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport const findPackageJson = (): unknown | undefined => {\n let dir = __dirname;\n while (dir !== path.dirname(dir)) {\n const files = fs.readdirSync(dir);\n const candidates = files.filter((file) => file === 'package.json');\n\n if (candidates[0]) {\n const packageJsonPath = path.join(dir, candidates[0]);\n return JSON.parse(\n fs.readFileSync(packageJsonPath, {\n encoding: 'utf8',\n }),\n );\n }\n\n dir = path.dirname(dir);\n }\n\n return;\n};\n\nexport const loadPackageJson = () => {\n const packageJson = findPackageJson();\n\n const safePackage = {\n bugs: {\n url: '',\n },\n name: '',\n version: '',\n };\n\n if (packageJson && typeof packageJson === 'object') {\n if ('name' in packageJson && typeof packageJson.name === 'string') {\n safePackage.name = packageJson.name;\n }\n\n if ('version' in packageJson && typeof packageJson.version === 'string') {\n safePackage.version = packageJson.version;\n }\n\n if (\n 'bugs' in packageJson &&\n packageJson.bugs &&\n typeof packageJson.bugs === 'object'\n ) {\n if (\n 'url' in packageJson.bugs &&\n typeof packageJson.bugs.url === 'string'\n ) {\n safePackage.bugs.url = packageJson.bugs.url;\n if (safePackage.bugs.url && !safePackage.bugs.url.endsWith('/')) {\n safePackage.bugs.url += '/';\n }\n }\n }\n }\n\n return safePackage;\n};\n\nexport const findTsConfigPath = (\n tsConfigPath?: UserOutput['tsConfigPath'],\n): string | null => {\n if (tsConfigPath === null) {\n return null;\n }\n\n if (tsConfigPath) {\n const resolved = path.isAbsolute(tsConfigPath)\n ? tsConfigPath\n : path.resolve(__dirname, tsConfigPath);\n return fs.existsSync(resolved) ? resolved : null;\n }\n\n let dir = __dirname;\n while (dir !== path.dirname(dir)) {\n const files = fs.readdirSync(dir);\n const candidates = files\n .filter((file) => file.startsWith('tsconfig') && file.endsWith('.json'))\n .sort((file) => (file === 'tsconfig.json' ? -1 : 1));\n\n if (candidates[0]) {\n return path.join(dir, candidates[0]);\n }\n\n dir = path.dirname(dir);\n }\n\n return null;\n};\n\nexport const loadTsConfig = (\n configPath: string | null,\n): ts.ParsedCommandLine | null => {\n if (!configPath) {\n return null;\n }\n\n const raw = ts.readConfigFile(configPath, ts.sys.readFile);\n\n if (raw.error) {\n throw new Error(`Couldn't read tsconfig from path: ${configPath}`);\n }\n\n return ts.parseJsonConfigFileContent(\n raw.config,\n ts.sys,\n path.dirname(configPath),\n );\n};\n","import type { PathLike } from 'node:fs';\nimport fs from 'node:fs';\n\nexport const ensureDirSync = (path: PathLike) => {\n if (!fs.existsSync(path)) {\n fs.mkdirSync(path, { recursive: true });\n }\n};\n","import fs from 'node:fs';\nimport path from 'node:path';\n\nimport colors from 'ansi-colors';\n\nimport { loadPackageJson } from '~/generate/tsConfig';\nimport { ensureDirSync } from '~/generate/utils';\n\ntype IJobError = {\n error: Error;\n jobIndex: number;\n};\n\n/**\n * Represents a single configuration error.\n *\n * Used for reporting issues with a specific config instance.\n */\nexport class ConfigError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ConfigError';\n }\n}\n\n/**\n * Aggregates multiple config errors with their job indices for reporting.\n */\nexport class ConfigValidationError extends Error {\n readonly errors: ReadonlyArray<IJobError>;\n\n constructor(errors: Array<IJobError>) {\n super(\n `Found ${errors.length} configuration ${errors.length === 1 ? 'error' : 'errors'}.`,\n );\n this.name = 'ConfigValidationError';\n this.errors = errors;\n }\n}\n\n/**\n * Represents a runtime error originating from a specific job.\n *\n * Used for reporting job-level failures that are not config validation errors.\n */\nexport class JobError extends Error {\n readonly originalError: IJobError;\n\n constructor(message: string, error: IJobError) {\n super(message);\n this.name = 'JobError';\n this.originalError = error;\n }\n}\n\nexport class HeyApiError extends Error {\n args: ReadonlyArray<unknown>;\n event: string;\n pluginName: string;\n\n constructor({\n args,\n error,\n event,\n name,\n pluginName,\n }: {\n args: unknown[];\n error: Error;\n event: string;\n name: string;\n pluginName: string;\n }) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n super(message);\n\n this.args = args;\n this.cause = error.cause;\n this.event = event;\n this.name = name || error.name;\n this.pluginName = pluginName;\n this.stack = error.stack;\n }\n}\n\nexport const logCrashReport = (\n error: unknown,\n logsDir: string,\n): string | undefined => {\n if (error instanceof ConfigError || error instanceof ConfigValidationError) {\n return;\n }\n\n if (error instanceof JobError) {\n error = error.originalError.error;\n }\n\n const logName = `openapi-ts-error-${Date.now()}.log`;\n const fullDir = path.resolve(process.cwd(), logsDir);\n ensureDirSync(fullDir);\n const logPath = path.resolve(fullDir, logName);\n\n let logContent = `[${new Date().toISOString()}] `;\n\n if (error instanceof HeyApiError) {\n logContent += `${error.name} during event \"${error.event}\"\\n`;\n if (error.pluginName) {\n logContent += `Plugin: ${error.pluginName}\\n`;\n }\n logContent += `Arguments: ${JSON.stringify(error.args, null, 2)}\\n\\n`;\n }\n\n const message = error instanceof Error ? error.message : String(error);\n const stack = error instanceof Error ? error.stack : undefined;\n\n logContent += `Error: ${message}\\n`;\n if (stack) {\n logContent += `Stack:\\n${stack}\\n`;\n }\n\n fs.writeFileSync(logPath, logContent);\n\n return logPath;\n};\n\nexport const openGitHubIssueWithCrashReport = async (error: unknown) => {\n const packageJson = loadPackageJson();\n if (!packageJson.bugs.url) return;\n\n if (error instanceof JobError) {\n error = error.originalError.error;\n }\n\n let body = '';\n\n if (error instanceof HeyApiError) {\n if (error.pluginName) {\n body += `**Plugin**: \\`${error.pluginName}\\`\\n`;\n }\n body += `**Event**: \\`${error.event}\\`\\n`;\n body += `**Arguments**:\\n\\`\\`\\`ts\\n${JSON.stringify(error.args, null, 2)}\\n\\`\\`\\`\\n\\n`;\n }\n\n const message = error instanceof Error ? error.message : String(error);\n const stack = error instanceof Error ? error.stack : undefined;\n\n body += `**Error**: \\`${message}\\`\\n`;\n if (stack) {\n body += `\\n**Stack Trace**:\\n\\`\\`\\`\\n${stack}\\n\\`\\`\\``;\n }\n\n const search = new URLSearchParams({\n body,\n labels: 'bug 🔥',\n title: 'Crash Report',\n });\n const url = `${packageJson.bugs.url}new?${search.toString()}`;\n const open = (await import('open')).default;\n await open(url);\n};\n\nexport const printCrashReport = ({\n error,\n logPath,\n}: {\n error: unknown;\n logPath: string | undefined;\n}) => {\n if (error instanceof ConfigValidationError && error.errors.length) {\n const groupByJob = new Map<number, Array<Error>>();\n for (const { error: err, jobIndex } of error.errors) {\n if (!groupByJob.has(jobIndex)) {\n groupByJob.set(jobIndex, []);\n }\n groupByJob.get(jobIndex)!.push(err);\n }\n\n for (const [jobIndex, errors] of groupByJob.entries()) {\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n const count = errors.length;\n const baseString = colors.red(\n `Found ${count} configuration ${count === 1 ? 'error' : 'errors'}:`,\n );\n console.error(`${jobPrefix}❗️ ${baseString}`);\n errors.forEach((err, index) => {\n const itemPrefixStr = ` [${index + 1}] `;\n const itemPrefix = colors.red(itemPrefixStr);\n console.error(`${jobPrefix}${itemPrefix}${colors.white(err.message)}`);\n });\n }\n } else {\n let jobPrefix = colors.gray('[root] ');\n if (error instanceof JobError) {\n jobPrefix = colors.gray(`[Job ${error.originalError.jobIndex + 1}] `);\n error = error.originalError.error;\n }\n\n const baseString = colors.red('Failed with the message:');\n console.error(`${jobPrefix}❌ ${baseString}`);\n const itemPrefixStr = ` `;\n const itemPrefix = colors.red(itemPrefixStr);\n console.error(\n `${jobPrefix}${itemPrefix}${typeof error === 'string' ? error : error instanceof Error ? error.message : 'Unknown error'}`,\n );\n }\n\n if (logPath) {\n const jobPrefix = colors.gray('[root] ');\n console.error(\n `${jobPrefix}${colors.cyan('📄 Crash log saved to:')} ${colors.gray(logPath)}`,\n );\n }\n};\n\nexport const shouldReportCrash = async ({\n error,\n isInteractive,\n}: {\n error: unknown;\n isInteractive: boolean | undefined;\n}): Promise<boolean> => {\n if (\n !isInteractive ||\n error instanceof ConfigError ||\n error instanceof ConfigValidationError\n ) {\n return false;\n }\n\n return new Promise((resolve) => {\n const jobPrefix = colors.gray('[root] ');\n console.log(\n `${jobPrefix}${colors.yellow('📢 Open a GitHub issue with crash details? (y/N):')}`,\n );\n process.stdin.setEncoding('utf8');\n process.stdin.once('data', (data: string) => {\n resolve(data.trim().toLowerCase() === 'y');\n });\n });\n};\n","import type { Input } from '~/types/input';\n\n// Regular expression to match Hey API Registry input formats:\n// - {organization}/{project}?{queryParams}\nconst registryRegExp = /^([\\w-]+)\\/([\\w-]+)(?:\\?([\\w=&.-]*))?$/;\n\nexport const heyApiRegistryBaseUrl = 'https://get.heyapi.dev';\n\n/**\n * Creates a full Hey API Registry URL.\n *\n * @param organization - Hey API organization slug\n * @param project - Hey API project slug\n * @param queryParams - Optional query parameters\n * @returns The full Hey API registry URL.\n */\nexport const getRegistryUrl = (\n organization: string,\n project: string,\n queryParams?: string,\n): string =>\n `${heyApiRegistryBaseUrl}/${organization}/${project}${queryParams ? `?${queryParams}` : ''}`;\n\nexport interface Parsed {\n organization: string;\n project: string;\n queryParams?: string;\n}\n\n/**\n * Parses a Hey API input string and extracts components.\n *\n * @param input - Hey API configuration input\n * @returns Parsed Hey API input components\n * @throws Error if the input format is invalid\n */\nexport const parseShorthand = (\n input: Input & {\n path: string;\n },\n): Parsed => {\n let organization = input.organization;\n let project = input.project;\n let queryParams: string | undefined;\n\n if (input.path) {\n const match = input.path.match(registryRegExp);\n\n if (!match) {\n throw new Error(\n `Invalid Hey API shorthand format. Expected \"organization/project?queryParams\" or \"organization/project\", received: ${input.path}`,\n );\n }\n\n organization = match[1];\n project = match[2];\n queryParams = match[3];\n }\n\n if (!organization) {\n throw new Error('The Hey API organization cannot be empty.');\n }\n\n if (!project) {\n throw new Error('The Hey API project cannot be empty.');\n }\n\n const result: Parsed = {\n organization,\n project,\n queryParams,\n };\n\n return result;\n};\n\n/**\n * Transforms a Hey API shorthand string to the corresponding API URL.\n *\n * @param input - Hey API configuration input\n * @returns The Hey API Registry URL\n */\nexport const inputToHeyApiPath = (\n input: Input & {\n path: string;\n },\n): Partial<Input> => {\n const parsed = parseShorthand(input);\n return {\n path: getRegistryUrl(\n parsed.organization,\n parsed.project,\n parsed.queryParams,\n ),\n registry: 'hey-api',\n };\n};\n","import type { Input } from '~/types/input';\n\n// Regular expression to match ReadMe API Registry input formats:\n// - @{organization}/{project}#{uuid}\n// - {uuid}\nconst registryRegExp = /^(@([\\w-]+)\\/([\\w\\-.]+)#)?([\\w-]+)$/;\n\n/**\n * Creates a full ReadMe API Registry URL.\n *\n * @param uuid - ReadMe UUID\n * @returns The full ReadMe API registry URL.\n */\nexport const getRegistryUrl = (uuid: string): string =>\n `https://dash.readme.com/api/v1/api-registry/${uuid}`;\n\nexport interface Parsed {\n organization?: string;\n project?: string;\n uuid: string;\n}\n\nconst namespace = 'readme';\n\n/**\n * Parses a ReadMe input string and extracts components.\n *\n * @param shorthand - ReadMe format string (@org/project#uuid or uuid)\n * @returns Parsed ReadMe input components\n * @throws Error if the input format is invalid\n */\nexport const parseShorthand = (shorthand: string): Parsed => {\n const match = shorthand.match(registryRegExp);\n\n if (!match) {\n throw new Error(\n `Invalid ReadMe shorthand format. Expected \"${namespace}:@organization/project#uuid\" or \"${namespace}:uuid\", received: ${namespace}:${shorthand}`,\n );\n }\n\n const [, , organization, project, uuid] = match;\n\n if (!uuid) {\n throw new Error('The ReadMe UUID cannot be empty.');\n }\n\n const result: Parsed = {\n organization,\n project,\n uuid,\n };\n\n return result;\n};\n\n/**\n * Transforms a ReadMe shorthand string to the corresponding API URL.\n *\n * @param input - ReadMe format string\n * @returns The ReadMe API Registry URL\n */\nexport const inputToReadmePath = (input: string): Partial<Input> => {\n const shorthand = input.slice(`${namespace}:`.length);\n const parsed = parseShorthand(shorthand);\n return {\n ...parsed,\n path: getRegistryUrl(parsed.uuid),\n registry: 'readme',\n };\n};\n","import type { Input } from '~/types/input';\n\n// Regular expression to match Scalar API Registry input formats:\n// - @{organization}/{project}\nconst registryRegExp = /^(@[\\w-]+)\\/([\\w.-]+)$/;\n\n/**\n * Creates a full Scalar API Registry URL.\n *\n * @param organization - Scalar organization slug\n * @param project - Scalar project slug\n * @returns The full Scalar API registry URL.\n */\nexport const getRegistryUrl = (organization: string, project: string): string =>\n `https://registry.scalar.com/${organization}/apis/${project}/latest?format=json`;\n\nexport interface Parsed {\n organization: string;\n project: string;\n}\n\nconst namespace = 'scalar';\n\n/**\n * Parses a Scalar input string and extracts components.\n *\n * @param shorthand - Scalar format string (@org/project)\n * @returns Parsed Scalar input components\n * @throws Error if the input format is invalid\n */\nexport const parseShorthand = (shorthand: string): Parsed => {\n const match = shorthand.match(registryRegExp);\n\n if (!match) {\n throw new Error(\n `Invalid Scalar shorthand format. Expected \"${namespace}:@organization/project\", received: ${namespace}:${shorthand}`,\n );\n }\n\n const [, organization, project] = match;\n\n if (!organization) {\n throw new Error('The Scalar organization cannot be empty.');\n }\n\n if (!project) {\n throw new Error('The Scalar project cannot be empty.');\n }\n\n const result: Parsed = {\n organization,\n project,\n };\n\n return result;\n};\n\n/**\n * Transforms a Scalar shorthand string to the corresponding API URL.\n *\n * @param input - Scalar format string\n * @returns The Scalar API Registry URL\n */\nexport const inputToScalarPath = (input: string): Partial<Input> => {\n const shorthand = input.slice(`${namespace}:`.length);\n const parsed = parseShorthand(shorthand);\n return {\n ...parsed,\n path: getRegistryUrl(parsed.organization, parsed.project),\n registry: 'scalar',\n };\n};\n","import type { Input } from '~/types/input';\n\nimport { heyApiRegistryBaseUrl, inputToHeyApiPath } from './heyApi';\nimport { inputToReadmePath } from './readme';\nimport { inputToScalarPath } from './scalar';\n\nexport const inputToApiRegistry = (\n input: Input & {\n path: string;\n },\n) => {\n if (input.path.startsWith('readme:')) {\n Object.assign(input, inputToReadmePath(input.path));\n return;\n }\n\n if (input.path.startsWith('scalar:')) {\n Object.assign(input, inputToScalarPath(input.path));\n return;\n }\n\n if (input.path.startsWith('.')) {\n return;\n }\n\n if (input.path.startsWith(heyApiRegistryBaseUrl)) {\n input.path = input.path.slice(heyApiRegistryBaseUrl.length + 1);\n Object.assign(input, inputToHeyApiPath(input as Input & { path: string }));\n return;\n }\n\n const parts = input.path.split('/');\n if (parts.length === 2 && parts.filter(Boolean).length === 2) {\n Object.assign(input, inputToHeyApiPath(input as Input & { path: string }));\n return;\n }\n};\n","import type { Config, UserConfig } from '~/types/config';\nimport type { Input, Watch } from '~/types/input';\nimport { inputToApiRegistry } from '~/utils/input';\nimport { heyApiRegistryBaseUrl } from '~/utils/input/heyApi';\n\nconst defaultWatch: Watch = {\n enabled: false,\n interval: 1_000,\n timeout: 60_000,\n};\n\n// watch only remote files\nconst getWatch = (input: Pick<Input, 'path' | 'watch'>): Watch => {\n let watch = { ...defaultWatch };\n\n // we cannot watch spec passed as an object\n if (typeof input.path !== 'string') {\n return watch;\n }\n\n if (typeof input.watch === 'boolean') {\n watch.enabled = input.watch;\n } else if (typeof input.watch === 'number') {\n watch.enabled = true;\n watch.interval = input.watch;\n } else if (input.watch) {\n watch = {\n ...watch,\n ...input.watch,\n };\n }\n\n return watch;\n};\n\nexport const getInput = (userConfig: UserConfig): Config['input'] => {\n const userInputs =\n userConfig.input instanceof Array ? userConfig.input : [userConfig.input];\n\n const inputs: Array<Input> = [];\n\n for (const userInput of userInputs) {\n let input: Input = {\n path: '',\n watch: defaultWatch,\n };\n\n if (typeof userInput === 'string') {\n input.path = userInput;\n } else if (\n userInput &&\n (userInput.path !== undefined || userInput.organization !== undefined)\n ) {\n // @ts-expect-error\n input = {\n ...input,\n path: heyApiRegistryBaseUrl,\n ...userInput,\n };\n\n if (input.watch !== undefined) {\n input.watch = getWatch(input);\n }\n } else {\n input = {\n ...input,\n path: userInput,\n };\n }\n\n if (typeof input.path === 'string') {\n inputToApiRegistry(input as Input & { path: string });\n }\n\n if (\n userConfig.watch !== undefined &&\n input.watch.enabled === defaultWatch.enabled &&\n input.watch.interval === defaultWatch.interval &&\n input.watch.timeout === defaultWatch.timeout\n ) {\n input.watch = getWatch({\n path: input.path,\n // @ts-expect-error\n watch: userConfig.watch,\n });\n }\n\n if (input.path) {\n inputs.push(input);\n }\n }\n\n return inputs;\n};\n","import type { Config, UserConfig } from '~/types/config';\n\nexport const getLogs = (\n userConfig: Pick<UserConfig, 'logs'> | undefined,\n): Config['logs'] => {\n let logs: Config['logs'] = {\n file: true,\n level: 'info',\n path: process.cwd(),\n };\n\n if (typeof userConfig?.logs === 'string') {\n logs.path = userConfig.logs;\n } else {\n logs = {\n ...logs,\n ...userConfig?.logs,\n };\n }\n\n return logs;\n};\n","import type { UserConfig } from '~/types/config';\n\nconst mergeObjects = (\n objA: Record<string, unknown> | undefined,\n objB: Record<string, unknown> | undefined,\n): Record<string, unknown> => {\n const a = objA || {};\n const b = objB || {};\n return {\n ...a,\n ...b,\n };\n};\n\nexport const mergeConfigs = (\n configA: UserConfig | undefined,\n configB: UserConfig | undefined,\n): UserConfig => {\n const a: Partial<UserConfig> = configA || {};\n const b: Partial<UserConfig> = configB || {};\n const merged: UserConfig = {\n ...(a as UserConfig),\n ...(b as UserConfig),\n };\n if (typeof merged.logs === 'object') {\n merged.logs = mergeObjects(\n a.logs as Record<string, unknown>,\n b.logs as Record<string, unknown>,\n );\n }\n return merged;\n};\n","type ObjectType<T> =\n Extract<T, Record<string, any>> extends never\n ? Record<string, any>\n : Extract<T, Record<string, any>>;\n\ntype NotArray<T> = T extends any[] ? never : T;\ntype NotFunction<T> = T extends (...args: any[]) => any ? never : T;\ntype PlainObject<T> = T extends object\n ? NotFunction<T> extends never\n ? never\n : NotArray<T> extends never\n ? never\n : T\n : never;\n\ntype MappersType<T> = {\n boolean: T extends boolean\n ? (value: boolean) => Partial<ObjectType<T>>\n : never;\n function: T extends (...args: any[]) => any\n ? (value: (...args: any[]) => any) => Partial<ObjectType<T>>\n : never;\n number: T extends number ? (value: number) => Partial<ObjectType<T>> : never;\n object?: PlainObject<T> extends never\n ? never\n : (\n value: Partial<PlainObject<T>>,\n defaultValue: PlainObject<T>,\n ) => Partial<ObjectType<T>>;\n string: T extends string ? (value: string) => Partial<ObjectType<T>> : never;\n} extends infer U\n ? { [K in keyof U as U[K] extends never ? never : K]: U[K] }\n : never;\n\ntype IsObjectOnly<T> = T extends Record<string, any> | undefined\n ? Extract<\n T,\n string | boolean | number | ((...args: any[]) => any)\n > extends never\n ? true\n : false\n : false;\n\nexport type ValueToObject = <\n T extends\n | undefined\n | string\n | boolean\n | number\n | ((...args: any[]) => any)\n | Record<string, any>,\n>(\n args: {\n defaultValue: ObjectType<T>;\n value: T;\n } & (IsObjectOnly<T> extends true\n ? {\n mappers?: MappersType<T>;\n }\n : {\n mappers: MappersType<T>;\n }),\n) => PlainObject<T>;\n\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n typeof value !== 'function';\n\nconst mergeResult = <T>(\n result: ObjectType<T>,\n mapped: Record<string, any>,\n): ObjectType<T> => {\n for (const [key, value] of Object.entries(mapped)) {\n if (value !== undefined && value !== '') {\n (result as Record<string, any>)[key] = value;\n }\n }\n return result;\n};\n\nexport const valueToObject: ValueToObject = ({\n defaultValue,\n mappers,\n value,\n}) => {\n let result = { ...defaultValue };\n\n switch (typeof value) {\n case 'boolean':\n if (mappers && 'boolean' in mappers) {\n const mapper = mappers.boolean as (\n value: boolean,\n ) => Record<string, any>;\n result = mergeResult(result, mapper(value));\n }\n break;\n case 'function':\n if (mappers && 'function' in mappers) {\n const mapper = mappers.function as (\n value: (...args: any[]) => any,\n ) => Record<string, any>;\n result = mergeResult(result, mapper(value as (...args: any[]) => any));\n }\n break;\n case 'number':\n if (mappers && 'number' in mappers) {\n const mapper = mappers.number as (value: number) => Record<string, any>;\n result = mergeResult(result, mapper(value));\n }\n break;\n case 'string':\n if (mappers && 'string' in mappers) {\n const mapper = mappers.string as (value: string) => Record<string, any>;\n result = mergeResult(result, mapper(value));\n }\n break;\n case 'object':\n if (isPlainObject(value)) {\n if (\n mappers &&\n 'object' in mappers &&\n typeof mappers.object === 'function'\n ) {\n const mapper = mappers.object as (\n value: Record<string, any>,\n defaultValue: ObjectType<any>,\n ) => Partial<ObjectType<any>>;\n result = mergeResult(result, mapper(value, defaultValue));\n } else {\n result = mergeResult(result, value);\n }\n }\n break;\n }\n\n return result as any;\n};\n","import ts from 'typescript';\n\nimport { findTsConfigPath, loadTsConfig } from '~/generate/tsConfig';\nimport type { Config, UserConfig } from '~/types/config';\n\nimport { valueToObject } from './utils/config';\n\nexport const getOutput = (userConfig: UserConfig): Config['output'] => {\n if (userConfig.output instanceof Array) {\n throw new Error(\n 'Unexpected array of outputs in user configuration. This should have been expanded already.',\n );\n }\n\n const output = valueToObject({\n defaultValue: {\n clean: true,\n fileName: {\n case: 'preserve',\n name: '{{name}}',\n suffix: '.gen',\n },\n format: null,\n indexFile: true,\n lint: null,\n path: '',\n },\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n fileName: valueToObject({\n defaultValue: {\n ...(defaultValue.fileName as Extract<\n typeof defaultValue.fileName,\n Record<string, unknown>\n >),\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: fields.fileName,\n }),\n }),\n string: (path) => ({ path }),\n },\n value: userConfig.output,\n }) as Config['output'];\n output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath));\n if (\n output.importFileExtension === undefined &&\n output.tsConfig?.options.moduleResolution ===\n ts.ModuleResolutionKind.NodeNext\n ) {\n output.importFileExtension = '.js';\n }\n if (\n output.importFileExtension &&\n !output.importFileExtension.startsWith('.')\n ) {\n output.importFileExtension = `.${output.importFileExtension}`;\n }\n return output;\n};\n","import fs from 'node:fs';\nimport path from 'node:path';\n\n/**\n * Finds and reads the project's package.json file by searching upwards from the config file location,\n * or from process.cwd() if no config file is provided.\n * This ensures we get the correct dependencies even in monorepo setups.\n *\n * @param configFilePath - The path to the configuration file (e.g., openapi-ts.config.ts)\n * @returns An object containing all project dependencies (dependencies, devDependencies, peerDependencies, optionalDependencies)\n */\nexport const getProjectDependencies = (\n configFilePath?: string,\n): Record<string, string> => {\n let currentDir = configFilePath\n ? path.dirname(configFilePath)\n : process.cwd();\n\n while (currentDir !== path.dirname(currentDir)) {\n const packageJsonPath = path.join(currentDir, 'package.json');\n\n if (fs.existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, 'utf8'),\n );\n return {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n ...packageJson.peerDependencies,\n ...packageJson.optionalDependencies,\n };\n } catch {\n // Silently ignore JSON parsing errors and continue searching\n }\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n break;\n }\n currentDir = parentDir;\n }\n\n return {};\n};\n","import type { Config, UserConfig } from '~/types/config';\n\nimport { valueToObject } from './utils/config';\n\nexport const defaultPaginationKeywords = [\n 'after',\n 'before',\n 'cursor',\n 'offset',\n 'page',\n 'start',\n] as const;\n\nexport const getParser = (userConfig: UserConfig): Config['parser'] => {\n const parser = valueToObject({\n defaultValue: {\n hooks: {},\n pagination: {\n keywords: defaultPaginationKeywords,\n },\n transforms: {\n enums: {\n case: 'PascalCase',\n enabled: false,\n mode: 'root',\n name: '{{name}}Enum',\n },\n propertiesRequiredByDefault: false,\n readWrite: {\n enabled: true,\n requests: {\n case: 'preserve',\n name: '{{name}}Writable',\n },\n responses: {\n case: 'preserve',\n name: '{{name}}',\n },\n },\n },\n validate_EXPERIMENTAL: false,\n },\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n pagination: valueToObject({\n defaultValue: {\n ...(defaultValue.pagination as Extract<\n typeof defaultValue.pagination,\n Record<string, unknown>\n >),\n },\n value: fields.pagination,\n }),\n transforms: valueToObject({\n defaultValue: {\n ...(defaultValue.transforms as Extract<\n typeof defaultValue.transforms,\n Record<string, unknown>\n >),\n },\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n enums: valueToObject({\n defaultValue: {\n ...(defaultValue.enums as Extract<\n typeof defaultValue.enums,\n Record<string, unknown>\n >),\n enabled:\n fields.enums !== undefined\n ? Boolean(fields.enums)\n : (\n defaultValue.enums as Extract<\n typeof defaultValue.enums,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n string: (mode) => ({ mode }),\n },\n value: fields.enums,\n }),\n propertiesRequiredByDefault:\n fields.propertiesRequiredByDefault !== undefined\n ? fields.propertiesRequiredByDefault\n : defaultValue.propertiesRequiredByDefault,\n readWrite: valueToObject({\n defaultValue: {\n ...(defaultValue.readWrite as Extract<\n typeof defaultValue.readWrite,\n Record<string, unknown>\n >),\n enabled:\n fields.readWrite !== undefined\n ? Boolean(fields.readWrite)\n : (\n defaultValue.readWrite as Extract<\n typeof defaultValue.readWrite,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n object: (fields, defaultValue) => ({\n ...fields,\n requests: valueToObject({\n defaultValue: {\n ...(defaultValue.requests as Extract<\n typeof defaultValue.requests,\n Record<string, unknown>\n >),\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: fields.requests,\n }),\n responses: valueToObject({\n defaultValue: {\n ...(defaultValue.responses as Extract<\n typeof defaultValue.responses,\n Record<string, unknown>\n >),\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: fields.responses,\n }),\n }),\n },\n value: fields.readWrite,\n }),\n }),\n },\n value: fields.transforms,\n }),\n validate_EXPERIMENTAL:\n fields.validate_EXPERIMENTAL === true\n ? 'warn'\n : fields.validate_EXPERIMENTAL,\n }),\n },\n value: userConfig.parser,\n });\n return parser as Config['parser'];\n};\n","import type { Plugin } from '~/plugins';\n\nexport const definePluginConfig =\n <T extends Plugin.Types>(defaultConfig: Plugin.Config<T>) =>\n (\n userConfig?: Omit<Plugin.UserConfig<T['config']>, 'name'>,\n ): Omit<Plugin.Config<T>, 'name'> & {\n /**\n * Cast name to `any` so it doesn't throw type error in `plugins` array.\n * We could allow any `string` as plugin `name` in the object syntax, but\n * that TypeScript trick would cause all string methods to appear as\n * suggested auto completions, which is undesirable.\n */\n name: any;\n } => ({\n ...defaultConfig,\n config: {\n ...defaultConfig.config,\n ...userConfig,\n },\n });\n\n/**\n * Reusable mappers for `enabled` and `name` fields.\n */\nexport const mappers = {\n boolean: (enabled: boolean) => ({ enabled }),\n function: (name: (...args: any[]) => any) => ({ name }),\n string: (name: string) => ({ name }),\n} as const;\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import type { StringCase } from '~/types/case';\n\nconst uppercaseRegExp = /[\\p{Lu}]/u;\nconst lowercaseRegExp = /[\\p{Ll}]/u;\nconst identifierRegExp = /([\\p{Alpha}\\p{N}_]|$)/u;\nconst separatorsRegExp = /[_.\\- `\\\\[\\]{}\\\\/]+/;\n\nconst leadingSeparatorsRegExp = new RegExp(`^${separatorsRegExp.source}`);\nconst separatorsAndIdentifierRegExp = new RegExp(\n `${separatorsRegExp.source}${identifierRegExp.source}`,\n 'gu',\n);\nconst numbersAndIdentifierRegExp = new RegExp(\n `\\\\d+${identifierRegExp.source}`,\n 'gu',\n);\n\nconst preserveCase = ({\n case: _case,\n string,\n}: {\n readonly case: StringCase;\n string: string;\n}) => {\n let isLastCharLower = false;\n let isLastCharUpper = false;\n let isLastLastCharUpper = false;\n let isLastLastCharPreserved = false;\n\n const separator =\n _case === 'snake_case' || _case === 'SCREAMING_SNAKE_CASE' ? '_' : '-';\n\n for (let index = 0; index < string.length; index++) {\n const character = string[index]!;\n isLastLastCharPreserved =\n index > 2 ? string[index - 3] === separator : true;\n\n let nextIndex = index + 1;\n let nextCharacter = string[nextIndex];\n separatorsRegExp.lastIndex = 0;\n while (nextCharacter && separatorsRegExp.test(nextCharacter)) {\n nextIndex += 1;\n nextCharacter = string[nextIndex];\n }\n const isSeparatorBeforeNextCharacter = nextIndex !== index + 1;\n\n lowercaseRegExp.lastIndex = 0;\n uppercaseRegExp.lastIndex = 0;\n if (\n uppercaseRegExp.test(character) &&\n (isLastCharLower ||\n (nextCharacter &&\n !isSeparatorBeforeNextCharacter &&\n nextCharacter !== 's' &&\n lowercaseRegExp.test(nextCharacter)))\n ) {\n // insert separator behind character\n string = `${string.slice(0, index)}${separator}${string.slice(index)}`;\n index++;\n isLastLastCharUpper = isLastCharUpper;\n isLastCharLower = false;\n isLastCharUpper = true;\n } else if (\n isLastCharUpper &&\n isLastLastCharUpper &&\n lowercaseRegExp.test(character) &&\n !isLastLastCharPreserved &&\n // naive detection of plurals\n !(\n character === 's' &&\n (!nextCharacter || nextCharacter.toLocaleLowerCase() !== nextCharacter)\n )\n ) {\n // insert separator 2 characters behind\n string = `${string.slice(0, index - 1)}${separator}${string.slice(index - 1)}`;\n isLastLastCharUpper = isLastCharUpper;\n isLastCharLower = true;\n isLastCharUpper = false;\n } else {\n const characterLower = character.toLocaleLowerCase();\n const characterUpper = character.toLocaleUpperCase();\n isLastLastCharUpper = isLastCharUpper;\n isLastCharLower =\n characterLower === character && characterUpper !== character;\n isLastCharUpper =\n characterUpper === character && characterLower !== character;\n }\n }\n\n return string;\n};\n\nexport const stringCase = ({\n case: _case,\n stripLeadingSeparators = true,\n value,\n}: {\n readonly case: StringCase | undefined;\n /**\n * If leading separators have a semantic meaning, we might not want to\n * remove them.\n */\n stripLeadingSeparators?: boolean;\n value: string;\n}): string => {\n let result = value.trim();\n\n if (!result.length) {\n return '';\n }\n\n if (!_case || _case === 'preserve') {\n return result;\n }\n\n if (result.length === 1) {\n separatorsRegExp.lastIndex = 0;\n if (separatorsRegExp.test(result)) {\n return '';\n }\n\n return _case === 'PascalCase' || _case === 'SCREAMING_SNAKE_CASE'\n ? result.toLocaleUpperCase()\n : result.toLocaleLowerCase();\n }\n\n const hasUpperCase = result !== result.toLocaleLowerCase();\n\n if (hasUpperCase) {\n result = preserveCase({ case: _case, string: result });\n }\n\n if (stripLeadingSeparators || result[0] !== value[0]) {\n result = result.replace(leadingSeparatorsRegExp, '');\n }\n\n result =\n _case === 'SCREAMING_SNAKE_CASE'\n ? result.toLocaleUpperCase()\n : result.toLocaleLowerCase();\n\n if (_case === 'PascalCase') {\n result = `${result.charAt(0).toLocaleUpperCase()}${result.slice(1)}`;\n }\n\n if (_case === 'snake_case' || _case === 'SCREAMING_SNAKE_CASE') {\n result = result.replaceAll(\n separatorsAndIdentifierRegExp,\n (match, identifier, offset) => {\n if (offset === 0 && !stripLeadingSeparators) {\n return match;\n }\n return `_${identifier}`;\n },\n );\n\n if (result[result.length - 1] === '_') {\n // strip trailing underscore\n result = result.slice(0, result.length - 1);\n }\n } else {\n separatorsAndIdentifierRegExp.lastIndex = 0;\n numbersAndIdentifierRegExp.lastIndex = 0;\n\n result = result.replaceAll(\n numbersAndIdentifierRegExp,\n (match, _, offset) => {\n if (['_', '-', '.'].includes(result.charAt(offset + match.length))) {\n return match;\n }\n\n return match.toLocaleUpperCase();\n },\n );\n\n result = result.replaceAll(\n separatorsAndIdentifierRegExp,\n (match, identifier, offset) => {\n if (\n offset === 0 &&\n !stripLeadingSeparators &&\n match[0] &&\n value.startsWith(match[0])\n ) {\n return match;\n }\n return identifier.toLocaleUpperCase();\n },\n );\n }\n\n return result;\n};\n","import { stringCase } from '~/utils/stringCase';\n\nimport type { StringCase, StringName } from '../../../types/case';\n\nexport const buildName = ({\n config,\n name,\n}: {\n config: {\n case: StringCase;\n name?: StringName;\n };\n name: string;\n}): string => {\n if (typeof config.name === 'function') {\n name = config.name(name);\n } else if (config.name) {\n const separator = config.case === 'preserve' ? '' : '-';\n name = config.name.replace('{{name}}', `${separator}${name}${separator}`);\n }\n\n return stringCase({ case: config.case, value: name });\n};\n","import type { Context } from './context';\nimport type { Pagination } from './pagination';\nimport type { IR } from './types';\n\nconst getPaginationSchema = ({\n context,\n parameter,\n}: {\n context: Context;\n parameter: IR.ParameterObject;\n}): IR.SchemaObject | undefined => {\n if (!parameter.pagination) {\n return;\n }\n\n if (parameter.pagination === true) {\n return parameter.schema;\n }\n\n let schema = parameter.schema;\n if (schema.$ref) {\n schema = context.resolveIrRef<IR.SchemaObject>(schema.$ref);\n }\n\n return schema.properties![parameter.pagination]!;\n};\n\nexport const hasParameterGroupObjectRequired = (\n parameterGroup?: Record<string, IR.ParameterObject>,\n): boolean => {\n for (const name in parameterGroup) {\n if (parameterGroup[name]!.required) {\n return true;\n }\n }\n\n return false;\n};\n\nexport const hasParametersObjectRequired = (\n parameters: IR.ParametersObject | undefined,\n): boolean => {\n if (!parameters) {\n return false;\n }\n\n if (hasParameterGroupObjectRequired(parameters.cookie)) {\n return true;\n }\n\n if (hasParameterGroupObjectRequired(parameters.header)) {\n return true;\n }\n\n if (hasParameterGroupObjectRequired(parameters.path)) {\n return true;\n }\n\n if (hasParameterGroupObjectRequired(parameters.query)) {\n return true;\n }\n\n return false;\n};\n\nexport const parameterWithPagination = ({\n context,\n parameters,\n}: {\n context: Context;\n parameters: IR.ParametersObject | undefined;\n}): Pagination | undefined => {\n if (!parameters) {\n return;\n }\n\n for (const name in parameters.cookie) {\n const parameter = parameters.cookie[name]!;\n if (parameter.pagination) {\n return {\n in: parameter.location,\n name:\n parameter.pagination === true\n ? parameter.name\n : `${parameter.name}.${parameter.pagination}`,\n schema: getPaginationSchema({ context, parameter })!,\n };\n }\n }\n\n for (const name in parameters.header) {\n const parameter = parameters.header[name]!;\n if (parameter.pagination) {\n return {\n in: parameter.location,\n name:\n parameter.pagination === true\n ? parameter.name\n : `${parameter.name}.${parameter.pagination}`,\n schema: getPaginationSchema({ context, parameter })!,\n };\n }\n }\n\n for (const name in parameters.path) {\n const parameter = parameters.path[name]!;\n if (parameter.pagination) {\n return {\n in: parameter.location,\n name:\n parameter.pagination === true\n ? parameter.name\n : `${parameter.name}.${parameter.pagination}`,\n schema: getPaginationSchema({ context, parameter })!,\n };\n }\n }\n\n for (const name in parameters.query) {\n const parameter = parameters.query[name]!;\n if (parameter.pagination) {\n return {\n in: parameter.location,\n name:\n parameter.pagination === true\n ? parameter.name\n : `${parameter.name}.${parameter.pagination}`,\n schema: getPaginationSchema({ context, parameter })!,\n };\n }\n }\n\n return;\n};\n","import type { IR } from './types';\n\n/**\n * Ensure we don't produce redundant types, e.g. string | string.\n */\nexport const deduplicateSchema = <T extends IR.SchemaObject>({\n detectFormat = true,\n schema,\n}: {\n detectFormat?: boolean;\n schema: T;\n}): T => {\n if (!schema.items) {\n return schema;\n }\n\n const uniqueItems: Array<IR.SchemaObject> = [];\n const typeIds: Array<string> = [];\n\n for (const item of schema.items) {\n // skip nested schemas for now, handle if necessary\n if ((!item.type && item.items) || schema.type === 'tuple') {\n uniqueItems.push(item);\n continue;\n }\n\n if (\n // no `type` might still include `$ref` or `const`\n !item.type ||\n item.type === 'boolean' ||\n item.type === 'integer' ||\n item.type === 'null' ||\n item.type === 'number' ||\n item.type === 'string' ||\n item.type === 'unknown' ||\n item.type === 'void'\n ) {\n // const needs namespace to handle empty string values, otherwise\n // fallback would equal an actual value and we would skip an item\n const constant = item.const !== undefined ? `const-${item.const}` : '';\n const format =\n item.format !== undefined && detectFormat\n ? `format-${item.format}`\n : '';\n\n // Include validation constraints in the type ID to avoid incorrect deduplication\n const constraints = [\n item.minLength !== undefined ? `minLength-${item.minLength}` : '',\n item.maxLength !== undefined ? `maxLength-${item.maxLength}` : '',\n item.minimum !== undefined ? `minimum-${item.minimum}` : '',\n item.maximum !== undefined ? `maximum-${item.maximum}` : '',\n item.exclusiveMinimum !== undefined\n ? `exclusiveMinimum-${item.exclusiveMinimum}`\n : '',\n item.exclusiveMaximum !== undefined\n ? `exclusiveMaximum-${item.exclusiveMaximum}`\n : '',\n item.minItems !== undefined ? `minItems-${item.minItems}` : '',\n item.maxItems !== undefined ? `maxItems-${item.maxItems}` : '',\n item.pattern !== undefined ? `pattern-${item.pattern}` : '',\n ].join('');\n\n const typeId = `${item.$ref ?? ''}${item.type ?? ''}${constant}${format}${constraints}`;\n if (!typeIds.includes(typeId)) {\n typeIds.push(typeId);\n uniqueItems.push(item);\n }\n continue;\n }\n\n uniqueItems.push(item);\n }\n\n let result = { ...schema };\n result.items = uniqueItems;\n\n if (\n result.items.length <= 1 &&\n result.type !== 'array' &&\n result.type !== 'enum' &&\n result.type !== 'tuple'\n ) {\n // bring the only item up to clean up the schema\n const liftedSchema = result.items[0];\n delete result.logicalOperator;\n delete result.items;\n result = {\n ...result,\n ...liftedSchema,\n };\n }\n\n // exclude unknown if it's the only type left\n if (result.type === 'unknown') {\n return {} as T;\n }\n\n return result;\n};\n","import type { IR } from './types';\n\n/**\n * Simply adds `items` to the schema. Also handles setting the logical operator\n * and avoids setting it for a single item or tuples.\n */\nexport const addItemsToSchema = ({\n items,\n logicalOperator = 'or',\n mutateSchemaOneItem = false,\n schema,\n}: {\n items: Array<IR.SchemaObject>;\n logicalOperator?: IR.SchemaObject['logicalOperator'];\n mutateSchemaOneItem?: boolean;\n schema: IR.SchemaObject;\n}) => {\n if (!items.length) {\n return schema;\n }\n\n if (schema.type === 'tuple') {\n schema.items = items;\n return schema;\n }\n\n if (items.length !== 1) {\n schema.items = items;\n schema.logicalOperator = logicalOperator;\n return schema;\n }\n\n if (mutateSchemaOneItem) {\n // bring composition up to avoid extraneous brackets\n schema = {\n ...schema,\n ...items[0],\n };\n return schema;\n }\n\n schema.items = items;\n return schema;\n};\n","import type { Context } from './context';\nimport type { Pagination } from './pagination';\nimport {\n hasParametersObjectRequired,\n parameterWithPagination,\n} from './parameter';\nimport { deduplicateSchema } from './schema';\nimport type { IR } from './types';\nimport { addItemsToSchema } from './utils';\n\nexport const hasOperationDataRequired = (\n operation: IR.OperationObject,\n): boolean => {\n if (hasParametersObjectRequired(operation.parameters)) {\n return true;\n }\n\n if (operation.body?.required) {\n return true;\n }\n\n return false;\n};\n\nexport const createOperationKey = ({\n method,\n path,\n}: {\n method: string;\n path: string;\n}) => `${method.toUpperCase()} ${path}`;\n\nexport const operationPagination = ({\n context,\n operation,\n}: {\n context: Context;\n operation: IR.OperationObject;\n}): Pagination | undefined => {\n const body = operation.body;\n\n if (!body || !body.pagination) {\n return parameterWithPagination({\n context,\n parameters: operation.parameters,\n });\n }\n\n if (body.pagination === true) {\n return {\n in: 'body',\n name: 'body',\n schema: body.schema,\n };\n }\n\n const schema = body.schema;\n const resolvedSchema = schema.$ref\n ? context.resolveIrRef<IR.RequestBodyObject | IR.SchemaObject>(schema.$ref)\n : schema;\n\n const finalSchema =\n 'schema' in resolvedSchema ? resolvedSchema.schema : resolvedSchema;\n const paginationProp = finalSchema?.properties?.[body.pagination];\n\n if (!paginationProp) {\n return parameterWithPagination({\n context,\n parameters: operation.parameters,\n });\n }\n\n return {\n in: 'body',\n name: body.pagination,\n schema: paginationProp,\n };\n};\n\ntype StatusGroup = '1XX' | '2XX' | '3XX' | '4XX' | '5XX' | 'default';\n\nexport const statusCodeToGroup = ({\n statusCode,\n}: {\n statusCode: string;\n}): StatusGroup => {\n switch (statusCode) {\n case '1XX':\n return '1XX';\n case '2XX':\n return '2XX';\n case '3XX':\n return '3XX';\n case '4XX':\n return '4XX';\n case '5XX':\n return '5XX';\n case 'default':\n return 'default';\n default:\n return `${statusCode[0]}XX` as StatusGroup;\n }\n};\n\ninterface OperationResponsesMap {\n /**\n * A deduplicated union of all error types. Unknown types are omitted.\n */\n error?: IR.SchemaObject;\n /**\n * An object containing a map of status codes for each error type.\n */\n errors?: IR.SchemaObject;\n /**\n * A deduplicated union of all response types. Unknown types are omitted.\n */\n response?: IR.SchemaObject;\n /**\n * An object containing a map of status codes for each response type.\n */\n responses?: IR.SchemaObject;\n}\n\nexport const operationResponsesMap = (\n operation: IR.OperationObject,\n): OperationResponsesMap => {\n const result: OperationResponsesMap = {};\n\n if (!operation.responses) {\n return result;\n }\n\n const errors: Omit<IR.SchemaObject, 'properties'> &\n Pick<Required<IR.SchemaObject>, 'properties'> = {\n properties: {},\n type: 'object',\n };\n\n const responses: Omit<IR.SchemaObject, 'properties'> &\n Pick<Required<IR.SchemaObject>, 'properties'> = {\n properties: {},\n type: 'object',\n };\n\n // store default response to be evaluated last\n let defaultResponse: IR.ResponseObject | undefined;\n\n for (const name in operation.responses) {\n const response = operation.responses[name]!;\n\n switch (statusCodeToGroup({ statusCode: name })) {\n case '1XX':\n case '3XX':\n // TODO: parser - handle informational and redirection status codes\n break;\n case '2XX':\n responses.properties[name] = response.schema;\n break;\n case '4XX':\n case '5XX':\n errors.properties[name] = response.schema;\n break;\n case 'default':\n defaultResponse = response;\n break;\n }\n }\n\n // infer default response type\n if (defaultResponse) {\n let inferred = false;\n\n // assume default is intended for success if none exists yet\n if (!Object.keys(responses.properties).length) {\n responses.properties.default = defaultResponse.schema;\n inferred = true;\n }\n\n const description = (\n defaultResponse.schema.description ?? ''\n ).toLocaleLowerCase();\n const $ref = (defaultResponse.schema.$ref ?? '').toLocaleLowerCase();\n\n // TODO: parser - this could be rewritten using regular expressions\n const successKeywords = ['success'];\n if (\n successKeywords.some(\n (keyword) => description.includes(keyword) || $ref.includes(keyword),\n )\n ) {\n responses.properties.default = defaultResponse.schema;\n inferred = true;\n }\n\n // TODO: parser - this could be rewritten using regular expressions\n const errorKeywords = ['error', 'problem'];\n if (\n errorKeywords.some(\n (keyword) => description.includes(keyword) || $ref.includes(keyword),\n )\n ) {\n errors.properties.default = defaultResponse.schema;\n inferred = true;\n }\n\n // if no keyword match, assume default schema is intended for error\n if (!inferred) {\n errors.properties.default = defaultResponse.schema;\n }\n }\n\n const errorKeys = Object.keys(errors.properties);\n if (errorKeys.length) {\n errors.required = errorKeys;\n result.errors = errors;\n\n let errorUnion = addItemsToSchema({\n items: Object.values(errors.properties),\n mutateSchemaOneItem: true,\n schema: {},\n });\n errorUnion = deduplicateSchema({ schema: errorUnion });\n if (Object.keys(errorUnion).length && errorUnion.type !== 'unknown') {\n result.error = errorUnion;\n }\n }\n\n const responseKeys = Object.keys(responses.properties);\n if (responseKeys.length) {\n responses.required = responseKeys;\n result.responses = responses;\n\n let responseUnion = addItemsToSchema({\n items: Object.values(responses.properties),\n mutateSchemaOneItem: true,\n schema: {},\n });\n responseUnion = deduplicateSchema({ schema: responseUnion });\n if (Object.keys(responseUnion).length && responseUnion.type !== 'unknown') {\n result.response = responseUnion;\n }\n }\n\n return result;\n};\n","/**\n * Sanitizes namespace identifiers so they are valid TypeScript identifiers of a certain form.\n *\n * 1: Remove any leading characters that are illegal as starting character of a typescript identifier.\n * 2: Replace illegal characters in remaining part of type name with hyphen (-).\n *\n * Step 1 should perhaps instead also replace illegal characters with underscore, or prefix with it, like sanitizeEnumName\n * does. The way this is now one could perhaps end up removing all characters, if all are illegal start characters. It\n * would be sort of a breaking change to do so, though, previously generated code might change then.\n *\n * JavaScript identifier regexp pattern retrieved from https://developer.mozilla.org/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers\n *\n * The output of this is expected to be converted to PascalCase\n */\nexport const sanitizeNamespaceIdentifier = (name: string) =>\n name\n .replace(/^[^\\p{ID_Start}]+/u, '')\n .replace(/[^$\\u200c\\u200d\\p{ID_Continue}]/gu, '-')\n .replace(/[$+]/g, '-');\n","import type { PluginClientNames } from '~/plugins/types';\nimport type { Config } from '~/types/config';\n\nexport const getClientBaseUrlKey = (config: Config) => {\n const client = getClientPlugin(config);\n if (\n client.name === '@hey-api/client-axios' ||\n client.name === '@hey-api/client-nuxt'\n ) {\n return 'baseURL';\n }\n return 'baseUrl';\n};\n\nexport const getClientPlugin = (\n config: Config,\n): Config['plugins'][PluginClientNames] & { name: PluginClientNames } => {\n for (const name of config.pluginOrder) {\n const plugin = config.plugins[name];\n if (plugin?.tags?.includes('client')) {\n return plugin as Config['plugins'][PluginClientNames] & {\n name: PluginClientNames;\n };\n }\n }\n\n return {\n config: {\n // @ts-expect-error\n name: '',\n },\n // @ts-expect-error\n name: '',\n };\n};\n","import type { FromRefs, ToRefs } from '../types/refs';\n\n/**\n * Wraps a single value in a Ref object.\n *\n * @example\n * ```ts\n * const r = toRef(123); // { value: 123 }\n * console.log(r.value); // 123\n * ```\n */\nexport const toRef = <T>(value: T): { value: T } => ({ value });\n\n/**\n * Unwraps a single Ref object to its value.\n *\n * @example\n * ```ts\n * const r = { value: 42 };\n * const n = fromRef(r); // 42\n * console.log(n); // 42\n * ```\n */\nexport const fromRef = <T>(ref: { value: T }): T => ref.value;\n\n/**\n * Converts an object of Refs back to a plain object (unwraps all refs).\n *\n * @example\n * ```ts\n * const refs = { a: { value: 1 }, b: { value: \"x\" } };\n * const plain = fromRefs(refs); // { a: 1, b: \"x\" }\n * ```\n */\nexport const fromRefs = <T extends ToRefs<Record<string, unknown>>>(\n obj: T,\n): FromRefs<T> => {\n const result = {} as FromRefs<T>;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = fromRef(obj[key]!) as (typeof result)[typeof key];\n }\n }\n return result;\n};\n\n/**\n * Converts a plain object to an object of Refs (deep, per property).\n *\n * @example\n * ```ts\n * const obj = { a: 1, b: \"x\" };\n * const refs = toRefs(obj); // { a: { value: 1 }, b: { value: \"x\" } }\n * ```\n */\nexport const toRefs = <T extends Record<string, unknown>>(\n obj: T,\n): ToRefs<T> => {\n const result = {} as ToRefs<T>;\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n result[key] = toRef(obj[key]);\n }\n }\n return result;\n};\n","/**\n * Matches characters from the start as long as they're not allowed.\n */\nexport const illegalStartCharactersRegExp = /^[^$_\\p{ID_Start}]+/u;\n\n/**\n * Matches string if it contains only digits and optionally decimal point or\n * leading minus sign.\n */\nexport const numberRegExp = /^-?\\d+(\\.\\d+)?$/;\n\nexport const reservedBrowserGlobalsRegExp =\n /^(document|history|location|navigator|window)$/g;\n\nexport const reservedJavaScriptGlobalsRegExp =\n /^(console|Array|Date|Error|Function|JSON|Map|Math|Object|Promise|RegExp|Set|WeakMap|WeakSet)$/g;\n\nexport const reservedJavaScriptKeywordsRegExp =\n /^(arguments|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|eval|export|extends|false|finally|for|from|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)$/g;\n\nexport const reservedNodeGlobalsRegExp = /^(global|process|Buffer)$/g;\n\nexport const reservedTypeScriptKeywordsRegExp =\n /^(any|as|bigint|boolean|namespace|never|null|number|string|symbol|type|undefined|unknown|void)$/g;\n\n/**\n * Javascript identifier regexp pattern retrieved from\n * {@link} https://developer.mozilla.org/docs/Web/JavaScript/Reference/Lexical_grammar#identifiers\n */\nexport const validTypescriptIdentifierRegExp =\n /^[$_\\p{ID_Start}][$\\u200c\\u200d\\p{ID_Continue}]*$/u;\n","import { EOL } from 'node:os';\n\nimport { validTypescriptIdentifierRegExp } from './regexp';\n\nexport const escapeName = (value: string): string => {\n if (value || value === '') {\n validTypescriptIdentifierRegExp.lastIndex = 0;\n const validName = validTypescriptIdentifierRegExp.test(value);\n if (!validName) {\n return `'${value}'`;\n }\n }\n return value;\n};\n\nexport const unescapeName = (value: string): string => {\n if (value && value.startsWith(\"'\") && value.endsWith(\"'\")) {\n return value.slice(1, value.length - 1);\n }\n return value;\n};\n\nexport const escapeComment = (value: string) =>\n value\n .replace(/\\*\\//g, '*')\n .replace(/\\/\\*/g, '*')\n .replace(/\\r?\\n(.*)/g, (_l, w) => EOL + w.trim());\n","import ts from 'typescript';\n\nimport { unescapeName } from '~/utils/escape';\n\nimport type { AccessLevel } from './types';\nimport { createStringLiteral, syntaxKindKeyword } from './types';\n\nexport interface ImportExportItemObject<\n Name extends string | undefined = string | undefined,\n Alias extends string | undefined = undefined,\n> {\n alias?: Alias;\n asType?: boolean;\n name: Name;\n}\n\nconst printer = ts.createPrinter({\n newLine: ts.NewLineKind.LineFeed,\n removeComments: false,\n});\n\nexport const createSourceFile = (sourceText: string): ts.SourceFile =>\n ts.createSourceFile(\n '',\n sourceText,\n ts.ScriptTarget.ESNext,\n false,\n ts.ScriptKind.TS,\n );\n\nconst blankSourceFile = createSourceFile('');\n\nconst unescapeUnicode = (value: string) =>\n value.replace(/\\\\u([0-9a-fA-F]{4})/g, (_, hex: string) =>\n String.fromCharCode(Number.parseInt(hex, 16)),\n );\n\n/**\n * Print a TypeScript node to a string.\n * @param node the node to print\n * @returns string\n */\nexport function tsNodeToString({\n node,\n unescape = false,\n}: {\n node: ts.Node;\n unescape?: boolean;\n}): string {\n const result = printer.printNode(\n ts.EmitHint.Unspecified,\n node,\n blankSourceFile,\n );\n\n if (!unescape) {\n return result;\n }\n\n try {\n /**\n * TypeScript Compiler API escapes unicode characters by default and there\n * is no way to disable this behavior\n * {@link https://github.com/microsoft/TypeScript/issues/36174}\n */\n return unescapeUnicode(result);\n } catch {\n // if (getConfig().logs.level === 'debug') {\n // console.warn('Could not decode value:', result);\n // }\n return result;\n }\n}\n\nexport const createIdentifier = ({ text }: { text: string }): ts.Identifier =>\n ts.factory.createIdentifier(text);\n\nexport const createThis = (): ts.ThisExpression => ts.factory.createThis();\n\nexport type Modifier = AccessLevel | 'async' | 'export' | 'readonly' | 'static';\n\nexport const createModifier = ({ keyword }: { keyword: Modifier }) => {\n const kind = syntaxKindKeyword({ keyword });\n return ts.factory.createModifier(kind);\n};\n\nexport const createPropertyDeclaration = ({\n initializer,\n modifier,\n name,\n type,\n}: {\n initializer?: ts.Expression;\n modifier?: Modifier;\n name: string | ts.PropertyName;\n type?: ts.TypeNode;\n}) => {\n const node = ts.factory.createPropertyDeclaration(\n modifier ? [createModifier({ keyword: modifier })] : undefined,\n name,\n undefined,\n type,\n initializer,\n );\n return node;\n};\n\n/**\n * ots for @hey-api/openapi-ts are helpers to reduce repetition of basic TypeScript\n * factory functions.\n */\nexport const ots = {\n /**\n * Create a boolean expression based on value.\n */\n boolean: (value: boolean) =>\n value ? ts.factory.createTrue() : ts.factory.createFalse(),\n export: ({ alias, asType = false, name }: ImportExportItemObject) => {\n const nameNode = createIdentifier({ text: name! });\n if (alias) {\n const aliasNode = createIdentifier({ text: alias });\n return ts.factory.createExportSpecifier(asType, nameNode, aliasNode);\n }\n return ts.factory.createExportSpecifier(asType, undefined, nameNode);\n },\n import: ({ alias, asType = false, name }: ImportExportItemObject) => {\n const nameNode = createIdentifier({ text: name! });\n if (alias) {\n const aliasNode = createIdentifier({ text: alias });\n return ts.factory.createImportSpecifier(asType, nameNode, aliasNode);\n }\n return ts.factory.createImportSpecifier(asType, undefined, nameNode);\n },\n /**\n * Create a numeric expression, handling negative numbers.\n */\n number: (value: number) => {\n if (value < 0) {\n return ts.factory.createPrefixUnaryExpression(\n ts.SyntaxKind.MinusToken,\n ts.factory.createNumericLiteral(Math.abs(value)),\n );\n }\n return ts.factory.createNumericLiteral(value);\n },\n /**\n * Create a string literal. This handles strings that start with '`' or \"'\".\n */\n string: (value: string, unescape = false) => {\n let text = value;\n if (unescape) {\n text = unescapeName(text);\n }\n const hasBothQuotes = text.includes(\"'\") && text.includes('\"');\n const hasNewlines = text.includes('\\n');\n const hasUnescapedBackticks = text.startsWith('`');\n const isBacktickEscaped = text.startsWith('\\\\`') && text.endsWith('\\\\`');\n if (\n (hasNewlines || hasBothQuotes || hasUnescapedBackticks) &&\n !isBacktickEscaped\n ) {\n text = `\\`${text.replace(/(?<!\\\\)`/g, '\\\\`').replace(/\\${/g, '\\\\${')}\\``;\n }\n if (text.startsWith('`')) {\n return createIdentifier({ text });\n }\n return createStringLiteral({ text });\n },\n};\n\nexport const isTsNode = (node: any): node is ts.Expression =>\n node !== null &&\n typeof node === 'object' &&\n typeof node.kind === 'number' &&\n typeof node.flags === 'number' &&\n typeof node.pos === 'number' &&\n typeof node.end === 'number';\n\nexport const isType = <T>(value: T | undefined): value is T =>\n value !== undefined;\n\ntype CommentLines = Array<string | null | false | undefined>;\ntype CommentObject = {\n jsdoc?: boolean;\n lines: CommentLines;\n};\nexport type Comments = CommentLines | Array<CommentObject>;\n\nconst processCommentObject = ({\n commentObject,\n node,\n}: {\n commentObject: CommentObject;\n node: ts.Node;\n}) => {\n const lines = commentObject.lines.filter(\n (line) => Boolean(line) || line === '',\n ) as string[];\n if (!lines.length) {\n return;\n }\n\n if (!commentObject.jsdoc) {\n for (const line of lines) {\n ts.addSyntheticLeadingComment(\n node,\n ts.SyntaxKind.SingleLineCommentTrivia,\n ` ${line}`,\n true,\n );\n }\n return;\n }\n\n const jsdocTexts = lines.map((line, index) => {\n let text = line;\n if (index !== lines.length) {\n text = `${text}\\n`;\n }\n const jsdocText = ts.factory.createJSDocText(text);\n return jsdocText;\n });\n\n const jsdoc = ts.factory.createJSDocComment(\n ts.factory.createNodeArray(jsdocTexts),\n undefined,\n );\n\n const cleanedJsdoc = tsNodeToString({ node: jsdoc, unescape: true })\n .replace('/*', '')\n .replace('* */', '');\n\n ts.addSyntheticLeadingComment(\n node,\n ts.SyntaxKind.MultiLineCommentTrivia,\n cleanedJsdoc,\n true,\n );\n};\n\nexport const addLeadingComments = ({\n comments = [],\n node,\n}: {\n comments?: Comments;\n node: ts.Node;\n}) => {\n const isObjectStyle = Boolean(\n comments.find((comment) => typeof comment === 'object' && comment),\n );\n\n let commentObjects = comments as Array<CommentObject>;\n if (!isObjectStyle) {\n commentObjects = [\n {\n jsdoc: true,\n lines: comments as CommentLines,\n },\n ];\n }\n\n for (const commentObject of commentObjects) {\n processCommentObject({\n commentObject,\n node,\n });\n }\n};\n","import ts from 'typescript';\n\nimport { escapeName } from '~/utils/escape';\nimport { validTypescriptIdentifierRegExp } from '~/utils/regexp';\n\nimport type { Modifier } from './utils';\nimport {\n addLeadingComments,\n type Comments,\n createIdentifier,\n createModifier,\n isTsNode,\n isType,\n ots,\n} from './utils';\n\nexport type AccessLevel = 'private' | 'protected' | 'public';\n\nexport type FunctionParameter =\n | {\n accessLevel?: AccessLevel;\n default?: any;\n isReadOnly?: boolean;\n isRequired?: boolean;\n name: string;\n type?: any | ts.TypeNode;\n }\n | {\n destructure: ReadonlyArray<FunctionParameter>;\n type?: any | ts.TypeNode;\n };\n\nexport interface FunctionTypeParameter {\n default?: any;\n extends?: string | ts.TypeNode;\n name: string | ts.Identifier;\n}\n\nexport const createTypeNode = (\n base: any | ts.TypeNode,\n args?: (any | ts.TypeNode)[],\n): ts.TypeNode => {\n if (ts.isTypeNode(base)) {\n return base;\n }\n\n if (typeof base === 'number') {\n return ts.factory.createLiteralTypeNode(ots.number(base));\n }\n\n return createTypeReferenceNode({\n typeArguments: args?.map((arg) => createTypeNode(arg)),\n typeName: ts.isIdentifier(base) ? base.text : base,\n });\n};\n\nexport const createPropertyAccessChain = ({\n expression,\n name,\n}: {\n expression: ts.Expression;\n name: string | ts.MemberName;\n}) => {\n const node = ts.factory.createPropertyAccessChain(\n expression,\n ts.factory.createToken(ts.SyntaxKind.QuestionDotToken),\n name,\n );\n return node;\n};\n\nexport const createPropertyAccessExpression = ({\n expression,\n isOptional,\n name,\n}: {\n expression: string | ts.Expression;\n isOptional?: boolean;\n name: string | number | ts.MemberName;\n}):\n | ts.PropertyAccessChain\n | ts.PropertyAccessExpression\n | ts.ElementAccessExpression => {\n const nodeExpression =\n typeof expression === 'string'\n ? createIdentifier({ text: expression })\n : expression;\n\n if (isOptional && typeof name !== 'number') {\n return createPropertyAccessChain({\n expression: nodeExpression,\n name,\n });\n }\n\n if (typeof name === 'string') {\n validTypescriptIdentifierRegExp.lastIndex = 0;\n if (!validTypescriptIdentifierRegExp.test(name)) {\n // TODO: parser - this should escape name only for new parser\n if (!name.startsWith(\"'\") && !name.endsWith(\"'\")) {\n // eslint-disable-next-line no-useless-escape\n name = `\\'${name}\\'`;\n }\n const nodeName = createIdentifier({ text: name });\n return ts.factory.createElementAccessExpression(nodeExpression, nodeName);\n }\n\n const nodeName = createIdentifier({ text: name });\n return ts.factory.createPropertyAccessExpression(nodeExpression, nodeName);\n }\n\n if (typeof name === 'number') {\n const nodeName = ts.factory.createNumericLiteral(name);\n return ts.factory.createElementAccessExpression(nodeExpression, nodeName);\n }\n\n return ts.factory.createPropertyAccessExpression(nodeExpression, name);\n};\n\nexport const createNull = (): ts.NullLiteral => ts.factory.createNull();\n\n/**\n * Convert an unknown value to an expression.\n * @param identifiers - list of keys that are treated as identifiers.\n * @param shorthand - if shorthand syntax is allowed.\n * @param unescape - if string should be unescaped.\n * @param value - the unknown value.\n * @returns ts.Expression\n */\nexport const toExpression = <T = unknown>({\n identifiers = [],\n isValueAccess,\n shorthand,\n unescape,\n value,\n}: {\n identifiers?: string[];\n isValueAccess?: boolean;\n shorthand?: boolean;\n unescape?: boolean;\n value: T;\n}): ts.Expression | undefined => {\n if (value === null) {\n return createNull();\n }\n\n if (Array.isArray(value)) {\n return createArrayLiteralExpression({ elements: value });\n }\n\n if (typeof value === 'object') {\n return createObjectType({\n identifiers,\n obj: value,\n shorthand,\n });\n }\n\n if (typeof value === 'number') {\n return ots.number(value);\n }\n\n if (typeof value === 'boolean') {\n return ots.boolean(value);\n }\n\n if (typeof value === 'string') {\n if (isValueAccess) {\n // TODO; handle more than single nested level, i.e. foo.bar.baz\n const parts = value.split('.');\n return createPropertyAccessExpression({\n expression: parts[0]!,\n name: parts[1]!,\n });\n }\n return ots.string(value, unescape);\n }\n\n return;\n};\n\n/**\n * Convert parameters to the declaration array expected by TypeScript\n * Compiler API.\n * @param parameters - the parameters to convert to declarations\n * @returns ts.ParameterDeclaration[]\n */\nexport const toParameterDeclarations = (\n parameters: ReadonlyArray<FunctionParameter>,\n) =>\n parameters.map((parameter) => {\n if ('destructure' in parameter) {\n return createParameterDeclaration({\n name: ts.factory.createObjectBindingPattern(\n parameter.destructure\n .map((param) => {\n // TODO: add support for nested destructuring, not needed at the moment\n if ('destructure' in param) {\n return;\n }\n\n const result = ts.factory.createBindingElement(\n undefined,\n undefined,\n createIdentifier({ text: param.name }),\n undefined,\n );\n return result;\n })\n .filter(Boolean) as ts.BindingElement[],\n ),\n type:\n parameter.type !== undefined\n ? createTypeNode(parameter.type)\n : undefined,\n });\n }\n\n const modifiers = parameter.accessLevel\n ? [createModifier({ keyword: parameter.accessLevel })]\n : [];\n\n if (parameter.isReadOnly) {\n modifiers.push(createModifier({ keyword: 'readonly' }));\n }\n\n return createParameterDeclaration({\n initializer:\n parameter.default !== undefined\n ? toExpression({ value: parameter.default })\n : undefined,\n modifiers,\n name: createIdentifier({ text: parameter.name }),\n required: parameter.isRequired !== false,\n type:\n parameter.type !== undefined\n ? createTypeNode(parameter.type)\n : undefined,\n });\n });\n\nexport type SyntaxKindKeyword =\n | 'any'\n | 'async'\n | 'boolean'\n | 'export'\n | 'never'\n | 'number'\n | 'private'\n | 'protected'\n | 'public'\n | 'readonly'\n | 'static'\n | 'string'\n | 'undefined'\n | 'unknown'\n | 'void';\n\nexport const syntaxKindKeyword = <T extends SyntaxKindKeyword>({\n keyword,\n}: {\n keyword: T;\n}): T extends 'protected'\n ? ts.SyntaxKind.ProtectedKeyword\n : T extends 'public'\n ? ts.SyntaxKind.PublicKeyword\n : T extends 'private'\n ? ts.SyntaxKind.PrivateKeyword\n : T extends 'export'\n ? ts.SyntaxKind.ExportKeyword\n : T extends 'async'\n ? ts.SyntaxKind.ExportKeyword\n : T extends 'readonly'\n ? ts.SyntaxKind.ExportKeyword\n : T extends 'static'\n ? ts.SyntaxKind.ExportKeyword\n :\n | ts.SyntaxKind.AnyKeyword\n | ts.SyntaxKind.BooleanKeyword\n | ts.SyntaxKind.NeverKeyword\n | ts.SyntaxKind.NumberKeyword\n | ts.SyntaxKind.StringKeyword\n | ts.SyntaxKind.UndefinedKeyword\n | ts.SyntaxKind.UnknownKeyword\n | ts.SyntaxKind.VoidKeyword => {\n switch (keyword) {\n case 'any':\n return ts.SyntaxKind.AnyKeyword as any;\n case 'async':\n return ts.SyntaxKind.AsyncKeyword as any;\n case 'boolean':\n return ts.SyntaxKind.BooleanKeyword as any;\n case 'export':\n return ts.SyntaxKind.ExportKeyword as any;\n case 'never':\n return ts.SyntaxKind.NeverKeyword as any;\n case 'number':\n return ts.SyntaxKind.NumberKeyword as any;\n case 'private':\n return ts.SyntaxKind.PrivateKeyword as any;\n case 'protected':\n return ts.SyntaxKind.ProtectedKeyword as any;\n case 'public':\n return ts.SyntaxKind.PublicKeyword as any;\n case 'readonly':\n return ts.SyntaxKind.ReadonlyKeyword as any;\n case 'static':\n return ts.SyntaxKind.StaticKeyword as any;\n case 'string':\n return ts.SyntaxKind.StringKeyword as any;\n case 'undefined':\n return ts.SyntaxKind.UndefinedKeyword as any;\n case 'unknown':\n return ts.SyntaxKind.UnknownKeyword as any;\n case 'void':\n return ts.SyntaxKind.VoidKeyword as any;\n default:\n throw new Error(`unsupported syntax kind keyword \"${keyword}\"`);\n }\n};\n\nexport const createKeywordTypeNode = ({\n keyword,\n}: {\n keyword: Extract<\n SyntaxKindKeyword,\n | 'any'\n | 'boolean'\n | 'never'\n | 'number'\n | 'string'\n | 'undefined'\n | 'unknown'\n | 'void'\n >;\n}) => {\n const kind = syntaxKindKeyword({ keyword });\n return ts.factory.createKeywordTypeNode(kind);\n};\n\nexport const toTypeParameters = (\n types: (FunctionTypeParameter | ts.TypeParameterDeclaration)[],\n) =>\n types.map((node) => {\n // @ts-expect-error\n if (ts.isTypeParameterDeclaration(node)) {\n return node;\n }\n\n return createTypeParameterDeclaration({\n // TODO: support other extends values\n constraint: node.extends\n ? typeof node.extends === 'string'\n ? createKeywordTypeNode({ keyword: 'boolean' })\n : node.extends\n : undefined,\n // TODO: support other default types\n defaultType:\n node.default !== undefined\n ? isTsNode(node.default)\n ? (node.default as unknown as ts.TypeNode)\n : ts.factory.createLiteralTypeNode(\n node.default\n ? ts.factory.createTrue()\n : ts.factory.createFalse(),\n )\n : undefined,\n name: node.name,\n });\n });\n\nexport const createTypeOperatorNode = ({\n operator,\n type,\n}: {\n operator: 'keyof' | 'readonly' | 'unique';\n type: ts.TypeNode;\n}) => {\n const operatorKeyword =\n operator === 'keyof'\n ? ts.SyntaxKind.KeyOfKeyword\n : operator === 'readonly'\n ? ts.SyntaxKind.ReadonlyKeyword\n : ts.SyntaxKind.UniqueKeyword;\n return ts.factory.createTypeOperatorNode(operatorKeyword, type);\n};\n\nexport const createTypeParameterDeclaration = ({\n constraint,\n defaultType,\n modifiers,\n name,\n}: {\n constraint?: ts.TypeNode;\n defaultType?: ts.TypeNode;\n modifiers?: Array<ts.Modifier>;\n name: string | ts.Identifier;\n}) =>\n ts.factory.createTypeParameterDeclaration(\n modifiers,\n name,\n constraint,\n defaultType,\n );\n\nexport const createMappedTypeNode = ({\n members,\n nameType,\n questionToken,\n readonlyToken,\n type,\n typeParameter,\n}: {\n members?: ts.NodeArray<ts.TypeElement>;\n nameType?: ts.TypeNode;\n questionToken?: ts.QuestionToken | ts.PlusToken | ts.MinusToken;\n readonlyToken?: ts.ReadonlyKeyword | ts.PlusToken | ts.MinusToken;\n type?: ts.TypeNode;\n typeParameter: ts.TypeParameterDeclaration;\n}) =>\n ts.factory.createMappedTypeNode(\n readonlyToken,\n typeParameter,\n nameType,\n questionToken,\n type,\n members,\n );\n\nexport const createLiteralTypeNode = ({\n literal,\n}: {\n literal: ts.LiteralTypeNode['literal'];\n}) => {\n const node = ts.factory.createLiteralTypeNode(literal);\n return node;\n};\n\n/**\n * Create arrow function type expression.\n */\nexport const createArrowFunction = ({\n async,\n comment,\n multiLine,\n parameters = [],\n returnType,\n statements = [],\n types = [],\n}: {\n async?: boolean;\n comment?: Comments;\n multiLine?: boolean;\n parameters?: ReadonlyArray<FunctionParameter>;\n returnType?: string | ts.TypeNode;\n statements?: ts.Statement[] | ts.Expression;\n types?: FunctionTypeParameter[];\n}) => {\n const expression = ts.factory.createArrowFunction(\n async ? [createModifier({ keyword: 'async' })] : undefined,\n types ? toTypeParameters(types) : undefined,\n toParameterDeclarations(parameters),\n returnType ? createTypeNode(returnType) : undefined,\n undefined,\n Array.isArray(statements)\n ? createBlock({ multiLine, statements })\n : statements,\n );\n\n addLeadingComments({\n comments: comment,\n node: expression,\n });\n\n return expression;\n};\n\n/**\n * Create anonymous function type expression.\n */\nexport const createAnonymousFunction = ({\n async,\n comment,\n multiLine,\n parameters = [],\n returnType,\n statements = [],\n types = [],\n}: {\n async?: boolean;\n comment?: Comments;\n multiLine?: boolean;\n parameters?: FunctionParameter[];\n returnType?: string | ts.TypeNode;\n statements?: ReadonlyArray<ts.Statement>;\n types?: FunctionTypeParameter[];\n}) => {\n const expression = ts.factory.createFunctionExpression(\n async ? [createModifier({ keyword: 'async' })] : undefined,\n undefined,\n undefined,\n types ? toTypeParameters(types) : undefined,\n toParameterDeclarations(parameters),\n returnType ? createTypeNode(returnType) : undefined,\n createBlock({ multiLine, statements }),\n );\n\n addLeadingComments({\n comments: comment,\n node: expression,\n });\n\n return expression;\n};\n\n/**\n * Create Array type expression.\n */\nexport const createArrayLiteralExpression = <T>({\n elements,\n multiLine = false,\n}: {\n /**\n * The array to create.\n */\n elements: T[];\n /**\n * Should the array be multi line?\n *\n * @default false\n */\n multiLine?: boolean;\n}): ts.ArrayLiteralExpression => {\n const expression = ts.factory.createArrayLiteralExpression(\n elements\n .map((value) => (isTsNode(value) ? value : toExpression({ value })))\n .filter(isType<ts.Expression>),\n // multiline if array contains objects\n multiLine ||\n (!Array.isArray(elements[0]) && typeof elements[0] === 'object'),\n );\n return expression;\n};\n\nexport const createAwaitExpression = ({\n expression,\n}: {\n expression: ts.Expression;\n}) => ts.factory.createAwaitExpression(expression);\n\nexport const createFunctionTypeNode = ({\n parameters = [],\n returnType,\n typeParameters,\n}: {\n parameters?: ts.ParameterDeclaration[];\n returnType: ts.TypeNode;\n typeParameters?: ts.TypeParameterDeclaration[];\n}) => {\n const node = ts.factory.createFunctionTypeNode(\n typeParameters,\n parameters,\n returnType,\n );\n return node;\n};\n\nexport type ObjectValue =\n | {\n assertion?: 'any' | ts.TypeNode;\n comments?: Comments;\n spread: string;\n }\n | {\n comments?: Comments;\n isValueAccess?: boolean;\n key: string;\n shorthand?: boolean;\n value: any;\n };\n\ntype ObjectAssignment =\n | ts.PropertyAssignment\n | ts.ShorthandPropertyAssignment\n | ts.SpreadAssignment;\n\n/**\n * Create Object type expression.\n * @param comments - comments to add to each property.\n * @param identifier - keys that should be treated as identifiers.\n * @param multiLine - if the object should be multiline.\n * @param obj - the object to create expression with.\n * @param shorthand - if shorthand syntax should be used.\n * @param unescape - if properties strings should be unescaped.\n * @returns ts.ObjectLiteralExpression\n */\nexport const createObjectType = <\n T extends Record<string, any> | Array<ObjectValue>,\n>({\n comments,\n identifiers = [],\n multiLine = true,\n obj,\n shorthand,\n unescape = false,\n}: {\n comments?: Comments;\n identifiers?: string[];\n multiLine?: boolean;\n obj: T;\n shorthand?: boolean;\n unescape?: boolean;\n}): ts.ObjectLiteralExpression => {\n const properties = Array.isArray(obj)\n ? obj\n .map((value: ObjectValue) => {\n // Check key value equality before possibly modifying it\n let canShorthand = false;\n if ('key' in value) {\n const { key } = value;\n canShorthand = key === value.value;\n const firstDigitAndNonDigits =\n key.match(/^[0-9]/) && key.match(/\\D+/g);\n if (\n (firstDigitAndNonDigits || key.match(/\\W/g) || key === '') &&\n !key.startsWith(\"'\") &&\n !key.endsWith(\"'\")\n ) {\n value.key = `'${key}'`;\n }\n }\n let assignment: ObjectAssignment;\n if ('spread' in value) {\n const nameIdentifier = isTsNode(value.spread)\n ? value.spread\n : createIdentifier({ text: value.spread });\n assignment = ts.factory.createSpreadAssignment(\n value.assertion\n ? createAsExpression({\n expression: nameIdentifier,\n type:\n typeof value.assertion === 'string'\n ? createKeywordTypeNode({ keyword: value.assertion })\n : value.assertion,\n })\n : nameIdentifier,\n );\n } else if (value.shorthand || (shorthand && canShorthand)) {\n assignment = ts.factory.createShorthandPropertyAssignment(\n value.value,\n );\n } else {\n let initializer: ts.Expression | undefined = isTsNode(value.value)\n ? value.value\n : Array.isArray(value.value) &&\n (!value.value.length || typeof value.value[0] === 'object')\n ? createObjectType({\n multiLine,\n obj: value.value,\n shorthand,\n unescape,\n })\n : toExpression({\n identifiers: identifiers.includes(value.key)\n ? Object.keys(value.value)\n : [],\n isValueAccess: value.isValueAccess,\n shorthand,\n unescape,\n value: value.value,\n });\n if (!initializer) {\n return;\n }\n // Create a identifier if the current key is one and it is not an object\n if (\n identifiers.includes(value.key) &&\n !ts.isObjectLiteralExpression(initializer)\n ) {\n initializer = createIdentifier({ text: value.value as string });\n }\n assignment = createPropertyAssignment({\n initializer,\n name: value.key,\n });\n }\n\n addLeadingComments({\n comments: value.comments,\n node: assignment,\n });\n\n return assignment;\n })\n .filter(isType<ObjectAssignment>)\n : Object.entries(obj)\n .map(([key, value]) => {\n // Pass all object properties as identifiers if the whole object is an identifier\n let initializer: ts.Expression | undefined = toExpression({\n identifiers: identifiers.includes(key) ? Object.keys(value) : [],\n shorthand,\n unescape,\n value,\n });\n if (!initializer) {\n return;\n }\n // Create a identifier if the current key is one and it is not an object\n if (\n identifiers.includes(key) &&\n !ts.isObjectLiteralExpression(initializer)\n ) {\n initializer = createIdentifier({ text: value as string });\n }\n // Check key value equality before possibly modifying it\n const canShorthand = key === value;\n if (\n key.match(/^[0-9]/) &&\n key.match(/\\D+/g) &&\n !key.startsWith(\"'\") &&\n !key.endsWith(\"'\")\n ) {\n key = `'${key}'`;\n }\n if (key.match(/\\W/g) && !key.startsWith(\"'\") && !key.endsWith(\"'\")) {\n key = `'${key}'`;\n }\n const assignment =\n shorthand && canShorthand\n ? ts.factory.createShorthandPropertyAssignment(value)\n : createPropertyAssignment({ initializer, name: key });\n\n return assignment;\n })\n .filter(isType<ObjectAssignment>);\n\n const node = ts.factory.createObjectLiteralExpression(\n properties as any[],\n multiLine,\n );\n\n addLeadingComments({\n comments,\n node,\n });\n\n return node;\n};\n\n/**\n * Create enum declaration. Example `export enum T = { X, Y };`\n * @param asConst - whether to use const enums.\n * @param comments - comments to add to each property.\n * @param leadingComment - leading comment to add to enum.\n * @param name - the name of the enum.\n * @param obj - the object representing the enum.\n * @returns ts.EnumDeclaration\n */\nexport const createEnumDeclaration = <\n T extends Record<string, any> | Array<ObjectValue>,\n>({\n asConst,\n comments: enumMemberComments = {},\n leadingComment: comments,\n name,\n obj,\n}: {\n asConst: boolean;\n comments?: Record<string | number, Comments>;\n leadingComment?: Comments;\n name: string | ts.TypeReferenceNode;\n obj: T;\n}): ts.EnumDeclaration => {\n const members: Array<ts.EnumMember> = Array.isArray(obj)\n ? obj.map((value) => {\n const enumMember = createEnumMember({\n initializer: toExpression({\n value: value.value,\n }),\n name: value.key,\n });\n\n addLeadingComments({\n comments: value.comments,\n node: enumMember,\n });\n\n return enumMember;\n })\n : // TODO: parser - deprecate object syntax\n Object.entries(obj).map(([key, value]) => {\n const enumMember = ts.factory.createEnumMember(\n key,\n toExpression({\n unescape: true,\n value,\n }),\n );\n\n addLeadingComments({\n comments: enumMemberComments[key],\n node: enumMember,\n });\n\n return enumMember;\n });\n\n const defaultModifiers = [createModifier({ keyword: 'export' })];\n const constModifier = asConst\n ? [ts.factory.createToken(ts.SyntaxKind.ConstKeyword)]\n : [];\n const modifiers = [...defaultModifiers, ...constModifier];\n const node = ts.factory.createEnumDeclaration(\n modifiers,\n typeof name === 'string'\n ? createIdentifier({ text: name })\n : // TODO: https://github.com/hey-api/openapi-ts/issues/2289\n (name as unknown as ts.Identifier),\n members,\n );\n\n addLeadingComments({\n comments,\n node,\n });\n\n return node;\n};\n\nconst createEnumMember = ({\n initializer,\n name,\n}: {\n initializer?: ts.Expression;\n name: string | ts.PropertyName;\n}) => {\n let key = name;\n if (typeof key === 'string') {\n if (key.includes(\"'\")) {\n key = createStringLiteral({\n isSingleQuote: false,\n text: key,\n });\n } else {\n key = escapeName(key);\n }\n }\n return ts.factory.createEnumMember(key, initializer);\n};\n\n/**\n * Create namespace declaration. Example `export namespace MyNamespace { ... }`\n * @param name - the name of the namespace.\n * @param nodes - the nodes in the namespace.\n * @returns\n */\nexport const createNamespaceDeclaration = ({\n name,\n statements,\n}: {\n name: string;\n statements: Array<ts.Statement>;\n}) =>\n ts.factory.createModuleDeclaration(\n [createModifier({ keyword: 'export' })],\n createIdentifier({ text: name }),\n ts.factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n );\n\nexport const createIndexedAccessTypeNode = ({\n indexType,\n objectType,\n}: {\n indexType: ts.TypeNode;\n objectType: ts.TypeNode;\n}) => {\n const node = ts.factory.createIndexedAccessTypeNode(objectType, indexType);\n return node;\n};\n\nexport const createGetAccessorDeclaration = ({\n modifiers,\n name,\n returnType,\n statements,\n}: {\n modifiers?: Modifier | ReadonlyArray<Modifier>;\n name: string | ts.PropertyName;\n returnType?: string | ts.Identifier;\n statements: ReadonlyArray<ts.Statement>;\n}) => {\n const mods = Array.isArray(modifiers) ? modifiers : [modifiers];\n return ts.factory.createGetAccessorDeclaration(\n modifiers ? mods.map((keyword) => createModifier({ keyword })) : undefined,\n name,\n [],\n returnType ? createTypeReferenceNode({ typeName: returnType }) : undefined,\n createBlock({ statements }),\n );\n};\n\nexport const createStringLiteral = ({\n isSingleQuote,\n text,\n}: {\n isSingleQuote?: boolean;\n text: string;\n}) => {\n if (isSingleQuote === undefined) {\n isSingleQuote = !text.includes(\"'\");\n }\n const node = ts.factory.createStringLiteral(text, isSingleQuote);\n return node;\n};\n\nexport const createConditionalExpression = ({\n condition,\n whenFalse,\n whenTrue,\n}: {\n condition: ts.Expression;\n whenFalse: ts.Expression;\n whenTrue: ts.Expression;\n}) => {\n const expression = ts.factory.createConditionalExpression(\n condition,\n ts.factory.createToken(ts.SyntaxKind.QuestionToken),\n whenTrue,\n ts.factory.createToken(ts.SyntaxKind.ColonToken),\n whenFalse,\n );\n return expression;\n};\n\nexport const createTypeOfExpression = ({\n text,\n}: {\n text: string | ts.Identifier;\n}) => {\n const expression = ts.factory.createTypeOfExpression(\n typeof text === 'string' ? createIdentifier({ text }) : text,\n );\n return expression;\n};\n\n/**\n * Create a type alias declaration. Example `export type X = Y;`.\n * @param comment (optional) comments to add\n * @param name the name of the type\n * @param type the type\n * @returns ts.TypeAliasDeclaration\n */\nexport const createTypeAliasDeclaration = ({\n comment,\n exportType,\n name,\n type,\n typeParameters = [],\n}: {\n comment?: Comments;\n exportType?: boolean;\n name: string | ts.TypeReferenceNode;\n type: string | ts.TypeNode | ts.Identifier;\n typeParameters?: FunctionTypeParameter[];\n}): ts.TypeAliasDeclaration => {\n const node = ts.factory.createTypeAliasDeclaration(\n exportType ? [createModifier({ keyword: 'export' })] : undefined,\n // TODO: https://github.com/hey-api/openapi-ts/issues/2289\n // passing type reference node seems to work and allows for dynamic renaming\n // @ts-expect-error\n typeof name === 'string' ? createIdentifier({ text: name }) : name,\n toTypeParameters(typeParameters),\n createTypeNode(type),\n );\n\n addLeadingComments({\n comments: comment,\n node,\n });\n\n return node;\n};\n\nexport const createTypeReferenceNode = ({\n typeArguments,\n typeName,\n}: {\n typeArguments?: ts.TypeNode[];\n typeName: string | ts.EntityName;\n}) => ts.factory.createTypeReferenceNode(typeName, typeArguments);\n\nexport const createTypeParenthesizedNode = ({ type }: { type: ts.TypeNode }) =>\n ts.factory.createParenthesizedType(type);\n\nexport const createParameterDeclaration = ({\n initializer,\n modifiers,\n name,\n required = true,\n type,\n}: {\n initializer?: ts.Expression;\n modifiers?: ReadonlyArray<ts.ModifierLike>;\n name: string | ts.BindingName;\n required?: boolean;\n type?: ts.TypeNode;\n}) => {\n const node = ts.factory.createParameterDeclaration(\n modifiers,\n undefined,\n name,\n required ? undefined : ts.factory.createToken(ts.SyntaxKind.QuestionToken),\n type,\n initializer,\n );\n return node;\n};\n\nexport const createNewExpression = ({\n argumentsArray,\n expression,\n typeArguments,\n}: {\n argumentsArray?: Array<ts.Expression>;\n expression: ts.Expression;\n typeArguments?: Array<ts.TypeNode>;\n}) => {\n const node = ts.factory.createNewExpression(\n expression,\n typeArguments,\n argumentsArray,\n );\n return node;\n};\n\nexport const createForOfStatement = ({\n awaitModifier,\n expression,\n initializer,\n statement,\n}: {\n // TODO: parser - simplify this to be await?: boolean\n awaitModifier?: ts.AwaitKeyword;\n expression: ts.Expression;\n initializer: ts.ForInitializer;\n statement: ts.Statement;\n}) => {\n const node = ts.factory.createForOfStatement(\n awaitModifier,\n initializer,\n expression,\n statement,\n );\n return node;\n};\n\nexport const createAssignment = ({\n left,\n right,\n}: {\n left: ts.Expression;\n right: ts.Expression;\n}) => ts.factory.createAssignment(left, right);\n\nexport const createBlock = ({\n multiLine = true,\n statements,\n}: {\n multiLine?: boolean;\n statements: ReadonlyArray<ts.Statement>;\n}) => ts.factory.createBlock(statements, multiLine);\n\nexport const createPropertyAssignment = ({\n initializer,\n name,\n}: {\n initializer: ts.Expression;\n name: string | ts.PropertyName;\n}) => ts.factory.createPropertyAssignment(name, initializer);\n\nexport const createRegularExpressionLiteral = ({\n flags = [],\n text,\n}: {\n flags?: ReadonlyArray<'g' | 'i' | 'm' | 's' | 'u' | 'y'>;\n text: string;\n}) => {\n // Extract pattern content, removing outer slashes if present\n const patternContent =\n text.startsWith('/') && text.endsWith('/') ? text.slice(1, -1) : text;\n\n // Escape forward slashes in the pattern content, but only if they're not already escaped\n const escapedPattern = patternContent.replace(/(?<!\\\\)\\//g, '\\\\/');\n\n // Wrap with forward slashes\n const textWithSlashes = `/${escapedPattern}/`;\n\n return ts.factory.createRegularExpressionLiteral(\n `${textWithSlashes}${flags.join('')}`,\n );\n};\n\nexport const createAsExpression = ({\n expression,\n type,\n}: {\n expression: ts.Expression;\n type: ts.TypeNode;\n}) => ts.factory.createAsExpression(expression, type);\n\nexport const createTemplateLiteralType = ({\n value,\n}: {\n value: ReadonlyArray<string | ts.TypeNode>;\n}) => {\n const spans: Array<ts.TemplateLiteralTypeSpan> = [];\n let spanText = '';\n\n for (const item of value.slice(0).reverse()) {\n if (typeof item === 'string') {\n spanText = `${item}${spanText}`;\n } else {\n const literal = spans.length\n ? ts.factory.createTemplateMiddle(spanText)\n : ts.factory.createTemplateTail(spanText);\n const span = ts.factory.createTemplateLiteralTypeSpan(item, literal);\n spans.push(span);\n spanText = '';\n }\n }\n\n const templateLiteralType = ts.factory.createTemplateLiteralType(\n ts.factory.createTemplateHead(spanText),\n spans.reverse(),\n );\n return templateLiteralType;\n};\n","import ts from 'typescript';\n\nimport { createAsExpression, createTypeReferenceNode } from './types';\nimport {\n addLeadingComments,\n type Comments,\n createIdentifier,\n createModifier,\n type ImportExportItemObject,\n ots,\n} from './utils';\n\n/**\n * Create export all declaration. Example: `export * from './y'`.\n * @param module - module containing exports\n * @returns ts.ExportDeclaration\n */\nexport const createExportAllDeclaration = ({\n module,\n shouldAppendJs,\n}: {\n module: string;\n shouldAppendJs?: boolean;\n}): ts.ExportDeclaration => {\n const statement = ts.factory.createExportDeclaration(\n undefined,\n false,\n undefined,\n ots.string(shouldAppendJs ? `${module}.js` : module),\n );\n return statement;\n};\n\nexport type ImportExportItem = ImportExportItemObject | string;\n\nexport const createCallExpression = ({\n functionName,\n parameters = [],\n types,\n}: {\n functionName:\n | string\n | ts.PropertyAccessExpression\n | ts.PropertyAccessChain\n | ts.ElementAccessExpression\n | ts.Expression;\n parameters?: Array<string | ts.Expression | undefined>;\n types?: ReadonlyArray<ts.TypeNode>;\n}) => {\n const expression =\n typeof functionName === 'string'\n ? createIdentifier({ text: functionName })\n : functionName;\n const argumentsArray = parameters\n .filter((parameter) => parameter !== undefined)\n .map((parameter) =>\n typeof parameter === 'string'\n ? createIdentifier({ text: parameter })\n : parameter,\n );\n const callExpression = ts.factory.createCallExpression(\n expression,\n types,\n argumentsArray,\n );\n return callExpression;\n};\n\n/**\n * Create a named export declaration. Example: `export { X } from './y'`.\n * @param exports - named imports to export\n * @param module - module containing exports\n * @returns ts.ExportDeclaration\n */\nexport const createNamedExportDeclarations = ({\n exports,\n module,\n}: {\n exports: Array<ImportExportItem> | ImportExportItem;\n module: string;\n}): ts.ExportDeclaration => {\n const exportedTypes = Array.isArray(exports) ? exports : [exports];\n const hasNonTypeExport = exportedTypes.some(\n (item) => typeof item !== 'object' || !item.asType,\n );\n const elements = exportedTypes.map((name) => {\n const item = typeof name === 'string' ? { name } : name;\n return ots.export({\n alias: item.alias,\n asType: hasNonTypeExport && item.asType,\n name: item.name,\n });\n });\n const exportClause = ts.factory.createNamedExports(elements);\n const moduleSpecifier = ots.string(module);\n const statement = ts.factory.createExportDeclaration(\n undefined,\n !hasNonTypeExport,\n exportClause,\n moduleSpecifier,\n );\n return statement;\n};\n\n/**\n * Create a const variable. Optionally, it can use const assertion or export\n * statement. Example: `export x = {} as const`.\n * @param assertion use const assertion?\n * @param exportConst export created variable?\n * @param expression expression for the variable.\n * @param name name of the variable.\n * @returns ts.VariableStatement\n */\nexport const createConstVariable = ({\n assertion,\n comment,\n destructure,\n exportConst,\n expression,\n name,\n typeName,\n}: {\n assertion?: 'const' | ts.TypeNode;\n comment?: Comments;\n destructure?: boolean;\n exportConst?: boolean;\n expression: ts.Expression;\n name: string | ts.TypeReferenceNode;\n // TODO: support a more intuitive definition of generics for example\n typeName?: string | ts.IndexedAccessTypeNode | ts.TypeNode;\n}): ts.VariableStatement => {\n const initializer = assertion\n ? createAsExpression({\n expression,\n type:\n typeof assertion === 'string'\n ? createTypeReferenceNode({ typeName: assertion })\n : assertion,\n })\n : expression;\n const nameIdentifier =\n typeof name === 'string'\n ? createIdentifier({ text: name })\n : // TODO: https://github.com/hey-api/openapi-ts/issues/2289\n (name as unknown as ts.Identifier);\n const declaration = ts.factory.createVariableDeclaration(\n destructure\n ? ts.factory.createObjectBindingPattern([\n ts.factory.createBindingElement(\n undefined,\n undefined,\n nameIdentifier,\n undefined,\n ),\n ])\n : nameIdentifier,\n undefined,\n typeName\n ? typeof typeName === 'string'\n ? createTypeReferenceNode({ typeName })\n : typeName\n : undefined,\n initializer,\n );\n const statement = ts.factory.createVariableStatement(\n exportConst ? [createModifier({ keyword: 'export' })] : undefined,\n ts.factory.createVariableDeclarationList([declaration], ts.NodeFlags.Const),\n );\n\n addLeadingComments({\n comments: comment,\n node: statement,\n });\n\n return statement;\n};\n\n/**\n * Create a named import declaration. Example: `import { X } from './y'`.\n * @param imports - named exports to import\n * @param module - module containing imports\n * @returns ts.ImportDeclaration\n */\nexport const createNamedImportDeclarations = ({\n imports,\n module,\n}: {\n imports: Array<ImportExportItem> | ImportExportItem;\n module: string;\n}): ts.ImportDeclaration => {\n const importedTypes = Array.isArray(imports) ? imports : [imports];\n const hasNonTypeImport = importedTypes.some(\n (item) => typeof item !== 'object' || !item.asType,\n );\n let namespaceBinding: ImportExportItemObject | undefined;\n const elements: Array<ts.ImportSpecifier> = [];\n importedTypes.forEach((name) => {\n const item = typeof name === 'string' ? { name } : name;\n if (item.name === '*' && item.alias) {\n namespaceBinding = item;\n } else {\n elements.push(\n ots.import({\n alias: item.alias,\n asType: hasNonTypeImport && item.asType,\n name: item.name,\n }),\n );\n }\n });\n const namedBindings = namespaceBinding\n ? ts.factory.createNamespaceImport(\n createIdentifier({ text: namespaceBinding.alias! }),\n )\n : ts.factory.createNamedImports(elements);\n const importClause = ts.factory.createImportClause(\n !hasNonTypeImport,\n undefined,\n namedBindings,\n );\n const moduleSpecifier = ots.string(module);\n const statement = ts.factory.createImportDeclaration(\n undefined,\n importClause,\n moduleSpecifier,\n );\n return statement;\n};\n","import ts from 'typescript';\n\nimport { createCallExpression } from './module';\nimport {\n type AccessLevel,\n createBlock,\n createTypeNode,\n type FunctionParameter,\n type FunctionTypeParameter,\n toExpression,\n toParameterDeclarations,\n toTypeParameters,\n} from './types';\nimport type { Comments } from './utils';\nimport {\n addLeadingComments,\n createIdentifier,\n createModifier,\n isType,\n} from './utils';\n\n/**\n * Create a class constructor declaration.\n * @param accessLevel - the access level of the constructor.\n * @param comment - comment to add to function.\n * @param multiLine - if it should be multi line.\n * @param parameters - parameters for the constructor.\n * @param statements - statements to put in the constructor body.\n * @returns ts.ConstructorDeclaration\n */\nexport const createConstructorDeclaration = ({\n accessLevel,\n comment,\n multiLine = true,\n parameters = [],\n statements = [],\n}: {\n accessLevel?: AccessLevel;\n comment?: Comments;\n multiLine?: boolean;\n parameters?: FunctionParameter[];\n statements?: ts.Statement[];\n}) => {\n const modifiers = accessLevel\n ? [createModifier({ keyword: accessLevel })]\n : undefined;\n const node = ts.factory.createConstructorDeclaration(\n modifiers,\n toParameterDeclarations(parameters),\n createBlock({ multiLine, statements }),\n );\n\n addLeadingComments({\n comments: comment,\n node,\n });\n\n return node;\n};\n\n/**\n * Create a class method declaration.\n * @param accessLevel - the access level of the method.\n * @param comment - comment to add to function.\n * @param isStatic - if the function is static.\n * @param multiLine - if it should be multi line.\n * @param name - name of the method.\n * @param parameters - parameters for the method.\n * @param returnType - the return type of the method.\n * @param statements - statements to put in the constructor body.\n * @returns ts.MethodDeclaration\n */\nexport const createMethodDeclaration = ({\n accessLevel,\n comment,\n isStatic = false,\n multiLine = true,\n name,\n parameters = [],\n returnType,\n statements = [],\n types = [],\n}: {\n accessLevel?: AccessLevel;\n comment?: Comments;\n isStatic?: boolean;\n multiLine?: boolean;\n name: string;\n parameters?: ReadonlyArray<FunctionParameter>;\n returnType?: string | ts.TypeNode;\n statements?: ts.Statement[];\n types?: FunctionTypeParameter[];\n}) => {\n const modifiers = accessLevel\n ? [createModifier({ keyword: accessLevel })]\n : [];\n\n if (isStatic) {\n modifiers.push(createModifier({ keyword: 'static' }));\n }\n\n const node = ts.factory.createMethodDeclaration(\n modifiers,\n undefined,\n createIdentifier({ text: name }),\n undefined,\n types ? toTypeParameters(types) : undefined,\n toParameterDeclarations(parameters),\n returnType ? createTypeNode(returnType) : undefined,\n createBlock({ multiLine, statements }),\n );\n\n addLeadingComments({\n comments: comment,\n node,\n });\n\n return node;\n};\n\ntype ClassDecorator = {\n args: any[];\n name: string;\n};\n\n/**\n * Create a class declaration.\n */\nexport const createClassDeclaration = ({\n decorator,\n exportClass,\n extendedClasses,\n name,\n nodes,\n}: {\n /**\n * Class decorator.\n */\n decorator?: ClassDecorator;\n /**\n * @default false\n */\n exportClass?: boolean;\n /**\n * List of extended classes.\n */\n extendedClasses?: ReadonlyArray<string>;\n /**\n * Class name.\n */\n name: string;\n /**\n * Class elements.\n */\n nodes: ReadonlyArray<ts.ClassElement>;\n}): ts.ClassDeclaration => {\n const modifiers: Array<ts.ModifierLike> = [];\n\n if (exportClass) {\n modifiers.push(createModifier({ keyword: 'export' }));\n }\n\n if (decorator) {\n modifiers.unshift(\n ts.factory.createDecorator(\n createCallExpression({\n functionName: decorator.name,\n parameters: decorator.args\n .map((arg) => toExpression({ value: arg }))\n .filter(isType<ts.Expression>),\n }),\n ),\n );\n }\n\n const heritageClauses: Array<ts.HeritageClause> = [];\n\n if (extendedClasses) {\n for (const extendedClass of extendedClasses) {\n heritageClauses.push(\n ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [\n ts.factory.createExpressionWithTypeArguments(\n createIdentifier({ text: extendedClass }),\n undefined,\n ),\n ]),\n );\n }\n }\n\n return ts.factory.createClassDeclaration(\n modifiers,\n createIdentifier({ text: name }),\n undefined,\n heritageClauses,\n nodes,\n );\n};\n","import ts from 'typescript';\n\nexport const expressionToStatement = ({\n expression,\n}: {\n expression: ts.Expression;\n}) => {\n const statement = ts.factory.createExpressionStatement(expression);\n return statement;\n};\n","import ts from 'typescript';\n\nimport { createCallExpression } from './module';\nimport { createTypeReferenceNode } from './types';\nimport { createIdentifier, isType } from './utils';\n\nexport const createReturnStatement = ({\n expression,\n}: {\n expression?: ts.Expression;\n}) => ts.factory.createReturnStatement(expression);\n\n/**\n * Create a return function call statement.\n *\n * @example `return fn<string>(params)`\n *\n * @returns ts.ReturnStatement\n */\nexport const createReturnFunctionCall = ({\n args = [],\n name,\n types = [],\n}: {\n /**\n * Arguments to pass to the function.\n */\n args: any[];\n /**\n * Name of the function to call or expression.\n */\n name: string | ts.Expression;\n /**\n * List of function types.\n */\n types?: ReadonlyArray<string | ts.StringLiteral>;\n}) => {\n const typeArguments = types.map((type) =>\n // this works with string literals too despite throwing a type error.\n // should be probably fixed at some point...\n // @ts-expect-error\n createTypeReferenceNode({ typeName: type }),\n );\n const argumentsArray = args\n .map((arg) =>\n ts.isExpression(arg) ? arg : createIdentifier({ text: arg }),\n )\n .filter(isType<ts.Identifier | ts.Expression>);\n const expression = createCallExpression({\n functionName: name,\n parameters: argumentsArray,\n types: typeArguments,\n });\n const statement = createReturnStatement({ expression });\n return statement;\n};\n\nexport const createReturnVariable = ({\n expression,\n}: {\n expression: string | ts.Expression;\n}) => {\n const statement = createReturnStatement({\n expression:\n typeof expression === 'string'\n ? createIdentifier({ text: expression })\n : expression,\n });\n return statement;\n};\n","import ts from 'typescript';\n\nimport { validTypescriptIdentifierRegExp } from '~/utils/regexp';\n\nimport { expressionToStatement } from './convert';\nimport { createCallExpression } from './module';\nimport {\n createArrowFunction,\n createBlock,\n createNewExpression,\n createPropertyAccessChain,\n createPropertyAccessExpression,\n} from './types';\nimport { createIdentifier } from './utils';\n\nexport const createSafeAccessExpression = (path: string[]) =>\n path.slice(1).reduce<ts.Expression>(\n (expression, element) => {\n validTypescriptIdentifierRegExp.lastIndex = 0;\n if (validTypescriptIdentifierRegExp.test(element)) {\n return createPropertyAccessChain({\n expression,\n name: element,\n });\n }\n\n return ts.factory.createElementAccessChain(\n expression,\n ts.factory.createToken(ts.SyntaxKind.QuestionDotToken),\n createIdentifier({ text: element }),\n );\n },\n createIdentifier({ text: path[0]! }),\n );\n\nexport const createAccessExpression = (path: string[]) =>\n path.slice(1).reduce<ts.Expression>(\n (expression, element) =>\n createPropertyAccessExpression({\n expression,\n name: element,\n }),\n createIdentifier({ text: path[0]! }),\n );\n\n/**\n * Handles an array of access expressions instead of nesting them (default TypeScript syntax)\n */\nexport const createPropertyAccessExpressions = ({\n expressions,\n}: {\n expressions: Array<string | ts.Expression | ts.MemberName>;\n}): ts.PropertyAccessExpression => {\n const expression = expressions.reduce((expression, name) => {\n const node = createPropertyAccessExpression({\n expression,\n // @ts-expect-error\n name,\n });\n return node;\n });\n return expression as ts.PropertyAccessExpression;\n};\n\nexport const createBinaryExpression = ({\n left,\n operator = '=',\n right,\n}: {\n left: ts.Expression;\n operator?: '=' | '===' | '!==' | 'in' | '??';\n right: ts.Expression | string;\n}) => {\n const expression = ts.factory.createBinaryExpression(\n left,\n // TODO: add support for other tokens\n operator === '='\n ? ts.SyntaxKind.EqualsToken\n : operator === '==='\n ? ts.SyntaxKind.EqualsEqualsEqualsToken\n : operator === '!=='\n ? ts.SyntaxKind.ExclamationEqualsEqualsToken\n : operator === '??'\n ? ts.SyntaxKind.QuestionQuestionToken\n : ts.SyntaxKind.InKeyword,\n typeof right === 'string' ? createIdentifier({ text: right }) : right,\n );\n return expression;\n};\n\nexport const createIfStatement = ({\n elseStatement,\n expression,\n thenStatement,\n}: {\n elseStatement?: ts.Statement;\n expression: ts.Expression;\n thenStatement: ts.Statement;\n}) => ts.factory.createIfStatement(expression, thenStatement, elseStatement);\n\nexport const createDateTransformMutation = ({\n path,\n}: {\n path: string[];\n}): ts.Statement => {\n const safeAccessExpression = createSafeAccessExpression(path);\n const accessExpression = createAccessExpression(path);\n\n const thenStatement = createBlock({\n statements: [\n expressionToStatement({\n expression: createBinaryExpression({\n left: accessExpression,\n right: createNewExpression({\n argumentsArray: [accessExpression],\n expression: createIdentifier({ text: 'Date' }),\n }),\n }),\n }),\n ],\n });\n\n const statement = createIfStatement({\n expression: safeAccessExpression,\n thenStatement,\n });\n\n return statement;\n};\n\nexport const createFunctionTransformMutation = ({\n path,\n transformerName,\n}: {\n path: string[];\n transformerName: string;\n}) => {\n const safeAccessExpression = createSafeAccessExpression(path);\n const accessExpression = createAccessExpression(path);\n\n const thenStatement = createBlock({\n statements: [\n expressionToStatement({\n expression: createCallExpression({\n functionName: transformerName,\n parameters: [accessExpression],\n }),\n }),\n ],\n });\n\n const statement = [\n createIfStatement({\n expression: safeAccessExpression,\n thenStatement,\n }),\n ];\n\n return statement;\n};\n\nexport const createArrayTransformMutation = ({\n path,\n transformerName,\n}: {\n path: string[];\n transformerName: string;\n}): ts.Statement => {\n const safeAccessExpression = createSafeAccessExpression(path);\n const accessExpression = createAccessExpression(path);\n\n const statement = createIfStatement({\n expression: createCallExpression({\n functionName: createPropertyAccessExpression({\n expression: 'Array',\n name: 'isArray',\n }),\n parameters: [safeAccessExpression],\n }),\n thenStatement: createBlock({\n statements: [\n expressionToStatement({\n expression: ts.factory.createCallChain(\n createPropertyAccessExpression({\n expression: accessExpression,\n name: 'forEach',\n }),\n undefined,\n undefined,\n [createIdentifier({ text: transformerName })],\n ),\n }),\n ],\n }),\n });\n\n return statement;\n};\n\nexport const createDateTransformerExpression = ({\n parameterName,\n}: {\n parameterName: string;\n}) => {\n const expression = createIdentifier({ text: 'Date' });\n const newExpression = createNewExpression({\n argumentsArray: [createIdentifier({ text: parameterName })],\n expression,\n });\n return newExpression;\n};\n\nexport const createArrayMapTransform = ({\n path,\n transformExpression,\n}: {\n path: string[];\n transformExpression: ts.Expression;\n}) => {\n const safeAccessExpression = createSafeAccessExpression(path);\n const accessExpression = createAccessExpression(path);\n\n const statement = createIfStatement({\n expression: createCallExpression({\n functionName: createPropertyAccessExpression({\n expression: 'Array',\n name: 'isArray',\n }),\n parameters: [safeAccessExpression],\n }),\n thenStatement: createBlock({\n statements: [\n expressionToStatement({\n expression: createBinaryExpression({\n left: accessExpression,\n right: ts.factory.createCallChain(\n createPropertyAccessExpression({\n expression: accessExpression,\n name: 'map',\n }),\n undefined,\n undefined,\n [\n createArrowFunction({\n parameters: [\n {\n name: 'item',\n },\n ],\n statements: transformExpression,\n }),\n ],\n ),\n }),\n }),\n ],\n }),\n });\n\n return statement;\n};\n","import ts from 'typescript';\n\nimport { validTypescriptIdentifierRegExp } from '~/utils/regexp';\n\nimport {\n createKeywordTypeNode,\n createMappedTypeNode,\n createParameterDeclaration,\n createStringLiteral,\n createTypeNode,\n createTypeParameterDeclaration,\n createTypeReferenceNode,\n} from './types';\nimport {\n addLeadingComments,\n type Comments,\n createIdentifier,\n createModifier,\n tsNodeToString,\n} from './utils';\n\nconst nullNode = createTypeReferenceNode({ typeName: 'null' });\n\n// Property of a interface type node.\nexport type Property = {\n comment?: Comments;\n isReadOnly?: boolean;\n isRequired?: boolean;\n name: string | ts.PropertyName;\n type: any | ts.TypeNode;\n};\n\n/**\n * Returns a union of provided node with null if marked as nullable,\n * otherwise returns the provided node unmodified.\n */\nconst maybeNullable = ({\n isNullable,\n node,\n}: {\n isNullable?: boolean;\n node: ts.TypeNode;\n}) => {\n if (!isNullable) {\n return node;\n }\n return ts.factory.createUnionTypeNode([node, nullNode]);\n};\n\n/**\n * Create a interface type node. Example `{ readonly x: string, y?: number }`\n * @param properties - the properties of the interface.\n * @param isNullable - if the whole interface can be nullable\n * @returns ts.TypeLiteralNode | ts.TypeUnionNode\n */\nexport const createTypeInterfaceNode = ({\n indexKey,\n indexProperty,\n isNullable,\n properties,\n useLegacyResolution,\n}: {\n /**\n * Adds an index key type.\n *\n * @example\n * ```ts\n * type IndexKey = {\n * [key in Foo]: string\n * }\n * ```\n */\n indexKey?: ts.TypeReferenceNode;\n /**\n * Adds an index signature if defined.\n *\n * @example\n * ```ts\n * type IndexProperty = {\n * [key: string]: string\n * }\n * ```\n */\n indexProperty?: Property;\n isNullable?: boolean;\n properties: Property[];\n useLegacyResolution: boolean;\n}) => {\n const propertyTypes: Array<ts.TypeNode> = [];\n\n const members: Array<ts.TypeElement | ts.MappedTypeNode> = properties.map(\n (property) => {\n const modifiers: readonly ts.Modifier[] | undefined = property.isReadOnly\n ? [createModifier({ keyword: 'readonly' })]\n : undefined;\n\n const questionToken: ts.QuestionToken | undefined =\n property.isRequired !== false\n ? undefined\n : ts.factory.createToken(ts.SyntaxKind.QuestionToken);\n\n const type: ts.TypeNode | undefined = createTypeNode(property.type);\n propertyTypes.push(type);\n\n const signature = ts.factory.createPropertySignature(\n modifiers,\n useLegacyResolution ||\n (typeof property.name === 'string' &&\n property.name.match(validTypescriptIdentifierRegExp)) ||\n (typeof property.name !== 'string' &&\n ts.isPropertyName(property.name))\n ? property.name\n : createStringLiteral({ text: property.name }),\n questionToken,\n type,\n );\n\n addLeadingComments({\n comments: property.comment,\n node: signature,\n });\n\n return signature;\n },\n );\n\n let isIndexMapped = false;\n\n if (indexProperty) {\n if (!properties.length && indexKey) {\n const indexSignature = createMappedTypeNode({\n questionToken: ts.factory.createToken(ts.SyntaxKind.QuestionToken),\n type:\n indexProperty.type ?? createKeywordTypeNode({ keyword: 'string' }),\n typeParameter: createTypeParameterDeclaration({\n constraint: indexKey,\n name: createIdentifier({ text: String(indexProperty.name) }),\n }),\n });\n members.push(indexSignature);\n isIndexMapped = true;\n } else {\n const modifiers: ReadonlyArray<ts.Modifier> | undefined =\n indexProperty.isReadOnly\n ? [createModifier({ keyword: 'readonly' })]\n : undefined;\n const indexSignature = ts.factory.createIndexSignature(\n modifiers,\n [\n createParameterDeclaration({\n name: createIdentifier({ text: String(indexProperty.name) }),\n type: createKeywordTypeNode({ keyword: 'string' }),\n }),\n ],\n createTypeNode(indexProperty.type),\n );\n members.push(indexSignature);\n }\n }\n\n const node = isIndexMapped\n ? members[0]!\n : // @ts-expect-error\n ts.factory.createTypeLiteralNode(members);\n return maybeNullable({\n isNullable,\n // @ts-expect-error\n node,\n });\n};\n\n/**\n * Create type union node. Example `string | number | boolean`\n * @param types - the types in the union\n * @param isNullable - if the whole type can be null\n * @returns ts.UnionTypeNode\n */\nexport const createTypeUnionNode = ({\n isNullable,\n types,\n}: {\n isNullable?: boolean;\n types: ReadonlyArray<any | ts.TypeNode>;\n}) => {\n // flatten nested unions\n const nodes: Array<ts.TypeNode> = [];\n for (const type of types) {\n const node = createTypeNode(type);\n if (ts.isUnionTypeNode(node)) {\n nodes.push(...node.types);\n } else {\n nodes.push(node);\n }\n }\n const unionNode = ts.factory.createUnionTypeNode(nodes);\n return maybeNullable({ isNullable, node: unionNode });\n};\n\n/**\n * Create type intersection node. Example `string & number & boolean`\n * @param types - the types in the union\n * @param isNullable - if the whole type can be null\n * @returns ts.IntersectionTypeNode | ts.UnionTypeNode\n */\nexport const createTypeIntersectionNode = ({\n isNullable,\n types,\n}: {\n isNullable?: boolean;\n types: (any | ts.TypeNode)[];\n}) => {\n // flatten nested intersections\n const nodes: Array<ts.TypeNode> = [];\n for (const type of types) {\n const node = createTypeNode(type);\n if (ts.isIntersectionTypeNode(node)) {\n nodes.push(...node.types);\n } else {\n nodes.push(node);\n }\n }\n const intersectionNode = ts.factory.createIntersectionTypeNode(nodes);\n return maybeNullable({ isNullable, node: intersectionNode });\n};\n\n/**\n * Create type tuple node. Example `string, number, boolean`\n * @param isNullable if the whole type can be null\n * @param types the types in the union\n * @returns ts.UnionTypeNode\n */\nexport const createTypeTupleNode = ({\n isNullable = false,\n types,\n}: {\n isNullable?: boolean;\n types: Array<any | ts.TypeNode>;\n}) => {\n const nodes = types.map((type) => createTypeNode(type));\n const node = ts.factory.createTupleTypeNode(nodes);\n return maybeNullable({ isNullable, node });\n};\n\n/**\n * Create type record node. Example `{ [key: string]: string }`\n * @param keys - key types.\n * @param values - value types.\n * @param isNullable - if the whole type can be null\n * @returns ts.TypeReferenceNode | ts.UnionTypeNode\n */\nexport const createTypeRecordNode = (\n keys: (any | ts.TypeNode)[],\n values: (any | ts.TypeNode)[],\n isNullable: boolean = false,\n useLegacyResolution: boolean = true,\n) => {\n const keyNode = createTypeUnionNode({\n types: keys,\n });\n const valueNode = createTypeUnionNode({\n types: values,\n });\n // NOTE: We use the syntax `{ [key: string]: string }` because using a Record causes\n // invalid types with circular dependencies. This is functionally the same.\n // Ref: https://github.com/hey-api/openapi-ts/issues/370\n const node = createTypeInterfaceNode({\n properties: [\n {\n name: `[key: ${tsNodeToString({ node: keyNode, unescape: true })}]`,\n type: valueNode,\n },\n ],\n useLegacyResolution,\n });\n return maybeNullable({ isNullable, node });\n};\n\n/**\n * Create type array node. Example `Array<string | number>`\n * @param types - the types\n * @param isNullable - if the whole type can be null\n * @returns ts.TypeReferenceNode | ts.UnionTypeNode\n */\nexport const createTypeArrayNode = (\n types:\n | ReadonlyArray<any | ts.TypeNode>\n | ts.TypeNode\n | ts.Identifier\n | string,\n isNullable: boolean = false,\n) => {\n const node = createTypeReferenceNode({\n typeArguments: [\n // @ts-expect-error\n Array.isArray(types) ? createTypeUnionNode({ types }) : types,\n ],\n typeName: 'Array',\n });\n return maybeNullable({ isNullable, node });\n};\n","import * as classes from './classes';\nimport * as convert from './convert';\nimport * as module from './module';\nimport * as _return from './return';\nimport * as transform from './transform';\nimport * as typedef from './typedef';\nimport * as types from './types';\nimport * as utils from './utils';\n\nexport type { Property } from './typedef';\nexport type { FunctionParameter } from './types';\nexport type { Comments } from './utils';\n\nexport const tsc = {\n anonymousFunction: types.createAnonymousFunction,\n arrayLiteralExpression: types.createArrayLiteralExpression,\n arrowFunction: types.createArrowFunction,\n asExpression: types.createAsExpression,\n assignment: types.createAssignment,\n awaitExpression: types.createAwaitExpression,\n binaryExpression: transform.createBinaryExpression,\n block: types.createBlock,\n callExpression: module.createCallExpression,\n classDeclaration: classes.createClassDeclaration,\n conditionalExpression: types.createConditionalExpression,\n constVariable: module.createConstVariable,\n constructorDeclaration: classes.createConstructorDeclaration,\n enumDeclaration: types.createEnumDeclaration,\n exportAllDeclaration: module.createExportAllDeclaration,\n exportNamedDeclaration: module.createNamedExportDeclarations,\n expressionToStatement: convert.expressionToStatement,\n forOfStatement: types.createForOfStatement,\n functionTypeNode: types.createFunctionTypeNode,\n getAccessorDeclaration: types.createGetAccessorDeclaration,\n identifier: utils.createIdentifier,\n ifStatement: transform.createIfStatement,\n indexedAccessTypeNode: types.createIndexedAccessTypeNode,\n isTsNode: utils.isTsNode,\n keywordTypeNode: types.createKeywordTypeNode,\n literalTypeNode: types.createLiteralTypeNode,\n mappedTypeNode: types.createMappedTypeNode,\n methodDeclaration: classes.createMethodDeclaration,\n namedImportDeclarations: module.createNamedImportDeclarations,\n namespaceDeclaration: types.createNamespaceDeclaration,\n newExpression: types.createNewExpression,\n nodeToString: utils.tsNodeToString,\n null: types.createNull,\n objectExpression: types.createObjectType,\n ots: utils.ots,\n parameterDeclaration: types.createParameterDeclaration,\n propertyAccessExpression: types.createPropertyAccessExpression,\n propertyAccessExpressions: transform.createPropertyAccessExpressions,\n propertyAssignment: types.createPropertyAssignment,\n propertyDeclaration: utils.createPropertyDeclaration,\n regularExpressionLiteral: types.createRegularExpressionLiteral,\n returnFunctionCall: _return.createReturnFunctionCall,\n returnStatement: _return.createReturnStatement,\n returnVariable: _return.createReturnVariable,\n safeAccessExpression: transform.createSafeAccessExpression,\n stringLiteral: types.createStringLiteral,\n templateLiteralType: types.createTemplateLiteralType,\n this: utils.createThis,\n transformArrayMap: transform.createArrayMapTransform,\n transformArrayMutation: transform.createArrayTransformMutation,\n transformDateMutation: transform.createDateTransformMutation,\n transformFunctionMutation: transform.createFunctionTransformMutation,\n transformNewDate: transform.createDateTransformerExpression,\n typeAliasDeclaration: types.createTypeAliasDeclaration,\n typeArrayNode: typedef.createTypeArrayNode,\n typeInterfaceNode: typedef.createTypeInterfaceNode,\n typeIntersectionNode: typedef.createTypeIntersectionNode,\n typeNode: types.createTypeNode,\n typeOfExpression: types.createTypeOfExpression,\n typeOperatorNode: types.createTypeOperatorNode,\n typeParameterDeclaration: types.createTypeParameterDeclaration,\n typeParenthesizedNode: types.createTypeParenthesizedNode,\n typeRecordNode: typedef.createTypeRecordNode,\n typeReferenceNode: types.createTypeReferenceNode,\n typeTupleNode: typedef.createTypeTupleNode,\n typeUnionNode: typedef.createTypeUnionNode,\n valueToExpression: types.toExpression,\n};\n\n/** @deprecated use tsc */\nexport const compiler = tsc;\n","import type { Config } from '~/types/config';\n\nexport const transformClassName = ({\n config,\n name,\n}: {\n config: Config;\n name: string;\n}) => {\n const plugin = config.plugins['@hey-api/sdk'];\n if (plugin?.config.classNameBuilder) {\n let customName = '';\n\n if (typeof plugin.config.classNameBuilder === 'function') {\n customName = plugin.config.classNameBuilder(name);\n } else {\n customName = plugin.config.classNameBuilder.replace('{{name}}', name);\n }\n\n return customName;\n }\n\n return name;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\n\nimport type { Auth } from '../../client-core/bundle/auth';\nimport type { HeyApiSdkPlugin } from '../types';\n\n// TODO: parser - handle more security types\nconst securitySchemeObjectToAuthObject = ({\n securitySchemeObject,\n}: {\n securitySchemeObject: IR.SecurityObject;\n}): Auth | undefined => {\n if (securitySchemeObject.type === 'openIdConnect') {\n return {\n scheme: 'bearer',\n type: 'http',\n };\n }\n\n if (securitySchemeObject.type === 'oauth2') {\n if (\n securitySchemeObject.flows.password ||\n securitySchemeObject.flows.authorizationCode ||\n securitySchemeObject.flows.clientCredentials ||\n securitySchemeObject.flows.implicit\n ) {\n return {\n scheme: 'bearer',\n type: 'http',\n };\n }\n\n return;\n }\n\n if (securitySchemeObject.type === 'apiKey') {\n if (securitySchemeObject.in === 'header') {\n return {\n name: securitySchemeObject.name,\n type: 'apiKey',\n };\n }\n\n if (\n securitySchemeObject.in === 'query' ||\n securitySchemeObject.in == 'cookie'\n ) {\n return {\n in: securitySchemeObject.in,\n name: securitySchemeObject.name,\n type: 'apiKey',\n };\n }\n\n return;\n }\n\n if (securitySchemeObject.type === 'http') {\n const scheme = securitySchemeObject.scheme.toLowerCase();\n if (scheme === 'bearer' || scheme === 'basic') {\n return {\n scheme: scheme as 'bearer' | 'basic',\n type: 'http',\n };\n }\n\n return;\n }\n\n return;\n};\n\nexport const operationAuth = ({\n operation,\n plugin,\n}: {\n context: Context;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}): Array<Auth> => {\n if (!operation.security || !plugin.config.auth) {\n return [];\n }\n\n const auth: Array<Auth> = [];\n\n for (const securitySchemeObject of operation.security) {\n const authObject = securitySchemeObjectToAuthObject({\n securitySchemeObject,\n });\n if (authObject) {\n auth.push(authObject);\n } else {\n console.warn(\n `❗️ SDK warning: unsupported security scheme. Please open an issue if you'd like it added https://github.com/hey-api/openapi-ts/issues\\n${JSON.stringify(securitySchemeObject, null, 2)}`,\n );\n }\n }\n\n return auth;\n};\n","export const nuxtTypeComposable = 'TComposable';\nexport const nuxtTypeDefault = 'DefaultT';\nexport const nuxtTypeResponse = 'ResT';\n","const jsonPointerSlash = /~1/g;\nconst jsonPointerTilde = /~0/g;\n\n/**\n * Returns the reusable component name from `$ref`.\n */\nexport const refToName = ($ref: string): string => {\n const path = jsonPointerToPath($ref);\n const name = path[path.length - 1]!;\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n return decodeURI(name);\n};\n\n/**\n * Encodes a path segment for use in a JSON Pointer (RFC 6901).\n *\n * - Replaces all '~' with '~0'.\n * - Replaces all '/' with '~1'.\n *\n * This ensures that path segments containing these characters are safely\n * represented in JSON Pointer strings.\n *\n * @param segment - The path segment (string or number) to encode.\n * @returns The encoded segment as a string.\n */\nexport const encodeJsonPointerSegment = (segment: string | number): string =>\n String(segment).replace(/~/g, '~0').replace(/\\//g, '~1');\n\n/**\n * Converts a JSON Pointer string (RFC 6901) to an array of path segments.\n *\n * - Removes the leading '#' if present.\n * - Splits the pointer on '/'.\n * - Decodes '~1' to '/' and '~0' to '~' in each segment.\n * - Returns an empty array for the root pointer ('#' or '').\n *\n * @param pointer - The JSON Pointer string to convert (e.g., '#/components/schemas/Foo').\n * @returns An array of decoded path segments.\n */\nexport const jsonPointerToPath = (pointer: string): ReadonlyArray<string> => {\n let clean = pointer.trim();\n if (clean.startsWith('#')) {\n clean = clean.slice(1);\n }\n if (clean.startsWith('/')) {\n clean = clean.slice(1);\n }\n if (!clean) {\n return [];\n }\n return clean\n .split('/')\n .map((part) =>\n part.replace(jsonPointerSlash, '/').replace(jsonPointerTilde, '~'),\n );\n};\n\n/**\n * Normalizes a JSON Pointer string to a canonical form.\n *\n * - Ensures the pointer starts with '#'.\n * - Removes trailing slashes (except for root).\n * - Collapses multiple consecutive slashes into one.\n * - Trims whitespace from the input.\n *\n * @param pointer - The JSON Pointer string to normalize.\n * @returns The normalized JSON Pointer string.\n */\nexport const normalizeJsonPointer = (pointer: string): string => {\n let normalized = pointer.trim();\n if (!normalized.startsWith('#')) {\n normalized = `#${normalized}`;\n }\n // Remove trailing slashes (except for root)\n if (normalized.length > 1 && normalized.endsWith('/')) {\n normalized = normalized.slice(0, -1);\n }\n // Collapse multiple slashes\n normalized = normalized.replace(/\\/+/g, '/');\n return normalized;\n};\n\n/**\n * Encode path as JSON Pointer (RFC 6901).\n *\n * @param path\n * @returns\n */\nexport const pathToJsonPointer = (\n path: ReadonlyArray<string | number>,\n): string => {\n const segments = path.map(encodeJsonPointerSegment).join('/');\n return '#' + (segments ? `/${segments}` : '');\n};\n\nexport const resolveRef = <T>({\n $ref,\n spec,\n}: {\n $ref: string;\n spec: Record<string, any>;\n}): T => {\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n const path = jsonPointerToPath(decodeURI($ref));\n\n let current = spec;\n\n for (const part of path) {\n const segment = part as keyof typeof current;\n if (current[segment] === undefined) {\n throw new Error(`Reference not found: ${$ref}`);\n }\n current = current[segment];\n }\n\n return current as T;\n};\n","import type { IR } from '~/ir/types';\nimport type { PluginInstance } from '~/plugins/shared/utils/instance';\nimport { refToName } from '~/utils/ref';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { Field } from '../../client-core/bundle/params';\n\ntype Location = keyof IR.ParametersObject | 'body';\n\ntype SignatureParameter = {\n /**\n * Is this parameter required in the SDK method signature?\n */\n isRequired: boolean;\n /**\n * Parameter name in the SDK method signature.\n */\n name: string;\n /**\n * If the name was modified due to conflicts, this holds the original name.\n */\n originalName?: string;\n /**\n * Parameter schema object.\n */\n schema: IR.SchemaObject;\n};\n\ntype SignatureParameters = Record<string, SignatureParameter>;\n\ntype Signature = {\n fields: ReadonlyArray<Field>;\n parameters: SignatureParameters;\n};\n\n/**\n * Collects and resolves all operation parameters for flattened SDK signatures.\n * - Prefixes all conflicting names with their location (e.g. path_foo, query_foo)\n * - Returns a flat map of resolved parameter names to their metadata\n */\nexport const getSignatureParameters = ({\n operation,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n}): Signature | undefined => {\n // TODO: add cookies\n const locations = [\n 'header',\n 'path',\n 'query',\n ] as const satisfies ReadonlyArray<Location>;\n const nameToLocations: Record<string, Set<Location>> = {};\n\n const addParameter = (name: string, location: Location): void => {\n if (!nameToLocations[name]) {\n nameToLocations[name] = new Set();\n }\n nameToLocations[name].add(location);\n };\n\n for (const location of locations) {\n const parameters = operation.parameters?.[location];\n if (parameters) {\n for (const key in parameters) {\n const parameter = parameters[key]!;\n addParameter(parameter.name, location);\n }\n }\n }\n\n if (operation.body) {\n // spread body if there's only a single object\n if (\n !operation.body.schema.logicalOperator &&\n operation.body.schema.type === 'object' &&\n operation.body.schema.properties\n ) {\n const properties = operation.body.schema.properties;\n for (const key in properties) {\n addParameter(key, 'body');\n }\n } else if (operation.body.schema.$ref) {\n // alias body for more ergonomic naming, e.g. user if the type is User\n const name = refToName(operation.body.schema.$ref);\n const key = stringCase({ case: 'camelCase', value: name });\n addParameter(key, 'body');\n } else {\n addParameter('body', 'body');\n }\n }\n\n const conflicts = new Set<string>();\n for (const name in nameToLocations) {\n if (nameToLocations[name]!.size > 1) {\n conflicts.add(name);\n }\n }\n\n const signatureParameters: SignatureParameters = {};\n const fields: Array<Field> = [];\n\n for (const location of locations) {\n const parameters = operation.parameters?.[location];\n if (parameters) {\n for (const key in parameters) {\n const parameter = parameters[key]!;\n const originalName = parameter.name;\n const name = conflicts.has(originalName)\n ? `${location}_${originalName}`\n : originalName;\n const signatureParameter: SignatureParameter = {\n isRequired: parameter.required ?? false,\n name,\n schema: parameter.schema,\n };\n if (name !== originalName) {\n signatureParameter.originalName = originalName;\n }\n signatureParameters[name] = signatureParameter;\n fields.push({\n in: location === 'header' ? 'headers' : location,\n key: name,\n ...(name !== originalName ? { map: originalName } : {}),\n });\n }\n }\n }\n\n if (operation.body) {\n const location = 'body';\n if (\n !operation.body.schema.logicalOperator &&\n operation.body.schema.type === 'object' &&\n operation.body.schema.properties\n ) {\n const properties = operation.body.schema.properties;\n for (const originalName in properties) {\n const property = properties[originalName]!;\n const name = conflicts.has(originalName)\n ? `${location}_${originalName}`\n : originalName;\n const signatureParameter: SignatureParameter = {\n isRequired: property.required?.includes(originalName) ?? false,\n name,\n schema: property,\n };\n if (name !== originalName) {\n signatureParameter.originalName = originalName;\n }\n signatureParameters[name] = signatureParameter;\n fields.push({\n in: location,\n key: name,\n ...(name !== originalName ? { map: originalName } : {}),\n });\n }\n } else if (operation.body.schema.$ref) {\n const value = refToName(operation.body.schema.$ref);\n const originalName = stringCase({ case: 'camelCase', value });\n const name = conflicts.has(originalName)\n ? `${location}_${originalName}`\n : originalName;\n const signatureParameter: SignatureParameter = {\n isRequired: operation.body.required ?? false,\n name,\n schema: operation.body.schema,\n };\n if (name !== originalName) {\n signatureParameter.originalName = originalName;\n }\n signatureParameters[name] = signatureParameter;\n fields.push({\n key: name,\n map: 'body',\n });\n } else {\n // never alias body\n signatureParameters.body = {\n isRequired: operation.body.required ?? false,\n name: 'body',\n schema: operation.body.schema,\n };\n fields.push({ in: 'body' });\n }\n }\n\n if (!Object.keys(signatureParameters).length) {\n return;\n }\n\n return { fields, parameters: signatureParameters };\n};\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\n\nimport type { HeyApiSdkPlugin } from '../types';\n\ninterface ValidatorProps {\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}\n\nexport const createRequestValidator = ({\n operation,\n plugin,\n}: ValidatorProps): ts.ArrowFunction | undefined => {\n if (!plugin.config.validator.request) return;\n\n const validator = plugin.getPluginOrThrow(plugin.config.validator.request);\n if (!validator.api.createRequestValidator) return;\n\n return validator.api.createRequestValidator({\n operation,\n // @ts-expect-error\n plugin: validator,\n });\n};\n\nexport const createResponseValidator = ({\n operation,\n plugin,\n}: ValidatorProps): ts.ArrowFunction | undefined => {\n if (!plugin.config.validator.response) return;\n\n const validator = plugin.getPluginOrThrow(plugin.config.validator.response);\n if (!validator.api.createResponseValidator) return;\n\n return validator.api.createResponseValidator({\n operation,\n // @ts-expect-error\n plugin: validator,\n });\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { Context } from '~/ir/context';\nimport { statusCodeToGroup } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { sanitizeNamespaceIdentifier } from '~/openApi/common/parser/sanitize';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport { toRefs } from '~/plugins/shared/utils/refs';\nimport type { Property } from '~/tsc';\nimport { tsc } from '~/tsc';\nimport type { FunctionParameter, ObjectValue } from '~/tsc/types';\nimport { reservedJavaScriptKeywordsRegExp } from '~/utils/regexp';\nimport { stringCase } from '~/utils/stringCase';\nimport { transformClassName } from '~/utils/transform';\n\nimport type { Field, Fields } from '../../client-core/bundle/params';\nimport type { HeyApiSdkPlugin } from '../types';\nimport { operationAuth } from './auth';\nimport { nuxtTypeComposable, nuxtTypeDefault } from './constants';\nimport { getSignatureParameters } from './signature';\nimport { createRequestValidator, createResponseValidator } from './validator';\n\ninterface ClassNameEntry {\n /**\n * Name of the class where this function appears.\n */\n className: string;\n /**\n * Name of the function within the class.\n */\n methodName: string;\n /**\n * JSONPath-like array to class location.\n */\n path: ReadonlyArray<string>;\n}\n\nconst operationClassName = ({\n context,\n value,\n}: {\n context: Context;\n value: string;\n}) => {\n const name = stringCase({\n case: 'PascalCase',\n value: sanitizeNamespaceIdentifier(value),\n });\n return transformClassName({\n config: context.config,\n name,\n });\n};\n\nconst getOperationMethodName = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: {\n config: Pick<\n HeyApiSdkPlugin['Instance']['config'],\n 'asClass' | 'methodNameBuilder'\n >;\n };\n}) => {\n if (plugin.config.methodNameBuilder) {\n return plugin.config.methodNameBuilder(operation);\n }\n\n const handleIllegal = !plugin.config.asClass;\n if (handleIllegal && operation.id.match(reservedJavaScriptKeywordsRegExp)) {\n return `${operation.id}_`;\n }\n\n return operation.id;\n};\n\n/**\n * Returns a list of classes where this operation appears in the generated SDK.\n */\nexport const operationClasses = ({\n context,\n operation,\n plugin,\n}: {\n context: Context;\n operation: IR.OperationObject;\n plugin: {\n config: Pick<\n HeyApiSdkPlugin['Instance']['config'],\n 'asClass' | 'classStructure' | 'instance'\n >;\n };\n}): Map<string, ClassNameEntry> => {\n const classNames = new Map<string, ClassNameEntry>();\n\n let className: string | undefined;\n let methodName: string | undefined;\n let classCandidates: Array<string> = [];\n\n if (plugin.config.classStructure === 'auto' && operation.operationId) {\n classCandidates = operation.operationId.split(/[./]/).filter(Boolean);\n if (classCandidates.length > 1) {\n const methodCandidate = classCandidates.pop()!;\n methodName = stringCase({\n case: 'camelCase',\n value: sanitizeNamespaceIdentifier(methodCandidate),\n });\n className = classCandidates.pop()!;\n }\n }\n\n const rootClasses = plugin.config.instance\n ? [plugin.config.instance as string]\n : (operation.tags ?? ['default']);\n\n for (const rootClass of rootClasses) {\n const finalClassName = operationClassName({\n context,\n value: className || rootClass,\n });\n\n // Default path\n let path = [rootClass];\n if (className) {\n // If root class is already within classCandidates or the same as className\n // do not add it again as this will cause a recursion issue.\n if (classCandidates.includes(rootClass) || rootClass === className) {\n path = [...classCandidates, className];\n } else {\n path = [rootClass, ...classCandidates, className];\n }\n }\n\n classNames.set(rootClass, {\n className: finalClassName,\n methodName: methodName || getOperationMethodName({ operation, plugin }),\n path: path.map((value) =>\n operationClassName({\n context,\n value,\n }),\n ),\n });\n }\n\n return classNames;\n};\n\n/** TODO: needs complete refactor */\nexport const operationOptionsType = ({\n isDataAllowed = true,\n operation,\n plugin,\n throwOnError,\n}: {\n isDataAllowed?: boolean;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n throwOnError?: string;\n}) => {\n const client = getClientPlugin(plugin.context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n\n const symbolDataType = isDataAllowed\n ? plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'typescript',\n })\n : undefined;\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n\n if (isNuxtClient) {\n const symbolResponseType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n });\n const dataType = isDataAllowed\n ? symbolDataType?.placeholder || 'unknown'\n : 'never';\n const responseType = symbolResponseType?.placeholder || 'unknown';\n return `${symbolOptions.placeholder}<${nuxtTypeComposable}, ${dataType}, ${responseType}, ${nuxtTypeDefault}>`;\n }\n\n // TODO: refactor this to be more generic, works for now\n if (throwOnError) {\n const dataType = isDataAllowed\n ? symbolDataType?.placeholder || 'unknown'\n : 'never';\n return `${symbolOptions.placeholder}<${dataType}, ${throwOnError}>`;\n }\n const dataType = isDataAllowed ? symbolDataType?.placeholder : 'never';\n return dataType\n ? `${symbolOptions.placeholder}<${dataType}>`\n : symbolOptions.placeholder;\n};\n\ntype OperationParameters = {\n argNames: Array<string>;\n fields: Array<Field | Fields>;\n parameters: Array<FunctionParameter>;\n};\n\nexport const operationParameters = ({\n isRequiredOptions,\n operation,\n plugin,\n}: {\n isRequiredOptions: boolean;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}): OperationParameters => {\n const result: OperationParameters = {\n argNames: [],\n fields: [],\n parameters: [],\n };\n\n const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript');\n const client = getClientPlugin(plugin.context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n\n if (plugin.config.paramsStructure === 'flat') {\n const signature = getSignatureParameters({ operation, plugin });\n const flatParamsTypeProperties: Array<Property> = [];\n\n if (signature) {\n let isParametersRequired = false;\n\n for (const key in signature.parameters) {\n const parameter = signature.parameters[key]!;\n if (parameter.isRequired) {\n isParametersRequired = true;\n }\n flatParamsTypeProperties.push({\n isRequired: parameter.isRequired,\n name: parameter.name,\n type: pluginTypeScript.api.schemaToType({\n plugin: pluginTypeScript,\n schema: parameter.schema,\n state: toRefs({\n path: [],\n }),\n }),\n });\n }\n\n result.argNames.push('parameters');\n for (const field of signature.fields) {\n result.fields.push(field);\n }\n\n result.parameters.push({\n isRequired: isParametersRequired,\n name: 'parameters',\n type: tsc.typeInterfaceNode({\n properties: flatParamsTypeProperties,\n useLegacyResolution: false,\n }),\n });\n }\n }\n\n result.parameters.push({\n isRequired: isRequiredOptions,\n name: 'options',\n type: operationOptionsType({\n isDataAllowed: plugin.config.paramsStructure === 'grouped',\n operation,\n plugin,\n throwOnError: isNuxtClient ? undefined : 'ThrowOnError',\n }),\n });\n\n return result;\n};\n\n/**\n * Infers `responseType` value from provided response content type. This is\n * an adapted version of `getParseAs()` from the Fetch API client.\n *\n * From Axios documentation:\n * `responseType` indicates the type of data that the server will respond with\n * options are: 'arraybuffer', 'document', 'json', 'text', 'stream'\n * browser only: 'blob'\n */\nconst getResponseType = (\n contentType: string | null | undefined,\n):\n | 'arraybuffer'\n | 'blob'\n | 'document'\n | 'json'\n | 'stream'\n | 'text'\n | undefined => {\n if (!contentType) {\n return;\n }\n\n const cleanContent = contentType.split(';')[0]?.trim();\n\n if (!cleanContent) {\n return;\n }\n\n if (\n cleanContent.startsWith('application/json') ||\n cleanContent.endsWith('+json')\n ) {\n return 'json';\n }\n\n // Axios does not handle form data out of the box\n // if (cleanContent === 'multipart/form-data') {\n // return 'formData';\n // }\n\n if (\n ['application/', 'audio/', 'image/', 'video/'].some((type) =>\n cleanContent.startsWith(type),\n )\n ) {\n return 'blob';\n }\n\n if (cleanContent.startsWith('text/')) {\n return 'text';\n }\n\n return;\n};\n\nexport const operationStatements = ({\n isRequiredOptions,\n opParameters,\n operation,\n plugin,\n}: {\n isRequiredOptions: boolean;\n opParameters: OperationParameters;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}): Array<ts.Statement> => {\n const client = getClientPlugin(plugin.context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n\n const symbolResponseType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: isNuxtClient ? 'response' : 'responses',\n });\n const responseType = symbolResponseType?.placeholder || 'unknown';\n\n const symbolErrorType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: isNuxtClient ? 'error' : 'errors',\n });\n const errorType = symbolErrorType?.placeholder || 'unknown';\n\n // TODO: transform parameters\n // const query = {\n // BarBaz: options.query.bar_baz,\n // qux_quux: options.query.qux_quux,\n // fooBar: options.query.foo_bar,\n // };\n\n // if (operation.parameters) {\n // for (const name in operation.parameters.query) {\n // const parameter = operation.parameters.query[name]\n // if (parameter.name !== fieldName({ context, name: parameter.name })) {\n // console.warn(parameter.name)\n // }\n // }\n // }\n\n const requestOptions: Array<ObjectValue> = [];\n\n if (operation.body) {\n switch (operation.body.type) {\n case 'form-data': {\n const symbol = plugin.referenceSymbol({\n category: 'external',\n resource: 'client.formDataBodySerializer',\n });\n requestOptions.push({ spread: symbol.placeholder });\n break;\n }\n case 'json':\n // jsonBodySerializer is the default, no need to specify\n break;\n case 'text':\n case 'octet-stream':\n // ensure we don't use any serializer by default\n requestOptions.push({\n key: 'bodySerializer',\n value: null,\n });\n break;\n case 'url-search-params': {\n const symbol = plugin.referenceSymbol({\n category: 'external',\n resource: 'client.urlSearchParamsBodySerializer',\n });\n requestOptions.push({ spread: symbol.placeholder });\n break;\n }\n }\n }\n\n // TODO: parser - set parseAs to skip inference if every response has the same\n // content type. currently impossible because successes do not contain\n // header information\n\n const parameterSerializers: Array<ObjectValue> = [];\n\n for (const name in operation.parameters?.query) {\n const parameter = operation.parameters.query[name]!;\n\n if (\n parameter.schema.type === 'array' ||\n parameter.schema.type === 'tuple'\n ) {\n if (parameter.style !== 'form' || !parameter.explode) {\n // override the default settings for array serialization\n parameterSerializers.push({\n key: parameter.name,\n value: [\n {\n key: 'array',\n value: [\n {\n key: 'explode',\n value:\n parameter.explode !== true ? parameter.explode : undefined,\n },\n {\n key: 'style',\n value:\n parameter.style !== 'form' ? parameter.style : undefined,\n },\n ].filter(({ value }) => value !== undefined),\n },\n ],\n });\n }\n } else if (parameter.schema.type === 'object') {\n if (parameter.style !== 'deepObject' || !parameter.explode) {\n // override the default settings for object serialization\n parameterSerializers.push({\n key: parameter.name,\n value: [\n {\n key: 'object',\n value: [\n {\n key: 'explode',\n value:\n parameter.explode !== true ? parameter.explode : undefined,\n },\n {\n key: 'style',\n value:\n parameter.style !== 'deepObject'\n ? parameter.style\n : undefined,\n },\n ].filter(({ value }) => value !== undefined),\n },\n ],\n });\n }\n }\n }\n\n if (parameterSerializers.length) {\n // TODO: if all parameters have the same serialization,\n // apply it globally to reduce output size\n requestOptions.push({\n key: 'querySerializer',\n value: [\n {\n key: 'parameters',\n value: parameterSerializers,\n },\n ],\n });\n }\n\n const requestValidator = createRequestValidator({ operation, plugin });\n if (requestValidator) {\n requestOptions.push({\n key: 'requestValidator',\n value: requestValidator,\n });\n }\n\n if (plugin.config.transformer) {\n const query: SymbolMeta = {\n category: 'transform',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n };\n if (plugin.isSymbolRegistered(query)) {\n const ref = plugin.referenceSymbol(query);\n requestOptions.push({\n key: 'responseTransformer',\n value: ref.placeholder,\n });\n }\n }\n\n let hasServerSentEvents = false;\n let responseTypeValue: ReturnType<typeof getResponseType> | undefined;\n\n for (const statusCode in operation.responses) {\n const response = operation.responses[statusCode]!;\n\n // try to infer `responseType` option for Axios. We don't need this in\n // Fetch API client because it automatically detects the correct response\n // during runtime.\n if (!responseTypeValue && client.name === '@hey-api/client-axios') {\n // this doesn't handle default status code for now\n if (statusCodeToGroup({ statusCode }) === '2XX') {\n responseTypeValue = getResponseType(response.mediaType);\n if (responseTypeValue) {\n requestOptions.push({\n key: 'responseType',\n value: responseTypeValue,\n });\n }\n }\n }\n\n if (response.mediaType === 'text/event-stream') {\n hasServerSentEvents = true;\n }\n }\n\n const responseValidator = createResponseValidator({ operation, plugin });\n if (responseValidator) {\n requestOptions.push({\n key: 'responseValidator',\n value: responseValidator,\n });\n }\n\n if (plugin.config.responseStyle === 'data') {\n requestOptions.push({\n key: 'responseStyle',\n value: plugin.config.responseStyle,\n });\n }\n\n const auth = operationAuth({ context: plugin.context, operation, plugin });\n if (auth.length) {\n requestOptions.push({\n key: 'security',\n value: tsc.arrayLiteralExpression({ elements: auth }),\n });\n }\n\n requestOptions.push({\n key: 'url',\n value: operation.path,\n });\n\n // options must go last to allow overriding parameters above\n requestOptions.push({ spread: 'options' });\n\n const statements: Array<ts.Statement> = [];\n const hasParams = opParameters.argNames.length;\n\n if (hasParams) {\n const args: Array<unknown> = [];\n const config: Array<unknown> = [];\n for (const argName of opParameters.argNames) {\n args.push(tsc.identifier({ text: argName }));\n }\n for (const field of opParameters.fields) {\n const obj: Array<Record<string, unknown>> = [];\n if ('in' in field) {\n obj.push({\n key: 'in',\n value: field.in,\n });\n if (field.key) {\n obj.push({\n key: 'key',\n value: field.key,\n });\n }\n if (field.map) {\n obj.push({\n key: 'map',\n value: field.map,\n });\n }\n }\n config.push(tsc.objectExpression({ obj }));\n }\n const symbol = plugin.referenceSymbol({\n category: 'external',\n resource: 'client.buildClientParams',\n });\n statements.push(\n tsc.constVariable({\n expression: tsc.callExpression({\n functionName: symbol.placeholder,\n parameters: [\n tsc.arrayLiteralExpression({ elements: args }),\n tsc.arrayLiteralExpression({ elements: config }),\n ],\n }),\n name: 'params',\n }),\n );\n requestOptions.push({ spread: 'params' });\n }\n\n if (operation.body) {\n const parameterContentType = operation.parameters?.header?.['content-type'];\n const hasRequiredContentType = Boolean(parameterContentType?.required);\n // spreading required Content-Type on generated header would throw a TypeScript error\n if (!hasRequiredContentType) {\n const headersValue: Array<unknown> = [\n {\n key: parameterContentType?.name ?? 'Content-Type',\n // form-data does not need Content-Type header, browser will set it automatically\n value:\n operation.body.type === 'form-data'\n ? null\n : operation.body.mediaType,\n },\n {\n spread: tsc.propertyAccessExpression({\n expression: tsc.identifier({ text: 'options' }),\n isOptional: !isRequiredOptions,\n name: 'headers',\n }),\n },\n ];\n if (hasParams) {\n headersValue.push({\n spread: tsc.propertyAccessExpression({\n expression: tsc.identifier({ text: 'params' }),\n name: 'headers',\n }),\n });\n }\n requestOptions.push({\n key: 'headers',\n value: headersValue,\n });\n }\n }\n\n const symbolClient = plugin.config.client\n ? plugin.getSymbol({\n category: 'client',\n })\n : undefined;\n\n const optionsClient = tsc.propertyAccessExpression({\n expression: tsc.identifier({ text: 'options' }),\n isOptional: !isRequiredOptions,\n name: 'client',\n });\n\n let clientExpression: ts.Expression;\n if (plugin.config.instance) {\n clientExpression = tsc.binaryExpression({\n left: optionsClient,\n operator: '??',\n right: tsc.propertyAccessExpression({\n expression: tsc.this(),\n name: '_client',\n }),\n });\n } else if (symbolClient) {\n clientExpression = tsc.binaryExpression({\n left: optionsClient,\n operator: '??',\n right: symbolClient.placeholder,\n });\n } else {\n clientExpression = optionsClient;\n }\n\n const types: Array<string | ts.StringLiteral> = [];\n if (isNuxtClient) {\n types.push(\n nuxtTypeComposable,\n `${responseType} | ${nuxtTypeDefault}`,\n errorType,\n nuxtTypeDefault,\n );\n } else {\n types.push(responseType, errorType, 'ThrowOnError');\n }\n\n if (plugin.config.responseStyle === 'data') {\n types.push(tsc.stringLiteral({ text: plugin.config.responseStyle }));\n }\n\n let functionName = hasServerSentEvents\n ? tsc.propertyAccessExpression({\n expression: clientExpression,\n name: tsc.identifier({ text: 'sse' }),\n })\n : clientExpression;\n\n functionName = tsc.propertyAccessExpression({\n expression: functionName,\n name: tsc.identifier({ text: operation.method }),\n });\n\n statements.push(\n tsc.returnFunctionCall({\n args: [\n tsc.objectExpression({\n identifiers: ['responseTransformer'],\n obj: requestOptions,\n }),\n ],\n name: functionName,\n types,\n }),\n );\n\n return statements;\n};\n","import type { Context } from '~/ir/context';\nimport { hasOperationDataRequired } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport type { Comments } from '~/tsc';\nimport { escapeComment } from '~/utils/escape';\n\nexport const createOperationComment = ({\n operation,\n}: {\n operation: IR.OperationObject;\n}): Comments | undefined => {\n const comments: Array<string> = [];\n\n if (operation.summary) {\n comments.push(escapeComment(operation.summary));\n }\n\n if (operation.description) {\n if (comments.length) {\n comments.push(''); // Add an empty line between summary and description\n }\n\n comments.push(escapeComment(operation.description));\n }\n\n if (operation.deprecated) {\n if (comments.length) {\n comments.push(''); // Add an empty line before deprecated\n }\n\n comments.push('@deprecated');\n }\n\n if (!comments.length) {\n return;\n }\n\n return comments;\n};\n\nexport const isOperationOptionsRequired = ({\n context,\n operation,\n}: {\n context: Context;\n operation: IR.OperationObject;\n}): boolean => {\n const client = getClientPlugin(context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n const plugin = context.config.plugins['@hey-api/sdk'];\n if (plugin) {\n if (!plugin.config.client && !plugin.config.instance) {\n return true;\n }\n if (plugin.config.paramsStructure === 'flat') {\n return false;\n }\n }\n return isNuxtClient || hasOperationDataRequired(operation);\n};\n\nexport const hasOperationSse = ({\n operation,\n}: {\n operation: IR.OperationObject;\n}): boolean => {\n for (const statusCode in operation.responses) {\n const response = operation.responses[statusCode]!;\n if (response.mediaType === 'text/event-stream') {\n return true;\n }\n }\n return false;\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation';\nimport {\n createOperationComment,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { AngularCommonPlugin } from './types';\n\ninterface AngularRequestClassEntry {\n className: string;\n classes: Set<string>;\n methods: Set<string>;\n nodes: Array<ts.ClassElement>;\n root: boolean;\n}\n\nconst generateAngularClassRequests = ({\n plugin,\n}: {\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n const requestClasses = new Map<string, AngularRequestClassEntry>();\n const generatedClasses = new Set<string>();\n\n const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');\n\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n\n const classes = operationClasses({\n context: plugin.context,\n operation,\n plugin: sdkPlugin,\n });\n\n for (const entry of classes.values()) {\n entry.path.forEach((currentClassName, index) => {\n if (!requestClasses.has(currentClassName)) {\n requestClasses.set(currentClassName, {\n className: currentClassName,\n classes: new Set(),\n methods: new Set(),\n nodes: [],\n root: !index,\n });\n }\n\n const parentClassName = entry.path[index - 1];\n if (parentClassName && parentClassName !== currentClassName) {\n const parentClass = requestClasses.get(parentClassName)!;\n parentClass.classes.add(currentClassName);\n requestClasses.set(parentClassName, parentClass);\n }\n\n const isLast = entry.path.length === index + 1;\n if (!isLast) {\n return;\n }\n\n const currentClass = requestClasses.get(currentClassName)!;\n\n const requestMethodName =\n plugin.config.httpRequests.methodNameBuilder(operation);\n\n if (currentClass.methods.has(requestMethodName)) {\n return;\n }\n\n const methodNode = generateAngularRequestMethod({\n isRequiredOptions,\n methodName: requestMethodName,\n operation,\n plugin,\n });\n\n if (!currentClass.nodes.length) {\n currentClass.nodes.push(methodNode);\n } else {\n // @ts-expect-error\n currentClass.nodes.push(tsc.identifier({ text: '\\n' }), methodNode);\n }\n\n currentClass.methods.add(requestMethodName);\n requestClasses.set(currentClassName, currentClass);\n });\n }\n },\n {\n order: 'declarations',\n },\n );\n\n const generateClass = (currentClass: AngularRequestClassEntry) => {\n if (generatedClasses.has(currentClass.className)) {\n return;\n }\n\n if (currentClass.classes.size) {\n for (const childClassName of currentClass.classes) {\n const childClass = requestClasses.get(childClassName)!;\n generateClass(childClass);\n\n currentClass.nodes.push(\n tsc.propertyDeclaration({\n initializer: tsc.newExpression({\n argumentsArray: [],\n expression: tsc.identifier({\n text: buildName({\n config: {\n case: 'preserve',\n name: plugin.config.httpRequests.classNameBuilder,\n },\n name: childClass.className,\n }),\n }),\n }),\n name: stringCase({\n case: 'camelCase',\n value: childClass.className,\n }),\n }),\n );\n }\n }\n\n const symbolInjectable = plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/core.Injectable',\n });\n const symbolClass = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'utility',\n resource: 'class',\n resourceId: currentClass.className,\n tool: 'angular',\n },\n name: buildName({\n config: {\n case: 'preserve',\n name: plugin.config.httpRequests.classNameBuilder,\n },\n name: currentClass.className,\n }),\n });\n const node = tsc.classDeclaration({\n decorator: currentClass.root\n ? {\n args: [{ providedIn: 'root' }],\n name: symbolInjectable.placeholder,\n }\n : undefined,\n exportClass: symbolClass.exported,\n name: symbolClass.placeholder,\n nodes: currentClass.nodes,\n });\n plugin.setSymbolValue(symbolClass, node);\n\n generatedClasses.add(currentClass.className);\n };\n\n for (const requestClass of requestClasses.values()) {\n generateClass(requestClass);\n }\n};\n\nconst generateAngularFunctionRequests = ({\n plugin,\n}: {\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'utility',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'angular',\n },\n name: plugin.config.httpRequests.methodNameBuilder(operation),\n });\n const node = generateAngularRequestFunction({\n isRequiredOptions,\n operation,\n plugin,\n symbol,\n });\n plugin.setSymbolValue(symbol, node);\n },\n {\n order: 'declarations',\n },\n );\n};\n\nconst generateRequestCallExpression = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n const symbolClient = plugin.getSymbol({\n category: 'client',\n });\n\n const optionsClient = tsc.propertyAccessExpression({\n expression: tsc.identifier({ text: 'options' }),\n isOptional: true,\n name: 'client',\n });\n\n let clientExpression: ts.Expression;\n if (symbolClient) {\n clientExpression = tsc.binaryExpression({\n left: optionsClient,\n operator: '??',\n right: symbolClient.placeholder,\n });\n } else {\n clientExpression = optionsClient;\n }\n\n return tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: clientExpression,\n name: 'requestOptions',\n }),\n parameters: [\n tsc.objectExpression({\n obj: [\n {\n key: 'responseStyle',\n value: tsc.identifier({ text: \"'data'\" }),\n },\n {\n key: 'method',\n value: tsc.identifier({\n text: `'${operation.method.toUpperCase()}'`,\n }),\n },\n {\n key: 'url',\n value: tsc.identifier({ text: `'${operation.path}'` }),\n },\n {\n spread: 'options',\n },\n ],\n }),\n ],\n });\n};\n\nconst generateAngularRequestMethod = ({\n isRequiredOptions,\n methodName,\n operation,\n plugin,\n}: {\n isRequiredOptions: boolean;\n methodName: string;\n operation: IR.OperationObject;\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n const symbolHttpRequest = plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/common/http.HttpRequest',\n });\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n\n const symbolDataType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'typescript',\n });\n const dataType = symbolDataType?.placeholder || 'unknown';\n\n return tsc.methodDeclaration({\n accessLevel: 'public',\n comment: createOperationComment({ operation }),\n name: methodName,\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: 'options',\n type: `${symbolOptions.placeholder}<${dataType}, ThrowOnError>`,\n },\n ],\n returnType: `${symbolHttpRequest.placeholder}<unknown>`,\n statements: [\n tsc.returnStatement({\n expression: generateRequestCallExpression({\n operation,\n plugin,\n }),\n }),\n ],\n types: [\n {\n default: false,\n extends: 'boolean',\n name: 'ThrowOnError',\n },\n ],\n });\n};\n\nconst generateAngularRequestFunction = ({\n isRequiredOptions,\n operation,\n plugin,\n symbol,\n}: {\n isRequiredOptions: boolean;\n operation: IR.OperationObject;\n plugin: AngularCommonPlugin['Instance'];\n symbol: Symbol;\n}) => {\n const symbolHttpRequest = plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/common/http.HttpRequest',\n });\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n\n const symbolDataType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'typescript',\n });\n const dataType = symbolDataType?.placeholder || 'unknown';\n\n return tsc.constVariable({\n comment: createOperationComment({ operation }),\n exportConst: symbol.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: 'options',\n type: `${symbolOptions.placeholder}<${dataType}, ThrowOnError>`,\n },\n ],\n returnType: `${symbolHttpRequest.placeholder}<unknown>`,\n statements: [\n tsc.returnStatement({\n expression: generateRequestCallExpression({\n operation,\n plugin,\n }),\n }),\n ],\n types: [\n {\n default: false,\n extends: 'boolean',\n name: 'ThrowOnError',\n },\n ],\n }),\n name: symbol.placeholder,\n });\n};\n\nexport const createHttpRequests: AngularCommonPlugin['Handler'] = ({\n plugin,\n}) => {\n if (plugin.config.httpRequests.asClass) {\n generateAngularClassRequests({ plugin });\n } else {\n generateAngularFunctionRequests({ plugin });\n }\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation';\nimport {\n createOperationComment,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { AngularCommonPlugin } from './types';\n\ninterface AngularServiceClassEntry {\n className: string;\n classes: Set<string>;\n methods: Set<string>;\n nodes: Array<ts.ClassElement>;\n root: boolean;\n}\n\nconst generateAngularClassServices = ({\n plugin,\n}: {\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n const serviceClasses = new Map<string, AngularServiceClassEntry>();\n const generatedClasses = new Set<string>();\n\n const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');\n\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n\n const classes = operationClasses({\n context: plugin.context,\n operation,\n plugin: sdkPlugin,\n });\n\n for (const entry of classes.values()) {\n entry.path.forEach((currentClassName, index) => {\n if (!serviceClasses.has(currentClassName)) {\n serviceClasses.set(currentClassName, {\n className: currentClassName,\n classes: new Set(),\n methods: new Set(),\n nodes: [],\n root: !index,\n });\n }\n\n const parentClassName = entry.path[index - 1];\n if (parentClassName && parentClassName !== currentClassName) {\n const parentClass = serviceClasses.get(parentClassName)!;\n parentClass.classes.add(currentClassName);\n serviceClasses.set(parentClassName, parentClass);\n }\n\n const isLast = entry.path.length === index + 1;\n if (!isLast) {\n return;\n }\n\n const currentClass = serviceClasses.get(currentClassName)!;\n\n const resourceMethodName =\n plugin.config.httpResources.methodNameBuilder(operation);\n\n if (currentClass.methods.has(resourceMethodName)) {\n return;\n }\n\n const methodNode = generateAngularResourceMethod({\n isRequiredOptions,\n methodName: resourceMethodName,\n operation,\n plugin,\n });\n\n if (!currentClass.nodes.length) {\n currentClass.nodes.push(methodNode);\n } else {\n // @ts-expect-error\n currentClass.nodes.push(tsc.identifier({ text: '\\n' }), methodNode);\n }\n\n currentClass.methods.add(resourceMethodName);\n serviceClasses.set(currentClassName, currentClass);\n });\n }\n },\n {\n order: 'declarations',\n },\n );\n\n const generateClass = (currentClass: AngularServiceClassEntry) => {\n if (generatedClasses.has(currentClass.className)) {\n return;\n }\n\n if (currentClass.classes.size) {\n for (const childClassName of currentClass.classes) {\n const childClass = serviceClasses.get(childClassName)!;\n generateClass(childClass);\n\n currentClass.nodes.push(\n tsc.propertyDeclaration({\n initializer: tsc.newExpression({\n argumentsArray: [],\n expression: tsc.identifier({\n text: buildName({\n config: {\n case: 'preserve',\n name: plugin.config.httpResources.classNameBuilder,\n },\n name: childClass.className,\n }),\n }),\n }),\n name: stringCase({\n case: 'camelCase',\n value: childClass.className,\n }),\n }),\n );\n }\n }\n\n const symbolInjectable = plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/core.Injectable',\n });\n const symbolClass = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: {\n case: 'preserve',\n name: plugin.config.httpResources.classNameBuilder,\n },\n name: currentClass.className,\n }),\n });\n const node = tsc.classDeclaration({\n decorator: currentClass.root\n ? {\n args: [{ providedIn: 'root' }],\n name: symbolInjectable.placeholder,\n }\n : undefined,\n exportClass: symbolClass.exported,\n name: symbolClass.placeholder,\n nodes: currentClass.nodes,\n });\n plugin.setSymbolValue(symbolClass, node);\n\n generatedClasses.add(currentClass.className);\n };\n\n for (const serviceClass of serviceClasses.values()) {\n generateClass(serviceClass);\n }\n};\n\nconst generateAngularFunctionServices = ({\n plugin,\n}: {\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n\n const symbol = plugin.registerSymbol({\n exported: true,\n name: plugin.config.httpResources.methodNameBuilder(operation),\n });\n const node = generateAngularResourceFunction({\n isRequiredOptions,\n operation,\n plugin,\n symbol,\n });\n plugin.setSymbolValue(symbol, node);\n },\n {\n order: 'declarations',\n },\n );\n};\n\nconst generateResourceCallExpression = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');\n\n const symbolHttpResource = plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/common/http.httpResource',\n });\n\n const symbolResponseType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n });\n const responseType = symbolResponseType?.placeholder || 'unknown';\n\n if (plugin.config.httpRequests.asClass) {\n // For class-based request methods, use inject and class hierarchy\n const classes = operationClasses({\n context: plugin.context,\n operation,\n plugin: sdkPlugin,\n });\n\n const firstEntry = Array.from(classes.values())[0];\n if (firstEntry) {\n // Import the root class from HTTP requests\n const rootClassName = firstEntry.path[0]!;\n const symbolClass = plugin.referenceSymbol({\n category: 'utility',\n resource: 'class',\n resourceId: rootClassName,\n tool: 'angular',\n });\n\n // Build the method access path using inject\n const symbolInject = plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/core.inject',\n });\n let methodAccess: ts.Expression = tsc.callExpression({\n functionName: symbolInject.placeholder,\n parameters: [tsc.identifier({ text: symbolClass.placeholder })],\n });\n\n // Navigate through the class hierarchy\n for (let i = 1; i < firstEntry.path.length; i++) {\n const className = firstEntry.path[i];\n if (className) {\n methodAccess = tsc.propertyAccessExpression({\n expression: methodAccess,\n name: stringCase({\n case: 'camelCase',\n value: className,\n }),\n });\n }\n }\n\n methodAccess = tsc.propertyAccessExpression({\n expression: methodAccess,\n name: plugin.config.httpRequests.methodNameBuilder(operation),\n });\n\n return tsc.callExpression({\n functionName: symbolHttpResource.placeholder,\n parameters: [\n tsc.arrowFunction({\n parameters: [],\n statements: [\n tsc.constVariable({\n expression: tsc.conditionalExpression({\n condition: tsc.identifier({ text: 'options' }),\n whenFalse: tsc.identifier({ text: 'undefined' }),\n whenTrue: tsc.callExpression({\n functionName: 'options',\n parameters: [],\n }),\n }),\n name: 'opts',\n }),\n tsc.returnStatement({\n expression: tsc.conditionalExpression({\n condition: tsc.identifier({ text: 'opts' }),\n whenFalse: tsc.identifier({ text: 'undefined' }),\n whenTrue: tsc.callExpression({\n functionName: methodAccess,\n parameters: [tsc.identifier({ text: 'opts' })],\n }),\n }),\n }),\n ],\n }),\n ],\n types: [tsc.typeNode(responseType)],\n });\n }\n } else {\n const symbolHttpRequest = plugin.referenceSymbol({\n category: 'utility',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'angular',\n });\n\n return tsc.callExpression({\n functionName: symbolHttpResource.placeholder,\n parameters: [\n tsc.arrowFunction({\n parameters: [],\n statements: [\n tsc.constVariable({\n expression: tsc.conditionalExpression({\n condition: tsc.identifier({ text: 'options' }),\n whenFalse: tsc.identifier({ text: 'undefined' }),\n whenTrue: tsc.callExpression({\n functionName: 'options',\n parameters: [],\n }),\n }),\n name: 'opts',\n }),\n tsc.returnStatement({\n expression: tsc.conditionalExpression({\n condition: tsc.identifier({ text: 'opts' }),\n whenFalse: tsc.identifier({ text: 'undefined' }),\n whenTrue: tsc.callExpression({\n functionName: symbolHttpRequest.placeholder,\n parameters: [tsc.identifier({ text: 'opts' })],\n }),\n }),\n }),\n ],\n }),\n ],\n types: [tsc.typeNode(responseType)],\n });\n }\n\n // Fallback return (should not reach here)\n return tsc.callExpression({\n functionName: symbolHttpResource.placeholder,\n parameters: [\n tsc.arrowFunction({\n parameters: [],\n statements: [\n tsc.returnStatement({\n expression: tsc.identifier({ text: 'undefined' }),\n }),\n ],\n }),\n ],\n types: [tsc.typeNode(responseType)],\n });\n};\n\nconst generateAngularResourceMethod = ({\n isRequiredOptions,\n methodName,\n operation,\n plugin,\n}: {\n isRequiredOptions: boolean;\n methodName: string;\n operation: IR.OperationObject;\n plugin: AngularCommonPlugin['Instance'];\n}) => {\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n\n const symbolDataType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'typescript',\n });\n const dataType = symbolDataType?.placeholder || 'unknown';\n\n return tsc.methodDeclaration({\n accessLevel: 'public',\n comment: createOperationComment({ operation }),\n name: methodName,\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: 'options',\n type: `() => ${symbolOptions.placeholder}<${dataType}, ThrowOnError> | undefined`,\n },\n ],\n returnType: undefined,\n statements: [\n tsc.returnStatement({\n expression: generateResourceCallExpression({\n operation,\n plugin,\n }),\n }),\n ],\n types: [\n {\n default: false,\n extends: 'boolean',\n name: 'ThrowOnError',\n },\n ],\n });\n};\n\nconst generateAngularResourceFunction = ({\n isRequiredOptions,\n operation,\n plugin,\n symbol,\n}: {\n isRequiredOptions: boolean;\n operation: IR.OperationObject;\n plugin: AngularCommonPlugin['Instance'];\n symbol: Symbol;\n}) => {\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n\n const symbolDataType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'typescript',\n });\n const dataType = symbolDataType?.placeholder || 'unknown';\n\n return tsc.constVariable({\n comment: createOperationComment({ operation }),\n exportConst: symbol.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: 'options',\n type: `() => ${symbolOptions.placeholder}<${dataType}, ThrowOnError> | undefined`,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: generateResourceCallExpression({\n operation,\n plugin,\n }),\n }),\n ],\n types: [\n {\n default: false,\n extends: 'boolean',\n name: 'ThrowOnError',\n },\n ],\n }),\n name: symbol.placeholder,\n });\n};\n\nexport const createHttpResources: AngularCommonPlugin['Handler'] = ({\n plugin,\n}) => {\n if (plugin.config.httpResources.asClass) {\n generateAngularClassServices({ plugin });\n } else {\n generateAngularFunctionServices({ plugin });\n }\n};\n","import { createHttpRequests } from './httpRequests';\nimport { createHttpResources } from './httpResources';\nimport type { AngularCommonPlugin } from './types';\n\nexport const handler: AngularCommonPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: '@angular/common/http',\n kind: 'type',\n meta: {\n category: 'external',\n resource: '@angular/common/http.HttpRequest',\n },\n name: 'HttpRequest',\n });\n plugin.registerSymbol({\n external: '@angular/core',\n meta: {\n category: 'external',\n resource: '@angular/core.inject',\n },\n name: 'inject',\n });\n plugin.registerSymbol({\n external: '@angular/core',\n meta: {\n category: 'external',\n resource: '@angular/core.Injectable',\n },\n name: 'Injectable',\n });\n plugin.registerSymbol({\n external: '@angular/common/http',\n meta: {\n category: 'external',\n resource: '@angular/common/http.httpResource',\n },\n name: 'httpResource',\n });\n\n if (plugin.config.httpRequests.enabled) {\n createHttpRequests({ plugin });\n }\n\n if (plugin.config.httpResources.enabled) {\n createHttpResources({ plugin });\n }\n};\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { AngularCommonPlugin } from './types';\n\nexport const defaultConfig: AngularCommonPlugin['Config'] = {\n api: new Api(),\n config: {\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/client-angular', '@hey-api/sdk'],\n handler,\n name: '@angular/common',\n output: '@angular/common',\n resolveConfig: (plugin, context) => {\n plugin.config.httpRequests = context.valueToObject({\n defaultValue: {\n asClass: false,\n classNameBuilder: '{{name}}Requests',\n enabled: true,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n },\n value: plugin.config.httpRequests,\n });\n\n if (!plugin.config.httpRequests.methodNameBuilder) {\n const { asClass } = plugin.config.httpRequests;\n plugin.config.httpRequests.methodNameBuilder = (operation) =>\n asClass ? String(operation.id) : `${String(operation.id)}Request`;\n }\n\n plugin.config.httpResources = context.valueToObject({\n defaultValue: {\n asClass: false,\n classNameBuilder: '{{name}}Resources',\n enabled: true,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n },\n value: plugin.config.httpResources,\n });\n\n if (!plugin.config.httpResources.methodNameBuilder) {\n const { asClass } = plugin.config.httpResources;\n plugin.config.httpResources.methodNameBuilder = (operation) =>\n asClass ? String(operation.id) : `${String(operation.id)}Resource`;\n }\n },\n};\n\n/**\n * Type helper for `@angular/common` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export const clientDefaultConfig = {\n baseUrl: true,\n bundle: true,\n exportFromIndex: false,\n} as const;\n\nexport const clientDefaultMeta = {\n dependencies: ['@hey-api/typescript'],\n tags: ['client'],\n} as const;\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { IProject, ProjectRenderMeta } from '@hey-api/codegen-core';\n\nimport type { DefinePlugin } from '~/plugins';\nimport type { Client } from '~/plugins/@hey-api/client-core/types';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport type { Config } from '~/types/config';\n\nimport { ensureDirSync } from './utils';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n/**\n * Returns absolute path to the client folder. This is hard-coded for now.\n */\nexport const clientFolderAbsolutePath = (config: Config): string => {\n const client = getClientPlugin(config);\n\n if ('bundle' in client.config && client.config.bundle) {\n // not proud of this one\n const renamed: Map<string, string> | undefined =\n // @ts-expect-error\n config._FRAGILE_CLIENT_BUNDLE_RENAMED;\n return path.resolve(\n config.output.path,\n 'client',\n `${renamed?.get('index') ?? 'index'}.ts`,\n );\n }\n\n return client.name;\n};\n\n/**\n * Recursively copies files and directories.\n * This is a PnP-compatible alternative to fs.cpSync that works with Yarn PnP's\n * virtualized filesystem.\n */\nconst copyRecursivePnP = (src: string, dest: string) => {\n const stat = fs.statSync(src);\n\n if (stat.isDirectory()) {\n if (!fs.existsSync(dest)) {\n fs.mkdirSync(dest, { recursive: true });\n }\n\n const files = fs.readdirSync(src);\n for (const file of files) {\n copyRecursivePnP(path.join(src, file), path.join(dest, file));\n }\n } else {\n const content = fs.readFileSync(src);\n fs.writeFileSync(dest, content);\n }\n};\n\nconst renameFile = ({\n filePath,\n project,\n renamed,\n}: {\n filePath: string;\n project: IProject;\n renamed: Map<string, string>;\n}) => {\n const extension = path.extname(filePath);\n const name = path.basename(filePath, extension);\n const renamedName = project.fileName?.(name) || name;\n if (renamedName !== name) {\n const outputPath = path.dirname(filePath);\n fs.renameSync(\n filePath,\n path.resolve(outputPath, `${renamedName}${extension}`),\n );\n renamed.set(name, renamedName);\n }\n};\n\nconst replaceImports = ({\n filePath,\n meta,\n renamed,\n}: {\n filePath: string;\n meta: ProjectRenderMeta;\n renamed: Map<string, string>;\n}) => {\n let content = fs.readFileSync(filePath, 'utf8');\n\n content = content.replace(\n /from\\s+['\"](\\.\\.?\\/[^'\"]*?)['\"]/g,\n (match, importPath) => {\n const importIndex = match.indexOf(importPath);\n const extension = path.extname(importPath);\n const fileName = path.basename(importPath, extension);\n const importDir = path.dirname(importPath);\n const replacedName =\n (renamed.get(fileName) ?? fileName) +\n (meta.importFileExtension ? meta.importFileExtension : extension);\n const replacedMatch =\n match.slice(0, importIndex) +\n [importDir, replacedName].filter(Boolean).join('/') +\n match.slice(importIndex + importPath.length);\n return replacedMatch;\n },\n );\n\n const header = '// This file is auto-generated by @hey-api/openapi-ts\\n\\n';\n\n content = `${header}${content}`;\n\n fs.writeFileSync(filePath, content, 'utf8');\n};\n\n/**\n * Creates a `client` folder containing the same modules as the client package.\n */\nexport const generateClientBundle = ({\n meta,\n outputPath,\n plugin,\n project,\n}: {\n meta: ProjectRenderMeta;\n outputPath: string;\n plugin: DefinePlugin<Client.Config & { name: string }>['Config'];\n project?: IProject;\n}): Map<string, string> | undefined => {\n const renamed = new Map<string, string>();\n\n // copy Hey API clients to output\n const isHeyApiClientPlugin = plugin.name.startsWith('@hey-api/client-');\n if (isHeyApiClientPlugin) {\n // copy client core\n const coreOutputPath = path.resolve(outputPath, 'core');\n ensureDirSync(coreOutputPath);\n const coreDistPath = path.resolve(__dirname, 'clients', 'core');\n copyRecursivePnP(coreDistPath, coreOutputPath);\n\n // copy client bundle\n const clientOutputPath = path.resolve(outputPath, 'client');\n ensureDirSync(clientOutputPath);\n const clientDistFolderName = plugin.name.slice('@hey-api/client-'.length);\n const clientDistPath = path.resolve(\n __dirname,\n 'clients',\n clientDistFolderName,\n );\n copyRecursivePnP(clientDistPath, clientOutputPath);\n\n if (project) {\n const copiedCoreFiles = fs.readdirSync(coreOutputPath);\n for (const file of copiedCoreFiles) {\n renameFile({\n filePath: path.resolve(coreOutputPath, file),\n project,\n renamed,\n });\n }\n\n const copiedClientFiles = fs.readdirSync(clientOutputPath);\n for (const file of copiedClientFiles) {\n renameFile({\n filePath: path.resolve(clientOutputPath, file),\n project,\n renamed,\n });\n }\n }\n\n const coreFiles = fs.readdirSync(coreOutputPath);\n for (const file of coreFiles) {\n replaceImports({\n filePath: path.resolve(coreOutputPath, file),\n meta,\n renamed,\n });\n }\n\n const clientFiles = fs.readdirSync(clientOutputPath);\n for (const file of clientFiles) {\n replaceImports({\n filePath: path.resolve(clientOutputPath, file),\n meta,\n renamed,\n });\n }\n return renamed;\n }\n\n const clientSrcPath = path.isAbsolute(plugin.name)\n ? path.dirname(plugin.name)\n : undefined;\n\n // copy custom local client to output\n if (clientSrcPath) {\n const dirPath = path.resolve(outputPath, 'client');\n ensureDirSync(dirPath);\n copyRecursivePnP(clientSrcPath, dirPath);\n return;\n }\n\n // copy third-party client to output\n const clientModulePath = path.normalize(require.resolve(plugin.name));\n const clientModulePathComponents = clientModulePath.split(path.sep);\n const clientDistPath = clientModulePathComponents\n .slice(0, clientModulePathComponents.indexOf('dist') + 1)\n .join(path.sep);\n\n const indexJsFile =\n clientModulePathComponents[clientModulePathComponents.length - 1];\n const distFiles = [indexJsFile!, 'index.d.ts', 'index.d.cts'];\n const dirPath = path.resolve(outputPath, 'client');\n ensureDirSync(dirPath);\n for (const file of distFiles) {\n fs.copyFileSync(\n path.resolve(clientDistPath, file),\n path.resolve(dirPath, file),\n );\n }\n\n return;\n};\n","const parseUrlRegExp =\n /^(([^:/?#]+):)?((\\/\\/)?([^:/?#]*)(:?([^/?#]*)))?([^?#]*)(\\?([^#]*))?(#(.*))?/;\n\ninterface Url {\n host: string;\n path: string;\n port: string;\n protocol: string;\n}\n\nexport const parseUrl = (value: string): Url => {\n const errorResponse: Url = {\n host: '',\n path: '',\n port: '',\n protocol: '',\n };\n\n parseUrlRegExp.lastIndex = 0;\n const match = value.match(parseUrlRegExp);\n\n if (!match) {\n return errorResponse;\n }\n\n const host = match[5] || '';\n\n // value is a relative file system path\n if (host === '.' || host === '..') {\n return errorResponse;\n }\n\n const path = match[8] || '';\n const protocol = match[2] || '';\n\n // value is probably a Windows file system path\n if (protocol.length === 1) {\n return errorResponse;\n }\n\n return {\n host,\n path: path === '/' ? '' : path,\n port: match[7] || '',\n protocol,\n };\n};\n","import { clientFolderAbsolutePath } from '~/generate/client';\nimport { tsc } from '~/tsc';\nimport { parseUrl } from '~/utils/url';\n\nimport type { PluginHandler } from './types';\nimport { getClientBaseUrlKey } from './utils';\n\nconst resolveBaseUrlString = ({\n plugin,\n}: Parameters<PluginHandler>[0]): string | undefined => {\n const { baseUrl } = plugin.config;\n\n if (baseUrl === false) {\n return;\n }\n\n if (typeof baseUrl === 'string') {\n return baseUrl;\n }\n\n const { servers } = plugin.context.ir;\n\n if (!servers) {\n return;\n }\n\n return servers[typeof baseUrl === 'number' ? baseUrl : 0]?.url;\n};\n\nexport const createClient: PluginHandler = ({ plugin }) => {\n const clientModule = clientFolderAbsolutePath(plugin.context.config);\n const symbolCreateClient = plugin.registerSymbol({\n external: clientModule,\n name: 'createClient',\n });\n const symbolCreateConfig = plugin.registerSymbol({\n external: clientModule,\n name: 'createConfig',\n });\n const symbolClientOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client',\n role: 'options',\n });\n\n const { runtimeConfigPath } = plugin.config;\n const symbolCreateClientConfig = runtimeConfigPath\n ? plugin.registerSymbol({\n external: runtimeConfigPath,\n name: 'createClientConfig',\n })\n : undefined;\n\n const defaultValues: Array<unknown> = [];\n\n const resolvedBaseUrl = resolveBaseUrlString({\n plugin: plugin as any,\n });\n if (resolvedBaseUrl) {\n const url = parseUrl(resolvedBaseUrl);\n if (url.protocol && url.host && !resolvedBaseUrl.includes('{')) {\n defaultValues.push({\n key: getClientBaseUrlKey(plugin.context.config),\n value: resolvedBaseUrl,\n });\n } else if (resolvedBaseUrl !== '/' && resolvedBaseUrl.startsWith('/')) {\n const baseUrl = resolvedBaseUrl.endsWith('/')\n ? resolvedBaseUrl.slice(0, -1)\n : resolvedBaseUrl;\n defaultValues.push({\n key: getClientBaseUrlKey(plugin.context.config),\n value: baseUrl,\n });\n }\n }\n\n if ('throwOnError' in plugin.config && plugin.config.throwOnError) {\n defaultValues.push({\n key: 'throwOnError',\n value: true,\n });\n }\n\n const createConfigParameters = [\n tsc.callExpression({\n functionName: symbolCreateConfig.placeholder,\n parameters: defaultValues.length\n ? [tsc.objectExpression({ obj: defaultValues })]\n : undefined,\n types: [\n tsc.typeReferenceNode({ typeName: symbolClientOptions.placeholder }),\n ],\n }),\n ];\n\n const symbolClient = plugin.registerSymbol({\n meta: {\n category: 'client',\n },\n name: 'client',\n });\n const statement = tsc.constVariable({\n exportConst: true,\n expression: tsc.callExpression({\n functionName: symbolCreateClient.placeholder,\n parameters: symbolCreateClientConfig\n ? [\n tsc.callExpression({\n functionName: symbolCreateClientConfig.placeholder,\n parameters: createConfigParameters,\n }),\n ]\n : createConfigParameters,\n }),\n name: symbolClient.placeholder,\n });\n plugin.setSymbolValue(symbolClient, statement);\n};\n","import { clientFolderAbsolutePath } from '~/generate/client';\nimport { tsc } from '~/tsc';\n\nimport type { PluginHandler } from './types';\n\nexport const createClientConfigType = ({\n plugin,\n}: Parameters<PluginHandler>[0]) => {\n const clientModule = clientFolderAbsolutePath(plugin.context.config);\n const symbolClientOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client',\n role: 'options',\n });\n const symbolConfig = plugin.registerSymbol({\n external: clientModule,\n kind: 'type',\n name: 'Config',\n });\n const symbolDefaultClientOptions = plugin.registerSymbol({\n external: clientModule,\n kind: 'type',\n name: 'ClientOptions',\n });\n const symbolCreateClientConfig = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n name: 'CreateClientConfig',\n });\n\n const defaultClientOptionsType = tsc.typeReferenceNode({\n typeName: symbolDefaultClientOptions.placeholder,\n });\n const tType = tsc.typeReferenceNode({ typeName: 'T' });\n const typeCreateClientConfig = tsc.typeAliasDeclaration({\n comment: [\n 'The `createClientConfig()` function will be called on client initialization',\n \"and the returned object will become the client's initial configuration.\",\n '',\n 'You may want to initialize your client this way instead of calling',\n \"`setConfig()`. This is useful for example if you're using Next.js\",\n 'to ensure your client always has the correct values.',\n ],\n exportType: symbolCreateClientConfig.exported,\n name: symbolCreateClientConfig.placeholder,\n type: tsc.functionTypeNode({\n parameters: [\n tsc.parameterDeclaration({\n name: 'override',\n required: false,\n type: tsc.typeReferenceNode({\n typeArguments: [\n tsc.typeIntersectionNode({\n types: [defaultClientOptionsType, tType],\n }),\n ],\n typeName: symbolConfig.placeholder,\n }),\n }),\n ],\n returnType: tsc.typeReferenceNode({\n typeArguments: [\n tsc.typeIntersectionNode({\n types: [\n tsc.typeReferenceNode({\n typeArguments: [defaultClientOptionsType],\n typeName: 'Required',\n }),\n tType,\n ],\n }),\n ],\n typeName: symbolConfig.placeholder,\n }),\n }),\n typeParameters: [\n {\n default: tsc.typeReferenceNode({\n typeName: symbolClientOptions.placeholder,\n }),\n extends: defaultClientOptionsType,\n name: 'T',\n },\n ],\n });\n plugin.setSymbolValue(symbolCreateClientConfig, typeCreateClientConfig);\n};\n","import { createClient } from './client';\nimport { createClientConfigType } from './createClientConfig';\nimport type { PluginHandler } from './types';\n\nexport const clientPluginHandler = ({\n plugin,\n}: Parameters<PluginHandler>[0]) => {\n createClientConfigType({ plugin });\n createClient({ plugin });\n};\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nimport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { HeyApiClientAngularPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientAngularPlugin['Config'] = {\n ...clientDefaultMeta,\n api: new Api(),\n config: {\n ...clientDefaultConfig,\n throwOnError: false,\n },\n handler: clientPluginHandler,\n name: '@hey-api/client-angular',\n};\n\n/**\n * Type helper for `@hey-api/client-angular` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nimport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { HeyApiClientAxiosPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientAxiosPlugin['Config'] = {\n ...clientDefaultMeta,\n api: new Api(),\n config: {\n ...clientDefaultConfig,\n throwOnError: false,\n },\n handler: clientPluginHandler,\n name: '@hey-api/client-axios',\n};\n\n/**\n * Type helper for `@hey-api/client-axios` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nimport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { HeyApiClientFetchPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientFetchPlugin['Config'] = {\n ...clientDefaultMeta,\n api: new Api(),\n config: {\n ...clientDefaultConfig,\n throwOnError: false,\n },\n handler: clientPluginHandler,\n name: '@hey-api/client-fetch',\n};\n\n/**\n * Type helper for `@hey-api/client-fetch` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nimport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { HeyApiClientNextPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientNextPlugin['Config'] = {\n ...clientDefaultMeta,\n api: new Api(),\n config: {\n ...clientDefaultConfig,\n throwOnError: false,\n },\n handler: clientPluginHandler,\n name: '@hey-api/client-next',\n};\n\n/**\n * Type helper for `@hey-api/client-next` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nimport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { HeyApiClientNuxtPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientNuxtPlugin['Config'] = {\n ...clientDefaultMeta,\n api: new Api(),\n config: clientDefaultConfig,\n handler: clientPluginHandler,\n name: '@hey-api/client-nuxt',\n};\n\n/**\n * Type helper for `@hey-api/client-nuxt` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import {\n clientDefaultConfig,\n clientDefaultMeta,\n} from '~/plugins/@hey-api/client-core/config';\nimport { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { HeyApiClientOfetchPlugin } from './types';\n\nexport const defaultConfig: HeyApiClientOfetchPlugin['Config'] = {\n ...clientDefaultMeta,\n api: new Api(),\n config: {\n ...clientDefaultConfig,\n throwOnError: false,\n },\n handler: clientPluginHandler,\n name: '@hey-api/client-ofetch',\n};\n\n/**\n * Type helper for `@hey-api/client-ofetch` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import type { RangeOptions, SemVer } from 'semver';\nimport * as semver from 'semver';\n\nexport type Package = {\n /**\n * Get the installed version of a package.\n * @param name The name of the package to get the version for.\n * @returns A SemVer object containing version information, or undefined if the package is not installed\n * or the version string is invalid.\n */\n getVersion: (name: string) => SemVer | undefined;\n /**\n * Check if a given package is installed in the project.\n * @param name The name of the package to check.\n */\n isInstalled: (name: string) => boolean;\n /**\n * Check if the installed version of a package or a given SemVer object satisfies a semver range.\n * @param nameOrVersion The name of the package to check, or a SemVer object.\n * @param range The semver range to check against.\n * @returns True if the version satisfies the range, false otherwise.\n */\n satisfies: (\n nameOrVersion: string | SemVer,\n range: string,\n optionsOrLoose?: boolean | RangeOptions,\n ) => boolean;\n};\n\nexport const satisfies: typeof semver.satisfies = (...args) =>\n semver.satisfies(...args);\n\nexport const packageFactory = (\n dependencies: Record<string, string>,\n): Package => ({\n getVersion: (name) => {\n const version = dependencies[name];\n if (!version) return;\n try {\n let parsed = semver.parse(version);\n if (parsed) return parsed;\n\n const min = semver.minVersion(version);\n if (min) return min;\n\n parsed = semver.coerce(version);\n if (parsed) return parsed;\n } catch {\n // noop\n }\n return;\n },\n isInstalled: (name) => Boolean(dependencies[name]),\n satisfies: (nameOrVersion, range, optionsOrLoose) => {\n const version =\n typeof nameOrVersion === 'string'\n ? dependencies[nameOrVersion]\n : nameOrVersion;\n return version ? satisfies(version, range, optionsOrLoose) : false;\n },\n});\n","import {\n illegalStartCharactersRegExp,\n reservedBrowserGlobalsRegExp,\n reservedJavaScriptGlobalsRegExp,\n reservedJavaScriptKeywordsRegExp,\n reservedNodeGlobalsRegExp,\n reservedTypeScriptKeywordsRegExp,\n} from '~/utils/regexp';\n\nconst regexps = [\n reservedJavaScriptKeywordsRegExp,\n reservedTypeScriptKeywordsRegExp,\n reservedJavaScriptGlobalsRegExp,\n reservedNodeGlobalsRegExp,\n reservedBrowserGlobalsRegExp,\n];\n\nexport const ensureValidIdentifier = (name: string): string => {\n let identifier = name.replace(/[^$\\u200c\\u200d\\p{ID_Continue}]/gu, '_');\n\n illegalStartCharactersRegExp.lastIndex = 0;\n if (illegalStartCharactersRegExp.test(identifier)) {\n return `_${identifier}`;\n }\n\n for (const regexp of regexps) {\n if (identifier.startsWith('_')) {\n return identifier;\n }\n\n identifier = identifier.replace(regexp, '_$1');\n }\n\n return identifier;\n};\n","import { satisfies } from '~/config/utils/package';\nimport type { Context } from '~/ir/context';\nimport type { OpenApiV2_0_XTypes } from '~/openApi/2.0.x';\nimport type { OpenApiV3_0_XTypes } from '~/openApi/3.0.x';\nimport type { OpenApiV3_1_XTypes } from '~/openApi/3.1.x';\nimport { ensureValidIdentifier } from '~/openApi/shared/utils/identifier';\nimport type { OpenApi } from '~/openApi/types';\nimport { tsc } from '~/tsc';\n\nimport type { HeyApiSchemasPlugin } from './types';\n\nconst stripSchema = ({\n plugin,\n schema,\n}: {\n plugin: HeyApiSchemasPlugin['Instance'];\n schema:\n | OpenApiV2_0_XTypes['SchemaObject']\n | OpenApiV3_0_XTypes['SchemaObject']\n | OpenApiV3_1_XTypes['SchemaObject'];\n}) => {\n if (plugin.config.type === 'form') {\n if (schema.description) {\n delete schema.description;\n }\n\n if (schema['x-enum-descriptions']) {\n delete schema['x-enum-descriptions'];\n }\n\n if (schema['x-enum-varnames']) {\n delete schema['x-enum-varnames'];\n }\n\n if (schema['x-enumNames']) {\n delete schema['x-enumNames'];\n }\n\n if (schema.title) {\n delete schema.title;\n }\n }\n};\n\nconst schemaToJsonSchemaDraft_04 = ({\n context,\n plugin,\n schema: _schema,\n}: {\n context: Context;\n plugin: HeyApiSchemasPlugin['Instance'];\n schema: OpenApiV2_0_XTypes['SchemaObject'];\n}): OpenApiV2_0_XTypes['SchemaObject'] => {\n if (Array.isArray(_schema)) {\n return _schema.map((item) =>\n schemaToJsonSchemaDraft_04({\n context,\n plugin,\n schema: item,\n }),\n ) as unknown as OpenApiV2_0_XTypes['SchemaObject'];\n }\n\n const schema = structuredClone(_schema);\n\n if (schema.$ref) {\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n schema.$ref = decodeURI(schema.$ref);\n return schema;\n }\n\n stripSchema({ plugin, schema });\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties !== 'boolean'\n ) {\n schema.additionalProperties = schemaToJsonSchemaDraft_04({\n context,\n plugin,\n schema: schema.additionalProperties,\n });\n }\n\n if (schema.allOf) {\n schema.allOf = schema.allOf.map((item) =>\n schemaToJsonSchemaDraft_04({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.items) {\n schema.items = schemaToJsonSchemaDraft_04({\n context,\n plugin,\n schema: schema.items as OpenApiV2_0_XTypes['SchemaObject'],\n });\n }\n\n if (schema.properties) {\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n\n if (typeof property !== 'boolean') {\n schema.properties[name] = schemaToJsonSchemaDraft_04({\n context,\n plugin,\n schema: property,\n });\n }\n }\n }\n\n return schema;\n};\n\nconst schemaToJsonSchemaDraft_05 = ({\n context,\n plugin,\n schema: _schema,\n}: {\n context: Context;\n plugin: HeyApiSchemasPlugin['Instance'];\n schema:\n | OpenApiV3_0_XTypes['SchemaObject']\n | OpenApiV3_0_XTypes['ReferenceObject'];\n}):\n | OpenApiV3_0_XTypes['SchemaObject']\n | OpenApiV3_0_XTypes['ReferenceObject'] => {\n if (Array.isArray(_schema)) {\n return _schema.map((item) =>\n schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: item,\n }),\n ) as\n | OpenApiV3_0_XTypes['SchemaObject']\n | OpenApiV3_0_XTypes['ReferenceObject'];\n }\n\n const schema = structuredClone(_schema);\n\n if ('$ref' in schema) {\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n schema.$ref = decodeURI(schema.$ref);\n return schema;\n }\n\n stripSchema({ plugin, schema });\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties !== 'boolean'\n ) {\n schema.additionalProperties = schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: schema.additionalProperties,\n });\n }\n\n if (schema.allOf) {\n schema.allOf = schema.allOf.map((item) =>\n schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.anyOf) {\n schema.anyOf = schema.anyOf.map((item) =>\n schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.items) {\n schema.items = schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: schema.items,\n });\n }\n\n if (schema.oneOf) {\n schema.oneOf = schema.oneOf.map((item) =>\n schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.properties) {\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n\n if (typeof property !== 'boolean') {\n schema.properties[name] = schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema: property,\n });\n }\n }\n }\n\n return schema;\n};\n\nconst schemaToJsonSchema2020_12 = ({\n context,\n plugin,\n schema: _schema,\n}: {\n context: Context;\n plugin: HeyApiSchemasPlugin['Instance'];\n schema: OpenApiV3_1_XTypes['SchemaObject'];\n}): OpenApiV3_1_XTypes['SchemaObject'] => {\n if (Array.isArray(_schema)) {\n return _schema.map((item) =>\n schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: item,\n }),\n ) as OpenApiV3_1_XTypes['SchemaObject'];\n }\n\n const schema = structuredClone(_schema);\n\n stripSchema({ plugin, schema });\n\n if (schema.$ref) {\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n schema.$ref = decodeURI(schema.$ref);\n }\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties !== 'boolean'\n ) {\n schema.additionalProperties = schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: schema.additionalProperties,\n });\n }\n\n if (schema.allOf) {\n schema.allOf = schema.allOf.map((item) =>\n schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.anyOf) {\n schema.anyOf = schema.anyOf.map((item) =>\n schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.items) {\n schema.items = schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: schema.items,\n });\n }\n\n if (schema.oneOf) {\n schema.oneOf = schema.oneOf.map((item) =>\n schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.prefixItems) {\n schema.prefixItems = schema.prefixItems.map((item) =>\n schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: item,\n }),\n );\n }\n\n if (schema.properties) {\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n\n if (typeof property !== 'boolean') {\n schema.properties[name] = schemaToJsonSchema2020_12({\n context,\n plugin,\n schema: property,\n });\n }\n }\n }\n\n return schema;\n};\n\nconst schemaName = ({\n name,\n plugin,\n schema,\n}: {\n name: string;\n plugin: HeyApiSchemasPlugin['Instance'];\n schema:\n | OpenApiV2_0_XTypes['SchemaObject']\n | OpenApiV3_0_XTypes['ReferenceObject']\n | OpenApiV3_0_XTypes['SchemaObject']\n | OpenApiV3_1_XTypes['SchemaObject'];\n}): string => {\n let customName = '';\n\n if (plugin.config.nameBuilder) {\n if (typeof plugin.config.nameBuilder === 'function') {\n customName = plugin.config.nameBuilder(name, schema);\n } else {\n customName = plugin.config.nameBuilder.replace('{{name}}', name);\n }\n }\n\n if (!customName) {\n customName = `${name}Schema`;\n }\n\n return ensureValidIdentifier(customName);\n};\n\nconst schemasV2_0_X = ({\n context,\n plugin,\n}: {\n context: Context<OpenApi.V2_0_X>;\n plugin: HeyApiSchemasPlugin['Instance'];\n}) => {\n if (!context.spec.definitions) {\n return;\n }\n\n for (const name in context.spec.definitions) {\n const schema = context.spec.definitions[name]!;\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n resource: 'definition',\n resourceId: name,\n tool: 'json-schema',\n },\n name: schemaName({ name, plugin, schema }),\n });\n const obj = schemaToJsonSchemaDraft_04({\n context,\n plugin,\n schema,\n });\n const statement = tsc.constVariable({\n assertion: 'const',\n exportConst: symbol.exported,\n expression: tsc.objectExpression({ obj }),\n name: symbol.placeholder,\n });\n plugin.setSymbolValue(symbol, statement);\n }\n};\n\nconst schemasV3_0_X = ({\n context,\n plugin,\n}: {\n context: Context<OpenApi.V3_0_X>;\n plugin: HeyApiSchemasPlugin['Instance'];\n}) => {\n if (!context.spec.components) {\n return;\n }\n\n for (const name in context.spec.components.schemas) {\n const schema = context.spec.components.schemas[name]!;\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n resource: 'definition',\n resourceId: name,\n tool: 'json-schema',\n },\n name: schemaName({ name, plugin, schema }),\n });\n const obj = schemaToJsonSchemaDraft_05({\n context,\n plugin,\n schema,\n });\n const statement = tsc.constVariable({\n assertion: 'const',\n exportConst: symbol.exported,\n expression: tsc.objectExpression({ obj }),\n name: symbol.placeholder,\n });\n plugin.setSymbolValue(symbol, statement);\n }\n};\n\nconst schemasV3_1_X = ({\n context,\n plugin,\n}: {\n context: Context<OpenApi.V3_1_X>;\n plugin: HeyApiSchemasPlugin['Instance'];\n}) => {\n if (!context.spec.components) {\n return;\n }\n\n for (const name in context.spec.components.schemas) {\n const schema = context.spec.components.schemas[name]!;\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n resource: 'definition',\n resourceId: name,\n tool: 'json-schema',\n },\n name: schemaName({ name, plugin, schema }),\n });\n const obj = schemaToJsonSchema2020_12({\n context,\n plugin,\n schema,\n });\n const statement = tsc.constVariable({\n assertion: 'const',\n exportConst: symbol.exported,\n expression: tsc.objectExpression({ obj }),\n name: symbol.placeholder,\n });\n plugin.setSymbolValue(symbol, statement);\n }\n};\n\nexport const handler: HeyApiSchemasPlugin['Handler'] = ({ plugin }) => {\n if ('swagger' in plugin.context.spec) {\n schemasV2_0_X({\n context: plugin.context as Context<OpenApi.V2_0_X>,\n plugin,\n });\n return;\n }\n\n if (satisfies(plugin.context.spec.openapi, '>=3.0.0 <3.1.0')) {\n schemasV3_0_X({\n context: plugin.context as Context<OpenApi.V3_0_X>,\n plugin,\n });\n return;\n }\n\n if (satisfies(plugin.context.spec.openapi, '>=3.1.0')) {\n schemasV3_1_X({\n context: plugin.context as Context<OpenApi.V3_1_X>,\n plugin,\n });\n return;\n }\n\n throw new Error('Unsupported OpenAPI specification');\n};\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { HeyApiSchemasPlugin } from './types';\n\nexport const defaultConfig: HeyApiSchemasPlugin['Config'] = {\n api: new Api(),\n config: {\n exportFromIndex: false,\n nameBuilder: (name) => `${name}Schema`,\n type: 'json',\n },\n handler,\n name: '@hey-api/schemas',\n};\n\n/**\n * Type helper for `@hey-api/schemas` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import type ts from 'typescript';\n\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport {\n createOperationComment,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { HeyApiSdkPlugin } from '../types';\nimport { nuxtTypeComposable, nuxtTypeDefault } from './constants';\nimport {\n operationClasses,\n operationParameters,\n operationStatements,\n} from './operation';\n\ntype SdkClassEntry = {\n /**\n * Name of the class.\n */\n className: string;\n /**\n * Class names for child classes located inside this class.\n */\n classes: Set<string>;\n /**\n * Symbol ID for the class.\n */\n id: number;\n /**\n * Track unique added method nodes.\n */\n methods: Set<string>;\n /**\n * List of class nodes containing methods.\n */\n nodes: Array<ts.ClassElement>;\n /**\n * Is this a root class?\n */\n root: boolean;\n};\n\nconst createClientClassNodes = ({\n plugin,\n}: {\n plugin: HeyApiSdkPlugin['Instance'];\n}): ReadonlyArray<ts.ClassElement> => {\n const clientAssignmentStatement = tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: tsc.this(),\n name: '_client',\n }),\n operator: '=',\n right: tsc.propertyAccessExpression({\n expression: tsc.identifier({ text: 'args' }),\n name: 'client',\n }),\n }),\n });\n\n const symbolClient = plugin.referenceSymbol({\n category: 'external',\n resource: 'client.Client',\n });\n const symClient = plugin.getSymbol({\n category: 'client',\n });\n\n return [\n tsc.propertyDeclaration({\n initializer: symClient\n ? tsc.identifier({ text: symClient.placeholder })\n : undefined,\n modifier: 'protected',\n name: '_client',\n type: tsc.typeReferenceNode({ typeName: symbolClient.placeholder }),\n }),\n // @ts-expect-error\n tsc.identifier({ text: '\\n' }),\n tsc.constructorDeclaration({\n multiLine: true,\n parameters: [\n {\n isRequired: !plugin.config.client,\n name: 'args',\n type: tsc.typeInterfaceNode({\n properties: [\n {\n isRequired: !plugin.config.client,\n name: 'client',\n type: symbolClient.placeholder,\n },\n ],\n useLegacyResolution: false,\n }),\n },\n ],\n statements: [\n !plugin.config.client\n ? clientAssignmentStatement\n : tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: tsc.identifier({ text: 'args' }),\n isOptional: true,\n name: 'client',\n }),\n thenStatement: tsc.block({\n statements: [clientAssignmentStatement],\n }),\n }),\n ],\n }),\n ];\n};\n\nexport const generateClassSdk = ({\n plugin,\n}: {\n plugin: HeyApiSdkPlugin['Instance'];\n}): void => {\n const client = getClientPlugin(plugin.context.config);\n const isAngularClient = client.name === '@hey-api/client-angular';\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n const sdkClasses = new Map<string, SdkClassEntry>();\n /**\n * Track unique added classes.\n */\n const generatedClasses = new Set<string>();\n\n const clientClassNodes = plugin.config.instance\n ? createClientClassNodes({ plugin })\n : [];\n\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n const symbolResponse = isNuxtClient\n ? plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n })\n : undefined;\n\n const classes = operationClasses({\n context: plugin.context,\n operation,\n plugin,\n });\n\n for (const entry of classes.values()) {\n entry.path.forEach((currentClassName, index) => {\n const symbolCurrentClass = plugin.referenceSymbol({\n category: 'utility',\n resource: 'class',\n resourceId: currentClassName,\n tool: 'sdk',\n });\n if (!sdkClasses.has(symbolCurrentClass.meta!.resourceId!)) {\n sdkClasses.set(symbolCurrentClass.meta!.resourceId!, {\n className: symbolCurrentClass.meta!.resourceId!,\n classes: new Set(),\n id: symbolCurrentClass.id,\n methods: new Set(),\n nodes: [],\n root: !index,\n });\n }\n\n const parentClassName = entry.path[index - 1];\n if (parentClassName) {\n const symbolParentClass = plugin.referenceSymbol({\n category: 'utility',\n resource: 'class',\n resourceId: parentClassName,\n tool: 'sdk',\n });\n if (\n symbolParentClass.meta?.resourceId !==\n symbolCurrentClass.meta?.resourceId\n ) {\n const parentClass = sdkClasses.get(\n symbolParentClass.meta!.resourceId!,\n )!;\n parentClass.classes.add(symbolCurrentClass.meta!.resourceId!);\n sdkClasses.set(symbolParentClass.meta!.resourceId!, parentClass);\n }\n }\n\n const isLast = entry.path.length === index + 1;\n // add methods only to the last class\n if (!isLast) {\n return;\n }\n\n const currentClass = sdkClasses.get(\n symbolCurrentClass.meta!.resourceId!,\n )!;\n\n // avoid duplicate methods\n if (currentClass.methods.has(entry.methodName)) {\n return;\n }\n\n const opParameters = operationParameters({\n isRequiredOptions,\n operation,\n plugin,\n });\n const statements = operationStatements({\n isRequiredOptions,\n opParameters,\n operation,\n plugin,\n });\n const functionNode = tsc.methodDeclaration({\n accessLevel: 'public',\n comment: createOperationComment({ operation }),\n isStatic: isAngularClient ? false : !plugin.config.instance,\n name: entry.methodName,\n parameters: opParameters.parameters,\n returnType: undefined,\n statements,\n types: isNuxtClient\n ? [\n {\n default: tsc.ots.string('$fetch'),\n extends: tsc.typeNode(\n plugin.referenceSymbol({\n category: 'external',\n resource: 'client.Composable',\n }).placeholder,\n ),\n name: nuxtTypeComposable,\n },\n {\n default: symbolResponse\n ? tsc.typeReferenceNode({\n typeName: symbolResponse.placeholder,\n })\n : tsc.typeNode('undefined'),\n extends: symbolResponse\n ? tsc.typeReferenceNode({\n typeName: symbolResponse.placeholder,\n })\n : undefined,\n name: nuxtTypeDefault,\n },\n ]\n : [\n {\n default:\n ('throwOnError' in client.config\n ? client.config.throwOnError\n : false) ?? false,\n extends: 'boolean',\n name: 'ThrowOnError',\n },\n ],\n });\n\n if (!currentClass.nodes.length) {\n currentClass.nodes.push(functionNode);\n } else {\n currentClass.nodes.push(\n // @ts-expect-error\n tsc.identifier({ text: '\\n' }),\n functionNode,\n );\n }\n\n currentClass.methods.add(entry.methodName);\n\n sdkClasses.set(symbolCurrentClass.meta!.resourceId!, currentClass);\n });\n }\n },\n {\n order: 'declarations',\n },\n );\n\n const symbolHeyApiClient = plugin.registerSymbol({\n exported: false,\n kind: 'class',\n meta: {\n category: 'utility',\n resource: 'class',\n resourceId: '_HeyApiClient',\n tool: 'sdk',\n },\n name: '_HeyApiClient',\n });\n\n const generateClass = (currentClass: SdkClassEntry) => {\n if (generatedClasses.has(currentClass.className)) {\n return;\n }\n\n const resourceId = currentClass.className;\n generatedClasses.add(resourceId);\n\n if (currentClass.classes.size) {\n for (const childClassName of currentClass.classes) {\n const childClass = sdkClasses.get(childClassName)!;\n generateClass(childClass);\n\n const refChildClass = plugin.referenceSymbol({\n category: 'utility',\n resource: 'class',\n resourceId: childClass.className,\n tool: 'sdk',\n });\n\n const originalMemberName = stringCase({\n case: 'camelCase',\n value: refChildClass.meta!.resourceId!,\n });\n // avoid collisions with existing method names\n let memberName = originalMemberName;\n if (currentClass.methods.has(memberName)) {\n let index = 2;\n let attempt = `${memberName}${index}`;\n while (currentClass.methods.has(attempt)) {\n attempt = `${memberName}${index++}`;\n }\n memberName = attempt;\n }\n currentClass.methods.add(memberName);\n\n let subClassReferenceNode:\n | ts.GetAccessorDeclaration\n | ts.PropertyDeclaration;\n if (plugin.isSymbolRegistered(refChildClass.id)) {\n subClassReferenceNode = tsc.propertyDeclaration({\n initializer: plugin.config.instance\n ? tsc.newExpression({\n argumentsArray: plugin.config.instance\n ? [\n tsc.objectExpression({\n multiLine: false,\n obj: [\n {\n key: 'client',\n value: tsc.propertyAccessExpression({\n expression: tsc.this(),\n name: '_client',\n }),\n },\n ],\n }),\n ]\n : [],\n expression: tsc.identifier({\n text: refChildClass.placeholder,\n }),\n })\n : tsc.identifier({ text: refChildClass.placeholder }),\n modifier: plugin.config.instance ? undefined : 'static',\n name: memberName,\n });\n } else {\n subClassReferenceNode = tsc.getAccessorDeclaration({\n modifiers: plugin.config.instance\n ? undefined\n : ['public', 'static'],\n name: memberName,\n statements: plugin.config.instance\n ? [\n tsc.returnStatement({\n expression: tsc.newExpression({\n argumentsArray: [\n tsc.objectExpression({\n multiLine: false,\n obj: [\n {\n key: 'client',\n value: tsc.propertyAccessExpression({\n expression: tsc.this(),\n name: '_client',\n }),\n },\n ],\n }),\n ],\n expression: tsc.identifier({\n text: refChildClass.placeholder,\n }),\n }),\n }),\n ]\n : [\n tsc.returnStatement({\n expression: tsc.identifier({\n text: refChildClass.placeholder,\n }),\n }),\n ],\n });\n }\n\n if (!currentClass.nodes.length) {\n currentClass.nodes.push(subClassReferenceNode);\n } else {\n currentClass.nodes.push(\n // @ts-expect-error\n tsc.identifier({ text: '\\n' }),\n subClassReferenceNode,\n );\n }\n }\n }\n\n const symbol = plugin.registerSymbol({\n exported: true,\n kind: 'class',\n meta: {\n category: 'utility',\n resource: 'class',\n resourceId,\n tool: 'sdk',\n },\n name: resourceId,\n });\n const node = tsc.classDeclaration({\n decorator:\n currentClass.root && isAngularClient\n ? {\n args: [\n {\n providedIn: 'root',\n },\n ],\n name: plugin.referenceSymbol({\n category: 'external',\n resource: '@angular/core.Injectable',\n }).placeholder,\n }\n : undefined,\n exportClass: symbol.exported,\n extendedClasses: plugin.config.instance\n ? [symbolHeyApiClient.placeholder]\n : undefined,\n name: symbol.placeholder,\n nodes: currentClass.nodes,\n });\n plugin.setSymbolValue(symbol, node);\n };\n\n if (clientClassNodes.length) {\n const node = tsc.classDeclaration({\n exportClass: symbolHeyApiClient.exported,\n name: symbolHeyApiClient.placeholder,\n nodes: clientClassNodes,\n });\n plugin.setSymbolValue(symbolHeyApiClient, node);\n }\n\n for (const sdkClass of sdkClasses.values()) {\n generateClass(sdkClass);\n }\n};\n","import type { IR } from '~/ir/types';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport {\n createOperationComment,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\nimport { reservedJavaScriptKeywordsRegExp } from '~/utils/regexp';\n\nimport type { HeyApiSdkPlugin } from '../types';\nimport { nuxtTypeComposable, nuxtTypeDefault } from './constants';\nimport { operationParameters, operationStatements } from './operation';\n\nconst serviceFunctionIdentifier = ({\n id,\n operation,\n plugin,\n}: {\n id: string;\n operation: IR.OperationObject;\n plugin: HeyApiSdkPlugin['Instance'];\n}) => {\n if (plugin.config.methodNameBuilder) {\n return plugin.config.methodNameBuilder(operation);\n }\n\n if (id.match(reservedJavaScriptKeywordsRegExp)) {\n return `${id}_`;\n }\n\n return id;\n};\n\nexport const generateFlatSdk = ({\n plugin,\n}: {\n plugin: HeyApiSdkPlugin['Instance'];\n}): void => {\n const client = getClientPlugin(plugin.context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n\n plugin.forEach(\n 'operation',\n (event) => {\n const { operation } = event;\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n const symbolResponse = isNuxtClient\n ? plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n })\n : undefined;\n const opParameters = operationParameters({\n isRequiredOptions,\n operation,\n plugin,\n });\n const statements = operationStatements({\n isRequiredOptions,\n opParameters,\n operation,\n plugin,\n });\n const symbol = plugin.registerSymbol({\n meta: {\n category: 'sdk',\n path: event._path,\n resource: 'operation',\n resourceId: operation.id,\n tags: event.tags,\n tool: 'sdk',\n },\n name: serviceFunctionIdentifier({\n id: operation.id,\n operation,\n plugin,\n }),\n });\n const node = tsc.constVariable({\n comment: createOperationComment({ operation }),\n exportConst: true,\n expression: tsc.arrowFunction({\n parameters: opParameters.parameters,\n returnType: undefined,\n statements,\n types: isNuxtClient\n ? [\n {\n default: tsc.ots.string('$fetch'),\n extends: tsc.typeNode(\n plugin.referenceSymbol({\n category: 'external',\n resource: 'client.Composable',\n }).placeholder,\n ),\n name: nuxtTypeComposable,\n },\n {\n default: symbolResponse\n ? tsc.typeReferenceNode({\n typeName: symbolResponse.placeholder,\n })\n : tsc.typeNode('undefined'),\n extends: symbolResponse\n ? tsc.typeReferenceNode({\n typeName: symbolResponse.placeholder,\n })\n : undefined,\n name: nuxtTypeDefault,\n },\n ]\n : [\n {\n default:\n ('throwOnError' in client.config\n ? client.config.throwOnError\n : false) ?? false,\n extends: 'boolean',\n name: 'ThrowOnError',\n },\n ],\n }),\n name: symbol.placeholder,\n });\n plugin.setSymbolValue(symbol, node);\n },\n {\n order: 'declarations',\n },\n );\n};\n","import { clientFolderAbsolutePath } from '~/generate/client';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport { tsc } from '~/tsc';\n\nimport type { HeyApiSdkPlugin } from '../types';\nimport { nuxtTypeDefault, nuxtTypeResponse } from './constants';\n\nexport const createTypeOptions = ({\n plugin,\n}: {\n plugin: HeyApiSdkPlugin['Instance'];\n}) => {\n const clientModule = clientFolderAbsolutePath(plugin.context.config);\n const client = getClientPlugin(plugin.context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n\n const symbolTDataShape = plugin.registerSymbol({\n external: clientModule,\n kind: 'type',\n name: 'TDataShape',\n });\n const symbolClient = plugin.registerSymbol({\n external: clientModule,\n kind: 'type',\n meta: {\n category: 'external',\n resource: 'client.Client',\n tool: client.name,\n },\n name: 'Client',\n });\n const symbolClientOptions = plugin.registerSymbol({\n external: clientModule,\n kind: 'type',\n name: 'Options',\n });\n const symbolOptions = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n },\n name: 'Options',\n });\n\n const typeOptions = tsc.typeAliasDeclaration({\n exportType: symbolOptions.exported,\n name: symbolOptions.placeholder,\n type: tsc.typeIntersectionNode({\n types: [\n tsc.typeReferenceNode({\n typeArguments: isNuxtClient\n ? [\n tsc.typeReferenceNode({ typeName: 'TComposable' }),\n tsc.typeReferenceNode({ typeName: 'TData' }),\n tsc.typeReferenceNode({ typeName: nuxtTypeResponse }),\n tsc.typeReferenceNode({ typeName: nuxtTypeDefault }),\n ]\n : [\n tsc.typeReferenceNode({ typeName: 'TData' }),\n tsc.typeReferenceNode({ typeName: 'ThrowOnError' }),\n ],\n typeName: symbolClientOptions.placeholder,\n }),\n tsc.typeInterfaceNode({\n properties: [\n {\n comment: [\n 'You can provide a client instance returned by `createClient()` instead of',\n 'individual options. This might be also useful if you want to implement a',\n 'custom client.',\n ],\n isRequired: !plugin.config.client,\n name: 'client',\n type: tsc.typeReferenceNode({\n typeName: symbolClient.placeholder,\n }),\n },\n {\n comment: [\n 'You can pass arbitrary values through the `meta` object. This can be',\n \"used to access values that aren't defined as part of the SDK function.\",\n ],\n isRequired: false,\n name: 'meta',\n type: tsc.typeReferenceNode({\n typeArguments: [\n tsc.keywordTypeNode({ keyword: 'string' }),\n tsc.keywordTypeNode({ keyword: 'unknown' }),\n ],\n typeName: 'Record',\n }),\n },\n ],\n useLegacyResolution: false,\n }),\n ],\n }),\n typeParameters: isNuxtClient\n ? [\n tsc.typeParameterDeclaration({\n constraint: tsc.typeReferenceNode({\n typeName: plugin.referenceSymbol({\n category: 'external',\n resource: 'client.Composable',\n }).placeholder,\n }),\n defaultType: tsc.typeNode(\"'$fetch'\"),\n name: 'TComposable',\n }),\n tsc.typeParameterDeclaration({\n constraint: tsc.typeReferenceNode({\n typeName: symbolTDataShape.placeholder,\n }),\n defaultType: tsc.typeReferenceNode({\n typeName: symbolTDataShape.placeholder,\n }),\n name: 'TData',\n }),\n tsc.typeParameterDeclaration({\n defaultType: tsc.keywordTypeNode({ keyword: 'unknown' }),\n name: nuxtTypeResponse,\n }),\n tsc.typeParameterDeclaration({\n defaultType: tsc.keywordTypeNode({ keyword: 'undefined' }),\n name: nuxtTypeDefault,\n }),\n ]\n : [\n tsc.typeParameterDeclaration({\n constraint: tsc.typeReferenceNode({\n typeName: symbolTDataShape.placeholder,\n }),\n defaultType: tsc.typeReferenceNode({\n typeName: symbolTDataShape.placeholder,\n }),\n name: 'TData',\n }),\n tsc.typeParameterDeclaration({\n constraint: tsc.keywordTypeNode({ keyword: 'boolean' }),\n defaultType: tsc.keywordTypeNode({ keyword: 'boolean' }),\n name: 'ThrowOnError',\n }),\n ],\n });\n plugin.setSymbolValue(symbolOptions, typeOptions);\n};\n","import { clientFolderAbsolutePath } from '~/generate/client';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\n\nimport { generateClassSdk } from '../shared/class';\nimport { generateFlatSdk } from '../shared/functions';\nimport { createTypeOptions } from '../shared/typeOptions';\nimport type { HeyApiSdkPlugin } from '../types';\n\nexport const handlerV1: HeyApiSdkPlugin['Handler'] = ({ plugin }) => {\n const clientModule = clientFolderAbsolutePath(plugin.context.config);\n const client = getClientPlugin(plugin.context.config);\n const isAngularClient = client.name === '@hey-api/client-angular';\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n\n plugin.registerSymbol({\n external: clientModule,\n meta: {\n category: 'external',\n resource: 'client.formDataBodySerializer',\n tool: client.name,\n },\n name: 'formDataBodySerializer',\n });\n plugin.registerSymbol({\n external: clientModule,\n meta: {\n category: 'external',\n resource: 'client.urlSearchParamsBodySerializer',\n tool: client.name,\n },\n name: 'urlSearchParamsBodySerializer',\n });\n plugin.registerSymbol({\n external: clientModule,\n meta: {\n category: 'external',\n resource: 'client.buildClientParams',\n tool: client.name,\n },\n name: 'buildClientParams',\n });\n if (isNuxtClient) {\n plugin.registerSymbol({\n external: clientModule,\n kind: 'type',\n meta: {\n category: 'external',\n resource: 'client.Composable',\n tool: client.name,\n },\n name: 'Composable',\n });\n }\n if (isAngularClient && plugin.config.asClass) {\n plugin.registerSymbol({\n external: '@angular/core',\n meta: {\n category: 'external',\n resource: '@angular/core.Injectable',\n },\n name: 'Injectable',\n });\n }\n\n createTypeOptions({ plugin });\n\n if (plugin.config.asClass) {\n generateClassSdk({ plugin });\n } else {\n generateFlatSdk({ plugin });\n }\n};\n","import type { HeyApiSdkPlugin } from './types';\nimport { handlerV1 } from './v1/plugin';\n\nexport const handler: HeyApiSdkPlugin['Handler'] = (args) => handlerV1(args);\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { HeyApiSdkPlugin } from './types';\n\nexport const defaultConfig: HeyApiSdkPlugin['Config'] = {\n api: new Api(),\n config: {\n asClass: false,\n auth: true,\n classNameBuilder: '{{name}}',\n classStructure: 'auto',\n client: true,\n exportFromIndex: true,\n instance: false,\n operationId: true,\n paramsStructure: 'grouped',\n response: 'body',\n responseStyle: 'fields',\n transformer: false,\n validator: false,\n },\n dependencies: ['@hey-api/typescript'],\n handler,\n name: '@hey-api/sdk',\n resolveConfig: (plugin, context) => {\n if (plugin.config.client) {\n if (typeof plugin.config.client === 'boolean') {\n plugin.config.client = context.pluginByTag('client', {\n defaultPlugin: '@hey-api/client-fetch',\n });\n }\n\n plugin.dependencies.add(plugin.config.client!);\n } else {\n plugin.config.client = false;\n }\n\n if (plugin.config.transformer) {\n if (typeof plugin.config.transformer === 'boolean') {\n plugin.config.transformer = context.pluginByTag('transformer');\n }\n\n plugin.dependencies.add(plugin.config.transformer!);\n } else {\n plugin.config.transformer = false;\n }\n\n if (typeof plugin.config.validator !== 'object') {\n plugin.config.validator = {\n request: plugin.config.validator,\n response: plugin.config.validator,\n };\n }\n\n if (plugin.config.validator.request) {\n if (typeof plugin.config.validator.request === 'boolean') {\n plugin.config.validator.request = context.pluginByTag('validator');\n }\n\n plugin.dependencies.add(plugin.config.validator.request!);\n } else {\n plugin.config.validator.request = false;\n }\n\n if (plugin.config.validator.response) {\n if (typeof plugin.config.validator.response === 'boolean') {\n plugin.config.validator.response = context.pluginByTag('validator');\n }\n\n plugin.dependencies.add(plugin.config.validator.response!);\n } else {\n plugin.config.validator.response = false;\n }\n\n if (plugin.config.instance) {\n if (typeof plugin.config.instance !== 'string') {\n plugin.config.instance = 'Sdk';\n }\n\n plugin.config.asClass = true;\n } else {\n plugin.config.instance = false;\n }\n\n // Set default classNameBuilder based on client type\n if (plugin.config.classNameBuilder === '{{name}}') {\n if (plugin.config.client === '@hey-api/client-angular') {\n plugin.config.classNameBuilder = '{{name}}Service';\n }\n }\n },\n};\n\n/**\n * Type helper for `@hey-api/sdk` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { tsc } from '~/tsc';\n\nimport type { UserConfig } from './types';\n\nexport type ExpressionTransformer = ({\n config,\n dataExpression,\n schema,\n}: {\n config: Omit<UserConfig, 'name'>;\n dataExpression?: ts.Expression | string;\n schema: IR.SchemaObject;\n}) => Array<ts.Expression> | undefined;\n\nexport const bigIntExpressions: ExpressionTransformer = ({\n dataExpression,\n schema,\n}) => {\n if (schema.type !== 'integer' || schema.format !== 'int64') {\n return;\n }\n\n const bigIntCallExpression =\n dataExpression !== undefined\n ? tsc.callExpression({\n functionName: 'BigInt',\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: dataExpression,\n name: 'toString',\n }),\n }),\n ],\n })\n : undefined;\n\n if (bigIntCallExpression) {\n if (typeof dataExpression === 'string') {\n return [bigIntCallExpression];\n }\n\n if (dataExpression) {\n return [\n tsc.assignment({\n left: dataExpression,\n right: bigIntCallExpression,\n }),\n ];\n }\n }\n\n return;\n};\n\nexport const dateExpressions: ExpressionTransformer = ({\n dataExpression,\n schema,\n}) => {\n if (\n schema.type !== 'string' ||\n !(schema.format === 'date' || schema.format === 'date-time')\n ) {\n return;\n }\n\n const identifierDate = tsc.identifier({ text: 'Date' });\n\n if (typeof dataExpression === 'string') {\n return [\n tsc.newExpression({\n argumentsArray: [tsc.identifier({ text: dataExpression })],\n expression: identifierDate,\n }),\n ];\n }\n\n if (dataExpression) {\n return [\n tsc.assignment({\n left: dataExpression,\n right: tsc.newExpression({\n argumentsArray: [dataExpression],\n expression: identifierDate,\n }),\n }),\n ];\n }\n\n return;\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\nimport ts from 'typescript';\n\nimport { createOperationKey, operationResponsesMap } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { tsc } from '~/tsc';\nimport { refToName } from '~/utils/ref';\n\nimport type { HeyApiTransformersPlugin } from './types';\n\nconst dataVariableName = 'data';\n\n// Track symbols that are currently being built so recursive references\n// can emit calls to transformers that will be implemented later.\nconst buildingSymbols = new Set<number>();\n\nconst ensureStatements = (\n nodes: Array<ts.Expression | ts.Statement>,\n): Array<ts.Statement> =>\n nodes.map((node) =>\n ts.isStatement(node)\n ? node\n : tsc.expressionToStatement({ expression: node }),\n );\n\nconst isNodeReturnStatement = ({\n node,\n}: {\n node: ts.Expression | ts.Statement;\n}) => node.kind === ts.SyntaxKind.ReturnStatement;\n\nconst schemaResponseTransformerNodes = ({\n plugin,\n schema,\n}: {\n plugin: HeyApiTransformersPlugin['Instance'];\n schema: IR.SchemaObject;\n}): Array<ts.Expression | ts.Statement> => {\n const identifierData = tsc.identifier({ text: dataVariableName });\n const nodes = processSchemaType({\n dataExpression: identifierData,\n plugin,\n schema,\n });\n // append return statement if one does not already exist\n if (\n nodes.length &&\n !isNodeReturnStatement({ node: nodes[nodes.length - 1]! })\n ) {\n nodes.push(tsc.returnStatement({ expression: identifierData }));\n }\n return nodes;\n};\n\nconst processSchemaType = ({\n dataExpression,\n plugin,\n schema,\n}: {\n dataExpression?: ts.Expression | string;\n plugin: HeyApiTransformersPlugin['Instance'];\n schema: IR.SchemaObject;\n}): Array<ts.Expression | ts.Statement> => {\n if (schema.$ref) {\n const query: SymbolMeta = {\n category: 'transform',\n resource: 'definition',\n resourceId: schema.$ref,\n };\n\n let symbol = plugin.getSymbol(query);\n\n if (!symbol) {\n // Register a placeholder symbol immediately and set its value to null\n // as a stop token to prevent infinite recursion for self-referential\n // schemas. We also mark this symbol as \"building\" so that nested\n // references to it can emit calls that will be implemented later.\n symbol = plugin.registerSymbol({\n meta: query,\n name: buildName({\n config: {\n case: 'camelCase',\n name: '{{name}}SchemaResponseTransformer',\n },\n name: refToName(schema.$ref),\n }),\n });\n plugin.setSymbolValue(symbol, null);\n }\n\n // Only compute the implementation if the symbol isn't already being built.\n // This prevents infinite recursion on self-referential schemas. We still\n // allow emitting a call when the symbol is currently being built so\n // parent nodes can reference the transformer that will be emitted later.\n const existingValue = plugin.gen.symbols.getValue(symbol.id);\n if (!existingValue && !buildingSymbols.has(symbol.id)) {\n buildingSymbols.add(symbol.id);\n try {\n const refSchema = plugin.context.resolveIrRef<IR.SchemaObject>(\n schema.$ref,\n );\n const nodes = schemaResponseTransformerNodes({\n plugin,\n schema: refSchema,\n });\n\n if (nodes.length) {\n const node = tsc.constVariable({\n expression: tsc.arrowFunction({\n async: false,\n multiLine: true,\n parameters: [\n {\n name: dataVariableName,\n // TODO: parser - add types, generate types without transforms\n type: tsc.keywordTypeNode({ keyword: 'any' }),\n },\n ],\n statements: ensureStatements(nodes),\n }),\n name: symbol.placeholder,\n });\n plugin.setSymbolValue(symbol, node);\n }\n } finally {\n buildingSymbols.delete(symbol.id);\n }\n }\n\n // Only emit a call if the symbol has a value (implementation) OR the\n // symbol is currently being built (recursive reference) — in the\n // latter case we allow emitting a call that will be implemented later.\n const currentValue = plugin.gen.symbols.getValue(symbol.id);\n if (currentValue || buildingSymbols.has(symbol.id)) {\n const ref = plugin.referenceSymbol(query);\n const callExpression = tsc.callExpression({\n functionName: ref.placeholder,\n parameters: [dataExpression],\n });\n\n if (dataExpression) {\n // In a map callback, the item needs to be returned, not just the transformation result\n if (typeof dataExpression === 'string' && dataExpression === 'item') {\n return [\n tsc.returnStatement({\n expression: callExpression,\n }),\n ];\n }\n\n return [\n typeof dataExpression === 'string'\n ? callExpression\n : tsc.assignment({\n left: dataExpression,\n right: callExpression,\n }),\n ];\n }\n }\n\n return [];\n }\n\n if (schema.type === 'array') {\n if (!dataExpression || typeof dataExpression === 'string') {\n return [];\n }\n\n // TODO: parser - handle tuples and complex arrays\n const nodes = !schema.items\n ? []\n : processSchemaType({\n dataExpression: 'item',\n plugin,\n schema: schema.items?.[0]\n ? schema.items[0]\n : {\n ...schema,\n type: undefined,\n },\n });\n\n if (!nodes.length) {\n return [];\n }\n\n // Ensure the map callback has a return statement for the item\n const mapCallbackStatements = ensureStatements(nodes);\n const hasReturnStatement = mapCallbackStatements.some((stmt) =>\n isNodeReturnStatement({ node: stmt }),\n );\n\n if (!hasReturnStatement) {\n mapCallbackStatements.push(\n tsc.returnStatement({\n expression: tsc.identifier({ text: 'item' }),\n }),\n );\n }\n\n return [\n tsc.assignment({\n left: dataExpression,\n right: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: dataExpression,\n name: 'map',\n }),\n parameters: [\n tsc.arrowFunction({\n multiLine: true,\n parameters: [\n {\n name: 'item',\n type: 'any',\n },\n ],\n statements: mapCallbackStatements,\n }),\n ],\n }),\n }),\n ];\n }\n\n if (schema.type === 'object') {\n let nodes: Array<ts.Expression | ts.Statement> = [];\n const required = schema.required ?? [];\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const propertyAccessExpression = tsc.propertyAccessExpression({\n expression: dataExpression || dataVariableName,\n name,\n });\n const propertyNodes = processSchemaType({\n dataExpression: propertyAccessExpression,\n plugin,\n schema: property,\n });\n if (!propertyNodes.length) {\n continue;\n }\n const noNullableTypesInSchema = !property.items?.find(\n (x) => x.type === 'null',\n );\n const requiredField = required.includes(name);\n // Cannot fully rely on required fields\n // Such value has to be present, but it doesn't guarantee that this value is not nullish\n if (requiredField && noNullableTypesInSchema) {\n nodes = nodes.concat(propertyNodes);\n } else {\n nodes.push(\n // todo: Probably, it would make more sense to go with if(x !== undefined && x !== null) instead of if(x)\n // this place influences all underlying transformers, while it's not exactly transformer itself\n // Keep in mind that !!0 === false, so it already makes output for Bigint undesirable\n tsc.ifStatement({\n expression: propertyAccessExpression,\n thenStatement: tsc.block({\n statements: ensureStatements(propertyNodes),\n }),\n }),\n );\n }\n }\n\n return nodes;\n }\n\n if (schema.items) {\n if (schema.items.length === 1) {\n return processSchemaType({\n dataExpression: 'item',\n plugin,\n schema: schema.items[0]!,\n });\n }\n\n let arrayNodes: Array<ts.Expression | ts.Statement> = [];\n // process 2 items if one of them is null\n if (\n schema.logicalOperator === 'and' ||\n (schema.items.length === 2 &&\n schema.items.find(\n (item) => item.type === 'null' || item.type === 'void',\n ))\n ) {\n for (const item of schema.items) {\n const nodes = processSchemaType({\n dataExpression: dataExpression || 'item',\n plugin,\n schema: item,\n });\n if (nodes.length) {\n if (dataExpression) {\n arrayNodes = arrayNodes.concat(nodes);\n } else {\n const identifierItem = tsc.identifier({ text: 'item' });\n // processed means the item was transformed\n arrayNodes.push(\n tsc.ifStatement({\n expression: identifierItem,\n thenStatement: tsc.block({\n statements: ensureStatements(nodes),\n }),\n }),\n tsc.returnStatement({ expression: identifierItem }),\n );\n }\n }\n }\n return arrayNodes;\n }\n\n // assume enums do not contain transformable values\n if (schema.type !== 'enum') {\n if (\n !(schema.items ?? []).every((item) =>\n (\n ['boolean', 'integer', 'null', 'number', 'string'] as ReadonlyArray<\n typeof item.type\n >\n ).includes(item.type),\n )\n ) {\n console.warn(\n `❗️ Transformers warning: schema ${JSON.stringify(schema)} is too complex and won't be currently processed. This will likely produce an incomplete transformer which is not what you want. Please open an issue if you'd like this improved https://github.com/hey-api/openapi-ts/issues`,\n );\n }\n }\n }\n\n for (const transformer of plugin.config.transformers) {\n const t = transformer({\n config: plugin.config,\n dataExpression,\n schema,\n });\n if (t) {\n return t;\n }\n }\n\n return [];\n};\n\n// handles only response transformers for now\nexport const handler: HeyApiTransformersPlugin['Handler'] = ({ plugin }) => {\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const { response } = operationResponsesMap(operation);\n if (!response) return;\n\n if (response.items && response.items.length > 1) {\n if (plugin.context.config.logs.level === 'debug') {\n console.warn(\n `❗️ Transformers warning: route ${createOperationKey(operation)} has ${response.items.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`,\n );\n }\n return;\n }\n\n const symbolResponse = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n });\n if (!symbolResponse) return;\n\n // TODO: parser - consider handling simple string response which is also a date\n const nodes = schemaResponseTransformerNodes({\n plugin,\n schema: response,\n });\n if (!nodes.length) return;\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'transform',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n },\n name: buildName({\n config: {\n case: 'camelCase',\n name: '{{name}}ResponseTransformer',\n },\n name: operation.id,\n }),\n });\n const value = tsc.constVariable({\n exportConst: symbol.exported,\n expression: tsc.arrowFunction({\n async: true,\n multiLine: true,\n parameters: [\n {\n name: dataVariableName,\n // TODO: parser - add types, generate types without transforms\n type: tsc.keywordTypeNode({ keyword: 'any' }),\n },\n ],\n returnType: tsc.typeReferenceNode({\n typeArguments: [\n tsc.typeReferenceNode({ typeName: symbolResponse.placeholder }),\n ],\n typeName: 'Promise',\n }),\n statements: ensureStatements(nodes),\n }),\n name: symbol.placeholder,\n });\n plugin.setSymbolValue(symbol, value);\n },\n {\n order: 'declarations',\n },\n );\n};\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { bigIntExpressions, dateExpressions } from './expressions';\nimport { handler } from './plugin';\nimport type { HeyApiTransformersPlugin } from './types';\n\nexport const defaultConfig: HeyApiTransformersPlugin['Config'] = {\n api: new Api(),\n config: {\n bigInt: true,\n dates: true,\n exportFromIndex: false,\n transformers: [],\n typeTransformers: [],\n },\n dependencies: ['@hey-api/typescript'],\n handler,\n name: '@hey-api/transformers',\n resolveConfig: (plugin) => {\n if (!plugin.config.transformers) {\n plugin.config.transformers = [];\n }\n\n if (plugin.config.dates) {\n plugin.config.transformers = [\n ...plugin.config.transformers,\n dateExpressions,\n ];\n }\n\n if (plugin.config.bigInt) {\n plugin.config.transformers = [\n ...plugin.config.transformers,\n bigIntExpressions,\n ];\n }\n },\n tags: ['transformer'],\n};\n\n/**\n * Type helper for `@hey-api/transformers`, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type { Symbol } from '@hey-api/codegen-core';\nimport ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport {\n getClientBaseUrlKey,\n getClientPlugin,\n} from '~/plugins/@hey-api/client-core/utils';\nimport { tsc } from '~/tsc';\nimport { parseUrl } from '~/utils/url';\n\nimport type { HeyApiTypeScriptPlugin } from '../types';\n\nconst stringType = tsc.keywordTypeNode({ keyword: 'string' });\n\nconst serverToBaseUrlType = ({ server }: { server: IR.ServerObject }) => {\n const url = parseUrl(server.url);\n\n if (url.protocol && url.host) {\n return tsc.literalTypeNode({\n literal: tsc.stringLiteral({ text: server.url }),\n });\n }\n\n return tsc.templateLiteralType({\n value: [\n url.protocol || stringType,\n '://',\n url.host || stringType,\n url.port ? `:${url.port}` : '',\n url.path || '',\n ],\n });\n};\n\nexport const createClientOptions = ({\n plugin,\n servers,\n symbolClientOptions,\n}: {\n plugin: HeyApiTypeScriptPlugin['Instance'];\n servers: ReadonlyArray<IR.ServerObject>;\n symbolClientOptions: Symbol;\n}) => {\n const client = getClientPlugin(plugin.context.config);\n\n const types: Array<ts.TypeNode> = servers.map((server) =>\n serverToBaseUrlType({ server }),\n );\n\n if (!servers.length) {\n types.push(stringType);\n } else if (\n !('strictBaseUrl' in client.config && client.config.strictBaseUrl)\n ) {\n types.push(\n tsc.typeIntersectionNode({\n types: [stringType, ts.factory.createTypeLiteralNode([])],\n }),\n );\n }\n\n const type = tsc.typeInterfaceNode({\n properties: [\n {\n name: getClientBaseUrlKey(plugin.context.config),\n type: tsc.typeUnionNode({ types }),\n },\n ],\n useLegacyResolution: false,\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbolClientOptions.exported,\n name: symbolClientOptions.placeholder,\n type,\n });\n plugin.setSymbolValue(symbolClientOptions, node);\n};\n","import type { IR } from '~/ir/types';\nimport type { Comments } from '~/tsc';\nimport { escapeComment } from '~/utils/escape';\n\nexport const createSchemaComment = ({\n schema,\n}: {\n schema: IR.SchemaObject;\n}): Comments | undefined => {\n const comments: Array<string> = [];\n\n if (schema.title) {\n comments.push(escapeComment(schema.title));\n }\n\n if (schema.description) {\n if (comments.length) {\n comments.push(''); // Add an empty line between title and description\n }\n comments.push(escapeComment(schema.description));\n }\n\n if (schema.deprecated) {\n if (comments.length) {\n comments.push(''); // Add an empty line before deprecated\n }\n comments.push('@deprecated');\n }\n\n return comments.length ? comments : undefined;\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { createSchemaComment } from '~/plugins/shared/utils/schema';\nimport { tsc } from '~/tsc';\nimport { numberRegExp } from '~/utils/regexp';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { HeyApiTypeScriptPlugin } from '../types';\n\nconst schemaToEnumObject = ({\n plugin,\n schema,\n}: {\n plugin: HeyApiTypeScriptPlugin['Instance'];\n schema: IR.SchemaObject;\n}) => {\n const typeofItems: Array<\n | 'bigint'\n | 'boolean'\n | 'function'\n | 'number'\n | 'object'\n | 'string'\n | 'symbol'\n | 'undefined'\n > = [];\n\n const obj = (schema.items ?? []).map((item, index) => {\n const typeOfItemConst = typeof item.const;\n\n if (!typeofItems.includes(typeOfItemConst)) {\n // track types of enum values because some modes support\n // only enums with string and number types\n typeofItems.push(typeOfItemConst);\n }\n\n let key: string | undefined;\n if (item.title) {\n key = item.title;\n } else if (typeOfItemConst === 'number' || typeOfItemConst === 'string') {\n key = `${item.const}`;\n } else if (typeOfItemConst === 'boolean') {\n key = item.const ? 'true' : 'false';\n } else if (item.const === null) {\n key = 'null';\n } else {\n key = `${index}`;\n }\n\n if (key) {\n key = stringCase({\n case: plugin.config.enums.case,\n stripLeadingSeparators: false,\n value: key,\n });\n\n numberRegExp.lastIndex = 0;\n // TypeScript enum keys cannot be numbers\n if (\n numberRegExp.test(key) &&\n plugin.config.enums.enabled &&\n (plugin.config.enums.mode === 'typescript' ||\n plugin.config.enums.mode === 'typescript-const')\n ) {\n key = `_${key}`;\n }\n }\n\n return {\n comments: createSchemaComment({ schema: item }),\n key,\n value: item.const,\n };\n });\n\n return {\n obj,\n typeofItems,\n };\n};\n\nexport const exportType = ({\n plugin,\n schema,\n symbol,\n type,\n}: {\n plugin: HeyApiTypeScriptPlugin['Instance'];\n schema: IR.SchemaObject;\n symbol: Symbol;\n type: ts.TypeNode;\n}) => {\n // root enums have an additional export\n if (schema.type === 'enum' && plugin.config.enums.enabled) {\n const enumObject = schemaToEnumObject({ plugin, schema });\n\n if (plugin.config.enums.mode === 'javascript') {\n // JavaScript enums might want to ignore null values\n if (\n plugin.config.enums.constantsIgnoreNull &&\n enumObject.typeofItems.includes('object')\n ) {\n enumObject.obj = enumObject.obj.filter((item) => item.value !== null);\n }\n\n const objectNode = tsc.constVariable({\n assertion: 'const',\n comment: createSchemaComment({ schema }),\n exportConst: true,\n expression: tsc.objectExpression({\n multiLine: true,\n obj: enumObject.obj,\n }),\n name: symbol.placeholder,\n });\n\n const typeofType = tsc.typeOfExpression({\n text: symbol.placeholder,\n }) as unknown as ts.TypeNode;\n const node = tsc.typeAliasDeclaration({\n comment: createSchemaComment({ schema }),\n exportType: true,\n name: symbol.placeholder,\n type: tsc.indexedAccessTypeNode({\n indexType: tsc.typeOperatorNode({\n operator: 'keyof',\n type: typeofType,\n }),\n objectType: typeofType,\n }),\n });\n plugin.setSymbolValue(symbol, [objectNode, node]);\n return;\n } else if (\n plugin.config.enums.mode === 'typescript' ||\n plugin.config.enums.mode === 'typescript-const'\n ) {\n // TypeScript enums support only string and number values\n const shouldCreateTypeScriptEnum = !enumObject.typeofItems.some(\n (type) => type !== 'number' && type !== 'string',\n );\n if (shouldCreateTypeScriptEnum) {\n const enumNode = tsc.enumDeclaration({\n asConst: plugin.config.enums.mode === 'typescript-const',\n leadingComment: createSchemaComment({ schema }),\n name: symbol.placeholder,\n obj: enumObject.obj,\n });\n plugin.setSymbolValue(symbol, enumNode);\n return;\n }\n }\n }\n\n const node = tsc.typeAliasDeclaration({\n comment: createSchemaComment({ schema }),\n exportType: symbol.exported,\n name: symbol.placeholder,\n type,\n });\n plugin.setSymbolValue(symbol, node);\n};\n","import { operationResponsesMap } from '~/ir/operation';\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { tsc } from '~/tsc';\n\nimport { irSchemaToAst } from '../v1/plugin';\nimport type { IrSchemaToAstOptions } from './types';\n\nconst irParametersToIrSchema = ({\n parameters,\n}: {\n parameters: Record<string, IR.ParameterObject>;\n}): IR.SchemaObject => {\n const irSchema: IR.SchemaObject = {\n type: 'object',\n };\n\n if (parameters) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in parameters) {\n const parameter = parameters[key]!;\n\n properties[parameter.name] = deduplicateSchema({\n detectFormat: false,\n schema: parameter.schema,\n });\n\n if (parameter.required) {\n required.push(parameter.name);\n }\n }\n\n irSchema.properties = properties;\n\n if (required.length) {\n irSchema.required = required;\n }\n }\n\n return irSchema;\n};\n\nconst operationToDataType = ({\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n operation: IR.OperationObject;\n}) => {\n const data: IR.SchemaObject = {\n type: 'object',\n };\n const dataRequired: Array<string> = [];\n\n if (!data.properties) {\n data.properties = {};\n }\n\n if (operation.body) {\n data.properties.body = operation.body.schema;\n\n if (operation.body.required) {\n dataRequired.push('body');\n }\n } else {\n data.properties.body = {\n type: 'never',\n };\n }\n\n // TODO: parser - handle cookie parameters\n\n // do not set headers to never so we can always pass arbitrary values\n if (operation.parameters?.header) {\n data.properties.headers = irParametersToIrSchema({\n parameters: operation.parameters.header,\n });\n\n if (data.properties.headers.required) {\n dataRequired.push('headers');\n }\n }\n\n if (operation.parameters?.path) {\n data.properties.path = irParametersToIrSchema({\n parameters: operation.parameters.path,\n });\n\n if (data.properties.path.required) {\n dataRequired.push('path');\n }\n } else {\n data.properties.path = {\n type: 'never',\n };\n }\n\n if (operation.parameters?.query) {\n data.properties.query = irParametersToIrSchema({\n parameters: operation.parameters.query,\n });\n\n if (data.properties.query.required) {\n dataRequired.push('query');\n }\n } else {\n data.properties.query = {\n type: 'never',\n };\n }\n\n data.properties.url = {\n const: operation.path,\n type: 'string',\n };\n dataRequired.push('url');\n\n data.required = dataRequired;\n\n const symbol = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: plugin.config.requests,\n name: operation.id,\n }),\n });\n const type = irSchemaToAst({\n plugin,\n schema: data,\n state,\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbol.exported,\n name: symbol.placeholder,\n type,\n });\n plugin.setSymbolValue(symbol, node);\n};\n\nexport const operationToType = ({\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n operation: IR.OperationObject;\n}) => {\n operationToDataType({ operation, plugin, state });\n\n const { error, errors, response, responses } =\n operationResponsesMap(operation);\n\n if (errors) {\n const symbolErrors = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'errors',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: plugin.config.errors,\n name: operation.id,\n }),\n });\n const type = irSchemaToAst({\n plugin,\n schema: errors,\n state,\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbolErrors.exported,\n name: symbolErrors.placeholder,\n type,\n });\n plugin.setSymbolValue(symbolErrors, node);\n\n if (error) {\n const symbol = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'error',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: {\n case: plugin.config.errors.case,\n name: plugin.config.errors.error,\n },\n name: operation.id,\n }),\n });\n const type = tsc.indexedAccessTypeNode({\n indexType: tsc.typeOperatorNode({\n operator: 'keyof',\n type: tsc.typeReferenceNode({ typeName: symbolErrors.placeholder }),\n }),\n objectType: tsc.typeReferenceNode({\n typeName: symbolErrors.placeholder,\n }),\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbol.exported,\n name: symbol.placeholder,\n type,\n });\n plugin.setSymbolValue(symbol, node);\n }\n }\n\n if (responses) {\n const symbolResponses = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: plugin.config.responses,\n name: operation.id,\n }),\n });\n const type = irSchemaToAst({\n plugin,\n schema: responses,\n state,\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbolResponses.exported,\n name: symbolResponses.placeholder,\n type,\n });\n plugin.setSymbolValue(symbolResponses, node);\n\n if (response) {\n const symbol = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: {\n case: plugin.config.responses.case,\n name: plugin.config.responses.response,\n },\n name: operation.id,\n }),\n });\n const type = tsc.indexedAccessTypeNode({\n indexType: tsc.typeOperatorNode({\n operator: 'keyof',\n type: tsc.typeReferenceNode({\n typeName: symbolResponses.placeholder,\n }),\n }),\n objectType: tsc.typeReferenceNode({\n typeName: symbolResponses.placeholder,\n }),\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbol.exported,\n name: symbol.placeholder,\n type,\n });\n plugin.setSymbolValue(symbol, node);\n }\n }\n};\n","import type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { createSchemaComment } from '~/plugins/shared/utils/schema';\nimport { tsc } from '~/tsc';\n\nimport { irSchemaToAst } from '../v1/plugin';\nimport type { IrSchemaToAstOptions } from './types';\n\nconst operationToDataType = ({\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n operation: IR.OperationObject;\n}): string => {\n const data: IR.SchemaObject = {\n type: 'object',\n };\n const dataRequired: Array<string> = [];\n\n if (!data.properties) {\n data.properties = {};\n }\n\n if (operation.body) {\n const symbolWebhookPayload = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'webhook',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: {\n case: plugin.config.webhooks.case,\n name: plugin.config.webhooks.payload,\n },\n name: operation.id,\n }),\n });\n const type = irSchemaToAst({\n plugin,\n schema: operation.body.schema,\n state,\n });\n const node = tsc.typeAliasDeclaration({\n comment: createSchemaComment({ schema: operation.body.schema }),\n exportType: symbolWebhookPayload.exported,\n name: symbolWebhookPayload.placeholder,\n type,\n });\n plugin.setSymbolValue(symbolWebhookPayload, node);\n\n plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'definition',\n resourceId: symbolWebhookPayload.placeholder,\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: symbolWebhookPayload.name,\n placeholder: symbolWebhookPayload.placeholder,\n });\n data.properties.body = { $ref: symbolWebhookPayload.placeholder };\n dataRequired.push('body');\n } else {\n data.properties.body = { type: 'never' };\n }\n\n data.properties.key = {\n const: operation.path,\n type: 'string',\n };\n dataRequired.push('key');\n\n data.properties.path = { type: 'never' };\n data.properties.query = { type: 'never' };\n\n data.required = dataRequired;\n\n const symbolWebhookRequest = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'webhook',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: plugin.config.webhooks,\n name: operation.id,\n }),\n });\n const type = irSchemaToAst({\n plugin,\n schema: data,\n state,\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbolWebhookRequest.exported,\n name: symbolWebhookRequest.placeholder,\n type,\n });\n plugin.setSymbolValue(symbolWebhookRequest, node);\n\n return symbolWebhookRequest.placeholder;\n};\n\nexport const webhookToType = ({\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n operation: IR.OperationObject;\n}): string => {\n const name = operationToDataType({ operation, plugin, state });\n return name;\n\n // don't handle webhook responses for now, users only need requestBody\n};\n","import type { Symbol } from '@hey-api/codegen-core';\n\nimport { tsc } from '~/tsc';\n\nimport type { HeyApiTypeScriptPlugin } from '../types';\n\nexport const createWebhooks = ({\n plugin,\n symbolWebhooks,\n webhookNames,\n}: {\n plugin: HeyApiTypeScriptPlugin['Instance'];\n symbolWebhooks: Symbol;\n webhookNames: ReadonlyArray<string>;\n}) => {\n if (!webhookNames.length) return;\n\n const type = tsc.typeUnionNode({\n types: webhookNames.map((name) =>\n tsc.typeReferenceNode({ typeName: name }),\n ),\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbolWebhooks.exported,\n name: symbolWebhooks.placeholder,\n type,\n });\n plugin.setSymbolValue(symbolWebhooks, node);\n};\n","import type ts from 'typescript';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const arrayToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'array'>;\n}): ts.TypeNode => {\n if (!schema.items) {\n return tsc.typeArrayNode(\n tsc.keywordTypeNode({ keyword: plugin.config.topType }),\n );\n }\n\n schema = deduplicateSchema({ detectFormat: true, schema });\n\n const itemTypes: Array<ts.TypeNode> = [];\n\n if (schema.items) {\n schema.items.forEach((item, index) => {\n const type = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n itemTypes.push(type);\n });\n }\n\n if (itemTypes.length === 1) {\n return tsc.typeArrayNode(itemTypes[0]!);\n }\n\n if (schema.logicalOperator === 'and') {\n return tsc.typeArrayNode(tsc.typeIntersectionNode({ types: itemTypes }));\n }\n\n return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemTypes }));\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const booleanToAst = ({\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'boolean'>;\n}): ts.TypeNode => {\n if (schema.const !== undefined) {\n return tsc.literalTypeNode({\n literal: tsc.ots.boolean(schema.const as boolean),\n });\n }\n\n return tsc.keywordTypeNode({\n keyword: 'boolean',\n });\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const enumToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'enum'>;\n}): ts.TypeNode => {\n const type = irSchemaToAst({\n plugin,\n schema: {\n ...schema,\n type: undefined,\n },\n state,\n });\n return type;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const neverToAst = (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _args: IrSchemaToAstOptions & {\n schema: SchemaWithType<'never'>;\n },\n): ts.TypeNode => {\n const node = tsc.keywordTypeNode({\n keyword: 'never',\n });\n return node;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const nullToAst = (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _args: IrSchemaToAstOptions & {\n schema: SchemaWithType<'null'>;\n },\n): ts.TypeNode => {\n const node = tsc.literalTypeNode({\n literal: tsc.null(),\n });\n return node;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const numberToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'integer' | 'number'>;\n}): ts.TypeNode => {\n if (schema.const !== undefined) {\n return tsc.literalTypeNode({\n literal: tsc.ots.number(schema.const as number),\n });\n }\n\n if (schema.type === 'integer' && schema.format === 'int64') {\n // TODO: parser - add ability to skip type transformers\n if (plugin.getPlugin('@hey-api/transformers')?.config.bigInt) {\n return tsc.typeReferenceNode({ typeName: 'bigint' });\n }\n }\n\n return tsc.keywordTypeNode({\n keyword: 'number',\n });\n};\n","import ts from 'typescript';\n\nimport type { Context } from '~/ir/context';\nimport { numberRegExp } from '~/utils/regexp';\nimport { stringCase } from '~/utils/stringCase';\n\n/**\n * Returns final field name for object properties. This might differ from the\n * original value as applying case transform function might alter it.\n */\nexport const fieldName = ({\n context,\n name,\n}: {\n context: Context;\n name: string;\n}) => {\n numberRegExp.lastIndex = 0;\n if (numberRegExp.test(name)) {\n // For negative numbers, use string literals instead\n if (name.startsWith('-')) {\n return ts.factory.createStringLiteral(name);\n }\n return ts.factory.createNumericLiteral(name);\n }\n\n // if (typeof context.config.output.case === 'function') {\n // return context.config.output.case({ value: name });\n // }\n\n return stringCase({ case: context.config.output.case, value: name });\n};\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport type { SchemaWithType } from '~/plugins';\nimport { fieldName } from '~/plugins/shared/utils/case';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { createSchemaComment } from '~/plugins/shared/utils/schema';\nimport type { Property } from '~/tsc';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const objectToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'object'>;\n}): ts.TypeNode => {\n // TODO: parser - handle constants\n let indexKey: ts.TypeReferenceNode | undefined;\n let indexProperty: Property | undefined;\n const schemaProperties: Array<Property> = [];\n let indexPropertyItems: Array<IR.SchemaObject> = [];\n const required = schema.required ?? [];\n let hasOptionalProperties = false;\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const propertyType = irSchemaToAst({\n plugin,\n schema: property,\n state: {\n ...state,\n path: toRef([...state.path.value, 'properties', name]),\n },\n });\n const isRequired = required.includes(name);\n schemaProperties.push({\n comment: createSchemaComment({ schema: property }),\n isReadOnly: property.accessScope === 'read',\n isRequired,\n name: fieldName({ context: plugin.context, name }),\n type: propertyType,\n });\n indexPropertyItems.push(property);\n\n if (!isRequired) {\n hasOptionalProperties = true;\n }\n }\n\n // include pattern value schemas into the index union\n if (schema.patternProperties) {\n for (const pattern in schema.patternProperties) {\n const ir = schema.patternProperties[pattern]!;\n indexPropertyItems.unshift(ir);\n }\n }\n\n const hasPatterns =\n !!schema.patternProperties &&\n Object.keys(schema.patternProperties).length > 0;\n\n const addPropsRaw = schema.additionalProperties;\n const addPropsObj =\n addPropsRaw !== false && addPropsRaw\n ? (addPropsRaw as IR.SchemaObject)\n : undefined;\n const shouldCreateIndex =\n hasPatterns ||\n (!!addPropsObj &&\n (addPropsObj.type !== 'never' || !indexPropertyItems.length));\n\n if (shouldCreateIndex) {\n // only inject additionalProperties when it’s not \"never\"\n const addProps = addPropsObj;\n if (addProps && addProps.type !== 'never') {\n indexPropertyItems.unshift(addProps);\n } else if (\n !hasPatterns &&\n !indexPropertyItems.length &&\n addProps &&\n addProps.type === 'never'\n ) {\n // keep \"never\" only when there are NO patterns and NO explicit properties\n indexPropertyItems = [addProps];\n }\n\n if (hasOptionalProperties) {\n indexPropertyItems.push({\n type: 'undefined',\n });\n }\n\n indexProperty = {\n isRequired: !schema.propertyNames,\n name: 'key',\n type:\n indexPropertyItems.length === 1\n ? irSchemaToAst({\n plugin,\n schema: indexPropertyItems[0]!,\n state,\n })\n : irSchemaToAst({\n plugin,\n schema: { items: indexPropertyItems, logicalOperator: 'or' },\n state,\n }),\n };\n\n if (schema.propertyNames?.$ref) {\n indexKey = irSchemaToAst({\n plugin,\n schema: {\n $ref: schema.propertyNames.$ref,\n },\n state,\n }) as ts.TypeReferenceNode;\n }\n }\n\n return tsc.typeInterfaceNode({\n indexKey,\n indexProperty,\n properties: schemaProperties,\n useLegacyResolution: false,\n });\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const stringToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'string'>;\n}): ts.TypeNode => {\n if (schema.const !== undefined) {\n return tsc.literalTypeNode({\n literal: tsc.stringLiteral({ text: schema.const as string }),\n });\n }\n\n if (schema.format) {\n if (schema.format === 'binary') {\n return tsc.typeUnionNode({\n types: [\n tsc.typeReferenceNode({\n typeName: 'Blob',\n }),\n tsc.typeReferenceNode({\n typeName: 'File',\n }),\n ],\n });\n }\n\n if (schema.format === 'date-time' || schema.format === 'date') {\n // TODO: parser - add ability to skip type transformers\n if (plugin.getPlugin('@hey-api/transformers')?.config.dates) {\n return tsc.typeReferenceNode({ typeName: 'Date' });\n }\n }\n\n if (schema.format === 'typeid' && typeof schema.example === 'string') {\n const parts = String(schema.example).split('_');\n parts.pop(); // remove the ID part\n const type = parts.join('_');\n\n const query: SymbolMeta = {\n category: 'type',\n resource: 'type-id',\n resourceId: type,\n tool: 'typescript',\n };\n if (!plugin.getSymbol(query)) {\n const queryTypeId: SymbolMeta = {\n category: 'type',\n resource: 'type-id',\n tool: 'typescript',\n variant: 'container',\n };\n\n if (!plugin.getSymbol(queryTypeId)) {\n const symbolTypeId = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: queryTypeId,\n name: 'TypeID',\n });\n const nodeTypeId = tsc.typeAliasDeclaration({\n exportType: symbolTypeId.exported,\n name: symbolTypeId.placeholder,\n type: tsc.templateLiteralType({\n value: [\n tsc.typeReferenceNode({ typeName: 'T' }),\n '_',\n tsc.keywordTypeNode({ keyword: 'string' }),\n ],\n }),\n typeParameters: [\n tsc.typeParameterDeclaration({\n constraint: tsc.keywordTypeNode({\n keyword: 'string',\n }),\n name: 'T',\n }),\n ],\n });\n plugin.setSymbolValue(symbolTypeId, nodeTypeId);\n }\n\n const symbolTypeId = plugin.referenceSymbol(queryTypeId);\n const symbolTypeName = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: query,\n name: stringCase({\n case: plugin.config.case,\n value: `${type}_id`,\n }),\n });\n const node = tsc.typeAliasDeclaration({\n exportType: symbolTypeName.exported,\n name: symbolTypeName.placeholder,\n type: tsc.typeReferenceNode({\n typeArguments: [\n tsc.literalTypeNode({\n literal: tsc.stringLiteral({ text: type }),\n }),\n ],\n typeName: symbolTypeId.placeholder,\n }),\n });\n plugin.setSymbolValue(symbolTypeName, node);\n }\n const symbol = plugin.referenceSymbol(query);\n return tsc.typeReferenceNode({ typeName: symbol.placeholder });\n }\n }\n\n return tsc.keywordTypeNode({\n keyword: 'string',\n });\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const tupleToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'tuple'>;\n}): ts.TypeNode => {\n let itemTypes: Array<ts.Expression | ts.TypeNode> = [];\n\n if (schema.const && Array.isArray(schema.const)) {\n itemTypes = schema.const.map((value) => {\n const expression = tsc.valueToExpression({ value });\n return expression ?? tsc.identifier({ text: plugin.config.topType });\n });\n } else if (schema.items) {\n schema.items.forEach((item, index) => {\n const type = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n itemTypes.push(type);\n });\n }\n\n return tsc.typeTupleNode({\n types: itemTypes,\n });\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const undefinedToAst = (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _args: IrSchemaToAstOptions & {\n schema: SchemaWithType<'undefined'>;\n },\n): ts.TypeNode => {\n const node = tsc.keywordTypeNode({\n keyword: 'undefined',\n });\n return node;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const unknownToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'unknown'>;\n}): ts.TypeNode => {\n const node = tsc.keywordTypeNode({\n keyword: plugin.config.topType,\n });\n return node;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const voidToAst = (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _args: IrSchemaToAstOptions & {\n schema: SchemaWithType<'void'>;\n },\n): ts.TypeNode => {\n const node = tsc.keywordTypeNode({\n keyword: 'void',\n });\n return node;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { arrayToAst } from './array';\nimport { booleanToAst } from './boolean';\nimport { enumToAst } from './enum';\nimport { neverToAst } from './never';\nimport { nullToAst } from './null';\nimport { numberToAst } from './number';\nimport { objectToAst } from './object';\nimport { stringToAst } from './string';\nimport { tupleToAst } from './tuple';\nimport { undefinedToAst } from './undefined';\nimport { unknownToAst } from './unknown';\nimport { voidToAst } from './void';\n\nexport const irSchemaWithTypeToAst = ({\n schema,\n ...args\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType;\n}): ts.TypeNode => {\n const transformersPlugin = args.plugin.getPlugin('@hey-api/transformers');\n if (transformersPlugin?.config.typeTransformers) {\n for (const typeTransformer of transformersPlugin.config.typeTransformers) {\n const typeNode = typeTransformer({ schema });\n if (typeNode) {\n return typeNode;\n }\n }\n }\n\n switch (schema.type) {\n case 'array':\n return arrayToAst({\n ...args,\n schema: schema as SchemaWithType<'array'>,\n });\n case 'boolean':\n return booleanToAst({\n ...args,\n schema: schema as SchemaWithType<'boolean'>,\n });\n case 'enum':\n return enumToAst({\n ...args,\n schema: schema as SchemaWithType<'enum'>,\n });\n case 'integer':\n case 'number':\n return numberToAst({\n ...args,\n schema: schema as SchemaWithType<'integer' | 'number'>,\n });\n case 'never':\n return neverToAst({\n ...args,\n schema: schema as SchemaWithType<'never'>,\n });\n case 'null':\n return nullToAst({\n ...args,\n schema: schema as SchemaWithType<'null'>,\n });\n case 'object':\n return objectToAst({\n ...args,\n schema: schema as SchemaWithType<'object'>,\n });\n case 'string':\n return stringToAst({\n ...args,\n schema: schema as SchemaWithType<'string'>,\n });\n case 'tuple':\n return tupleToAst({\n ...args,\n schema: schema as SchemaWithType<'tuple'>,\n });\n case 'undefined':\n return undefinedToAst({\n ...args,\n schema: schema as SchemaWithType<'undefined'>,\n });\n case 'unknown':\n return unknownToAst({\n ...args,\n schema: schema as SchemaWithType<'unknown'>,\n });\n case 'void':\n return voidToAst({\n ...args,\n schema: schema as SchemaWithType<'void'>,\n });\n }\n};\n","import type ts from 'typescript';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRefs } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { pathToJsonPointer, refToName } from '~/utils/ref';\n\nimport { createClientOptions } from '../shared/clientOptions';\nimport { exportType } from '../shared/export';\nimport { operationToType } from '../shared/operation';\nimport type { IrSchemaToAstOptions, PluginState } from '../shared/types';\nimport { webhookToType } from '../shared/webhook';\nimport { createWebhooks } from '../shared/webhooks';\nimport type { HeyApiTypeScriptPlugin } from '../types';\nimport { irSchemaWithTypeToAst } from './toAst';\n\nexport const irSchemaToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}): ts.TypeNode => {\n if (schema.$ref) {\n const symbol = plugin.referenceSymbol({\n category: 'type',\n resource: 'definition',\n resourceId: schema.$ref,\n });\n return tsc.typeReferenceNode({ typeName: symbol.placeholder });\n }\n\n if (schema.type) {\n return irSchemaWithTypeToAst({\n plugin,\n schema: schema as SchemaWithType,\n state,\n });\n }\n\n if (schema.items) {\n schema = deduplicateSchema({ detectFormat: false, schema });\n if (schema.items) {\n const itemTypes: Array<ts.TypeNode> = [];\n\n for (const item of schema.items) {\n const type = irSchemaToAst({ plugin, schema: item, state });\n itemTypes.push(type);\n }\n\n return schema.logicalOperator === 'and'\n ? tsc.typeIntersectionNode({ types: itemTypes })\n : tsc.typeUnionNode({ types: itemTypes });\n }\n\n return irSchemaToAst({ plugin, schema, state });\n }\n\n // catch-all fallback for failed schemas\n return irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n};\n\nconst handleComponent = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}) => {\n const type = irSchemaToAst({ plugin, schema, state });\n\n // Don't tag enums as 'type' since they export runtime artifacts (values)\n const isEnum = schema.type === 'enum' && plugin.config.enums.enabled;\n\n const $ref = pathToJsonPointer(state.path.value);\n const symbol = plugin.registerSymbol({\n exported: true,\n kind: isEnum ? undefined : 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'typescript',\n },\n name: buildName({\n config: plugin.config.definitions,\n name: refToName($ref),\n }),\n });\n exportType({\n plugin,\n schema,\n symbol,\n type,\n });\n};\n\nexport const handlerV1: HeyApiTypeScriptPlugin['Handler'] = ({ plugin }) => {\n // reserve identifier for ClientOptions\n const symbolClientOptions = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n resource: 'client',\n role: 'options',\n tool: 'typescript',\n },\n name: buildName({\n config: {\n case: plugin.config.case,\n },\n name: 'ClientOptions',\n }),\n });\n // reserve identifier for Webhooks\n const symbolWebhooks = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n resource: 'webhook',\n tool: 'typescript',\n variant: 'container',\n },\n name: buildName({\n config: {\n case: plugin.config.case,\n },\n name: 'Webhooks',\n }),\n });\n\n const servers: Array<IR.ServerObject> = [];\n const webhookNames: Array<string> = [];\n\n plugin.forEach(\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'server',\n 'webhook',\n (event) => {\n const state = toRefs<PluginState>({\n path: event._path,\n tags: event.tags,\n });\n switch (event.type) {\n case 'operation':\n operationToType({\n operation: event.operation,\n plugin,\n state,\n });\n break;\n case 'parameter':\n handleComponent({\n plugin,\n schema: event.parameter.schema,\n state,\n });\n break;\n case 'requestBody':\n handleComponent({\n plugin,\n schema: event.requestBody.schema,\n state,\n });\n break;\n case 'schema':\n handleComponent({\n plugin,\n schema: event.schema,\n state,\n });\n break;\n case 'server':\n servers.push(event.server);\n break;\n case 'webhook':\n webhookNames.push(\n webhookToType({\n operation: event.operation,\n plugin,\n state,\n }),\n );\n break;\n }\n },\n {\n order: 'declarations',\n },\n );\n\n createClientOptions({ plugin, servers, symbolClientOptions });\n createWebhooks({ plugin, symbolWebhooks, webhookNames });\n};\n","import type ts from 'typescript';\n\nimport { irSchemaToAstV1 } from './v1/api';\n\nexport type IApi = {\n schemaToType: (args: Parameters<typeof irSchemaToAstV1>[0]) => ts.TypeNode;\n};\n\nexport class Api implements IApi {\n schemaToType(args: Parameters<typeof irSchemaToAstV1>[0]): ts.TypeNode {\n return irSchemaToAstV1(args);\n }\n}\n","import type { HeyApiTypeScriptPlugin } from './types';\nimport { handlerV1 } from './v1/plugin';\n\nexport const handler: HeyApiTypeScriptPlugin['Handler'] = (args) =>\n handlerV1(args);\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { HeyApiTypeScriptPlugin } from './types';\n\nexport const defaultConfig: HeyApiTypeScriptPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'PascalCase',\n exportFromIndex: true,\n style: 'preserve',\n topType: 'unknown',\n tree: false,\n },\n handler,\n name: '@hey-api/typescript',\n resolveConfig: (plugin, context) => {\n plugin.config.definitions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n name: '{{name}}',\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.definitions,\n });\n\n plugin.config.enums = context.valueToObject({\n defaultValue: {\n case: 'SCREAMING_SNAKE_CASE',\n constantsIgnoreNull: false,\n enabled: Boolean(plugin.config.enums),\n mode: 'javascript',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n string: (mode) => ({ mode }),\n },\n value: plugin.config.enums,\n });\n\n plugin.config.errors = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n error: '{{name}}Error',\n name: '{{name}}Errors',\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.errors,\n });\n\n plugin.config.requests = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n name: '{{name}}Data',\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.requests,\n });\n\n plugin.config.responses = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n name: '{{name}}Responses',\n response: '{{name}}Response',\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.responses,\n });\n\n plugin.config.webhooks = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n name: '{{name}}WebhookRequest',\n payload: '{{name}}WebhookPayload',\n },\n mappers: {\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.webhooks,\n });\n },\n};\n\n/**\n * Type helper for `@hey-api/typescript` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { tsc } from '~/tsc';\n\nimport type { PiniaColadaPlugin } from './types';\n\nexport const handleMeta = (\n plugin: PiniaColadaPlugin['Instance'],\n operation: IR.OperationObject,\n configPath: 'queryOptions' | 'mutationOptions',\n): ts.Expression | undefined => {\n const metaFn = plugin.config[configPath].meta;\n if (!metaFn) return;\n\n const metaObject = metaFn(operation);\n if (!Object.keys(metaObject).length) return;\n\n return tsc.valueToExpression({ value: metaObject });\n};\n","import type { IR } from '~/ir/types';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport { operationOptionsType } from '~/plugins/@hey-api/sdk/shared/operation';\n\nimport type { PiniaColadaPlugin } from './types';\n\nexport const useTypeData = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n}): string => {\n const pluginSdk = plugin.getPluginOrThrow('@hey-api/sdk');\n const typeData = operationOptionsType({ operation, plugin: pluginSdk });\n return typeData;\n};\n\nexport const useTypeError = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n}): string => {\n const client = getClientPlugin(plugin.context.config);\n\n const symbolErrorType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'error',\n });\n\n let typeErrorName: string | undefined = symbolErrorType?.placeholder;\n if (!typeErrorName) {\n typeErrorName = 'Error';\n }\n if (client.name === '@hey-api/client-axios') {\n const symbol = plugin.referenceSymbol({\n category: 'external',\n resource: 'axios.AxiosError',\n });\n typeErrorName = `${symbol.placeholder}<${typeErrorName}>`;\n }\n return typeErrorName;\n};\n\nexport const useTypeResponse = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n}): string => {\n const symbolResponseType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n });\n return symbolResponseType?.placeholder || 'unknown';\n};\n","import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\n\nimport type { PiniaColadaPlugin } from './types';\n\nexport const getPublicTypeData = ({\n plugin,\n typeData,\n}: {\n plugin: PiniaColadaPlugin['Instance'];\n typeData: string;\n}) => {\n const client = getClientPlugin(plugin.context.config);\n const isNuxtClient = client.name === '@hey-api/client-nuxt';\n const strippedTypeData = isNuxtClient\n ? `Omit<${typeData}, 'composable'>`\n : typeData;\n\n return { isNuxtClient, strippedTypeData };\n};\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { createOperationComment } from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\n\nimport { handleMeta } from './meta';\nimport type { PiniaColadaPlugin } from './types';\nimport { useTypeData, useTypeError, useTypeResponse } from './useType';\nimport { getPublicTypeData } from './utils';\n\nexport const createMutationOptions = ({\n operation,\n plugin,\n queryFn,\n}: {\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n queryFn: string;\n}): void => {\n const symbolMutationOptionsType = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.UseMutationOptions`,\n });\n\n const typeData = useTypeData({ operation, plugin });\n const typeError = useTypeError({ operation, plugin });\n const typeResponse = useTypeResponse({ operation, plugin });\n const { isNuxtClient, strippedTypeData } = getPublicTypeData({\n plugin,\n typeData,\n });\n // TODO: better types syntax\n const mutationType = isNuxtClient\n ? `${symbolMutationOptionsType.placeholder}<${typeResponse}, ${strippedTypeData}, ${typeError}>`\n : `${symbolMutationOptionsType.placeholder}<${typeResponse}, ${typeData}, ${typeError}>`;\n\n const fnOptions = 'fnOptions';\n\n const awaitSdkExpression = tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: queryFn,\n parameters: [\n tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n spread: 'options',\n },\n {\n spread: fnOptions,\n },\n {\n key: 'throwOnError',\n value: true,\n },\n ],\n }),\n ],\n }),\n });\n\n const statements: Array<ts.Statement> = [];\n\n if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') {\n statements.push(\n tsc.returnVariable({\n expression: awaitSdkExpression,\n }),\n );\n } else {\n statements.push(\n tsc.constVariable({\n destructure: true,\n expression: awaitSdkExpression,\n name: 'data',\n }),\n tsc.returnVariable({\n expression: 'data',\n }),\n );\n }\n\n const mutationOptionsObj: Array<{ key: string; value: ts.Expression }> = [\n {\n key: 'mutation',\n value: tsc.arrowFunction({\n async: true,\n multiLine: true,\n parameters: [\n isNuxtClient\n ? {\n name: fnOptions,\n type: `Partial<${strippedTypeData}>`,\n }\n : { name: fnOptions },\n ],\n statements,\n }),\n },\n ];\n\n const meta = handleMeta(plugin, operation, 'mutationOptions');\n\n if (meta) {\n mutationOptionsObj.push({\n key: 'meta',\n value: meta,\n });\n }\n\n const symbolMutationOptions = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.mutationOptions,\n name: operation.id,\n }),\n });\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createOperationComment({ operation })\n : undefined,\n exportConst: symbolMutationOptions.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: false,\n name: 'options',\n type: `Partial<${strippedTypeData}>`,\n },\n ],\n returnType: mutationType,\n statements: [\n tsc.returnStatement({\n expression: tsc.objectExpression({\n obj: mutationOptionsObj,\n }),\n }),\n ],\n }),\n name: symbolMutationOptions.placeholder,\n });\n plugin.setSymbolValue(symbolMutationOptions, statement);\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type { Expression } from 'typescript';\n\nimport { clientFolderAbsolutePath } from '~/generate/client';\nimport { hasOperationDataRequired } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { getClientBaseUrlKey } from '~/plugins/@hey-api/client-core/utils';\nimport { type Property, tsc } from '~/tsc';\n\nimport type { PiniaColadaPlugin } from './types';\nimport { useTypeData } from './useType';\nimport { getPublicTypeData } from './utils';\n\nconst TOptionsType = 'TOptions';\n\nconst optionsIdentifier = tsc.identifier({ text: 'options' });\n\nexport const createQueryKeyFunction = ({\n plugin,\n}: {\n plugin: PiniaColadaPlugin['Instance'];\n}) => {\n const symbolCreateQueryKey = plugin.registerSymbol({\n meta: {\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n },\n name: buildName({\n config: {\n case: plugin.config.case,\n },\n name: 'createQueryKey',\n }),\n });\n const symbolQueryKeyType = plugin.referenceSymbol({\n category: 'type',\n resource: 'QueryKey',\n tool: plugin.name,\n });\n const symbolJsonValue = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}._JSONValue`,\n });\n\n const returnType = tsc.indexedAccessTypeNode({\n indexType: tsc.literalTypeNode({\n literal: tsc.ots.number(0),\n }),\n objectType: tsc.typeReferenceNode({\n typeArguments: [tsc.typeReferenceNode({ typeName: TOptionsType })],\n typeName: symbolQueryKeyType.placeholder,\n }),\n });\n\n const baseUrlKey = getClientBaseUrlKey(plugin.context.config);\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n const symbolClient = plugin.getSymbol({\n category: 'client',\n });\n\n const clientModule = clientFolderAbsolutePath(plugin.context.config);\n const symbolSerializeQueryValue = plugin.registerSymbol({\n external: clientModule,\n meta: {\n category: 'external',\n resource: `${clientModule}.serializeQueryKeyValue`,\n },\n name: 'serializeQueryKeyValue',\n });\n\n const fn = tsc.constVariable({\n expression: tsc.arrowFunction({\n multiLine: true,\n parameters: [\n {\n name: 'id',\n type: tsc.typeReferenceNode({ typeName: 'string' }),\n },\n {\n isRequired: false,\n name: 'options',\n type: tsc.typeReferenceNode({ typeName: TOptionsType }),\n },\n {\n isRequired: false,\n name: 'tags',\n type: tsc.typeReferenceNode({ typeName: 'ReadonlyArray<string>' }),\n },\n ],\n returnType: tsc.typeTupleNode({\n types: [returnType],\n }),\n statements: [\n tsc.constVariable({\n assertion: returnType,\n expression: tsc.objectExpression({\n multiLine: false,\n obj: [\n { key: '_id', value: tsc.identifier({ text: 'id' }) },\n {\n key: baseUrlKey,\n value: tsc.identifier({\n text: `options?.${baseUrlKey} || (options?.client ?? ${symbolClient?.placeholder}).getConfig().${baseUrlKey}`,\n }),\n },\n ],\n }),\n name: 'params',\n typeName: returnType,\n }),\n tsc.ifStatement({\n expression: tsc.identifier({ text: 'tags' }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'tags',\n }),\n right: tsc.asExpression({\n expression: tsc.asExpression({\n expression: tsc.identifier({ text: 'tags' }),\n type: tsc.keywordTypeNode({ keyword: 'unknown' }),\n }),\n type: tsc.typeReferenceNode({\n typeName: symbolJsonValue.placeholder,\n }),\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'body' }),\n }),\n operator: '!==',\n right: 'undefined',\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.constVariable({\n expression: tsc.callExpression({\n functionName: symbolSerializeQueryValue.placeholder,\n parameters: [\n tsc.propertyAccessExpression({\n expression: 'options',\n name: 'body',\n }),\n ],\n }),\n name: 'normalizedBody',\n }),\n tsc.ifStatement({\n expression: tsc.binaryExpression({\n left: tsc.identifier({ text: 'normalizedBody' }),\n operator: '!==',\n right: 'undefined',\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'body',\n }),\n right: tsc.identifier({ text: 'normalizedBody' }),\n }),\n }),\n ],\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'path' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'path',\n }),\n right: tsc.propertyAccessExpression({\n expression: 'options',\n name: 'path',\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'query' }),\n }),\n operator: '!==',\n right: 'undefined',\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.constVariable({\n expression: tsc.callExpression({\n functionName: symbolSerializeQueryValue.placeholder,\n parameters: [\n tsc.propertyAccessExpression({\n expression: 'options',\n name: 'query',\n }),\n ],\n }),\n name: 'normalizedQuery',\n }),\n tsc.ifStatement({\n expression: tsc.binaryExpression({\n left: tsc.identifier({ text: 'normalizedQuery' }),\n operator: '!==',\n right: 'undefined',\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'query',\n }),\n right: tsc.identifier({ text: 'normalizedQuery' }),\n }),\n }),\n ],\n }),\n }),\n ],\n }),\n }),\n tsc.returnStatement({\n expression: tsc.arrayLiteralExpression({\n elements: [tsc.identifier({ text: 'params' })],\n }),\n }),\n ],\n types: [\n {\n extends: tsc.typeReferenceNode({\n typeName: tsc.identifier({ text: symbolOptions.placeholder }),\n }),\n name: TOptionsType,\n },\n ],\n }),\n name: symbolCreateQueryKey.placeholder,\n });\n plugin.setSymbolValue(symbolCreateQueryKey, fn);\n};\n\nconst createQueryKeyLiteral = ({\n id,\n operation,\n plugin,\n}: {\n id: string;\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n}) => {\n const config = plugin.config.queryKeys;\n let tagsExpression: Expression | undefined;\n if (config.tags && operation.tags && operation.tags.length > 0) {\n tagsExpression = tsc.arrayLiteralExpression({\n elements: operation.tags.map((tag) => tsc.stringLiteral({ text: tag })),\n });\n }\n\n const symbolCreateQueryKey = plugin.referenceSymbol({\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n });\n const createQueryKeyCallExpression = tsc.callExpression({\n functionName: symbolCreateQueryKey.placeholder,\n parameters: [tsc.ots.string(id), 'options', tagsExpression],\n });\n return createQueryKeyCallExpression;\n};\n\nexport const createQueryKeyType = ({\n plugin,\n}: {\n plugin: PiniaColadaPlugin['Instance'];\n}) => {\n const symbolJsonValue = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}._JSONValue`,\n });\n\n const properties: Array<Property> = [\n { name: '_id', type: tsc.keywordTypeNode({ keyword: 'string' }) },\n {\n isRequired: false,\n name: getClientBaseUrlKey(plugin.context.config),\n type: tsc.typeReferenceNode({ typeName: symbolJsonValue.placeholder }),\n },\n {\n isRequired: false,\n name: 'body',\n type: tsc.typeReferenceNode({ typeName: symbolJsonValue.placeholder }),\n },\n {\n isRequired: false,\n name: 'query',\n type: tsc.typeReferenceNode({ typeName: symbolJsonValue.placeholder }),\n },\n {\n isRequired: false,\n name: 'tags',\n type: tsc.typeReferenceNode({ typeName: symbolJsonValue.placeholder }),\n },\n ];\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n const symbolQueryKeyType = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n resource: 'QueryKey',\n tool: plugin.name,\n },\n name: 'QueryKey',\n });\n const queryKeyType = tsc.typeAliasDeclaration({\n exportType: symbolQueryKeyType.exported,\n name: symbolQueryKeyType.placeholder,\n type: tsc.typeTupleNode({\n types: [\n tsc.typeIntersectionNode({\n types: [\n tsc.typeReferenceNode({\n typeName: `Pick<${TOptionsType}, 'path'>`,\n }),\n tsc.typeInterfaceNode({\n properties,\n useLegacyResolution: true,\n }),\n ],\n }),\n ],\n }),\n typeParameters: [\n {\n extends: tsc.typeReferenceNode({\n typeName: tsc.identifier({ text: symbolOptions.placeholder }),\n }),\n name: TOptionsType,\n },\n ],\n });\n plugin.setSymbolValue(symbolQueryKeyType, queryKeyType);\n};\n\nexport const queryKeyStatement = ({\n operation,\n plugin,\n symbol,\n}: {\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n symbol: Symbol;\n}) => {\n const typeData = useTypeData({ operation, plugin });\n const { strippedTypeData } = getPublicTypeData({ plugin, typeData });\n const statement = tsc.constVariable({\n exportConst: symbol.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: hasOperationDataRequired(operation),\n name: 'options',\n type: strippedTypeData,\n },\n ],\n statements: createQueryKeyLiteral({\n id: operation.id,\n operation,\n plugin,\n }),\n }),\n name: symbol.placeholder,\n });\n return statement;\n};\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport {\n createOperationComment,\n hasOperationSse,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\n\nimport { handleMeta } from './meta';\nimport {\n createQueryKeyFunction,\n createQueryKeyType,\n queryKeyStatement,\n} from './queryKey';\nimport type { PiniaColadaPlugin } from './types';\nimport { useTypeData } from './useType';\nimport { getPublicTypeData } from './utils';\n\nconst optionsParamName = 'options';\nconst fnOptions = 'context';\n\nexport const createQueryOptions = ({\n operation,\n plugin,\n queryFn,\n}: {\n operation: IR.OperationObject;\n plugin: PiniaColadaPlugin['Instance'];\n queryFn: string;\n}): void => {\n if (hasOperationSse({ operation })) {\n return;\n }\n\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n if (\n !plugin.getSymbol({\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n })\n ) {\n createQueryKeyType({ plugin });\n createQueryKeyFunction({ plugin });\n }\n\n let keyExpression: ts.Expression;\n if (plugin.config.queryKeys.enabled) {\n const symbolQueryKey = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.queryKeys,\n name: operation.id,\n }),\n });\n const node = queryKeyStatement({\n operation,\n plugin,\n symbol: symbolQueryKey,\n });\n plugin.setSymbolValue(symbolQueryKey, node);\n keyExpression = tsc.callExpression({\n functionName: symbolQueryKey.placeholder,\n parameters: [optionsParamName],\n });\n } else {\n const symbolCreateQueryKey = plugin.referenceSymbol({\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n });\n // Optionally include tags when configured\n let tagsExpr: ts.Expression | undefined;\n if (\n plugin.config.queryKeys.tags &&\n operation.tags &&\n operation.tags.length > 0\n ) {\n tagsExpr = tsc.arrayLiteralExpression({\n elements: operation.tags.map((t) => tsc.stringLiteral({ text: t })),\n });\n }\n keyExpression = tsc.callExpression({\n functionName: symbolCreateQueryKey.placeholder,\n parameters: [tsc.ots.string(operation.id), optionsParamName, tagsExpr],\n });\n }\n\n const typeData = useTypeData({ operation, plugin });\n const { strippedTypeData } = getPublicTypeData({\n plugin,\n typeData,\n });\n const awaitSdkExpression = tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: queryFn,\n parameters: [\n tsc.objectExpression({\n multiLine: true,\n obj: [\n { spread: optionsParamName },\n { spread: fnOptions },\n { key: 'throwOnError', value: true },\n ],\n }),\n ],\n }),\n });\n\n const statements: Array<ts.Statement> = [];\n if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') {\n statements.push(\n tsc.returnVariable({\n expression: awaitSdkExpression,\n }),\n );\n } else {\n statements.push(\n tsc.constVariable({\n destructure: true,\n expression: awaitSdkExpression,\n name: 'data',\n }),\n tsc.returnVariable({\n expression: 'data',\n }),\n );\n }\n\n const queryOptionsObj: Array<{ key: string; value: ts.Expression }> = [\n {\n key: 'key',\n value: keyExpression,\n },\n {\n key: 'query',\n value: tsc.arrowFunction({\n async: true,\n multiLine: true,\n parameters: [{ name: fnOptions }],\n statements,\n }),\n },\n ];\n\n const meta = handleMeta(plugin, operation, 'queryOptions');\n if (meta) {\n queryOptionsObj.push({\n key: 'meta',\n value: meta,\n });\n }\n\n const symbolQueryOptionsFn = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'hook',\n resource: 'operation',\n resourceId: operation.id,\n role: 'queryOptions',\n tool: plugin.name,\n },\n name: buildName({\n config: plugin.config.queryOptions,\n name: operation.id,\n }),\n });\n const symbolDefineQueryOptions = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.defineQueryOptions`,\n });\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createOperationComment({ operation })\n : undefined,\n exportConst: symbolQueryOptionsFn.exported,\n expression: tsc.callExpression({\n functionName: symbolDefineQueryOptions.placeholder,\n parameters: [\n tsc.arrowFunction({\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: optionsParamName,\n type: strippedTypeData,\n },\n ],\n statements: tsc.objectExpression({ obj: queryOptionsObj }),\n }),\n ],\n }),\n name: symbolQueryOptionsFn.placeholder,\n });\n plugin.setSymbolValue(symbolQueryOptionsFn, statement);\n};\n","import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation';\nimport { stringCase } from '~/utils/stringCase';\n\nimport { createMutationOptions } from './mutationOptions';\nimport { createQueryOptions } from './queryOptions';\nimport type { PiniaColadaPlugin } from './types';\n\nexport const handler: PiniaColadaPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: plugin.name,\n meta: {\n category: 'external',\n resource: `${plugin.name}.defineQueryOptions`,\n },\n name: 'defineQueryOptions',\n });\n plugin.registerSymbol({\n external: plugin.name,\n kind: 'type',\n meta: {\n category: 'external',\n resource: `${plugin.name}.UseMutationOptions`,\n },\n name: 'UseMutationOptions',\n });\n plugin.registerSymbol({\n external: plugin.name,\n kind: 'type',\n meta: {\n category: 'external',\n resource: `${plugin.name}.UseQueryOptions`,\n },\n name: 'UseQueryOptions',\n });\n plugin.registerSymbol({\n external: plugin.name,\n kind: 'type',\n meta: {\n category: 'external',\n resource: `${plugin.name}._JSONValue`,\n },\n name: '_JSONValue',\n });\n plugin.registerSymbol({\n external: 'axios',\n kind: 'type',\n meta: {\n category: 'external',\n resource: 'axios.AxiosError',\n },\n name: 'AxiosError',\n });\n\n const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');\n\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const classes = sdkPlugin.config.asClass\n ? operationClasses({\n context: plugin.context,\n operation,\n plugin: sdkPlugin,\n })\n : undefined;\n const entry = classes ? classes.values().next().value : undefined;\n const queryFn =\n // TODO: this should use class graph to determine correct path string\n // as it's really easy to break once we change the class casing\n entry\n ? [\n plugin.referenceSymbol({\n category: 'utility',\n resource: 'class',\n resourceId: entry.path[0],\n tool: 'sdk',\n }).placeholder,\n ...entry.path.slice(1).map((className: string) =>\n stringCase({\n case: 'camelCase',\n value: className,\n }),\n ),\n entry.methodName,\n ]\n .filter(Boolean)\n .join('.')\n : plugin.referenceSymbol({\n category: 'sdk',\n resource: 'operation',\n resourceId: operation.id,\n }).placeholder;\n\n if (plugin.hooks.operation.isQuery(operation)) {\n if (plugin.config.queryOptions.enabled) {\n createQueryOptions({ operation, plugin, queryFn });\n }\n }\n\n if (plugin.hooks.operation.isMutation(operation)) {\n if (plugin.config.mutationOptions.enabled) {\n createMutationOptions({ operation, plugin, queryFn });\n }\n }\n },\n {\n order: 'declarations',\n },\n );\n};\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { PiniaColadaPlugin } from './types';\n\nexport const defaultConfig: PiniaColadaPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/typescript', '@hey-api/sdk'],\n handler: handler as PiniaColadaPlugin['Handler'],\n name: '@pinia/colada',\n resolveConfig: (plugin, context) => {\n plugin.config.mutationOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Mutation',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.mutationOptions,\n });\n\n plugin.config.queryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}QueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryKeys,\n });\n\n plugin.config.queryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Query',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryOptions,\n });\n },\n};\n\n/**\n * Type helper for `@pinia/colada` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { tsc } from '~/tsc';\n\nimport type { PluginInstance } from './types';\n\nexport const handleMeta = (\n plugin: PluginInstance,\n operation: IR.OperationObject,\n configPath: 'queryOptions' | 'infiniteQueryOptions' | 'mutationOptions',\n): ts.Expression | undefined => {\n const metaFn = plugin.config[configPath].meta;\n if (!metaFn) return;\n\n const metaObject = metaFn(operation);\n if (!Object.keys(metaObject).length) return;\n\n return tsc.valueToExpression({ value: metaObject });\n};\n","import type { IR } from '~/ir/types';\nimport { getClientPlugin } from '~/plugins/@hey-api/client-core/utils';\nimport { operationOptionsType } from '~/plugins/@hey-api/sdk/shared/operation';\n\nimport type { PluginInstance } from './types';\n\nexport const useTypeData = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n}): string => {\n const pluginSdk = plugin.getPluginOrThrow('@hey-api/sdk');\n const typeData = operationOptionsType({ operation, plugin: pluginSdk });\n return typeData;\n};\n\nexport const useTypeError = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n}): string => {\n const client = getClientPlugin(plugin.context.config);\n\n const symbolErrorType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'error',\n });\n\n let typeErrorName: string | undefined = symbolErrorType?.placeholder;\n if (!typeErrorName) {\n const symbol = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.DefaultError`,\n });\n typeErrorName = symbol.placeholder;\n }\n if (client.name === '@hey-api/client-axios') {\n const symbol = plugin.referenceSymbol({\n category: 'external',\n resource: 'axios.AxiosError',\n });\n typeErrorName = `${symbol.placeholder}<${typeErrorName}>`;\n }\n return typeErrorName;\n};\n\nexport const useTypeResponse = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n}): string => {\n const symbolResponseType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'response',\n });\n return symbolResponseType?.placeholder || 'unknown';\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type { Expression } from 'typescript';\n\nimport { hasOperationDataRequired } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { getClientBaseUrlKey } from '~/plugins/@hey-api/client-core/utils';\nimport { type Property, tsc } from '~/tsc';\n\nimport type { PluginInstance } from './types';\nimport { useTypeData } from './useType';\n\nconst TOptionsType = 'TOptions';\n\nconst infiniteIdentifier = tsc.identifier({ text: 'infinite' });\nconst optionsIdentifier = tsc.identifier({ text: 'options' });\n\nexport const createQueryKeyFunction = ({\n plugin,\n}: {\n plugin: PluginInstance;\n}) => {\n const symbolCreateQueryKey = plugin.registerSymbol({\n meta: {\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n },\n name: buildName({\n config: {\n case: plugin.config.case,\n },\n name: 'createQueryKey',\n }),\n });\n const symbolQueryKeyType = plugin.referenceSymbol({\n category: 'type',\n resource: 'QueryKey',\n tool: plugin.name,\n });\n\n const returnType = tsc.indexedAccessTypeNode({\n indexType: tsc.literalTypeNode({\n literal: tsc.ots.number(0),\n }),\n objectType: tsc.typeReferenceNode({\n typeArguments: [tsc.typeReferenceNode({ typeName: TOptionsType })],\n typeName: symbolQueryKeyType.placeholder,\n }),\n });\n\n const baseUrlKey = getClientBaseUrlKey(plugin.context.config);\n\n const symbolClient = plugin.getSymbol({\n category: 'client',\n });\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n\n const fn = tsc.constVariable({\n expression: tsc.arrowFunction({\n multiLine: true,\n parameters: [\n {\n name: 'id',\n type: tsc.typeReferenceNode({ typeName: 'string' }),\n },\n {\n isRequired: false,\n name: 'options',\n type: tsc.typeReferenceNode({ typeName: TOptionsType }),\n },\n {\n isRequired: false,\n name: 'infinite',\n type: tsc.typeReferenceNode({ typeName: 'boolean' }),\n },\n {\n isRequired: false,\n name: 'tags',\n type: tsc.typeReferenceNode({ typeName: 'ReadonlyArray<string>' }),\n },\n ],\n returnType: tsc.typeTupleNode({\n types: [returnType],\n }),\n statements: [\n tsc.constVariable({\n assertion: returnType,\n expression: tsc.objectExpression({\n multiLine: false,\n obj: [\n {\n key: '_id',\n value: tsc.identifier({ text: 'id' }),\n },\n {\n key: baseUrlKey,\n value: tsc.identifier({\n text: `options?.${baseUrlKey} || (options?.client ?? ${symbolClient?.placeholder}).getConfig().${baseUrlKey}`,\n }),\n },\n ],\n }),\n name: 'params',\n typeName: returnType,\n }),\n tsc.ifStatement({\n expression: infiniteIdentifier,\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: '_infinite',\n }),\n right: infiniteIdentifier,\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.identifier({ text: 'tags' }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'tags',\n }),\n right: tsc.identifier({ text: 'tags' }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'body' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'body',\n }),\n right: tsc.propertyAccessExpression({\n expression: 'options',\n name: 'body',\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'headers' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'headers',\n }),\n right: tsc.propertyAccessExpression({\n expression: 'options',\n name: 'headers',\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'path' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'path',\n }),\n right: tsc.propertyAccessExpression({\n expression: 'options',\n name: 'path',\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: optionsIdentifier,\n isOptional: true,\n name: tsc.identifier({ text: 'query' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'query',\n }),\n right: tsc.propertyAccessExpression({\n expression: 'options',\n name: 'query',\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.returnStatement({\n expression: tsc.arrayLiteralExpression({\n elements: [tsc.identifier({ text: 'params' })],\n }),\n }),\n ],\n types: [\n {\n extends: tsc.typeReferenceNode({\n typeName: tsc.identifier({ text: symbolOptions.placeholder }),\n }),\n name: TOptionsType,\n },\n ],\n }),\n name: symbolCreateQueryKey.placeholder,\n });\n plugin.setSymbolValue(symbolCreateQueryKey, fn);\n};\n\nconst createQueryKeyLiteral = ({\n id,\n isInfinite,\n operation,\n plugin,\n}: {\n id: string;\n isInfinite?: boolean;\n operation: IR.OperationObject;\n plugin: PluginInstance;\n}) => {\n const config = isInfinite\n ? plugin.config.infiniteQueryKeys\n : plugin.config.queryKeys;\n let tagsExpression: Expression | undefined;\n if (config.tags && operation.tags && operation.tags.length > 0) {\n tagsExpression = tsc.arrayLiteralExpression({\n elements: operation.tags.map((tag) => tsc.stringLiteral({ text: tag })),\n });\n }\n\n const symbolCreateQueryKey = plugin.referenceSymbol({\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n });\n const createQueryKeyCallExpression = tsc.callExpression({\n functionName: symbolCreateQueryKey.placeholder,\n parameters: [\n tsc.ots.string(id),\n 'options',\n isInfinite || tagsExpression\n ? tsc.ots.boolean(Boolean(isInfinite))\n : undefined,\n tagsExpression,\n ],\n });\n return createQueryKeyCallExpression;\n};\n\nexport const createQueryKeyType = ({ plugin }: { plugin: PluginInstance }) => {\n const properties: Array<Property> = [\n {\n name: '_id',\n type: tsc.keywordTypeNode({ keyword: 'string' }),\n },\n {\n isRequired: false,\n name: '_infinite',\n type: tsc.keywordTypeNode({ keyword: 'boolean' }),\n },\n {\n isRequired: false,\n name: 'tags',\n type: tsc.typeReferenceNode({ typeName: 'ReadonlyArray<string>' }),\n },\n ];\n\n const symbolOptions = plugin.referenceSymbol({\n category: 'type',\n resource: 'client-options',\n tool: 'sdk',\n });\n const symbolQueryKeyType = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n resource: 'QueryKey',\n tool: plugin.name,\n },\n name: 'QueryKey',\n });\n const queryKeyType = tsc.typeAliasDeclaration({\n exportType: symbolQueryKeyType.exported,\n name: symbolQueryKeyType.placeholder,\n type: tsc.typeTupleNode({\n types: [\n tsc.typeIntersectionNode({\n types: [\n tsc.typeReferenceNode({\n typeName: `Pick<${TOptionsType}, '${getClientBaseUrlKey(plugin.context.config)}' | 'body' | 'headers' | 'path' | 'query'>`,\n }),\n tsc.typeInterfaceNode({\n properties,\n useLegacyResolution: true,\n }),\n ],\n }),\n ],\n }),\n typeParameters: [\n {\n extends: tsc.typeReferenceNode({\n typeName: tsc.identifier({ text: symbolOptions.placeholder }),\n }),\n name: TOptionsType,\n },\n ],\n });\n plugin.setSymbolValue(symbolQueryKeyType, queryKeyType);\n};\n\nexport const queryKeyStatement = ({\n isInfinite,\n operation,\n plugin,\n symbol,\n typeQueryKey,\n}: {\n isInfinite: boolean;\n operation: IR.OperationObject;\n plugin: PluginInstance;\n symbol: Symbol;\n typeQueryKey?: string;\n}) => {\n const typeData = useTypeData({ operation, plugin });\n const statement = tsc.constVariable({\n exportConst: symbol.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: hasOperationDataRequired(operation),\n name: 'options',\n type: typeData,\n },\n ],\n returnType: isInfinite ? typeQueryKey : undefined,\n statements: createQueryKeyLiteral({\n id: operation.id,\n isInfinite,\n operation,\n plugin,\n }),\n }),\n name: symbol.placeholder,\n });\n return statement;\n};\n","import ts from 'typescript';\n\nimport { operationPagination } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport {\n createOperationComment,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\nimport { tsNodeToString } from '~/tsc/utils';\n\nimport { handleMeta } from './meta';\nimport {\n createQueryKeyFunction,\n createQueryKeyType,\n queryKeyStatement,\n} from './queryKey';\nimport type { PluginInstance } from './types';\nimport { useTypeData, useTypeError, useTypeResponse } from './useType';\n\nconst createInfiniteParamsFunction = ({\n plugin,\n}: {\n plugin: PluginInstance;\n}) => {\n const symbolCreateInfiniteParams = plugin.registerSymbol({\n meta: {\n category: 'utility',\n resource: 'createInfiniteParams',\n tool: plugin.name,\n },\n name: buildName({\n config: {\n case: plugin.config.case,\n },\n name: 'createInfiniteParams',\n }),\n });\n\n const fn = tsc.constVariable({\n expression: tsc.arrowFunction({\n multiLine: true,\n parameters: [\n {\n name: 'queryKey',\n type: tsc.typeReferenceNode({ typeName: 'QueryKey<Options>' }),\n },\n {\n name: 'page',\n type: tsc.typeReferenceNode({ typeName: 'K' }),\n },\n ],\n statements: [\n tsc.constVariable({\n expression: tsc.objectExpression({\n obj: [\n {\n spread: tsc.propertyAccessExpression({\n expression: 'queryKey',\n name: 0,\n }),\n },\n ],\n }),\n name: 'params',\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: tsc.identifier({\n text: 'page',\n }),\n name: tsc.identifier({ text: 'body' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'body',\n }),\n right: tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n assertion: 'any',\n spread: 'queryKey[0].body',\n },\n {\n assertion: 'any',\n spread: 'page.body',\n },\n ],\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: tsc.identifier({\n text: 'page',\n }),\n name: tsc.identifier({ text: 'headers' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'headers',\n }),\n right: tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n spread: 'queryKey[0].headers',\n },\n {\n spread: 'page.headers',\n },\n ],\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: tsc.identifier({\n text: 'page',\n }),\n name: tsc.identifier({ text: 'path' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'path',\n }),\n right: tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n assertion: 'any',\n spread: 'queryKey[0].path',\n },\n {\n assertion: 'any',\n spread: 'page.path',\n },\n ],\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.ifStatement({\n expression: tsc.propertyAccessExpression({\n expression: tsc.identifier({\n text: 'page',\n }),\n name: tsc.identifier({ text: 'query' }),\n }),\n thenStatement: tsc.block({\n statements: [\n tsc.expressionToStatement({\n expression: tsc.binaryExpression({\n left: tsc.propertyAccessExpression({\n expression: 'params',\n name: 'query',\n }),\n right: tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n assertion: 'any',\n spread: 'queryKey[0].query',\n },\n {\n assertion: 'any',\n spread: 'page.query',\n },\n ],\n }),\n }),\n }),\n ],\n }),\n }),\n tsc.returnVariable({\n expression: tsc.asExpression({\n expression: tsc.asExpression({\n expression: tsc.identifier({ text: 'params' }),\n type: tsc.keywordTypeNode({ keyword: 'unknown' }),\n }),\n type: ts.factory.createTypeQueryNode(\n tsc.identifier({ text: 'page' }),\n ),\n }),\n }),\n ],\n types: [\n {\n extends: tsc.typeReferenceNode({\n typeName: tsc.identifier({\n text: \"Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>\",\n }),\n }),\n name: 'K',\n },\n ],\n }),\n name: symbolCreateInfiniteParams.placeholder,\n });\n plugin.setSymbolValue(symbolCreateInfiniteParams, fn);\n};\n\nexport const createInfiniteQueryOptions = ({\n operation,\n plugin,\n queryFn,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n queryFn: string;\n}): void => {\n const pagination = operationPagination({\n context: plugin.context,\n operation,\n });\n\n if (!pagination) {\n return;\n }\n\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n\n if (\n !plugin.getSymbol({\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n })\n ) {\n createQueryKeyType({ plugin });\n createQueryKeyFunction({ plugin });\n }\n\n if (\n !plugin.getSymbol({\n category: 'utility',\n resource: 'createInfiniteParams',\n tool: plugin.name,\n })\n ) {\n createInfiniteParamsFunction({ plugin });\n }\n\n const symbolInfiniteQueryOptions = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.infiniteQueryOptions`,\n });\n const symbolInfiniteDataType = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.InfiniteData`,\n });\n\n const typeData = useTypeData({ operation, plugin });\n const typeError = useTypeError({ operation, plugin });\n const typeResponse = useTypeResponse({ operation, plugin });\n\n const symbolQueryKeyType = plugin.referenceSymbol({\n category: 'type',\n resource: 'QueryKey',\n tool: plugin.name,\n });\n const typeQueryKey = `${symbolQueryKeyType.placeholder}<${typeData}>`;\n const typePageObjectParam = `Pick<${typeQueryKey}[0], 'body' | 'headers' | 'path' | 'query'>`;\n const pluginTypeScript = plugin.getPluginOrThrow('@hey-api/typescript');\n // TODO: parser - this is a bit clunky, need to compile type to string because\n // `tsc.returnFunctionCall()` accepts only strings, should be cleaned up\n const type = pluginTypeScript.api.schemaToType({\n plugin: pluginTypeScript,\n schema: pagination.schema,\n state: {\n path: {\n value: [],\n },\n },\n });\n const typePageParam = `${tsNodeToString({\n node: type,\n unescape: true,\n })} | ${typePageObjectParam}`;\n\n const symbolInfiniteQueryKey = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.infiniteQueryKeys,\n name: operation.id,\n }),\n });\n const node = queryKeyStatement({\n isInfinite: true,\n operation,\n plugin,\n symbol: symbolInfiniteQueryKey,\n typeQueryKey,\n });\n plugin.setSymbolValue(symbolInfiniteQueryKey, node);\n\n const awaitSdkExpression = tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: queryFn,\n parameters: [\n tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n spread: 'options',\n },\n {\n spread: 'params',\n },\n {\n key: 'signal',\n shorthand: true,\n value: tsc.identifier({\n text: 'signal',\n }),\n },\n {\n key: 'throwOnError',\n value: true,\n },\n ],\n }),\n ],\n }),\n });\n\n const symbolCreateInfiniteParams = plugin.referenceSymbol({\n category: 'utility',\n resource: 'createInfiniteParams',\n tool: plugin.name,\n });\n\n const statements: Array<ts.Statement> = [\n tsc.constVariable({\n comment: [\n {\n jsdoc: false,\n lines: ['@ts-ignore'],\n },\n ],\n expression: tsc.conditionalExpression({\n condition: tsc.binaryExpression({\n left: tsc.typeOfExpression({\n text: 'pageParam',\n }),\n operator: '===',\n right: tsc.ots.string('object'),\n }),\n whenFalse: tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n key: pagination.in,\n value: tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n key: pagination.name,\n value: tsc.identifier({\n text: 'pageParam',\n }),\n },\n ],\n }),\n },\n ],\n }),\n whenTrue: tsc.identifier({\n text: 'pageParam',\n }),\n }),\n name: 'page',\n typeName: typePageObjectParam,\n }),\n tsc.constVariable({\n expression: tsc.callExpression({\n functionName: symbolCreateInfiniteParams.placeholder,\n parameters: ['queryKey', 'page'],\n }),\n name: 'params',\n }),\n ];\n\n if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') {\n statements.push(\n tsc.returnVariable({\n expression: awaitSdkExpression,\n }),\n );\n } else {\n statements.push(\n tsc.constVariable({\n destructure: true,\n expression: awaitSdkExpression,\n name: 'data',\n }),\n tsc.returnVariable({\n expression: 'data',\n }),\n );\n }\n\n const infiniteQueryOptionsObj: Array<{ key: string; value: ts.Expression }> =\n [\n {\n key: 'queryFn',\n value: tsc.arrowFunction({\n async: true,\n multiLine: true,\n parameters: [\n {\n destructure: [\n {\n name: 'pageParam',\n },\n {\n name: 'queryKey',\n },\n {\n name: 'signal',\n },\n ],\n },\n ],\n statements,\n }),\n },\n {\n key: 'queryKey',\n value: tsc.callExpression({\n functionName: symbolInfiniteQueryKey.placeholder,\n parameters: ['options'],\n }),\n },\n ];\n\n const meta = handleMeta(plugin, operation, 'infiniteQueryOptions');\n\n if (meta) {\n infiniteQueryOptionsObj.push({\n key: 'meta',\n value: meta,\n });\n }\n\n const symbolInfiniteQueryOptionsFn = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.infiniteQueryOptions,\n name: operation.id,\n }),\n });\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createOperationComment({ operation })\n : undefined,\n exportConst: symbolInfiniteQueryOptionsFn.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: 'options',\n type: typeData,\n },\n ],\n statements: [\n tsc.returnFunctionCall({\n args: [\n tsc.objectExpression({\n comments: [\n {\n jsdoc: false,\n lines: ['@ts-ignore'],\n },\n ],\n obj: infiniteQueryOptionsObj,\n }),\n ],\n name: symbolInfiniteQueryOptions.placeholder,\n // TODO: better types syntax\n types: [\n typeResponse,\n typeError || 'unknown',\n `${symbolInfiniteDataType.placeholder}<${typeResponse}>`,\n typeQueryKey,\n typePageParam,\n ],\n }),\n ],\n }),\n name: symbolInfiniteQueryOptionsFn.placeholder,\n });\n plugin.setSymbolValue(symbolInfiniteQueryOptionsFn, statement);\n};\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport { createOperationComment } from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\n\nimport { handleMeta } from './meta';\nimport type { PluginInstance } from './types';\nimport { useTypeData, useTypeError, useTypeResponse } from './useType';\n\nexport const createMutationOptions = ({\n operation,\n plugin,\n queryFn,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n queryFn: string;\n}): void => {\n const symbolMutationOptionsType = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.MutationOptions`,\n });\n\n const typeData = useTypeData({ operation, plugin });\n const typeError = useTypeError({ operation, plugin });\n const typeResponse = useTypeResponse({ operation, plugin });\n // TODO: better types syntax\n const mutationType = `${symbolMutationOptionsType.placeholder}<${typeResponse}, ${typeError}, ${typeData}>`;\n\n const fnOptions = 'fnOptions';\n\n const awaitSdkExpression = tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: queryFn,\n parameters: [\n tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n spread: 'options',\n },\n {\n spread: fnOptions,\n },\n {\n key: 'throwOnError',\n value: true,\n },\n ],\n }),\n ],\n }),\n });\n\n const statements: Array<ts.Statement> = [];\n\n if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') {\n statements.push(\n tsc.returnVariable({\n expression: awaitSdkExpression,\n }),\n );\n } else {\n statements.push(\n tsc.constVariable({\n destructure: true,\n expression: awaitSdkExpression,\n name: 'data',\n }),\n tsc.returnVariable({\n expression: 'data',\n }),\n );\n }\n\n const mutationOptionsObj: Array<{ key: string; value: ts.Expression }> = [\n {\n key: 'mutationFn',\n value: tsc.arrowFunction({\n async: true,\n multiLine: true,\n parameters: [\n {\n name: fnOptions,\n },\n ],\n statements,\n }),\n },\n ];\n\n const meta = handleMeta(plugin, operation, 'mutationOptions');\n\n if (meta) {\n mutationOptionsObj.push({\n key: 'meta',\n value: meta,\n });\n }\n\n const mutationOptionsFn = 'mutationOptions';\n const expression = tsc.arrowFunction({\n parameters: [\n {\n isRequired: false,\n name: 'options',\n type: `Partial<${typeData}>`,\n },\n ],\n returnType: mutationType,\n statements: [\n tsc.constVariable({\n expression: tsc.objectExpression({\n obj: mutationOptionsObj,\n }),\n name: mutationOptionsFn,\n typeName: mutationType,\n }),\n tsc.returnVariable({\n expression: mutationOptionsFn,\n }),\n ],\n });\n const symbolMutationOptions = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.mutationOptions,\n name: operation.id,\n }),\n });\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createOperationComment({ operation })\n : undefined,\n exportConst: symbolMutationOptions.exported,\n expression,\n name: symbolMutationOptions.placeholder,\n });\n plugin.setSymbolValue(symbolMutationOptions, statement);\n};\n","import type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport {\n createOperationComment,\n hasOperationSse,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\n\nimport { handleMeta } from './meta';\nimport {\n createQueryKeyFunction,\n createQueryKeyType,\n queryKeyStatement,\n} from './queryKey';\nimport type { PluginInstance } from './types';\nimport { useTypeData } from './useType';\n\nconst optionsParamName = 'options';\n\nexport const createQueryOptions = ({\n operation,\n plugin,\n queryFn,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n queryFn: string;\n}): void => {\n if (hasOperationSse({ operation })) {\n return;\n }\n\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n\n if (\n !plugin.getSymbol({\n category: 'utility',\n resource: 'createQueryKey',\n tool: plugin.name,\n })\n ) {\n createQueryKeyType({ plugin });\n createQueryKeyFunction({ plugin });\n }\n\n const symbolQueryOptions = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.queryOptions`,\n });\n\n const symbolQueryKey = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.queryKeys,\n name: operation.id,\n }),\n });\n const node = queryKeyStatement({\n isInfinite: false,\n operation,\n plugin,\n symbol: symbolQueryKey,\n });\n plugin.setSymbolValue(symbolQueryKey, node);\n\n const typeData = useTypeData({ operation, plugin });\n\n const awaitSdkExpression = tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: queryFn,\n parameters: [\n tsc.objectExpression({\n multiLine: true,\n obj: [\n {\n spread: optionsParamName,\n },\n {\n spread: 'queryKey[0]',\n },\n {\n key: 'signal',\n shorthand: true,\n value: tsc.identifier({\n text: 'signal',\n }),\n },\n {\n key: 'throwOnError',\n value: true,\n },\n ],\n }),\n ],\n }),\n });\n\n const statements: Array<ts.Statement> = [];\n\n if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') {\n statements.push(\n tsc.returnVariable({\n expression: awaitSdkExpression,\n }),\n );\n } else {\n statements.push(\n tsc.constVariable({\n destructure: true,\n expression: awaitSdkExpression,\n name: 'data',\n }),\n tsc.returnVariable({\n expression: 'data',\n }),\n );\n }\n\n const queryOptionsObj: Array<{ key: string; value: ts.Expression }> = [\n {\n key: 'queryFn',\n value: tsc.arrowFunction({\n async: true,\n multiLine: true,\n parameters: [\n {\n destructure: [\n {\n name: 'queryKey',\n },\n {\n name: 'signal',\n },\n ],\n },\n ],\n statements,\n }),\n },\n {\n key: 'queryKey',\n value: tsc.callExpression({\n functionName: symbolQueryKey.placeholder,\n parameters: [optionsParamName],\n }),\n },\n ];\n\n const meta = handleMeta(plugin, operation, 'queryOptions');\n\n if (meta) {\n queryOptionsObj.push({\n key: 'meta',\n value: meta,\n });\n }\n\n const symbolQueryOptionsFn = plugin.registerSymbol({\n exported: plugin.config.queryOptions.exported,\n meta: {\n category: 'hook',\n resource: 'operation',\n resourceId: operation.id,\n role: 'queryOptions',\n tool: plugin.name,\n },\n name: buildName({\n config: plugin.config.queryOptions,\n name: operation.id,\n }),\n });\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createOperationComment({ operation })\n : undefined,\n exportConst: symbolQueryOptionsFn.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: optionsParamName,\n type: typeData,\n },\n ],\n statements: [\n tsc.returnFunctionCall({\n args: [tsc.objectExpression({ obj: queryOptionsObj })],\n name: symbolQueryOptions.placeholder,\n }),\n ],\n }),\n name: symbolQueryOptionsFn.placeholder,\n // TODO: add type error\n // TODO: AxiosError<PutSubmissionMetaError>\n });\n plugin.setSymbolValue(symbolQueryOptionsFn, statement);\n};\n","import type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport {\n createOperationComment,\n hasOperationSse,\n isOperationOptionsRequired,\n} from '~/plugins/shared/utils/operation';\nimport { tsc } from '~/tsc';\n\nimport type { PluginInstance } from './types';\nimport { useTypeData } from './useType';\n\nconst optionsParamName = 'options';\n\nexport const createUseQuery = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: PluginInstance;\n}): void => {\n if (hasOperationSse({ operation })) {\n return;\n }\n\n if (!('useQuery' in plugin.config)) {\n return;\n }\n\n const symbolUseQueryFn = plugin.registerSymbol({\n exported: true,\n name: buildName({\n config: plugin.config.useQuery,\n name: operation.id,\n }),\n });\n\n const symbolUseQuery = plugin.referenceSymbol({\n category: 'external',\n resource: `${plugin.name}.useQuery`,\n });\n\n const isRequiredOptions = isOperationOptionsRequired({\n context: plugin.context,\n operation,\n });\n const typeData = useTypeData({ operation, plugin });\n\n const symbolQueryOptionsFn = plugin.referenceSymbol({\n category: 'hook',\n resource: 'operation',\n resourceId: operation.id,\n role: 'queryOptions',\n tool: plugin.name,\n });\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createOperationComment({ operation })\n : undefined,\n exportConst: symbolUseQueryFn.exported,\n expression: tsc.arrowFunction({\n parameters: [\n {\n isRequired: isRequiredOptions,\n name: optionsParamName,\n type: typeData,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.callExpression({\n functionName: symbolUseQuery.placeholder,\n parameters: [\n tsc.callExpression({\n functionName: symbolQueryOptionsFn.placeholder,\n parameters: [optionsParamName],\n }),\n ],\n }),\n }),\n ],\n }),\n name: symbolUseQueryFn.placeholder,\n });\n plugin.setSymbolValue(symbolUseQueryFn, statement);\n};\n","import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation';\nimport { stringCase } from '~/utils/stringCase';\n\nimport { createInfiniteQueryOptions } from './infiniteQueryOptions';\nimport { createMutationOptions } from './mutationOptions';\nimport { createQueryOptions } from './queryOptions';\nimport type { PluginHandler } from './types';\nimport { createUseQuery } from './useQuery';\n\nexport const handler: PluginHandler = ({ plugin }) => {\n plugin.registerSymbol({\n external: plugin.name,\n kind: 'type',\n meta: {\n category: 'external',\n resource: `${plugin.name}.DefaultError`,\n },\n name: 'DefaultError',\n });\n plugin.registerSymbol({\n external: plugin.name,\n kind: 'type',\n meta: {\n category: 'external',\n resource: `${plugin.name}.InfiniteData`,\n },\n name: 'InfiniteData',\n });\n const mutationsType =\n plugin.name === '@tanstack/angular-query-experimental' ||\n plugin.name === '@tanstack/svelte-query' ||\n plugin.name === '@tanstack/solid-query'\n ? 'MutationOptions'\n : 'UseMutationOptions';\n plugin.registerSymbol({\n external: plugin.name,\n kind: 'type',\n meta: {\n category: 'external',\n resource: `${plugin.name}.MutationOptions`,\n },\n name: mutationsType,\n });\n plugin.registerSymbol({\n external: plugin.name,\n meta: {\n category: 'external',\n resource: `${plugin.name}.infiniteQueryOptions`,\n },\n name: 'infiniteQueryOptions',\n });\n plugin.registerSymbol({\n external: plugin.name,\n meta: {\n category: 'external',\n resource: `${plugin.name}.queryOptions`,\n },\n name: 'queryOptions',\n });\n plugin.registerSymbol({\n external: plugin.name,\n meta: {\n category: 'external',\n resource: `${plugin.name}.useQuery`,\n },\n name: 'useQuery',\n });\n plugin.registerSymbol({\n external: 'axios',\n kind: 'type',\n meta: {\n category: 'external',\n resource: 'axios.AxiosError',\n },\n name: 'AxiosError',\n });\n\n const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk');\n\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const classes = sdkPlugin.config.asClass\n ? operationClasses({\n context: plugin.context,\n operation,\n plugin: sdkPlugin,\n })\n : undefined;\n const entry = classes ? classes.values().next().value : undefined;\n const queryFn =\n // TODO: this should use class graph to determine correct path string\n // as it's really easy to break once we change the class casing\n entry\n ? [\n plugin.referenceSymbol({\n category: 'utility',\n resource: 'class',\n resourceId: entry.path[0],\n tool: 'sdk',\n }).placeholder,\n ...entry.path.slice(1).map((className) =>\n stringCase({\n case: 'camelCase',\n value: className,\n }),\n ),\n entry.methodName,\n ]\n .filter(Boolean)\n .join('.')\n : plugin.referenceSymbol({\n category: 'sdk',\n resource: 'operation',\n resourceId: operation.id,\n }).placeholder;\n\n if (plugin.hooks.operation.isQuery(operation)) {\n if (plugin.config.queryOptions.enabled) {\n createQueryOptions({ operation, plugin, queryFn });\n }\n\n if (plugin.config.infiniteQueryOptions.enabled) {\n createInfiniteQueryOptions({ operation, plugin, queryFn });\n }\n\n if ('useQuery' in plugin.config && plugin.config.useQuery.enabled) {\n createUseQuery({ operation, plugin });\n }\n }\n\n if (plugin.hooks.operation.isMutation(operation)) {\n if (plugin.config.mutationOptions.enabled) {\n createMutationOptions({ operation, plugin, queryFn });\n }\n }\n },\n {\n order: 'declarations',\n },\n );\n};\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import { handler } from '~/plugins/@tanstack/query-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { TanStackAngularQueryPlugin } from './types';\n\nexport const defaultConfig: TanStackAngularQueryPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/sdk', '@hey-api/typescript'],\n handler: handler as TanStackAngularQueryPlugin['Handler'],\n name: '@tanstack/angular-query-experimental',\n output: '@tanstack/angular-query-experimental',\n resolveConfig: (plugin, context) => {\n plugin.config.infiniteQueryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteQueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryKeys,\n });\n\n plugin.config.infiniteQueryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteOptions',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryOptions,\n });\n\n plugin.config.mutationOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Mutation',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.mutationOptions,\n });\n\n plugin.config.queryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}QueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryKeys,\n });\n\n plugin.config.queryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n exported: true,\n name: '{{name}}Options',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryOptions,\n });\n },\n};\n\n/**\n * Type helper for `@tanstack/angular-query-experimental` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import { handler } from '~/plugins/@tanstack/query-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { TanStackReactQueryPlugin } from './types';\n\nexport const defaultConfig: TanStackReactQueryPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/sdk', '@hey-api/typescript'],\n handler: handler as TanStackReactQueryPlugin['Handler'],\n name: '@tanstack/react-query',\n output: '@tanstack/react-query',\n resolveConfig: (plugin, context) => {\n plugin.config.infiniteQueryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteQueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryKeys,\n });\n\n plugin.config.infiniteQueryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteOptions',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryOptions,\n });\n\n plugin.config.mutationOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Mutation',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.mutationOptions,\n });\n\n plugin.config.queryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}QueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryKeys,\n });\n\n plugin.config.queryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n exported: true,\n name: '{{name}}Options',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryOptions,\n });\n\n plugin.config.useQuery = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: false,\n name: 'use{{name}}Query',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ enabled: true, name }),\n object: (fields) => ({ enabled: true, ...fields }),\n string: (name) => ({ enabled: true, name }),\n },\n value: plugin.config.useQuery,\n });\n\n if (plugin.config.useQuery.enabled) {\n // useQuery hooks consume queryOptions\n if (!plugin.config.queryOptions.enabled) {\n plugin.config.queryOptions.enabled = true;\n plugin.config.queryOptions.exported = false;\n }\n }\n },\n};\n\n/**\n * Type helper for `@tanstack/react-query` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import { handler } from '~/plugins/@tanstack/query-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { TanStackSolidQueryPlugin } from './types';\n\nexport const defaultConfig: TanStackSolidQueryPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/sdk', '@hey-api/typescript'],\n handler: handler as TanStackSolidQueryPlugin['Handler'],\n name: '@tanstack/solid-query',\n output: '@tanstack/solid-query',\n resolveConfig: (plugin, context) => {\n plugin.config.infiniteQueryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteQueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryKeys,\n });\n\n plugin.config.infiniteQueryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteOptions',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryOptions,\n });\n\n plugin.config.mutationOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Mutation',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.mutationOptions,\n });\n\n plugin.config.queryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}QueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryKeys,\n });\n\n plugin.config.queryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n exported: true,\n name: '{{name}}Options',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryOptions,\n });\n },\n};\n\n/**\n * Type helper for `@tanstack/solid-query` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import { handler } from '~/plugins/@tanstack/query-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { TanStackSvelteQueryPlugin } from './types';\n\nexport const defaultConfig: TanStackSvelteQueryPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/sdk', '@hey-api/typescript'],\n handler: handler as TanStackSvelteQueryPlugin['Handler'],\n name: '@tanstack/svelte-query',\n output: '@tanstack/svelte-query',\n resolveConfig: (plugin, context) => {\n plugin.config.infiniteQueryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteQueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryKeys,\n });\n\n plugin.config.infiniteQueryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteOptions',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryOptions,\n });\n\n plugin.config.mutationOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Mutation',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.mutationOptions,\n });\n\n plugin.config.queryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}QueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryKeys,\n });\n\n plugin.config.queryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n exported: true,\n name: '{{name}}Options',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryOptions,\n });\n },\n};\n\n/**\n * Type helper for `@tanstack/svelte-query` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import { handler } from '~/plugins/@tanstack/query-core/plugin';\nimport { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport type { TanStackVueQueryPlugin } from './types';\n\nexport const defaultConfig: TanStackVueQueryPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/sdk', '@hey-api/typescript'],\n handler: handler as TanStackVueQueryPlugin['Handler'],\n name: '@tanstack/vue-query',\n output: '@tanstack/vue-query',\n resolveConfig: (plugin, context) => {\n plugin.config.infiniteQueryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteQueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryKeys,\n });\n\n plugin.config.infiniteQueryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}InfiniteOptions',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.infiniteQueryOptions,\n });\n\n plugin.config.mutationOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}Mutation',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.mutationOptions,\n });\n\n plugin.config.queryKeys = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: '{{name}}QueryKey',\n tags: false,\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryKeys,\n });\n\n plugin.config.queryOptions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n exported: true,\n name: '{{name}}Options',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.queryOptions,\n });\n },\n};\n\n/**\n * Type helper for `@tanstack/vue-query` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\n// import { identifiers } from '../constants';\nimport type { ValidatorArgs } from '../shared/types';\n\nexport const createRequestValidatorV2 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'arktype',\n });\n if (!symbol) return;\n\n // const out = User({\n // name: \"Alan Turing\",\n // device: {\n // platform: \"enigma\",\n // versions: [0, \"1\", 0n]\n // }\n // })\n // if (out instanceof type.errors) {\n // // hover out.summary to see validation errors\n // console.error(out.summary)\n // } else {\n // // hover out to see your validated data\n // console.log(`Hello, ${out.name}`)\n // }\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: 'parseAsync',\n // name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n\nexport const createResponseValidatorV2 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tool: 'arktype',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: 'parseAsync',\n // name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n","import type ts from 'typescript';\n\nimport type { ValidatorArgs } from './shared/types';\nimport { createRequestValidatorV2, createResponseValidatorV2 } from './v2/api';\n\nexport type IApi = {\n createRequestValidator: (args: ValidatorArgs) => ts.ArrowFunction | undefined;\n createResponseValidator: (\n args: ValidatorArgs,\n ) => ts.ArrowFunction | undefined;\n};\n\nexport class Api implements IApi {\n createRequestValidator(args: ValidatorArgs): ts.ArrowFunction | undefined {\n return createRequestValidatorV2(args);\n }\n\n createResponseValidator(args: ValidatorArgs): ts.ArrowFunction | undefined {\n return createResponseValidatorV2(args);\n }\n}\n","import { tsc } from '~/tsc';\n\nexport const identifiers = {\n keywords: {\n false: tsc.identifier({ text: 'false' }),\n true: tsc.identifier({ text: 'true' }),\n },\n /**\n * {@link https://arktype.io/docs/primitives#number Number}\n */\n number: {\n Infinity: tsc.identifier({ text: 'Infinity' }),\n NaN: tsc.identifier({ text: 'NaN' }),\n NegativeInfinity: tsc.identifier({ text: 'NegativeInfinity' }),\n epoch: tsc.identifier({ text: 'epoch' }),\n integer: tsc.identifier({ text: 'integer' }),\n safe: tsc.identifier({ text: 'safe' }),\n },\n /**\n * {@link https://arktype.io/docs/primitives Primitives}\n */\n primitives: {\n bigint: tsc.identifier({ text: 'bigint' }),\n boolean: tsc.identifier({ text: 'boolean' }),\n keywords: tsc.identifier({ text: 'keywords' }),\n null: 'null',\n number: tsc.identifier({ text: 'number' }),\n string: 'string',\n symbol: tsc.identifier({ text: 'symbol' }),\n undefined: tsc.identifier({ text: 'undefined' }),\n unit: tsc.identifier({ text: 'unit' }),\n },\n /**\n * {@link https://arktype.io/docs/primitives#string String}\n */\n string: {\n NFC: tsc.identifier({ text: 'NFC' }),\n NFD: tsc.identifier({ text: 'NFD' }),\n NFKC: tsc.identifier({ text: 'NFKC' }),\n NFKD: tsc.identifier({ text: 'NFKD' }),\n alpha: tsc.identifier({ text: 'alpha' }),\n alphanumeric: tsc.identifier({ text: 'alphanumeric' }),\n base64: tsc.identifier({ text: 'base64' }),\n capitalize: tsc.identifier({ text: 'capitalize' }),\n creditCard: tsc.identifier({ text: 'creditCard' }),\n date: 'date',\n digits: tsc.identifier({ text: 'digits' }),\n email: 'email',\n epoch: tsc.identifier({ text: 'epoch' }),\n hex: tsc.identifier({ text: 'hex' }),\n integer: tsc.identifier({ text: 'integer' }),\n ip: 'ip',\n iso: 'iso',\n json: tsc.identifier({ text: 'json' }),\n lower: tsc.identifier({ text: 'lower' }),\n normalize: tsc.identifier({ text: 'normalize' }),\n numeric: tsc.identifier({ text: 'numeric' }),\n parse: tsc.identifier({ text: 'parse' }),\n preformatted: tsc.identifier({ text: 'preformatted' }),\n regex: tsc.identifier({ text: 'regex' }),\n semver: tsc.identifier({ text: 'semver' }),\n trim: tsc.identifier({ text: 'trim' }),\n upper: tsc.identifier({ text: 'upper' }),\n url: 'url',\n uuid: 'uuid',\n v1: 'v1',\n v2: 'v2',\n v3: 'v3',\n v4: 'v4',\n v5: 'v5',\n v6: 'v6',\n v7: 'v7',\n v8: 'v8',\n },\n /**\n * {@link https://arktype.io/docs/type-api Type API}\n */\n type: {\n $: tsc.identifier({ text: '$' }),\n allows: tsc.identifier({ text: 'allows' }),\n and: tsc.identifier({ text: 'and' }),\n array: tsc.identifier({ text: 'array' }),\n as: tsc.identifier({ text: 'as' }),\n assert: tsc.identifier({ text: 'assert' }),\n brand: tsc.identifier({ text: 'brand' }),\n configure: tsc.identifier({ text: 'configure' }),\n default: tsc.identifier({ text: 'default' }),\n describe: tsc.identifier({ text: 'describe' }),\n description: tsc.identifier({ text: 'description' }),\n equals: tsc.identifier({ text: 'equals' }),\n exclude: tsc.identifier({ text: 'exclude' }),\n expression: tsc.identifier({ text: 'expression' }),\n extends: tsc.identifier({ text: 'extends' }),\n extract: tsc.identifier({ text: 'extract' }),\n filter: tsc.identifier({ text: 'filter' }),\n from: tsc.identifier({ text: 'from' }),\n ifEquals: tsc.identifier({ text: 'ifEquals' }),\n ifExtends: tsc.identifier({ text: 'ifExtends' }),\n infer: tsc.identifier({ text: 'infer' }),\n inferIn: tsc.identifier({ text: 'inferIn' }),\n intersect: tsc.identifier({ text: 'intersect' }),\n json: tsc.identifier({ text: 'json' }),\n meta: tsc.identifier({ text: 'meta' }),\n narrow: tsc.identifier({ text: 'narrow' }),\n onDeepUndeclaredKey: tsc.identifier({ text: 'onDeepUndeclaredKey' }),\n onUndeclaredKey: tsc.identifier({ text: 'onUndeclaredKey' }),\n optional: tsc.identifier({ text: 'optional' }),\n or: tsc.identifier({ text: 'or' }),\n overlaps: tsc.identifier({ text: 'overlaps' }),\n pipe: tsc.identifier({ text: 'pipe' }),\n select: tsc.identifier({ text: 'select' }),\n to: tsc.identifier({ text: 'to' }),\n toJsonSchema: tsc.identifier({ text: 'toJsonSchema' }),\n },\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { createSchemaComment } from '~/plugins/shared/utils/schema';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../constants';\nimport type { ArktypePlugin } from '../types';\nimport type { Ast } from './types';\n\nexport const exportAst = ({\n ast,\n plugin,\n schema,\n symbol,\n typeInferSymbol,\n}: {\n ast: Ast;\n plugin: ArktypePlugin['Instance'];\n schema: IR.SchemaObject;\n symbol: Symbol;\n typeInferSymbol: Symbol | undefined;\n}): void => {\n const type = plugin.referenceSymbol({\n category: 'external',\n resource: 'arktype.type',\n });\n\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createSchemaComment({ schema })\n : undefined,\n exportConst: symbol.exported,\n expression: tsc.callExpression({\n functionName: type.placeholder,\n parameters: [\n ast.def ? tsc.stringLiteral({ text: ast.def }) : ast.expression,\n ],\n }),\n name: symbol.placeholder,\n // typeName: ast.typeName\n // ? (tsc.propertyAccessExpression({\n // expression: z.placeholder,\n // name: ast.typeName,\n // }) as unknown as ts.TypeNode)\n // : undefined,\n });\n plugin.setSymbolValue(symbol, statement);\n\n if (typeInferSymbol) {\n const inferType = tsc.typeAliasDeclaration({\n exportType: typeInferSymbol.exported,\n name: typeInferSymbol.placeholder,\n type: ts.factory.createTypeQueryNode(\n ts.factory.createQualifiedName(\n ts.factory.createIdentifier(symbol.placeholder),\n identifiers.type.infer,\n ),\n ),\n });\n plugin.setSymbolValue(typeInferSymbol, inferType);\n }\n};\n","import type { SchemaWithType } from '~/plugins/shared/types/schema';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const nullToAst = (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _args: IrSchemaToAstOptions & {\n schema: SchemaWithType<'null'>;\n },\n): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n result.def = identifiers.primitives.null;\n return result as Omit<Ast, 'typeName'>;\n};\n","import ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins/shared/types/schema';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { numberRegExp } from '~/utils/regexp';\n\n// import { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const objectToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'object'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n // TODO: parser - handle constants\n const properties: Array<ts.PropertyAssignment | ts.GetAccessorDeclaration> =\n [];\n\n const required = schema.required ?? [];\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const isRequired = required.includes(name);\n\n const propertyAst = irSchemaToAst({\n optional: !isRequired,\n plugin,\n schema: property,\n state: {\n ...state,\n path: toRef([...state.path.value, 'properties', name]),\n },\n });\n if (propertyAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n let propertyName:\n | ts.ComputedPropertyName\n | ts.StringLiteral\n | ts.NumericLiteral\n | string = isRequired ? name : `${name}?`;\n\n // if (propertyAst.hasCircularReference) {\n // properties.push(\n // tsc.getAccessorDeclaration({\n // name: propertyName,\n // // @ts-expect-error\n // returnType: propertyAst.typeName\n // ? tsc.propertyAccessExpression({\n // expression: 'TODO',\n // name: propertyAst.typeName,\n // })\n // : undefined,\n // statements: [\n // tsc.returnStatement({\n // expression: propertyAst.expression,\n // }),\n // ],\n // }),\n // );\n // } else {\n // properties.push(\n // tsc.propertyAssignment({\n // initializer: propertyAst.expression,\n // name: ts.factory.createComputedPropertyName(\n // ts.factory.createStringLiteral(`${propertyName}?`),\n // ),\n // }),\n // );\n // }\n\n if (propertyName.endsWith('?')) {\n propertyName = ts.factory.createComputedPropertyName(\n tsc.stringLiteral({ text: propertyName }),\n );\n } else {\n // TODO: parser - abstract safe property name logic\n if (\n ((propertyName.match(/^[0-9]/) && propertyName.match(/\\D+/g)) ||\n propertyName.match(/\\W/g)) &&\n !propertyName.startsWith(\"'\") &&\n !propertyName.endsWith(\"'\")\n ) {\n propertyName = `'${propertyName}'`;\n }\n\n numberRegExp.lastIndex = 0;\n if (numberRegExp.test(propertyName)) {\n // For numeric literals, we'll handle negative numbers by using a string literal\n // instead of trying to use a PrefixUnaryExpression\n propertyName = propertyName.startsWith('-')\n ? tsc.stringLiteral({ text: name })\n : ts.factory.createNumericLiteral(name);\n } else {\n propertyName = name;\n }\n }\n properties.push(\n tsc.propertyAssignment({\n initializer: propertyAst.expression,\n name: propertyName,\n }),\n );\n }\n\n if (\n schema.additionalProperties &&\n (!schema.properties || !Object.keys(schema.properties).length)\n ) {\n const additionalAst = irSchemaToAst({\n plugin,\n schema: schema.additionalProperties,\n state: {\n ...state,\n path: toRef([...state.path.value, 'additionalProperties']),\n },\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: 'TODO',\n name: 'record',\n // name: identifiers.record,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: 'TODO',\n name: 'string',\n // name: identifiers.string,\n }),\n parameters: [],\n }),\n additionalAst.expression,\n ],\n });\n if (additionalAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n // Return with typeName for circular references\n if (result.hasLazyExpression) {\n return {\n ...result,\n typeName: 'TODO',\n } as Ast;\n }\n\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = ts.factory.createObjectLiteralExpression(\n properties,\n true,\n );\n\n // return with typeName for circular references\n if (result.hasLazyExpression) {\n return {\n ...result,\n typeName: 'TODO',\n } as Ast;\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins/shared/types/schema';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const stringToAst = ({\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'string'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n if (typeof schema.const === 'string') {\n result.def = schema.const;\n return result as Omit<Ast, 'typeName'>;\n }\n\n let def = identifiers.primitives.string;\n\n if (schema.format) {\n switch (schema.format) {\n case 'date':\n case 'date-time':\n case 'time':\n def = `${def}.${identifiers.string.date}.${identifiers.string.iso}`;\n break;\n case 'email':\n def = `${def}.${identifiers.string.email}`;\n break;\n case 'ipv4':\n def = `${def}.${identifiers.string.ip}.${identifiers.string.v4}`;\n break;\n case 'ipv6':\n def = `${def}.${identifiers.string.ip}.${identifiers.string.v6}`;\n break;\n case 'uri':\n def = `${def}.${identifiers.string.url}`;\n break;\n case 'uuid':\n def = `${def}.${identifiers.string.uuid}`;\n break;\n }\n }\n\n if (schema.minLength === schema.maxLength && schema.minLength !== undefined) {\n def = `${schema.minLength} <= ${def} <= ${schema.maxLength}`;\n } else {\n if (schema.maxLength !== undefined) {\n def = `${def} <= ${schema.maxLength}`;\n\n if (schema.minLength !== undefined) {\n def = `${schema.minLength} <= ${def}`;\n }\n } else if (schema.minLength !== undefined) {\n def = `${def} >= ${schema.minLength}`;\n }\n }\n\n if (schema.pattern) {\n def = `/${schema.pattern}/`;\n }\n\n result.def = def;\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins/shared/types/schema';\n\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { nullToAst } from './null';\nimport { objectToAst } from './object';\nimport { stringToAst } from './string';\n// import { arrayToAst } from \"./array\";\n// import { booleanToAst } from \"./boolean\";\n// import { enumToAst } from \"./enum\";\n// import { neverToAst } from \"./never\";\n// import { numberToAst } from \"./number\";\n// import { tupleToAst } from \"./tuple\";\n// import { undefinedToAst } from \"./undefined\";\n// import { unknownToAst } from \"./unknown\";\n// import { voidToAst } from \"./void\";\n\nexport const irSchemaWithTypeToAst = ({\n schema,\n ...args\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType;\n}): Omit<Ast, 'typeName'> => {\n switch (schema.type) {\n // case 'array':\n // return arrayToAst({\n // ...args,\n // schema: schema as SchemaWithType<'array'>,\n // });\n // case 'boolean':\n // return booleanToAst({\n // ...args,\n // schema: schema as SchemaWithType<'boolean'>,\n // });\n // case 'enum':\n // return enumToAst({\n // ...args,\n // schema: schema as SchemaWithType<'enum'>,\n // });\n // case 'integer':\n // case 'number':\n // return numberToAst({\n // ...args,\n // schema: schema as SchemaWithType<'integer' | 'number'>,\n // });\n // case 'never':\n // return neverToAst({\n // ...args,\n // schema: schema as SchemaWithType<'never'>,\n // });\n case 'null':\n return nullToAst({\n ...args,\n schema: schema as SchemaWithType<'null'>,\n });\n case 'object':\n return objectToAst({\n ...args,\n schema: schema as SchemaWithType<'object'>,\n });\n case 'string':\n return stringToAst({\n ...args,\n schema: schema as SchemaWithType<'string'>,\n });\n // case 'tuple':\n // return tupleToAst({\n // ...args,\n // schema: schema as SchemaWithType<'tuple'>,\n // });\n // case 'undefined':\n // return undefinedToAst({\n // ...args,\n // schema: schema as SchemaWithType<'undefined'>,\n // });\n // case 'unknown':\n // return unknownToAst({\n // ...args,\n // schema: schema as SchemaWithType<'unknown'>,\n // });\n // case 'void':\n // return voidToAst({\n // ...args,\n // schema: schema as SchemaWithType<'void'>,\n // });\n }\n\n const type = args.plugin.referenceSymbol({\n category: 'external',\n resource: 'arktype.type',\n });\n\n const expression = ts.factory.createCallExpression(\n ts.factory.createIdentifier(type.placeholder),\n undefined,\n [\n ts.factory.createObjectLiteralExpression(\n [\n ts.factory.createPropertyAssignment(\n 'name',\n ts.factory.createStringLiteral('string'),\n ),\n ts.factory.createPropertyAssignment(\n 'platform',\n ts.factory.createStringLiteral(\"'android' | 'ios'\"),\n ),\n ts.factory.createPropertyAssignment(\n ts.factory.createComputedPropertyName(\n ts.factory.createStringLiteral('versions?'),\n ),\n ts.factory.createStringLiteral('(number | string)[]'),\n ),\n ],\n true,\n ),\n ],\n );\n\n return {\n def: '',\n expression,\n hasLazyExpression: false,\n };\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { SchemaWithType } from '~/plugins/shared/types/schema';\nimport { toRefs } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { pathToJsonPointer, refToName } from '~/utils/ref';\n\nimport { exportAst } from '../shared/export';\nimport type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types';\nimport type { ArktypePlugin } from '../types';\nimport { irSchemaWithTypeToAst } from './toAst';\n\nexport const irSchemaToAst = ({\n // optional,\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n /**\n * Accept `optional` to handle optional object properties. We can't handle\n * this inside the object function because `.optional()` must come before\n * `.default()` which is handled in this function.\n */\n optional?: boolean;\n schema: IR.SchemaObject;\n}): Ast => {\n let ast: Partial<Ast> = {};\n\n // const z = plugin.referenceSymbol({\n // category: 'external',\n // resource: 'arktype.type',\n // });\n\n if (schema.$ref) {\n const query: SymbolMeta = {\n category: 'schema',\n resource: 'definition',\n resourceId: schema.$ref,\n tool: 'arktype',\n };\n const refSymbol = plugin.referenceSymbol(query);\n if (plugin.isSymbolRegistered(query)) {\n const ref = tsc.identifier({ text: refSymbol.placeholder });\n ast.expression = ref;\n } else {\n const lazyExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n // expression: z.placeholder,\n expression: 'TODO',\n name: 'TODO',\n // name: identifiers.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n returnType: tsc.keywordTypeNode({ keyword: 'any' }),\n statements: [\n tsc.returnStatement({\n expression: tsc.identifier({ text: refSymbol.placeholder }),\n }),\n ],\n }),\n ],\n });\n ast.expression = lazyExpression;\n ast.hasLazyExpression = true;\n state.hasLazyExpression.value = true;\n }\n } else if (schema.type) {\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: schema as SchemaWithType,\n state,\n });\n ast.def = typeAst.def;\n ast.expression = typeAst.expression;\n ast.hasLazyExpression = typeAst.hasLazyExpression;\n\n if (plugin.config.metadata && schema.description) {\n // TODO: add description\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: ast.expression,\n // name: identifiers.register,\n // }),\n // parameters: [\n // tsc.propertyAccessExpression({\n // expression: z.placeholder,\n // name: identifiers.globalRegistry,\n // }),\n // tsc.objectExpression({\n // obj: [\n // {\n // key: 'description',\n // value: tsc.stringLiteral({ text: schema.description }),\n // },\n // ],\n // }),\n // ],\n // });\n }\n } else if (schema.items) {\n schema = deduplicateSchema({ schema });\n\n if (schema.items) {\n // const itemSchemas = schema.items.map((item, index) =>\n // irSchemaToAst({\n // plugin,\n // schema: item,\n // state: {\n // ...state,\n // _path: [...state._path, 'items', index],\n // },\n // }),\n // );\n // if (schema.logicalOperator === 'and') {\n // const firstSchema = schema.items[0]!;\n // // we want to add an intersection, but not every schema can use the same API.\n // // if the first item contains another array or not an object, we cannot use\n // // `.merge()` as that does not exist on `.union()` and non-object schemas.\n // if (\n // firstSchema.logicalOperator === 'or' ||\n // (firstSchema.type && firstSchema.type !== 'object')\n // ) {\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: z.placeholder,\n // name: identifiers.intersection,\n // }),\n // parameters: itemSchemas.map((schema) => schema.expression),\n // });\n // } else {\n // ast.expression = itemSchemas[0]!.expression;\n // itemSchemas.slice(1).forEach((schema) => {\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: ast.expression!,\n // name: identifiers.and,\n // }),\n // parameters: [\n // schema.hasCircularReference\n // ? tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: z.placeholder,\n // name: identifiers.lazy,\n // }),\n // parameters: [\n // tsc.arrowFunction({\n // statements: [\n // tsc.returnStatement({\n // expression: schema.expression,\n // }),\n // ],\n // }),\n // ],\n // })\n // : schema.expression,\n // ],\n // });\n // });\n // }\n // } else {\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: z.placeholder,\n // name: identifiers.union,\n // }),\n // parameters: [\n // tsc.arrayLiteralExpression({\n // elements: itemSchemas.map((schema) => schema.expression),\n // }),\n // ],\n // });\n // }\n } else {\n ast = irSchemaToAst({ plugin, schema, state });\n }\n } else {\n // catch-all fallback for failed schemas\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n ast.def = typeAst.def;\n ast.expression = typeAst.expression;\n }\n\n // TODO: remove later\n if (!ast.expression) {\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n ast.expression = typeAst.expression;\n }\n // END TODO: remove later\n\n // if (ast.expression) {\n // if (schema.accessScope === 'read') {\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: ast.expression,\n // name: identifiers.readonly,\n // }),\n // });\n // }\n\n // if (optional) {\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: z.placeholder,\n // name: identifiers.optional,\n // }),\n // parameters: [ast.expression],\n // });\n // ast.typeName = identifiers.ZodOptional;\n // }\n\n // if (schema.default !== undefined) {\n // const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n // const callParameter = numberParameter({\n // isBigInt,\n // value: schema.default,\n // });\n // if (callParameter) {\n // ast.expression = tsc.callExpression({\n // functionName: tsc.propertyAccessExpression({\n // expression: ast.expression,\n // name: identifiers.default,\n // }),\n // parameters: [callParameter],\n // });\n // }\n // }\n // }\n\n return ast as Ast;\n};\n\nconst handleComponent = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}): void => {\n const $ref = pathToJsonPointer(state.path.value);\n const ast = irSchemaToAst({ plugin, schema, state });\n const baseName = refToName($ref);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'arktype',\n },\n name: buildName({\n config: plugin.config.definitions,\n name: baseName,\n }),\n });\n const typeInferSymbol = plugin.config.definitions.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tool: 'arktype',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.definitions.types.infer,\n name: baseName,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema,\n symbol,\n typeInferSymbol,\n });\n};\n\nexport const handlerV2: ArktypePlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: 'arktype',\n meta: {\n category: 'external',\n resource: 'arktype.type',\n },\n name: 'type',\n });\n\n plugin.forEach(\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'webhook',\n (event) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path: event._path,\n tags: event.tags,\n });\n switch (event.type) {\n // case 'operation':\n // operationToZodSchema({\n // getZodSchema: (schema) => {\n // const state: State = {\n // circularReferenceTracker: [],\n // currentReferenceTracker: [],\n // hasCircularReference: false,\n // };\n // return schemaToZodSchema({ plugin, schema, state });\n // },\n // operation: event.operation,\n // plugin,\n // });\n // break;\n case 'parameter':\n handleComponent({\n plugin,\n schema: event.parameter.schema,\n state,\n });\n break;\n case 'requestBody':\n handleComponent({\n plugin,\n schema: event.requestBody.schema,\n state,\n });\n break;\n case 'schema':\n handleComponent({\n plugin,\n schema: event.schema,\n state,\n });\n break;\n // case 'webhook':\n // webhookToZodSchema({\n // getZodSchema: (schema) => {\n // const state: State = {\n // circularReferenceTracker: [],\n // currentReferenceTracker: [],\n // hasCircularReference: false,\n // };\n // return schemaToZodSchema({ plugin, schema, state });\n // },\n // operation: event.operation,\n // plugin,\n // });\n // break;\n }\n },\n );\n};\n","import type { ArktypePlugin } from './types';\nimport { handlerV2 } from './v2/plugin';\n\nexport const handler: ArktypePlugin['Handler'] = (args) => handlerV2(args);\n","import { definePluginConfig, mappers } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { ArktypePlugin } from './types';\n\nexport const defaultConfig: ArktypePlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'PascalCase',\n comments: true,\n exportFromIndex: false,\n metadata: false,\n },\n handler,\n name: 'arktype',\n resolveConfig: (plugin, context) => {\n plugin.config.types = context.valueToObject({\n defaultValue: {\n infer: {\n case: 'PascalCase',\n enabled: false,\n },\n },\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: plugin.config.types,\n });\n\n plugin.config.definitions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n enabled: true,\n name: '{{name}}',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.definitions,\n });\n\n plugin.config.requests = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n enabled: true,\n name: '{{name}}Data',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}Data',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.requests,\n });\n\n plugin.config.responses = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n enabled: true,\n name: '{{name}}Response',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}Response',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.responses,\n });\n\n plugin.config.webhooks = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'PascalCase',\n enabled: true,\n name: '{{name}}WebhookRequest',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}WebhookRequest',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.webhooks,\n });\n },\n tags: ['validator'],\n};\n\n/**\n * Type helper for Arktype plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","export type IApi = any;\n\nexport class Api implements IApi {}\n","import type ts from 'typescript';\n\nimport { operationResponsesMap } from '~/ir/operation';\nimport { hasParameterGroupObjectRequired } from '~/ir/parameter';\nimport type { IR } from '~/ir/types';\nimport { type Property, tsc } from '~/tsc';\n\nimport type { FastifyPlugin } from './types';\n\nconst operationToRouteHandler = ({\n operation,\n plugin,\n}: {\n operation: IR.OperationObject;\n plugin: FastifyPlugin['Instance'];\n}): Property | undefined => {\n const properties: Array<Property> = [];\n\n const symbolDataType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'typescript',\n });\n if (symbolDataType) {\n if (operation.body) {\n properties.push({\n isRequired: operation.body.required,\n name: 'Body',\n type: `${symbolDataType.placeholder}['body']`,\n });\n }\n\n if (operation.parameters) {\n if (operation.parameters.header) {\n properties.push({\n isRequired: hasParameterGroupObjectRequired(\n operation.parameters.header,\n ),\n name: 'Headers',\n type: `${symbolDataType.placeholder}['headers']`,\n });\n }\n\n if (operation.parameters.path) {\n properties.push({\n isRequired: hasParameterGroupObjectRequired(\n operation.parameters.path,\n ),\n name: 'Params',\n type: `${symbolDataType.placeholder}['path']`,\n });\n }\n\n if (operation.parameters.query) {\n properties.push({\n isRequired: hasParameterGroupObjectRequired(\n operation.parameters.query,\n ),\n name: 'Querystring',\n type: `${symbolDataType.placeholder}['query']`,\n });\n }\n }\n }\n\n const { errors, responses } = operationResponsesMap(operation);\n\n let errorsTypeReference: ts.TypeReferenceNode | undefined = undefined;\n const symbolErrorType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'errors',\n });\n if (symbolErrorType && errors && errors.properties) {\n const keys = Object.keys(errors.properties);\n if (keys.length) {\n const hasDefaultResponse = keys.includes('default');\n if (!hasDefaultResponse) {\n errorsTypeReference = tsc.typeReferenceNode({\n typeName: symbolErrorType.placeholder,\n });\n } else if (keys.length > 1) {\n const errorsType = tsc.typeReferenceNode({\n typeName: symbolErrorType.placeholder,\n });\n const defaultType = tsc.literalTypeNode({\n literal: tsc.stringLiteral({ text: 'default' }),\n });\n errorsTypeReference = tsc.typeReferenceNode({\n typeArguments: [errorsType, defaultType],\n typeName: 'Omit',\n });\n }\n }\n }\n\n let responsesTypeReference: ts.TypeReferenceNode | undefined = undefined;\n const symbolResponseType = plugin.querySymbol({\n category: 'type',\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n });\n if (symbolResponseType && responses && responses.properties) {\n const keys = Object.keys(responses.properties);\n if (keys.length) {\n const hasDefaultResponse = keys.includes('default');\n if (!hasDefaultResponse) {\n responsesTypeReference = tsc.typeReferenceNode({\n typeName: symbolResponseType.placeholder,\n });\n } else if (keys.length > 1) {\n const responsesType = tsc.typeReferenceNode({\n typeName: symbolResponseType.placeholder,\n });\n const defaultType = tsc.literalTypeNode({\n literal: tsc.stringLiteral({ text: 'default' }),\n });\n responsesTypeReference = tsc.typeReferenceNode({\n typeArguments: [responsesType, defaultType],\n typeName: 'Omit',\n });\n }\n }\n }\n\n const replyTypes = [errorsTypeReference, responsesTypeReference].filter(\n Boolean,\n );\n if (replyTypes.length) {\n properties.push({\n name: 'Reply',\n type: tsc.typeIntersectionNode({\n types: replyTypes,\n }),\n });\n }\n\n if (!properties.length) {\n return;\n }\n\n const symbolRouteHandler = plugin.referenceSymbol({\n category: 'type',\n resource: 'route-handler',\n tool: 'fastify',\n });\n const routeHandler: Property = {\n name: operation.id,\n type: tsc.typeReferenceNode({\n typeArguments: [\n tsc.typeInterfaceNode({\n properties,\n useLegacyResolution: false,\n }),\n ],\n typeName: symbolRouteHandler.placeholder,\n }),\n };\n return routeHandler;\n};\n\nexport const handler: FastifyPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: 'fastify',\n kind: 'type',\n meta: {\n category: 'type',\n resource: 'route-handler',\n tool: 'fastify',\n },\n name: 'RouteHandler',\n });\n\n const symbolRouteHandlers = plugin.registerSymbol({\n exported: true,\n kind: 'type',\n name: 'RouteHandlers',\n });\n\n const routeHandlers: Array<Property> = [];\n\n plugin.forEach(\n 'operation',\n ({ operation }) => {\n const routeHandler = operationToRouteHandler({ operation, plugin });\n if (routeHandler) {\n routeHandlers.push(routeHandler);\n }\n },\n {\n order: 'declarations',\n },\n );\n\n const node = tsc.typeAliasDeclaration({\n exportType: symbolRouteHandlers.exported,\n name: symbolRouteHandlers.placeholder,\n type: tsc.typeInterfaceNode({\n properties: routeHandlers,\n useLegacyResolution: false,\n }),\n });\n plugin.setSymbolValue(symbolRouteHandlers, node);\n};\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { FastifyPlugin } from './types';\n\nexport const defaultConfig: FastifyPlugin['Config'] = {\n api: new Api(),\n config: {\n exportFromIndex: false,\n },\n dependencies: ['@hey-api/typescript'],\n handler,\n name: 'fastify',\n};\n\n/**\n * Type helper for `fastify` plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import { tsc } from '~/tsc';\n\nexport const identifiers = {\n /**\n * {@link https://valibot.dev/api/#actions Actions}\n */\n actions: {\n args: tsc.identifier({ text: 'args' }),\n base64: tsc.identifier({ text: 'base64' }),\n bic: tsc.identifier({ text: 'bic' }),\n brand: tsc.identifier({ text: 'brand' }),\n bytes: tsc.identifier({ text: 'bytes' }),\n check: tsc.identifier({ text: 'check' }),\n checkItems: tsc.identifier({ text: 'checkItems' }),\n creditCard: tsc.identifier({ text: 'creditCard' }),\n cuid2: tsc.identifier({ text: 'cuid2' }),\n decimal: tsc.identifier({ text: 'decimal' }),\n description: tsc.identifier({ text: 'description' }),\n digits: tsc.identifier({ text: 'digits' }),\n email: tsc.identifier({ text: 'email' }),\n emoji: tsc.identifier({ text: 'emoji' }),\n empty: tsc.identifier({ text: 'empty' }),\n endsWith: tsc.identifier({ text: 'endsWith' }),\n entries: tsc.identifier({ text: 'entries' }),\n everyItem: tsc.identifier({ text: 'everyItem' }),\n excludes: tsc.identifier({ text: 'excludes' }),\n filterItems: tsc.identifier({ text: 'filterItems' }),\n findItem: tsc.identifier({ text: 'findItem' }),\n finite: tsc.identifier({ text: 'finite' }),\n flavor: tsc.identifier({ text: 'flavor' }),\n graphemes: tsc.identifier({ text: 'graphemes' }),\n gtValue: tsc.identifier({ text: 'gtValue' }),\n hash: tsc.identifier({ text: 'hash' }),\n hexColor: tsc.identifier({ text: 'hexColor' }),\n hexadecimal: tsc.identifier({ text: 'hexadecimal' }),\n imei: tsc.identifier({ text: 'imei' }),\n includes: tsc.identifier({ text: 'includes' }),\n integer: tsc.identifier({ text: 'integer' }),\n ip: tsc.identifier({ text: 'ip' }),\n ipv4: tsc.identifier({ text: 'ipv4' }),\n ipv6: tsc.identifier({ text: 'ipv6' }),\n isoDate: tsc.identifier({ text: 'isoDate' }),\n isoDateTime: tsc.identifier({ text: 'isoDateTime' }),\n isoTime: tsc.identifier({ text: 'isoTime' }),\n isoTimeSecond: tsc.identifier({ text: 'isoTimeSecond' }),\n isoTimestamp: tsc.identifier({ text: 'isoTimestamp' }),\n isoWeek: tsc.identifier({ text: 'isoWeek' }),\n length: tsc.identifier({ text: 'length' }),\n ltValue: tsc.identifier({ text: 'ltValue' }),\n mac: tsc.identifier({ text: 'mac' }),\n mac48: tsc.identifier({ text: 'mac48' }),\n mac64: tsc.identifier({ text: 'mac64' }),\n mapItems: tsc.identifier({ text: 'mapItems' }),\n maxBytes: tsc.identifier({ text: 'maxBytes' }),\n maxEntries: tsc.identifier({ text: 'maxEntries' }),\n maxGraphemes: tsc.identifier({ text: 'maxGraphemes' }),\n maxLength: tsc.identifier({ text: 'maxLength' }),\n maxSize: tsc.identifier({ text: 'maxSize' }),\n maxValue: tsc.identifier({ text: 'maxValue' }),\n maxWords: tsc.identifier({ text: 'maxWords' }),\n metadata: tsc.identifier({ text: 'metadata' }),\n mimeType: tsc.identifier({ text: 'mimeType' }),\n minBytes: tsc.identifier({ text: 'minBytes' }),\n minEntries: tsc.identifier({ text: 'minEntries' }),\n minGraphemes: tsc.identifier({ text: 'minGraphemes' }),\n minLength: tsc.identifier({ text: 'minLength' }),\n minSize: tsc.identifier({ text: 'minSize' }),\n minValue: tsc.identifier({ text: 'minValue' }),\n minWords: tsc.identifier({ text: 'minWords' }),\n multipleOf: tsc.identifier({ text: 'multipleOf' }),\n nanoid: tsc.identifier({ text: 'nanoid' }),\n nonEmpty: tsc.identifier({ text: 'nonEmpty' }),\n normalize: tsc.identifier({ text: 'normalize' }),\n notBytes: tsc.identifier({ text: 'notBytes' }),\n notEntries: tsc.identifier({ text: 'notEntries' }),\n notGraphemes: tsc.identifier({ text: 'notGraphemes' }),\n notLength: tsc.identifier({ text: 'notLength' }),\n notSize: tsc.identifier({ text: 'notSize' }),\n notValue: tsc.identifier({ text: 'notValue' }),\n notValues: tsc.identifier({ text: 'notValues' }),\n notWords: tsc.identifier({ text: 'notWords' }),\n octal: tsc.identifier({ text: 'octal' }),\n parseJson: tsc.identifier({ text: 'parseJson' }),\n partialCheck: tsc.identifier({ text: 'partialCheck' }),\n rawCheck: tsc.identifier({ text: 'rawCheck' }),\n rawTransform: tsc.identifier({ text: 'rawTransform' }),\n readonly: tsc.identifier({ text: 'readonly' }),\n reduceItems: tsc.identifier({ text: 'reduceItems' }),\n regex: tsc.identifier({ text: 'regex' }),\n returns: tsc.identifier({ text: 'returns' }),\n rfcEmail: tsc.identifier({ text: 'rfcEmail' }),\n safeInteger: tsc.identifier({ text: 'safeInteger' }),\n size: tsc.identifier({ text: 'size' }),\n slug: tsc.identifier({ text: 'slug' }),\n someItem: tsc.identifier({ text: 'someItem' }),\n sortItems: tsc.identifier({ text: 'sortItems' }),\n startsWith: tsc.identifier({ text: 'startsWith' }),\n stringifyJson: tsc.identifier({ text: 'stringifyJson' }),\n title: tsc.identifier({ text: 'title' }),\n toLowerCase: tsc.identifier({ text: 'toLowerCase' }),\n toMaxValue: tsc.identifier({ text: 'toMaxValue' }),\n toMinValue: tsc.identifier({ text: 'toMinValue' }),\n toUpperCase: tsc.identifier({ text: 'toUpperCase' }),\n transform: tsc.identifier({ text: 'transform' }),\n trim: tsc.identifier({ text: 'trim' }),\n trimEnd: tsc.identifier({ text: 'trimEnd' }),\n trimStart: tsc.identifier({ text: 'trimStart' }),\n ulid: tsc.identifier({ text: 'ulid' }),\n url: tsc.identifier({ text: 'url' }),\n uuid: tsc.identifier({ text: 'uuid' }),\n value: tsc.identifier({ text: 'value' }),\n values: tsc.identifier({ text: 'values' }),\n words: tsc.identifier({ text: 'words' }),\n },\n /**\n * {@link https://valibot.dev/api/#async Async}\n */\n async: {\n argsAsync: tsc.identifier({ text: 'argsAsync' }),\n arrayAsync: tsc.identifier({ text: 'arrayAsync' }),\n awaitAsync: tsc.identifier({ text: 'awaitAsync' }),\n checkAsync: tsc.identifier({ text: 'checkAsync' }),\n checkItemsAsync: tsc.identifier({ text: 'checkItemsAsync' }),\n customAsync: tsc.identifier({ text: 'customAsync' }),\n exactOptionalAsync: tsc.identifier({ text: 'exactOptionalAsync' }),\n fallbackAsync: tsc.identifier({ text: 'fallbackAsync' }),\n forwardAsync: tsc.identifier({ text: 'forwardAsync' }),\n getDefaultsAsync: tsc.identifier({ text: 'getDefaultsAsync' }),\n getFallbacksAsync: tsc.identifier({ text: 'getFallbacksAsync' }),\n intersectAsync: tsc.identifier({ text: 'intersectAsync' }),\n lazyAsync: tsc.identifier({ text: 'lazyAsync' }),\n looseObjectAsync: tsc.identifier({ text: 'looseObjectAsync' }),\n looseTupleAsync: tsc.identifier({ text: 'looseTupleAsync' }),\n mapAsync: tsc.identifier({ text: 'mapAsync' }),\n nonNullableAsync: tsc.identifier({ text: 'nonNullableAsync' }),\n nonNullishAsync: tsc.identifier({ text: 'nonNullishAsync' }),\n nonOptionalAsync: tsc.identifier({ text: 'nonOptionalAsync' }),\n nullableAsync: tsc.identifier({ text: 'nullableAsync' }),\n nullishAsync: tsc.identifier({ text: 'nullishAsync' }),\n objectAsync: tsc.identifier({ text: 'objectAsync' }),\n objectWithRestAsync: tsc.identifier({ text: 'objectWithRestAsync' }),\n optionalAsync: tsc.identifier({ text: 'optionalAsync' }),\n parseAsync: tsc.identifier({ text: 'parseAsync' }),\n parserAsync: tsc.identifier({ text: 'parserAsync' }),\n partialAsync: tsc.identifier({ text: 'partialAsync' }),\n partialCheckAsync: tsc.identifier({ text: 'partialCheckAsync' }),\n pipeAsync: tsc.identifier({ text: 'pipeAsync' }),\n rawCheckAsync: tsc.identifier({ text: 'rawCheckAsync' }),\n rawTransformAsync: tsc.identifier({ text: 'rawTransformAsync' }),\n recordAsync: tsc.identifier({ text: 'recordAsync' }),\n requiredAsync: tsc.identifier({ text: 'requiredAsync' }),\n returnsAsync: tsc.identifier({ text: 'returnsAsync' }),\n safeParseAsync: tsc.identifier({ text: 'safeParseAsync' }),\n safeParserAsync: tsc.identifier({ text: 'safeParserAsync' }),\n setAsync: tsc.identifier({ text: 'setAsync' }),\n strictObjectAsync: tsc.identifier({ text: 'strictObjectAsync' }),\n strictTupleAsync: tsc.identifier({ text: 'strictTupleAsync' }),\n transformAsync: tsc.identifier({ text: 'transformAsync' }),\n tupleAsync: tsc.identifier({ text: 'tupleAsync' }),\n tupleWithRestAsync: tsc.identifier({ text: 'tupleWithRestAsync' }),\n undefinedableAsync: tsc.identifier({ text: 'undefinedableAsync' }),\n unionAsync: tsc.identifier({ text: 'unionAsync' }),\n variantAsync: tsc.identifier({ text: 'variantAsync' }),\n },\n /**\n * {@link https://valibot.dev/api/#methods Methods}\n */\n methods: {\n assert: tsc.identifier({ text: 'assert' }),\n config: tsc.identifier({ text: 'config' }),\n fallback: tsc.identifier({ text: 'fallback' }),\n flatten: tsc.identifier({ text: 'flatten' }),\n forward: tsc.identifier({ text: 'forward' }),\n getDefault: tsc.identifier({ text: 'getDefault' }),\n getDefaults: tsc.identifier({ text: 'getDefaults' }),\n getDescription: tsc.identifier({ text: 'getDescription' }),\n getFallback: tsc.identifier({ text: 'getFallback' }),\n getFallbacks: tsc.identifier({ text: 'getFallbacks' }),\n getMetadata: tsc.identifier({ text: 'getMetadata' }),\n getTitle: tsc.identifier({ text: 'getTitle' }),\n is: tsc.identifier({ text: 'is' }),\n keyof: tsc.identifier({ text: 'keyof' }),\n message: tsc.identifier({ text: 'message' }),\n omit: tsc.identifier({ text: 'omit' }),\n parse: tsc.identifier({ text: 'parse' }),\n parser: tsc.identifier({ text: 'parser' }),\n partial: tsc.identifier({ text: 'partial' }),\n pick: tsc.identifier({ text: 'pick' }),\n pipe: tsc.identifier({ text: 'pipe' }),\n required: tsc.identifier({ text: 'required' }),\n safeParse: tsc.identifier({ text: 'safeParse' }),\n safeParser: tsc.identifier({ text: 'safeParser' }),\n summarize: tsc.identifier({ text: 'summarize' }),\n unwrap: tsc.identifier({ text: 'unwrap' }),\n },\n /**\n * {@link https://valibot.dev/api/#schemas Schemas}\n */\n schemas: {\n any: tsc.identifier({ text: 'any' }),\n array: tsc.identifier({ text: 'array' }),\n bigInt: tsc.identifier({ text: 'bigint' }),\n blob: tsc.identifier({ text: 'blob' }),\n boolean: tsc.identifier({ text: 'boolean' }),\n custom: tsc.identifier({ text: 'custom' }),\n date: tsc.identifier({ text: 'date' }),\n enum: tsc.identifier({ text: 'enum' }),\n exactOptional: tsc.identifier({ text: 'exactOptional' }),\n file: tsc.identifier({ text: 'file' }),\n function: tsc.identifier({ text: 'function' }),\n instance: tsc.identifier({ text: 'instance' }),\n intersect: tsc.identifier({ text: 'intersect' }),\n lazy: tsc.identifier({ text: 'lazy' }),\n literal: tsc.identifier({ text: 'literal' }),\n looseObject: tsc.identifier({ text: 'looseObject' }),\n looseTuple: tsc.identifier({ text: 'looseTuple' }),\n map: tsc.identifier({ text: 'map' }),\n nan: tsc.identifier({ text: 'nan' }),\n never: tsc.identifier({ text: 'never' }),\n nonNullable: tsc.identifier({ text: 'nonNullable' }),\n nonNullish: tsc.identifier({ text: 'nonNullish' }),\n nonOptional: tsc.identifier({ text: 'nonOptional' }),\n null: tsc.identifier({ text: 'null' }),\n nullable: tsc.identifier({ text: 'nullable' }),\n nullish: tsc.identifier({ text: 'nullish' }),\n number: tsc.identifier({ text: 'number' }),\n object: tsc.identifier({ text: 'object' }),\n objectWithRest: tsc.identifier({ text: 'objectWithRest' }),\n optional: tsc.identifier({ text: 'optional' }),\n picklist: tsc.identifier({ text: 'picklist' }),\n promise: tsc.identifier({ text: 'promise' }),\n record: tsc.identifier({ text: 'record' }),\n set: tsc.identifier({ text: 'set' }),\n strictObject: tsc.identifier({ text: 'strictObject' }),\n strictTuple: tsc.identifier({ text: 'strictTuple' }),\n string: tsc.identifier({ text: 'string' }),\n symbol: tsc.identifier({ text: 'symbol' }),\n tuple: tsc.identifier({ text: 'tuple' }),\n tupleWithRest: tsc.identifier({ text: 'tupleWithRest' }),\n undefined: tsc.identifier({ text: 'undefined' }),\n undefinedable: tsc.identifier({ text: 'undefinedable' }),\n union: tsc.identifier({ text: 'union' }),\n unknown: tsc.identifier({ text: 'unknown' }),\n variant: tsc.identifier({ text: 'variant' }),\n void: tsc.identifier({ text: 'void' }),\n },\n /**\n * {@link https://valibot.dev/api/#storages Storages}\n */\n storages: {\n // TODO: implement if necessary\n },\n /**\n * {@link https://valibot.dev/api/#types Types}\n */\n types: {\n // TODO: implement if necessary\n GenericSchema: tsc.identifier({ text: 'GenericSchema' }),\n },\n /**\n * {@link https://valibot.dev/api/#utils Utils}\n */\n utils: {\n // TODO: implement if necessary\n },\n};\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\nimport type { ValidatorArgs } from '../shared/types';\nimport { identifiers } from './constants';\n\nexport const createRequestValidatorV1 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'valibot',\n });\n if (!symbol) return;\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.async.parseAsync,\n }),\n parameters: [\n tsc.identifier({ text: symbol.placeholder }),\n tsc.identifier({ text: dataParameterName }),\n ],\n }),\n }),\n }),\n ],\n });\n};\n\nexport const createResponseValidatorV1 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tool: 'valibot',\n });\n if (!symbol) return;\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.async.parseAsync,\n }),\n parameters: [\n tsc.identifier({ text: symbol.placeholder }),\n tsc.identifier({ text: dataParameterName }),\n ],\n }),\n }),\n }),\n ],\n });\n};\n","import type ts from 'typescript';\n\nimport type { ValidatorArgs } from './shared/types';\nimport { createRequestValidatorV1, createResponseValidatorV1 } from './v1/api';\n\nexport type IApi = {\n createRequestValidator: (args: ValidatorArgs) => ts.ArrowFunction | undefined;\n createResponseValidator: (\n args: ValidatorArgs,\n ) => ts.ArrowFunction | undefined;\n};\n\nexport class Api implements IApi {\n createRequestValidator(args: ValidatorArgs): ts.ArrowFunction | undefined {\n return createRequestValidatorV1(args);\n }\n\n createResponseValidator(args: ValidatorArgs): ts.ArrowFunction | undefined {\n return createResponseValidatorV1(args);\n }\n}\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\nimport type { ValibotPlugin } from '../types';\nimport { identifiers } from '../v1/constants';\n\nexport const pipesToAst = ({\n pipes,\n plugin,\n}: {\n pipes: Array<ts.Expression>;\n plugin: ValibotPlugin['Instance'];\n}): ts.Expression => {\n if (pipes.length === 1) {\n return pipes[0]!;\n }\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.methods.pipe,\n }),\n parameters: pipes,\n });\n return expression;\n};\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { createSchemaComment } from '~/plugins/shared/utils/schema';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../v1/constants';\nimport { pipesToAst } from './pipesToAst';\nimport type { Ast, IrSchemaToAstOptions } from './types';\n\nexport const exportAst = ({\n ast,\n plugin,\n schema,\n state,\n symbol,\n}: IrSchemaToAstOptions & {\n ast: Ast;\n schema: IR.SchemaObject;\n symbol: Symbol;\n}): void => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createSchemaComment({ schema })\n : undefined,\n exportConst: symbol.exported,\n expression: pipesToAst({ pipes: ast.pipes, plugin }),\n name: symbol.placeholder,\n typeName: state.hasLazyExpression.value\n ? (tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: ast.typeName || identifiers.types.GenericSchema.text,\n }) as unknown as ts.TypeNode)\n : undefined,\n });\n plugin.setSymbolValue(symbol, statement);\n};\n","import { tsc } from '~/tsc';\n\nexport const INTEGER_FORMATS = {\n int16: {\n max: 32767,\n maxError: 'Invalid value: Expected int16 to be <= 2^15-1',\n min: -32768,\n minError: 'Invalid value: Expected int16 to be >= -2^15',\n needsBigInt: false,\n },\n int32: {\n max: 2147483647,\n maxError: 'Invalid value: Expected int32 to be <= 2^31-1',\n min: -2147483648,\n minError: 'Invalid value: Expected int32 to be >= -2^31',\n needsBigInt: false,\n },\n int64: {\n max: '9223372036854775807',\n maxError: 'Invalid value: Expected int64 to be <= 2^63-1',\n min: '-9223372036854775808',\n minError: 'Invalid value: Expected int64 to be >= -2^63',\n needsBigInt: true,\n },\n int8: {\n max: 127,\n maxError: 'Invalid value: Expected int8 to be <= 2^7-1',\n min: -128,\n minError: 'Invalid value: Expected int8 to be >= -2^7',\n needsBigInt: false,\n },\n uint16: {\n max: 65535,\n maxError: 'Invalid value: Expected uint16 to be <= 2^16-1',\n min: 0,\n minError: 'Invalid value: Expected uint16 to be >= 0',\n needsBigInt: false,\n },\n uint32: {\n max: 4294967295,\n maxError: 'Invalid value: Expected uint32 to be <= 2^32-1',\n min: 0,\n minError: 'Invalid value: Expected uint32 to be >= 0',\n needsBigInt: false,\n },\n uint64: {\n max: '18446744073709551615',\n maxError: 'Invalid value: Expected uint64 to be <= 2^64-1',\n min: '0',\n minError: 'Invalid value: Expected uint64 to be >= 0',\n needsBigInt: true,\n },\n uint8: {\n max: 255,\n maxError: 'Invalid value: Expected uint8 to be <= 2^8-1',\n min: 0,\n minError: 'Invalid value: Expected uint8 to be >= 0',\n needsBigInt: false,\n },\n} as const;\n\nexport type IntegerFormat = keyof typeof INTEGER_FORMATS;\n\nexport const isIntegerFormat = (\n format: string | undefined,\n): format is IntegerFormat => format !== undefined && format in INTEGER_FORMATS;\n\nexport const needsBigIntForFormat = (format: string | undefined): boolean =>\n isIntegerFormat(format) && INTEGER_FORMATS[format].needsBigInt;\n\nexport const numberParameter = ({\n isBigInt,\n value,\n}: {\n isBigInt: boolean;\n value: unknown;\n}) => {\n const expression = tsc.valueToExpression({ value });\n\n if (\n isBigInt &&\n (typeof value === 'bigint' ||\n typeof value === 'number' ||\n typeof value === 'string' ||\n typeof value === 'boolean')\n ) {\n return tsc.callExpression({\n functionName: 'BigInt',\n parameters: [expression],\n });\n }\n\n return expression;\n};\n","import { operationResponsesMap } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\n\nimport { exportAst } from './export';\nimport type { Ast, IrSchemaToAstOptions } from './types';\n\nexport const irOperationToAst = ({\n getAst,\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n getAst: (\n schema: IR.SchemaObject,\n path: ReadonlyArray<string | number>,\n ) => Ast;\n operation: IR.OperationObject;\n}) => {\n if (plugin.config.requests.enabled) {\n const requiredProperties = new Set<string>();\n\n const schemaData: IR.SchemaObject = {\n properties: {\n body: {\n type: 'never',\n },\n path: {\n type: 'never',\n },\n query: {\n type: 'never',\n },\n },\n type: 'object',\n };\n\n if (operation.parameters) {\n // TODO: add support for cookies\n\n if (operation.parameters.header) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.header) {\n const parameter = operation.parameters.header[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('headers');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.headers = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.path) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.path) {\n const parameter = operation.parameters.path[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('path');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.path = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.query) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.query) {\n const parameter = operation.parameters.query[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('query');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.query = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n }\n\n if (operation.body) {\n schemaData.properties!.body = operation.body.schema;\n\n if (operation.body.required) {\n requiredProperties.add('body');\n }\n }\n\n schemaData.required = [...requiredProperties];\n\n const ast = getAst(schemaData, state.path.value);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'valibot',\n },\n name: buildName({\n config: plugin.config.requests,\n name: operation.id,\n }),\n });\n exportAst({\n ast,\n plugin,\n schema: schemaData,\n state,\n symbol,\n });\n }\n\n if (plugin.config.responses.enabled) {\n if (operation.responses) {\n const { response } = operationResponsesMap(operation);\n\n if (response) {\n const path = [...state.path.value, 'responses'];\n const ast = getAst(response, path);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path,\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tags: state.tags?.value,\n tool: 'valibot',\n },\n name: buildName({\n config: plugin.config.responses,\n name: operation.id,\n }),\n });\n exportAst({\n ast,\n plugin,\n schema: response,\n state,\n symbol,\n });\n }\n }\n }\n};\n","import type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\n\nimport { exportAst } from './export';\nimport type { Ast, IrSchemaToAstOptions } from './types';\n\nexport const irWebhookToAst = ({\n getAst,\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n getAst: (\n schema: IR.SchemaObject,\n path: ReadonlyArray<string | number>,\n ) => Ast;\n operation: IR.OperationObject;\n}) => {\n if (plugin.config.webhooks.enabled) {\n const requiredProperties = new Set<string>();\n\n const schemaData: IR.SchemaObject = {\n properties: {\n body: {\n type: 'never',\n },\n path: {\n type: 'never',\n },\n query: {\n type: 'never',\n },\n },\n type: 'object',\n };\n\n if (operation.parameters) {\n // TODO: add support for cookies\n\n if (operation.parameters.header) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.header) {\n const parameter = operation.parameters.header[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('headers');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.headers = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.path) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.path) {\n const parameter = operation.parameters.path[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('path');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.path = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.query) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.query) {\n const parameter = operation.parameters.query[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('query');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.query = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n }\n\n if (operation.body) {\n schemaData.properties!.body = operation.body.schema;\n\n if (operation.body.required) {\n requiredProperties.add('body');\n }\n }\n\n schemaData.required = [...requiredProperties];\n\n const ast = getAst(schemaData, state.path.value);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'webhook',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'valibot',\n },\n name: buildName({\n config: plugin.config.webhooks,\n name: operation.id,\n }),\n });\n exportAst({\n ast,\n plugin,\n schema: schemaData,\n state,\n symbol,\n });\n }\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const unknownToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'unknown'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.unknown,\n }),\n });\n return expression;\n};\n","import { deduplicateSchema } from '~/ir/schema';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { pipesToAst } from '../../shared/pipesToAst';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\nimport { irSchemaToAst } from '../plugin';\nimport { unknownToAst } from './unknown';\n\nexport const arrayToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'array'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Omit<Ast, 'typeName'> = {\n pipes: [],\n };\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n const functionName = tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.array,\n });\n\n if (!schema.items) {\n const expression = tsc.callExpression({\n functionName,\n parameters: [\n unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n }),\n ],\n });\n result.pipes.push(expression);\n } else {\n schema = deduplicateSchema({ schema });\n\n // at least one item is guaranteed\n const itemExpressions = schema.items!.map((item, index) => {\n const itemAst = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n if (itemAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n return pipesToAst({ pipes: itemAst.pipes, plugin });\n });\n\n if (itemExpressions.length === 1) {\n const expression = tsc.callExpression({\n functionName,\n parameters: itemExpressions,\n });\n result.pipes.push(expression);\n } else {\n if (schema.logicalOperator === 'and') {\n // TODO: parser - handle intersection\n // return tsc.typeArrayNode(\n // tsc.typeIntersectionNode({ types: itemExpressions }),\n // );\n }\n\n // TODO: parser - handle union\n // return tsc.typeArrayNode(tsc.typeUnionNode({ types: itemExpressions }));\n\n const expression = tsc.callExpression({\n functionName,\n parameters: [\n unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n }),\n ],\n });\n result.pipes.push(expression);\n }\n }\n\n if (schema.minItems === schema.maxItems && schema.minItems !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n });\n result.pipes.push(expression);\n } else {\n if (schema.minItems !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.minLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n });\n result.pipes.push(expression);\n }\n\n if (schema.maxItems !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.maxLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxItems })],\n });\n result.pipes.push(expression);\n }\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const booleanToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'boolean'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n if (typeof schema.const === 'boolean') {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.literal,\n }),\n parameters: [tsc.ots.boolean(schema.const)],\n });\n return expression;\n }\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.boolean,\n }),\n });\n return expression;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\nimport { unknownToAst } from './unknown';\n\nexport const enumToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'enum'>;\n}): ts.CallExpression => {\n const enumMembers: Array<ts.LiteralExpression> = [];\n\n let isNullable = false;\n\n for (const item of schema.items ?? []) {\n // Zod supports only string enums\n if (item.type === 'string' && typeof item.const === 'string') {\n enumMembers.push(\n tsc.stringLiteral({\n text: item.const,\n }),\n );\n } else if (item.type === 'null' || item.const === null) {\n isNullable = true;\n }\n }\n\n if (!enumMembers.length) {\n return unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n }\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n let resultExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.picklist,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: enumMembers,\n multiLine: false,\n }),\n ],\n });\n\n if (isNullable) {\n resultExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.nullable,\n }),\n parameters: [resultExpression],\n });\n }\n\n return resultExpression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const neverToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'never'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.never,\n }),\n });\n return expression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const nullToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'null'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.null,\n }),\n });\n return expression;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport {\n INTEGER_FORMATS,\n isIntegerFormat,\n needsBigIntForFormat,\n numberParameter,\n} from '../../shared/numbers';\nimport { pipesToAst } from '../../shared/pipesToAst';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const numberToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'integer' | 'number'>;\n}) => {\n const format = schema.format;\n const isInteger = schema.type === 'integer';\n const isBigInt = needsBigIntForFormat(format);\n const formatInfo = isIntegerFormat(format) ? INTEGER_FORMATS[format] : null;\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n // Return early if const is defined since we can create a literal type directly without additional validation\n if (schema.const !== undefined && schema.const !== null) {\n const constValue = schema.const;\n let literalValue;\n\n // Case 1: Number with no format -> generate literal with the number\n if (typeof constValue === 'number' && !format) {\n literalValue = tsc.ots.number(constValue);\n }\n // Case 2: Number with format -> check if format needs BigInt, generate appropriate literal\n else if (typeof constValue === 'number' && format) {\n if (isBigInt) {\n // Format requires BigInt, convert number to BigInt\n literalValue = tsc.callExpression({\n functionName: 'BigInt',\n parameters: [tsc.ots.string(constValue.toString())],\n });\n } else {\n // Regular format, use number as-is\n literalValue = tsc.ots.number(constValue);\n }\n }\n // Case 3: Format that allows string -> generate BigInt literal (for int64/uint64 formats)\n else if (typeof constValue === 'string' && isBigInt) {\n // Remove 'n' suffix if present in string\n const cleanString = constValue.endsWith('n')\n ? constValue.slice(0, -1)\n : constValue;\n literalValue = tsc.callExpression({\n functionName: 'BigInt',\n parameters: [tsc.ots.string(cleanString)],\n });\n }\n // Case 4: Const is typeof bigint (literal) -> transform from literal to BigInt()\n else if (typeof constValue === 'bigint') {\n // Convert BigInt to string and remove 'n' suffix that toString() adds\n const bigintString = constValue.toString();\n const cleanString = bigintString.endsWith('n')\n ? bigintString.slice(0, -1)\n : bigintString;\n literalValue = tsc.callExpression({\n functionName: 'BigInt',\n parameters: [tsc.ots.string(cleanString)],\n });\n }\n // Default case: use value as-is for other types\n else {\n literalValue = tsc.valueToExpression({ value: constValue });\n }\n\n return tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.literal,\n }),\n parameters: [literalValue],\n });\n }\n\n const pipes: Array<ts.CallExpression> = [];\n\n // For bigint formats (int64, uint64), create union of number, string, and bigint with transform\n if (isBigInt) {\n const unionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.number,\n }),\n }),\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.string,\n }),\n }),\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.bigInt,\n }),\n }),\n ],\n multiLine: false,\n }),\n ],\n });\n pipes.push(unionExpression);\n\n // Add transform to convert to BigInt\n const transformExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.transform,\n }),\n parameters: [\n tsc.arrowFunction({\n parameters: [{ name: 'x' }],\n statements: tsc.callExpression({\n functionName: 'BigInt',\n parameters: [tsc.identifier({ text: 'x' })],\n }),\n }),\n ],\n });\n pipes.push(transformExpression);\n } else {\n // For regular number formats, use number schema\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.number,\n }),\n });\n pipes.push(expression);\n }\n\n // Add integer validation for integer types (except when using bigint union)\n if (!isBigInt && isInteger) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.integer,\n }),\n });\n pipes.push(expression);\n }\n\n // Add format-specific range validations\n if (formatInfo) {\n const minValue = formatInfo.min;\n const maxValue = formatInfo.max;\n const minErrorMessage = formatInfo.minError;\n const maxErrorMessage = formatInfo.maxError;\n\n // Add minimum value validation\n const minExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.minValue,\n }),\n parameters: [\n isBigInt\n ? tsc.callExpression({\n functionName: 'BigInt',\n parameters: [tsc.ots.string(minValue.toString())],\n })\n : tsc.ots.number(minValue as number),\n tsc.ots.string(minErrorMessage),\n ],\n });\n pipes.push(minExpression);\n\n // Add maximum value validation\n const maxExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.maxValue,\n }),\n parameters: [\n isBigInt\n ? tsc.callExpression({\n functionName: 'BigInt',\n parameters: [tsc.ots.string(maxValue.toString())],\n })\n : tsc.ots.number(maxValue as number),\n tsc.ots.string(maxErrorMessage),\n ],\n });\n pipes.push(maxExpression);\n }\n\n if (schema.exclusiveMinimum !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.gtValue,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMinimum }),\n ],\n });\n pipes.push(expression);\n } else if (schema.minimum !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.minValue,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.minimum })],\n });\n pipes.push(expression);\n }\n\n if (schema.exclusiveMaximum !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.ltValue,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMaximum }),\n ],\n });\n pipes.push(expression);\n } else if (schema.maximum !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.maxValue,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.maximum })],\n });\n pipes.push(expression);\n }\n\n return pipesToAst({ pipes, plugin });\n};\n","import ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { numberRegExp } from '~/utils/regexp';\n\nimport { pipesToAst } from '../../shared/pipesToAst';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\nimport { irSchemaToAst } from '../plugin';\n\nexport const objectToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'object'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n // TODO: parser - handle constants\n const properties: Array<ts.PropertyAssignment> = [];\n\n const required = schema.required ?? [];\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const isRequired = required.includes(name);\n\n const propertyAst = irSchemaToAst({\n optional: !isRequired,\n plugin,\n schema: property,\n state: {\n ...state,\n path: toRef([...state.path.value, 'properties', name]),\n },\n });\n if (propertyAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n numberRegExp.lastIndex = 0;\n let propertyName;\n if (numberRegExp.test(name)) {\n // For numeric literals, we'll handle negative numbers by using a string literal\n // instead of trying to use a PrefixUnaryExpression\n propertyName = name.startsWith('-')\n ? ts.factory.createStringLiteral(name)\n : ts.factory.createNumericLiteral(name);\n } else {\n propertyName = name;\n }\n // TODO: parser - abstract safe property name logic\n if (\n ((name.match(/^[0-9]/) && name.match(/\\D+/g)) || name.match(/\\W/g)) &&\n !name.startsWith(\"'\") &&\n !name.endsWith(\"'\")\n ) {\n propertyName = `'${name}'`;\n }\n properties.push(\n tsc.propertyAssignment({\n initializer: pipesToAst({ pipes: propertyAst.pipes, plugin }),\n name: propertyName,\n }),\n );\n }\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n // Handle additionalProperties with a schema (not just true/false)\n // This supports objects with dynamic keys (e.g., Record<string, T>)\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === 'object' &&\n schema.additionalProperties.type !== undefined\n ) {\n const additionalAst = irSchemaToAst({\n plugin,\n schema: schema.additionalProperties,\n state: {\n ...state,\n path: toRef([...state.path.value, 'additionalProperties']),\n },\n });\n if (additionalAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n // If there are no named properties, use v.record() directly\n if (!Object.keys(properties).length) {\n result.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.record,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.string,\n }),\n parameters: [],\n }),\n pipesToAst({ pipes: additionalAst.pipes, plugin }),\n ],\n }),\n ];\n return result as Omit<Ast, 'typeName'>;\n }\n\n // If there are named properties, use v.objectWithRest() to validate both\n // The rest parameter is the schema for each additional property value\n result.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.objectWithRest,\n }),\n parameters: [\n ts.factory.createObjectLiteralExpression(properties, true),\n pipesToAst({ pipes: additionalAst.pipes, plugin }),\n ],\n }),\n ];\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.object,\n }),\n parameters: [ts.factory.createObjectLiteralExpression(properties, true)],\n }),\n ];\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { pipesToAst } from '../../shared/pipesToAst';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const stringToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'string'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n if (typeof schema.const === 'string') {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.literal,\n }),\n parameters: [tsc.ots.string(schema.const)],\n });\n return expression;\n }\n\n const pipes: Array<ts.CallExpression> = [];\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.string,\n }),\n });\n pipes.push(expression);\n\n if (schema.format) {\n switch (schema.format) {\n case 'date':\n pipes.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.isoDate,\n }),\n }),\n );\n break;\n case 'date-time':\n pipes.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.isoTimestamp,\n }),\n }),\n );\n break;\n case 'ipv4':\n case 'ipv6':\n pipes.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.ip,\n }),\n }),\n );\n break;\n case 'time':\n pipes.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.isoTimeSecond,\n }),\n }),\n );\n break;\n case 'uri':\n pipes.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.url,\n }),\n }),\n );\n break;\n case 'email':\n case 'uuid':\n pipes.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: tsc.identifier({ text: schema.format }),\n }),\n }),\n );\n break;\n }\n }\n\n if (schema.minLength === schema.maxLength && schema.minLength !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n });\n pipes.push(expression);\n } else {\n if (schema.minLength !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.minLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n });\n pipes.push(expression);\n }\n\n if (schema.maxLength !== undefined) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.maxLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxLength })],\n });\n pipes.push(expression);\n }\n }\n\n if (schema.pattern) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.regex,\n }),\n parameters: [tsc.regularExpressionLiteral({ text: schema.pattern })],\n });\n pipes.push(expression);\n }\n\n return pipesToAst({ pipes, plugin });\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { pipesToAst } from '../../shared/pipesToAst';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\nimport { irSchemaToAst } from '../plugin';\nimport { unknownToAst } from './unknown';\n\nexport const tupleToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'tuple'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n if (schema.const && Array.isArray(schema.const)) {\n const tupleElements = schema.const.map((value) =>\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.literal,\n }),\n parameters: [tsc.valueToExpression({ value })],\n }),\n );\n result.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n }),\n ];\n return result as Omit<Ast, 'typeName'>;\n }\n\n if (schema.items) {\n const tupleElements = schema.items.map((item, index) => {\n const schemaPipes = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n if (schemaPipes.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n return pipesToAst({ pipes: schemaPipes.pipes, plugin });\n });\n result.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n }),\n ];\n return result as Omit<Ast, 'typeName'>;\n }\n\n return {\n pipes: [\n unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n }),\n ],\n };\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const undefinedToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'undefined'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.undefined,\n }),\n });\n return expression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { identifiers } from '../constants';\n\nexport const voidToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'void'>;\n}) => {\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.void,\n }),\n });\n return expression;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\n\nimport { pipesToAst } from '../../shared/pipesToAst';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { arrayToAst } from './array';\nimport { booleanToAst } from './boolean';\nimport { enumToAst } from './enum';\nimport { neverToAst } from './never';\nimport { nullToAst } from './null';\nimport { numberToAst } from './number';\nimport { objectToAst } from './object';\nimport { stringToAst } from './string';\nimport { tupleToAst } from './tuple';\nimport { undefinedToAst } from './undefined';\nimport { unknownToAst } from './unknown';\nimport { voidToAst } from './void';\n\nexport const irSchemaWithTypeToAst = ({\n schema,\n ...args\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType;\n}): {\n anyType?: string;\n expression: ts.Expression;\n} => {\n switch (schema.type) {\n case 'array':\n return {\n expression: pipesToAst({\n pipes: arrayToAst({\n ...args,\n schema: schema as SchemaWithType<'array'>,\n }).pipes,\n plugin: args.plugin,\n }),\n };\n case 'boolean':\n return {\n expression: booleanToAst({\n ...args,\n schema: schema as SchemaWithType<'boolean'>,\n }),\n };\n case 'enum':\n return {\n expression: enumToAst({\n ...args,\n schema: schema as SchemaWithType<'enum'>,\n }),\n };\n case 'integer':\n case 'number':\n return {\n expression: numberToAst({\n ...args,\n schema: schema as SchemaWithType<'integer' | 'number'>,\n }),\n };\n case 'never':\n return {\n expression: neverToAst({\n ...args,\n schema: schema as SchemaWithType<'never'>,\n }),\n };\n case 'null':\n return {\n expression: nullToAst({\n ...args,\n schema: schema as SchemaWithType<'null'>,\n }),\n };\n case 'object':\n return {\n expression: pipesToAst({\n pipes: objectToAst({\n ...args,\n schema: schema as SchemaWithType<'object'>,\n }).pipes,\n plugin: args.plugin,\n }),\n };\n case 'string':\n // For string schemas with int64/uint64 formats, use number handler to generate union with transform\n if (schema.format === 'int64' || schema.format === 'uint64') {\n return {\n expression: numberToAst({\n ...args,\n schema: schema as SchemaWithType<'integer' | 'number'>,\n }),\n };\n }\n return {\n expression: stringToAst({\n ...args,\n schema: schema as SchemaWithType<'string'>,\n }),\n };\n case 'tuple':\n return {\n expression: pipesToAst({\n pipes: tupleToAst({\n ...args,\n schema: schema as SchemaWithType<'tuple'>,\n }).pipes,\n plugin: args.plugin,\n }),\n };\n case 'undefined':\n return {\n expression: undefinedToAst({\n ...args,\n schema: schema as SchemaWithType<'undefined'>,\n }),\n };\n case 'unknown':\n return {\n expression: unknownToAst({\n ...args,\n schema: schema as SchemaWithType<'unknown'>,\n }),\n };\n case 'void':\n return {\n expression: voidToAst({\n ...args,\n schema: schema as SchemaWithType<'void'>,\n }),\n };\n }\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef, toRefs } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { pathToJsonPointer, refToName } from '~/utils/ref';\n\nimport { exportAst } from '../shared/export';\nimport { numberParameter } from '../shared/numbers';\nimport { irOperationToAst } from '../shared/operation';\nimport { pipesToAst } from '../shared/pipesToAst';\nimport type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types';\nimport { irWebhookToAst } from '../shared/webhook';\nimport type { ValibotPlugin } from '../types';\nimport { identifiers } from './constants';\nimport { irSchemaWithTypeToAst } from './toAst';\n\nexport const irSchemaToAst = ({\n optional,\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n /**\n * Accept `optional` to handle optional object properties. We can't handle\n * this inside the object function because `.optional()` must come before\n * `.default()` which is handled in this function.\n */\n optional?: boolean;\n schema: IR.SchemaObject;\n}): Ast => {\n const ast: Ast = {\n pipes: [],\n };\n\n const v = plugin.referenceSymbol({\n category: 'external',\n resource: 'valibot.v',\n });\n\n if (schema.$ref) {\n const query: SymbolMeta = {\n category: 'schema',\n resource: 'definition',\n resourceId: schema.$ref,\n tool: 'valibot',\n };\n const refSymbol = plugin.referenceSymbol(query);\n if (plugin.isSymbolRegistered(query)) {\n const ref = tsc.identifier({ text: refSymbol.placeholder });\n ast.pipes.push(ref);\n } else {\n const lazyExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n statements: [\n tsc.returnStatement({\n expression: tsc.identifier({ text: refSymbol.placeholder }),\n }),\n ],\n }),\n ],\n });\n ast.pipes.push(lazyExpression);\n state.hasLazyExpression.value = true;\n }\n } else if (schema.type) {\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: schema as SchemaWithType,\n state,\n });\n ast.typeName = typeAst.anyType;\n ast.pipes.push(typeAst.expression);\n\n if (plugin.config.metadata && schema.description) {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.metadata,\n }),\n parameters: [\n tsc.objectExpression({\n obj: [\n {\n key: 'description',\n value: tsc.stringLiteral({ text: schema.description }),\n },\n ],\n }),\n ],\n });\n ast.pipes.push(expression);\n }\n } else if (schema.items) {\n schema = deduplicateSchema({ schema });\n\n if (schema.items) {\n const itemsAst = schema.items.map((item, index) => {\n const itemAst = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n return pipesToAst({ pipes: itemAst.pipes, plugin });\n });\n\n if (schema.logicalOperator === 'and') {\n const intersectExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.intersect,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemsAst,\n }),\n ],\n });\n ast.pipes.push(intersectExpression);\n } else {\n const unionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemsAst,\n }),\n ],\n });\n ast.pipes.push(unionExpression);\n }\n } else {\n const schemaPipes = irSchemaToAst({ plugin, schema, state });\n ast.pipes.push(...schemaPipes.pipes);\n }\n } else {\n // catch-all fallback for failed schemas\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n ast.typeName = typeAst.anyType;\n ast.pipes.push(typeAst.expression);\n }\n\n if (ast.pipes.length) {\n if (schema.accessScope === 'read') {\n const readonlyExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.actions.readonly,\n }),\n });\n ast.pipes.push(readonlyExpression);\n }\n\n let callParameter: ts.Expression | undefined;\n\n if (schema.default !== undefined) {\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n callParameter = numberParameter({ isBigInt, value: schema.default });\n if (callParameter) {\n ast.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.optional,\n }),\n parameters: [\n pipesToAst({ pipes: ast.pipes, plugin }),\n callParameter,\n ],\n }),\n ];\n }\n }\n\n if (optional && !callParameter) {\n ast.pipes = [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: v.placeholder,\n name: identifiers.schemas.optional,\n }),\n parameters: [pipesToAst({ pipes: ast.pipes, plugin })],\n }),\n ];\n }\n }\n\n return ast as Ast;\n};\n\nconst handleComponent = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}): void => {\n const $ref = pathToJsonPointer(state.path.value);\n const ast = irSchemaToAst({ plugin, schema, state });\n const baseName = refToName($ref);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'valibot',\n },\n name: buildName({\n config: plugin.config.definitions,\n name: baseName,\n }),\n });\n exportAst({\n ast,\n plugin,\n schema,\n state,\n symbol,\n });\n};\n\nexport const handlerV1: ValibotPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: 'valibot',\n importKind: 'namespace',\n meta: {\n category: 'external',\n resource: 'valibot.v',\n },\n name: 'v',\n });\n\n plugin.forEach(\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'webhook',\n (event) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path: event._path,\n tags: event.tags,\n });\n switch (event.type) {\n case 'operation':\n irOperationToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n case 'parameter':\n handleComponent({\n plugin,\n schema: event.parameter.schema,\n state,\n });\n break;\n case 'requestBody':\n handleComponent({\n plugin,\n schema: event.requestBody.schema,\n state,\n });\n break;\n case 'schema':\n handleComponent({\n plugin,\n schema: event.schema,\n state,\n });\n break;\n case 'webhook':\n irWebhookToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n }\n },\n );\n};\n","import type { ValibotPlugin } from './types';\nimport { handlerV1 } from './v1/plugin';\n\nexport const handler: ValibotPlugin['Handler'] = (args) => handlerV1(args);\n","import { definePluginConfig } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { ValibotPlugin } from './types';\n\nexport const defaultConfig: ValibotPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n metadata: false,\n },\n handler,\n name: 'valibot',\n resolveConfig: (plugin, context) => {\n plugin.config.definitions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'v{{name}}',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.definitions,\n });\n\n plugin.config.requests = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'v{{name}}Data',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.requests,\n });\n\n plugin.config.responses = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'v{{name}}Response',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.responses,\n });\n\n plugin.config.webhooks = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'v{{name}}WebhookRequest',\n },\n mappers: {\n boolean: (enabled) => ({ enabled }),\n function: (name) => ({ name }),\n string: (name) => ({ name }),\n },\n value: plugin.config.webhooks,\n });\n },\n tags: ['validator'],\n};\n\n/**\n * Type helper for Valibot plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import { tsc } from '~/tsc';\n\n// TODO: this is inaccurate, it combines identifiers for all supported versions\nexport const identifiers = {\n ZodMiniOptional: tsc.identifier({ text: 'ZodMiniOptional' }),\n ZodOptional: tsc.identifier({ text: 'ZodOptional' }),\n _default: tsc.identifier({ text: '_default' }),\n and: tsc.identifier({ text: 'and' }),\n array: tsc.identifier({ text: 'array' }),\n bigint: tsc.identifier({ text: 'bigint' }),\n boolean: tsc.identifier({ text: 'boolean' }),\n check: tsc.identifier({ text: 'check' }),\n coerce: tsc.identifier({ text: 'coerce' }),\n date: tsc.identifier({ text: 'date' }),\n datetime: tsc.identifier({ text: 'datetime' }),\n default: tsc.identifier({ text: 'default' }),\n describe: tsc.identifier({ text: 'describe' }),\n email: tsc.identifier({ text: 'email' }),\n enum: tsc.identifier({ text: 'enum' }),\n globalRegistry: tsc.identifier({ text: 'globalRegistry' }),\n gt: tsc.identifier({ text: 'gt' }),\n gte: tsc.identifier({ text: 'gte' }),\n infer: tsc.identifier({ text: 'infer' }),\n int: tsc.identifier({ text: 'int' }),\n intersection: tsc.identifier({ text: 'intersection' }),\n ip: tsc.identifier({ text: 'ip' }),\n ipv4: tsc.identifier({ text: 'ipv4' }),\n ipv6: tsc.identifier({ text: 'ipv6' }),\n iso: tsc.identifier({ text: 'iso' }),\n lazy: tsc.identifier({ text: 'lazy' }),\n length: tsc.identifier({ text: 'length' }),\n literal: tsc.identifier({ text: 'literal' }),\n lt: tsc.identifier({ text: 'lt' }),\n lte: tsc.identifier({ text: 'lte' }),\n max: tsc.identifier({ text: 'max' }),\n maxLength: tsc.identifier({ text: 'maxLength' }),\n min: tsc.identifier({ text: 'min' }),\n minLength: tsc.identifier({ text: 'minLength' }),\n never: tsc.identifier({ text: 'never' }),\n null: tsc.identifier({ text: 'null' }),\n nullable: tsc.identifier({ text: 'nullable' }),\n number: tsc.identifier({ text: 'number' }),\n object: tsc.identifier({ text: 'object' }),\n optional: tsc.identifier({ text: 'optional' }),\n parseAsync: tsc.identifier({ text: 'parseAsync' }),\n readonly: tsc.identifier({ text: 'readonly' }),\n record: tsc.identifier({ text: 'record' }),\n regex: tsc.identifier({ text: 'regex' }),\n register: tsc.identifier({ text: 'register' }),\n string: tsc.identifier({ text: 'string' }),\n time: tsc.identifier({ text: 'time' }),\n tuple: tsc.identifier({ text: 'tuple' }),\n undefined: tsc.identifier({ text: 'undefined' }),\n union: tsc.identifier({ text: 'union' }),\n unknown: tsc.identifier({ text: 'unknown' }),\n url: tsc.identifier({ text: 'url' }),\n uuid: tsc.identifier({ text: 'uuid' }),\n void: tsc.identifier({ text: 'void' }),\n};\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../constants';\nimport type { ValidatorArgs } from '../shared/types';\n\nexport const createRequestValidatorMini = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'zod',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n\nexport const createResponseValidatorMini = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tool: 'zod',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../constants';\nimport type { ValidatorArgs } from '../shared/types';\n\nexport const createRequestValidatorV3 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'zod',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n\nexport const createResponseValidatorV3 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tool: 'zod',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../constants';\nimport type { ValidatorArgs } from '../shared/types';\n\nexport const createRequestValidatorV4 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tool: 'zod',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n\nexport const createResponseValidatorV4 = ({\n operation,\n plugin,\n}: ValidatorArgs): ts.ArrowFunction | undefined => {\n const symbol = plugin.getSymbol({\n category: 'schema',\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tool: 'zod',\n });\n if (!symbol) return;\n\n const dataParameterName = 'data';\n\n return tsc.arrowFunction({\n async: true,\n parameters: [\n {\n name: dataParameterName,\n },\n ],\n statements: [\n tsc.returnStatement({\n expression: tsc.awaitExpression({\n expression: tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: symbol.placeholder,\n name: identifiers.parseAsync,\n }),\n parameters: [tsc.identifier({ text: dataParameterName })],\n }),\n }),\n }),\n ],\n });\n};\n","import type ts from 'typescript';\n\nimport {\n createRequestValidatorMini,\n createResponseValidatorMini,\n} from './mini/api';\nimport type { ValidatorArgs } from './shared/types';\nimport { createRequestValidatorV3, createResponseValidatorV3 } from './v3/api';\nimport { createRequestValidatorV4, createResponseValidatorV4 } from './v4/api';\n\nexport type IApi = {\n createRequestValidator: (args: ValidatorArgs) => ts.ArrowFunction | undefined;\n createResponseValidator: (\n args: ValidatorArgs,\n ) => ts.ArrowFunction | undefined;\n};\n\nexport class Api implements IApi {\n createRequestValidator(args: ValidatorArgs): ts.ArrowFunction | undefined {\n const { plugin } = args;\n switch (plugin.config.compatibilityVersion) {\n case 3:\n return createRequestValidatorV3(args);\n case 'mini':\n return createRequestValidatorMini(args);\n case 4:\n default:\n return createRequestValidatorV4(args);\n }\n }\n\n createResponseValidator(args: ValidatorArgs): ts.ArrowFunction | undefined {\n const { plugin } = args;\n switch (plugin.config.compatibilityVersion) {\n case 3:\n return createResponseValidatorV3(args);\n case 'mini':\n return createResponseValidatorMini(args);\n case 4:\n default:\n return createResponseValidatorV4(args);\n }\n }\n}\n","import type { Symbol } from '@hey-api/codegen-core';\nimport type ts from 'typescript';\n\nimport type { IR } from '~/ir/types';\nimport { createSchemaComment } from '~/plugins/shared/utils/schema';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../constants';\nimport type { ZodPlugin } from '../types';\nimport type { Ast } from './types';\n\nexport const exportAst = ({\n ast,\n plugin,\n schema,\n symbol,\n typeInferSymbol,\n}: {\n ast: Ast;\n plugin: ZodPlugin['Instance'];\n schema: IR.SchemaObject;\n symbol: Symbol;\n typeInferSymbol: Symbol | undefined;\n}): void => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const statement = tsc.constVariable({\n comment: plugin.config.comments\n ? createSchemaComment({ schema })\n : undefined,\n exportConst: symbol.exported,\n expression: ast.expression,\n name: symbol.placeholder,\n typeName: ast.typeName\n ? (tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: ast.typeName,\n }) as unknown as ts.TypeNode)\n : undefined,\n });\n plugin.setSymbolValue(symbol, statement);\n\n if (typeInferSymbol) {\n const inferType = tsc.typeAliasDeclaration({\n exportType: typeInferSymbol.exported,\n name: typeInferSymbol.placeholder,\n type: tsc.typeReferenceNode({\n typeArguments: [\n tsc.typeOfExpression({\n text: symbol.placeholder,\n }) as unknown as ts.TypeNode,\n ],\n typeName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.infer,\n }) as unknown as string,\n }),\n });\n plugin.setSymbolValue(typeInferSymbol, inferType);\n }\n};\n","import type { ZodPlugin } from '../types';\n\nexport const getZodModule = ({\n plugin,\n}: {\n plugin: ZodPlugin['Instance'];\n}): string => {\n const version = plugin.package.getVersion('zod');\n\n if (version) {\n if (plugin.package.satisfies(version, '<4.0.0')) {\n switch (plugin.config.compatibilityVersion) {\n case 3:\n default:\n return 'zod';\n case 4:\n return 'zod/v4';\n case 'mini':\n return 'zod/v4-mini';\n }\n }\n }\n\n switch (plugin.config.compatibilityVersion) {\n case 3:\n return 'zod/v3';\n case 4:\n default:\n return 'zod';\n case 'mini':\n return 'zod/mini';\n }\n};\n","import type ts from 'typescript';\n\nimport { tsc } from '~/tsc';\n\nexport const numberParameter = ({\n isBigInt,\n value,\n}: {\n isBigInt: boolean;\n value: unknown;\n}): ts.Expression | undefined => {\n const expression = tsc.valueToExpression({ value });\n\n if (\n isBigInt &&\n (typeof value === 'bigint' ||\n typeof value === 'number' ||\n typeof value === 'string' ||\n typeof value === 'boolean')\n ) {\n return tsc.callExpression({\n functionName: 'BigInt',\n parameters: [expression],\n });\n }\n\n return expression;\n};\n","import { operationResponsesMap } from '~/ir/operation';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\n\nimport { exportAst } from './export';\nimport type { Ast, IrSchemaToAstOptions } from './types';\n\nexport const irOperationToAst = ({\n getAst,\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n getAst: (\n schema: IR.SchemaObject,\n path: ReadonlyArray<string | number>,\n ) => Ast;\n operation: IR.OperationObject;\n}): void => {\n if (plugin.config.requests.enabled) {\n const requiredProperties = new Set<string>();\n\n const schemaData: IR.SchemaObject = {\n properties: {\n body: {\n type: 'never',\n },\n path: {\n type: 'never',\n },\n query: {\n type: 'never',\n },\n },\n type: 'object',\n };\n\n if (operation.parameters) {\n // TODO: add support for cookies\n\n if (operation.parameters.header) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.header) {\n const parameter = operation.parameters.header[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('headers');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.headers = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.path) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.path) {\n const parameter = operation.parameters.path[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('path');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.path = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.query) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.query) {\n const parameter = operation.parameters.query[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('query');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.query = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n }\n\n if (operation.body) {\n schemaData.properties!.body = operation.body.schema;\n\n if (operation.body.required) {\n requiredProperties.add('body');\n }\n }\n\n schemaData.required = [...requiredProperties];\n\n const ast = getAst(schemaData, state.path.value);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'zod',\n },\n name: buildName({\n config: plugin.config.requests,\n name: operation.id,\n }),\n });\n const typeInferSymbol = plugin.config.requests.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'operation',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'zod',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.requests.types.infer,\n name: operation.id,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema: schemaData,\n symbol,\n typeInferSymbol,\n });\n }\n\n if (plugin.config.responses.enabled) {\n if (operation.responses) {\n const { response } = operationResponsesMap(operation);\n\n if (response) {\n const path = [...state.path.value, 'responses'];\n const ast = getAst(response, path);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path,\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tags: state.tags?.value,\n tool: 'zod',\n },\n name: buildName({\n config: plugin.config.responses,\n name: operation.id,\n }),\n });\n const typeInferSymbol = plugin.config.responses.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path,\n resource: 'operation',\n resourceId: operation.id,\n role: 'responses',\n tags: state.tags?.value,\n tool: 'zod',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.responses.types.infer,\n name: operation.id,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema: response,\n symbol,\n typeInferSymbol,\n });\n }\n }\n }\n};\n","import type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\n\nimport { exportAst } from './export';\nimport type { Ast, IrSchemaToAstOptions } from './types';\n\nexport const irWebhookToAst = ({\n getAst,\n operation,\n plugin,\n state,\n}: IrSchemaToAstOptions & {\n getAst: (\n schema: IR.SchemaObject,\n path: ReadonlyArray<string | number>,\n ) => Ast;\n operation: IR.OperationObject;\n}) => {\n if (plugin.config.webhooks.enabled) {\n const requiredProperties = new Set<string>();\n\n const schemaData: IR.SchemaObject = {\n properties: {\n body: {\n type: 'never',\n },\n path: {\n type: 'never',\n },\n query: {\n type: 'never',\n },\n },\n type: 'object',\n };\n\n if (operation.parameters) {\n // TODO: add support for cookies\n\n if (operation.parameters.header) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.header) {\n const parameter = operation.parameters.header[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('headers');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.headers = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.path) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.path) {\n const parameter = operation.parameters.path[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('path');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.path = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n\n if (operation.parameters.query) {\n const properties: Record<string, IR.SchemaObject> = {};\n const required: Array<string> = [];\n\n for (const key in operation.parameters.query) {\n const parameter = operation.parameters.query[key]!;\n properties[parameter.name] = parameter.schema;\n if (parameter.required) {\n required.push(parameter.name);\n requiredProperties.add('query');\n }\n }\n\n if (Object.keys(properties).length) {\n schemaData.properties!.query = {\n properties,\n required,\n type: 'object',\n };\n }\n }\n }\n\n if (operation.body) {\n schemaData.properties!.body = operation.body.schema;\n\n if (operation.body.required) {\n requiredProperties.add('body');\n }\n }\n\n schemaData.required = [...requiredProperties];\n\n const ast = getAst(schemaData, state.path.value);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'webhook',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'zod',\n },\n name: buildName({\n config: plugin.config.webhooks,\n name: operation.id,\n }),\n });\n const typeInferSymbol = plugin.config.webhooks.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'webhook',\n resourceId: operation.id,\n role: 'data',\n tags: state.tags?.value,\n tool: 'zod',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.webhooks.types.infer,\n name: operation.id,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema: schemaData,\n symbol,\n typeInferSymbol,\n });\n }\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const unknownToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'unknown'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.unknown,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\nimport { unknownToAst } from './unknown';\n\nexport const arrayToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'array'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const functionName = tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.array,\n });\n\n if (!schema.items) {\n result.expression = tsc.callExpression({\n functionName,\n parameters: [\n unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n }).expression,\n ],\n });\n } else {\n schema = deduplicateSchema({ schema });\n\n // at least one item is guaranteed\n const itemExpressions = schema.items!.map((item, index) => {\n const itemAst = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n if (itemAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n return itemAst.expression;\n });\n\n if (itemExpressions.length === 1) {\n result.expression = tsc.callExpression({\n functionName,\n parameters: itemExpressions,\n });\n } else {\n if (schema.logicalOperator === 'and') {\n const firstSchema = schema.items![0]!;\n // we want to add an intersection, but not every schema can use the same API.\n // if the first item contains another array or not an object, we cannot use\n // `.intersection()` as that does not exist on `.union()` and non-object schemas.\n let intersectionExpression: ts.Expression;\n if (\n firstSchema.logicalOperator === 'or' ||\n (firstSchema.type && firstSchema.type !== 'object')\n ) {\n intersectionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: itemExpressions,\n });\n } else {\n intersectionExpression = itemExpressions[0]!;\n for (let i = 1; i < itemExpressions.length; i++) {\n intersectionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: [intersectionExpression, itemExpressions[i]!],\n });\n }\n }\n\n result.expression = tsc.callExpression({\n functionName,\n parameters: [intersectionExpression],\n });\n } else {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.array,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemExpressions,\n }),\n ],\n }),\n ],\n });\n }\n }\n }\n\n const checks: Array<ts.Expression> = [];\n\n if (schema.minItems === schema.maxItems && schema.minItems !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n }),\n );\n } else {\n if (schema.minItems !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.minLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n }),\n );\n }\n\n if (schema.maxItems !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.maxLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxItems })],\n }),\n );\n }\n }\n\n if (checks.length) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.check,\n }),\n parameters: checks,\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const booleanToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'boolean'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n if (typeof schema.const === 'boolean') {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.boolean(schema.const)],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.boolean,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { unknownToAst } from './unknown';\n\nexport const enumToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'enum'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const enumMembers: Array<ts.LiteralExpression> = [];\n const literalMembers: Array<ts.CallExpression> = [];\n\n let isNullable = false;\n let allStrings = true;\n\n for (const item of schema.items ?? []) {\n // Zod supports string, number, and boolean enums\n if (item.type === 'string' && typeof item.const === 'string') {\n const stringLiteral = tsc.stringLiteral({\n text: item.const,\n });\n enumMembers.push(stringLiteral);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [stringLiteral],\n }),\n );\n } else if (\n (item.type === 'number' || item.type === 'integer') &&\n typeof item.const === 'number'\n ) {\n allStrings = false;\n const numberLiteral = tsc.ots.number(item.const);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [numberLiteral],\n }),\n );\n } else if (item.type === 'boolean' && typeof item.const === 'boolean') {\n allStrings = false;\n const booleanLiteral = tsc.ots.boolean(item.const);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [booleanLiteral],\n }),\n );\n } else if (item.type === 'null' || item.const === null) {\n isNullable = true;\n }\n }\n\n if (!literalMembers.length) {\n return unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n }\n\n // Use z.enum() for pure string enums, z.union() for mixed or non-string types\n if (allStrings && enumMembers.length > 0) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.enum,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: enumMembers,\n multiLine: false,\n }),\n ],\n });\n } else if (literalMembers.length === 1) {\n // For single-member unions, use the member directly instead of wrapping in z.union()\n result.expression = literalMembers[0];\n } else {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: literalMembers,\n multiLine: literalMembers.length > 3,\n }),\n ],\n });\n }\n\n if (isNullable) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.nullable,\n }),\n parameters: [result.expression],\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const neverToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'never'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.never,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const nullToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'null'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.null,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport { numberParameter } from '../../shared/numbers';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const numberToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'integer' | 'number'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n\n if (typeof schema.const === 'number') {\n // TODO: parser - handle bigint constants\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.number(schema.const)],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: isBigInt\n ? tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.coerce,\n }),\n name: identifiers.bigint,\n })\n : tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.number,\n }),\n });\n\n if (!isBigInt && schema.type === 'integer') {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.int,\n }),\n });\n }\n\n const checks: Array<ts.Expression> = [];\n\n if (schema.exclusiveMinimum !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.gt,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMinimum }),\n ],\n }),\n );\n } else if (schema.minimum !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.gte,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.minimum })],\n }),\n );\n }\n\n if (schema.exclusiveMaximum !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lt,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMaximum }),\n ],\n }),\n );\n } else if (schema.maximum !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lte,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.maximum })],\n }),\n );\n }\n\n if (checks.length) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.check,\n }),\n parameters: checks,\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { numberRegExp } from '~/utils/regexp';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const objectToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'object'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n // TODO: parser - handle constants\n const properties: Array<ts.PropertyAssignment | ts.GetAccessorDeclaration> =\n [];\n\n const required = schema.required ?? [];\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const isRequired = required.includes(name);\n\n const propertyAst = irSchemaToAst({\n optional: !isRequired,\n plugin,\n schema: property,\n state: {\n ...state,\n path: toRef([...state.path.value, 'properties', name]),\n },\n });\n if (propertyAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n numberRegExp.lastIndex = 0;\n let propertyName;\n if (numberRegExp.test(name)) {\n // For numeric literals, we'll handle negative numbers by using a string literal\n // instead of trying to use a PrefixUnaryExpression\n propertyName = name.startsWith('-')\n ? ts.factory.createStringLiteral(name)\n : ts.factory.createNumericLiteral(name);\n } else {\n propertyName = name;\n }\n // TODO: parser - abstract safe property name logic\n if (\n ((name.match(/^[0-9]/) && name.match(/\\D+/g)) || name.match(/\\W/g)) &&\n !name.startsWith(\"'\") &&\n !name.endsWith(\"'\")\n ) {\n propertyName = `'${name}'`;\n }\n\n if (propertyAst.hasLazyExpression) {\n properties.push(\n tsc.getAccessorDeclaration({\n name: propertyName,\n statements: [\n tsc.returnStatement({\n expression: propertyAst.expression,\n }),\n ],\n }),\n );\n } else {\n properties.push(\n tsc.propertyAssignment({\n initializer: propertyAst.expression,\n name: propertyName,\n }),\n );\n }\n }\n\n if (\n schema.additionalProperties &&\n (!schema.properties || !Object.keys(schema.properties).length)\n ) {\n const additionalAst = irSchemaToAst({\n plugin,\n schema: schema.additionalProperties,\n state: {\n ...state,\n path: toRef([...state.path.value, 'additionalProperties']),\n },\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.record,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.string,\n }),\n parameters: [],\n }),\n additionalAst.expression,\n ],\n });\n if (additionalAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.object,\n }),\n parameters: [ts.factory.createObjectLiteralExpression(properties, true)],\n });\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const stringToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'string'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n if (typeof schema.const === 'string') {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.string(schema.const)],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.string,\n }),\n });\n\n const dateTimeOptions: { key: string; value: boolean }[] = [];\n\n if (plugin.config.dates.offset) {\n dateTimeOptions.push({ key: 'offset', value: true });\n }\n if (plugin.config.dates.local) {\n dateTimeOptions.push({ key: 'local', value: true });\n }\n\n if (schema.format) {\n switch (schema.format) {\n case 'date':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.iso,\n }),\n name: identifiers.date,\n }),\n });\n break;\n case 'date-time':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.iso,\n }),\n name: identifiers.datetime,\n }),\n parameters:\n dateTimeOptions.length > 0\n ? [\n tsc.objectExpression({\n obj: dateTimeOptions,\n }),\n ]\n : [],\n });\n break;\n case 'email':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.email,\n }),\n });\n break;\n case 'ipv4':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.ipv4,\n }),\n });\n break;\n case 'ipv6':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.ipv6,\n }),\n });\n break;\n case 'time':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.iso,\n }),\n name: identifiers.time,\n }),\n });\n break;\n case 'uri':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.url,\n }),\n });\n break;\n case 'uuid':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.uuid,\n }),\n });\n break;\n }\n }\n\n const checks: Array<ts.Expression> = [];\n\n if (schema.minLength === schema.maxLength && schema.minLength !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n }),\n );\n } else {\n if (schema.minLength !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.minLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n }),\n );\n }\n\n if (schema.maxLength !== undefined) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.maxLength,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxLength })],\n }),\n );\n }\n }\n\n if (schema.pattern) {\n checks.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.regex,\n }),\n parameters: [tsc.regularExpressionLiteral({ text: schema.pattern })],\n }),\n );\n }\n\n if (checks.length) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.check,\n }),\n parameters: checks,\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const tupleToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'tuple'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n if (schema.const && Array.isArray(schema.const)) {\n const tupleElements = schema.const.map((value) =>\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.valueToExpression({ value })],\n }),\n );\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n const tupleElements: Array<ts.Expression> = [];\n\n if (schema.items) {\n schema.items.forEach((item, index) => {\n const itemSchema = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n tupleElements.push(itemSchema.expression);\n if (itemSchema.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n });\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n });\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const undefinedToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'undefined'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.undefined,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const voidToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'void'>;\n}): Omit<Ast, 'typeName'> => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.void,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\n\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { arrayToAst } from './array';\nimport { booleanToAst } from './boolean';\nimport { enumToAst } from './enum';\nimport { neverToAst } from './never';\nimport { nullToAst } from './null';\nimport { numberToAst } from './number';\nimport { objectToAst } from './object';\nimport { stringToAst } from './string';\nimport { tupleToAst } from './tuple';\nimport { undefinedToAst } from './undefined';\nimport { unknownToAst } from './unknown';\nimport { voidToAst } from './void';\n\nexport const irSchemaWithTypeToAst = ({\n schema,\n ...args\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType;\n}): Omit<Ast, 'typeName'> => {\n switch (schema.type) {\n case 'array':\n return arrayToAst({\n ...args,\n schema: schema as SchemaWithType<'array'>,\n });\n case 'boolean':\n return booleanToAst({\n ...args,\n schema: schema as SchemaWithType<'boolean'>,\n });\n case 'enum':\n return enumToAst({\n ...args,\n schema: schema as SchemaWithType<'enum'>,\n });\n case 'integer':\n case 'number':\n return numberToAst({\n ...args,\n schema: schema as SchemaWithType<'integer' | 'number'>,\n });\n case 'never':\n return neverToAst({\n ...args,\n schema: schema as SchemaWithType<'never'>,\n });\n case 'null':\n return nullToAst({\n ...args,\n schema: schema as SchemaWithType<'null'>,\n });\n case 'object':\n return objectToAst({\n ...args,\n schema: schema as SchemaWithType<'object'>,\n });\n case 'string':\n return stringToAst({\n ...args,\n schema: schema as SchemaWithType<'string'>,\n });\n case 'tuple':\n return tupleToAst({\n ...args,\n schema: schema as SchemaWithType<'tuple'>,\n });\n case 'undefined':\n return undefinedToAst({\n ...args,\n schema: schema as SchemaWithType<'undefined'>,\n });\n case 'unknown':\n return unknownToAst({\n ...args,\n schema: schema as SchemaWithType<'unknown'>,\n });\n case 'void':\n return voidToAst({\n ...args,\n schema: schema as SchemaWithType<'void'>,\n });\n }\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef, toRefs } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { pathToJsonPointer, refToName } from '~/utils/ref';\n\nimport { identifiers } from '../constants';\nimport { exportAst } from '../shared/export';\nimport { getZodModule } from '../shared/module';\nimport { numberParameter } from '../shared/numbers';\nimport { irOperationToAst } from '../shared/operation';\nimport type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types';\nimport { irWebhookToAst } from '../shared/webhook';\nimport type { ZodPlugin } from '../types';\nimport { irSchemaWithTypeToAst } from './toAst';\n\nexport const irSchemaToAst = ({\n optional,\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n /**\n * Accept `optional` to handle optional object properties. We can't handle\n * this inside the object function because `.optional()` must come before\n * `.default()` which is handled in this function.\n */\n optional?: boolean;\n schema: IR.SchemaObject;\n}): Ast => {\n let ast: Partial<Ast> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (schema.$ref) {\n const query: SymbolMeta = {\n category: 'schema',\n resource: 'definition',\n resourceId: schema.$ref,\n tool: 'zod',\n };\n const refSymbol = plugin.referenceSymbol(query);\n if (plugin.isSymbolRegistered(query)) {\n const ref = tsc.identifier({ text: refSymbol.placeholder });\n ast.expression = ref;\n } else {\n const lazyExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n returnType: tsc.keywordTypeNode({ keyword: 'any' }),\n statements: [\n tsc.returnStatement({\n expression: tsc.identifier({ text: refSymbol.placeholder }),\n }),\n ],\n }),\n ],\n });\n ast.expression = lazyExpression;\n ast.hasLazyExpression = true;\n state.hasLazyExpression.value = true;\n }\n } else if (schema.type) {\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: schema as SchemaWithType,\n state,\n });\n ast.expression = typeAst.expression;\n ast.hasLazyExpression = typeAst.hasLazyExpression;\n\n if (plugin.config.metadata && schema.description) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.register,\n }),\n parameters: [\n tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.globalRegistry,\n }),\n tsc.objectExpression({\n obj: [\n {\n key: 'description',\n value: tsc.stringLiteral({ text: schema.description }),\n },\n ],\n }),\n ],\n });\n }\n } else if (schema.items) {\n schema = deduplicateSchema({ schema });\n\n if (schema.items) {\n const itemSchemas = schema.items.map((item, index) =>\n irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n }),\n );\n\n if (schema.logicalOperator === 'and') {\n const firstSchema = schema.items[0]!;\n // we want to add an intersection, but not every schema can use the same API.\n // if the first item contains another array or not an object, we cannot use\n // `.merge()` as that does not exist on `.union()` and non-object schemas.\n if (\n firstSchema.logicalOperator === 'or' ||\n (firstSchema.type && firstSchema.type !== 'object')\n ) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: itemSchemas.map((schema) => schema.expression),\n });\n } else {\n ast.expression = itemSchemas[0]!.expression;\n itemSchemas.slice(1).forEach((schema) => {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: [\n ast.expression,\n schema.hasLazyExpression\n ? tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n statements: [\n tsc.returnStatement({\n expression: schema.expression,\n }),\n ],\n }),\n ],\n })\n : schema.expression,\n ],\n });\n });\n }\n } else {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemSchemas.map((schema) => schema.expression),\n }),\n ],\n });\n }\n } else {\n ast = irSchemaToAst({ plugin, schema, state });\n }\n } else {\n // catch-all fallback for failed schemas\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n ast.expression = typeAst.expression;\n }\n\n if (ast.expression) {\n if (schema.accessScope === 'read') {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.readonly,\n }),\n parameters: [ast.expression],\n });\n }\n\n if (optional) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.optional,\n }),\n parameters: [ast.expression],\n });\n ast.typeName = identifiers.ZodMiniOptional;\n }\n\n if (schema.default !== undefined) {\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n const callParameter = numberParameter({\n isBigInt,\n value: schema.default,\n });\n if (callParameter) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers._default,\n }),\n parameters: [ast.expression, callParameter],\n });\n }\n }\n }\n\n return ast as Ast;\n};\n\nconst handleComponent = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}): void => {\n const $ref = pathToJsonPointer(state.path.value);\n const ast = irSchemaToAst({ plugin, schema, state });\n const baseName = refToName($ref);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'zod',\n },\n name: buildName({\n config: plugin.config.definitions,\n name: baseName,\n }),\n });\n const typeInferSymbol = plugin.config.definitions.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'zod',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.definitions.types.infer,\n name: baseName,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema,\n symbol,\n typeInferSymbol,\n });\n};\n\nexport const handlerMini: ZodPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: getZodModule({ plugin }),\n importKind: 'namespace',\n meta: {\n category: 'external',\n resource: 'zod.z',\n },\n name: 'z',\n });\n\n plugin.forEach(\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'webhook',\n (event) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path: event._path,\n tags: event.tags,\n });\n switch (event.type) {\n case 'operation':\n irOperationToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n case 'parameter':\n handleComponent({\n plugin,\n schema: event.parameter.schema,\n state,\n });\n break;\n case 'requestBody':\n handleComponent({\n plugin,\n schema: event.requestBody.schema,\n state,\n });\n break;\n case 'schema':\n handleComponent({\n plugin,\n schema: event.schema,\n state,\n });\n break;\n case 'webhook':\n irWebhookToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n }\n },\n );\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const unknownToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'unknown'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.unknown,\n }),\n });\n return expression;\n};\n","import type ts from 'typescript';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\nimport { unknownToAst } from './unknown';\n\nexport const arrayToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'array'>;\n}): Omit<Ast, 'typeName'> & {\n anyType?: string;\n} => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const functionName = tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.array,\n });\n\n let arrayExpression: ts.CallExpression | undefined;\n let hasLazyExpression = false;\n\n if (!schema.items) {\n arrayExpression = tsc.callExpression({\n functionName,\n parameters: [\n unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n }),\n ],\n });\n } else {\n schema = deduplicateSchema({ schema });\n\n // at least one item is guaranteed\n const itemExpressions = schema.items!.map((item, index) => {\n const itemAst = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n if (itemAst.hasLazyExpression) {\n hasLazyExpression = true;\n }\n return itemAst.expression;\n });\n\n if (itemExpressions.length === 1) {\n arrayExpression = tsc.callExpression({\n functionName,\n parameters: itemExpressions,\n });\n } else {\n if (schema.logicalOperator === 'and') {\n const firstSchema = schema.items![0]!;\n // we want to add an intersection, but not every schema can use the same API.\n // if the first item contains another array or not an object, we cannot use\n // `.and()` as that does not exist on `.union()` and non-object schemas.\n let intersectionExpression: ts.Expression;\n if (\n firstSchema.logicalOperator === 'or' ||\n (firstSchema.type && firstSchema.type !== 'object')\n ) {\n intersectionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: itemExpressions,\n });\n } else {\n intersectionExpression = itemExpressions[0]!;\n for (let i = 1; i < itemExpressions.length; i++) {\n intersectionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: intersectionExpression,\n name: identifiers.and,\n }),\n parameters: [itemExpressions[i]!],\n });\n }\n }\n\n arrayExpression = tsc.callExpression({\n functionName,\n parameters: [intersectionExpression],\n });\n } else {\n arrayExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.array,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemExpressions,\n }),\n ],\n }),\n ],\n });\n }\n }\n }\n\n if (schema.minItems === schema.maxItems && schema.minItems !== undefined) {\n arrayExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: arrayExpression,\n name: identifiers.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n });\n } else {\n if (schema.minItems !== undefined) {\n arrayExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: arrayExpression,\n name: identifiers.min,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n });\n }\n\n if (schema.maxItems !== undefined) {\n arrayExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: arrayExpression,\n name: identifiers.max,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxItems })],\n });\n }\n }\n\n return {\n expression: arrayExpression,\n hasLazyExpression,\n };\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const booleanToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'boolean'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (typeof schema.const === 'boolean') {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.boolean(schema.const)],\n });\n return expression;\n }\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.boolean,\n }),\n });\n return expression;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\nimport { unknownToAst } from './unknown';\n\nexport const enumToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'enum'>;\n}): ts.CallExpression => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const enumMembers: Array<ts.LiteralExpression> = [];\n const literalMembers: Array<ts.CallExpression> = [];\n\n let isNullable = false;\n let allStrings = true;\n\n for (const item of schema.items ?? []) {\n // Zod supports string, number, and boolean enums\n if (item.type === 'string' && typeof item.const === 'string') {\n const stringLiteral = tsc.stringLiteral({\n text: item.const,\n });\n enumMembers.push(stringLiteral);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [stringLiteral],\n }),\n );\n } else if (\n (item.type === 'number' || item.type === 'integer') &&\n typeof item.const === 'number'\n ) {\n allStrings = false;\n const numberLiteral = tsc.ots.number(item.const);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [numberLiteral],\n }),\n );\n } else if (item.type === 'boolean' && typeof item.const === 'boolean') {\n allStrings = false;\n const booleanLiteral = tsc.ots.boolean(item.const);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [booleanLiteral],\n }),\n );\n } else if (item.type === 'null' || item.const === null) {\n isNullable = true;\n }\n }\n\n if (!literalMembers.length) {\n return unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n }\n\n // Use z.enum() for pure string enums, z.union() for mixed or non-string types\n let enumExpression: ts.CallExpression;\n if (allStrings && enumMembers.length > 0) {\n enumExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.enum,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: enumMembers,\n multiLine: false,\n }),\n ],\n });\n } else if (literalMembers.length === 1) {\n // For single-member unions, use the member directly instead of wrapping in z.union()\n enumExpression = literalMembers[0]!;\n } else {\n enumExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: literalMembers,\n multiLine: literalMembers.length > 3,\n }),\n ],\n });\n }\n\n if (isNullable) {\n enumExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: enumExpression,\n name: identifiers.nullable,\n }),\n });\n }\n\n return enumExpression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const neverToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'never'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.never,\n }),\n });\n return expression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const nullToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'null'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.null,\n }),\n });\n return expression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport { numberParameter } from '../../shared/numbers';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const numberToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'integer' | 'number'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n\n if (typeof schema.const === 'number') {\n // TODO: parser - handle bigint constants\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.number(schema.const)],\n });\n return expression;\n }\n\n let numberExpression = tsc.callExpression({\n functionName: isBigInt\n ? tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.coerce,\n }),\n name: identifiers.bigint,\n })\n : tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.number,\n }),\n });\n\n if (!isBigInt && schema.type === 'integer') {\n numberExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: numberExpression,\n name: identifiers.int,\n }),\n });\n }\n\n if (schema.exclusiveMinimum !== undefined) {\n numberExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: numberExpression,\n name: identifiers.gt,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMinimum }),\n ],\n });\n } else if (schema.minimum !== undefined) {\n numberExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: numberExpression,\n name: identifiers.gte,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.minimum })],\n });\n }\n\n if (schema.exclusiveMaximum !== undefined) {\n numberExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: numberExpression,\n name: identifiers.lt,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMaximum }),\n ],\n });\n } else if (schema.maximum !== undefined) {\n numberExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: numberExpression,\n name: identifiers.lte,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.maximum })],\n });\n }\n\n return numberExpression;\n};\n","import ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { numberRegExp } from '~/utils/regexp';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const objectToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'object'>;\n}): Omit<Ast, 'typeName'> & {\n anyType?: string;\n} => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n let hasLazyExpression = false;\n\n // TODO: parser - handle constants\n const properties: Array<ts.PropertyAssignment> = [];\n\n const required = schema.required ?? [];\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const isRequired = required.includes(name);\n\n const propertyExpression = irSchemaToAst({\n optional: !isRequired,\n plugin,\n schema: property,\n state: {\n ...state,\n path: toRef([...state.path.value, 'properties', name]),\n },\n });\n\n if (propertyExpression.hasLazyExpression) {\n hasLazyExpression = true;\n }\n\n numberRegExp.lastIndex = 0;\n let propertyName;\n if (numberRegExp.test(name)) {\n // For numeric literals, we'll handle negative numbers by using a string literal\n // instead of trying to use a PrefixUnaryExpression\n propertyName = name.startsWith('-')\n ? ts.factory.createStringLiteral(name)\n : ts.factory.createNumericLiteral(name);\n } else {\n propertyName = name;\n }\n // TODO: parser - abstract safe property name logic\n if (\n ((name.match(/^[0-9]/) && name.match(/\\D+/g)) || name.match(/\\W/g)) &&\n !name.startsWith(\"'\") &&\n !name.endsWith(\"'\")\n ) {\n propertyName = `'${name}'`;\n }\n properties.push(\n tsc.propertyAssignment({\n initializer: propertyExpression.expression,\n name: propertyName,\n }),\n );\n }\n\n if (\n schema.additionalProperties &&\n (!schema.properties || !Object.keys(schema.properties).length)\n ) {\n const additionalAst = irSchemaToAst({\n plugin,\n schema: schema.additionalProperties,\n state: {\n ...state,\n path: toRef([...state.path.value, 'additionalProperties']),\n },\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.record,\n }),\n parameters: [additionalAst.expression],\n });\n return {\n anyType: 'AnyZodObject',\n expression,\n hasLazyExpression: additionalAst.hasLazyExpression,\n };\n }\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.object,\n }),\n parameters: [ts.factory.createObjectLiteralExpression(properties, true)],\n });\n return {\n anyType: 'AnyZodObject',\n expression,\n hasLazyExpression,\n };\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const stringToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'string'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (typeof schema.const === 'string') {\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.string(schema.const)],\n });\n return expression;\n }\n\n let stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.string,\n }),\n });\n\n const dateTimeOptions: { key: string; value: boolean }[] = [];\n\n if (plugin.config.dates.offset) {\n dateTimeOptions.push({ key: 'offset', value: true });\n }\n if (plugin.config.dates.local) {\n dateTimeOptions.push({ key: 'local', value: true });\n }\n\n if (schema.format) {\n switch (schema.format) {\n case 'date':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.date,\n }),\n });\n break;\n case 'date-time':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.datetime,\n }),\n parameters:\n dateTimeOptions.length > 0\n ? [\n tsc.objectExpression({\n obj: dateTimeOptions,\n }),\n ]\n : [],\n });\n break;\n case 'email':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.email,\n }),\n });\n break;\n case 'ipv4':\n case 'ipv6':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.ip,\n }),\n });\n break;\n case 'time':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.time,\n }),\n });\n break;\n case 'uri':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.url,\n }),\n });\n break;\n case 'uuid':\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.uuid,\n }),\n });\n break;\n }\n }\n\n if (schema.minLength === schema.maxLength && schema.minLength !== undefined) {\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n });\n } else {\n if (schema.minLength !== undefined) {\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.min,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n });\n }\n\n if (schema.maxLength !== undefined) {\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.max,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxLength })],\n });\n }\n }\n\n if (schema.pattern) {\n stringExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: stringExpression,\n name: identifiers.regex,\n }),\n parameters: [tsc.regularExpressionLiteral({ text: schema.pattern })],\n });\n }\n\n return stringExpression;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const tupleToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'tuple'>;\n}): Omit<Ast, 'typeName'> & {\n anyType?: string;\n} => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n let hasLazyExpression = false;\n\n if (schema.const && Array.isArray(schema.const)) {\n const tupleElements = schema.const.map((value) =>\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.valueToExpression({ value })],\n }),\n );\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n });\n return {\n expression,\n hasLazyExpression,\n };\n }\n\n const tupleElements: Array<ts.Expression> = [];\n\n if (schema.items) {\n schema.items.forEach((item, index) => {\n const itemSchema = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n tupleElements.push(itemSchema.expression);\n if (itemSchema.hasLazyExpression) {\n hasLazyExpression = true;\n }\n });\n }\n\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n });\n return {\n expression,\n hasLazyExpression,\n };\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const undefinedToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'undefined'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.undefined,\n }),\n });\n return expression;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { IrSchemaToAstOptions } from '../../shared/types';\n\nexport const voidToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'void'>;\n}) => {\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n const expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.void,\n }),\n });\n return expression;\n};\n","import type { SchemaWithType } from '~/plugins';\n\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { arrayToAst } from './array';\nimport { booleanToAst } from './boolean';\nimport { enumToAst } from './enum';\nimport { neverToAst } from './never';\nimport { nullToAst } from './null';\nimport { numberToAst } from './number';\nimport { objectToAst } from './object';\nimport { stringToAst } from './string';\nimport { tupleToAst } from './tuple';\nimport { undefinedToAst } from './undefined';\nimport { unknownToAst } from './unknown';\nimport { voidToAst } from './void';\n\nexport const irSchemaWithTypeToAst = ({\n schema,\n ...args\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType;\n}): Omit<Ast, 'typeName'> & {\n anyType?: string;\n} => {\n switch (schema.type) {\n case 'array':\n return arrayToAst({\n ...args,\n schema: schema as SchemaWithType<'array'>,\n });\n case 'boolean':\n return {\n expression: booleanToAst({\n ...args,\n schema: schema as SchemaWithType<'boolean'>,\n }),\n };\n case 'enum':\n return {\n expression: enumToAst({\n ...args,\n schema: schema as SchemaWithType<'enum'>,\n }),\n };\n case 'integer':\n case 'number':\n return {\n expression: numberToAst({\n ...args,\n schema: schema as SchemaWithType<'integer' | 'number'>,\n }),\n };\n case 'never':\n return {\n expression: neverToAst({\n ...args,\n schema: schema as SchemaWithType<'never'>,\n }),\n };\n case 'null':\n return {\n expression: nullToAst({\n ...args,\n schema: schema as SchemaWithType<'null'>,\n }),\n };\n case 'object':\n return objectToAst({\n ...args,\n schema: schema as SchemaWithType<'object'>,\n });\n case 'string':\n return {\n expression: stringToAst({\n ...args,\n schema: schema as SchemaWithType<'string'>,\n }),\n };\n case 'tuple':\n return tupleToAst({\n ...args,\n schema: schema as SchemaWithType<'tuple'>,\n });\n case 'undefined':\n return {\n expression: undefinedToAst({\n ...args,\n schema: schema as SchemaWithType<'undefined'>,\n }),\n };\n case 'unknown':\n return {\n expression: unknownToAst({\n ...args,\n schema: schema as SchemaWithType<'unknown'>,\n }),\n };\n case 'void':\n return {\n expression: voidToAst({\n ...args,\n schema: schema as SchemaWithType<'void'>,\n }),\n };\n }\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef, toRefs } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { pathToJsonPointer, refToName } from '~/utils/ref';\n\nimport { identifiers } from '../constants';\nimport { exportAst } from '../shared/export';\nimport { getZodModule } from '../shared/module';\nimport { numberParameter } from '../shared/numbers';\nimport { irOperationToAst } from '../shared/operation';\nimport type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types';\nimport { irWebhookToAst } from '../shared/webhook';\nimport type { ZodPlugin } from '../types';\nimport { irSchemaWithTypeToAst } from './toAst';\n\nexport const irSchemaToAst = ({\n optional,\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n /**\n * Accept `optional` to handle optional object properties. We can't handle\n * this inside the object function because `.optional()` must come before\n * `.default()` which is handled in this function.\n */\n optional?: boolean;\n schema: IR.SchemaObject;\n}): Ast => {\n let ast: Partial<Ast> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (schema.$ref) {\n const query: SymbolMeta = {\n category: 'schema',\n resource: 'definition',\n resourceId: schema.$ref,\n tool: 'zod',\n };\n const refSymbol = plugin.referenceSymbol(query);\n if (plugin.isSymbolRegistered(query)) {\n const ref = tsc.identifier({ text: refSymbol.placeholder });\n ast.expression = ref;\n } else {\n const lazyExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n statements: [\n tsc.returnStatement({\n expression: tsc.identifier({ text: refSymbol.placeholder }),\n }),\n ],\n }),\n ],\n });\n ast.expression = lazyExpression;\n ast.hasLazyExpression = true;\n state.hasLazyExpression.value = true;\n }\n } else if (schema.type) {\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: schema as SchemaWithType,\n state,\n });\n ast.expression = typeAst.expression;\n ast.typeName = typeAst.anyType;\n\n if (plugin.config.metadata && schema.description) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.describe,\n }),\n parameters: [tsc.stringLiteral({ text: schema.description })],\n });\n }\n } else if (schema.items) {\n schema = deduplicateSchema({ schema });\n\n if (schema.items) {\n const itemTypes = schema.items.map((item, index) => {\n const typeAst = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n return typeAst.expression;\n });\n\n if (schema.logicalOperator === 'and') {\n const firstSchema = schema.items[0]!;\n // we want to add an intersection, but not every schema can use the same API.\n // if the first item contains another array or not an object, we cannot use\n // `.merge()` as that does not exist on `.union()` and non-object schemas.\n if (\n firstSchema.logicalOperator === 'or' ||\n (firstSchema.type && firstSchema.type !== 'object')\n ) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: itemTypes,\n });\n } else {\n ast.expression = itemTypes[0];\n itemTypes.slice(1).forEach((item) => {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression!,\n name: identifiers.and,\n }),\n parameters: [item],\n });\n });\n }\n } else {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemTypes,\n }),\n ],\n });\n }\n } else {\n ast = irSchemaToAst({ plugin, schema, state });\n }\n } else {\n // catch-all fallback for failed schemas\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n ast.expression = typeAst.expression;\n ast.typeName = typeAst.anyType;\n }\n\n if (ast.expression) {\n if (schema.accessScope === 'read') {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.readonly,\n }),\n });\n }\n\n if (optional) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.optional,\n }),\n });\n }\n\n if (schema.default !== undefined) {\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n const callParameter = numberParameter({\n isBigInt,\n value: schema.default,\n });\n if (callParameter) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.default,\n }),\n parameters: [callParameter],\n });\n }\n }\n }\n\n if (state.hasLazyExpression.value) {\n if (!ast.typeName) {\n ast.typeName = 'ZodTypeAny';\n }\n } else if (ast.typeName) {\n ast.typeName = undefined;\n }\n\n return ast as Ast;\n};\n\nconst handleComponent = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}): void => {\n const $ref = pathToJsonPointer(state.path.value);\n const ast = irSchemaToAst({ plugin, schema, state });\n const baseName = refToName($ref);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'zod',\n },\n name: buildName({\n config: plugin.config.definitions,\n name: baseName,\n }),\n });\n const typeInferSymbol = plugin.config.definitions.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'zod',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.definitions.types.infer,\n name: baseName,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema,\n symbol,\n typeInferSymbol,\n });\n};\n\nexport const handlerV3: ZodPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: getZodModule({ plugin }),\n meta: {\n category: 'external',\n resource: 'zod.z',\n },\n name: 'z',\n });\n\n plugin.forEach(\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'webhook',\n (event) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path: event._path,\n tags: event.tags,\n });\n switch (event.type) {\n case 'operation':\n irOperationToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n case 'parameter':\n handleComponent({\n plugin,\n schema: event.parameter.schema,\n state,\n });\n break;\n case 'requestBody':\n handleComponent({\n plugin,\n schema: event.requestBody.schema,\n state,\n });\n break;\n case 'schema':\n handleComponent({\n plugin,\n schema: event.schema,\n state,\n });\n break;\n case 'webhook':\n irWebhookToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n }\n },\n );\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const unknownToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'unknown'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.unknown,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\nimport { unknownToAst } from './unknown';\n\nexport const arrayToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'array'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const functionName = tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.array,\n });\n\n if (!schema.items) {\n result.expression = tsc.callExpression({\n functionName,\n parameters: [\n unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n }).expression,\n ],\n });\n } else {\n schema = deduplicateSchema({ schema });\n\n // at least one item is guaranteed\n const itemExpressions = schema.items!.map((item, index) => {\n const itemAst = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n if (itemAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n return itemAst.expression;\n });\n\n if (itemExpressions.length === 1) {\n result.expression = tsc.callExpression({\n functionName,\n parameters: itemExpressions,\n });\n } else {\n if (schema.logicalOperator === 'and') {\n const firstSchema = schema.items![0]!;\n // we want to add an intersection, but not every schema can use the same API.\n // if the first item contains another array or not an object, we cannot use\n // `.and()` as that does not exist on `.union()` and non-object schemas.\n let intersectionExpression: ts.Expression;\n if (\n firstSchema.logicalOperator === 'or' ||\n (firstSchema.type && firstSchema.type !== 'object')\n ) {\n intersectionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: itemExpressions,\n });\n } else {\n intersectionExpression = itemExpressions[0]!;\n for (let i = 1; i < itemExpressions.length; i++) {\n intersectionExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: intersectionExpression,\n name: identifiers.and,\n }),\n parameters: [itemExpressions[i]!],\n });\n }\n }\n\n result.expression = tsc.callExpression({\n functionName,\n parameters: [intersectionExpression],\n });\n } else {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.array,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemExpressions,\n }),\n ],\n }),\n ],\n });\n }\n }\n }\n\n if (schema.minItems === schema.maxItems && schema.minItems !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n });\n } else {\n if (schema.minItems !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.min,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minItems })],\n });\n }\n\n if (schema.maxItems !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.max,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxItems })],\n });\n }\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const booleanToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'boolean'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (typeof schema.const === 'boolean') {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.boolean(schema.const)],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.boolean,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { unknownToAst } from './unknown';\n\nexport const enumToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'enum'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n const enumMembers: Array<ts.LiteralExpression> = [];\n const literalMembers: Array<ts.CallExpression> = [];\n\n let isNullable = false;\n let allStrings = true;\n\n for (const item of schema.items ?? []) {\n // Zod supports string, number, and boolean enums\n if (item.type === 'string' && typeof item.const === 'string') {\n const stringLiteral = tsc.stringLiteral({\n text: item.const,\n });\n enumMembers.push(stringLiteral);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [stringLiteral],\n }),\n );\n } else if (\n (item.type === 'number' || item.type === 'integer') &&\n typeof item.const === 'number'\n ) {\n allStrings = false;\n const numberLiteral = tsc.ots.number(item.const);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [numberLiteral],\n }),\n );\n } else if (item.type === 'boolean' && typeof item.const === 'boolean') {\n allStrings = false;\n const booleanLiteral = tsc.ots.boolean(item.const);\n literalMembers.push(\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [booleanLiteral],\n }),\n );\n } else if (item.type === 'null' || item.const === null) {\n isNullable = true;\n }\n }\n\n if (!literalMembers.length) {\n return unknownToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n }\n\n // Use z.enum() for pure string enums, z.union() for mixed or non-string types\n if (allStrings && enumMembers.length > 0) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.enum,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: enumMembers,\n multiLine: false,\n }),\n ],\n });\n } else if (literalMembers.length === 1) {\n // For single-member unions, use the member directly instead of wrapping in z.union()\n result.expression = literalMembers[0];\n } else {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: literalMembers,\n multiLine: literalMembers.length > 3,\n }),\n ],\n });\n }\n\n if (isNullable) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.nullable,\n }),\n parameters: [result.expression],\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const neverToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'never'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.never,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const nullToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'null'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.null,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport { numberParameter } from '../../shared/numbers';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const numberToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'integer' | 'number'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (typeof schema.const === 'number') {\n // TODO: parser - handle bigint constants\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.number(schema.const)],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: isBigInt\n ? tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.coerce,\n }),\n name: identifiers.bigint,\n })\n : tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.number,\n }),\n });\n\n if (!isBigInt && schema.type === 'integer') {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.int,\n }),\n });\n }\n\n if (schema.exclusiveMinimum !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.gt,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMinimum }),\n ],\n });\n } else if (schema.minimum !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.gte,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.minimum })],\n });\n }\n\n if (schema.exclusiveMaximum !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.lt,\n }),\n parameters: [\n numberParameter({ isBigInt, value: schema.exclusiveMaximum }),\n ],\n });\n } else if (schema.maximum !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.lte,\n }),\n parameters: [numberParameter({ isBigInt, value: schema.maximum })],\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { numberRegExp } from '~/utils/regexp';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const objectToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'object'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n // TODO: parser - handle constants\n const properties: Array<ts.PropertyAssignment | ts.GetAccessorDeclaration> =\n [];\n\n const required = schema.required ?? [];\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n const isRequired = required.includes(name);\n\n const propertyAst = irSchemaToAst({\n optional: !isRequired,\n plugin,\n schema: property,\n state: {\n ...state,\n path: toRef([...state.path.value, 'properties', name]),\n },\n });\n if (propertyAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n numberRegExp.lastIndex = 0;\n let propertyName;\n if (numberRegExp.test(name)) {\n // For numeric literals, we'll handle negative numbers by using a string literal\n // instead of trying to use a PrefixUnaryExpression\n propertyName = name.startsWith('-')\n ? ts.factory.createStringLiteral(name)\n : ts.factory.createNumericLiteral(name);\n } else {\n propertyName = name;\n }\n // TODO: parser - abstract safe property name logic\n if (\n ((name.match(/^[0-9]/) && name.match(/\\D+/g)) || name.match(/\\W/g)) &&\n !name.startsWith(\"'\") &&\n !name.endsWith(\"'\")\n ) {\n propertyName = `'${name}'`;\n }\n\n if (propertyAst.hasLazyExpression) {\n properties.push(\n tsc.getAccessorDeclaration({\n name: propertyName,\n statements: [\n tsc.returnStatement({\n expression: propertyAst.expression,\n }),\n ],\n }),\n );\n } else {\n properties.push(\n tsc.propertyAssignment({\n initializer: propertyAst.expression,\n name: propertyName,\n }),\n );\n }\n }\n\n if (\n schema.additionalProperties &&\n (!schema.properties || !Object.keys(schema.properties).length)\n ) {\n const additionalAst = irSchemaToAst({\n plugin,\n schema: schema.additionalProperties,\n state: {\n ...state,\n path: toRef([...state.path.value, 'additionalProperties']),\n },\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.record,\n }),\n parameters: [\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.string,\n }),\n parameters: [],\n }),\n additionalAst.expression,\n ],\n });\n if (additionalAst.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n\n // Return with typeName for circular references\n if (result.hasLazyExpression) {\n return {\n ...result,\n typeName: 'ZodType',\n } as Ast;\n }\n\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.object,\n }),\n parameters: [ts.factory.createObjectLiteralExpression(properties, true)],\n });\n\n // Return with typeName for circular references (AnyZodObject doesn't exist in Zod v4, use ZodType)\n if (result.hasLazyExpression) {\n return {\n ...result,\n typeName: 'ZodType',\n } as Ast;\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const stringToAst = ({\n plugin,\n schema,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'string'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (typeof schema.const === 'string') {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.ots.string(schema.const)],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.string,\n }),\n });\n\n const dateTimeOptions: { key: string; value: boolean }[] = [];\n\n if (plugin.config.dates.offset) {\n dateTimeOptions.push({ key: 'offset', value: true });\n }\n if (plugin.config.dates.local) {\n dateTimeOptions.push({ key: 'local', value: true });\n }\n\n if (schema.format) {\n switch (schema.format) {\n case 'date':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.iso,\n }),\n name: identifiers.date,\n }),\n });\n break;\n case 'date-time':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.iso,\n }),\n name: identifiers.datetime,\n }),\n parameters:\n dateTimeOptions.length > 0\n ? [\n tsc.objectExpression({\n obj: dateTimeOptions,\n }),\n ]\n : [],\n });\n break;\n case 'email':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.email,\n }),\n });\n break;\n case 'ipv4':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.ipv4,\n }),\n });\n break;\n case 'ipv6':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.ipv6,\n }),\n });\n break;\n case 'time':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.iso,\n }),\n name: identifiers.time,\n }),\n });\n break;\n case 'uri':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.url,\n }),\n });\n break;\n case 'uuid':\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.uuid,\n }),\n });\n break;\n }\n }\n\n if (schema.minLength === schema.maxLength && schema.minLength !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.length,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n });\n } else {\n if (schema.minLength !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.min,\n }),\n parameters: [tsc.valueToExpression({ value: schema.minLength })],\n });\n }\n\n if (schema.maxLength !== undefined) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.max,\n }),\n parameters: [tsc.valueToExpression({ value: schema.maxLength })],\n });\n }\n }\n\n if (schema.pattern) {\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: result.expression,\n name: identifiers.regex,\n }),\n parameters: [tsc.regularExpressionLiteral({ text: schema.pattern })],\n });\n }\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type ts from 'typescript';\n\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { irSchemaToAst } from '../plugin';\n\nexport const tupleToAst = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'tuple'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (schema.const && Array.isArray(schema.const)) {\n const tupleElements = schema.const.map((value) =>\n tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.literal,\n }),\n parameters: [tsc.valueToExpression({ value })],\n }),\n );\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n });\n return result as Omit<Ast, 'typeName'>;\n }\n\n const tupleElements: Array<ts.Expression> = [];\n\n if (schema.items) {\n schema.items.forEach((item, index) => {\n const itemSchema = irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n });\n tupleElements.push(itemSchema.expression);\n if (itemSchema.hasLazyExpression) {\n result.hasLazyExpression = true;\n }\n });\n }\n\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.tuple,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: tupleElements,\n }),\n ],\n });\n\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const undefinedToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'undefined'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.undefined,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\nimport { tsc } from '~/tsc';\n\nimport { identifiers } from '../../constants';\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\n\nexport const voidToAst = ({\n plugin,\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType<'void'>;\n}): Omit<Ast, 'typeName'> => {\n const result: Partial<Omit<Ast, 'typeName'>> = {};\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n result.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.void,\n }),\n });\n return result as Omit<Ast, 'typeName'>;\n};\n","import type { SchemaWithType } from '~/plugins';\n\nimport type { Ast, IrSchemaToAstOptions } from '../../shared/types';\nimport { arrayToAst } from './array';\nimport { booleanToAst } from './boolean';\nimport { enumToAst } from './enum';\nimport { neverToAst } from './never';\nimport { nullToAst } from './null';\nimport { numberToAst } from './number';\nimport { objectToAst } from './object';\nimport { stringToAst } from './string';\nimport { tupleToAst } from './tuple';\nimport { undefinedToAst } from './undefined';\nimport { unknownToAst } from './unknown';\nimport { voidToAst } from './void';\n\nexport const irSchemaWithTypeToAst = ({\n schema,\n ...args\n}: IrSchemaToAstOptions & {\n schema: SchemaWithType;\n}): Omit<Ast, 'typeName'> => {\n switch (schema.type) {\n case 'array':\n return arrayToAst({\n ...args,\n schema: schema as SchemaWithType<'array'>,\n });\n case 'boolean':\n return booleanToAst({\n ...args,\n schema: schema as SchemaWithType<'boolean'>,\n });\n case 'enum':\n return enumToAst({\n ...args,\n schema: schema as SchemaWithType<'enum'>,\n });\n case 'integer':\n case 'number':\n return numberToAst({\n ...args,\n schema: schema as SchemaWithType<'integer' | 'number'>,\n });\n case 'never':\n return neverToAst({\n ...args,\n schema: schema as SchemaWithType<'never'>,\n });\n case 'null':\n return nullToAst({\n ...args,\n schema: schema as SchemaWithType<'null'>,\n });\n case 'object':\n return objectToAst({\n ...args,\n schema: schema as SchemaWithType<'object'>,\n });\n case 'string':\n return stringToAst({\n ...args,\n schema: schema as SchemaWithType<'string'>,\n });\n case 'tuple':\n return tupleToAst({\n ...args,\n schema: schema as SchemaWithType<'tuple'>,\n });\n case 'undefined':\n return undefinedToAst({\n ...args,\n schema: schema as SchemaWithType<'undefined'>,\n });\n case 'unknown':\n return unknownToAst({\n ...args,\n schema: schema as SchemaWithType<'unknown'>,\n });\n case 'void':\n return voidToAst({\n ...args,\n schema: schema as SchemaWithType<'void'>,\n });\n }\n};\n","import type { SymbolMeta } from '@hey-api/codegen-core';\n\nimport { deduplicateSchema } from '~/ir/schema';\nimport type { IR } from '~/ir/types';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { SchemaWithType } from '~/plugins';\nimport { toRef, toRefs } from '~/plugins/shared/utils/refs';\nimport { tsc } from '~/tsc';\nimport { pathToJsonPointer, refToName } from '~/utils/ref';\n\nimport { identifiers } from '../constants';\nimport { exportAst } from '../shared/export';\nimport { getZodModule } from '../shared/module';\nimport { numberParameter } from '../shared/numbers';\nimport { irOperationToAst } from '../shared/operation';\nimport type { Ast, IrSchemaToAstOptions, PluginState } from '../shared/types';\nimport { irWebhookToAst } from '../shared/webhook';\nimport type { ZodPlugin } from '../types';\nimport { irSchemaWithTypeToAst } from './toAst';\n\nexport const irSchemaToAst = ({\n optional,\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n /**\n * Accept `optional` to handle optional object properties. We can't handle\n * this inside the object function because `.optional()` must come before\n * `.default()` which is handled in this function.\n */\n optional?: boolean;\n schema: IR.SchemaObject;\n}): Ast => {\n let ast: Partial<Ast> = {};\n\n const z = plugin.referenceSymbol({\n category: 'external',\n resource: 'zod.z',\n });\n\n if (schema.$ref) {\n const query: SymbolMeta = {\n category: 'schema',\n resource: 'definition',\n resourceId: schema.$ref,\n tool: 'zod',\n };\n const refSymbol = plugin.referenceSymbol(query);\n if (plugin.isSymbolRegistered(query)) {\n const ref = tsc.identifier({ text: refSymbol.placeholder });\n ast.expression = ref;\n } else {\n const lazyExpression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n returnType: tsc.keywordTypeNode({ keyword: 'any' }),\n statements: [\n tsc.returnStatement({\n expression: tsc.identifier({ text: refSymbol.placeholder }),\n }),\n ],\n }),\n ],\n });\n ast.expression = lazyExpression;\n ast.hasLazyExpression = true;\n state.hasLazyExpression.value = true;\n }\n } else if (schema.type) {\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: schema as SchemaWithType,\n state,\n });\n ast.expression = typeAst.expression;\n ast.hasLazyExpression = typeAst.hasLazyExpression;\n\n if (plugin.config.metadata && schema.description) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.register,\n }),\n parameters: [\n tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.globalRegistry,\n }),\n tsc.objectExpression({\n obj: [\n {\n key: 'description',\n value: tsc.stringLiteral({ text: schema.description }),\n },\n ],\n }),\n ],\n });\n }\n } else if (schema.items) {\n schema = deduplicateSchema({ schema });\n\n if (schema.items) {\n const itemSchemas = schema.items.map((item, index) =>\n irSchemaToAst({\n plugin,\n schema: item,\n state: {\n ...state,\n path: toRef([...state.path.value, 'items', index]),\n },\n }),\n );\n\n if (schema.logicalOperator === 'and') {\n const firstSchema = schema.items[0]!;\n // we want to add an intersection, but not every schema can use the same API.\n // if the first item contains another array or not an object, we cannot use\n // `.merge()` as that does not exist on `.union()` and non-object schemas.\n if (\n firstSchema.logicalOperator === 'or' ||\n (firstSchema.type && firstSchema.type !== 'object')\n ) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.intersection,\n }),\n parameters: itemSchemas.map((schema) => schema.expression),\n });\n } else {\n ast.expression = itemSchemas[0]!.expression;\n itemSchemas.slice(1).forEach((schema) => {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression!,\n name: identifiers.and,\n }),\n parameters: [\n schema.hasLazyExpression\n ? tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.lazy,\n }),\n parameters: [\n tsc.arrowFunction({\n statements: [\n tsc.returnStatement({\n expression: schema.expression,\n }),\n ],\n }),\n ],\n })\n : schema.expression,\n ],\n });\n });\n }\n } else {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.union,\n }),\n parameters: [\n tsc.arrayLiteralExpression({\n elements: itemSchemas.map((schema) => schema.expression),\n }),\n ],\n });\n }\n } else {\n ast = irSchemaToAst({\n plugin,\n schema,\n state,\n });\n }\n } else {\n // catch-all fallback for failed schemas\n const typeAst = irSchemaWithTypeToAst({\n plugin,\n schema: {\n type: 'unknown',\n },\n state,\n });\n ast.expression = typeAst.expression;\n }\n\n if (ast.expression) {\n if (schema.accessScope === 'read') {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.readonly,\n }),\n });\n }\n\n if (optional) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: z.placeholder,\n name: identifiers.optional,\n }),\n parameters: [ast.expression],\n });\n ast.typeName = identifiers.ZodOptional;\n }\n\n if (schema.default !== undefined) {\n const isBigInt = schema.type === 'integer' && schema.format === 'int64';\n const callParameter = numberParameter({\n isBigInt,\n value: schema.default,\n });\n if (callParameter) {\n ast.expression = tsc.callExpression({\n functionName: tsc.propertyAccessExpression({\n expression: ast.expression,\n name: identifiers.default,\n }),\n parameters: [callParameter],\n });\n }\n }\n }\n\n return ast as Ast;\n};\n\nconst handleComponent = ({\n plugin,\n schema,\n state,\n}: IrSchemaToAstOptions & {\n schema: IR.SchemaObject;\n}): void => {\n const $ref = pathToJsonPointer(state.path.value);\n const ast = irSchemaToAst({ plugin, schema, state });\n const baseName = refToName($ref);\n const symbol = plugin.registerSymbol({\n exported: true,\n meta: {\n category: 'schema',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'zod',\n },\n name: buildName({\n config: plugin.config.definitions,\n name: baseName,\n }),\n });\n const typeInferSymbol = plugin.config.definitions.types.infer.enabled\n ? plugin.registerSymbol({\n exported: true,\n kind: 'type',\n meta: {\n category: 'type',\n path: state.path.value,\n resource: 'definition',\n resourceId: $ref,\n tags: state.tags?.value,\n tool: 'zod',\n variant: 'infer',\n },\n name: buildName({\n config: plugin.config.definitions.types.infer,\n name: baseName,\n }),\n })\n : undefined;\n exportAst({\n ast,\n plugin,\n schema,\n symbol,\n typeInferSymbol,\n });\n};\n\nexport const handlerV4: ZodPlugin['Handler'] = ({ plugin }) => {\n plugin.registerSymbol({\n external: getZodModule({ plugin }),\n meta: {\n category: 'external',\n resource: 'zod.z',\n },\n name: 'z',\n });\n\n plugin.forEach(\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'webhook',\n (event) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path: event._path,\n tags: event.tags,\n });\n switch (event.type) {\n case 'operation':\n irOperationToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n case 'parameter':\n handleComponent({\n plugin,\n schema: event.parameter.schema,\n state,\n });\n break;\n case 'requestBody':\n handleComponent({\n plugin,\n schema: event.requestBody.schema,\n state,\n });\n break;\n case 'schema':\n handleComponent({\n plugin,\n schema: event.schema,\n state,\n });\n break;\n case 'webhook':\n irWebhookToAst({\n getAst: (schema, path) => {\n const state = toRefs<PluginState>({\n hasLazyExpression: false,\n path,\n tags: event.tags,\n });\n return irSchemaToAst({ plugin, schema, state });\n },\n operation: event.operation,\n plugin,\n state,\n });\n break;\n }\n },\n );\n};\n","import { handlerMini } from './mini/plugin';\nimport type { ZodPlugin } from './types';\nimport { handlerV3 } from './v3/plugin';\nimport { handlerV4 } from './v4/plugin';\n\nexport const handler: ZodPlugin['Handler'] = (args) => {\n const { plugin } = args;\n switch (plugin.config.compatibilityVersion) {\n case 3:\n return handlerV3(args);\n case 'mini':\n return handlerMini(args);\n case 4:\n default:\n return handlerV4(args);\n }\n};\n","import colors from 'ansi-colors';\n\nimport { definePluginConfig, mappers } from '~/plugins/shared/utils/config';\n\nimport { Api } from './api';\nimport { handler } from './plugin';\nimport type { ZodPlugin } from './types';\n\ntype CompatibilityVersion = NonNullable<\n ZodPlugin['Config']['config']['compatibilityVersion']\n>;\n\nexport const defaultConfig: ZodPlugin['Config'] = {\n api: new Api(),\n config: {\n case: 'camelCase',\n comments: true,\n exportFromIndex: false,\n metadata: false,\n },\n handler,\n name: 'zod',\n resolveConfig: (plugin, context) => {\n const packageName = 'zod';\n const version = context.package.getVersion(packageName);\n\n const inferCompatibleVersion = (): CompatibilityVersion => {\n if (version && (version.major === 4 || version.major === 3)) {\n return version.major;\n }\n\n // default compatibility version\n return 4;\n };\n\n const ensureCompatibleVersion = (\n compatibilityVersion: CompatibilityVersion | undefined,\n ): CompatibilityVersion => {\n if (!compatibilityVersion) {\n return inferCompatibleVersion();\n }\n\n if (!version) {\n return compatibilityVersion;\n }\n\n if (\n compatibilityVersion === 4 ||\n compatibilityVersion === 3 ||\n compatibilityVersion === 'mini'\n ) {\n if (!context.package.satisfies(version, '>=3.25.0 <5.0.0')) {\n const compatibleVersion = inferCompatibleVersion();\n console.warn(\n `🔌 ${colors.yellow('Warning:')} Installed ${colors.cyan(packageName)} ${colors.cyan(`v${version.version}`)} does not support compatibility version ${colors.yellow(String(compatibilityVersion))}, using ${colors.yellow(String(compatibleVersion))}.`,\n );\n return compatibleVersion;\n }\n }\n\n return compatibilityVersion;\n };\n\n plugin.config.compatibilityVersion = ensureCompatibleVersion(\n plugin.config.compatibilityVersion,\n );\n\n plugin.config.dates = context.valueToObject({\n defaultValue: {\n local: false,\n offset: false,\n },\n value: plugin.config.dates,\n });\n\n plugin.config.types = context.valueToObject({\n defaultValue: {\n infer: {\n case: 'PascalCase',\n enabled: false,\n },\n },\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: plugin.config.types,\n });\n\n plugin.config.definitions = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'z{{name}}',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}ZodType',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.definitions,\n });\n\n plugin.config.requests = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'z{{name}}Data',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}DataZodType',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.requests,\n });\n\n plugin.config.responses = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'z{{name}}Response',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}ResponseZodType',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.responses,\n });\n\n plugin.config.webhooks = context.valueToObject({\n defaultValue: {\n case: plugin.config.case ?? 'camelCase',\n enabled: true,\n name: 'z{{name}}WebhookRequest',\n types: {\n ...plugin.config.types,\n infer: {\n ...(plugin.config.types.infer as Extract<\n typeof plugin.config.types.infer,\n Record<string, unknown>\n >),\n name: '{{name}}WebhookRequestZodType',\n },\n },\n },\n mappers: {\n ...mappers,\n object: (fields, defaultValue) => ({\n ...fields,\n types: context.valueToObject({\n defaultValue: defaultValue.types!,\n mappers: {\n object: (fields, defaultValue) => ({\n ...fields,\n infer: context.valueToObject({\n defaultValue: {\n ...(defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >),\n enabled:\n fields.infer !== undefined\n ? Boolean(fields.infer)\n : (\n defaultValue.infer as Extract<\n typeof defaultValue.infer,\n Record<string, unknown>\n >\n ).enabled,\n },\n mappers,\n value: fields.infer,\n }),\n }),\n },\n value: fields.types,\n }),\n }),\n },\n value: plugin.config.webhooks,\n });\n },\n tags: ['validator'],\n};\n\n/**\n * Type helper for Zod plugin, returns {@link Plugin.Config} object\n */\nexport const defineConfig = definePluginConfig(defaultConfig);\n","import type { Plugin } from '~/plugins';\nimport type { AngularCommonPlugin } from '~/plugins/@angular/common';\nimport { defaultConfig as angularCommon } from '~/plugins/@angular/common';\nimport type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular';\nimport { defaultConfig as heyApiClientAngular } from '~/plugins/@hey-api/client-angular';\nimport type { HeyApiClientAxiosPlugin } from '~/plugins/@hey-api/client-axios';\nimport { defaultConfig as heyApiClientAxios } from '~/plugins/@hey-api/client-axios';\nimport type { HeyApiClientFetchPlugin } from '~/plugins/@hey-api/client-fetch';\nimport { defaultConfig as heyApiClientFetch } from '~/plugins/@hey-api/client-fetch';\nimport type { HeyApiClientNextPlugin } from '~/plugins/@hey-api/client-next';\nimport { defaultConfig as heyApiClientNext } from '~/plugins/@hey-api/client-next';\nimport type { HeyApiClientNuxtPlugin } from '~/plugins/@hey-api/client-nuxt';\nimport { defaultConfig as heyApiClientNuxt } from '~/plugins/@hey-api/client-nuxt';\nimport type { HeyApiClientOfetchPlugin } from '~/plugins/@hey-api/client-ofetch';\nimport { defaultConfig as heyApiClientOfetch } from '~/plugins/@hey-api/client-ofetch';\nimport type { HeyApiSchemasPlugin } from '~/plugins/@hey-api/schemas';\nimport { defaultConfig as heyApiSchemas } from '~/plugins/@hey-api/schemas';\nimport type { HeyApiSdkPlugin } from '~/plugins/@hey-api/sdk';\nimport { defaultConfig as heyApiSdk } from '~/plugins/@hey-api/sdk';\nimport type { HeyApiTransformersPlugin } from '~/plugins/@hey-api/transformers';\nimport { defaultConfig as heyApiTransformers } from '~/plugins/@hey-api/transformers';\nimport type { HeyApiTypeScriptPlugin } from '~/plugins/@hey-api/typescript';\nimport { defaultConfig as heyApiTypeScript } from '~/plugins/@hey-api/typescript';\nimport type { PiniaColadaPlugin } from '~/plugins/@pinia/colada';\nimport { defaultConfig as piniaColada } from '~/plugins/@pinia/colada';\nimport type { TanStackAngularQueryPlugin } from '~/plugins/@tanstack/angular-query-experimental';\nimport { defaultConfig as tanStackAngularQuery } from '~/plugins/@tanstack/angular-query-experimental';\nimport type { TanStackReactQueryPlugin } from '~/plugins/@tanstack/react-query';\nimport { defaultConfig as tanStackReactQuery } from '~/plugins/@tanstack/react-query';\nimport type { TanStackSolidQueryPlugin } from '~/plugins/@tanstack/solid-query';\nimport { defaultConfig as tanStackSolidQuery } from '~/plugins/@tanstack/solid-query';\nimport type { TanStackSvelteQueryPlugin } from '~/plugins/@tanstack/svelte-query';\nimport { defaultConfig as tanStackSvelteQuery } from '~/plugins/@tanstack/svelte-query';\nimport type { TanStackVueQueryPlugin } from '~/plugins/@tanstack/vue-query';\nimport { defaultConfig as tanStackVueQuery } from '~/plugins/@tanstack/vue-query';\nimport type { ArktypePlugin } from '~/plugins/arktype';\nimport { defaultConfig as arktype } from '~/plugins/arktype';\nimport type { FastifyPlugin } from '~/plugins/fastify';\nimport { defaultConfig as fastify } from '~/plugins/fastify';\nimport type { PluginNames } from '~/plugins/types';\nimport type { ValibotPlugin } from '~/plugins/valibot';\nimport { defaultConfig as valibot } from '~/plugins/valibot';\nimport type { ZodPlugin } from '~/plugins/zod';\nimport { defaultConfig as zod } from '~/plugins/zod';\n\nexport interface PluginConfigMap {\n '@angular/common': AngularCommonPlugin['Types'];\n '@hey-api/client-angular': HeyApiClientAngularPlugin['Types'];\n '@hey-api/client-axios': HeyApiClientAxiosPlugin['Types'];\n '@hey-api/client-fetch': HeyApiClientFetchPlugin['Types'];\n '@hey-api/client-next': HeyApiClientNextPlugin['Types'];\n '@hey-api/client-nuxt': HeyApiClientNuxtPlugin['Types'];\n '@hey-api/client-ofetch': HeyApiClientOfetchPlugin['Types'];\n '@hey-api/schemas': HeyApiSchemasPlugin['Types'];\n '@hey-api/sdk': HeyApiSdkPlugin['Types'];\n '@hey-api/transformers': HeyApiTransformersPlugin['Types'];\n '@hey-api/typescript': HeyApiTypeScriptPlugin['Types'];\n '@pinia/colada': PiniaColadaPlugin['Types'];\n '@tanstack/angular-query-experimental': TanStackAngularQueryPlugin['Types'];\n '@tanstack/react-query': TanStackReactQueryPlugin['Types'];\n '@tanstack/solid-query': TanStackSolidQueryPlugin['Types'];\n '@tanstack/svelte-query': TanStackSvelteQueryPlugin['Types'];\n '@tanstack/vue-query': TanStackVueQueryPlugin['Types'];\n arktype: ArktypePlugin['Types'];\n fastify: FastifyPlugin['Types'];\n valibot: ValibotPlugin['Types'];\n zod: ZodPlugin['Types'];\n}\n\nexport const defaultPluginConfigs: {\n [K in PluginNames]: Plugin.Config<PluginConfigMap[K]>;\n} = {\n '@angular/common': angularCommon,\n '@hey-api/client-angular': heyApiClientAngular,\n '@hey-api/client-axios': heyApiClientAxios,\n '@hey-api/client-fetch': heyApiClientFetch,\n '@hey-api/client-next': heyApiClientNext,\n '@hey-api/client-nuxt': heyApiClientNuxt,\n '@hey-api/client-ofetch': heyApiClientOfetch,\n '@hey-api/schemas': heyApiSchemas,\n '@hey-api/sdk': heyApiSdk,\n '@hey-api/transformers': heyApiTransformers,\n '@hey-api/typescript': heyApiTypeScript,\n '@pinia/colada': piniaColada,\n '@tanstack/angular-query-experimental': tanStackAngularQuery,\n '@tanstack/react-query': tanStackReactQuery,\n '@tanstack/solid-query': tanStackSolidQuery,\n '@tanstack/svelte-query': tanStackSvelteQuery,\n '@tanstack/vue-query': tanStackVueQuery,\n arktype,\n fastify,\n valibot,\n zod,\n};\n","import { defaultPluginConfigs } from '~/plugins/config';\nimport type {\n AnyPluginName,\n PluginContext,\n PluginNames,\n} from '~/plugins/types';\nimport type { Config, UserConfig } from '~/types/config';\n\nimport { valueToObject } from './utils/config';\nimport { packageFactory } from './utils/package';\n\n/**\n * Default plugins used to generate artifacts if plugins aren't specified.\n */\nexport const defaultPlugins = [\n '@hey-api/typescript',\n '@hey-api/sdk',\n] as const satisfies ReadonlyArray<PluginNames>;\n\nconst getPluginsConfig = ({\n dependencies,\n userPlugins,\n userPluginsConfig,\n}: {\n dependencies: Record<string, string>;\n userPlugins: ReadonlyArray<AnyPluginName>;\n userPluginsConfig: Config['plugins'];\n}): Pick<Config, 'plugins' | 'pluginOrder'> => {\n const circularReferenceTracker = new Set<AnyPluginName>();\n const pluginOrder = new Set<AnyPluginName>();\n const plugins: Config['plugins'] = {};\n\n const dfs = (name: AnyPluginName) => {\n if (circularReferenceTracker.has(name)) {\n throw new Error(`Circular reference detected at '${name}'`);\n }\n\n if (pluginOrder.has(name)) {\n return;\n }\n\n circularReferenceTracker.add(name);\n\n const defaultPlugin = defaultPluginConfigs[name as PluginNames];\n const userPlugin = userPluginsConfig[name as PluginNames];\n\n if (!defaultPlugin && !userPlugin) {\n throw new Error(\n `unknown plugin dependency \"${name}\" - do you need to register a custom plugin with this name?`,\n );\n }\n\n const plugin = {\n ...defaultPlugin,\n ...userPlugin,\n config: {\n ...defaultPlugin?.config,\n ...userPlugin?.config,\n },\n dependencies: new Set([\n ...(defaultPlugin?.dependencies || []),\n ...(userPlugin?.dependencies || []),\n ]),\n };\n\n if (plugin.resolveConfig) {\n const context: PluginContext = {\n package: packageFactory(dependencies),\n pluginByTag: (tag, props = {}) => {\n const { defaultPlugin, errorMessage } = props;\n\n for (const userPlugin of userPlugins) {\n const defaultConfig =\n defaultPluginConfigs[userPlugin as PluginNames] ||\n userPluginsConfig[userPlugin as PluginNames];\n if (\n defaultConfig &&\n defaultConfig.tags?.includes(tag) &&\n userPlugin !== name\n ) {\n return userPlugin as any;\n }\n }\n\n if (defaultPlugin) {\n const defaultConfig =\n defaultPluginConfigs[defaultPlugin as PluginNames] ||\n userPluginsConfig[defaultPlugin as PluginNames];\n if (\n defaultConfig &&\n defaultConfig.tags?.includes(tag) &&\n defaultPlugin !== name\n ) {\n return defaultPlugin;\n }\n }\n\n throw new Error(\n errorMessage ||\n `missing plugin - no plugin with tag \"${tag}\" found`,\n );\n },\n valueToObject,\n };\n // @ts-expect-error\n plugin.resolveConfig(plugin, context);\n }\n\n for (const dependency of plugin.dependencies) {\n dfs(dependency);\n }\n\n circularReferenceTracker.delete(name);\n pluginOrder.add(name);\n\n // @ts-expect-error\n plugins[name] = plugin;\n };\n\n for (const name of userPlugins) {\n dfs(name);\n }\n\n return {\n pluginOrder: Array.from(pluginOrder) as ReadonlyArray<PluginNames>,\n plugins,\n };\n};\n\nconst isPluginClient = (plugin: Required<UserConfig>['plugins'][number]) => {\n if (typeof plugin === 'string') {\n return plugin.startsWith('@hey-api/client');\n }\n\n return (\n plugin.name.startsWith('@hey-api/client') ||\n // @ts-expect-error\n (plugin.tags && plugin.tags.includes('client'))\n );\n};\n\nexport const getPlugins = ({\n dependencies,\n userConfig,\n}: {\n dependencies: Record<string, string>;\n userConfig: UserConfig;\n}): Pick<Config, 'plugins' | 'pluginOrder'> => {\n const userPluginsConfig: Config['plugins'] = {};\n\n let definedPlugins: UserConfig['plugins'] = defaultPlugins;\n\n if (userConfig.plugins) {\n userConfig.plugins = userConfig.plugins.filter(\n (plugin) =>\n (typeof plugin === 'string' && plugin) ||\n (typeof plugin !== 'string' && plugin.name),\n );\n if (\n userConfig.plugins.length === 1 &&\n isPluginClient(userConfig.plugins[0]!)\n ) {\n definedPlugins = [...defaultPlugins, ...userConfig.plugins];\n } else {\n definedPlugins = userConfig.plugins;\n }\n }\n\n const userPlugins = definedPlugins\n .map((plugin) => {\n if (typeof plugin === 'string') {\n return plugin;\n }\n\n const pluginName = plugin.name;\n\n if (pluginName) {\n // @ts-expect-error\n if (plugin.handler) {\n // @ts-expect-error\n userPluginsConfig[pluginName] = plugin;\n } else {\n // @ts-expect-error\n userPluginsConfig[pluginName] = {\n config: { ...plugin },\n };\n // @ts-expect-error\n delete userPluginsConfig[pluginName]!.config.name;\n }\n }\n\n return pluginName;\n })\n .filter(Boolean);\n\n return getPluginsConfig({ dependencies, userPlugins, userPluginsConfig });\n};\n","import path from 'node:path';\n\nimport colors from 'ansi-colors';\n\nimport { ConfigError } from '~/error';\nimport type { Config, UserConfig } from '~/types/config';\nimport type { ArrayOnly } from '~/types/utils';\nimport type { Logger } from '~/utils/logger';\n\nimport { getInput } from './input';\nimport { getLogs } from './logs';\nimport { mergeConfigs } from './merge';\nimport { getOutput } from './output';\nimport { getProjectDependencies } from './packages';\nimport { getParser } from './parser';\nimport { getPlugins } from './plugins';\n\ntype ConfigResult = {\n config: Config;\n errors: ReadonlyArray<Error>;\n jobIndex: number;\n};\n\nexport type Configs = {\n dependencies: Record<string, string>;\n results: ReadonlyArray<ConfigResult>;\n};\n\n/**\n * Detect if the current session is interactive based on TTY status and environment variables.\n * This is used as a fallback when the user doesn't explicitly set the interactive option.\n * @internal\n */\nexport const detectInteractiveSession = (): boolean =>\n Boolean(\n process.stdin.isTTY &&\n process.stdout.isTTY &&\n !process.env.CI &&\n !process.env.NO_INTERACTIVE &&\n !process.env.NO_INTERACTION,\n );\n\n/**\n * @internal\n */\nexport const initConfigs = async ({\n logger,\n userConfigs,\n}: {\n logger: Logger;\n userConfigs: ReadonlyArray<UserConfig>;\n}): Promise<Configs> => {\n const configs: Array<UserConfig> = [];\n let dependencies: Record<string, string> = {};\n\n const eventLoad = logger.timeEvent('load');\n for (const userConfig of userConfigs) {\n let configurationFile: string | undefined = undefined;\n if (userConfig?.configFile) {\n const parts = userConfig.configFile.split('.');\n configurationFile = parts.slice(0, parts.length - 1).join('.');\n }\n\n const eventC12 = logger.timeEvent('c12');\n // c12 is ESM-only since v3\n const { loadConfig } = await import('c12');\n const { config: configFromFile, configFile: loadedConfigFile } =\n await loadConfig<UserConfig>({\n configFile: configurationFile,\n name: 'openapi-ts',\n });\n eventC12.timeEnd();\n\n if (!Object.keys(dependencies).length) {\n // TODO: handle dependencies for multiple configs properly?\n dependencies = getProjectDependencies(\n Object.keys(configFromFile).length ? loadedConfigFile : undefined,\n );\n }\n\n const mergedConfigs =\n configFromFile instanceof Array\n ? configFromFile.map((config) => mergeConfigs(config, userConfig))\n : [mergeConfigs(configFromFile, userConfig)];\n\n for (const mergedConfig of mergedConfigs) {\n const input = getInput(mergedConfig);\n\n if (mergedConfig.output instanceof Array) {\n const countInputs = input.length;\n const countOutputs = mergedConfig.output.length;\n if (countOutputs > 1) {\n if (countInputs !== countOutputs) {\n console.warn(\n `⚙️ ${colors.yellow('Warning:')} You provided ${colors.cyan(String(countInputs))} ${colors.cyan(countInputs === 1 ? 'input' : 'inputs')} and ${colors.yellow(String(countOutputs))} ${colors.yellow('outputs')}. This is probably not what you want as it will produce identical output in multiple locations. You most likely want to provide a single output or the same number of outputs as inputs.`,\n );\n for (const output of mergedConfig.output) {\n configs.push({ ...mergedConfig, input, output });\n }\n } else {\n mergedConfig.output.forEach((output, index) => {\n configs.push({ ...mergedConfig, input: input[index]!, output });\n });\n }\n } else {\n configs.push({\n ...mergedConfig,\n input,\n output: mergedConfig.output[0] ?? '',\n });\n }\n } else {\n configs.push({ ...mergedConfig, input });\n }\n }\n }\n eventLoad.timeEnd();\n\n const results: Array<ArrayOnly<ConfigResult>> = [];\n\n const eventBuild = logger.timeEvent('build');\n for (const userConfig of configs) {\n const logs = getLogs(userConfig);\n const input = getInput(userConfig);\n const output = getOutput(userConfig);\n const parser = getParser(userConfig);\n\n const errors: Array<Error> = [];\n\n if (!input.length) {\n errors.push(\n new ConfigError(\n 'missing input - which OpenAPI specification should we use to generate your output?',\n ),\n );\n }\n\n if (!output.path) {\n errors.push(\n new ConfigError(\n 'missing output - where should we generate your output?',\n ),\n );\n }\n\n output.path = path.resolve(process.cwd(), output.path);\n\n let plugins: Pick<Config, 'plugins' | 'pluginOrder'>;\n\n try {\n plugins = getPlugins({ dependencies, userConfig });\n } catch (error) {\n errors.push(error);\n plugins = {\n pluginOrder: [],\n plugins: {},\n };\n }\n\n const config: Config = {\n configFile: userConfig.configFile ?? '',\n dryRun: userConfig.dryRun ?? false,\n input,\n interactive: userConfig.interactive ?? detectInteractiveSession(),\n logs,\n output,\n parser,\n pluginOrder: plugins.pluginOrder,\n plugins: plugins.plugins,\n };\n\n const jobIndex = results.length;\n\n if (logs.level === 'debug') {\n const jobPrefix = colors.gray(`[Job ${jobIndex + 1}] `);\n console.warn(`${jobPrefix}${colors.cyan('config:')}`, config);\n }\n\n results.push({ config, errors, jobIndex });\n }\n eventBuild.timeEnd();\n\n return { dependencies, results };\n};\n","type Slot = 'body' | 'headers' | 'path' | 'query';\n\nexport type Field =\n | {\n in: Exclude<Slot, 'body'>;\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string;\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If omitted, we use the same value as `key`.\n */\n map?: string;\n }\n | {\n in: Extract<Slot, 'body'>;\n /**\n * Key isn't required for bodies.\n */\n key?: string;\n map?: string;\n }\n | {\n /**\n * Field name. This is the name we want the user to see and use.\n */\n key: string;\n /**\n * Field mapped name. This is the name we want to use in the request.\n * If `in` is omitted, `map` aliases `key` to the transport layer.\n */\n map: Slot;\n };\n\nexport interface Fields {\n allowExtra?: Partial<Record<Slot, boolean>>;\n args?: ReadonlyArray<Field>;\n}\n\nexport type FieldsConfig = ReadonlyArray<Field | Fields>;\n\nconst extraPrefixesMap: Record<string, Slot> = {\n $body_: 'body',\n $headers_: 'headers',\n $path_: 'path',\n $query_: 'query',\n};\nconst extraPrefixes = Object.entries(extraPrefixesMap);\n\ntype KeyMap = Map<\n string,\n | {\n in: Slot;\n map?: string;\n }\n | {\n in?: never;\n map: Slot;\n }\n>;\n\nconst buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => {\n if (!map) {\n map = new Map();\n }\n\n for (const config of fields) {\n if ('in' in config) {\n if (config.key) {\n map.set(config.key, {\n in: config.in,\n map: config.map,\n });\n }\n } else if ('key' in config) {\n map.set(config.key, {\n map: config.map,\n });\n } else if (config.args) {\n buildKeyMap(config.args, map);\n }\n }\n\n return map;\n};\n\ninterface Params {\n body: unknown;\n headers: Record<string, unknown>;\n path: Record<string, unknown>;\n query: Record<string, unknown>;\n}\n\nconst stripEmptySlots = (params: Params) => {\n for (const [slot, value] of Object.entries(params)) {\n if (value && typeof value === 'object' && !Object.keys(value).length) {\n delete params[slot as Slot];\n }\n }\n};\n\nexport const buildClientParams = (\n args: ReadonlyArray<unknown>,\n fields: FieldsConfig,\n) => {\n const params: Params = {\n body: {},\n headers: {},\n path: {},\n query: {},\n };\n\n const map = buildKeyMap(fields);\n\n let config: FieldsConfig[number] | undefined;\n\n for (const [index, arg] of args.entries()) {\n if (fields[index]) {\n config = fields[index];\n }\n\n if (!config) {\n continue;\n }\n\n if ('in' in config) {\n if (config.key) {\n const field = map.get(config.key)!;\n const name = field.map || config.key;\n if (field.in) {\n (params[field.in] as Record<string, unknown>)[name] = arg;\n }\n } else {\n params.body = arg;\n }\n } else {\n for (const [key, value] of Object.entries(arg ?? {})) {\n const field = map.get(key);\n\n if (field) {\n if (field.in) {\n const name = field.map || key;\n (params[field.in] as Record<string, unknown>)[name] = value;\n } else {\n params[field.map] = value;\n }\n } else {\n const extra = extraPrefixes.find(([prefix]) =>\n key.startsWith(prefix),\n );\n\n if (extra) {\n const [prefix, slot] = extra;\n (params[slot] as Record<string, unknown>)[\n key.slice(prefix.length)\n ] = value;\n } else if ('allowExtra' in config && config.allowExtra) {\n for (const [slot, allowed] of Object.entries(config.allowExtra)) {\n if (allowed) {\n (params[slot as Slot] as Record<string, unknown>)[key] = value;\n break;\n }\n }\n }\n }\n }\n }\n }\n\n stripEmptySlots(params);\n\n return params;\n};\n","interface SerializeOptions<T>\n extends SerializePrimitiveOptions,\n SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean;\n name: string;\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean;\n style: T;\n}\n\nexport type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle;\ntype MatrixStyle = 'label' | 'matrix' | 'simple';\nexport type ObjectStyle = 'form' | 'deepObject';\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle;\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string;\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case 'form':\n return ',';\n case 'pipeDelimited':\n return '|';\n case 'spaceDelimited':\n return '%20';\n default:\n return ',';\n }\n};\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle) => {\n switch (style) {\n case 'label':\n return '.';\n case 'matrix':\n return ';';\n case 'simple':\n return ',';\n default:\n return '&';\n }\n};\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[];\n}) => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style));\n switch (style) {\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n case 'simple':\n return joinedValues;\n default:\n return `${name}=${joinedValues}`;\n }\n }\n\n const separator = separatorArrayExplode(style);\n const joinedValues = value\n .map((v) => {\n if (style === 'label' || style === 'simple') {\n return allowReserved ? v : encodeURIComponent(v as string);\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n });\n })\n .join(separator);\n return style === 'label' || style === 'matrix'\n ? separator + joinedValues\n : joinedValues;\n};\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam) => {\n if (value === undefined || value === null) {\n return '';\n }\n\n if (typeof value === 'object') {\n throw new Error(\n 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.',\n );\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;\n};\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date;\n valueOnly?: boolean;\n}) => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;\n }\n\n if (style !== 'deepObject' && !explode) {\n let values: string[] = [];\n Object.entries(value).forEach(([key, v]) => {\n values = [\n ...values,\n key,\n allowReserved ? (v as string) : encodeURIComponent(v as string),\n ];\n });\n const joinedValues = values.join(',');\n switch (style) {\n case 'form':\n return `${name}=${joinedValues}`;\n case 'label':\n return `.${joinedValues}`;\n case 'matrix':\n return `;${name}=${joinedValues}`;\n default:\n return joinedValues;\n }\n }\n\n const separator = separatorObjectExplode(style);\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === 'deepObject' ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator);\n return style === 'label' || style === 'matrix'\n ? separator + joinedValues\n : joinedValues;\n};\n","import { getAuthToken } from '../../client-core/bundle/auth';\nimport type { QuerySerializerOptions } from '../../client-core/bundle/bodySerializer';\nimport { jsonBodySerializer } from '../../client-core/bundle/bodySerializer';\nimport {\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from '../../client-core/bundle/pathSerializer';\nimport { getUrl } from '../../client-core/bundle/utils';\nimport type { Client, ClientOptions, Config, RequestOptions } from './types';\n\nexport const createQuerySerializer = <T = unknown>({\n parameters = {},\n ...args\n}: QuerySerializerOptions = {}) => {\n const querySerializer = (queryParams: T) => {\n const search: string[] = [];\n if (queryParams && typeof queryParams === 'object') {\n for (const name in queryParams) {\n const value = queryParams[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n const options = parameters[name] || args;\n\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'form',\n value,\n ...options.array,\n });\n if (serializedArray) search.push(serializedArray);\n } else if (typeof value === 'object') {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: 'deepObject',\n value: value as Record<string, unknown>,\n ...options.object,\n });\n if (serializedObject) search.push(serializedObject);\n } else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value as string,\n });\n if (serializedPrimitive) search.push(serializedPrimitive);\n }\n }\n }\n return search.join('&');\n };\n return querySerializer;\n};\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (\n contentType: string | null,\n): Exclude<Config['parseAs'], 'auto'> => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return 'stream';\n }\n\n const cleanContent = contentType.split(';')[0]?.trim();\n\n if (!cleanContent) {\n return;\n }\n\n if (\n cleanContent.startsWith('application/json') ||\n cleanContent.endsWith('+json')\n ) {\n return 'json';\n }\n\n if (cleanContent === 'multipart/form-data') {\n return 'formData';\n }\n\n if (\n ['application/', 'audio/', 'image/', 'video/'].some((type) =>\n cleanContent.startsWith(type),\n )\n ) {\n return 'blob';\n }\n\n if (cleanContent.startsWith('text/')) {\n return 'text';\n }\n\n return;\n};\n\nconst checkForExistence = (\n options: Pick<RequestOptions, 'auth' | 'query'> & {\n headers: Headers;\n },\n name?: string,\n): boolean => {\n if (!name) {\n return false;\n }\n if (\n options.headers.has(name) ||\n options.query?.[name] ||\n options.headers.get('Cookie')?.includes(`${name}=`)\n ) {\n return true;\n }\n return false;\n};\n\nexport const setAuthParams = async ({\n security,\n ...options\n}: Pick<Required<RequestOptions>, 'security'> &\n Pick<RequestOptions, 'auth' | 'query'> & {\n headers: Headers;\n }) => {\n for (const auth of security) {\n if (checkForExistence(options, auth.name)) {\n continue;\n }\n\n const token = await getAuthToken(auth, options.auth);\n\n if (!token) {\n continue;\n }\n\n const name = auth.name ?? 'Authorization';\n\n switch (auth.in) {\n case 'query':\n if (!options.query) {\n options.query = {};\n }\n options.query[name] = token;\n break;\n case 'cookie':\n options.headers.append('Cookie', `${name}=${token}`);\n break;\n case 'header':\n default:\n options.headers.set(name, token);\n break;\n }\n }\n};\n\nexport const buildUrl: Client['buildUrl'] = (options) =>\n getUrl({\n baseUrl: options.baseUrl as string,\n path: options.path,\n query: options.query,\n querySerializer:\n typeof options.querySerializer === 'function'\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n });\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n const config = { ...a, ...b };\n if (config.baseUrl?.endsWith('/')) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);\n }\n config.headers = mergeHeaders(a.headers, b.headers);\n return config;\n};\n\nconst headersEntries = (headers: Headers): Array<[string, string]> => {\n const entries: Array<[string, string]> = [];\n headers.forEach((value, key) => {\n entries.push([key, value]);\n });\n return entries;\n};\n\nexport const mergeHeaders = (\n ...headers: Array<Required<Config>['headers'] | undefined>\n): Headers => {\n const mergedHeaders = new Headers();\n for (const header of headers) {\n if (!header) {\n continue;\n }\n\n const iterator =\n header instanceof Headers\n ? headersEntries(header)\n : Object.entries(header);\n\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v as string);\n }\n } else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e. their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(\n key,\n typeof value === 'object' ? JSON.stringify(value) : (value as string),\n );\n }\n }\n }\n return mergedHeaders;\n};\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n error: Err,\n response: Res,\n request: Req,\n options: Options,\n) => Err | Promise<Err>;\n\ntype ReqInterceptor<Req, Options> = (\n request: Req,\n options: Options,\n) => Req | Promise<Req>;\n\ntype ResInterceptor<Res, Req, Options> = (\n response: Res,\n request: Req,\n options: Options,\n) => Res | Promise<Res>;\n\nclass Interceptors<Interceptor> {\n fns: Array<Interceptor | null> = [];\n\n clear(): void {\n this.fns = [];\n }\n\n eject(id: number | Interceptor): void {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = null;\n }\n }\n\n exists(id: number | Interceptor): boolean {\n const index = this.getInterceptorIndex(id);\n return Boolean(this.fns[index]);\n }\n\n getInterceptorIndex(id: number | Interceptor): number {\n if (typeof id === 'number') {\n return this.fns[id] ? id : -1;\n }\n return this.fns.indexOf(id);\n }\n\n update(\n id: number | Interceptor,\n fn: Interceptor,\n ): number | Interceptor | false {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = fn;\n return id;\n }\n return false;\n }\n\n use(fn: Interceptor): number {\n this.fns.push(fn);\n return this.fns.length - 1;\n }\n}\n\nexport interface Middleware<Req, Res, Err, Options> {\n error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;\n request: Interceptors<ReqInterceptor<Req, Options>>;\n response: Interceptors<ResInterceptor<Res, Req, Options>>;\n}\n\nexport const createInterceptors = <Req, Res, Err, Options>(): Middleware<\n Req,\n Res,\n Err,\n Options\n> => ({\n error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n request: new Interceptors<ReqInterceptor<Req, Options>>(),\n response: new Interceptors<ResInterceptor<Res, Req, Options>>(),\n});\n\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: 'form',\n },\n object: {\n explode: true,\n style: 'deepObject',\n },\n});\n\nconst defaultHeaders = {\n 'Content-Type': 'application/json',\n};\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n override: Config<Omit<ClientOptions, keyof T> & T> = {},\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: 'auto',\n querySerializer: defaultQuerySerializer,\n ...override,\n});\n","import { getResolvedInput, sendRequest } from '@hey-api/json-schema-ref-parser';\n\nimport { mergeHeaders } from '~/plugins/@hey-api/client-fetch/bundle';\nimport type { Input } from '~/types/input';\nimport type { WatchValues } from '~/types/types';\n\ntype SpecResponse = {\n arrayBuffer: ArrayBuffer | undefined;\n error?: never;\n resolvedInput: ReturnType<typeof getResolvedInput>;\n response?: never;\n};\n\ntype SpecError = {\n arrayBuffer?: never;\n error: 'not-modified' | 'not-ok';\n resolvedInput?: never;\n response: Response;\n};\n\n/**\n * @internal\n */\nexport const getSpec = async ({\n fetchOptions,\n inputPath,\n timeout,\n watch,\n}: {\n fetchOptions?: RequestInit;\n inputPath: Input['path'];\n timeout: number | undefined;\n watch: WatchValues;\n}): Promise<SpecResponse | SpecError> => {\n const resolvedInput = getResolvedInput({ pathOrUrlOrSchema: inputPath });\n\n let arrayBuffer: ArrayBuffer | undefined;\n // boolean signals whether the file has **definitely** changed\n let hasChanged: boolean | undefined;\n let response: Response | undefined;\n\n if (resolvedInput.type === 'url') {\n // do NOT send HEAD request on first run or if unsupported\n if (watch.lastValue && watch.isHeadMethodSupported !== false) {\n try {\n const request = await sendRequest({\n fetchOptions: {\n method: 'HEAD',\n ...fetchOptions,\n headers: mergeHeaders(fetchOptions?.headers, watch.headers),\n },\n timeout,\n url: resolvedInput.path,\n });\n\n if (request.response.status >= 300) {\n return {\n error: 'not-ok',\n response: request.response,\n };\n }\n\n response = request.response;\n } catch (error) {\n return {\n error: 'not-ok',\n response: new Response(error.message),\n };\n }\n\n if (!response.ok && watch.isHeadMethodSupported) {\n // assume the server is no longer running\n // do nothing, it might be restarted later\n return {\n error: 'not-ok',\n response,\n };\n }\n\n if (watch.isHeadMethodSupported === undefined) {\n watch.isHeadMethodSupported = response.ok;\n }\n\n if (response.status === 304) {\n return {\n error: 'not-modified',\n response,\n };\n }\n\n if (hasChanged === undefined) {\n const eTag = response.headers.get('ETag');\n if (eTag) {\n hasChanged = eTag !== watch.headers.get('If-None-Match');\n\n if (hasChanged) {\n watch.headers.set('If-None-Match', eTag);\n }\n }\n }\n\n if (hasChanged === undefined) {\n const lastModified = response.headers.get('Last-Modified');\n if (lastModified) {\n hasChanged = lastModified !== watch.headers.get('If-Modified-Since');\n\n if (hasChanged) {\n watch.headers.set('If-Modified-Since', lastModified);\n }\n }\n }\n\n // we definitely know the input has not changed\n if (hasChanged === false) {\n return {\n error: 'not-modified',\n response,\n };\n }\n }\n\n try {\n const request = await sendRequest({\n fetchOptions: {\n method: 'GET',\n ...fetchOptions,\n },\n timeout,\n url: resolvedInput.path,\n });\n\n if (request.response.status >= 300) {\n return {\n error: 'not-ok',\n response: request.response,\n };\n }\n\n response = request.response;\n } catch (error) {\n return {\n error: 'not-ok',\n response: new Response(error.message),\n };\n }\n\n if (!response.ok) {\n // assume the server is no longer running\n // do nothing, it might be restarted later\n return {\n error: 'not-ok',\n response,\n };\n }\n\n arrayBuffer = response.body\n ? await response.arrayBuffer()\n : new ArrayBuffer(0);\n\n if (hasChanged === undefined) {\n const content = new TextDecoder().decode(arrayBuffer);\n hasChanged = content !== watch.lastValue;\n watch.lastValue = content;\n }\n } else {\n // we do not support watch mode for files or raw spec data\n if (!watch.lastValue) {\n watch.lastValue = resolvedInput.type;\n } else {\n hasChanged = false;\n }\n }\n\n if (hasChanged === false) {\n return {\n error: 'not-modified',\n response: response!,\n };\n }\n\n return {\n arrayBuffer,\n resolvedInput,\n };\n};\n","import path from 'node:path';\n\nimport type {\n BiMap,\n Binding,\n File,\n IProject,\n ProjectRenderMeta,\n Renderer,\n Symbol,\n} from '@hey-api/codegen-core';\nimport { createBinding, mergeBindings, renderIds } from '@hey-api/codegen-core';\nimport ts from 'typescript';\n\nimport { ensureValidIdentifier } from '~/openApi/shared/utils/identifier';\nimport { tsc } from '~/tsc';\nimport { tsNodeToString } from '~/tsc/utils';\n\nconst nodeBuiltins = new Set([\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'constants',\n 'crypto',\n 'dgram',\n 'dns',\n 'domain',\n 'events',\n 'freelist',\n 'fs',\n 'http',\n 'https',\n 'module',\n 'net',\n 'os',\n 'path',\n 'process',\n 'punycode',\n 'querystring',\n 'readline',\n 'repl',\n 'stream',\n 'string_decoder',\n 'timers',\n 'tls',\n 'tty',\n 'url',\n 'util',\n 'v8',\n 'vm',\n 'worker_threads',\n 'zlib',\n]);\n\nexport class TypeScriptRenderer implements Renderer {\n renderFile(\n symbolsAndExports: string,\n file: File,\n project: IProject,\n meta?: ProjectRenderMeta,\n ): string {\n const imports: Map<string, Binding> = new Map();\n symbolsAndExports = renderIds(symbolsAndExports, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n const replaced = this.replacerFn({ file, project, symbol });\n if (symbol) {\n this.addBinding({ bindings: imports, file, meta, project, symbol });\n }\n return replaced;\n });\n if (!symbolsAndExports.length) return '';\n let output = '';\n const headerLines = this.getHeaderLines();\n output += `${headerLines.join('\\n')}${headerLines.length ? '\\n\\n' : ''}`;\n const importLines = this.getImportLines(imports, file, project);\n output += `${importLines.join('\\n')}${importLines.length ? '\\n\\n' : ''}`;\n return `${output}${symbolsAndExports}`;\n }\n\n renderSymbols(\n file: File,\n project: IProject,\n meta?: ProjectRenderMeta,\n ): string {\n const exports: Map<string, Binding> = new Map();\n let output = '';\n const bodyLines = this.getBodyLines(file, project);\n output += `${bodyLines.join('\\n\\n')}${bodyLines.length ? '\\n' : ''}`;\n output = renderIds(output, (symbolId) => {\n if (!file.symbols.body.includes(symbolId)) return;\n const symbol = project.symbols.get(symbolId);\n return this.replacerFn({ file, project, symbol });\n });\n for (const symbolId of file.symbols.exports) {\n const symbol = project.symbols.get(symbolId);\n if (symbol) {\n this.addBinding({ bindings: exports, file, meta, project, symbol });\n }\n }\n // cast everything into namespace exports for now\n for (const binding of exports.values()) {\n binding.namespaceBinding = true;\n binding.typeNamespaceBinding =\n binding.names &&\n binding.typeNames &&\n binding.names.length === binding.typeNames.length &&\n binding.names.every((name) => (binding.typeNames ?? []).includes(name));\n }\n const exportLines = this.getExportLines(exports, file, project);\n output += `${exportLines.join('\\n')}${exportLines.length ? '\\n' : ''}`;\n return output;\n }\n\n private addBinding({\n bindings,\n file,\n meta,\n project,\n symbol,\n }: {\n bindings: Map<string, Binding>;\n file: File;\n meta?: ProjectRenderMeta;\n project: IProject;\n symbol: Symbol;\n }): void {\n if (!symbol.external && !project.symbols.hasValue(symbol.id)) {\n return;\n }\n\n const [symbolFile] = project.symbolIdToFiles(symbol.id);\n if (!symbolFile || file === symbolFile) return;\n\n const modulePath = this.getBindingPath(file, symbolFile, meta);\n const existing = bindings.get(modulePath);\n const binding = createBinding({\n file,\n modulePath,\n symbol,\n symbolFile,\n });\n if (existing) {\n mergeBindings(existing, binding);\n bindings.set(modulePath, existing);\n } else {\n bindings.set(modulePath, binding);\n }\n }\n\n private getBindingPath(\n currentFile: File,\n symbolFile: File,\n meta?: ProjectRenderMeta,\n ): string {\n if (!currentFile.path || !symbolFile.path) {\n return '';\n }\n if (symbolFile.external && !path.isAbsolute(symbolFile.path)) {\n return symbolFile.path;\n }\n let relativePath = path.posix.relative(\n path.posix.dirname(\n currentFile.path.split(path.sep).join(path.posix.sep), // normalize to posix\n ),\n symbolFile.path.split(path.sep).join(path.posix.sep), // normalize to posix\n );\n if (!relativePath.startsWith('.') && relativePath !== '') {\n relativePath = `./${relativePath}`;\n }\n if (symbolFile.extension === '.ts') {\n if (relativePath.endsWith(symbolFile.extension)) {\n relativePath = relativePath.slice(0, -symbolFile.extension.length);\n }\n if (meta?.importFileExtension) {\n relativePath += meta.importFileExtension;\n } else if (relativePath.endsWith('/index')) {\n relativePath = relativePath.slice(0, -'/index'.length);\n }\n }\n return relativePath;\n }\n\n private getBodyLines(file: File, project: IProject): Array<string> {\n const lines: Array<string> = [];\n\n for (const symbolId of file.symbols.body) {\n const value = project.symbols.getValue(symbolId);\n if (typeof value === 'string') {\n lines.push(value);\n } else if (value instanceof Array) {\n for (const node of value) {\n lines.push(tsNodeToString({ node, unescape: true }));\n }\n } else if (value !== undefined && value !== null) {\n lines.push(tsNodeToString({ node: value as any, unescape: true }));\n }\n }\n\n return lines;\n }\n\n private getExportLines(\n bindings: Map<string, Binding>,\n file: File,\n project: IProject,\n ): Array<string> {\n const lines: Array<string> = [];\n\n for (const [from, value] of bindings.entries()) {\n const specifiers: Array<ts.ExportSpecifier> = [];\n let namespaceBinding: string | undefined;\n let isTypeOnly = false;\n\n if (value.namespaceBinding !== undefined) {\n if (typeof value.namespaceBinding === 'string') {\n namespaceBinding = renderIds(value.namespaceBinding, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n return this.replacerFn({ file, project, symbol });\n });\n }\n if (value.typeNamespaceBinding) {\n isTypeOnly = true;\n }\n } else if (value.names && value.names.length > 0) {\n if (\n value.names.every((name) => (value.typeNames ?? []).includes(name))\n ) {\n isTypeOnly = true;\n }\n\n for (const name of value.names) {\n const alias = value.aliases?.[name];\n let finalName = name;\n let finalAlias: string | undefined;\n if (alias && alias !== finalName) {\n finalAlias = finalName;\n finalName = alias;\n }\n finalName = renderIds(finalName, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n const name = this.replacerFn({ file, project, symbol });\n const [symbolFile] = project.symbolIdToFiles(symbolId);\n const sourceName = symbolFile\n ? symbolFile.resolvedNames.get(symbolId)\n : undefined;\n if (sourceName && sourceName !== name) {\n // handle only simple imports for now\n if (!finalAlias) {\n finalAlias = sourceName;\n }\n }\n return name;\n });\n if (finalAlias) {\n finalAlias = renderIds(finalAlias, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n return this.replacerFn({ file, project, symbol });\n });\n // remove redundant alias\n if (finalAlias === finalName) {\n finalAlias = undefined;\n }\n }\n const specifier = ts.factory.createExportSpecifier(\n isTypeOnly ? false : (value.typeNames?.includes(name) ?? false),\n finalAlias ? tsc.identifier({ text: finalAlias }) : undefined,\n tsc.identifier({ text: finalName }),\n );\n specifiers.push(specifier);\n }\n }\n\n const exportClause = namespaceBinding\n ? ts.factory.createNamespaceExport(\n tsc.identifier({ text: namespaceBinding }),\n )\n : specifiers.length\n ? ts.factory.createNamedExports(specifiers)\n : undefined;\n\n const node = ts.factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n exportClause,\n tsc.stringLiteral({ isSingleQuote: true, text: from }),\n );\n lines.push(tsNodeToString({ node, unescape: true }));\n }\n\n return lines;\n }\n\n private getHeaderLines(): Array<string> {\n return ['// This file is auto-generated by @hey-api/openapi-ts'];\n }\n\n private getImportLines(\n bindings: Map<string, Binding>,\n file: File,\n project: IProject,\n ): Array<string> {\n const lines: Array<string> = [];\n\n let lastGroup = -1;\n const importSortKey = (binding: Binding): [number, number, string] => {\n const path = binding.from;\n if (!path.startsWith('.')) {\n // Node.js built-in\n if (nodeBuiltins.has(path.split('/')[0]!)) {\n return [0, 0, path];\n }\n // external package\n return [1, 0, path];\n }\n // sibling relative\n if (path.startsWith('./')) {\n return [2, 0, path];\n }\n // parent relative\n const parentCount = path.match(/\\.\\.\\//g)?.length ?? 0;\n return [2, parentCount, path];\n };\n\n const sortedBindings = Array.from(bindings.values())\n .map((value) => ({\n ...value,\n k: importSortKey(value),\n }))\n .sort(\n (a, b) =>\n a.k[0] - b.k[0] || a.k[1] - b.k[1] || a.k[2].localeCompare(b.k[2]),\n );\n\n for (const value of sortedBindings) {\n let specifiers: Array<ts.ImportSpecifier> = [];\n let defaultBinding: ts.Identifier | undefined;\n let namespaceBinding: string | undefined;\n let isTypeOnly = false;\n\n if (value.defaultBinding) {\n const processedDefaultBinding = renderIds(\n value.defaultBinding,\n (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n return this.replacerFn({ file, project, symbol });\n },\n );\n defaultBinding = tsc.identifier({ text: processedDefaultBinding });\n if (value.typeDefaultBinding) {\n isTypeOnly = true;\n }\n } else if (typeof value.namespaceBinding === 'string') {\n namespaceBinding = renderIds(value.namespaceBinding, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n return this.replacerFn({ file, project, symbol });\n });\n if (value.typeNamespaceBinding) {\n isTypeOnly = true;\n }\n } else if (value.names && value.names.length > 0) {\n if (value.names.every((name) => value.typeNames?.includes(name))) {\n isTypeOnly = true;\n }\n\n const namedImports: Array<{\n isTypeOnly: boolean;\n name: string;\n propertyName: ts.ModuleExportName | undefined;\n }> = [];\n\n for (const name of value.names) {\n const alias = value.aliases?.[name];\n let finalName = name;\n let finalAlias: string | undefined;\n if (alias && alias !== finalName) {\n finalAlias = finalName;\n finalName = alias;\n }\n finalName = renderIds(finalName, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n const name = this.replacerFn({ file, project, symbol });\n const [symbolFile] = project.symbolIdToFiles(symbolId);\n const sourceName = symbolFile\n ? symbolFile.resolvedNames.get(symbolId)\n : undefined;\n if (sourceName && sourceName !== name) {\n // handle only simple imports for now\n if (!finalAlias) {\n finalAlias = sourceName;\n }\n }\n return name;\n });\n if (finalAlias) {\n finalAlias = renderIds(finalAlias, (symbolId) => {\n const symbol = project.symbols.get(symbolId);\n return this.replacerFn({ file, project, symbol });\n });\n // remove redundant alias\n if (finalAlias === finalName) {\n finalAlias = undefined;\n }\n }\n namedImports.push({\n isTypeOnly: isTypeOnly\n ? false\n : (value.typeNames?.includes(name) ?? false),\n name: finalName,\n propertyName: finalAlias\n ? tsc.identifier({ text: finalAlias })\n : undefined,\n });\n }\n\n specifiers = namedImports\n .sort((a, b) => a.name.localeCompare(b.name))\n .map(({ isTypeOnly, name, propertyName }) =>\n ts.factory.createImportSpecifier(\n isTypeOnly,\n propertyName,\n tsc.identifier({ text: name }),\n ),\n );\n }\n\n const importClause = ts.factory.createImportClause(\n isTypeOnly,\n defaultBinding,\n namespaceBinding\n ? ts.factory.createNamespaceImport(\n tsc.identifier({ text: namespaceBinding }),\n )\n : specifiers.length\n ? ts.factory.createNamedImports(specifiers)\n : undefined,\n );\n\n const node = ts.factory.createImportDeclaration(\n undefined,\n importClause,\n tsc.stringLiteral({ isSingleQuote: true, text: value.from }),\n );\n\n if (lastGroup !== -1 && value.k[0] !== lastGroup) {\n lines.push(''); // add empty line between groups\n }\n\n lines.push(tsNodeToString({ node, unescape: true }));\n lastGroup = value.k[0];\n }\n\n return lines;\n }\n\n private getUniqueName(base: string, names: BiMap<number, string>): string {\n let index = 2;\n let name = base;\n while (names.hasValue(name)) {\n name = `${base}${index}`;\n index += 1;\n }\n return name;\n }\n\n private replacerFn({\n file,\n project,\n symbol,\n }: {\n file: File;\n project: IProject;\n symbol: Symbol | undefined;\n }): string | undefined {\n if (!symbol) return;\n const cached = file.resolvedNames.get(symbol.id);\n if (cached) return cached;\n if (!symbol.name) return;\n const [symbolFile] = project.symbolIdToFiles(symbol.id);\n const symbolFileResolvedName = symbolFile?.resolvedNames.get(symbol.id);\n let name = ensureValidIdentifier(symbolFileResolvedName ?? symbol.name);\n const conflictId = file.resolvedNames.getKey(name);\n if (conflictId !== undefined) {\n const conflictSymbol = project.symbols.get(conflictId);\n if (conflictSymbol) {\n const kinds = [conflictSymbol.kind, symbol.kind];\n if (\n kinds.every((kind) => kind === 'type') ||\n kinds.every((kind) => kind !== 'type') ||\n // avoid conflicts between class and type of the same name\n (kinds.includes('class') && kinds.includes('type'))\n ) {\n name = this.getUniqueName(name, file.resolvedNames);\n }\n }\n }\n file.resolvedNames.set(symbol.id, name);\n return name;\n }\n}\n","export class MinHeap {\n private heap: Array<string> = [];\n\n constructor(public declIndex: Map<string, number>) {}\n\n isEmpty(): boolean {\n return !this.heap.length;\n }\n\n pop(): string | undefined {\n const [top] = this.heap;\n if (!this.heap.length) return;\n const last = this.heap.pop()!;\n if (!this.heap.length) return top;\n this.heap[0] = last;\n this.sinkDown(0);\n return top;\n }\n\n push(item: string): void {\n this.heap.push(item);\n this.bubbleUp(this.heap.length - 1);\n }\n\n private bubbleUp(index: number): void {\n const heap = this.heap;\n while (index > 0) {\n const parent = Math.floor((index - 1) / 2);\n const parentVal = heap[parent]!;\n const curVal = heap[index]!;\n if (this.declIndex.get(parentVal)! <= this.declIndex.get(curVal)!) break;\n heap[parent] = curVal;\n heap[index] = parentVal;\n index = parent;\n }\n }\n\n private sinkDown(index: number): void {\n const heap = this.heap;\n const len = heap.length;\n while (true) {\n const left = 2 * index + 1;\n const right = 2 * index + 2;\n let smallest = index;\n if (left < len) {\n const leftVal = heap[left]!;\n const smallestVal = heap[smallest]!;\n if (this.declIndex.get(leftVal)! < this.declIndex.get(smallestVal)!)\n smallest = left;\n }\n if (right < len) {\n const rightVal = heap[right]!;\n const smallestVal = heap[smallest]!;\n if (this.declIndex.get(rightVal)! < this.declIndex.get(smallestVal)!)\n smallest = right;\n }\n if (smallest === index) break;\n const tmp = heap[smallest]!;\n heap[smallest] = heap[index]!;\n heap[index] = tmp;\n index = smallest;\n }\n }\n}\n","import { MinHeap } from '~/utils/minHeap';\n\nimport type { GetPointerPriorityFn, WalkFn } from './types/walk';\n\n/**\n * Walk the nodes of the graph in declaration (insertion) order.\n * This is a cheap alternative to `walkTopological` when dependency ordering\n * is not required and the caller only wants nodes in the order they were\n * added to the graph.\n */\nconst walkDeclarations: WalkFn = (graph, callback, options) => {\n const pointers = Array.from(graph.nodes.keys());\n\n if (options?.preferGroups && options.preferGroups.length > 0) {\n // emit nodes that match each preferred group in order, preserving insertion order\n const emitted = new Set<string>();\n if (options.matchPointerToGroup) {\n for (const kind of options.preferGroups) {\n for (const pointer of pointers) {\n const result = options.matchPointerToGroup(pointer);\n if (!result.matched) continue;\n if (result.kind === kind) {\n emitted.add(pointer);\n callback(pointer, graph.nodes.get(pointer)!);\n }\n }\n }\n }\n\n // emit anything not covered by the preferGroups (in declaration order)\n for (const pointer of pointers) {\n if (emitted.has(pointer)) continue;\n callback(pointer, graph.nodes.get(pointer)!);\n }\n return;\n }\n\n // fallback: simple declaration order\n for (const pointer of pointers) {\n callback(pointer, graph.nodes.get(pointer)!);\n }\n};\n\n/**\n * Walks the nodes of the graph in topological order (dependencies before dependents).\n * Calls the callback for each node pointer in order.\n * Nodes in cycles are grouped together and emitted in arbitrary order within the group.\n *\n * @param graph - The dependency graph\n * @param callback - Function to call for each node pointer\n */\nconst walkTopological: WalkFn = (graph, callback, options) => {\n // stable Kahn's algorithm that respects declaration order as a tiebreaker.\n const pointers = Array.from(graph.nodes.keys());\n // base insertion order\n const baseIndex = new Map<string, number>();\n pointers.forEach((pointer, index) => baseIndex.set(pointer, index));\n\n // composite decl index: group priority then base insertion order\n const declIndex = new Map<string, number>();\n for (const pointer of pointers) {\n const priority = options?.getPointerPriority?.(pointer) ?? 10;\n const composite = priority * 1_000_000 + (baseIndex.get(pointer) ?? 0);\n declIndex.set(pointer, composite);\n }\n\n // build dependency sets for each pointer\n const depsOf = new Map<string, Set<string>>();\n for (const pointer of pointers) {\n const raw = graph.subtreeDependencies?.get(pointer) ?? new Set();\n const filtered = new Set<string>();\n for (const rawPointer of raw) {\n if (rawPointer === pointer) continue; // ignore self-dependencies for ordering\n if (graph.nodes.has(rawPointer)) {\n filtered.add(rawPointer);\n }\n }\n depsOf.set(pointer, filtered);\n }\n\n // build inDegree and dependents adjacency\n const inDegree = new Map<string, number>();\n const dependents = new Map<string, Set<string>>();\n for (const pointer of pointers) {\n inDegree.set(pointer, 0);\n }\n for (const [pointer, deps] of depsOf) {\n inDegree.set(pointer, deps.size);\n for (const d of deps) {\n if (!dependents.has(d)) {\n dependents.set(d, new Set());\n }\n dependents.get(d)!.add(pointer);\n }\n }\n\n // sort pointers by declaration order\n const sortByDecl = (arr: Array<string>) =>\n arr.sort((a, b) => declIndex.get(a)! - declIndex.get(b)!);\n\n // initialize queue with zero-inDegree nodes in declaration order\n // use min-heap prioritized by declaration index to avoid repeated full sorts\n const heap = new MinHeap(declIndex);\n for (const pointer of pointers) {\n if ((inDegree.get(pointer) ?? 0) === 0) {\n heap.push(pointer);\n }\n }\n\n const emitted = new Set<string>();\n const order: Array<string> = [];\n\n while (!heap.isEmpty()) {\n const cur = heap.pop()!;\n if (emitted.has(cur)) continue;\n emitted.add(cur);\n order.push(cur);\n\n const deps = dependents.get(cur);\n if (!deps) continue;\n\n for (const dep of deps) {\n const v = (inDegree.get(dep) ?? 0) - 1;\n inDegree.set(dep, v);\n if (v === 0) {\n heap.push(dep);\n }\n }\n }\n\n // emit remaining nodes (cycles) in declaration order\n const remaining = pointers.filter((pointer) => !emitted.has(pointer));\n sortByDecl(remaining);\n for (const pointer of remaining) {\n emitted.add(pointer);\n order.push(pointer);\n }\n\n // prefer specified groups when safe\n let finalOrder = order;\n if (options?.preferGroups && options.preferGroups.length > 0) {\n // build group priority map (lower = earlier)\n const groupPriority = new Map<string, number>();\n for (let i = 0; i < options.preferGroups.length; i++) {\n const k = options.preferGroups[i];\n if (k) {\n groupPriority.set(k, i);\n }\n }\n\n const getGroup: GetPointerPriorityFn = (pointer) => {\n if (options.matchPointerToGroup) {\n const result = options.matchPointerToGroup(pointer);\n if (result.matched) {\n return groupPriority.has(result.kind)\n ? groupPriority.get(result.kind)!\n : options.preferGroups!.length;\n }\n }\n return options.preferGroups!.length;\n };\n\n // proposed order: sort by (groupPriority, originalIndex)\n const proposed = [...order].sort((a, b) => {\n const ga = getGroup(a);\n const gb = getGroup(b);\n return ga !== gb ? ga - gb : order.indexOf(a) - order.indexOf(b);\n });\n\n // build quick lookup of original index and proposed index\n const proposedIndex = new Map<string, number>();\n for (let i = 0; i < proposed.length; i++) {\n proposedIndex.set(proposed[i]!, i);\n }\n\n // only validate edges where group(dep) > group(node)\n const violated = (() => {\n for (const [node, deps] of depsOf) {\n for (const dep of deps) {\n const gDep = getGroup(dep);\n const gNode = getGroup(node);\n if (gDep <= gNode) continue; // not a crossing edge, cannot be violated by grouping\n const pDep = proposedIndex.get(dep)!;\n const pNode = proposedIndex.get(node)!;\n if (pDep >= pNode) {\n return true;\n }\n }\n }\n return false;\n })();\n\n if (!violated) {\n finalOrder = proposed;\n }\n }\n\n for (const pointer of finalOrder) {\n callback(pointer, graph.nodes.get(pointer)!);\n }\n};\n\nexport const walk: WalkFn = (graph, callback, options) => {\n if (options?.order === 'topological') {\n return walkTopological(graph, callback, options);\n }\n return walkDeclarations(graph, callback, options);\n};\n","import type { GetPointerPriorityFn, MatchPointerToGroupFn } from '~/graph';\n\nexport const irTopLevelKinds = [\n 'operation',\n 'parameter',\n 'requestBody',\n 'schema',\n 'server',\n 'webhook',\n] as const;\n\nexport type IrTopLevelKind = (typeof irTopLevelKinds)[number];\n\n/**\n * Checks if a pointer matches a known top-level IR component (schema, parameter, etc) and returns match info.\n *\n * @param pointer - The IR pointer string (e.g. '#/components/schemas/Foo')\n * @param kind - (Optional) The component kind to check\n * @returns { matched: true, kind: IrTopLevelKind } | { matched: false } - Whether it matched, and the matched kind if so\n */\nexport const matchIrPointerToGroup: MatchPointerToGroupFn<IrTopLevelKind> = (\n pointer,\n kind,\n) => {\n const patterns: Record<IrTopLevelKind, RegExp> = {\n operation:\n /^#\\/paths\\/[^/]+\\/(get|put|post|delete|options|head|patch|trace)$/,\n parameter: /^#\\/components\\/parameters\\/[^/]+$/,\n requestBody: /^#\\/components\\/requestBodies\\/[^/]+$/,\n schema: /^#\\/components\\/schemas\\/[^/]+$/,\n server: /^#\\/servers\\/(\\d+|[^/]+)$/,\n webhook:\n /^#\\/webhooks\\/[^/]+\\/(get|put|post|delete|options|head|patch|trace)$/,\n };\n if (kind) {\n return patterns[kind].test(pointer)\n ? { kind, matched: true }\n : { matched: false };\n }\n for (const key of Object.keys(patterns)) {\n const kind = key as IrTopLevelKind;\n if (patterns[kind].test(pointer)) {\n return { kind, matched: true };\n }\n }\n return { matched: false };\n};\n\n// default grouping preference (earlier groups emitted first when safe)\nexport const preferGroups = [\n 'server',\n 'schema',\n 'parameter',\n 'requestBody',\n 'operation',\n 'webhook',\n] satisfies ReadonlyArray<IrTopLevelKind>;\n\ntype KindPriority = Record<IrTopLevelKind, number>;\n\n// default group priority (lower = earlier)\n// built from `preferGroups` so the priority order stays in sync with the prefer-groups array.\nconst kindPriority: KindPriority = (() => {\n const partial: Partial<KindPriority> = {};\n for (let i = 0; i < preferGroups.length; i++) {\n const k = preferGroups[i];\n if (k) partial[k] = i;\n }\n // Ensure all known kinds exist in the map (fall back to a high index).\n for (const k of irTopLevelKinds) {\n if (partial[k] === undefined) {\n partial[k] = preferGroups.length;\n }\n }\n return partial as KindPriority;\n})();\n\nconst defaultPriority = 10;\n\nexport const getIrPointerPriority: GetPointerPriorityFn = (pointer) => {\n const result = matchIrPointerToGroup(pointer);\n if (result.matched) {\n return kindPriority[result.kind] ?? defaultPriority;\n }\n return defaultPriority;\n};\n","import path from 'node:path';\n\nimport type {\n IProject,\n Symbol,\n SymbolIdentifier,\n SymbolIn,\n SymbolMeta,\n} from '@hey-api/codegen-core';\n\nimport { HeyApiError } from '~/error';\nimport type { MatchPointerToGroupFn, WalkOptions } from '~/graph';\nimport { walk } from '~/graph';\nimport type { Context } from '~/ir/context';\nimport type { IrTopLevelKind } from '~/ir/graph';\nimport {\n getIrPointerPriority,\n irTopLevelKinds,\n matchIrPointerToGroup,\n preferGroups,\n} from '~/ir/graph';\nimport type { IR } from '~/ir/types';\nimport type { OpenApi } from '~/openApi/types';\nimport type { Hooks } from '~/parser/types/hooks';\nimport type { Plugin } from '~/plugins';\nimport type { PluginConfigMap } from '~/plugins/config';\nimport { jsonPointerToPath } from '~/utils/ref';\n\nimport type { BaseEvent, WalkEvent } from '../types/instance';\n\nconst defaultGetFilePath = (symbol: Symbol): string | undefined => {\n if (!symbol.meta?.pluginName || typeof symbol.meta.pluginName !== 'string') {\n return;\n }\n if (symbol.meta.pluginName.startsWith('@hey-api/client-')) {\n return 'client';\n }\n if (symbol.meta.pluginName === '@hey-api/typescript') {\n return 'types';\n }\n if (symbol.meta.pluginName.startsWith('@hey-api/')) {\n return symbol.meta.pluginName.split('/')[1];\n }\n return symbol.meta.pluginName;\n};\n\nconst defaultGetKind: Required<Required<Hooks>['operations']>['getKind'] = (\n operation,\n) => {\n switch (operation.method) {\n case 'delete':\n case 'patch':\n case 'post':\n case 'put':\n return ['mutation'];\n case 'get':\n return ['query'];\n default:\n return;\n }\n};\n\ntype EventHooks = {\n [K in keyof Required<NonNullable<Hooks['events']>>]: Array<\n NonNullable<NonNullable<Hooks['events']>[K]>\n >;\n};\n\nexport class PluginInstance<T extends Plugin.Types = Plugin.Types> {\n api: T['api'];\n config: Omit<T['resolvedConfig'], 'name' | 'output'>;\n context: Context;\n dependencies: Required<Plugin.Config<T>>['dependencies'] = [];\n private eventHooks: EventHooks;\n gen: IProject;\n private handler: Plugin.Config<T>['handler'];\n name: T['resolvedConfig']['name'];\n output: string;\n /**\n * The package metadata and utilities for the current context, constructed\n * from the provided dependencies. Used for managing package-related\n * information such as name, version, and dependency resolution during\n * code generation.\n */\n package: Context['package'];\n\n constructor(\n props: Pick<\n Required<Plugin.Config<T>>,\n 'config' | 'dependencies' | 'handler'\n > & {\n api?: T['api'];\n context: Context<OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X>;\n gen: IProject;\n name: string;\n output: string;\n },\n ) {\n this.api = props.api ?? {};\n this.config = props.config;\n this.context = props.context;\n this.dependencies = props.dependencies;\n this.eventHooks = this.buildEventHooks();\n this.gen = props.gen;\n this.handler = props.handler;\n this.name = props.name;\n this.output = props.output;\n this.package = props.context.package;\n }\n\n /**\n * Iterates over various input elements as specified by the event types, in\n * a specific order: servers, schemas, parameters, request bodies, then\n * operations.\n *\n * This ensures, for example, that schemas are always processed before\n * operations, which may reference them.\n *\n * @template TKind - The event type(s) to yield. Defaults to all event types.\n * @param events - The event types to walk over. If none are provided, all event types are included.\n * @param callback - Function to execute for each event.\n *\n * @example\n * // Iterate over all operations and schemas\n * plugin.forEach('operation', 'schema', (event) => {\n * if (event.type === 'operation') {\n * // handle operation\n * } else if (event.type === 'schema') {\n * // handle schema\n * }\n * });\n */\n forEach<TKind extends IrTopLevelKind = IrTopLevelKind>(\n ...args: [\n ...events: ReadonlyArray<TKind>,\n callback: (event: WalkEvent<TKind>) => void,\n ]\n ): void;\n forEach<TKind extends IrTopLevelKind = IrTopLevelKind>(\n ...args: [\n ...events: ReadonlyArray<TKind>,\n callback: (event: WalkEvent<TKind>) => void,\n options: WalkOptions<TKind>,\n ]\n ): void;\n forEach<TKind extends IrTopLevelKind = IrTopLevelKind>(\n ...args: [\n ...events: ReadonlyArray<TKind>,\n callback: (event: WalkEvent<TKind>) => void,\n options: any,\n ]\n ): void {\n if (!this.context.graph) {\n throw new Error('No graph available in context');\n }\n\n let callback: (event: WalkEvent<TKind>) => void;\n let events: ReadonlyArray<TKind>;\n let options: WalkOptions<TKind> = {\n getPointerPriority: getIrPointerPriority,\n // default functions operate on the full union of kinds; cast them\n // to the WalkOptions generic to keep strict typing for callers.\n matchPointerToGroup:\n matchIrPointerToGroup as unknown as MatchPointerToGroupFn<TKind>,\n order: 'topological',\n preferGroups: preferGroups as unknown as ReadonlyArray<TKind>,\n };\n if (typeof args[args.length - 1] === 'function') {\n events = args.slice(0, -1);\n callback = args[args.length - 1];\n } else {\n events = args.slice(0, -2);\n callback = args[args.length - 2];\n options = {\n ...options,\n ...args[args.length - 1],\n };\n }\n const eventSet = new Set(events.length ? events : irTopLevelKinds);\n\n walk(\n this.context.graph,\n (pointer, nodeInfo) => {\n const result = matchIrPointerToGroup(pointer);\n if (!result.matched || !eventSet.has(result.kind)) return;\n let event: WalkEvent | undefined;\n const baseEvent: BaseEvent = {\n _path: jsonPointerToPath(pointer),\n pointer,\n tags: nodeInfo.tags ? Array.from(nodeInfo.tags) : undefined,\n };\n switch (result.kind) {\n case 'operation':\n event = {\n ...baseEvent,\n method: nodeInfo.key as keyof IR.PathItemObject,\n operation: nodeInfo.node as IR.OperationObject,\n path: baseEvent._path[1] as string,\n type: result.kind,\n } satisfies WalkEvent<'operation'>;\n break;\n case 'parameter':\n event = {\n ...baseEvent,\n name: nodeInfo.key as string,\n parameter: nodeInfo.node as IR.ParameterObject,\n type: result.kind,\n } satisfies WalkEvent<'parameter'>;\n break;\n case 'requestBody':\n event = {\n ...baseEvent,\n name: nodeInfo.key as string,\n requestBody: nodeInfo.node as IR.RequestBodyObject,\n type: result.kind,\n } satisfies WalkEvent<'requestBody'>;\n break;\n case 'schema':\n event = {\n ...baseEvent,\n name: nodeInfo.key as string,\n schema: nodeInfo.node as IR.SchemaObject,\n type: result.kind,\n } satisfies WalkEvent<'schema'>;\n break;\n case 'server':\n event = {\n ...baseEvent,\n server: nodeInfo.node as IR.ServerObject,\n type: result.kind,\n } satisfies WalkEvent<'server'>;\n break;\n case 'webhook':\n event = {\n ...baseEvent,\n key: baseEvent._path[1] as string,\n method: nodeInfo.key as keyof IR.PathItemObject,\n operation: nodeInfo.node as IR.OperationObject,\n type: result.kind,\n } satisfies WalkEvent<'webhook'>;\n break;\n }\n if (event) {\n try {\n callback(event as WalkEvent<TKind>);\n } catch (error) {\n this.forEachError(error, event);\n }\n }\n },\n options,\n );\n }\n\n /**\n * Retrieves a registered plugin instance by its name from the context. This\n * allows plugins to access other plugins that have been registered in the\n * same context, enabling cross-plugin communication and dependencies.\n *\n * @param name Plugin name as defined in the configuration.\n * @returns The plugin instance if found, undefined otherwise.\n */\n getPlugin<TName extends keyof PluginConfigMap>(\n name: TName,\n ): TName extends any\n ? PluginInstance<PluginConfigMap[TName]> | undefined\n : never {\n return this.context.plugins[name] as any;\n }\n\n /**\n * Retrieves a registered plugin instance by its name from the context. This\n * allows plugins to access other plugins that have been registered in the\n * same context, enabling cross-plugin communication and dependencies.\n *\n * @param name Plugin name as defined in the configuration.\n * @returns The plugin instance if found, throw otherwise.\n */\n getPluginOrThrow<TName extends keyof PluginConfigMap>(\n name: TName,\n ): TName extends any ? PluginInstance<PluginConfigMap[TName]> : never {\n const plugin = this.getPlugin(name);\n if (!plugin) throw new Error(`plugin not found ${name}`);\n return plugin as any;\n }\n\n getSymbol(identifier: SymbolIdentifier): Symbol | undefined {\n return this.gen.symbols.get(identifier);\n }\n\n hooks = {\n operation: {\n isMutation: (operation: IR.OperationObject): boolean =>\n this.isOperationKind(operation, 'mutation'),\n isQuery: (operation: IR.OperationObject): boolean =>\n this.isOperationKind(operation, 'query'),\n },\n };\n\n isSymbolRegistered(identifier: SymbolIdentifier): boolean {\n return this.gen.symbols.isRegistered(identifier);\n }\n\n querySymbol(filter: SymbolMeta): Symbol | undefined {\n return this.gen.symbols.query(filter)[0];\n }\n\n referenceSymbol(meta: SymbolMeta): Symbol {\n return this.gen.symbols.reference(meta);\n }\n\n registerSymbol(symbol: SymbolIn): Symbol {\n const symbolIn: SymbolIn = {\n ...symbol,\n exportFrom:\n symbol.exportFrom ??\n (!symbol.external &&\n this.context.config.output.indexFile &&\n this.config.exportFromIndex\n ? ['index']\n : undefined),\n getFilePath: symbol.getFilePath ?? this.getSymbolFilePath.bind(this),\n meta: {\n pluginName: path.isAbsolute(this.name) ? 'custom' : this.name,\n ...symbol.meta,\n },\n };\n for (const hook of this.eventHooks['symbol:register:before']) {\n hook({ plugin: this, symbol: symbolIn });\n }\n const symbolOut = this.gen.symbols.register(symbolIn);\n for (const hook of this.eventHooks['symbol:register:after']) {\n hook({ plugin: this, symbol: symbolOut });\n }\n return symbolOut;\n }\n\n /**\n * Executes plugin's handler function.\n */\n async run(): Promise<void> {\n for (const hook of this.eventHooks['plugin:handler:before']) {\n hook({ plugin: this });\n }\n await this.handler({ plugin: this });\n for (const hook of this.eventHooks['plugin:handler:after']) {\n hook({ plugin: this });\n }\n }\n\n setSymbolValue(symbol: Symbol, value: unknown): void {\n for (const hook of this.eventHooks['symbol:setValue:before']) {\n hook({ plugin: this, symbol, value });\n }\n this.gen.symbols.setValue(symbol.id, value);\n for (const hook of this.eventHooks['symbol:setValue:after']) {\n hook({ plugin: this, symbol, value });\n }\n }\n\n private buildEventHooks(): EventHooks {\n const result: EventHooks = {\n 'plugin:handler:after': [],\n 'plugin:handler:before': [],\n 'symbol:register:after': [],\n 'symbol:register:before': [],\n 'symbol:setValue:after': [],\n 'symbol:setValue:before': [],\n };\n const scopes = [\n this.config['~hooks']?.events,\n this.context.config.parser.hooks.events,\n ];\n for (const scope of scopes) {\n if (!scope) continue;\n for (const [key, value] of Object.entries(scope)) {\n if (value) {\n result[key as keyof typeof result].push(value.bind(scope) as any);\n }\n }\n }\n return result;\n }\n\n private forEachError(error: unknown, event: WalkEvent) {\n const originalError =\n error instanceof Error ? error : new Error(String(error));\n throw new HeyApiError({\n args: [event],\n error: originalError,\n event: event.type,\n name: 'Error',\n pluginName: this.name,\n });\n }\n\n private getSymbolFilePath(symbol: Symbol): string | undefined {\n const hooks = [\n this.config['~hooks']?.symbols,\n this.context.config.parser.hooks.symbols,\n ];\n for (const hook of hooks) {\n const result = hook?.getFilePath?.(symbol);\n if (result !== undefined) return result;\n }\n return defaultGetFilePath(symbol);\n }\n\n private isOperationKind(\n operation: IR.OperationObject,\n kind: 'mutation' | 'query',\n ): boolean {\n const method = kind === 'query' ? 'isQuery' : 'isMutation';\n const hooks = [\n this.config['~hooks']?.operations?.[method],\n this.config['~hooks']?.operations?.getKind,\n this.context.config.parser.hooks.operations?.[method],\n this.context.config.parser.hooks.operations?.getKind,\n defaultGetKind,\n ];\n for (const hook of hooks) {\n if (hook) {\n const result = hook(operation);\n if (result !== undefined) {\n return typeof result === 'boolean' ? result : result.includes(kind);\n }\n }\n }\n return false;\n }\n}\n","import { Project } from '@hey-api/codegen-core';\n\nimport type { Package } from '~/config/utils/package';\nimport { packageFactory } from '~/config/utils/package';\nimport { TypeScriptRenderer } from '~/generate/renderer';\nimport type { Graph } from '~/graph';\nimport { buildName } from '~/openApi/shared/utils/name';\nimport type { PluginConfigMap } from '~/plugins/config';\nimport { PluginInstance } from '~/plugins/shared/utils/instance';\nimport type { PluginNames } from '~/plugins/types';\nimport type { Config } from '~/types/config';\nimport type { Logger } from '~/utils/logger';\nimport { resolveRef } from '~/utils/ref';\n\nimport type { IR } from './types';\n\nexport class Context<Spec extends Record<string, any> = any> {\n /**\n * Configuration for parsing and generating the output. This\n * is a mix of user-provided and default values.\n */\n config: Config;\n /**\n * The code generation project instance used to manage files, symbols,\n */\n gen: Project;\n /**\n * The dependency graph built from the intermediate representation.\n */\n graph: Graph | undefined;\n /**\n * Intermediate representation model obtained from `spec`.\n */\n ir: IR.Model = {};\n /**\n * Logger instance.\n */\n logger: Logger;\n /**\n * The package metadata and utilities for the current context, constructed\n * from the provided dependencies. Used for managing package-related\n * information such as name, version, and dependency resolution during\n * code generation.\n */\n package: Package;\n /**\n * A map of registered plugin instances, keyed by plugin name. Plugins are\n * registered through the `registerPlugin` method and can be accessed by\n * their configured name from the config.\n */\n plugins: Partial<\n Record<PluginNames, PluginInstance<PluginConfigMap[keyof PluginConfigMap]>>\n > = {};\n /**\n * Resolved specification from `input`.\n */\n spec: Spec;\n\n constructor({\n config,\n dependencies,\n logger,\n spec,\n }: {\n config: Config;\n dependencies: Record<string, string>;\n logger: Logger;\n spec: Spec;\n }) {\n this.config = config;\n this.gen = new Project({\n defaultFileName: 'index',\n fileName: (base) => {\n const name = buildName({\n config: config.output.fileName,\n name: base,\n });\n const { suffix } = config.output.fileName;\n if (!suffix) {\n return name;\n }\n return name === 'index' || name.endsWith(suffix)\n ? name\n : `${name}${suffix}`;\n },\n renderers: {\n // TODO: allow overriding via config with custom renderers\n '.ts': new TypeScriptRenderer(),\n },\n root: config.output.path,\n });\n this.logger = logger;\n this.package = packageFactory(dependencies);\n this.spec = spec;\n }\n\n /**\n * Returns a resolved and dereferenced schema from `spec`.\n */\n dereference<T>(schema: { $ref: string }) {\n const resolved = this.resolveRef<T>(schema.$ref);\n const dereferenced = {\n ...schema,\n ...resolved,\n } as T;\n // @ts-expect-error\n delete dereferenced.$ref;\n return dereferenced;\n }\n\n /**\n * Registers a new plugin to the global context.\n *\n * @param name Plugin name.\n * @returns Registered plugin instance.\n */\n private registerPlugin<T extends PluginNames>(\n name: T,\n ): PluginInstance<PluginConfigMap[T]> {\n const plugin = this.config.plugins[name]!;\n const instance = new PluginInstance({\n api: plugin.api,\n config: plugin.config as any,\n context: this as any,\n dependencies: plugin.dependencies ?? [],\n gen: this.gen,\n handler: plugin.handler,\n name: plugin.name,\n output: plugin.output as string,\n });\n this.plugins[instance.name] = instance;\n return instance;\n }\n\n /**\n * Registers all plugins in the order specified by the configuration and returns\n * an array of the registered PluginInstance objects. Each plugin is instantiated\n * and added to the context's plugins map.\n *\n * @returns {ReadonlyArray<PluginInstance>} An array of registered plugin instances in order.\n */\n registerPlugins(): ReadonlyArray<PluginInstance> {\n return this.config.pluginOrder.map((name) => this.registerPlugin(name));\n }\n\n // TODO: parser - works the same as resolveRef, but for IR schemas.\n // for now, they map 1:1, but if they diverge (like with OpenAPI 2.0),\n // we will want to rewrite $refs at parse time, so they continue pointing\n // to the correct IR location\n resolveIrRef<T>($ref: string) {\n return resolveRef<T>({\n $ref,\n spec: this.ir,\n });\n }\n\n /**\n * Returns a resolved reference from `spec`.\n */\n resolveRef<T>($ref: string) {\n return resolveRef<T>({\n $ref,\n spec: this.spec,\n });\n }\n}\n","import type { Context } from '~/ir/context';\nimport { createOperationKey } from '~/ir/operation';\nimport { sanitizeNamespaceIdentifier } from '~/openApi/common/parser/sanitize';\nimport { stringCase } from '~/utils/stringCase';\n\nimport type { State } from '../types/state';\n\nexport const httpMethods = [\n 'delete',\n 'get',\n 'head',\n 'options',\n 'patch',\n 'post',\n 'put',\n 'trace',\n] as const;\n\n/**\n * Returns an operation ID to use across the application. By default, we try\n * to use the provided ID. If it's not provided or the SDK is configured\n * to exclude it, we generate operation ID from its location.\n */\nexport const operationToId = ({\n context,\n count = 1,\n id,\n method,\n path,\n state,\n}: {\n context: Context;\n count?: number;\n id: string | undefined;\n method: string;\n path: string;\n state: Pick<State, 'ids'>;\n}): string => {\n let result: string;\n\n const { output } = context.config;\n const targetCase =\n (output !== undefined && typeof output === 'object' && 'case' in output\n ? output.case\n : undefined) ?? 'camelCase';\n\n if (\n id &&\n (!context.config.plugins['@hey-api/sdk'] ||\n context.config.plugins['@hey-api/sdk'].config.operationId)\n ) {\n result = stringCase({\n case: targetCase,\n value: sanitizeNamespaceIdentifier(id),\n });\n } else {\n const pathWithoutPlaceholders = path\n .replace(/{(.*?)}/g, 'by-$1')\n // replace slashes with hyphens for camelcase method at the end\n .replace(/[/:+]/g, '-');\n\n result = stringCase({\n case: targetCase,\n value: `${method}-${pathWithoutPlaceholders}`,\n });\n }\n\n if (count > 1) {\n result = `${result}${count}`;\n }\n\n if (state.ids.has(result)) {\n return operationToId({\n context,\n count: count + 1,\n id,\n method,\n path,\n state,\n });\n }\n\n state.ids.set(result, createOperationKey({ method, path }));\n\n return result;\n};\n","import { createOperationKey } from '~/ir/operation';\nimport type { PathItemObject, PathsObject } from '~/openApi/3.1.x/types/spec';\nimport type { OpenApi } from '~/openApi/types';\nimport type { Logger } from '~/utils/logger';\n\nimport type { Config } from '../../../types/config';\nimport type { ResourceMetadata } from '../graph/meta';\nimport { httpMethods } from './operation';\n\ntype FilterNamespace =\n | 'body'\n | 'operation'\n | 'parameter'\n | 'response'\n | 'schema'\n | 'unknown';\n\nconst namespaceNeedle = '/';\n\nexport const addNamespace = (\n namespace: FilterNamespace,\n value: string = '',\n): string => `${namespace}${namespaceNeedle}${value}`;\n\nexport const removeNamespace = (\n key: string,\n): {\n name: string;\n namespace: FilterNamespace;\n} => {\n const index = key.indexOf(namespaceNeedle);\n const name = key.slice(index + 1);\n return {\n name,\n namespace: key.slice(0, index)! as FilterNamespace,\n };\n};\n\n/**\n * Converts reference strings from OpenAPI $ref keywords into namespaces.\n *\n * @example '#/components/schemas/Foo' -> 'schema'\n */\nexport const stringToNamespace = (value: string): FilterNamespace => {\n switch (value) {\n case 'parameters':\n return 'parameter';\n case 'requestBodies':\n return 'body';\n case 'responses':\n return 'response';\n case 'definitions':\n case 'schemas':\n return 'schema';\n default:\n return 'unknown';\n }\n};\n\ntype FiltersConfigToState<T> = {\n [K in keyof T]-?: NonNullable<T[K]> extends ReadonlyArray<infer U>\n ? Set<U>\n : NonNullable<T[K]> extends object\n ? FiltersConfigToState<NonNullable<T[K]>>\n : T[K];\n};\n\nexport type Filters = FiltersConfigToState<\n NonNullable<Config['parser']['filters']>\n>;\n\ninterface SetAndRegExps {\n regexps: Array<RegExp>;\n set: Set<string>;\n}\n\nconst createFiltersSetAndRegExps = (\n type: FilterNamespace,\n filters: ReadonlyArray<string> | undefined,\n): SetAndRegExps => {\n const keys: Array<string> = [];\n const regexps: Array<RegExp> = [];\n if (filters) {\n for (const value of filters) {\n if (value.startsWith('/') && value.endsWith('/')) {\n regexps.push(new RegExp(value.slice(1, value.length - 1)));\n } else {\n keys.push(addNamespace(type, value));\n }\n }\n }\n return {\n regexps,\n set: new Set(keys),\n };\n};\n\ninterface CollectFiltersSetFromRegExps {\n excludeOperations: SetAndRegExps;\n excludeParameters: SetAndRegExps;\n excludeRequestBodies: SetAndRegExps;\n excludeResponses: SetAndRegExps;\n excludeSchemas: SetAndRegExps;\n includeOperations: SetAndRegExps;\n includeParameters: SetAndRegExps;\n includeRequestBodies: SetAndRegExps;\n includeResponses: SetAndRegExps;\n includeSchemas: SetAndRegExps;\n}\n\nconst collectFiltersSetFromRegExpsOpenApiV2 = ({\n excludeOperations,\n excludeSchemas,\n includeOperations,\n includeSchemas,\n spec,\n}: CollectFiltersSetFromRegExps & {\n spec: OpenApi.V2_0_X;\n}) => {\n if (\n (excludeOperations.regexps.length || includeOperations.regexps.length) &&\n spec.paths\n ) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n for (const method of httpMethods) {\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const key = createOperationKey({ method, path });\n if (excludeOperations.regexps.some((regexp) => regexp.test(key))) {\n excludeOperations.set.add(addNamespace('operation', key));\n }\n if (includeOperations.regexps.some((regexp) => regexp.test(key))) {\n includeOperations.set.add(addNamespace('operation', key));\n }\n }\n }\n }\n\n if (spec.definitions) {\n // TODO: add parameters\n\n if (excludeSchemas.regexps.length || includeSchemas.regexps.length) {\n for (const key of Object.keys(spec.definitions)) {\n if (excludeSchemas.regexps.some((regexp) => regexp.test(key))) {\n excludeSchemas.set.add(addNamespace('schema', key));\n }\n if (includeSchemas.regexps.some((regexp) => regexp.test(key))) {\n includeSchemas.set.add(addNamespace('schema', key));\n }\n }\n }\n }\n};\n\nconst collectFiltersSetFromRegExpsOpenApiV3 = ({\n excludeOperations,\n excludeParameters,\n excludeRequestBodies,\n excludeResponses,\n excludeSchemas,\n includeOperations,\n includeParameters,\n includeRequestBodies,\n includeResponses,\n includeSchemas,\n spec,\n}: CollectFiltersSetFromRegExps & {\n spec: OpenApi.V3_0_X | OpenApi.V3_1_X;\n}) => {\n if (\n (excludeOperations.regexps.length || includeOperations.regexps.length) &&\n spec.paths\n ) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n for (const method of httpMethods) {\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const key = createOperationKey({ method, path });\n if (excludeOperations.regexps.some((regexp) => regexp.test(key))) {\n excludeOperations.set.add(addNamespace('operation', key));\n }\n if (includeOperations.regexps.some((regexp) => regexp.test(key))) {\n includeOperations.set.add(addNamespace('operation', key));\n }\n }\n }\n }\n\n if (spec.components) {\n if (\n (excludeParameters.regexps.length || includeParameters.regexps.length) &&\n spec.components.parameters\n ) {\n for (const key of Object.keys(spec.components.parameters)) {\n if (excludeParameters.regexps.some((regexp) => regexp.test(key))) {\n excludeParameters.set.add(addNamespace('parameter', key));\n }\n if (includeParameters.regexps.some((regexp) => regexp.test(key))) {\n includeParameters.set.add(addNamespace('parameter', key));\n }\n }\n }\n\n if (\n (excludeRequestBodies.regexps.length ||\n includeRequestBodies.regexps.length) &&\n spec.components.requestBodies\n ) {\n for (const key of Object.keys(spec.components.requestBodies)) {\n if (excludeRequestBodies.regexps.some((regexp) => regexp.test(key))) {\n excludeRequestBodies.set.add(addNamespace('body', key));\n }\n if (includeRequestBodies.regexps.some((regexp) => regexp.test(key))) {\n includeRequestBodies.set.add(addNamespace('body', key));\n }\n }\n }\n\n if (\n (excludeResponses.regexps.length || includeResponses.regexps.length) &&\n spec.components.responses\n ) {\n for (const key of Object.keys(spec.components.responses)) {\n if (excludeResponses.regexps.some((regexp) => regexp.test(key))) {\n excludeResponses.set.add(addNamespace('response', key));\n }\n if (includeResponses.regexps.some((regexp) => regexp.test(key))) {\n includeResponses.set.add(addNamespace('response', key));\n }\n }\n }\n\n if (\n (excludeSchemas.regexps.length || includeSchemas.regexps.length) &&\n spec.components.schemas\n ) {\n for (const key of Object.keys(spec.components.schemas)) {\n if (excludeSchemas.regexps.some((regexp) => regexp.test(key))) {\n excludeSchemas.set.add(addNamespace('schema', key));\n }\n if (includeSchemas.regexps.some((regexp) => regexp.test(key))) {\n includeSchemas.set.add(addNamespace('schema', key));\n }\n }\n }\n }\n};\n\nconst collectFiltersSetFromRegExps = ({\n spec,\n ...filters\n}: CollectFiltersSetFromRegExps & {\n spec: OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X;\n}): void => {\n if ('swagger' in spec) {\n collectFiltersSetFromRegExpsOpenApiV2({ ...filters, spec });\n } else {\n collectFiltersSetFromRegExpsOpenApiV3({ ...filters, spec });\n }\n};\n\nexport const createFilters = (\n config: Config['parser']['filters'],\n spec: OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X,\n logger: Logger,\n): Filters => {\n const eventCreateFilters = logger.timeEvent('create-filters');\n const excludeOperations = createFiltersSetAndRegExps(\n 'operation',\n config?.operations?.exclude,\n );\n const includeOperations = createFiltersSetAndRegExps(\n 'operation',\n config?.operations?.include,\n );\n const excludeParameters = createFiltersSetAndRegExps(\n 'parameter',\n config?.parameters?.exclude,\n );\n const includeParameters = createFiltersSetAndRegExps(\n 'parameter',\n config?.parameters?.include,\n );\n const excludeRequestBodies = createFiltersSetAndRegExps(\n 'body',\n config?.requestBodies?.exclude,\n );\n const includeRequestBodies = createFiltersSetAndRegExps(\n 'body',\n config?.requestBodies?.include,\n );\n const excludeResponses = createFiltersSetAndRegExps(\n 'response',\n config?.responses?.exclude,\n );\n const includeResponses = createFiltersSetAndRegExps(\n 'response',\n config?.responses?.include,\n );\n const excludeSchemas = createFiltersSetAndRegExps(\n 'schema',\n config?.schemas?.exclude,\n );\n const includeSchemas = createFiltersSetAndRegExps(\n 'schema',\n config?.schemas?.include,\n );\n\n collectFiltersSetFromRegExps({\n excludeOperations,\n excludeParameters,\n excludeRequestBodies,\n excludeResponses,\n excludeSchemas,\n includeOperations,\n includeParameters,\n includeRequestBodies,\n includeResponses,\n includeSchemas,\n spec,\n });\n\n const filters: Filters = {\n deprecated: config?.deprecated ?? true,\n operations: {\n exclude: excludeOperations.set,\n include: includeOperations.set,\n },\n orphans: config?.orphans ?? false,\n parameters: {\n exclude: excludeParameters.set,\n include: includeParameters.set,\n },\n preserveOrder: config?.preserveOrder ?? false,\n requestBodies: {\n exclude: excludeRequestBodies.set,\n include: includeRequestBodies.set,\n },\n responses: {\n exclude: excludeResponses.set,\n include: includeResponses.set,\n },\n schemas: {\n exclude: excludeSchemas.set,\n include: includeSchemas.set,\n },\n tags: {\n exclude: new Set(config?.tags?.exclude),\n include: new Set(config?.tags?.include),\n },\n };\n eventCreateFilters.timeEnd();\n return filters;\n};\n\nexport const hasFilters = (config: Config['parser']['filters']): boolean => {\n if (!config) {\n return false;\n }\n\n // we explicitly want to strip orphans or deprecated\n if (config.orphans === false || config.deprecated === false) {\n return true;\n }\n\n return Boolean(\n config.operations?.exclude?.length ||\n config.operations?.include?.length ||\n config.parameters?.exclude?.length ||\n config.parameters?.include?.length ||\n config.requestBodies?.exclude?.length ||\n config.requestBodies?.include?.length ||\n config.responses?.exclude?.length ||\n config.responses?.include?.length ||\n config.schemas?.exclude?.length ||\n config.schemas?.include?.length ||\n config.tags?.exclude?.length ||\n config.tags?.include?.length,\n );\n};\n\n/**\n * Collect operations that satisfy the include/exclude filters and schema dependencies.\n */\nconst collectOperations = ({\n filters,\n parameters,\n requestBodies,\n resourceMetadata,\n responses,\n schemas,\n}: {\n filters: Filters;\n parameters: Set<string>;\n requestBodies: Set<string>;\n resourceMetadata: ResourceMetadata;\n responses: Set<string>;\n schemas: Set<string>;\n}): {\n operations: Set<string>;\n} => {\n const finalSet = new Set<string>();\n const initialSet = filters.operations.include.size\n ? filters.operations.include\n : new Set(resourceMetadata.operations.keys());\n const stack = [...initialSet];\n while (stack.length) {\n const key = stack.pop()!;\n\n if (filters.operations.exclude.has(key) || finalSet.has(key)) {\n continue;\n }\n\n const node = resourceMetadata.operations.get(key);\n\n if (!node) {\n continue;\n }\n\n if (!filters.deprecated && node.deprecated) {\n continue;\n }\n\n if (\n filters.tags.exclude.size &&\n node.tags.size &&\n [...filters.tags.exclude].some((tag) => node.tags.has(tag))\n ) {\n continue;\n }\n\n if (\n filters.tags.include.size &&\n !new Set([...filters.tags.include].filter((tag) => node.tags.has(tag)))\n .size\n ) {\n continue;\n }\n\n // skip operation if it references any component not included\n if (\n [...node.dependencies].some((dependency) => {\n const { namespace } = removeNamespace(dependency);\n switch (namespace) {\n case 'body':\n return !requestBodies.has(dependency);\n case 'parameter':\n return !parameters.has(dependency);\n case 'response':\n return !responses.has(dependency);\n case 'schema':\n return !schemas.has(dependency);\n default:\n return false;\n }\n })\n ) {\n continue;\n }\n\n finalSet.add(key);\n }\n return { operations: finalSet };\n};\n\n/**\n * Collect parameters that satisfy the include/exclude filters and schema dependencies.\n */\nconst collectParameters = ({\n filters,\n resourceMetadata,\n schemas,\n}: {\n filters: Filters;\n resourceMetadata: ResourceMetadata;\n schemas: Set<string>;\n}): {\n parameters: Set<string>;\n} => {\n const finalSet = new Set<string>();\n const initialSet = filters.parameters.include.size\n ? filters.parameters.include\n : new Set(resourceMetadata.parameters.keys());\n const stack = [...initialSet];\n while (stack.length) {\n const key = stack.pop()!;\n\n if (filters.parameters.exclude.has(key) || finalSet.has(key)) {\n continue;\n }\n\n const node = resourceMetadata.parameters.get(key);\n\n if (!node) {\n continue;\n }\n\n if (!filters.deprecated && node.deprecated) {\n continue;\n }\n\n finalSet.add(key);\n\n if (!node.dependencies.size) {\n continue;\n }\n\n for (const dependency of node.dependencies) {\n const { namespace } = removeNamespace(dependency);\n switch (namespace) {\n case 'body': {\n if (filters.requestBodies.exclude.has(dependency)) {\n finalSet.delete(key);\n } else if (!finalSet.has(dependency)) {\n stack.push(dependency);\n }\n break;\n }\n case 'schema': {\n if (filters.schemas.exclude.has(dependency)) {\n finalSet.delete(key);\n } else if (!schemas.has(dependency)) {\n schemas.add(dependency);\n }\n break;\n }\n }\n }\n }\n return { parameters: finalSet };\n};\n\n/**\n * Collect request bodies that satisfy the include/exclude filters and schema dependencies.\n */\nconst collectRequestBodies = ({\n filters,\n resourceMetadata,\n schemas,\n}: {\n filters: Filters;\n resourceMetadata: ResourceMetadata;\n schemas: Set<string>;\n}): {\n requestBodies: Set<string>;\n} => {\n const finalSet = new Set<string>();\n const initialSet = filters.requestBodies.include.size\n ? filters.requestBodies.include\n : new Set(resourceMetadata.requestBodies.keys());\n const stack = [...initialSet];\n while (stack.length) {\n const key = stack.pop()!;\n\n if (filters.requestBodies.exclude.has(key) || finalSet.has(key)) {\n continue;\n }\n\n const node = resourceMetadata.requestBodies.get(key);\n\n if (!node) {\n continue;\n }\n\n if (!filters.deprecated && node.deprecated) {\n continue;\n }\n\n finalSet.add(key);\n\n if (!node.dependencies.size) {\n continue;\n }\n\n for (const dependency of node.dependencies) {\n const { namespace } = removeNamespace(dependency);\n switch (namespace) {\n case 'body': {\n if (filters.requestBodies.exclude.has(dependency)) {\n finalSet.delete(key);\n } else if (!finalSet.has(dependency)) {\n stack.push(dependency);\n }\n break;\n }\n case 'schema': {\n if (filters.schemas.exclude.has(dependency)) {\n finalSet.delete(key);\n } else if (!schemas.has(dependency)) {\n schemas.add(dependency);\n }\n break;\n }\n }\n }\n }\n return { requestBodies: finalSet };\n};\n\n/**\n * Collect responses that satisfy the include/exclude filters and schema dependencies.\n */\nconst collectResponses = ({\n filters,\n resourceMetadata,\n schemas,\n}: {\n filters: Filters;\n resourceMetadata: ResourceMetadata;\n schemas: Set<string>;\n}): {\n responses: Set<string>;\n} => {\n const finalSet = new Set<string>();\n const initialSet = filters.responses.include.size\n ? filters.responses.include\n : new Set(resourceMetadata.responses.keys());\n const stack = [...initialSet];\n while (stack.length) {\n const key = stack.pop()!;\n\n if (filters.responses.exclude.has(key) || finalSet.has(key)) {\n continue;\n }\n\n const node = resourceMetadata.responses.get(key);\n\n if (!node) {\n continue;\n }\n\n if (!filters.deprecated && node.deprecated) {\n continue;\n }\n\n finalSet.add(key);\n\n if (!node.dependencies.size) {\n continue;\n }\n\n for (const dependency of node.dependencies) {\n const { namespace } = removeNamespace(dependency);\n switch (namespace) {\n case 'body': {\n if (filters.requestBodies.exclude.has(dependency)) {\n finalSet.delete(key);\n } else if (!finalSet.has(dependency)) {\n stack.push(dependency);\n }\n break;\n }\n case 'schema': {\n if (filters.schemas.exclude.has(dependency)) {\n finalSet.delete(key);\n } else if (!schemas.has(dependency)) {\n schemas.add(dependency);\n }\n break;\n }\n }\n }\n }\n return { responses: finalSet };\n};\n\n/**\n * Collect schemas that satisfy the include/exclude filters.\n */\nconst collectSchemas = ({\n filters,\n resourceMetadata,\n}: {\n filters: Filters;\n resourceMetadata: ResourceMetadata;\n}): {\n schemas: Set<string>;\n} => {\n const finalSet = new Set<string>();\n const initialSet = filters.schemas.include.size\n ? filters.schemas.include\n : new Set(resourceMetadata.schemas.keys());\n const stack = [...initialSet];\n while (stack.length) {\n const key = stack.pop()!;\n\n if (filters.schemas.exclude.has(key) || finalSet.has(key)) {\n continue;\n }\n\n const node = resourceMetadata.schemas.get(key);\n\n if (!node) {\n continue;\n }\n\n if (!filters.deprecated && node.deprecated) {\n continue;\n }\n\n finalSet.add(key);\n\n if (!node.dependencies.size) {\n continue;\n }\n\n for (const dependency of node.dependencies) {\n const { namespace } = removeNamespace(dependency);\n switch (namespace) {\n case 'schema': {\n if (\n !finalSet.has(dependency) &&\n !filters.schemas.exclude.has(dependency)\n ) {\n stack.push(dependency);\n }\n break;\n }\n }\n }\n }\n return { schemas: finalSet };\n};\n\n/**\n * Drop parameters that depend on already excluded parameters.\n */\nconst dropExcludedParameters = ({\n filters,\n parameters,\n resourceMetadata,\n}: {\n filters: Filters;\n parameters: Set<string>;\n resourceMetadata: ResourceMetadata;\n}): void => {\n if (!filters.parameters.exclude.size) {\n return;\n }\n\n for (const key of parameters) {\n const node = resourceMetadata.parameters.get(key);\n\n if (!node?.dependencies.size) {\n continue;\n }\n\n for (const excludedKey of filters.parameters.exclude) {\n if (node.dependencies.has(excludedKey)) {\n parameters.delete(key);\n break;\n }\n }\n }\n};\n\n/**\n * Drop request bodies that depend on already excluded request bodies.\n */\nconst dropExcludedRequestBodies = ({\n filters,\n requestBodies,\n resourceMetadata,\n}: {\n filters: Filters;\n requestBodies: Set<string>;\n resourceMetadata: ResourceMetadata;\n}): void => {\n if (!filters.requestBodies.exclude.size) {\n return;\n }\n\n for (const key of requestBodies) {\n const node = resourceMetadata.requestBodies.get(key);\n\n if (!node?.dependencies.size) {\n continue;\n }\n\n for (const excludedKey of filters.requestBodies.exclude) {\n if (node.dependencies.has(excludedKey)) {\n requestBodies.delete(key);\n break;\n }\n }\n }\n};\n\n/**\n * Drop responses that depend on already excluded responses.\n */\nconst dropExcludedResponses = ({\n filters,\n resourceMetadata,\n responses,\n}: {\n filters: Filters;\n resourceMetadata: ResourceMetadata;\n responses: Set<string>;\n}): void => {\n if (!filters.responses.exclude.size) {\n return;\n }\n\n for (const key of responses) {\n const node = resourceMetadata.responses.get(key);\n\n if (!node?.dependencies.size) {\n continue;\n }\n\n for (const excludedKey of filters.responses.exclude) {\n if (node.dependencies.has(excludedKey)) {\n responses.delete(key);\n break;\n }\n }\n }\n};\n\n/**\n * Drop schemas that depend on already excluded schemas.\n */\nconst dropExcludedSchemas = ({\n filters,\n resourceMetadata,\n schemas,\n}: {\n filters: Filters;\n resourceMetadata: ResourceMetadata;\n schemas: Set<string>;\n}): void => {\n if (!filters.schemas.exclude.size) {\n return;\n }\n\n for (const key of schemas) {\n const node = resourceMetadata.schemas.get(key);\n\n if (!node?.dependencies.size) {\n continue;\n }\n\n for (const excludedKey of filters.schemas.exclude) {\n if (node.dependencies.has(excludedKey)) {\n schemas.delete(key);\n break;\n }\n }\n }\n};\n\nconst dropOrphans = ({\n operationDependencies,\n parameters,\n requestBodies,\n responses,\n schemas,\n}: {\n operationDependencies: Set<string>;\n parameters: Set<string>;\n requestBodies: Set<string>;\n responses: Set<string>;\n schemas: Set<string>;\n}) => {\n for (const key of schemas) {\n if (!operationDependencies.has(key)) {\n schemas.delete(key);\n }\n }\n for (const key of parameters) {\n if (!operationDependencies.has(key)) {\n parameters.delete(key);\n }\n }\n for (const key of requestBodies) {\n if (!operationDependencies.has(key)) {\n requestBodies.delete(key);\n }\n }\n for (const key of responses) {\n if (!operationDependencies.has(key)) {\n responses.delete(key);\n }\n }\n};\n\nconst collectOperationDependencies = ({\n operations,\n resourceMetadata,\n}: {\n operations: Set<string>;\n resourceMetadata: ResourceMetadata;\n}): {\n operationDependencies: Set<string>;\n} => {\n const finalSet = new Set<string>();\n const initialSet = new Set(\n [...operations].flatMap((key) => [\n ...(resourceMetadata.operations.get(key)?.dependencies ?? []),\n ]),\n );\n const stack = [...initialSet];\n while (stack.length) {\n const key = stack.pop()!;\n\n if (finalSet.has(key)) {\n continue;\n }\n\n finalSet.add(key);\n\n const { namespace } = removeNamespace(key);\n let dependencies: Set<string> | undefined;\n if (namespace === 'body') {\n dependencies = resourceMetadata.requestBodies.get(key)?.dependencies;\n } else if (namespace === 'operation') {\n dependencies = resourceMetadata.operations.get(key)?.dependencies;\n } else if (namespace === 'parameter') {\n dependencies = resourceMetadata.parameters.get(key)?.dependencies;\n } else if (namespace === 'response') {\n dependencies = resourceMetadata.responses.get(key)?.dependencies;\n } else if (namespace === 'schema') {\n dependencies = resourceMetadata.schemas.get(key)?.dependencies;\n }\n\n if (!dependencies?.size) {\n continue;\n }\n\n for (const dependency of dependencies) {\n if (!finalSet.has(dependency)) {\n stack.push(dependency);\n }\n }\n }\n return { operationDependencies: finalSet };\n};\n\nexport const createFilteredDependencies = ({\n filters,\n logger,\n resourceMetadata,\n}: {\n filters: Filters;\n logger: Logger;\n resourceMetadata: ResourceMetadata;\n}): {\n operations: Set<string>;\n parameters: Set<string>;\n requestBodies: Set<string>;\n responses: Set<string>;\n schemas: Set<string>;\n} => {\n const eventCreateFilteredDependencies = logger.timeEvent(\n 'create-filtered-dependencies',\n );\n const { schemas } = collectSchemas({ filters, resourceMetadata });\n const { parameters } = collectParameters({\n filters,\n resourceMetadata,\n schemas,\n });\n const { requestBodies } = collectRequestBodies({\n filters,\n resourceMetadata,\n schemas,\n });\n const { responses } = collectResponses({\n filters,\n resourceMetadata,\n schemas,\n });\n\n dropExcludedSchemas({ filters, resourceMetadata, schemas });\n dropExcludedParameters({ filters, parameters, resourceMetadata });\n dropExcludedRequestBodies({ filters, requestBodies, resourceMetadata });\n dropExcludedResponses({ filters, resourceMetadata, responses });\n\n // collect operations after dropping components\n const { operations } = collectOperations({\n filters,\n parameters,\n requestBodies,\n resourceMetadata,\n responses,\n schemas,\n });\n\n if (!filters.orphans && operations.size) {\n const { operationDependencies } = collectOperationDependencies({\n operations,\n resourceMetadata,\n });\n dropOrphans({\n operationDependencies,\n parameters,\n requestBodies,\n responses,\n schemas,\n });\n }\n\n eventCreateFilteredDependencies.timeEnd();\n return {\n operations,\n parameters,\n requestBodies,\n responses,\n schemas,\n };\n};\n","import type { Graph } from '~/graph';\nimport { createOperationKey } from '~/ir/operation';\nimport type { Logger } from '~/utils/logger';\nimport { jsonPointerToPath } from '~/utils/ref';\n\nimport { addNamespace, stringToNamespace } from '../utils/filter';\nimport { httpMethods } from '../utils/operation';\n\nexport type ResourceMetadata = {\n operations: Map<\n string,\n {\n dependencies: Set<string>;\n deprecated: boolean;\n tags: Set<string>;\n }\n >;\n parameters: Map<\n string,\n {\n dependencies: Set<string>;\n deprecated: boolean;\n }\n >;\n requestBodies: Map<\n string,\n {\n dependencies: Set<string>;\n deprecated: boolean;\n }\n >;\n responses: Map<\n string,\n {\n dependencies: Set<string>;\n deprecated: boolean;\n }\n >;\n schemas: Map<\n string,\n {\n dependencies: Set<string>;\n deprecated: boolean;\n }\n >;\n};\n\n/**\n * Builds a resource metadata map from a Graph, matching the old Graph interface\n * for compatibility with filtering code.\n */\nexport const buildResourceMetadata = (\n graph: Graph,\n logger: Logger,\n): {\n resourceMetadata: ResourceMetadata;\n} => {\n const eventBuildResourceMetadata = logger.timeEvent(\n 'build-resource-metadata',\n );\n const resourceMetadata: ResourceMetadata = {\n operations: new Map(),\n parameters: new Map(),\n requestBodies: new Map(),\n responses: new Map(),\n schemas: new Map(),\n };\n\n const getDependencies = (pointer: string): Set<string> => {\n const dependencies = new Set<string>();\n const nodeDependencies = graph.transitiveDependencies.get(pointer);\n if (nodeDependencies?.size) {\n for (const dependency of nodeDependencies) {\n const path = jsonPointerToPath(dependency);\n const type = path[path.length - 2];\n const name = path[path.length - 1];\n if (type && name) {\n const namespace = stringToNamespace(type);\n if (namespace === 'unknown') {\n console.warn(`unsupported type: ${type}`);\n }\n dependencies.add(addNamespace(namespace, name));\n }\n }\n }\n return dependencies;\n };\n\n // Process each node to find top-level resources\n for (const [pointer, nodeInfo] of graph.nodes) {\n // const node = nodeInfo.node as Record<string, unknown>;\n const path = jsonPointerToPath(pointer);\n\n // OpenAPI 3.x\n if (path[0] === 'components') {\n if (path.length === 3) {\n if (path[1] === 'schemas') {\n // Schema: #/components/schemas/{name}\n const name = path[path.length - 1]!;\n resourceMetadata.schemas.set(addNamespace('schema', name), {\n dependencies: getDependencies(pointer),\n deprecated: nodeInfo.deprecated ?? false,\n });\n } else if (path[1] === 'parameters') {\n // Parameter: #/components/parameters/{name}\n const name = path[path.length - 1]!;\n resourceMetadata.parameters.set(addNamespace('parameter', name), {\n dependencies: getDependencies(pointer),\n deprecated: nodeInfo.deprecated ?? false,\n });\n } else if (path[1] === 'requestBodies') {\n // RequestBody: #/components/requestBodies/{name}\n const name = path[path.length - 1]!;\n resourceMetadata.requestBodies.set(addNamespace('body', name), {\n dependencies: getDependencies(pointer),\n deprecated: nodeInfo.deprecated ?? false,\n });\n } else if (path[1] === 'responses') {\n // Response: #/components/responses/{name}\n const name = path[path.length - 1]!;\n resourceMetadata.responses.set(addNamespace('response', name), {\n dependencies: getDependencies(pointer),\n deprecated: nodeInfo.deprecated ?? false,\n });\n }\n }\n continue;\n }\n\n if (path[0] === 'paths') {\n if (\n path.length === 3 &&\n httpMethods.includes(path[2] as (typeof httpMethods)[number])\n ) {\n // Operation: #/paths/{path}/{method}\n const method = path[path.length - 1]!;\n const operationPath = path.slice(1, -1).join('/');\n const operationKey = createOperationKey({\n method,\n path: operationPath,\n });\n resourceMetadata.operations.set(\n addNamespace('operation', operationKey),\n {\n dependencies: getDependencies(pointer),\n deprecated: nodeInfo.deprecated ?? false,\n tags: nodeInfo.tags ?? new Set(),\n },\n );\n }\n continue;\n }\n\n // OpenAPI 2.0\n if (path[0] === 'definitions') {\n if (path.length === 2) {\n // Schema: #/definitions/{name}\n const name = path[path.length - 1]!;\n resourceMetadata.schemas.set(addNamespace('schema', name), {\n dependencies: getDependencies(pointer),\n deprecated: nodeInfo.deprecated ?? false,\n });\n }\n continue;\n }\n }\n\n eventBuildResourceMetadata.timeEnd();\n return { resourceMetadata };\n};\n","export const deepClone = <T>(obj: T): T => JSON.parse(JSON.stringify(obj));\n","export const childSchemaRelationships = [\n ['additionalProperties', 'single'],\n ['allOf', 'array'],\n ['anyOf', 'array'],\n ['contains', 'single'],\n ['dependentSchemas', 'objectMap'],\n ['else', 'single'],\n ['if', 'single'],\n ['items', 'singleOrArray'],\n ['oneOf', 'array'],\n ['patternProperties', 'objectMap'],\n ['properties', 'objectMap'],\n ['propertyNames', 'single'],\n ['then', 'single'],\n] as const;\n","export const getSchemasObject = (\n spec: unknown,\n): Record<string, unknown> | undefined => {\n if (hasComponentsSchemasObject(spec)) {\n return (spec as any).components.schemas;\n }\n if (hasDefinitionsObject(spec)) {\n return (spec as any).definitions;\n }\n return;\n};\n\n/**\n * Checks if the given spec has a valid OpenAPI 3.x components.schemas object.\n * Returns true if present, false otherwise.\n */\nexport const hasComponentsSchemasObject = (spec: unknown): boolean =>\n typeof spec === 'object' &&\n spec !== null &&\n 'components' in spec &&\n typeof (spec as any).components === 'object' &&\n (spec as any).components !== null &&\n 'schemas' in (spec as any).components &&\n typeof (spec as any).components.schemas === 'object' &&\n (spec as any).components.schemas !== null;\n\n/**\n * Checks if the given spec has a valid OpenAPI 2.0 definitions object.\n * Returns true if present, false otherwise.\n */\nexport const hasDefinitionsObject = (spec: unknown): boolean =>\n typeof spec === 'object' &&\n spec !== null &&\n 'definitions' in spec &&\n typeof (spec as any).definitions === 'object' &&\n (spec as any).definitions !== null;\n","type Obj =\n | Record<string, unknown>\n | Set<string>\n | ReadonlyArray<string | undefined>;\n\nconst hasName = (obj: Obj, value: string): boolean => {\n if (obj instanceof Set) {\n return obj.has(value);\n }\n if (obj instanceof Array) {\n return obj.includes(value);\n }\n return value in obj;\n};\n\nexport const getUniqueComponentName = ({\n base,\n components,\n extraComponents,\n}: {\n base: string;\n /**\n * Input components.\n */\n components: Obj;\n /**\n * Temporary input components, waiting to be inserted for example.\n */\n extraComponents?: Obj;\n}): string => {\n let index = 2;\n let name = base;\n while (\n hasName(components, name) ||\n (extraComponents && hasName(extraComponents, name))\n ) {\n name = `${base}${index}`;\n index += 1;\n }\n return name;\n};\n\nexport const isPathRootSchema = (path: ReadonlyArray<string | number>) =>\n (path.length === 3 && path[0] === 'components' && path[1] === 'schemas') ||\n (path.length === 2 && path[0] === 'definitions');\n\nexport const specToSchemasPointerNamespace = (spec: unknown): string => {\n if (spec && typeof spec === 'object') {\n if ('swagger' in spec) {\n // #/definitions/SchemaName\n return '#/definitions/';\n }\n\n if ('openapi' in spec) {\n // #/components/schemas/SchemaName\n return '#/components/schemas/';\n }\n }\n\n return '';\n};\n","import { jsonPointerToPath } from '~/utils/ref';\n\nimport type { Config } from '../../../types/config';\nimport { buildName } from '../utils/name';\nimport { deepClone } from '../utils/schema';\nimport { childSchemaRelationships } from '../utils/schemaChildRelationships';\nimport { getSchemasObject } from '../utils/transforms';\nimport {\n getUniqueComponentName,\n isPathRootSchema,\n specToSchemasPointerNamespace,\n} from './utils';\n\ntype EnumsConfig = Config['parser']['transforms']['enums'];\n\n/**\n * Generate a unique, structural signature for an enum schema for deduplication.\n * Only considers 'type' and sorted 'enum' values, ignoring other fields.\n *\n * @param schema - The schema object to analyze\n * @returns A string signature if the schema is an enum, otherwise undefined\n */\nconst getEnumSignature = (schema: unknown): string | undefined => {\n if (\n !schema ||\n typeof schema !== 'object' ||\n !('enum' in schema) ||\n !(schema.enum instanceof Array)\n ) {\n return;\n }\n // Use type + sorted enum values for signature\n const type = ('type' in schema ? schema.type : undefined) || '';\n const values = [...schema.enum].sort();\n return JSON.stringify({ type, values });\n};\n\ntype NodeInfo = {\n key: string | number | null;\n node: unknown;\n parent: unknown;\n path: ReadonlyArray<string | number>;\n};\n\n/**\n * Recursively walk all schemas in the OpenAPI spec, visiting every object/array\n * that could contain an enum. Calls the visitor with node info for each.\n *\n * @param key - The key of the current node\n * @param node - The current node\n * @param parent - The parent node\n * @param path - The path to the current node\n * @param visitor - Function to call for each visited node\n */\nconst walkSchemas = ({\n key,\n node,\n parent,\n path,\n visitor,\n}: NodeInfo & {\n visitor: (nodeInfo: NodeInfo) => void;\n}) => {\n if (!node || typeof node !== 'object' || node instanceof Array) return;\n\n const value = node as Record<string, unknown>;\n\n if (\n 'type' in value ||\n 'enum' in value ||\n childSchemaRelationships.some(([keyword]) => keyword in value)\n ) {\n visitor({ key, node, parent, path });\n }\n\n for (const [k, v] of Object.entries(value)) {\n if (typeof v === 'object' && v !== null) {\n if (v instanceof Array) {\n v.forEach((item, index) =>\n walkSchemas({\n key: index,\n node: item,\n parent: v,\n path: [...path, k, index],\n visitor,\n }),\n );\n } else {\n walkSchemas({\n key: k,\n node: v,\n parent: node,\n path: [...path, k],\n visitor,\n });\n }\n }\n }\n};\n\n/**\n * Inlines all root/top-level enums by replacing $refs to them with the actual enum schema,\n * and then removes the now-unreferenced root enums from the schemas object.\n *\n * @param spec - The OpenAPI spec object to transform\n */\nconst inlineMode = ({ spec }: { spec: unknown }) => {\n const schemasObj = getSchemasObject(spec);\n if (!schemasObj) {\n return;\n }\n\n const schemasPointerNamespace = specToSchemasPointerNamespace(spec);\n\n // Collect all root enums\n const rootEnums: Record<string, unknown> = {};\n for (const [name, schema] of Object.entries(schemasObj)) {\n const signature = getEnumSignature(schema);\n if (signature) {\n rootEnums[`${schemasPointerNamespace}${name}`] = schema;\n }\n }\n\n // Walk the spec and replace $refs to root enums with inline enum schemas\n const replaceEnumRefs = (node: unknown) => {\n if (node instanceof Array) {\n node.forEach(replaceEnumRefs);\n } else if (node && typeof node === 'object') {\n for (const [k, v] of Object.entries(node)) {\n if (k === '$ref' && typeof v === 'string' && v in rootEnums) {\n // Replace $ref with a deep clone of the enum schema\n Object.assign(node, deepClone(rootEnums[v]));\n delete (node as Record<string, unknown>)['$ref'];\n } else {\n replaceEnumRefs(v);\n }\n }\n }\n };\n replaceEnumRefs(spec);\n\n // Remove unreferenced root enums\n for (const pointer of Object.keys(rootEnums)) {\n const path = jsonPointerToPath(pointer);\n const name = path[path.length - 1]!;\n if (name) {\n delete schemasObj[name];\n }\n }\n};\n\n/**\n * Promotes all inline enums to reusable root components (if mode is 'root'),\n * deduplicates by signature, and replaces inline enums with $refs.\n *\n * Naming, casing, and deduplication are controlled by the enums transform config.\n * Existing root enums are reused if structurally identical.\n *\n * @param spec - The OpenAPI spec object to transform\n * @param config - The enums transform config\n */\nconst rootMode = ({ config, spec }: { config: EnumsConfig; spec: unknown }) => {\n const schemasObj = getSchemasObject(spec);\n if (!schemasObj) {\n return;\n }\n\n // Build a map of existing root enum signatures to their names for deduplication\n const rootEnumSignatures: Record<string, string> = {};\n for (const [name, schema] of Object.entries(schemasObj)) {\n const signature = getEnumSignature(schema);\n if (signature) {\n rootEnumSignatures[signature] = name;\n }\n }\n\n // Collect all inline enums (not at root schemas)\n const inlineEnums: Array<{\n key: string | number | null;\n node: unknown;\n parent: unknown;\n path: ReadonlyArray<string | number>;\n signature: string;\n }> = [];\n\n walkSchemas({\n key: null,\n node: spec,\n parent: null,\n path: [],\n visitor: (nodeInfo) => {\n if (!isPathRootSchema(nodeInfo.path)) {\n const signature = getEnumSignature(nodeInfo.node);\n if (signature) {\n inlineEnums.push({ ...nodeInfo, signature });\n }\n }\n },\n });\n\n // Deduplicate and assign unique names for promoted enums\n const signatureToName: Record<string, string | undefined> = {};\n const signatureToSchema: Record<string, unknown> = {};\n\n for (const { key, node, signature } of inlineEnums) {\n if (signature in signatureToName) {\n // Already handled\n continue;\n }\n\n // Use existing root enum if available\n if (signature in rootEnumSignatures) {\n signatureToName[signature] = rootEnumSignatures[signature];\n continue;\n }\n\n // Generate a unique name for the new root enum using config\n const base = buildName({\n config,\n name:\n typeof node === 'object' &&\n node &&\n 'title' in node &&\n typeof node.title === 'string'\n ? node.title\n : String(key),\n });\n const name = getUniqueComponentName({\n base,\n components: schemasObj,\n extraComponents: Object.values(signatureToName),\n });\n signatureToName[signature] = name;\n signatureToSchema[signature] = node;\n }\n\n // Add new root enums to the schemas object\n for (const [signature, name] of Object.entries(signatureToName)) {\n // Only add if not already present\n const schema = signatureToSchema[signature];\n if (name && !(name in schemasObj) && schema && typeof schema === 'object') {\n schemasObj[name] = schema;\n }\n }\n\n // Replace inline enums with $ref to the new root enum\n const schemasPointerNamespace = specToSchemasPointerNamespace(spec);\n for (const { key, parent, signature } of inlineEnums) {\n const name = signatureToName[signature];\n if (name && key != null && parent && typeof parent === 'object') {\n (parent as Record<string, unknown>)[key] = {\n $ref: `${schemasPointerNamespace}${name}`,\n };\n }\n }\n};\n\n/**\n * Applies the enums transform according to the configured mode ('inline' or 'root').\n *\n * - In 'inline' mode, all root enums are inlined and removed.\n * - In 'root' mode, all inline enums are promoted to root components and deduplicated.\n *\n * @param config - The enums transform config\n * @param spec - The OpenAPI spec object to transform\n */\nexport const enumsTransform = ({\n config,\n spec,\n}: {\n config: EnumsConfig;\n spec: unknown;\n}) => {\n if (config.mode === 'inline') {\n inlineMode({ spec });\n return;\n }\n\n if (config.mode === 'root') {\n rootMode({ config, spec });\n return;\n }\n};\n","import { childSchemaRelationships } from '../utils/schemaChildRelationships';\n\ntype NodeInfo = {\n key: string | number | null;\n node: unknown;\n parent: unknown;\n path: ReadonlyArray<string | number>;\n};\n\n/**\n * Recursively walk all schemas in the OpenAPI spec, visiting every object.\n * Calls the visitor with node info for each.\n *\n * @param key - The key of the current node\n * @param node - The current node\n * @param parent - The parent node\n * @param path - The path to the current node\n * @param visitor - Function to call for each visited node\n */\nconst walkSchemas = ({\n key,\n node,\n parent,\n path,\n visitor,\n}: NodeInfo & {\n visitor: (nodeInfo: NodeInfo) => void;\n}) => {\n if (!node || typeof node !== 'object' || node instanceof Array) return;\n\n const value = node as Record<string, unknown>;\n\n if (\n 'type' in value ||\n childSchemaRelationships.some(([keyword]) => keyword in value)\n ) {\n visitor({ key, node, parent, path });\n }\n\n for (const [k, v] of Object.entries(value)) {\n if (typeof v === 'object' && v !== null) {\n if (v instanceof Array) {\n v.forEach((item, index) =>\n walkSchemas({\n key: index,\n node: item,\n parent: v,\n path: [...path, k, index],\n visitor,\n }),\n );\n } else {\n walkSchemas({\n key: k,\n node: v,\n parent: node,\n path: [...path, k],\n visitor,\n });\n }\n }\n }\n};\n\n/**\n * Applies the properties required by default transform\n *\n * @param spec - The OpenAPI spec object to transform\n */\nexport const propertiesRequiredByDefaultTransform = ({\n spec,\n}: {\n spec: unknown;\n}) => {\n walkSchemas({\n key: null,\n node: spec,\n parent: null,\n path: [],\n visitor: (nodeInfo) => {\n if (\n nodeInfo.node &&\n typeof nodeInfo.node === 'object' &&\n 'type' in nodeInfo.node &&\n nodeInfo.node.type === 'object' &&\n 'properties' in nodeInfo.node &&\n nodeInfo.node.properties &&\n typeof nodeInfo.node.properties === 'object' &&\n !('required' in nodeInfo.node)\n ) {\n const propKeys = Object.keys(\n nodeInfo.node.properties as Record<string, unknown>,\n );\n if (propKeys.length > 0) {\n (nodeInfo.node as Record<string, unknown>).required = propKeys;\n }\n }\n },\n });\n};\n","/**\n * Deep equality for JSON-compatible values (objects, arrays, primitives).\n * Used to determine whether read/write pruned variants actually differ.\n */\nconst deepEqual = (a: unknown, b: unknown): boolean => {\n if (a === b) return true;\n if (a === null || b === null) return a === b;\n const typeA = typeof a;\n const typeB = typeof b;\n if (typeA !== typeB) return false;\n if (typeA !== 'object') return false;\n\n // Arrays\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b)) return false;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) return false;\n }\n return true;\n }\n\n // Plain objects\n const objA = a as Record<string, unknown>;\n const objB = b as Record<string, unknown>;\n const keysA = Object.keys(objA).sort();\n const keysB = Object.keys(objB).sort();\n if (keysA.length !== keysB.length) return false;\n for (let i = 0; i < keysA.length; i++) {\n if (keysA[i] !== keysB[i]) return false;\n }\n for (const key of keysA) {\n if (!deepEqual(objA[key], objB[key])) return false;\n }\n return true;\n};\n\nexport default deepEqual;\n","import type { Graph, NodeInfo } from '~/graph';\nimport type { Logger } from '~/utils/logger';\nimport { normalizeJsonPointer, pathToJsonPointer } from '~/utils/ref';\n\nimport { childSchemaRelationships } from './schemaChildRelationships';\n\n/**\n * Represents the possible access scopes for OpenAPI nodes.\n * - 'normal': Default scope for regular nodes.\n * - 'read': Node is read-only (e.g., readOnly: true).\n * - 'write': Node is write-only (e.g., writeOnly: true).\n */\nexport type Scope = 'normal' | 'read' | 'write';\n\n/**\n * Ensures every relevant child node (e.g., properties, items) in the graph has a `scopes` property.\n * If a node does not have its own scopes, it inherits from its parent if available.\n *\n * @param nodes - Map of JSON Pointer to NodeInfo.\n */\nexport const annotateChildScopes = (nodes: Graph['nodes']): void => {\n for (const [, nodeInfo] of nodes) {\n if (nodeInfo.scopes) continue;\n\n if (nodeInfo.parentPointer) {\n const parentInfo = nodes.get(nodeInfo.parentPointer);\n if (parentInfo?.scopes) {\n nodeInfo.scopes = new Set(parentInfo.scopes);\n }\n }\n }\n};\n\ninterface Cache {\n parentToChildren: Map<string, Array<string>>;\n subtreeDependencies: Map<string, Set<string>>;\n transitiveDependencies: Map<string, Set<string>>;\n}\n\ntype PointerDependenciesResult = {\n subtreeDependencies: Set<string>;\n transitiveDependencies: Set<string>;\n};\n\n/**\n * Recursively collects all $ref dependencies in the subtree rooted at `pointer`.\n */\nconst collectPointerDependencies = ({\n cache,\n graph,\n pointer,\n visited,\n}: {\n cache: Cache;\n graph: Graph;\n pointer: string;\n visited: Set<string>;\n}): PointerDependenciesResult => {\n const cached = cache.transitiveDependencies.get(pointer);\n if (cached) {\n return {\n subtreeDependencies: cache.subtreeDependencies.get(pointer)!,\n transitiveDependencies: cached,\n };\n }\n\n if (visited.has(pointer)) {\n return {\n subtreeDependencies: new Set(),\n transitiveDependencies: new Set(),\n };\n }\n visited.add(pointer);\n\n const nodeInfo = graph.nodes.get(pointer);\n if (!nodeInfo) {\n return {\n subtreeDependencies: new Set(),\n transitiveDependencies: new Set(),\n };\n }\n\n const transitiveDependencies = new Set<string>();\n const subtreeDependencies = new Set<string>();\n\n // Add direct $ref dependencies for this node\n // (from the dependencies map, or by checking nodeInfo.node directly)\n // We'll use the dependencies map for consistency:\n const nodeDependencies = graph.nodeDependencies.get(pointer);\n if (nodeDependencies) {\n for (const depPointer of nodeDependencies) {\n transitiveDependencies.add(depPointer);\n subtreeDependencies.add(depPointer);\n // Recursively collect dependencies of the referenced node\n const depResult = collectPointerDependencies({\n cache,\n graph,\n pointer: depPointer,\n visited,\n });\n for (const dependency of depResult.transitiveDependencies) {\n transitiveDependencies.add(dependency);\n }\n }\n }\n\n const children = cache.parentToChildren.get(pointer) ?? [];\n for (const childPointer of children) {\n let childResult: Partial<PointerDependenciesResult> = {\n subtreeDependencies: cache.subtreeDependencies.get(childPointer),\n transitiveDependencies: cache.transitiveDependencies.get(childPointer),\n };\n if (\n !childResult.subtreeDependencies ||\n !childResult.transitiveDependencies\n ) {\n childResult = collectPointerDependencies({\n cache,\n graph,\n pointer: childPointer,\n visited,\n });\n cache.transitiveDependencies.set(\n childPointer,\n childResult.transitiveDependencies!,\n );\n cache.subtreeDependencies.set(\n childPointer,\n childResult.subtreeDependencies!,\n );\n }\n for (const dependency of childResult.transitiveDependencies!) {\n transitiveDependencies.add(dependency);\n }\n for (const dependency of childResult.subtreeDependencies!) {\n subtreeDependencies.add(dependency);\n }\n }\n\n cache.transitiveDependencies.set(pointer, transitiveDependencies);\n cache.subtreeDependencies.set(pointer, subtreeDependencies);\n return {\n subtreeDependencies,\n transitiveDependencies,\n };\n};\n\n/**\n * Propagates scopes through the graph using a worklist algorithm.\n * Each node's scopes will be updated to include any scopes inherited via $ref dependencies, combinator/child relationships, and parent relationships.\n * Handles cycles and deep chains efficiently.\n *\n * Whenever a node's scopes change, all dependents are notified:\n * - Its parent (if any)\n * - All nodes that reference it via $ref (reverse dependencies)\n * - Combinator parents (allOf/anyOf/oneOf) if applicable\n *\n * @param graph - The Graph structure containing nodes, dependencies, and reverseNodeDependencies.\n */\nexport const propagateScopes = (graph: Graph): void => {\n const worklist: Set<string> = new Set(\n Array.from(graph.nodes.entries())\n .filter(([, nodeInfo]) => nodeInfo.scopes && nodeInfo.scopes.size > 0)\n .map(([pointer]) => pointer),\n );\n\n /**\n * Notifies all dependents of a node that its scopes may have changed.\n * Dependents include:\n * - The parent node (if any)\n * - All nodes that reference this node via $ref (reverse dependencies)\n * - Combinator parents (allOf/anyOf/oneOf) if this node is a combinator child\n *\n * @param pointer - The JSON pointer of the node whose dependents to notify\n * @param nodeInfo - The NodeInfo of the node\n * @param childPointer - (Optional) The pointer of the child, used to detect combinator parents\n */\n const notifyAllDependents = (\n pointer: string,\n nodeInfo: NodeInfo,\n childPointer?: string,\n ) => {\n if (nodeInfo.parentPointer) {\n worklist.add(nodeInfo.parentPointer);\n }\n const reverseNodeDependencies = graph.reverseNodeDependencies.get(pointer);\n if (reverseNodeDependencies) {\n for (const dependentPointer of reverseNodeDependencies) {\n worklist.add(dependentPointer);\n }\n }\n if (childPointer) {\n // If this is a combinator child, notify the combinator parent\n const combinatorChildMatch = childPointer.match(\n /(.*)\\/(allOf|anyOf|oneOf)\\/\\d+$/,\n );\n if (combinatorChildMatch) {\n const combinatorParentPointer = combinatorChildMatch[1];\n if (combinatorParentPointer) {\n worklist.add(combinatorParentPointer);\n }\n }\n }\n };\n\n /**\n * Propagates scopes from a child node to its parent node.\n * If the parent's scopes change, notifies all dependents.\n *\n * @param pointer - The parent node's pointer\n * @param nodeInfo - The parent node's NodeInfo\n * @param childPointer - The child node's pointer\n */\n const propagateChildScopes = (\n pointer: string,\n nodeInfo: NodeInfo,\n childPointer: string,\n ): void => {\n if (!nodeInfo?.scopes) return;\n const childInfo = graph.nodes.get(childPointer);\n if (!childInfo?.scopes) return;\n const changed = propagateScopesToNode(childInfo, nodeInfo);\n if (changed) {\n notifyAllDependents(pointer, nodeInfo, childPointer);\n }\n };\n\n while (worklist.size > 0) {\n const pointer = worklist.values().next().value!;\n worklist.delete(pointer);\n\n const nodeInfo = graph.nodes.get(pointer);\n if (!nodeInfo) continue;\n\n if (!nodeInfo.scopes) {\n nodeInfo.scopes = new Set();\n }\n\n const node = nodeInfo.node as Record<string, unknown>;\n\n // Propagate scopes from all child schema relationships (combinators, properties, etc.)\n for (const [keyword, type] of childSchemaRelationships) {\n if (!node || typeof node !== 'object' || !(keyword in node)) continue;\n const value = node[keyword];\n if (type === 'array' && value instanceof Array) {\n for (let index = 0; index < value.length; index++) {\n const childPointer = `${pointer}/${keyword}/${index}`;\n propagateChildScopes(pointer, nodeInfo, childPointer);\n }\n } else if (\n type === 'objectMap' &&\n typeof value === 'object' &&\n value !== null &&\n !(value instanceof Array)\n ) {\n for (const key of Object.keys(value)) {\n const childPointer = `${pointer}/${keyword}/${key}`;\n propagateChildScopes(pointer, nodeInfo, childPointer);\n }\n } else if (\n type === 'single' &&\n typeof value === 'object' &&\n value !== null\n ) {\n const childPointer = `${pointer}/${keyword}`;\n propagateChildScopes(pointer, nodeInfo, childPointer);\n } else if (type === 'singleOrArray') {\n if (value instanceof Array) {\n for (let index = 0; index < value.length; index++) {\n const childPointer = `${pointer}/${keyword}/${index}`;\n propagateChildScopes(pointer, nodeInfo, childPointer);\n }\n } else if (typeof value === 'object' && value !== null) {\n const childPointer = `${pointer}/${keyword}`;\n propagateChildScopes(pointer, nodeInfo, childPointer);\n }\n }\n }\n\n // Propagate scopes from $ref dependencies\n const nodeDependencies = graph.nodeDependencies.get(pointer);\n if (nodeDependencies) {\n for (const depPointer of nodeDependencies) {\n const depNode = graph.nodes.get(depPointer);\n if (depNode?.scopes) {\n const changed = propagateScopesToNode(depNode, nodeInfo);\n if (changed) {\n notifyAllDependents(pointer, nodeInfo);\n }\n }\n }\n }\n\n // Propagate scopes up the parent chain\n if (nodeInfo.parentPointer) {\n const parentInfo = graph.nodes.get(nodeInfo.parentPointer);\n if (parentInfo) {\n const changed = propagateScopesToNode(nodeInfo, parentInfo);\n if (changed) {\n notifyAllDependents(nodeInfo.parentPointer, parentInfo);\n }\n }\n }\n }\n};\n\n/**\n * Propagates scopes from one node to another.\n * Adds any scopes from fromNodeInfo to toNodeInfo that are not already present.\n * Returns true if any scopes were added, false otherwise.\n *\n * @param fromNodeInfo - The node to propagate scopes from\n * @param toNodeInfo - The node to propagate scopes to\n * @returns boolean - Whether any scopes were added\n */\nconst propagateScopesToNode = (\n fromNodeInfo: NodeInfo,\n toNodeInfo: NodeInfo,\n): boolean => {\n if (!fromNodeInfo.scopes) {\n return false;\n }\n\n if (!toNodeInfo.scopes) {\n toNodeInfo.scopes = new Set();\n }\n\n let changed = false;\n\n for (const scope of fromNodeInfo.scopes) {\n if (!toNodeInfo.scopes.has(scope)) {\n toNodeInfo.scopes.add(scope);\n changed = true;\n }\n }\n\n return changed;\n};\n\n/**\n * Seeds each node in the graph with its local access scope(s) based on its own properties.\n * - 'read' if readOnly: true\n * - 'write' if writeOnly: true\n * - 'normal' if node is an object property\n *\n * Only non-array objects are considered for scope seeding.\n *\n * @param nodes - Map of JSON Pointer to NodeInfo.\n */\nexport const seedLocalScopes = (nodes: Graph['nodes']): void => {\n for (const [pointer, nodeInfo] of nodes) {\n const { node } = nodeInfo;\n\n if (typeof node !== 'object' || node === null || node instanceof Array) {\n continue;\n }\n\n if ('readOnly' in node && node.readOnly === true) {\n nodeInfo.scopes = new Set(['read']);\n } else if ('writeOnly' in node && node.writeOnly === true) {\n nodeInfo.scopes = new Set(['write']);\n } else if (pointer.match(/\\/properties\\/[^/]+$/)) {\n nodeInfo.scopes = new Set(['normal']);\n }\n }\n};\n\n/**\n * Builds a graph of all nodes in an OpenAPI spec, indexed by normalized JSON Pointer,\n * and tracks all $ref dependencies and reverse dependencies between nodes.\n *\n * - All keys in the returned maps are normalized JSON Pointers (RFC 6901, always starting with '#').\n * - The `nodes` map allows fast lookup of any node and its parent/key context.\n * - The `dependencies` map records, for each node, the set of normalized pointers it references via $ref.\n * - The `reverseNodeDependencies` map records, for each node, the set of nodes that reference it via $ref.\n * - After construction, all nodes will have their local and propagated scopes annotated.\n *\n * @param root The root object (e.g., the OpenAPI spec)\n * @returns An object with:\n * - nodes: Map from normalized JSON Pointer string to NodeInfo\n * - dependencies: Map from normalized JSON Pointer string to Set of referenced normalized JSON Pointers\n * - reverseNodeDependencies: Map from normalized JSON Pointer string to Set of referencing normalized JSON Pointers\n */\nexport const buildGraph = (\n root: unknown,\n logger: Logger,\n): {\n graph: Graph;\n} => {\n const eventBuildGraph = logger.timeEvent('build-graph');\n const graph: Graph = {\n nodeDependencies: new Map(),\n nodes: new Map(),\n reverseNodeDependencies: new Map(),\n subtreeDependencies: new Map(),\n transitiveDependencies: new Map(),\n };\n\n const walk = ({\n key,\n node,\n parentPointer,\n path,\n }: NodeInfo & {\n path: ReadonlyArray<string | number>;\n }) => {\n if (typeof node !== 'object' || node === null) {\n return;\n }\n\n const pointer = pathToJsonPointer(path);\n\n let deprecated: boolean | undefined;\n let tags: Set<string> | undefined;\n\n if (typeof node === 'object' && node !== null) {\n // Check for deprecated property\n if ('deprecated' in node && typeof node.deprecated === 'boolean') {\n deprecated = Boolean(node.deprecated);\n }\n // If this node has a $ref, record the dependency\n if ('$ref' in node && typeof node.$ref === 'string') {\n const refPointer = normalizeJsonPointer(node.$ref);\n if (!graph.nodeDependencies.has(pointer)) {\n graph.nodeDependencies.set(pointer, new Set());\n }\n graph.nodeDependencies.get(pointer)!.add(refPointer);\n }\n // Check for tags property (should be an array of strings)\n if ('tags' in node && node.tags instanceof Array) {\n tags = new Set(node.tags.filter((tag) => typeof tag === 'string'));\n }\n }\n\n graph.nodes.set(pointer, { deprecated, key, node, parentPointer, tags });\n\n if (node instanceof Array) {\n node.forEach((item, index) =>\n walk({\n key: index,\n node: item,\n parentPointer: pointer,\n path: [...path, index],\n }),\n );\n } else {\n for (const [childKey, value] of Object.entries(node)) {\n walk({\n key: childKey,\n node: value,\n parentPointer: pointer,\n path: [...path, childKey],\n });\n }\n }\n };\n\n walk({\n key: null,\n node: root,\n parentPointer: null,\n path: [],\n });\n\n const cache: Cache = {\n parentToChildren: new Map(),\n subtreeDependencies: new Map(),\n transitiveDependencies: new Map(),\n };\n\n for (const [pointer, nodeInfo] of graph.nodes) {\n const parent = nodeInfo.parentPointer;\n if (!parent) continue;\n if (!cache.parentToChildren.has(parent)) {\n cache.parentToChildren.set(parent, []);\n }\n cache.parentToChildren.get(parent)!.push(pointer);\n }\n\n for (const [pointerFrom, pointers] of graph.nodeDependencies) {\n for (const pointerTo of pointers) {\n if (!graph.reverseNodeDependencies.has(pointerTo)) {\n graph.reverseNodeDependencies.set(pointerTo, new Set());\n }\n graph.reverseNodeDependencies.get(pointerTo)!.add(pointerFrom);\n }\n }\n\n seedLocalScopes(graph.nodes);\n propagateScopes(graph);\n annotateChildScopes(graph.nodes);\n\n for (const pointer of graph.nodes.keys()) {\n const result = collectPointerDependencies({\n cache,\n graph,\n pointer,\n visited: new Set(),\n });\n graph.transitiveDependencies.set(pointer, result.transitiveDependencies);\n graph.subtreeDependencies.set(pointer, result.subtreeDependencies);\n }\n\n eventBuildGraph.timeEnd();\n\n // functions creating data for debug scripts located in `dev/`\n // const { maxChildren, maxDepth, totalNodes } = debugTools.graph.analyzeStructure(graph);\n // const nodesForViz = debugTools.graph.exportForVisualization(graph);\n // fs.writeFileSync('dev/graph.json', JSON.stringify(nodesForViz, null, 2));\n\n return { graph };\n};\n","import type { Graph } from '~/graph';\nimport type { Logger } from '~/utils/logger';\nimport { jsonPointerToPath } from '~/utils/ref';\n\nimport type { Config } from '../../../types/config';\nimport deepEqual from '../utils/deepEqual';\nimport { buildGraph, type Scope } from '../utils/graph';\nimport { buildName } from '../utils/name';\nimport { deepClone } from '../utils/schema';\nimport { childSchemaRelationships } from '../utils/schemaChildRelationships';\nimport {\n getSchemasObject,\n hasComponentsSchemasObject,\n hasDefinitionsObject,\n} from '../utils/transforms';\nimport {\n getUniqueComponentName,\n isPathRootSchema,\n specToSchemasPointerNamespace,\n} from './utils';\n\ntype OriginalSchemas = Record<string, unknown>;\n\ntype SplitSchemas = {\n /** Key is the original schema pointer. */\n mapping: Record<\n string,\n {\n read?: string;\n write?: string;\n }\n >;\n /** splitPointer -> originalPointer */\n reverseMapping: Record<string, string>;\n /** name -> schema object */\n schemas: Record<string, unknown>;\n};\n\ntype ReadWriteConfig = Config['parser']['transforms']['readWrite'];\n\nconst schemaKeys = new Set([\n 'additionalProperties',\n 'allOf',\n 'anyOf',\n 'items',\n 'not',\n 'oneOf',\n 'patternProperties',\n 'properties',\n 'schema',\n]);\n\nconst getComponentContext = (\n path: ReadonlyArray<string | number>,\n): Scope | undefined => {\n // OpenAPI 3.x: #/components/{type}/{name}\n if (path.length === 3 && path[0] === 'components') {\n const type = path[1];\n if (type === 'parameters') return 'write';\n if (type === 'requestBodies') return 'write';\n if (type === 'responses') return 'read';\n if (type === 'headers') return 'read';\n }\n // OpenAPI 2.x: #/parameters/{name}, #/responses/{name}\n if (path.length === 2) {\n const type = path[0];\n if (type === 'parameters') return 'write';\n if (type === 'responses') return 'read';\n }\n return;\n};\n\n/**\n * Capture the original schema objects by pointer before splitting.\n * This is used to safely remove only the true originals after splitting,\n * even if names are swapped or overwritten by split variants.\n */\nconst captureOriginalSchemas = (\n spec: unknown,\n logger: Logger,\n): OriginalSchemas => {\n const event = logger.timeEvent('capture-original-schemas');\n const originals: OriginalSchemas = {};\n if (hasComponentsSchemasObject(spec)) {\n for (const [name, obj] of Object.entries(\n (spec as any).components.schemas,\n )) {\n originals[`#/components/schemas/${name}`] = obj;\n }\n } else if (hasDefinitionsObject(spec)) {\n for (const [name, obj] of Object.entries((spec as any).definitions)) {\n originals[`#/definitions/${name}`] = obj;\n }\n }\n event.timeEnd();\n return originals;\n};\n\n/**\n * Inserts split schemas into the spec at the correct location (OpenAPI 3.x or 2.0).\n * This function is robust to spec version and will assign all split schemas\n * to either components.schemas (OAS3) or definitions (OAS2).\n *\n * @param spec - The OpenAPI spec object\n * @param split - The split schemas (from splitSchemas)\n */\nconst insertSplitSchemasIntoSpec = ({\n logger,\n spec,\n split,\n}: {\n logger: Logger;\n spec: unknown;\n split: Pick<SplitSchemas, 'schemas'>;\n}) => {\n const event = logger.timeEvent('insert-split-schemas-into-spec');\n if (hasComponentsSchemasObject(spec)) {\n Object.assign((spec as any).components.schemas, split.schemas);\n } else if (hasDefinitionsObject(spec)) {\n Object.assign((spec as any).definitions, split.schemas);\n }\n event.timeEnd();\n};\n\n/**\n * Prunes a schema by removing all child schemas (in any structural keyword)\n * that are marked with the given scope (readOnly/writeOnly), or that are $ref to a schema\n * that is exclusively the excluded scope (according to the graph).\n *\n * Uses childSchemaRelationships for parity with graph traversal.\n * Returns true if the schema itself should be removed from its parent.\n *\n * @param graph - The Graph containing all nodes and their scopes\n * @param schema - The schema object to prune\n * @param scope - The scope to exclude ('readOnly' or 'writeOnly')\n * @returns boolean - Whether the schema should be removed from its parent\n */\nconst pruneSchemaByScope = (\n graph: Graph,\n schema: unknown,\n scope: 'readOnly' | 'writeOnly',\n): boolean => {\n if (schema && typeof schema === 'object') {\n // Handle $ref schemas\n if ('$ref' in schema && typeof schema.$ref === 'string') {\n const nodeInfo = graph.nodes.get(schema.$ref);\n if (nodeInfo?.scopes) {\n // Only remove $ref if the referenced schema is *exclusively* the excluded scope.\n // This ensures 'normal' or multi-scope schemas are always kept.\n if (\n (scope === 'writeOnly' &&\n nodeInfo.scopes.size === 1 &&\n nodeInfo.scopes.has('write')) ||\n (scope === 'readOnly' &&\n nodeInfo.scopes.size === 1 &&\n nodeInfo.scopes.has('read'))\n ) {\n delete (schema as Record<string, unknown>)['$ref'];\n // If the schema is now empty, remove it\n if (\n !childSchemaRelationships.some(([keyword]) => keyword in schema)\n ) {\n return true;\n }\n }\n }\n }\n // Recursively prune all child schemas according to childSchemaRelationships\n for (const [keyword, type] of childSchemaRelationships) {\n if (!(keyword in schema)) {\n continue;\n }\n const value = (schema as Record<string, unknown>)[keyword];\n if (type === 'array' && value instanceof Array) {\n for (let index = value.length - 1; index >= 0; index--) {\n const item = value[index];\n if (\n item &&\n typeof item === 'object' &&\n (item as Record<string, unknown>)[scope] === true\n ) {\n value.splice(index, 1);\n } else {\n const shouldRemove = pruneSchemaByScope(graph, item, scope);\n if (shouldRemove) value.splice(index, 1);\n }\n }\n if (!value.length) {\n delete (schema as Record<string, unknown>)[keyword];\n }\n } else if (\n type === 'objectMap' &&\n typeof value === 'object' &&\n value !== null &&\n !(value instanceof Array)\n ) {\n const objMap = value as Record<string, unknown>;\n // Track removed properties for object schemas to update required array\n const removedProperties = new Set<string>();\n\n for (const key of Object.keys(objMap)) {\n const prop = objMap[key];\n if (\n prop &&\n typeof prop === 'object' &&\n (prop as Record<string, unknown>)[scope] === true\n ) {\n delete objMap[key];\n // Track removed properties for object schemas\n if (keyword === 'properties') {\n removedProperties.add(key);\n }\n } else {\n const shouldRemove = pruneSchemaByScope(graph, prop, scope);\n if (shouldRemove) {\n delete objMap[key];\n // Track removed properties for object schemas\n if (keyword === 'properties') {\n removedProperties.add(key);\n }\n }\n }\n }\n\n // Update required array if properties were removed\n if (\n removedProperties.size > 0 &&\n keyword === 'properties' &&\n 'required' in schema &&\n Array.isArray((schema as Record<string, unknown>).required)\n ) {\n const required = (schema as Record<string, unknown>)\n .required as string[];\n const filteredRequired = required.filter(\n (prop) => !removedProperties.has(prop),\n );\n\n if (!filteredRequired.length) {\n delete (schema as Record<string, unknown>).required;\n } else {\n (schema as Record<string, unknown>).required = filteredRequired;\n }\n }\n\n if (!Object.keys(objMap).length) {\n delete (schema as Record<string, unknown>)[keyword];\n }\n } else if (\n type === 'single' &&\n typeof value === 'object' &&\n value !== null\n ) {\n if ((value as Record<string, unknown>)[scope] === true) {\n delete (schema as Record<string, unknown>)[keyword];\n } else {\n const shouldRemove = pruneSchemaByScope(graph, value, scope);\n if (shouldRemove) {\n delete (schema as Record<string, unknown>)[keyword];\n }\n }\n } else if (type === 'singleOrArray') {\n if (value instanceof Array) {\n for (let index = value.length - 1; index >= 0; index--) {\n const item = value[index];\n if (\n item &&\n typeof item === 'object' &&\n (item as Record<string, unknown>)[scope] === true\n ) {\n value.splice(index, 1);\n } else {\n const shouldRemove = pruneSchemaByScope(graph, item, scope);\n if (shouldRemove) value.splice(index, 1);\n }\n }\n if (!value.length) {\n delete (schema as Record<string, unknown>)[keyword];\n }\n } else if (typeof value === 'object' && value !== null) {\n if ((value as Record<string, unknown>)[scope] === true) {\n delete (schema as Record<string, unknown>)[keyword];\n } else {\n const shouldRemove = pruneSchemaByScope(graph, value, scope);\n if (shouldRemove) {\n delete (schema as Record<string, unknown>)[keyword];\n }\n }\n }\n }\n }\n // After all removals, if this is type: object and has no structural fields, remove it\n if (\n (schema as Record<string, unknown>).type === 'object' &&\n !childSchemaRelationships.some(([keyword]) => keyword in schema)\n ) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Remove only the true original schemas that were split, by object identity.\n * This is robust to swaps, overwrites, and name collisions.\n *\n * @param originalSchemas - Map of original pointers to their schema objects (captured before splitting)\n * @param spec - The OpenAPI spec object\n * @param split - The split mapping (from splitSchemas)\n */\nconst removeOriginalSplitSchemas = ({\n logger,\n originalSchemas,\n spec,\n split,\n}: {\n logger: Logger;\n originalSchemas: OriginalSchemas;\n spec: unknown;\n split: Pick<SplitSchemas, 'mapping'>;\n}) => {\n const event = logger.timeEvent('remove-original-split-schemas');\n const schemasObj = getSchemasObject(spec);\n\n for (const originalPointer of Object.keys(split.mapping)) {\n const path = jsonPointerToPath(originalPointer);\n const name = path[path.length - 1]!;\n if (\n typeof name === 'string' &&\n schemasObj &&\n Object.prototype.hasOwnProperty.call(schemasObj, name) &&\n schemasObj[name] === originalSchemas[originalPointer]\n ) {\n delete schemasObj[name];\n }\n }\n event.timeEnd();\n};\n\n/**\n * Splits schemas with both 'read' and 'write' scopes into read/write variants.\n * Returns the new schemas and a mapping from original pointer to new variant pointers.\n *\n * @param config - The readWrite transform config\n * @param graph - The Graph containing all nodes and their scopes\n * @param spec - The OpenAPI spec object\n * @returns SplitSchemas - The split schemas and pointer mappings\n */\nexport const splitSchemas = ({\n config,\n graph,\n logger,\n spec,\n}: {\n config: ReadWriteConfig;\n graph: Graph;\n logger: Logger;\n spec: unknown;\n}): SplitSchemas => {\n const event = logger.timeEvent('split-schemas');\n const existingNames = new Set<string>();\n const split: SplitSchemas = {\n mapping: {},\n reverseMapping: {},\n schemas: {},\n };\n\n const schemasPointerNamespace = specToSchemasPointerNamespace(spec);\n const schemasNamespaceSegments =\n schemasPointerNamespace.split('/').length - 1;\n\n /**\n * Extracts the schema name from pointer, but only if it's a top-level schema\n * pointer. Returns an empty string if it's a nested pointer.\n * @param pointer\n * @returns Schema's base name.\n */\n const pointerToSchema = (pointer: string): string => {\n if (pointer.startsWith(schemasPointerNamespace)) {\n const path = jsonPointerToPath(pointer);\n if (path.length === schemasNamespaceSegments) {\n return path[schemasNamespaceSegments - 1] || '';\n }\n }\n return '';\n };\n\n // Collect all existing schema names\n for (const pointer of graph.nodes.keys()) {\n const name = pointerToSchema(pointer);\n if (name) existingNames.add(name);\n }\n\n for (const [pointer, nodeInfo] of graph.nodes) {\n const name = pointerToSchema(pointer);\n // Only split top-level schemas, with either read-only or write-only scopes (or both).\n if (\n !name ||\n !(nodeInfo.scopes?.has('read') || nodeInfo.scopes?.has('write')) ||\n !nodeInfo.scopes?.has('normal')\n ) {\n continue;\n }\n\n // read variant\n const readSchema = deepClone<unknown>(nodeInfo.node);\n pruneSchemaByScope(graph, readSchema, 'writeOnly');\n const readBase = buildName({\n config: config.responses,\n name,\n });\n const readName =\n readBase === name\n ? readBase\n : getUniqueComponentName({\n base: readBase,\n components: existingNames,\n });\n existingNames.add(readName);\n split.schemas[readName] = readSchema;\n const readPointer = `${schemasPointerNamespace}${readName}`;\n\n // write variant\n const writeSchema = deepClone<unknown>(nodeInfo.node);\n pruneSchemaByScope(graph, writeSchema, 'readOnly');\n\n // Check if this schema (or any of its descendants) references any schema that\n // will need read/write variants. This is determined by checking transitive\n // dependencies for schemas with both 'normal' and ('read' or 'write') scopes.\n const transitiveDeps =\n graph.transitiveDependencies.get(pointer) || new Set();\n const referencesReadWriteSchemas = Array.from(transitiveDeps).some(\n (depPointer) => {\n const depNodeInfo = graph.nodes.get(depPointer);\n return (\n depNodeInfo?.scopes?.has('normal') &&\n (depNodeInfo.scopes.has('read') || depNodeInfo.scopes.has('write'))\n );\n },\n );\n\n // If pruning did not change anything (both variants equal and equal to original),\n // and the schema doesn't reference any schemas that will have read/write variants,\n // skip splitting and keep the original single schema.\n if (\n !referencesReadWriteSchemas &&\n deepEqual(readSchema, writeSchema) &&\n deepEqual(readSchema, nodeInfo.node)\n ) {\n continue;\n }\n const writeBase = buildName({\n config: config.requests,\n name,\n });\n const writeName =\n writeBase === name && writeBase !== readName\n ? writeBase\n : getUniqueComponentName({\n base: writeBase,\n components: existingNames,\n });\n existingNames.add(writeName);\n split.schemas[writeName] = writeSchema;\n const writePointer = `${schemasPointerNamespace}${writeName}`;\n\n split.mapping[pointer] = {\n read: readPointer,\n write: writePointer,\n };\n split.reverseMapping[readPointer] = pointer;\n split.reverseMapping[writePointer] = pointer;\n }\n\n event.timeEnd();\n return split;\n};\n\ntype WalkArgs = {\n context: Scope | null;\n currentPointer: string | null;\n inSchema: boolean;\n node: unknown;\n path: ReadonlyArray<string | number>;\n visited?: Set<string>;\n};\n\n/**\n * Recursively updates $ref fields in the spec to point to the correct read/write variant\n * according to the current context (read/write), using the split mapping.\n *\n * @param spec - The OpenAPI spec object\n * @param split - The split mapping (from splitSchemas)\n */\nexport const updateRefsInSpec = ({\n logger,\n spec,\n split,\n}: {\n logger: Logger;\n spec: unknown;\n split: Omit<SplitSchemas, 'schemas'>;\n}): void => {\n const event = logger.timeEvent('update-refs-in-spec');\n const schemasPointerNamespace = specToSchemasPointerNamespace(spec);\n\n const walk = ({\n context,\n currentPointer,\n inSchema,\n node,\n path,\n visited = new Set(),\n }: WalkArgs): void => {\n if (node instanceof Array) {\n node.forEach((item, index) =>\n walk({\n context,\n currentPointer,\n inSchema,\n node: item,\n path: [...path, index],\n visited,\n }),\n );\n } else if (node && typeof node === 'object') {\n // Detect if we're entering a split schema variant\n let nextPointer = currentPointer;\n let nextContext = context;\n if (isPathRootSchema(path)) {\n // Use the last path segment instead of a fixed index (path[2]) because\n // path depth varies across OAS2/OAS3 and contexts; fixed indexing is brittle.\n const nameSegment = path[path.length - 1] as string;\n nextPointer = `${schemasPointerNamespace}${nameSegment}`;\n const originalPointer = split.reverseMapping[nextPointer];\n if (originalPointer) {\n const mapping = split.mapping[originalPointer];\n if (mapping?.read === nextPointer) {\n nextContext = 'read';\n } else if (mapping?.write === nextPointer) {\n nextContext = 'write';\n }\n }\n // For schemas that are not split variants, keep the inherited context.\n // This ensures that $refs inside these schemas are resolved based on\n // where the schema is actually used (requestBody vs responses), not\n // based on the schema's own scopes which track readOnly/writeOnly fields.\n }\n\n const compContext = getComponentContext(path);\n if (compContext !== undefined) {\n // For each component, walk with the correct context\n for (const key in node) {\n if (!Object.prototype.hasOwnProperty.call(node, key)) {\n continue;\n }\n walk({\n context: compContext,\n currentPointer: nextPointer,\n inSchema: false,\n node: (node as Record<string, unknown>)[key],\n path: [...path, key],\n visited,\n });\n }\n return;\n }\n\n for (const key in node) {\n if (!Object.prototype.hasOwnProperty.call(node, key)) {\n continue;\n }\n const value = (node as Record<string, unknown>)[key];\n\n // Only treat context switches at the OpenAPI structure level (not inside schemas)\n if (!inSchema) {\n if (key === 'requestBody') {\n walk({\n context: 'write',\n currentPointer: nextPointer,\n inSchema: false,\n node: value,\n path: [...path, key],\n visited,\n });\n continue;\n }\n if (key === 'responses') {\n walk({\n context: 'read',\n currentPointer: nextPointer,\n inSchema: false,\n node: value,\n path: [...path, key],\n visited,\n });\n continue;\n }\n if (key === 'parameters' && Array.isArray(value)) {\n value.forEach((param, index) => {\n if (param && typeof param === 'object' && 'schema' in param) {\n walk({\n context: 'write',\n currentPointer: nextPointer,\n inSchema: true,\n node: param.schema,\n path: [...path, key, index, 'schema'],\n visited,\n });\n }\n // Also handle content (OpenAPI 3.x)\n if (param && typeof param === 'object' && 'content' in param) {\n walk({\n context: 'write',\n currentPointer: nextPointer,\n inSchema: false,\n node: param.content,\n path: [...path, key, index, 'content'],\n visited,\n });\n }\n });\n continue;\n }\n // OpenAPI 3.x: headers in responses\n if (\n key === 'headers' &&\n typeof value === 'object' &&\n value !== null\n ) {\n for (const headerKey in value) {\n if (!Object.prototype.hasOwnProperty.call(value, headerKey)) {\n continue;\n }\n walk({\n context: 'read',\n currentPointer: nextPointer,\n inSchema: false,\n node: (value as Record<string, unknown>)[headerKey],\n path: [...path, key, headerKey],\n visited,\n });\n }\n continue;\n }\n }\n\n // Entering a schema context\n if (schemaKeys.has(key)) {\n walk({\n context: nextContext,\n currentPointer: nextPointer,\n inSchema: true,\n node: value,\n path: [...path, key],\n visited,\n });\n } else if (key === '$ref' && typeof value === 'string') {\n // Prefer exact match first\n const map = split.mapping[value];\n if (map) {\n if (nextContext === 'read' && map.read) {\n (node as Record<string, unknown>)[key] = map.read;\n } else if (nextContext === 'write' && map.write) {\n (node as Record<string, unknown>)[key] = map.write;\n } else if (!nextContext && map.read) {\n // For schemas with no context (unused in operations), default to read variant\n // This ensures $refs in unused schemas don't point to removed originals\n (node as Record<string, unknown>)[key] = map.read;\n }\n }\n } else {\n walk({\n context: nextContext,\n currentPointer: nextPointer,\n inSchema,\n node: value,\n path: [...path, key],\n visited,\n });\n }\n }\n }\n };\n walk({\n context: null,\n currentPointer: null,\n inSchema: false,\n node: spec,\n path: [],\n });\n event.timeEnd();\n};\n\n/**\n * Orchestrates the full read/write transform:\n * - Captures original schemas\n * - Splits schemas into read/write variants\n * - Inserts split schemas into the spec\n * - Updates $refs throughout the spec\n * - Removes original schemas that were split\n *\n * @param config - The readWrite transform config\n * @param spec - The OpenAPI spec object\n */\nexport const readWriteTransform = ({\n config,\n logger,\n spec,\n}: {\n config: ReadWriteConfig;\n logger: Logger;\n spec: unknown;\n}) => {\n const { graph } = buildGraph(spec, logger);\n const originalSchemas = captureOriginalSchemas(spec, logger);\n const split = splitSchemas({ config, graph, logger, spec });\n insertSplitSchemasIntoSpec({ logger, spec, split });\n updateRefsInSpec({ logger, spec, split });\n removeOriginalSplitSchemas({ logger, originalSchemas, spec, split });\n};\n","import type { Context } from '~/ir/context';\n\nimport { enumsTransform } from './enums';\nimport { propertiesRequiredByDefaultTransform } from './propertiesRequiredByDefault';\nimport { readWriteTransform } from './readWrite';\n\nexport const transformOpenApiSpec = ({ context }: { context: Context }) => {\n const { logger } = context;\n const eventTransformOpenApiSpec = logger.timeEvent('transform-openapi-spec');\n if (context.config.parser.transforms.enums.enabled) {\n enumsTransform({\n config: context.config.parser.transforms.enums,\n spec: context.spec,\n });\n }\n\n if (context.config.parser.transforms.propertiesRequiredByDefault) {\n propertiesRequiredByDefaultTransform({ spec: context.spec });\n }\n\n if (context.config.parser.transforms.readWrite.enabled) {\n readWriteTransform({\n config: context.config.parser.transforms.readWrite,\n logger,\n spec: context.spec,\n });\n }\n eventTransformOpenApiSpec.timeEnd();\n};\n","import type { IR } from '~/ir/types';\n\nexport const mergeParametersObjects = ({\n source,\n target,\n}: {\n source: IR.ParametersObject | undefined;\n target: IR.ParametersObject | undefined;\n}): IR.ParametersObject | undefined => {\n const result = { ...target };\n\n if (source) {\n if (source.cookie) {\n if (result.cookie) {\n result.cookie = {\n ...result.cookie,\n ...source.cookie,\n };\n } else {\n result.cookie = source.cookie;\n }\n }\n\n if (source.header) {\n if (result.header) {\n result.header = {\n ...result.header,\n ...source.header,\n };\n } else {\n result.header = source.header;\n }\n }\n\n if (source.path) {\n if (result.path) {\n result.path = {\n ...result.path,\n ...source.path,\n };\n } else {\n result.path = source.path;\n }\n }\n\n if (source.query) {\n if (result.query) {\n result.query = {\n ...result.query,\n ...source.query,\n };\n } else {\n result.query = source.query;\n }\n }\n }\n\n if (!Object.keys(result).length) {\n return;\n }\n\n return result;\n};\n","import colors from 'ansi-colors';\n\nimport type { Context } from '~/ir/context';\n\nexport interface ValidatorIssue {\n /**\n * Machine-readable issue code\n *\n * @example\n * 'invalid_type'\n */\n code: 'duplicate_key' | 'invalid_type' | 'missing_required_field';\n /**\n * Optional additional data.\n *\n * @example\n * 'expectedType'\n */\n context?: Record<string, any>;\n /**\n * Human-readable issue summary.\n */\n message: string;\n /**\n * JSONPath-like array to issue location.\n */\n path: ReadonlyArray<string | number>;\n /**\n * Error severity.\n */\n severity: 'error' | 'warning';\n}\n\nexport interface ValidatorResult {\n issues: ReadonlyArray<ValidatorIssue>;\n valid: boolean;\n}\n\nconst isSimpleKey = (key: string) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);\n\nconst formatPath = (path: ReadonlyArray<string | number>): string =>\n path\n .map((segment, i) => {\n if (typeof segment === 'number') {\n return `[${segment}]`;\n }\n\n if (i === 0) {\n // first segment no dot or brackets\n return segment;\n }\n\n return isSimpleKey(segment)\n ? `.${segment}`\n : `['${segment.replace(/\"/g, \"\\\\'\")}']`;\n })\n .join('');\n\nconst formatValidatorIssue = (issue: ValidatorIssue): string => {\n const pathStr = formatPath(issue.path);\n const level =\n issue.severity === 'error' ? colors.bold.red : colors.bold.yellow;\n\n const highlightedMessage = issue.message.replace(/`([^`]+)`/g, (_, code) =>\n colors.yellow(`\\`${code}\\``),\n );\n\n return `${level(`[${issue.severity.toUpperCase()}]`)} ${colors.cyan(pathStr)}: ${highlightedMessage}`;\n};\n\nconst shouldPrint = ({\n context,\n issue,\n}: {\n context: Context;\n issue: ValidatorIssue;\n}) => {\n if (context.config.logs.level === 'silent') {\n return false;\n }\n\n if (issue.severity === 'error') {\n return context.config.logs.level !== 'warn';\n }\n\n return true;\n};\n\nexport const handleValidatorResult = ({\n context,\n result,\n}: {\n context: Context;\n result: ValidatorResult;\n}) => {\n for (const issue of result.issues) {\n if (shouldPrint({ context, issue })) {\n console.log(formatValidatorIssue(issue));\n }\n }\n\n if (!result.valid) {\n process.exit(1);\n }\n};\n","import { createOperationKey } from '~/ir/operation';\nimport { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter';\nimport { httpMethods } from '~/openApi/shared/utils/operation';\nimport type { Logger } from '~/utils/logger';\n\nimport type {\n OpenApiV2_0_X,\n OperationObject,\n PathItemObject,\n PathsObject,\n} from '../types/spec';\n\n/**\n * Replace source spec with filtered version.\n */\nexport const filterSpec = ({\n logger,\n operations,\n preserveOrder,\n schemas,\n spec,\n}: {\n logger: Logger;\n operations: Set<string>;\n parameters: Set<string>;\n preserveOrder: boolean;\n requestBodies: Set<string>;\n responses: Set<string>;\n schemas: Set<string>;\n spec: OpenApiV2_0_X;\n}) => {\n const eventFilterSpec = logger.timeEvent('filter-spec');\n if (spec.definitions) {\n const filtered: typeof spec.definitions = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(spec.definitions)) {\n if (schemas.has(addNamespace('schema', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of schemas) {\n const { name } = removeNamespace(key);\n const source = spec.definitions[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.definitions = filtered;\n }\n\n if (spec.paths) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n\n for (const method of httpMethods) {\n // @ts-expect-error\n const operation = pathItem[method] as OperationObject;\n if (!operation) {\n continue;\n }\n\n const key = addNamespace(\n 'operation',\n createOperationKey({ method, path }),\n );\n if (!operations.has(key)) {\n // @ts-expect-error\n delete pathItem[method];\n }\n }\n\n // remove paths that have no operations left\n if (!Object.keys(pathItem).length) {\n delete spec.paths[path];\n }\n }\n }\n eventFilterSpec.timeEnd();\n};\n","const fileLikeRegExp =\n /^(application\\/(pdf|rtf|msword|vnd\\.(ms-|openxmlformats-officedocument\\.)|zip|x-(7z|tar|rar|zip|iso)|octet-stream|gzip|x-msdownload|json\\+download|xml|x-yaml|x-7z-compressed|x-tar)|text\\/(yaml|css|javascript)|audio\\/(mpeg|wav)|video\\/(mp4|x-matroska)|image\\/(vnd\\.adobe\\.photoshop|svg\\+xml))(; ?charset=[^;]+)?$/i;\nconst jsonMimeRegExp = /^application\\/(.*\\+)?json(;.*)?$/i;\nconst multipartFormDataMimeRegExp = /^multipart\\/form-data(;.*)?$/i;\nconst textMimeRegExp = /^text\\/[a-z0-9.+-]+(;.*)?$/i;\nconst xWwwFormUrlEncodedMimeRegExp =\n /^application\\/x-www-form-urlencoded(;.*)?$/i;\nconst octetStreamMimeRegExp = /^application\\/octet-stream(;.*)?$/i;\n\nexport type IRMediaType =\n | 'form-data'\n | 'json'\n | 'text'\n | 'url-search-params'\n | 'octet-stream';\n\nexport const isMediaTypeFileLike = ({\n mediaType,\n}: {\n mediaType: string;\n}): boolean => {\n fileLikeRegExp.lastIndex = 0;\n return fileLikeRegExp.test(mediaType);\n};\n\nexport const mediaTypeToIrMediaType = ({\n mediaType,\n}: {\n mediaType: string;\n}): IRMediaType | undefined => {\n jsonMimeRegExp.lastIndex = 0;\n if (jsonMimeRegExp.test(mediaType)) {\n return 'json';\n }\n\n multipartFormDataMimeRegExp.lastIndex = 0;\n if (multipartFormDataMimeRegExp.test(mediaType)) {\n return 'form-data';\n }\n\n textMimeRegExp.lastIndex = 0;\n if (textMimeRegExp.test(mediaType)) {\n return 'text';\n }\n\n xWwwFormUrlEncodedMimeRegExp.lastIndex = 0;\n if (xWwwFormUrlEncodedMimeRegExp.test(mediaType)) {\n return 'url-search-params';\n }\n\n octetStreamMimeRegExp.lastIndex = 0;\n if (octetStreamMimeRegExp.test(mediaType)) {\n return 'octet-stream';\n }\n\n return;\n};\n","import type { IRMediaType } from '~/ir/mediaType';\nimport { isMediaTypeFileLike, mediaTypeToIrMediaType } from '~/ir/mediaType';\n\nimport type {\n ReferenceObject,\n ResponseObject,\n SchemaObject,\n} from '../types/spec';\n\ninterface Content {\n mediaType: string;\n schema: SchemaObject | ReferenceObject | undefined;\n type: IRMediaType | undefined;\n}\n\nexport const contentToSchema = ({\n content,\n}: {\n content: Content;\n}): SchemaObject | undefined => {\n const { mediaType, schema } = content;\n\n if (schema && '$ref' in schema) {\n return {\n allOf: [{ ...schema }],\n };\n }\n\n if (!schema) {\n if (isMediaTypeFileLike({ mediaType })) {\n return {\n format: 'binary',\n type: 'string',\n };\n }\n return;\n }\n\n if (\n schema.type === 'string' &&\n !schema.format &&\n isMediaTypeFileLike({ mediaType })\n ) {\n return {\n ...schema,\n format: 'binary',\n };\n }\n\n return schema;\n};\n\nexport const mediaTypeObjects = ({\n mimeTypes,\n response,\n}: {\n mimeTypes: ReadonlyArray<string> | undefined;\n response: Pick<ResponseObject, 'schema'>;\n}): ReadonlyArray<Content> => {\n const objects: Array<Content> = [];\n\n for (const mediaType of mimeTypes ?? []) {\n objects.push({\n mediaType,\n schema: response.schema,\n type: mediaTypeToIrMediaType({ mediaType }),\n });\n }\n\n return objects;\n};\n","import type { Config } from '~/types/config';\n\nimport type { IR } from './types';\n\nexport function getPaginationKeywordsRegExp(\n pagination: Config['parser']['pagination'],\n): RegExp {\n const pattern = `^(${pagination.keywords.join('|')})$`;\n return new RegExp(pattern);\n}\n\nexport interface Pagination {\n in: 'body' | 'cookie' | 'header' | 'path' | 'query';\n name: string;\n schema: IR.SchemaObject;\n}\n","import { refToName } from '~/utils/ref';\n\nexport const discriminatorValues = (\n $ref: string,\n mapping?: Record<string, string>,\n shouldUseRefAsValue?: () => boolean,\n): ReadonlyArray<string> => {\n const values: Array<string> = [];\n\n for (const name in mapping) {\n if (mapping[name] === $ref) {\n values.push(name);\n }\n }\n\n if (!values.length && (!shouldUseRefAsValue || shouldUseRefAsValue())) {\n return [refToName($ref)];\n }\n\n return values;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { addItemsToSchema } from '~/ir/utils';\nimport type {\n SchemaState,\n SchemaType,\n SchemaWithRequired,\n} from '~/openApi/shared/types/schema';\nimport { discriminatorValues } from '~/openApi/shared/utils/discriminator';\nimport { refToName } from '~/utils/ref';\n\nimport type { SchemaObject } from '../types/spec';\n\nexport const getSchemaType = ({\n schema,\n}: {\n schema: SchemaObject;\n}): SchemaType<SchemaObject> | undefined => {\n if (schema.type) {\n return schema.type;\n }\n\n // infer object based on the presence of properties\n if (schema.properties) {\n return 'object';\n }\n\n return;\n};\n\nconst parseSchemaJsDoc = ({\n irSchema,\n schema,\n}: {\n irSchema: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n if (schema.example) {\n irSchema.example = schema.example;\n }\n\n if (schema.description) {\n irSchema.description = schema.description;\n }\n\n if (schema.title) {\n irSchema.title = schema.title;\n }\n};\n\nconst parseSchemaMeta = ({\n irSchema,\n schema,\n}: {\n irSchema: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n if (schema.default !== undefined) {\n irSchema.default = schema.default;\n }\n\n if (schema.exclusiveMaximum) {\n if (schema.maximum !== undefined) {\n irSchema.exclusiveMaximum = schema.maximum;\n }\n } else if (schema.maximum !== undefined) {\n irSchema.maximum = schema.maximum;\n }\n\n if (schema.exclusiveMinimum) {\n if (schema.minimum !== undefined) {\n irSchema.exclusiveMinimum = schema.minimum;\n }\n } else if (schema.minimum !== undefined) {\n irSchema.minimum = schema.minimum;\n }\n\n if (schema.format) {\n irSchema.format = schema.format;\n }\n\n if (schema.maxItems !== undefined) {\n irSchema.maxItems = schema.maxItems;\n }\n\n if (schema.maxLength !== undefined) {\n irSchema.maxLength = schema.maxLength;\n }\n\n if (schema.minItems !== undefined) {\n irSchema.minItems = schema.minItems;\n }\n\n if (schema.minLength !== undefined) {\n irSchema.minLength = schema.minLength;\n }\n\n if (schema.pattern) {\n irSchema.pattern = schema.pattern;\n }\n\n if (schema.readOnly) {\n irSchema.accessScope = 'read';\n }\n};\n\nconst parseArray = ({\n context,\n irSchema = {},\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (schema.maxItems && schema.maxItems === schema.minItems) {\n irSchema.type = 'tuple';\n } else {\n irSchema.type = 'array';\n }\n\n let schemaItems: Array<IR.SchemaObject> = [];\n\n if (schema.items) {\n const irItemsSchema = schemaToIrSchema({\n context,\n schema: schema.items,\n state,\n });\n\n if (\n !schemaItems.length &&\n schema.maxItems &&\n schema.maxItems === schema.minItems\n ) {\n schemaItems = Array(schema.maxItems).fill(irItemsSchema);\n } else {\n if ('$ref' in schema.items) {\n schemaItems.push(irItemsSchema);\n } else {\n const ofArray = schema.items.allOf;\n if (ofArray && ofArray.length > 1 && !schema.items['x-nullable']) {\n // bring composition up to avoid incorrectly nested arrays\n irSchema = {\n ...irSchema,\n ...irItemsSchema,\n };\n } else {\n schemaItems.push(irItemsSchema);\n }\n }\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseBoolean = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'boolean';\n\n return irSchema;\n};\n\nconst parseNumber = ({\n irSchema = {},\n schema,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = schema.type;\n\n return irSchema;\n};\n\nconst parseObject = ({\n context,\n irSchema = {},\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'object';\n\n const schemaProperties: Record<string, IR.SchemaObject> = {};\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n if (typeof property === 'boolean') {\n // TODO: parser - handle boolean properties\n } else {\n const irPropertySchema = schemaToIrSchema({\n context,\n schema: property,\n state,\n });\n schemaProperties[name] = irPropertySchema;\n }\n }\n\n if (Object.keys(schemaProperties).length) {\n irSchema.properties = schemaProperties;\n }\n\n if (schema.additionalProperties === undefined) {\n if (!irSchema.properties) {\n irSchema.additionalProperties = {\n type: 'unknown',\n };\n }\n } else if (typeof schema.additionalProperties === 'boolean') {\n // Avoid [key: string]: never for empty objects with additionalProperties: false inside allOf\n // This would override inherited properties from other schemas in the composition\n const isEmptyObjectInAllOf =\n state.inAllOf &&\n schema.additionalProperties === false &&\n (!schema.properties || !Object.keys(schema.properties).length);\n\n if (!isEmptyObjectInAllOf) {\n irSchema.additionalProperties = {\n type: schema.additionalProperties ? 'unknown' : 'never',\n };\n }\n } else {\n const irAdditionalPropertiesSchema = schemaToIrSchema({\n context,\n schema: schema.additionalProperties,\n state,\n });\n irSchema.additionalProperties = irAdditionalPropertiesSchema;\n }\n\n if (schema.required) {\n irSchema.required = schema.required;\n }\n\n return irSchema;\n};\n\nconst parseString = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'string';\n\n return irSchema;\n};\n\nconst initIrSchema = ({\n schema,\n}: {\n schema: SchemaObject;\n}): IR.SchemaObject => {\n const irSchema: IR.SchemaObject = {};\n\n parseSchemaJsDoc({\n irSchema,\n schema,\n });\n\n return irSchema;\n};\n\nconst parseAllOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'allOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n const schemaItems: Array<IR.SchemaObject> = [];\n const schemaType = getSchemaType({ schema });\n\n const compositionSchemas = schema.allOf;\n\n for (const compositionSchema of compositionSchemas) {\n const originalInAllOf = state.inAllOf;\n // Don't propagate inAllOf flag to $ref schemas to avoid issues with reusable components\n if (!('$ref' in compositionSchema)) {\n state.inAllOf = true;\n }\n const irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n state.inAllOf = originalInAllOf;\n if (state.inAllOf === undefined) {\n delete state.inAllOf;\n }\n\n if (schema.required) {\n if (irCompositionSchema.required) {\n irCompositionSchema.required = [\n ...irCompositionSchema.required,\n ...schema.required,\n ];\n } else {\n irCompositionSchema.required = schema.required;\n }\n }\n\n schemaItems.push(irCompositionSchema);\n\n if (compositionSchema.$ref) {\n const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref);\n // `$ref` should be passed from the root `parseSchema()` call\n if (ref.discriminator && state.$ref) {\n const values = discriminatorValues(state.$ref);\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [ref.discriminator]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n type: 'object',\n };\n if (ref.required?.includes(ref.discriminator)) {\n irDiscriminatorSchema.required = [ref.discriminator];\n }\n schemaItems.push(irDiscriminatorSchema);\n }\n }\n }\n\n if (schemaType === 'object') {\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n for (const requiredProperty of irObjectSchema.required ?? []) {\n if (!irObjectSchema.properties[requiredProperty]) {\n for (const compositionSchema of compositionSchemas) {\n // TODO: parser - this could be probably resolved more accurately\n const finalCompositionSchema = compositionSchema.$ref\n ? context.resolveRef<SchemaObject>(compositionSchema.$ref)\n : compositionSchema;\n\n if (\n getSchemaType({ schema: finalCompositionSchema }) === 'object'\n ) {\n const irCompositionSchema = parseOneType({\n context,\n schema: {\n ...finalCompositionSchema,\n type: 'object',\n },\n state,\n });\n\n if (irCompositionSchema.properties?.[requiredProperty]) {\n irObjectSchema.properties[requiredProperty] =\n irCompositionSchema.properties[requiredProperty];\n break;\n }\n }\n }\n }\n }\n schemaItems.push(irObjectSchema);\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n logicalOperator: 'and',\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schema['x-nullable']) {\n // nest composition to avoid producing an intersection with null\n const nestedItems: Array<IR.SchemaObject> = [\n {\n type: 'null',\n },\n ];\n\n if (schemaItems.length) {\n nestedItems.unshift(irSchema);\n }\n\n irSchema = {\n items: nestedItems,\n logicalOperator: 'or',\n };\n\n // TODO: parser - this is a hack to bring back up meta fields\n // without it, some schemas were missing original deprecated\n if (nestedItems[0]!.deprecated) {\n irSchema.deprecated = nestedItems[0]!.deprecated;\n }\n\n // TODO: parser - this is a hack to bring back up meta fields\n // without it, some schemas were missing original description\n if (nestedItems[0]!.description) {\n irSchema.description = nestedItems[0]!.description;\n }\n }\n\n return irSchema;\n};\n\nconst parseEnum = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'enum'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n irSchema.type = 'enum';\n\n const schemaItems: Array<IR.SchemaObject> = [];\n\n for (const [index, enumValue] of schema.enum.entries()) {\n const typeOfEnumValue = typeof enumValue;\n let enumType: SchemaType<SchemaObject> | 'null' | undefined;\n\n if (\n typeOfEnumValue === 'string' ||\n typeOfEnumValue === 'number' ||\n typeOfEnumValue === 'boolean'\n ) {\n enumType = typeOfEnumValue;\n } else if (typeOfEnumValue === 'object' && Array.isArray(enumValue)) {\n enumType = 'array';\n } else if (enumValue === null) {\n // nullable must be true\n if (schema['x-nullable']) {\n enumType = 'null';\n }\n } else {\n console.warn(\n '🚨',\n `unhandled \"${typeOfEnumValue}\" typeof value \"${enumValue}\" for enum`,\n schema.enum,\n );\n }\n\n if (!enumType) {\n continue;\n }\n\n const irTypeSchema = parseOneType({\n context,\n schema: {\n description: schema['x-enum-descriptions']?.[index],\n title:\n schema['x-enum-varnames']?.[index] ?? schema['x-enumNames']?.[index],\n // cast enum to string temporarily\n type: enumType === 'null' ? 'string' : enumType,\n },\n state,\n });\n\n irTypeSchema.const = enumValue;\n\n // cast enum back\n if (enumType === 'null') {\n irTypeSchema.type = enumType;\n }\n\n if (irTypeSchema.type === 'array') {\n irTypeSchema.type = 'tuple';\n }\n\n schemaItems.push(irTypeSchema);\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseRef = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, '$ref'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n const irSchema: IR.SchemaObject = {};\n // Inline non-component refs (e.g. #/paths/...) to avoid generating orphaned named types\n const isComponentsRef = schema.$ref.startsWith('#/definitions/');\n if (!isComponentsRef) {\n if (!state.circularReferenceTracker.has(schema.$ref)) {\n const refSchema = context.resolveRef<SchemaObject>(schema.$ref);\n const originalRef = state.$ref;\n state.$ref = schema.$ref;\n const irSchema = schemaToIrSchema({\n context,\n schema: refSchema,\n state,\n });\n state.$ref = originalRef;\n return irSchema;\n }\n // Fallback to preserving the ref if circular\n }\n\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n irSchema.$ref = decodeURI(schema.$ref);\n\n // rewrite definitions refs as the internal schema follows OpenAPI 3.x syntax\n // and stores all definitions as reusable schemas\n irSchema.$ref = irSchema.$ref.replace(\n /#\\/definitions\\/([^/]+)/g,\n '#/components/schemas/$1',\n );\n\n if (!state.circularReferenceTracker.has(schema.$ref)) {\n const refSchema = context.resolveRef<SchemaObject>(schema.$ref);\n const originalRef = state.$ref;\n state.$ref = schema.$ref;\n schemaToIrSchema({\n context,\n schema: refSchema,\n state,\n });\n state.$ref = originalRef;\n }\n\n return irSchema;\n};\n\nconst parseNullableType = ({\n context,\n irSchema,\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n }\n\n const typeIrSchema: IR.SchemaObject = {};\n\n parseSchemaMeta({ irSchema: typeIrSchema, schema });\n\n if (typeIrSchema.default === null) {\n // clear to avoid duplicate default inside the non-null schema.\n // this would produce incorrect validator output\n delete typeIrSchema.default;\n }\n\n const schemaItems: Array<IR.SchemaObject> = [\n parseOneType({\n context,\n irSchema: typeIrSchema,\n schema,\n state,\n }),\n {\n type: 'null',\n },\n ];\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseType = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n const irSchema = initIrSchema({ schema });\n\n parseSchemaMeta({ irSchema, schema });\n\n const type = getSchemaType({ schema });\n\n if (!type) {\n return irSchema;\n }\n\n if (schema['x-nullable']) {\n return parseNullableType({\n context,\n irSchema,\n schema: {\n ...schema,\n type,\n },\n state,\n });\n }\n\n return parseOneType({\n context,\n irSchema,\n schema: {\n ...schema,\n type,\n },\n state,\n });\n};\n\nconst parseOneType = ({\n context,\n irSchema,\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n\n parseSchemaMeta({ irSchema, schema });\n }\n\n switch (schema.type) {\n case 'array':\n return parseArray({\n context,\n irSchema,\n schema,\n state,\n });\n case 'boolean':\n return parseBoolean({\n context,\n irSchema,\n schema,\n state,\n });\n case 'integer':\n case 'number':\n return parseNumber({\n context,\n irSchema,\n schema,\n state,\n });\n case 'object':\n return parseObject({\n context,\n irSchema,\n schema,\n state,\n });\n case 'string':\n return parseString({\n context,\n irSchema,\n schema,\n state,\n });\n default:\n // gracefully handle invalid type\n return parseUnknown({\n context,\n irSchema,\n schema,\n });\n }\n};\n\nconst parseUnknown = ({\n irSchema,\n schema,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n }\n\n irSchema.type = 'unknown';\n\n parseSchemaMeta({ irSchema, schema });\n\n return irSchema;\n};\n\nexport const schemaToIrSchema = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaObject;\n state: SchemaState | undefined;\n}): IR.SchemaObject => {\n if (!state) {\n state = {\n circularReferenceTracker: new Set(),\n };\n }\n\n if (state.$ref) {\n state.circularReferenceTracker.add(state.$ref);\n }\n\n if (schema.$ref) {\n return parseRef({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, '$ref'>,\n state,\n });\n }\n\n if (schema.enum) {\n return parseEnum({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'enum'>,\n state,\n });\n }\n\n if (schema.allOf) {\n return parseAllOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'allOf'>,\n state,\n });\n }\n\n // infer object based on the presence of properties\n if (schema.type || schema.properties) {\n return parseType({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'type'>,\n state,\n });\n }\n\n return parseUnknown({ context, schema });\n};\n\nexport const parseSchema = ({\n $ref,\n context,\n schema,\n}: {\n $ref: string;\n context: Context;\n schema: SchemaObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.schemas) {\n context.ir.components.schemas = {};\n }\n\n context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({\n context,\n schema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n });\n};\n","import type { Context } from '~/ir/context';\nimport { getPaginationKeywordsRegExp } from '~/ir/pagination';\nimport type { SchemaType } from '~/openApi/shared/types/schema';\n\nimport type { ParameterObject, ReferenceObject } from '../types/spec';\nimport type { SchemaObject } from '../types/spec';\nimport { getSchemaType } from './schema';\n\nconst isPaginationType = (\n schemaType: SchemaType<SchemaObject> | undefined,\n): boolean =>\n schemaType === 'boolean' ||\n schemaType === 'integer' ||\n schemaType === 'number' ||\n schemaType === 'string';\n\n// We handle only simple values for now, up to 1 nested field\nexport const paginationField = ({\n context,\n name,\n schema,\n}: {\n context: Context;\n name: string;\n schema:\n | ParameterObject\n | SchemaObject\n | ReferenceObject\n | {\n in: undefined;\n };\n}): boolean | string => {\n const paginationRegExp = getPaginationKeywordsRegExp(\n context.config.parser.pagination,\n );\n if (paginationRegExp.test(name)) {\n return true;\n }\n\n if ('$ref' in schema) {\n const ref = context.resolveRef<ParameterObject | SchemaObject>(\n schema.$ref ?? '',\n );\n\n if ('in' in ref && ref.in) {\n const refSchema =\n 'schema' in ref\n ? ref.schema\n : {\n ...ref,\n in: undefined,\n };\n\n return paginationField({\n context,\n name,\n schema: refSchema,\n });\n }\n\n return paginationField({\n context,\n name,\n schema: ref,\n });\n }\n\n if ('in' in schema) {\n if (!schema.in) {\n return false;\n }\n\n const finalSchema =\n 'schema' in schema\n ? schema.schema\n : {\n ...schema,\n in: undefined,\n };\n\n return paginationField({\n context,\n name,\n schema: finalSchema,\n });\n }\n\n for (const name in schema.properties) {\n const paginationRegExp = getPaginationKeywordsRegExp(\n context.config.parser.pagination,\n );\n\n if (paginationRegExp.test(name)) {\n const property = schema.properties[name]!;\n\n if (typeof property !== 'boolean' && !('$ref' in property)) {\n const schemaType = getSchemaType({ schema: property });\n // TODO: resolve deeper references\n\n if (isPaginationType(schemaType)) {\n return name;\n }\n }\n }\n }\n\n for (const allOf of schema.allOf ?? []) {\n const pagination = paginationField({\n context,\n name,\n schema: allOf,\n });\n if (pagination) {\n return pagination;\n }\n }\n\n return false;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR, IRBodyObject } from '~/ir/types';\nimport type { State } from '~/openApi/shared/types/state';\nimport { operationToId } from '~/openApi/shared/utils/operation';\n\nimport type {\n OperationObject,\n ParameterObject,\n PathItemObject,\n ResponseObject,\n SchemaObject,\n SecuritySchemeObject,\n} from '../types/spec';\nimport { contentToSchema, mediaTypeObjects } from './mediaType';\nimport { paginationField } from './pagination';\nimport { schemaToIrSchema } from './schema';\n\ninterface Operation\n extends Omit<OperationObject, 'parameters'>,\n Pick<IR.OperationObject, 'parameters'> {\n requestBody?: OperationObject['parameters'];\n}\n\nconst parseOperationJsDoc = ({\n irOperation,\n operation,\n}: {\n irOperation: IR.OperationObject;\n operation: Operation;\n}) => {\n if (operation.deprecated !== undefined) {\n irOperation.deprecated = operation.deprecated;\n }\n\n if (operation.description) {\n irOperation.description = operation.description;\n }\n\n if (operation.summary) {\n irOperation.summary = operation.summary;\n }\n\n if (operation.tags?.length) {\n irOperation.tags = operation.tags;\n }\n};\n\nconst initIrOperation = ({\n context,\n method,\n operation,\n path,\n state,\n}: Pick<IR.OperationObject, 'method' | 'path'> & {\n context: Context;\n operation: Operation;\n state: State;\n}): IR.OperationObject => {\n const irOperation: IR.OperationObject = {\n id: operationToId({\n context,\n id: operation.operationId,\n method,\n path,\n state,\n }),\n method,\n path,\n };\n\n if (operation.operationId) {\n irOperation.operationId = operation.operationId;\n }\n\n parseOperationJsDoc({\n irOperation,\n operation,\n });\n\n return irOperation;\n};\n\nconst operationToIrOperation = ({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n}: Pick<IR.OperationObject, 'method' | 'path'> & {\n context: Context;\n operation: Operation;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}): IR.OperationObject => {\n const irOperation = initIrOperation({\n context,\n method,\n operation,\n path,\n state,\n });\n\n if (operation.parameters) {\n irOperation.parameters = operation.parameters;\n }\n\n let isRequestBodyRequired = false;\n const requestBodyObject: IRBodyObject = {\n mediaType: '',\n schema: {\n properties: {},\n required: [],\n type: 'object',\n },\n };\n const requestBodyObjectRequired: Array<string> = [];\n\n // Check if there are any body parameters (not formData) to determine default media type\n const hasBodyParameter = operation.requestBody?.some((param) => {\n const resolvedParam =\n '$ref' in param ? context.resolveRef<ParameterObject>(param.$ref) : param;\n return resolvedParam.in === 'body';\n });\n\n for (const requestBodyParameter of operation.requestBody ?? []) {\n const requestBody =\n '$ref' in requestBodyParameter\n ? context.resolveRef<ParameterObject>(requestBodyParameter.$ref)\n : requestBodyParameter;\n const schema: SchemaObject =\n requestBody.in === 'body'\n ? requestBody.schema\n : {\n ...requestBody,\n format: requestBody.type === 'file' ? 'binary' : requestBody.format,\n required: undefined,\n type: requestBody.type === 'file' ? 'string' : requestBody.type,\n };\n\n // Only default to JSON if we have body parameters and no consumes specified\n // FormData parameters without consumes should not get a default media type\n let mimeTypes = operation.consumes;\n if (!mimeTypes && hasBodyParameter && requestBody.in === 'body') {\n mimeTypes = ['application/json'];\n }\n\n const contents = mediaTypeObjects({\n mimeTypes,\n response: { schema },\n });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n\n if (content) {\n const pagination = paginationField({\n context,\n name: '',\n schema:\n content.schema && '$ref' in content.schema\n ? {\n allOf: [{ ...content.schema }],\n description: requestBody.description,\n }\n : {\n description: requestBody.description,\n ...content.schema,\n },\n });\n\n const irSchema = schemaToIrSchema({\n context,\n schema:\n '$ref' in requestBody\n ? {\n allOf: [\n {\n ...requestBody,\n $ref: requestBody.$ref as string,\n required: [],\n type: 'string',\n },\n ],\n description: requestBody.description,\n }\n : content.schema && '$ref' in content.schema\n ? {\n allOf: [{ ...content.schema }],\n description: requestBody.description,\n }\n : {\n description: requestBody.description,\n ...content.schema,\n },\n state: undefined,\n });\n\n requestBodyObject.mediaType = content.mediaType;\n\n if (requestBody.in === 'body') {\n requestBodyObject.schema = irSchema;\n } else {\n requestBodyObject.schema.properties![requestBody.name] = irSchema;\n\n if (requestBody.required) {\n requestBodyObjectRequired.push(requestBody.name);\n }\n }\n\n if (pagination) {\n requestBodyObject.pagination = pagination;\n }\n\n if (content.type) {\n requestBodyObject.type = content.type;\n }\n }\n\n if (requestBody.required) {\n isRequestBodyRequired = true;\n }\n }\n\n if (requestBodyObject.mediaType) {\n if (requestBodyObjectRequired.length) {\n requestBodyObject.schema.required = requestBodyObjectRequired;\n }\n\n irOperation.body = requestBodyObject;\n\n if (isRequestBodyRequired) {\n irOperation.body.required = isRequestBodyRequired;\n }\n }\n\n for (const name in operation.responses) {\n if (!irOperation.responses) {\n irOperation.responses = {};\n }\n\n const response = operation.responses[name]!;\n const responseObject =\n '$ref' in response\n ? context.resolveRef<ResponseObject>(response.$ref)\n : response;\n const contents = mediaTypeObjects({\n // assume JSON by default\n mimeTypes: operation.produces ? operation.produces : ['application/json'],\n response: responseObject,\n });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n\n if (content) {\n irOperation.responses[name] = {\n mediaType: content.mediaType,\n schema: schemaToIrSchema({\n context,\n schema: {\n description: responseObject.description,\n ...contentToSchema({ content }),\n },\n state: undefined,\n }),\n };\n } else {\n irOperation.responses[name] = {\n schema: {\n description: responseObject.description,\n // TODO: parser - cover all statues with empty response bodies\n // 1xx, 204, 205, 304\n type: name === '204' ? 'void' : 'unknown',\n },\n };\n }\n }\n\n if (operation.security) {\n const securitySchemeObjects: Map<string, IR.SecurityObject> = new Map();\n\n for (const securityRequirementObject of operation.security) {\n for (const name in securityRequirementObject) {\n const securitySchemeObject = securitySchemesMap.get(name);\n\n if (!securitySchemeObject) {\n continue;\n }\n\n let irSecuritySchemeObject: IR.SecurityObject | undefined;\n\n if (securitySchemeObject.type === 'apiKey') {\n irSecuritySchemeObject = securitySchemeObject;\n }\n\n if (securitySchemeObject.type === 'basic') {\n irSecuritySchemeObject = {\n description: securitySchemeObject.description,\n scheme: 'basic',\n type: 'http',\n };\n }\n\n if (securitySchemeObject.type === 'oauth2') {\n irSecuritySchemeObject = {\n description: securitySchemeObject.description,\n flows: {},\n type: 'oauth2',\n };\n\n switch (securitySchemeObject.flow) {\n case 'accessCode':\n irSecuritySchemeObject.flows.authorizationCode = {\n authorizationUrl: securitySchemeObject.authorizationUrl!,\n scopes: securitySchemeObject.scopes,\n tokenUrl: securitySchemeObject.tokenUrl!,\n };\n break;\n case 'application':\n irSecuritySchemeObject.flows.clientCredentials = {\n scopes: securitySchemeObject.scopes,\n tokenUrl: securitySchemeObject.tokenUrl!,\n };\n break;\n case 'implicit':\n irSecuritySchemeObject.flows.implicit = {\n authorizationUrl: securitySchemeObject.authorizationUrl!,\n scopes: securitySchemeObject.scopes,\n };\n break;\n case 'password':\n irSecuritySchemeObject.flows.password = {\n scopes: securitySchemeObject.scopes,\n tokenUrl: securitySchemeObject.tokenUrl!,\n };\n break;\n }\n }\n\n if (!irSecuritySchemeObject) {\n continue;\n }\n\n securitySchemeObjects.set(name, irSecuritySchemeObject);\n }\n }\n\n if (securitySchemeObjects.size) {\n irOperation.security = Array.from(securitySchemeObjects.values());\n }\n }\n\n // TODO: parser - handle servers\n // qux: operation.servers\n\n return irOperation;\n};\n\nexport const parsePathOperation = ({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n}: {\n context: Context;\n method: Extract<\n keyof PathItemObject,\n 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace'\n >;\n operation: Operation;\n path: keyof IR.PathsObject;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}) => {\n if (!context.ir.paths) {\n context.ir.paths = {};\n }\n\n if (!context.ir.paths[path]) {\n context.ir.paths[path] = {};\n }\n\n context.ir.paths[path][method] = operationToIrOperation({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n });\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\n\nimport type {\n OperationObject,\n ParameterObject,\n ReferenceObject,\n SchemaObject,\n} from '../types/spec';\nimport { paginationField } from './pagination';\nimport { schemaToIrSchema } from './schema';\n\ntype Parameter = Exclude<ParameterObject, { in: 'body' }>;\n\n/**\n * Returns default parameter `explode` based on value of `collectionFormat`.\n */\nconst defaultExplode = (\n collectionFormat: Parameter['collectionFormat'],\n): boolean => {\n switch (collectionFormat) {\n case 'multi':\n return true;\n case 'csv':\n case 'pipes':\n case 'ssv':\n case 'tsv':\n default:\n return false;\n }\n};\n\n/**\n * Returns default parameter `style` based on value of `in`.\n */\nconst defaultStyle = (\n _in: Parameter['in'],\n): Required<IR.ParameterObject>['style'] => {\n switch (_in) {\n case 'header':\n case 'path':\n return 'simple';\n case 'query':\n default:\n return 'form';\n }\n};\n\nexport const parametersArrayToObject = ({\n context,\n operation,\n parameters,\n}: {\n context: Context;\n operation: OperationObject;\n parameters?: ReadonlyArray<ParameterObject | ReferenceObject>;\n}): IR.ParametersObject | undefined => {\n if (!parameters || !Object.keys(parameters).length) {\n return;\n }\n\n const parametersObject: IR.ParametersObject = {};\n\n for (const parameterOrReference of parameters) {\n const parameter =\n '$ref' in parameterOrReference\n ? context.dereference<ParameterObject>(parameterOrReference)\n : parameterOrReference;\n\n // push request body parameters into a separate field\n if (parameter.in === 'body' || parameter.in === 'formData') {\n // @ts-expect-error\n if (!operation.requestBody) {\n // @ts-expect-error\n operation.requestBody = [];\n }\n\n // @ts-expect-error\n operation.requestBody.push(parameter);\n continue;\n }\n\n if (!parametersObject[parameter.in]) {\n parametersObject[parameter.in] = {};\n }\n\n // lowercase keys for case insensitive access\n parametersObject[parameter.in]![parameter.name.toLocaleLowerCase()] =\n parameterToIrParameter({\n $ref: `#/todo/real/path/to/parameter/${parameter.name}`,\n context,\n parameter,\n });\n }\n\n return parametersObject;\n};\n\nconst parameterToIrParameter = ({\n $ref,\n context,\n parameter,\n}: {\n $ref: string;\n context: Context;\n parameter: Parameter;\n}): IR.ParameterObject => {\n const schema = parameter;\n\n const finalSchema: SchemaObject =\n schema && '$ref' in schema\n ? {\n allOf: [\n {\n ...schema,\n $ref: schema.$ref as string,\n required: Array.isArray(schema.required) ? schema.required : [],\n type: schema.type as SchemaObject['type'],\n },\n ],\n description: parameter.description,\n }\n : {\n description: parameter.description,\n ...schema,\n required: Array.isArray(schema.required) ? schema.required : [],\n type: schema.type as SchemaObject['type'],\n };\n\n const pagination = paginationField({\n context,\n name: parameter.name,\n schema: finalSchema,\n });\n\n const style = defaultStyle(parameter.in);\n const explode = defaultExplode(parameter.collectionFormat);\n const allowReserved = false;\n\n const irParameter: IR.ParameterObject = {\n allowReserved,\n explode,\n location: parameter.in as IR.ParameterObject['location'],\n name: parameter.name,\n schema: schemaToIrSchema({\n context,\n schema: finalSchema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n }),\n style,\n };\n\n if (parameter.description) {\n irParameter.description = parameter.description;\n }\n\n if (pagination) {\n irParameter.pagination = pagination;\n }\n\n if (parameter.required) {\n irParameter.required = parameter.required;\n }\n\n return irParameter;\n};\n","import type { Context } from '~/ir/context';\nimport { parseUrl } from '~/utils/url';\n\nexport const parseServers = ({ context }: { context: Context }) => {\n let schemes: ReadonlyArray<string> = context.spec.schemes ?? [];\n let host = context.spec.host ?? '';\n const path = context.spec.basePath ?? '';\n\n for (const input of context.config.input) {\n if (typeof input.path === 'string') {\n const url = parseUrl(input.path);\n\n if (!schemes.length) {\n if (url.protocol) {\n schemes = [url.protocol] as typeof schemes;\n }\n }\n\n if (!host) {\n host = `${url.host}${url.port ? `:${url.port}` : ''}`;\n }\n }\n }\n\n if (!schemes.length) {\n schemes = [''];\n }\n\n const servers = schemes\n .map((scheme) => `${scheme ? `${scheme}://` : ''}${host}${path}`)\n .filter(Boolean);\n\n if (servers.length) {\n context.ir.servers = servers.map((url) => ({\n url,\n }));\n }\n};\n","import { createOperationKey } from '~/ir/operation';\nimport { httpMethods } from '~/openApi/shared/utils/operation';\nimport type {\n ValidatorIssue,\n ValidatorResult,\n} from '~/openApi/shared/utils/validator';\nimport type { Logger } from '~/utils/logger';\n\nimport type { OpenApiV2_0_X, PathItemObject, PathsObject } from '../types/spec';\n\nexport const validateOpenApiSpec = (\n spec: OpenApiV2_0_X,\n logger: Logger,\n): ValidatorResult => {\n const eventValidate = logger.timeEvent('validate');\n const issues: Array<ValidatorIssue> = [];\n const operationIds = new Map();\n\n if (spec.paths) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n for (const method of httpMethods) {\n if (method === 'trace') {\n continue;\n }\n\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const operationKey = createOperationKey({ method, path });\n\n if (operation.operationId) {\n if (!operationIds.has(operation.operationId)) {\n operationIds.set(operation.operationId, operationKey);\n } else {\n issues.push({\n code: 'duplicate_key',\n context: {\n key: 'operationId',\n value: operation.operationId,\n },\n message:\n 'Duplicate `operationId` found. Each `operationId` must be unique.',\n path: ['paths', path, method, 'operationId'],\n severity: 'error',\n });\n }\n }\n }\n }\n }\n\n eventValidate.timeEnd();\n return {\n issues,\n valid: !issues.some((issue) => issue.severity === 'error'),\n };\n};\n","import type { Context } from '~/ir/context';\nimport { buildResourceMetadata } from '~/openApi/shared/graph/meta';\nimport { transformOpenApiSpec } from '~/openApi/shared/transforms';\nimport type { State } from '~/openApi/shared/types/state';\nimport {\n createFilteredDependencies,\n createFilters,\n hasFilters,\n} from '~/openApi/shared/utils/filter';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { mergeParametersObjects } from '~/openApi/shared/utils/parameter';\nimport { handleValidatorResult } from '~/openApi/shared/utils/validator';\n\nimport type {\n OpenApiV2_0_X,\n OperationObject,\n PathItemObject,\n PathsObject,\n SecuritySchemeObject,\n} from '../types/spec';\nimport { filterSpec } from './filter';\nimport { parsePathOperation } from './operation';\nimport { parametersArrayToObject } from './parameter';\nimport { parseSchema } from './schema';\nimport { parseServers } from './server';\nimport { validateOpenApiSpec } from './validate';\n\ntype PathKeys<T extends keyof PathsObject = keyof PathsObject> =\n keyof T extends infer K ? (K extends `/${string}` ? K : never) : never;\n\nexport const parseV2_0_X = (context: Context<OpenApiV2_0_X>) => {\n if (context.config.parser.validate_EXPERIMENTAL) {\n const result = validateOpenApiSpec(context.spec, context.logger);\n handleValidatorResult({ context, result });\n }\n\n const shouldFilterSpec = hasFilters(context.config.parser.filters);\n if (shouldFilterSpec) {\n const filters = createFilters(\n context.config.parser.filters,\n context.spec,\n context.logger,\n );\n const { graph } = buildGraph(context.spec, context.logger);\n const { resourceMetadata } = buildResourceMetadata(graph, context.logger);\n const sets = createFilteredDependencies({\n filters,\n logger: context.logger,\n resourceMetadata,\n });\n filterSpec({\n ...sets,\n logger: context.logger,\n preserveOrder: filters.preserveOrder,\n spec: context.spec,\n });\n }\n\n transformOpenApiSpec({ context });\n\n const state: State = {\n ids: new Map(),\n };\n const securitySchemesMap = new Map<string, SecuritySchemeObject>();\n\n for (const name in context.spec.securityDefinitions) {\n const securitySchemeObject = context.spec.securityDefinitions[name]!;\n securitySchemesMap.set(name, securitySchemeObject);\n }\n\n if (context.spec.definitions) {\n for (const name in context.spec.definitions) {\n const $ref = `#/definitions/${name}`;\n const schema = context.spec.definitions[name]!;\n\n parseSchema({\n $ref,\n context,\n schema,\n });\n }\n }\n\n parseServers({ context });\n\n for (const path in context.spec.paths) {\n if (path.startsWith('x-')) {\n continue;\n }\n\n const pathItem = context.spec.paths[path as PathKeys]!;\n\n const finalPathItem = pathItem.$ref\n ? {\n ...context.resolveRef<PathItemObject>(pathItem.$ref),\n ...pathItem,\n }\n : pathItem;\n\n const commonOperation: OperationObject = {\n consumes: context.spec.consumes,\n produces: context.spec.produces,\n responses: {},\n security: context.spec.security,\n };\n const operationArgs: Omit<\n Parameters<typeof parsePathOperation>[0],\n 'method'\n > = {\n context,\n operation: {\n ...commonOperation,\n parameters: parametersArrayToObject({\n context,\n operation: commonOperation,\n parameters: finalPathItem.parameters,\n }),\n },\n path: path as PathKeys,\n securitySchemesMap,\n state,\n };\n\n if (finalPathItem.delete) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.delete,\n parameters: finalPathItem.delete.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'delete',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.delete,\n parameters,\n },\n });\n }\n\n if (finalPathItem.get) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.get,\n parameters: finalPathItem.get.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'get',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.get,\n parameters,\n },\n });\n }\n\n if (finalPathItem.head) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.head,\n parameters: finalPathItem.head.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'head',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.head,\n parameters,\n },\n });\n }\n\n if (finalPathItem.options) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.options,\n parameters: finalPathItem.options.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'options',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.options,\n parameters,\n },\n });\n }\n\n if (finalPathItem.patch) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.patch,\n parameters: finalPathItem.patch.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'patch',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.patch,\n parameters,\n },\n });\n }\n\n if (finalPathItem.post) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.post,\n parameters: finalPathItem.post.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'post',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.post,\n parameters,\n },\n });\n }\n\n if (finalPathItem.put) {\n const parameters = mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n operation: finalPathItem.put,\n parameters: finalPathItem.put.parameters,\n }),\n target: operationArgs.operation.parameters,\n });\n parsePathOperation({\n ...operationArgs,\n method: 'put',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.put,\n parameters,\n },\n });\n }\n }\n};\n","import { createOperationKey } from '~/ir/operation';\nimport { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter';\nimport { httpMethods } from '~/openApi/shared/utils/operation';\nimport type { Logger } from '~/utils/logger';\n\nimport type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec';\n\n/**\n * Replace source spec with filtered version.\n */\nexport const filterSpec = ({\n logger,\n operations,\n parameters,\n preserveOrder,\n requestBodies,\n responses,\n schemas,\n spec,\n}: {\n logger: Logger;\n operations: Set<string>;\n parameters: Set<string>;\n preserveOrder: boolean;\n requestBodies: Set<string>;\n responses: Set<string>;\n schemas: Set<string>;\n spec: OpenApiV3_0_X;\n}) => {\n const eventFilterSpec = logger.timeEvent('filter-spec');\n if (spec.components) {\n if (spec.components.parameters) {\n const filtered: typeof spec.components.parameters = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(\n spec.components.parameters,\n )) {\n if (parameters.has(addNamespace('parameter', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of parameters) {\n const { name } = removeNamespace(key);\n const source = spec.components.parameters[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.parameters = filtered;\n }\n\n if (spec.components.requestBodies) {\n const filtered: typeof spec.components.requestBodies = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(\n spec.components.requestBodies,\n )) {\n if (requestBodies.has(addNamespace('body', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of requestBodies) {\n const { name } = removeNamespace(key);\n const source = spec.components.requestBodies[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.requestBodies = filtered;\n }\n\n if (spec.components.responses) {\n const filtered: typeof spec.components.responses = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(\n spec.components.responses,\n )) {\n if (responses.has(addNamespace('response', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of responses) {\n const { name } = removeNamespace(key);\n const source = spec.components.responses[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.responses = filtered;\n }\n\n if (spec.components.schemas) {\n const filtered: typeof spec.components.schemas = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(spec.components.schemas)) {\n if (schemas.has(addNamespace('schema', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of schemas) {\n const { name } = removeNamespace(key);\n const source = spec.components.schemas[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.schemas = filtered;\n }\n }\n\n if (spec.paths) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n\n for (const method of httpMethods) {\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const key = addNamespace(\n 'operation',\n createOperationKey({ method, path }),\n );\n if (!operations.has(key)) {\n delete pathItem[method];\n }\n }\n\n // remove paths that have no operations left\n if (!Object.keys(pathItem).length) {\n delete spec.paths[path];\n }\n }\n }\n eventFilterSpec.timeEnd();\n};\n","import type { IRMediaType } from '~/ir/mediaType';\nimport { isMediaTypeFileLike, mediaTypeToIrMediaType } from '~/ir/mediaType';\n\nimport type {\n MediaTypeObject,\n ReferenceObject,\n SchemaObject,\n} from '../types/spec';\n\ninterface Content {\n mediaType: string;\n schema: SchemaObject | ReferenceObject | undefined;\n type: IRMediaType | undefined;\n}\n\nexport const contentToSchema = ({\n content,\n}: {\n content: Content;\n}): SchemaObject | undefined => {\n const { mediaType, schema } = content;\n\n if (schema && '$ref' in schema) {\n return {\n allOf: [{ ...schema }],\n };\n }\n\n if (!schema) {\n if (isMediaTypeFileLike({ mediaType })) {\n return {\n format: 'binary',\n type: 'string',\n };\n }\n return;\n }\n\n if (\n schema.type === 'string' &&\n !schema.format &&\n isMediaTypeFileLike({ mediaType })\n ) {\n return {\n ...schema,\n format: 'binary',\n };\n }\n\n return schema;\n};\n\nexport const mediaTypeObjects = ({\n content,\n}: {\n content: Record<string, MediaTypeObject> | undefined;\n}): ReadonlyArray<Content> => {\n const objects: Array<Content> = [];\n\n for (const mediaType in content) {\n objects.push({\n mediaType,\n schema: content[mediaType]!.schema,\n type: mediaTypeToIrMediaType({ mediaType }),\n });\n }\n\n return objects;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { addItemsToSchema } from '~/ir/utils';\nimport type {\n SchemaState,\n SchemaType,\n SchemaWithRequired,\n} from '~/openApi/shared/types/schema';\nimport { discriminatorValues } from '~/openApi/shared/utils/discriminator';\nimport { refToName } from '~/utils/ref';\n\nimport type { ReferenceObject, SchemaObject } from '../types/spec';\n\nexport const getSchemaType = ({\n schema,\n}: {\n schema: SchemaObject;\n}): SchemaType<SchemaObject> | undefined => {\n if (schema.type) {\n return schema.type;\n }\n\n // infer object based on the presence of properties\n if (schema.properties) {\n return 'object';\n }\n\n return;\n};\n\nconst parseSchemaJsDoc = ({\n irSchema,\n schema,\n}: {\n irSchema: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n if (schema.deprecated !== undefined) {\n irSchema.deprecated = schema.deprecated;\n }\n\n if (schema.example) {\n irSchema.example = schema.example;\n }\n\n if (schema.description) {\n irSchema.description = schema.description;\n }\n\n if (schema.title) {\n irSchema.title = schema.title;\n }\n};\n\nconst parseSchemaMeta = ({\n irSchema,\n schema,\n}: {\n irSchema: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n if (schema.default !== undefined) {\n irSchema.default = schema.default;\n }\n\n if (schema.exclusiveMaximum) {\n if (schema.maximum !== undefined) {\n irSchema.exclusiveMaximum = schema.maximum;\n }\n } else if (schema.maximum !== undefined) {\n irSchema.maximum = schema.maximum;\n }\n\n if (schema.exclusiveMinimum) {\n if (schema.minimum !== undefined) {\n irSchema.exclusiveMinimum = schema.minimum;\n }\n } else if (schema.minimum !== undefined) {\n irSchema.minimum = schema.minimum;\n }\n\n if (schema.format) {\n irSchema.format = schema.format;\n }\n\n if (schema.maxItems !== undefined) {\n irSchema.maxItems = schema.maxItems;\n }\n\n if (schema.maxLength !== undefined) {\n irSchema.maxLength = schema.maxLength;\n }\n\n if (schema.minItems !== undefined) {\n irSchema.minItems = schema.minItems;\n }\n\n if (schema.minLength !== undefined) {\n irSchema.minLength = schema.minLength;\n }\n\n if (schema.pattern) {\n irSchema.pattern = schema.pattern;\n }\n\n if (schema.readOnly) {\n irSchema.accessScope = 'read';\n } else if (schema.writeOnly) {\n irSchema.accessScope = 'write';\n }\n};\n\nconst parseArray = ({\n context,\n irSchema = {},\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (schema.maxItems && schema.maxItems === schema.minItems) {\n irSchema.type = 'tuple';\n } else {\n irSchema.type = 'array';\n }\n\n let schemaItems: Array<IR.SchemaObject> = [];\n\n if (schema.items) {\n const irItemsSchema = schemaToIrSchema({\n context,\n schema: schema.items,\n state,\n });\n\n if (\n !schemaItems.length &&\n schema.maxItems &&\n schema.maxItems === schema.minItems\n ) {\n schemaItems = Array(schema.maxItems).fill(irItemsSchema);\n } else {\n if ('$ref' in schema.items) {\n schemaItems.push(irItemsSchema);\n } else {\n const ofArray =\n schema.items.allOf || schema.items.anyOf || schema.items.oneOf;\n if (ofArray && ofArray.length > 1 && !schema.items.nullable) {\n // bring composition up to avoid incorrectly nested arrays\n irSchema = {\n ...irSchema,\n ...irItemsSchema,\n };\n } else {\n schemaItems.push(irItemsSchema);\n }\n }\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseBoolean = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'boolean';\n\n return irSchema;\n};\n\nconst parseNumber = ({\n irSchema = {},\n schema,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = schema.type;\n\n return irSchema;\n};\n\nconst parseObject = ({\n context,\n irSchema = {},\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'object';\n\n const schemaProperties: Record<string, IR.SchemaObject> = {};\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n if (typeof property === 'boolean') {\n // TODO: parser - handle boolean properties\n } else {\n schemaProperties[name] = schemaToIrSchema({\n context,\n schema: property,\n state,\n });\n }\n }\n\n if (Object.keys(schemaProperties).length) {\n irSchema.properties = schemaProperties;\n }\n\n if (schema.additionalProperties === undefined) {\n if (!irSchema.properties) {\n irSchema.additionalProperties = {\n type: 'unknown',\n };\n }\n } else if (typeof schema.additionalProperties === 'boolean') {\n // Avoid [key: string]: never for empty objects with additionalProperties: false inside allOf\n // This would override inherited properties from other schemas in the composition\n const isEmptyObjectInAllOf =\n state.inAllOf &&\n schema.additionalProperties === false &&\n (!schema.properties || !Object.keys(schema.properties).length);\n\n if (!isEmptyObjectInAllOf) {\n irSchema.additionalProperties = {\n type: schema.additionalProperties ? 'unknown' : 'never',\n };\n }\n } else {\n const irAdditionalPropertiesSchema = schemaToIrSchema({\n context,\n schema: schema.additionalProperties,\n state,\n });\n irSchema.additionalProperties = irAdditionalPropertiesSchema;\n }\n\n if (schema.required) {\n irSchema.required = schema.required;\n }\n\n return irSchema;\n};\n\nconst parseString = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'string';\n\n return irSchema;\n};\n\nconst initIrSchema = ({\n schema,\n}: {\n schema: SchemaObject;\n}): IR.SchemaObject => {\n const irSchema: IR.SchemaObject = {};\n\n parseSchemaJsDoc({\n irSchema,\n schema,\n });\n\n return irSchema;\n};\n\nconst parseAllOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'allOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n const schemaItems: Array<IR.SchemaObject> = [];\n const schemaType = getSchemaType({ schema });\n\n const compositionSchemas = schema.allOf;\n\n for (const compositionSchema of compositionSchemas) {\n const originalInAllOf = state.inAllOf;\n // Don't propagate inAllOf flag to $ref schemas to avoid issues with reusable components\n if (!('$ref' in compositionSchema)) {\n state.inAllOf = true;\n }\n const irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n state.inAllOf = originalInAllOf;\n if (state.inAllOf === undefined) {\n delete state.inAllOf;\n }\n\n if (schema.required) {\n if (irCompositionSchema.required) {\n irCompositionSchema.required = [\n ...irCompositionSchema.required,\n ...schema.required,\n ];\n } else {\n irCompositionSchema.required = schema.required;\n }\n }\n\n schemaItems.push(irCompositionSchema);\n\n if ('$ref' in compositionSchema) {\n const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref);\n // `$ref` should be passed from the root `parseSchema()` call\n if (ref.discriminator && state.$ref) {\n const values = discriminatorValues(\n state.$ref,\n ref.discriminator.mapping,\n // If the ref has oneOf, we only use the schema name as the value\n // only if current schema is part of the oneOf. Else it is extending\n // the ref schema\n ref.oneOf\n ? () => ref.oneOf!.some((o) => '$ref' in o && o.$ref === state.$ref)\n : undefined,\n );\n\n if (values.length > 0) {\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [ref.discriminator.propertyName]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n type: 'object',\n };\n if (ref.required?.includes(ref.discriminator.propertyName)) {\n irDiscriminatorSchema.required = [ref.discriminator.propertyName];\n }\n schemaItems.push(irDiscriminatorSchema);\n }\n }\n }\n }\n\n if (schemaType === 'object') {\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n for (const requiredProperty of irObjectSchema.required ?? []) {\n if (!irObjectSchema.properties[requiredProperty]) {\n for (const compositionSchema of compositionSchemas) {\n // TODO: parser - this could be probably resolved more accurately\n const finalCompositionSchema =\n '$ref' in compositionSchema\n ? context.resolveRef<SchemaObject>(compositionSchema.$ref)\n : compositionSchema;\n\n if (\n getSchemaType({ schema: finalCompositionSchema }) === 'object'\n ) {\n const irCompositionSchema = parseOneType({\n context,\n schema: {\n ...finalCompositionSchema,\n type: 'object',\n },\n state,\n });\n\n if (irCompositionSchema.properties?.[requiredProperty]) {\n irObjectSchema.properties[requiredProperty] =\n irCompositionSchema.properties[requiredProperty];\n break;\n }\n }\n }\n }\n }\n schemaItems.push(irObjectSchema);\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n logicalOperator: 'and',\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schema.nullable) {\n // nest composition to avoid producing an intersection with null\n const nestedItems: Array<IR.SchemaObject> = [\n {\n type: 'null',\n },\n ];\n\n if (schemaItems.length) {\n nestedItems.unshift(irSchema);\n }\n\n irSchema = {\n items: nestedItems,\n logicalOperator: 'or',\n };\n\n // TODO: parser - this is a hack to bring back up meta fields\n // without it, some schemas were missing original deprecated\n if (nestedItems[0]!.deprecated) {\n irSchema.deprecated = nestedItems[0]!.deprecated;\n }\n\n // TODO: parser - this is a hack to bring back up meta fields\n // without it, some schemas were missing original description\n if (nestedItems[0]!.description) {\n irSchema.description = nestedItems[0]!.description;\n }\n }\n\n return irSchema;\n};\n\nconst parseAnyOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'anyOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n const schemaItems: Array<IR.SchemaObject> = [];\n const schemaType = getSchemaType({ schema });\n\n const compositionSchemas = schema.anyOf;\n\n for (const compositionSchema of compositionSchemas) {\n let irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n\n // `$ref` should be defined with discriminators\n if (schema.discriminator && irCompositionSchema.$ref != null) {\n const values = discriminatorValues(\n irCompositionSchema.$ref,\n schema.discriminator.mapping,\n );\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [schema.discriminator.propertyName]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n type: 'object',\n };\n irCompositionSchema = {\n items: [irDiscriminatorSchema, irCompositionSchema],\n logicalOperator: 'and',\n };\n }\n\n schemaItems.push(irCompositionSchema);\n }\n\n if (schema.nullable) {\n schemaItems.push({ type: 'null' });\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schemaType === 'object') {\n // nest composition to avoid producing a union with object properties\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n irSchema = {\n items: [irSchema, irObjectSchema],\n logicalOperator: 'and',\n };\n }\n }\n\n return irSchema;\n};\n\nconst parseEnum = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'enum'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n irSchema.type = 'enum';\n\n const schemaItems: Array<IR.SchemaObject> = [];\n\n for (const [index, enumValue] of schema.enum.entries()) {\n const typeOfEnumValue = typeof enumValue;\n let enumType: SchemaType<SchemaObject> | 'null' | undefined;\n\n if (\n typeOfEnumValue === 'string' ||\n typeOfEnumValue === 'number' ||\n typeOfEnumValue === 'boolean'\n ) {\n enumType = typeOfEnumValue;\n } else if (typeOfEnumValue === 'object' && Array.isArray(enumValue)) {\n enumType = 'array';\n } else if (enumValue === null) {\n // nullable must be true\n if (schema.nullable) {\n enumType = 'null';\n }\n } else {\n console.warn(\n '🚨',\n `unhandled \"${typeOfEnumValue}\" typeof value \"${enumValue}\" for enum`,\n schema.enum,\n );\n }\n\n if (!enumType) {\n continue;\n }\n\n const irTypeSchema = parseOneType({\n context,\n schema: {\n description: schema['x-enum-descriptions']?.[index],\n title:\n schema['x-enum-varnames']?.[index] ?? schema['x-enumNames']?.[index],\n // cast enum to string temporarily\n type: enumType === 'null' ? 'string' : enumType,\n },\n state,\n });\n\n irTypeSchema.const = enumValue;\n\n // cast enum back\n if (enumType === 'null') {\n irTypeSchema.type = enumType;\n }\n\n if (irTypeSchema.type === 'array') {\n irTypeSchema.type = 'tuple';\n }\n\n schemaItems.push(irTypeSchema);\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseOneOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'oneOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n let schemaItems: Array<IR.SchemaObject> = [];\n const schemaType = getSchemaType({ schema });\n\n const compositionSchemas = schema.oneOf;\n\n for (const compositionSchema of compositionSchemas) {\n let irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n\n // `$ref` should be defined with discriminators\n if (schema.discriminator && irCompositionSchema.$ref != null) {\n const values = discriminatorValues(\n irCompositionSchema.$ref,\n schema.discriminator.mapping,\n );\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [schema.discriminator.propertyName]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n required: [schema.discriminator.propertyName],\n type: 'object',\n };\n irCompositionSchema = {\n items: [irDiscriminatorSchema, irCompositionSchema],\n logicalOperator: 'and',\n };\n }\n\n // since we know oneOf will be using \"or\" logical operator, if the parsed\n // composition schema also has an \"or\" operator, we can bring it up\n // to avoid unnecessary brackets\n if (\n irCompositionSchema.logicalOperator === 'or' &&\n irCompositionSchema.type !== 'array' &&\n irCompositionSchema.items\n ) {\n schemaItems = schemaItems.concat(irCompositionSchema.items);\n } else {\n schemaItems.push(irCompositionSchema);\n }\n }\n\n if (schema.nullable) {\n schemaItems.push({ type: 'null' });\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schemaType === 'object') {\n // nest composition to avoid producing a union with object properties\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n irSchema = {\n items: [irSchema, irObjectSchema],\n logicalOperator: 'and',\n };\n }\n }\n\n return irSchema;\n};\n\nconst parseRef = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: ReferenceObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n // Inline non-component refs (e.g. #/paths/...) to avoid generating orphaned named types\n const isComponentsRef = schema.$ref.startsWith('#/components/');\n if (!isComponentsRef) {\n if (!state.circularReferenceTracker.has(schema.$ref)) {\n const refSchema = context.resolveRef<SchemaObject>(schema.$ref);\n const originalRef = state.$ref;\n state.$ref = schema.$ref;\n const irSchema = schemaToIrSchema({\n context,\n schema: refSchema,\n state,\n });\n state.$ref = originalRef;\n return irSchema;\n }\n // Fallback to preserving the ref if circular\n }\n\n const irSchema: IR.SchemaObject = {};\n\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n irSchema.$ref = decodeURI(schema.$ref);\n\n if (!state.circularReferenceTracker.has(schema.$ref)) {\n const refSchema = context.resolveRef<SchemaObject>(schema.$ref);\n const originalRef = state.$ref;\n state.$ref = schema.$ref;\n schemaToIrSchema({\n context,\n schema: refSchema,\n state,\n });\n state.$ref = originalRef;\n }\n\n return irSchema;\n};\n\nconst parseNullableType = ({\n context,\n irSchema,\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n }\n\n const typeIrSchema: IR.SchemaObject = {};\n\n parseSchemaMeta({ irSchema: typeIrSchema, schema });\n\n if (typeIrSchema.default === null) {\n // clear to avoid duplicate default inside the non-null schema.\n // this would produce incorrect validator output\n delete typeIrSchema.default;\n }\n\n const schemaItems: Array<IR.SchemaObject> = [\n parseOneType({\n context,\n irSchema: typeIrSchema,\n schema,\n state,\n }),\n {\n type: 'null',\n },\n ];\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseType = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n const irSchema = initIrSchema({ schema });\n\n parseSchemaMeta({ irSchema, schema });\n\n const type = getSchemaType({ schema });\n\n if (!type) {\n return irSchema;\n }\n\n if (!schema.nullable) {\n return parseOneType({\n context,\n irSchema,\n schema: {\n ...schema,\n type,\n },\n state,\n });\n }\n\n return parseNullableType({\n context,\n irSchema,\n schema: {\n ...schema,\n type,\n },\n state,\n });\n};\n\nconst parseOneType = ({\n context,\n irSchema,\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n\n parseSchemaMeta({ irSchema, schema });\n }\n\n switch (schema.type) {\n case 'array':\n return parseArray({\n context,\n irSchema,\n schema,\n state,\n });\n case 'boolean':\n return parseBoolean({\n context,\n irSchema,\n schema,\n state,\n });\n case 'integer':\n case 'number':\n return parseNumber({\n context,\n irSchema,\n schema,\n state,\n });\n case 'object':\n return parseObject({\n context,\n irSchema,\n schema,\n state,\n });\n case 'string':\n return parseString({\n context,\n irSchema,\n schema,\n state,\n });\n default:\n // gracefully handle invalid type\n return parseUnknown({\n context,\n irSchema,\n schema,\n });\n }\n};\n\nconst parseUnknown = ({\n irSchema,\n schema,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n }\n\n irSchema.type = 'unknown';\n\n parseSchemaMeta({ irSchema, schema });\n\n return irSchema;\n};\n\nexport const schemaToIrSchema = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaObject | ReferenceObject;\n state: SchemaState | undefined;\n}): IR.SchemaObject => {\n if (!state) {\n state = {\n circularReferenceTracker: new Set(),\n };\n }\n\n if (state.$ref) {\n state.circularReferenceTracker.add(state.$ref);\n }\n\n if ('$ref' in schema) {\n return parseRef({\n context,\n schema,\n state,\n });\n }\n\n if (schema.enum) {\n return parseEnum({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'enum'>,\n state,\n });\n }\n\n if (schema.allOf) {\n return parseAllOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'allOf'>,\n state,\n });\n }\n\n if (schema.anyOf) {\n return parseAnyOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'anyOf'>,\n state,\n });\n }\n\n if (schema.oneOf) {\n return parseOneOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'oneOf'>,\n state,\n });\n }\n\n // infer object based on the presence of properties\n if (schema.type || schema.properties) {\n return parseType({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'type'>,\n state,\n });\n }\n\n return parseUnknown({ context, schema });\n};\n\nexport const parseSchema = ({\n $ref,\n context,\n schema,\n}: {\n $ref: string;\n context: Context;\n schema: SchemaObject | ReferenceObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.schemas) {\n context.ir.components.schemas = {};\n }\n\n context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({\n context,\n schema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n });\n};\n","import type { Context } from '~/ir/context';\nimport { getPaginationKeywordsRegExp } from '~/ir/pagination';\nimport type { SchemaType } from '~/openApi/shared/types/schema';\n\nimport type {\n ParameterObject,\n ReferenceObject,\n RequestBodyObject,\n} from '../types/spec';\nimport type { SchemaObject } from '../types/spec';\nimport { mediaTypeObjects } from './mediaType';\nimport { getSchemaType } from './schema';\n\nconst isPaginationType = (\n schemaType: SchemaType<SchemaObject> | undefined,\n): boolean =>\n schemaType === 'boolean' ||\n schemaType === 'integer' ||\n schemaType === 'number' ||\n schemaType === 'string';\n\n// We handle only simple values for now, up to 1 nested field\nexport const paginationField = ({\n context,\n name,\n schema,\n}: {\n context: Context;\n name: string;\n schema: SchemaObject | ReferenceObject;\n}): boolean | string => {\n const paginationRegExp = getPaginationKeywordsRegExp(\n context.config.parser.pagination,\n );\n if (paginationRegExp.test(name)) {\n return true;\n }\n\n if ('$ref' in schema) {\n const ref = context.resolveRef<\n ParameterObject | RequestBodyObject | SchemaObject\n >(schema.$ref);\n\n if ('content' in ref || 'in' in ref) {\n let refSchema: SchemaObject | ReferenceObject | undefined;\n\n if ('in' in ref) {\n refSchema = ref.schema;\n }\n\n if (!refSchema) {\n // parameter or body\n const contents = mediaTypeObjects({ content: ref.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n if (content?.schema) {\n refSchema = content.schema;\n }\n }\n\n if (!refSchema) {\n return false;\n }\n\n return paginationField({\n context,\n name,\n schema: refSchema,\n });\n }\n\n return paginationField({\n context,\n name,\n schema: ref,\n });\n }\n\n for (const name in schema.properties) {\n const paginationRegExp = getPaginationKeywordsRegExp(\n context.config.parser.pagination,\n );\n\n if (paginationRegExp.test(name)) {\n const property = schema.properties[name]!;\n\n if (typeof property !== 'boolean' && !('$ref' in property)) {\n const schemaType = getSchemaType({ schema: property });\n // TODO: resolve deeper references\n\n if (isPaginationType(schemaType)) {\n return name;\n }\n }\n }\n }\n\n for (const allOf of schema.allOf ?? []) {\n const pagination = paginationField({\n context,\n name,\n schema: allOf,\n });\n if (pagination) {\n return pagination;\n }\n }\n\n return false;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport type { State } from '~/openApi/shared/types/state';\nimport { operationToId } from '~/openApi/shared/utils/operation';\n\nimport type {\n OperationObject,\n PathItemObject,\n RequestBodyObject,\n ResponseObject,\n SecuritySchemeObject,\n} from '../types/spec';\nimport { contentToSchema, mediaTypeObjects } from './mediaType';\nimport { paginationField } from './pagination';\nimport { schemaToIrSchema } from './schema';\n\ninterface Operation\n extends Omit<OperationObject, 'parameters'>,\n Pick<IR.OperationObject, 'parameters'> {}\n\nconst parseOperationJsDoc = ({\n irOperation,\n operation,\n}: {\n irOperation: IR.OperationObject;\n operation: Operation;\n}) => {\n if (operation.deprecated !== undefined) {\n irOperation.deprecated = operation.deprecated;\n }\n\n if (operation.description) {\n irOperation.description = operation.description;\n }\n\n if (operation.summary) {\n irOperation.summary = operation.summary;\n }\n\n if (operation.tags?.length) {\n irOperation.tags = operation.tags;\n }\n};\n\nconst initIrOperation = ({\n context,\n method,\n operation,\n path,\n state,\n}: Pick<IR.OperationObject, 'method' | 'path'> & {\n context: Context;\n operation: Operation;\n state: State;\n}): IR.OperationObject => {\n const irOperation: IR.OperationObject = {\n id: operationToId({\n context,\n id: operation.operationId,\n method,\n path,\n state,\n }),\n method,\n path,\n };\n\n if (operation.operationId) {\n irOperation.operationId = operation.operationId;\n }\n\n parseOperationJsDoc({\n irOperation,\n operation,\n });\n\n return irOperation;\n};\n\nconst operationToIrOperation = ({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n}: Pick<IR.OperationObject, 'method' | 'path'> & {\n context: Context;\n operation: Operation;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}): IR.OperationObject => {\n const irOperation = initIrOperation({\n context,\n method,\n operation,\n path,\n state,\n });\n\n if (operation.parameters) {\n irOperation.parameters = operation.parameters;\n }\n\n if (operation.requestBody) {\n const requestBody =\n '$ref' in operation.requestBody\n ? context.resolveRef<RequestBodyObject>(operation.requestBody.$ref)\n : operation.requestBody;\n const contents = mediaTypeObjects({ content: requestBody.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n\n if (content) {\n const pagination = paginationField({\n context,\n name: '',\n schema:\n content.schema && '$ref' in content.schema\n ? {\n allOf: [{ ...content.schema }],\n description: requestBody.description,\n }\n : {\n description: requestBody.description,\n ...content.schema,\n },\n });\n\n irOperation.body = {\n mediaType: content.mediaType,\n schema: schemaToIrSchema({\n context,\n schema:\n '$ref' in operation.requestBody\n ? {\n allOf: [{ ...operation.requestBody }],\n description: requestBody.description,\n }\n : content.schema && '$ref' in content.schema\n ? {\n allOf: [{ ...content.schema }],\n description: requestBody.description,\n }\n : {\n description: requestBody.description,\n ...content.schema,\n },\n state: undefined,\n }),\n };\n\n if (pagination) {\n irOperation.body.pagination = pagination;\n }\n\n if (requestBody.required) {\n irOperation.body.required = requestBody.required;\n }\n\n if (content.type) {\n irOperation.body.type = content.type;\n }\n }\n }\n\n for (const name in operation.responses) {\n if (!irOperation.responses) {\n irOperation.responses = {};\n }\n\n const response = operation.responses[name]!;\n const responseObject =\n '$ref' in response\n ? context.resolveRef<ResponseObject>(response.$ref)\n : response;\n const contents = mediaTypeObjects({ content: responseObject.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n\n if (content) {\n irOperation.responses[name] = {\n mediaType: content.mediaType,\n schema: schemaToIrSchema({\n context,\n schema: {\n description: responseObject.description,\n ...contentToSchema({ content }),\n },\n state: undefined,\n }),\n };\n } else {\n irOperation.responses[name] = {\n schema: {\n description: responseObject.description,\n // TODO: parser - cover all statues with empty response bodies\n // 1xx, 204, 205, 304\n type: name === '204' ? 'void' : 'unknown',\n },\n };\n }\n }\n\n if (operation.security) {\n const securitySchemeObjects: Map<string, IR.SecurityObject> = new Map();\n\n for (const securityRequirementObject of operation.security) {\n for (const name in securityRequirementObject) {\n const securitySchemeObject = securitySchemesMap.get(name);\n\n if (!securitySchemeObject) {\n continue;\n }\n\n securitySchemeObjects.set(name, securitySchemeObject);\n }\n }\n\n if (securitySchemeObjects.size) {\n irOperation.security = Array.from(securitySchemeObjects.values());\n }\n }\n\n // TODO: parser - handle servers\n // qux: operation.servers\n\n return irOperation;\n};\n\nexport const parsePathOperation = ({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n}: {\n context: Context;\n method: Extract<\n keyof PathItemObject,\n 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace'\n >;\n operation: Operation;\n path: keyof IR.PathsObject;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}) => {\n if (!context.ir.paths) {\n context.ir.paths = {};\n }\n\n if (!context.ir.paths[path]) {\n context.ir.paths[path] = {};\n }\n\n if (operation.servers) {\n context.ir.servers = [...(context.ir.servers ?? []), ...operation.servers];\n }\n\n context.ir.paths[path][method] = operationToIrOperation({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n });\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { refToName } from '~/utils/ref';\n\nimport type {\n ParameterObject,\n ReferenceObject,\n SchemaObject,\n} from '../types/spec';\nimport { mediaTypeObjects } from './mediaType';\nimport { paginationField } from './pagination';\nimport { schemaToIrSchema } from './schema';\n\n/**\n * Returns default parameter `allowReserved` based on value of `in`.\n */\nconst defaultAllowReserved = (\n _in: ParameterObject['in'],\n): boolean | undefined => {\n switch (_in) {\n // this keyword only applies to parameters with an `in` value of `query`\n case 'query':\n return false;\n default:\n return;\n }\n};\n\n/**\n * Returns default parameter `explode` based on value of `style`.\n */\nconst defaultExplode = (style: Required<ParameterObject>['style']): boolean => {\n switch (style) {\n // default value for `deepObject` is `false`, but that behavior is undefined\n // so we use `true` to make this work with the `client-fetch` package\n case 'deepObject':\n case 'form':\n return true;\n default:\n return false;\n }\n};\n\n/**\n * Returns default parameter `style` based on value of `in`.\n */\nconst defaultStyle = (\n _in: ParameterObject['in'],\n): Required<IR.ParameterObject>['style'] => {\n switch (_in) {\n case 'header':\n case 'path':\n return 'simple';\n case 'cookie':\n case 'query':\n return 'form';\n }\n};\n\nexport const parametersArrayToObject = ({\n context,\n parameters,\n}: {\n context: Context;\n parameters?: ReadonlyArray<ParameterObject | ReferenceObject>;\n}): IR.ParametersObject | undefined => {\n if (!parameters || !Object.keys(parameters).length) {\n return;\n }\n\n const parametersObject: IR.ParametersObject = {};\n\n for (const parameterOrReference of parameters) {\n const parameter =\n '$ref' in parameterOrReference\n ? context.dereference<ParameterObject>(parameterOrReference)\n : parameterOrReference;\n\n if (!parametersObject[parameter.in]) {\n parametersObject[parameter.in] = {};\n }\n\n // lowercase keys for case insensitive access\n parametersObject[parameter.in]![parameter.name.toLocaleLowerCase()] =\n parameterToIrParameter({\n $ref: `#/todo/real/path/to/parameter/${parameter.name}`,\n context,\n parameter,\n });\n }\n\n return parametersObject;\n};\n\nconst parameterToIrParameter = ({\n $ref,\n context,\n parameter,\n}: {\n $ref: string;\n context: Context;\n parameter: ParameterObject;\n}): IR.ParameterObject => {\n // TODO: parser - fix\n let schema = parameter.schema;\n\n if (!schema) {\n const contents = mediaTypeObjects({ content: parameter.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n if (content) {\n schema = content.schema;\n }\n }\n\n const finalSchema: SchemaObject =\n schema && '$ref' in schema\n ? {\n allOf: [{ ...schema }],\n deprecated: parameter.deprecated,\n description: parameter.description,\n }\n : {\n deprecated: parameter.deprecated,\n description: parameter.description,\n ...schema,\n };\n\n const pagination = paginationField({\n context,\n name: parameter.name,\n schema: finalSchema,\n });\n\n const style = parameter.style || defaultStyle(parameter.in);\n const explode =\n parameter.explode !== undefined ? parameter.explode : defaultExplode(style);\n const allowReserved =\n parameter.allowReserved !== undefined\n ? parameter.allowReserved\n : defaultAllowReserved(parameter.in);\n\n const irParameter: IR.ParameterObject = {\n allowReserved,\n explode,\n location: parameter.in,\n name: parameter.name,\n schema: schemaToIrSchema({\n context,\n schema: finalSchema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n }),\n style,\n };\n\n if (parameter.deprecated) {\n irParameter.deprecated = parameter.deprecated;\n }\n\n if (parameter.description) {\n irParameter.description = parameter.description;\n }\n\n if (pagination) {\n irParameter.pagination = pagination;\n }\n\n if (parameter.required) {\n irParameter.required = parameter.required;\n }\n\n return irParameter;\n};\n\nexport const parseParameter = ({\n $ref,\n context,\n parameter,\n}: {\n $ref: string;\n context: Context;\n parameter: ParameterObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.parameters) {\n context.ir.components.parameters = {};\n }\n\n context.ir.components.parameters[refToName($ref)] = parameterToIrParameter({\n $ref,\n context,\n parameter,\n });\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { refToName } from '~/utils/ref';\n\nimport type { RequestBodyObject, SchemaObject } from '../types/spec';\nimport { mediaTypeObjects } from './mediaType';\nimport { schemaToIrSchema } from './schema';\n\nconst requestBodyToIrRequestBody = ({\n $ref,\n context,\n requestBody,\n}: {\n $ref: string;\n context: Context;\n requestBody: RequestBodyObject;\n}): IR.RequestBodyObject => {\n // TODO: parser - fix\n const contents = mediaTypeObjects({ content: requestBody.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n const schema = content ? content.schema : undefined;\n\n const finalSchema: SchemaObject = {\n description: requestBody.description,\n ...schema,\n };\n\n const irRequestBody: IR.RequestBodyObject = {\n schema: schemaToIrSchema({\n context,\n schema: finalSchema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n }),\n };\n\n if (requestBody.description) {\n irRequestBody.description = requestBody.description;\n }\n\n if (requestBody.required) {\n irRequestBody.required = requestBody.required;\n }\n\n return irRequestBody;\n};\n\nexport const parseRequestBody = ({\n $ref,\n context,\n requestBody,\n}: {\n $ref: string;\n context: Context;\n requestBody: RequestBodyObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.requestBodies) {\n context.ir.components.requestBodies = {};\n }\n\n context.ir.components.requestBodies[refToName($ref)] =\n requestBodyToIrRequestBody({\n $ref,\n context,\n requestBody,\n });\n};\n","import type { Context } from '~/ir/context';\nimport { parseUrl } from '~/utils/url';\n\nexport const parseServers = ({ context }: { context: Context }) => {\n if (context.spec.servers) {\n context.ir.servers = context.spec.servers;\n return;\n }\n\n for (const input of context.config.input) {\n if (typeof input.path === 'string') {\n const url = parseUrl(input.path);\n context.ir.servers = [\n {\n url: `${url.protocol ? `${url.protocol}://` : ''}${url.host}${url.port ? `:${url.port}` : ''}`,\n },\n ];\n }\n }\n\n if (!context.ir.servers) {\n context.ir.servers = [\n {\n url: '/',\n },\n ];\n }\n};\n","import { createOperationKey } from '~/ir/operation';\nimport { httpMethods } from '~/openApi/shared/utils/operation';\nimport type {\n ValidatorIssue,\n ValidatorResult,\n} from '~/openApi/shared/utils/validator';\nimport type { Logger } from '~/utils/logger';\n\nimport type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec';\n\nexport const validateOpenApiSpec = (\n spec: OpenApiV3_0_X,\n logger: Logger,\n): ValidatorResult => {\n const eventValidate = logger.timeEvent('validate');\n const issues: Array<ValidatorIssue> = [];\n const operationIds = new Map();\n\n if (spec.paths) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n for (const method of httpMethods) {\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const operationKey = createOperationKey({ method, path });\n\n if (operation.operationId) {\n if (!operationIds.has(operation.operationId)) {\n operationIds.set(operation.operationId, operationKey);\n } else {\n issues.push({\n code: 'duplicate_key',\n context: {\n key: 'operationId',\n value: operation.operationId,\n },\n message:\n 'Duplicate `operationId` found. Each `operationId` must be unique.',\n path: ['paths', path, method, 'operationId'],\n severity: 'error',\n });\n }\n }\n }\n }\n }\n\n if (spec.servers) {\n if (typeof spec.servers !== 'object' || !Array.isArray(spec.servers)) {\n issues.push({\n code: 'invalid_type',\n message: '`servers` must be an array.',\n path: [],\n severity: 'error',\n });\n }\n\n for (let index = 0; index < spec.servers.length; index++) {\n const server = spec.servers[index];\n if (!server || typeof server !== 'object') {\n issues.push({\n code: 'invalid_type',\n context: {\n actual: typeof server,\n expected: 'object',\n },\n message: 'Each entry in `servers` must be an object.',\n path: ['servers', index],\n severity: 'error',\n });\n } else {\n if (!server.url) {\n issues.push({\n code: 'missing_required_field',\n context: {\n field: 'url',\n },\n message: 'Missing required field `url` in server object.',\n path: ['servers', index],\n severity: 'error',\n });\n }\n }\n }\n }\n\n eventValidate.timeEnd();\n return {\n issues,\n valid: !issues.some((issue) => issue.severity === 'error'),\n };\n};\n","import type { Context } from '~/ir/context';\nimport { buildResourceMetadata } from '~/openApi/shared/graph/meta';\nimport { transformOpenApiSpec } from '~/openApi/shared/transforms';\nimport type { State } from '~/openApi/shared/types/state';\nimport {\n createFilteredDependencies,\n createFilters,\n hasFilters,\n} from '~/openApi/shared/utils/filter';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { mergeParametersObjects } from '~/openApi/shared/utils/parameter';\nimport { handleValidatorResult } from '~/openApi/shared/utils/validator';\n\nimport type {\n OpenApiV3_0_X,\n ParameterObject,\n PathItemObject,\n PathsObject,\n RequestBodyObject,\n SecuritySchemeObject,\n} from '../types/spec';\nimport { filterSpec } from './filter';\nimport { parsePathOperation } from './operation';\nimport { parametersArrayToObject, parseParameter } from './parameter';\nimport { parseRequestBody } from './requestBody';\nimport { parseSchema } from './schema';\nimport { parseServers } from './server';\nimport { validateOpenApiSpec } from './validate';\n\nexport const parseV3_0_X = (context: Context<OpenApiV3_0_X>) => {\n if (context.config.parser.validate_EXPERIMENTAL) {\n const result = validateOpenApiSpec(context.spec, context.logger);\n handleValidatorResult({ context, result });\n }\n\n const shouldFilterSpec = hasFilters(context.config.parser.filters);\n if (shouldFilterSpec) {\n const filters = createFilters(\n context.config.parser.filters,\n context.spec,\n context.logger,\n );\n const { graph } = buildGraph(context.spec, context.logger);\n const { resourceMetadata } = buildResourceMetadata(graph, context.logger);\n const sets = createFilteredDependencies({\n filters,\n logger: context.logger,\n resourceMetadata,\n });\n filterSpec({\n ...sets,\n logger: context.logger,\n preserveOrder: filters.preserveOrder,\n spec: context.spec,\n });\n }\n\n transformOpenApiSpec({ context });\n\n const state: State = {\n ids: new Map(),\n };\n const securitySchemesMap = new Map<string, SecuritySchemeObject>();\n\n // TODO: parser - handle more component types, old parser handles only parameters and schemas\n if (context.spec.components) {\n for (const name in context.spec.components.securitySchemes) {\n const securityOrReference =\n context.spec.components.securitySchemes[name]!;\n const securitySchemeObject =\n '$ref' in securityOrReference\n ? context.resolveRef<SecuritySchemeObject>(securityOrReference.$ref)\n : securityOrReference;\n securitySchemesMap.set(name, securitySchemeObject);\n }\n\n for (const name in context.spec.components.parameters) {\n const $ref = `#/components/parameters/${name}`;\n const parameterOrReference = context.spec.components.parameters[name]!;\n const parameter =\n '$ref' in parameterOrReference\n ? context.resolveRef<ParameterObject>(parameterOrReference.$ref)\n : parameterOrReference;\n\n parseParameter({\n $ref,\n context,\n parameter,\n });\n }\n\n for (const name in context.spec.components.requestBodies) {\n const $ref = `#/components/requestBodies/${name}`;\n const requestBodyOrReference =\n context.spec.components.requestBodies[name]!;\n const requestBody =\n '$ref' in requestBodyOrReference\n ? context.resolveRef<RequestBodyObject>(requestBodyOrReference.$ref)\n : requestBodyOrReference;\n\n parseRequestBody({\n $ref,\n context,\n requestBody,\n });\n }\n\n for (const name in context.spec.components.schemas) {\n const $ref = `#/components/schemas/${name}`;\n const schema = context.spec.components.schemas[name]!;\n\n parseSchema({\n $ref,\n context,\n schema,\n });\n }\n }\n\n parseServers({ context });\n\n for (const path in context.spec.paths) {\n const pathItem = context.spec.paths[path as keyof PathsObject]!;\n\n const finalPathItem = pathItem.$ref\n ? {\n ...context.resolveRef<PathItemObject>(pathItem.$ref),\n ...pathItem,\n }\n : pathItem;\n\n const operationArgs: Omit<\n Parameters<typeof parsePathOperation>[0],\n 'method' | 'operation'\n > & {\n operation: Omit<\n Parameters<typeof parsePathOperation>[0]['operation'],\n 'responses'\n >;\n } = {\n context,\n operation: {\n description: finalPathItem.description,\n parameters: parametersArrayToObject({\n context,\n parameters: finalPathItem.parameters,\n }),\n security: context.spec.security,\n servers: finalPathItem.servers,\n summary: finalPathItem.summary,\n },\n path: path as keyof PathsObject,\n securitySchemesMap,\n state,\n };\n\n if (finalPathItem.delete) {\n parsePathOperation({\n ...operationArgs,\n method: 'delete',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.delete,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.delete.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.get) {\n parsePathOperation({\n ...operationArgs,\n method: 'get',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.get,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.get.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.head) {\n parsePathOperation({\n ...operationArgs,\n method: 'head',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.head,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.head.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.options) {\n parsePathOperation({\n ...operationArgs,\n method: 'options',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.options,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.options.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.patch) {\n parsePathOperation({\n ...operationArgs,\n method: 'patch',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.patch,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.patch.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.post) {\n parsePathOperation({\n ...operationArgs,\n method: 'post',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.post,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.post.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.put) {\n parsePathOperation({\n ...operationArgs,\n method: 'put',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.put,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.put.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.trace) {\n parsePathOperation({\n ...operationArgs,\n method: 'trace',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.trace,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.trace.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n }\n};\n","import { createOperationKey } from '~/ir/operation';\nimport { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter';\nimport { httpMethods } from '~/openApi/shared/utils/operation';\nimport type { Logger } from '~/utils/logger';\n\nimport type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec';\n\n/**\n * Replace source spec with filtered version.\n */\nexport const filterSpec = ({\n logger,\n operations,\n parameters,\n preserveOrder,\n requestBodies,\n responses,\n schemas,\n spec,\n}: {\n logger: Logger;\n operations: Set<string>;\n parameters: Set<string>;\n preserveOrder: boolean;\n requestBodies: Set<string>;\n responses: Set<string>;\n schemas: Set<string>;\n spec: OpenApiV3_1_X;\n}) => {\n const eventFilterSpec = logger.timeEvent('filter-spec');\n if (spec.components) {\n if (spec.components.parameters) {\n const filtered: typeof spec.components.parameters = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(\n spec.components.parameters,\n )) {\n if (parameters.has(addNamespace('parameter', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of parameters) {\n const { name } = removeNamespace(key);\n const source = spec.components.parameters[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.parameters = filtered;\n }\n\n if (spec.components.requestBodies) {\n const filtered: typeof spec.components.requestBodies = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(\n spec.components.requestBodies,\n )) {\n if (requestBodies.has(addNamespace('body', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of requestBodies) {\n const { name } = removeNamespace(key);\n const source = spec.components.requestBodies[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.requestBodies = filtered;\n }\n\n if (spec.components.responses) {\n const filtered: typeof spec.components.responses = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(\n spec.components.responses,\n )) {\n if (responses.has(addNamespace('response', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of responses) {\n const { name } = removeNamespace(key);\n const source = spec.components.responses[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.responses = filtered;\n }\n\n if (spec.components.schemas) {\n const filtered: typeof spec.components.schemas = {};\n\n if (preserveOrder) {\n for (const [name, source] of Object.entries(spec.components.schemas)) {\n if (schemas.has(addNamespace('schema', name))) {\n filtered[name] = source;\n }\n }\n } else {\n for (const key of schemas) {\n const { name } = removeNamespace(key);\n const source = spec.components.schemas[name];\n if (source) {\n filtered[name] = source;\n }\n }\n }\n\n spec.components.schemas = filtered;\n }\n }\n\n if (spec.paths) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n\n for (const method of httpMethods) {\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const key = addNamespace(\n 'operation',\n createOperationKey({ method, path }),\n );\n if (!operations.has(key)) {\n delete pathItem[method];\n }\n }\n\n // remove paths that have no operations left\n if (!Object.keys(pathItem).length) {\n delete spec.paths[path];\n }\n }\n }\n eventFilterSpec.timeEnd();\n};\n","import type { IRMediaType } from '~/ir/mediaType';\nimport { isMediaTypeFileLike, mediaTypeToIrMediaType } from '~/ir/mediaType';\n\nimport type { MediaTypeObject, SchemaObject } from '../types/spec';\n\ninterface Content {\n mediaType: string;\n schema: SchemaObject | undefined;\n type: IRMediaType | undefined;\n}\n\nexport const contentToSchema = ({\n content,\n}: {\n content: Content;\n}): SchemaObject | undefined => {\n const { mediaType, schema } = content;\n\n if (!schema) {\n if (isMediaTypeFileLike({ mediaType })) {\n return {\n format: 'binary',\n type: 'string',\n };\n }\n return;\n }\n\n if (\n schema.type === 'string' &&\n !schema.format &&\n isMediaTypeFileLike({ mediaType })\n ) {\n return {\n ...schema,\n format: 'binary',\n };\n }\n\n return schema;\n};\n\nexport const mediaTypeObjects = ({\n content,\n}: {\n content: Record<string, MediaTypeObject> | undefined;\n}): ReadonlyArray<Content> => {\n const objects: Array<Content> = [];\n\n for (const mediaType in content) {\n objects.push({\n mediaType,\n schema: content[mediaType]!.schema,\n type: mediaTypeToIrMediaType({ mediaType }),\n });\n }\n\n return objects;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { addItemsToSchema } from '~/ir/utils';\nimport type {\n SchemaState,\n SchemaType,\n SchemaWithRequired,\n} from '~/openApi/shared/types/schema';\nimport { discriminatorValues } from '~/openApi/shared/utils/discriminator';\nimport { refToName } from '~/utils/ref';\n\nimport type { SchemaObject } from '../types/spec';\n\nexport const getSchemaTypes = ({\n schema,\n}: {\n schema: SchemaObject;\n}): ReadonlyArray<SchemaType<SchemaObject>> => {\n if (typeof schema.type === 'string') {\n return [schema.type];\n }\n\n if (schema.type) {\n return schema.type;\n }\n\n // infer object based on the presence of properties\n if (schema.properties) {\n return ['object'];\n }\n\n return [];\n};\n\nconst parseSchemaJsDoc = ({\n irSchema,\n schema,\n}: {\n irSchema: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n if (schema.deprecated !== undefined) {\n irSchema.deprecated = schema.deprecated;\n }\n\n if (schema.example) {\n irSchema.example = schema.example;\n }\n\n if (schema.description) {\n irSchema.description = schema.description;\n }\n\n if (schema.title) {\n irSchema.title = schema.title;\n }\n};\n\nconst parseSchemaMeta = ({\n irSchema,\n schema,\n}: {\n irSchema: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n if (schema.const !== undefined) {\n irSchema.const = schema.const;\n\n // try to infer schema type\n if (!schema.type) {\n if (schema.const === null) {\n irSchema.type = 'null';\n } else {\n switch (typeof schema.const) {\n case 'bigint':\n case 'number':\n irSchema.type = 'number';\n break;\n case 'boolean':\n irSchema.type = 'boolean';\n break;\n case 'string':\n irSchema.type = 'string';\n break;\n }\n }\n }\n }\n\n if (schema.default !== undefined) {\n irSchema.default = schema.default;\n }\n\n if (schema.exclusiveMaximum !== undefined) {\n irSchema.exclusiveMaximum = schema.exclusiveMaximum;\n }\n\n if (schema.exclusiveMinimum !== undefined) {\n irSchema.exclusiveMinimum = schema.exclusiveMinimum;\n }\n\n if (schema.format) {\n irSchema.format = schema.format;\n }\n\n if (schema.maximum !== undefined) {\n irSchema.maximum = schema.maximum;\n }\n\n if (schema.maxItems !== undefined) {\n irSchema.maxItems = schema.maxItems;\n }\n\n if (schema.maxLength !== undefined) {\n irSchema.maxLength = schema.maxLength;\n }\n\n if (schema.minimum !== undefined) {\n irSchema.minimum = schema.minimum;\n }\n\n if (schema.minItems !== undefined) {\n irSchema.minItems = schema.minItems;\n }\n\n if (schema.minLength !== undefined) {\n irSchema.minLength = schema.minLength;\n }\n\n if (schema.pattern) {\n irSchema.pattern = schema.pattern;\n }\n\n if (schema.readOnly) {\n irSchema.accessScope = 'read';\n } else if (schema.writeOnly) {\n irSchema.accessScope = 'write';\n }\n};\n\nconst parseArray = ({\n context,\n irSchema = {},\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n if (\n (schema.prefixItems && schema.prefixItems.length) ||\n (schema.maxItems && schema.maxItems === schema.minItems) ||\n schema.const !== undefined\n ) {\n irSchema.type = 'tuple';\n } else {\n irSchema.type = 'array';\n }\n\n let schemaItems: Array<IR.SchemaObject> = [];\n\n for (const item of schema.prefixItems ?? []) {\n const irItemSchema = schemaToIrSchema({\n context,\n schema: item,\n state,\n });\n schemaItems.push(irItemSchema);\n }\n\n if (schema.items) {\n const irItemsSchema = schemaToIrSchema({\n context,\n schema: schema.items,\n state,\n });\n\n if (\n !schemaItems.length &&\n schema.maxItems &&\n schema.maxItems === schema.minItems\n ) {\n schemaItems = Array(schema.maxItems).fill(irItemsSchema);\n } else {\n const ofArray =\n schema.items.allOf || schema.items.anyOf || schema.items.oneOf;\n if (\n ofArray &&\n ofArray.length > 1 &&\n !getSchemaTypes({ schema: schema.items }).includes('null')\n ) {\n // bring composition up to avoid incorrectly nested arrays\n irSchema = {\n ...irSchema,\n ...irItemsSchema,\n };\n } else {\n schemaItems.push(irItemsSchema);\n }\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseBoolean = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n}): IR.SchemaObject => {\n irSchema.type = 'boolean';\n\n return irSchema;\n};\n\nconst parseNull = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n}) => {\n irSchema.type = 'null';\n\n return irSchema;\n};\n\nconst parseNumber = ({\n irSchema = {},\n schema,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: Omit<SchemaObject, 'type'> & {\n type: SchemaType<SchemaObject>;\n };\n}): IR.SchemaObject => {\n irSchema.type = schema.type;\n\n return irSchema;\n};\n\nconst parseObject = ({\n context,\n irSchema = {},\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n state: SchemaState;\n}): IR.SchemaObject => {\n irSchema.type = 'object';\n\n const schemaProperties: Record<string, IR.SchemaObject> = {};\n\n for (const name in schema.properties) {\n const property = schema.properties[name]!;\n if (typeof property === 'boolean') {\n // TODO: parser - handle boolean properties\n } else {\n const irPropertySchema = schemaToIrSchema({\n context,\n schema: property,\n state,\n });\n schemaProperties[name] = irPropertySchema;\n }\n }\n\n if (Object.keys(schemaProperties).length) {\n irSchema.properties = schemaProperties;\n }\n\n if (schema.additionalProperties === undefined) {\n if (!irSchema.properties) {\n irSchema.additionalProperties = {\n type: 'unknown',\n };\n }\n } else if (typeof schema.additionalProperties === 'boolean') {\n // Avoid [key: string]: never for empty objects with additionalProperties: false inside allOf\n // This would override inherited properties from other schemas in the composition\n const isEmptyObjectInAllOf =\n state.inAllOf &&\n schema.additionalProperties === false &&\n (!schema.properties || !Object.keys(schema.properties).length) &&\n (!schema.patternProperties ||\n !Object.keys(schema.patternProperties).length);\n\n if (!isEmptyObjectInAllOf) {\n irSchema.additionalProperties = {\n type: schema.additionalProperties ? 'unknown' : 'never',\n };\n }\n } else {\n const irAdditionalPropertiesSchema = schemaToIrSchema({\n context,\n schema: schema.additionalProperties,\n state,\n });\n irSchema.additionalProperties = irAdditionalPropertiesSchema;\n }\n\n if (schema.patternProperties) {\n const patternProperties: Record<string, IR.SchemaObject> = {};\n\n for (const pattern in schema.patternProperties) {\n const patternSchema = schema.patternProperties[pattern]!;\n const irPatternSchema = schemaToIrSchema({\n context,\n schema: patternSchema,\n state,\n });\n patternProperties[pattern] = irPatternSchema;\n }\n\n if (Object.keys(patternProperties).length) {\n irSchema.patternProperties = patternProperties;\n }\n }\n\n if (schema.propertyNames) {\n irSchema.propertyNames = schemaToIrSchema({\n context,\n schema: schema.propertyNames,\n state,\n });\n }\n\n if (schema.required) {\n irSchema.required = schema.required;\n }\n\n return irSchema;\n};\n\nconst parseString = ({\n irSchema = {},\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n}): IR.SchemaObject => {\n irSchema.type = 'string';\n\n return irSchema;\n};\n\nconst initIrSchema = ({\n schema,\n}: {\n schema: SchemaObject;\n}): IR.SchemaObject => {\n const irSchema: IR.SchemaObject = {};\n\n parseSchemaJsDoc({\n irSchema,\n schema,\n });\n\n return irSchema;\n};\n\nconst parseAllOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'allOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n const schemaItems: Array<IR.SchemaObject> = [];\n const schemaTypes = getSchemaTypes({ schema });\n\n const compositionSchemas = schema.allOf;\n\n for (const compositionSchema of compositionSchemas) {\n const originalInAllOf = state.inAllOf;\n // Don't propagate inAllOf flag to $ref schemas to avoid issues with reusable components\n if (!('$ref' in compositionSchema)) {\n state.inAllOf = true;\n }\n const irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n state.inAllOf = originalInAllOf;\n if (state.inAllOf === undefined) {\n delete state.inAllOf;\n }\n\n if (schema.required) {\n if (irCompositionSchema.required) {\n irCompositionSchema.required = [\n ...irCompositionSchema.required,\n ...schema.required,\n ];\n } else {\n irCompositionSchema.required = schema.required;\n }\n }\n\n schemaItems.push(irCompositionSchema);\n\n if (compositionSchema.$ref) {\n const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref);\n // `$ref` should be passed from the root `parseSchema()` call\n if (ref.discriminator && state.$ref) {\n const values = discriminatorValues(\n state.$ref,\n ref.discriminator.mapping,\n // If the ref has oneOf, we only use the schema name as the value\n // only if current schema is part of the oneOf. Else it is extending\n // the ref schema\n ref.oneOf\n ? () => ref.oneOf!.some((o) => '$ref' in o && o.$ref === state.$ref)\n : undefined,\n );\n if (values.length > 0) {\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [ref.discriminator.propertyName]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n type: 'object',\n };\n if (ref.required?.includes(ref.discriminator.propertyName)) {\n irDiscriminatorSchema.required = [ref.discriminator.propertyName];\n }\n schemaItems.push(irDiscriminatorSchema);\n }\n }\n }\n }\n\n if (schemaTypes.includes('object')) {\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n for (const requiredProperty of irObjectSchema.required ?? []) {\n if (!irObjectSchema.properties[requiredProperty]) {\n for (const compositionSchema of compositionSchemas) {\n // TODO: parser - this could be probably resolved more accurately\n const finalCompositionSchema = compositionSchema.$ref\n ? context.resolveRef<SchemaObject>(compositionSchema.$ref)\n : compositionSchema;\n\n if (\n getSchemaTypes({ schema: finalCompositionSchema }).includes(\n 'object',\n )\n ) {\n const irCompositionSchema = parseOneType({\n context,\n schema: {\n ...finalCompositionSchema,\n type: 'object',\n },\n state,\n });\n\n if (irCompositionSchema.properties?.[requiredProperty]) {\n irObjectSchema.properties[requiredProperty] =\n irCompositionSchema.properties[requiredProperty];\n break;\n }\n }\n }\n }\n }\n schemaItems.push(irObjectSchema);\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n logicalOperator: 'and',\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schemaTypes.includes('null')) {\n // nest composition to avoid producing an intersection with null\n const nestedItems: Array<IR.SchemaObject> = [\n {\n type: 'null',\n },\n ];\n\n if (schemaItems.length) {\n nestedItems.unshift(irSchema);\n }\n\n irSchema = {\n items: nestedItems,\n logicalOperator: 'or',\n };\n }\n\n return irSchema;\n};\n\nconst parseAnyOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'anyOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n const schemaItems: Array<IR.SchemaObject> = [];\n const schemaTypes = getSchemaTypes({ schema });\n\n const compositionSchemas = schema.anyOf;\n\n for (const compositionSchema of compositionSchemas) {\n let irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n\n // `$ref` should be defined with discriminators\n if (schema.discriminator && irCompositionSchema.$ref != null) {\n const values = discriminatorValues(\n irCompositionSchema.$ref,\n schema.discriminator.mapping,\n );\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [schema.discriminator.propertyName]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n type: 'object',\n };\n irCompositionSchema = {\n items: [irDiscriminatorSchema, irCompositionSchema],\n logicalOperator: 'and',\n };\n }\n\n schemaItems.push(irCompositionSchema);\n }\n\n if (schemaTypes.includes('null')) {\n schemaItems.push({ type: 'null' });\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schemaTypes.includes('object')) {\n // nest composition to avoid producing a union with object properties\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n irSchema = {\n items: [irSchema, irObjectSchema],\n logicalOperator: 'and',\n };\n }\n }\n\n return irSchema;\n};\n\nconst parseEnum = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'enum'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n irSchema.type = 'enum';\n\n const schemaItems: Array<IR.SchemaObject> = [];\n const schemaTypes = getSchemaTypes({ schema });\n\n for (const [index, enumValue] of schema.enum.entries()) {\n const typeOfEnumValue = typeof enumValue;\n let enumType: SchemaType<SchemaObject> | undefined;\n\n if (\n typeOfEnumValue === 'string' ||\n typeOfEnumValue === 'number' ||\n typeOfEnumValue === 'boolean'\n ) {\n enumType = typeOfEnumValue;\n } else if (typeOfEnumValue === 'object' && Array.isArray(enumValue)) {\n enumType = 'array';\n } else if (enumValue === null) {\n // type must contain null\n if (schemaTypes.includes('null')) {\n enumType = 'null';\n }\n } else {\n console.warn(\n '🚨',\n `unhandled \"${typeOfEnumValue}\" typeof value \"${enumValue}\" for enum`,\n schema.enum,\n );\n }\n\n if (!enumType) {\n continue;\n }\n\n const irTypeSchema = parseOneType({\n context,\n schema: {\n const: enumValue,\n description: schema['x-enum-descriptions']?.[index],\n title:\n schema['x-enum-varnames']?.[index] ?? schema['x-enumNames']?.[index],\n type: enumType,\n },\n state,\n });\n\n schemaItems.push(irTypeSchema);\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseOneOf = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'oneOf'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n let irSchema = initIrSchema({ schema });\n\n let schemaItems: Array<IR.SchemaObject> = [];\n const schemaTypes = getSchemaTypes({ schema });\n\n const compositionSchemas = schema.oneOf;\n\n for (const compositionSchema of compositionSchemas) {\n let irCompositionSchema = schemaToIrSchema({\n context,\n schema: compositionSchema,\n state,\n });\n\n // `$ref` should be defined with discriminators\n if (schema.discriminator && irCompositionSchema.$ref != null) {\n const values = discriminatorValues(\n irCompositionSchema.$ref,\n schema.discriminator.mapping,\n );\n const valueSchemas: ReadonlyArray<IR.SchemaObject> = values.map(\n (value) => ({\n const: value,\n type: 'string',\n }),\n );\n const irDiscriminatorSchema: IR.SchemaObject = {\n properties: {\n [schema.discriminator.propertyName]:\n valueSchemas.length > 1\n ? {\n items: valueSchemas,\n logicalOperator: 'or',\n }\n : valueSchemas[0]!,\n },\n required: [schema.discriminator.propertyName],\n type: 'object',\n };\n irCompositionSchema = {\n items: [irDiscriminatorSchema, irCompositionSchema],\n logicalOperator: 'and',\n };\n }\n\n // since we know oneOf will be using \"or\" logical operator, if the parsed\n // composition schema also has an \"or\" operator, we can bring it up\n // to avoid unnecessary brackets\n if (\n irCompositionSchema.logicalOperator === 'or' &&\n irCompositionSchema.type !== 'array' &&\n irCompositionSchema.items\n ) {\n schemaItems = schemaItems.concat(irCompositionSchema.items);\n } else {\n schemaItems.push(irCompositionSchema);\n }\n }\n\n if (schemaTypes.includes('null')) {\n schemaItems.push({ type: 'null' });\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n if (schemaTypes.includes('object')) {\n // nest composition to avoid producing a union with object properties\n const irObjectSchema = parseOneType({\n context,\n schema: {\n ...schema,\n type: 'object',\n },\n state,\n });\n\n if (irObjectSchema.properties) {\n irSchema = {\n items: [irSchema, irObjectSchema],\n logicalOperator: 'and',\n };\n }\n }\n\n return irSchema;\n};\n\nconst parseRef = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, '$ref'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n // Inline non-component refs (e.g. #/paths/...) to avoid generating orphaned named types\n const isComponentsRef = schema.$ref.startsWith('#/components/');\n if (!isComponentsRef) {\n if (!state.circularReferenceTracker.has(schema.$ref)) {\n const refSchema = context.resolveRef<SchemaObject>(schema.$ref);\n const originalRef = state.$ref;\n state.$ref = schema.$ref;\n const irSchema = schemaToIrSchema({\n context,\n schema: refSchema,\n state,\n });\n state.$ref = originalRef;\n return irSchema;\n }\n // Fallback to preserving the ref if circular\n }\n\n let irSchema = initIrSchema({ schema });\n\n const irRefSchema: IR.SchemaObject = {};\n\n // refs using unicode characters become encoded, didn't investigate why\n // but the suspicion is this comes from `@hey-api/json-schema-ref-parser`\n irRefSchema.$ref = decodeURI(schema.$ref);\n\n if (!state.circularReferenceTracker.has(schema.$ref)) {\n const refSchema = context.resolveRef<SchemaObject>(schema.$ref);\n const originalRef = state.$ref;\n state.$ref = schema.$ref;\n schemaToIrSchema({\n context,\n schema: refSchema,\n state,\n });\n state.$ref = originalRef;\n }\n\n const schemaItems: Array<IR.SchemaObject> = [];\n schemaItems.push(irRefSchema);\n\n if (schema.type && typeof schema.type !== 'string') {\n if (schema.type.includes('null')) {\n schemaItems.push({ type: 'null' });\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n mutateSchemaOneItem: true,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseOneType = ({\n context,\n irSchema,\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: Omit<SchemaObject, 'type'> & {\n type: SchemaType<SchemaObject>;\n };\n state: SchemaState;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n parseSchemaMeta({ irSchema, schema });\n }\n\n switch (schema.type) {\n case 'array':\n return parseArray({\n context,\n irSchema,\n schema,\n state,\n });\n case 'boolean':\n return parseBoolean({\n context,\n irSchema,\n schema,\n });\n case 'integer':\n case 'number':\n return parseNumber({\n context,\n irSchema,\n schema,\n });\n case 'null':\n return parseNull({\n context,\n irSchema,\n schema,\n });\n case 'object':\n return parseObject({\n context,\n irSchema,\n schema,\n state,\n });\n case 'string':\n return parseString({\n context,\n irSchema,\n schema,\n });\n default:\n // gracefully handle invalid type\n return parseUnknown({ context, irSchema, schema });\n }\n};\n\nconst parseManyTypes = ({\n context,\n irSchema,\n schema,\n state,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: Omit<SchemaObject, 'type'> & {\n type: ReadonlyArray<SchemaType<SchemaObject>>;\n };\n state: SchemaState;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n }\n\n const typeIrSchema: IR.SchemaObject = {};\n\n parseSchemaMeta({ irSchema: typeIrSchema, schema });\n\n if (schema.type.includes('null') && typeIrSchema.default === null) {\n // clear to avoid duplicate default inside the non-null schema.\n // this would produce incorrect validator output\n delete typeIrSchema.default;\n }\n\n const schemaItems: Array<IR.SchemaObject> = [];\n\n for (const type of schema.type) {\n if (type === 'null') {\n schemaItems.push({ type: 'null' });\n } else {\n const irTypeSchema = parseOneType({\n context,\n irSchema: { ...typeIrSchema },\n schema: {\n ...schema,\n type,\n },\n state,\n });\n\n schemaItems.push(irTypeSchema);\n }\n }\n\n irSchema = addItemsToSchema({\n items: schemaItems,\n schema: irSchema,\n });\n\n return irSchema;\n};\n\nconst parseType = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaWithRequired<SchemaObject, 'type'>;\n state: SchemaState;\n}): IR.SchemaObject => {\n const irSchema = initIrSchema({ schema });\n\n parseSchemaMeta({ irSchema, schema });\n\n const schemaTypes = getSchemaTypes({ schema });\n\n if (schemaTypes.length === 1) {\n return parseOneType({\n context,\n irSchema,\n schema: {\n ...schema,\n type: schemaTypes[0]!,\n },\n state,\n });\n }\n\n return parseManyTypes({\n context,\n irSchema,\n schema: {\n ...schema,\n type: schemaTypes,\n },\n state,\n });\n};\n\nconst parseUnknown = ({\n irSchema,\n schema,\n}: {\n context: Context;\n irSchema?: IR.SchemaObject;\n schema: SchemaObject;\n}): IR.SchemaObject => {\n if (!irSchema) {\n irSchema = initIrSchema({ schema });\n }\n\n irSchema.type = 'unknown';\n\n parseSchemaMeta({ irSchema, schema });\n\n return irSchema;\n};\n\nexport const schemaToIrSchema = ({\n context,\n schema,\n state,\n}: {\n context: Context;\n schema: SchemaObject;\n state: SchemaState | undefined;\n}): IR.SchemaObject => {\n if (!state) {\n state = {\n circularReferenceTracker: new Set(),\n };\n }\n\n if (state.$ref) {\n state.circularReferenceTracker.add(state.$ref);\n }\n\n if (schema.$ref) {\n return parseRef({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, '$ref'>,\n state,\n });\n }\n\n if (schema.enum) {\n return parseEnum({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'enum'>,\n state,\n });\n }\n\n if (schema.allOf) {\n return parseAllOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'allOf'>,\n state,\n });\n }\n\n if (schema.anyOf) {\n return parseAnyOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'anyOf'>,\n state,\n });\n }\n\n if (schema.oneOf) {\n return parseOneOf({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'oneOf'>,\n state,\n });\n }\n\n // infer object based on the presence of properties\n if (schema.type || schema.properties) {\n return parseType({\n context,\n schema: schema as SchemaWithRequired<SchemaObject, 'type'>,\n state,\n });\n }\n\n return parseUnknown({ context, schema });\n};\n\nexport const parseSchema = ({\n $ref,\n context,\n schema,\n}: {\n $ref: string;\n context: Context;\n schema: SchemaObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.schemas) {\n context.ir.components.schemas = {};\n }\n\n context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({\n context,\n schema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n });\n};\n","import type { Context } from '~/ir/context';\nimport { getPaginationKeywordsRegExp } from '~/ir/pagination';\nimport type { SchemaType } from '~/openApi/shared/types/schema';\n\nimport type { ParameterObject, RequestBodyObject } from '../types/spec';\nimport type { SchemaObject } from '../types/spec';\nimport { mediaTypeObjects } from './mediaType';\nimport { getSchemaTypes } from './schema';\n\nconst isPaginationType = (\n schemaTypes: ReadonlyArray<SchemaType<SchemaObject>>,\n): boolean =>\n schemaTypes.includes('boolean') ||\n schemaTypes.includes('integer') ||\n schemaTypes.includes('number') ||\n schemaTypes.includes('string');\n\n// We handle only simple values for now, up to 1 nested field\nexport const paginationField = ({\n context,\n name,\n schema,\n}: {\n context: Context;\n name: string;\n schema: SchemaObject;\n}): boolean | string => {\n const paginationRegExp = getPaginationKeywordsRegExp(\n context.config.parser.pagination,\n );\n if (paginationRegExp.test(name)) {\n return true;\n }\n\n if (schema.$ref) {\n const ref = context.resolveRef<\n ParameterObject | RequestBodyObject | SchemaObject\n >(schema.$ref);\n\n if ('content' in ref || 'in' in ref) {\n let refSchema: SchemaObject | undefined;\n\n if ('in' in ref) {\n refSchema = ref.schema;\n }\n\n if (!refSchema) {\n // parameter or body\n const contents = mediaTypeObjects({ content: ref.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n if (content?.schema) {\n refSchema = content.schema;\n }\n }\n\n if (!refSchema) {\n return false;\n }\n\n return paginationField({\n context,\n name,\n schema: refSchema,\n });\n }\n\n return paginationField({\n context,\n name,\n schema: ref,\n });\n }\n\n for (const name in schema.properties) {\n const paginationRegExp = getPaginationKeywordsRegExp(\n context.config.parser.pagination,\n );\n\n if (paginationRegExp.test(name)) {\n const property = schema.properties[name]!;\n\n if (typeof property !== 'boolean') {\n // TODO: resolve deeper references\n const schemaTypes = getSchemaTypes({ schema: property });\n\n if (!schemaTypes.length) {\n const compositionSchemas = property.anyOf ?? property.oneOf;\n const nonNullCompositionSchemas = (compositionSchemas ?? []).filter(\n (schema) => schema.type !== 'null',\n );\n if (nonNullCompositionSchemas.length === 1) {\n const schemaTypes = getSchemaTypes({\n schema: nonNullCompositionSchemas[0]!,\n });\n if (isPaginationType(schemaTypes)) {\n return name;\n }\n }\n }\n\n if (isPaginationType(schemaTypes)) {\n return name;\n }\n }\n }\n }\n\n for (const allOf of schema.allOf ?? []) {\n const pagination = paginationField({\n context,\n name,\n schema: allOf,\n });\n if (pagination) {\n return pagination;\n }\n }\n\n return false;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport type { State } from '~/openApi/shared/types/state';\nimport type { httpMethods } from '~/openApi/shared/utils/operation';\nimport { operationToId } from '~/openApi/shared/utils/operation';\n\nimport type {\n OperationObject,\n RequestBodyObject,\n ResponseObject,\n SecuritySchemeObject,\n} from '../types/spec';\nimport { contentToSchema, mediaTypeObjects } from './mediaType';\nimport { paginationField } from './pagination';\nimport { schemaToIrSchema } from './schema';\n\ninterface Operation\n extends Omit<OperationObject, 'parameters'>,\n Pick<IR.OperationObject, 'parameters'> {}\n\nconst parseOperationJsDoc = ({\n irOperation,\n operation,\n}: {\n irOperation: IR.OperationObject;\n operation: Operation;\n}) => {\n if (operation.deprecated !== undefined) {\n irOperation.deprecated = operation.deprecated;\n }\n\n if (operation.description) {\n irOperation.description = operation.description;\n }\n\n if (operation.summary) {\n irOperation.summary = operation.summary;\n }\n\n if (operation.tags?.length) {\n irOperation.tags = operation.tags;\n }\n};\n\nconst initIrOperation = ({\n context,\n method,\n operation,\n path,\n state,\n}: Pick<IR.OperationObject, 'method' | 'path'> & {\n context: Context;\n operation: Operation;\n state: State;\n}): IR.OperationObject => {\n const irOperation: IR.OperationObject = {\n id: operationToId({\n context,\n id: operation.operationId,\n method,\n path,\n state,\n }),\n method,\n path,\n };\n\n if (operation.operationId) {\n irOperation.operationId = operation.operationId;\n }\n\n parseOperationJsDoc({\n irOperation,\n operation,\n });\n\n return irOperation;\n};\n\nconst operationToIrOperation = ({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n}: Pick<IR.OperationObject, 'method' | 'path'> & {\n context: Context;\n operation: Operation;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}): IR.OperationObject => {\n const irOperation = initIrOperation({\n context,\n method,\n operation,\n path,\n state,\n });\n\n if (operation.parameters) {\n irOperation.parameters = operation.parameters;\n }\n\n if (operation.requestBody) {\n const requestBody =\n '$ref' in operation.requestBody\n ? context.resolveRef<RequestBodyObject>(operation.requestBody.$ref)\n : operation.requestBody;\n const contents = mediaTypeObjects({ content: requestBody.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n\n if (content) {\n const pagination = paginationField({\n context,\n name: '',\n schema: {\n description: requestBody.description,\n ...content.schema,\n },\n });\n\n irOperation.body = {\n mediaType: content.mediaType,\n schema: schemaToIrSchema({\n context,\n schema: {\n description: requestBody.description,\n ...('$ref' in operation.requestBody\n ? operation.requestBody\n : content.schema),\n },\n state: undefined,\n }),\n };\n\n if (pagination) {\n irOperation.body.pagination = pagination;\n }\n\n if (requestBody.required) {\n irOperation.body.required = requestBody.required;\n }\n\n if (content.type) {\n irOperation.body.type = content.type;\n }\n }\n }\n\n for (const name in operation.responses) {\n if (!irOperation.responses) {\n irOperation.responses = {};\n }\n\n const response = operation.responses[name]!;\n const responseObject =\n '$ref' in response\n ? context.resolveRef<ResponseObject>(response.$ref)\n : response;\n const contents = mediaTypeObjects({ content: responseObject.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n\n if (content) {\n irOperation.responses[name] = {\n mediaType: content.mediaType,\n schema: schemaToIrSchema({\n context,\n schema: {\n description: responseObject.description,\n ...contentToSchema({ content }),\n },\n state: undefined,\n }),\n };\n } else {\n irOperation.responses[name] = {\n schema: {\n description: responseObject.description,\n // TODO: parser - cover all statues with empty response bodies\n // 1xx, 204, 205, 304\n type: name === '204' ? 'void' : 'unknown',\n },\n };\n }\n }\n\n if (operation.security) {\n const securitySchemeObjects: Map<string, IR.SecurityObject> = new Map();\n\n for (const securityRequirementObject of operation.security) {\n for (const name in securityRequirementObject) {\n const securitySchemeObject = securitySchemesMap.get(name);\n\n if (!securitySchemeObject) {\n continue;\n }\n\n securitySchemeObjects.set(name, securitySchemeObject);\n }\n }\n\n if (securitySchemeObjects.size) {\n irOperation.security = Array.from(securitySchemeObjects.values());\n }\n }\n\n // TODO: parser - handle servers\n // qux: operation.servers\n\n return irOperation;\n};\n\nconst parseOperationObject = ({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n}: {\n context: Context;\n method: (typeof httpMethods)[number];\n operation: Operation;\n path: keyof IR.PathsObject;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}) => {\n if (operation.servers) {\n context.ir.servers = [...(context.ir.servers ?? []), ...operation.servers];\n }\n\n const parsed = operationToIrOperation({\n context,\n method,\n operation,\n path,\n securitySchemesMap,\n state,\n });\n\n return { parsed };\n};\n\nexport const parsePathOperation = ({\n context,\n method,\n path,\n ...options\n}: {\n context: Context;\n method: (typeof httpMethods)[number];\n operation: Operation;\n path: keyof IR.PathsObject;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}) => {\n if (!context.ir.paths) {\n context.ir.paths = {};\n }\n\n if (!context.ir.paths[path]) {\n context.ir.paths[path] = {};\n }\n\n const { parsed } = parseOperationObject({\n context,\n method,\n path,\n ...options,\n });\n\n context.ir.paths[path][method] = parsed;\n};\n\nexport const parseWebhookOperation = ({\n context,\n key,\n method,\n ...options\n}: {\n context: Context;\n key: string;\n method: (typeof httpMethods)[number];\n operation: Operation;\n securitySchemesMap: Map<string, SecuritySchemeObject>;\n state: State;\n}) => {\n if (!context.ir.webhooks) {\n context.ir.webhooks = {};\n }\n\n if (!context.ir.webhooks[key]) {\n context.ir.webhooks[key] = {};\n }\n\n const { parsed } = parseOperationObject({\n context,\n method,\n path: key as `/${string}`,\n ...options,\n });\n\n context.ir.webhooks[key][method] = parsed;\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { refToName } from '~/utils/ref';\n\nimport type {\n ParameterObject,\n ReferenceObject,\n SchemaObject,\n} from '../types/spec';\nimport { mediaTypeObjects } from './mediaType';\nimport { paginationField } from './pagination';\nimport { schemaToIrSchema } from './schema';\n\n/**\n * Returns default parameter `allowReserved` based on value of `in`.\n */\nconst defaultAllowReserved = (\n _in: ParameterObject['in'],\n): boolean | undefined => {\n switch (_in) {\n // this keyword only applies to parameters with an `in` value of `query`\n case 'query':\n return false;\n default:\n return;\n }\n};\n\n/**\n * Returns default parameter `explode` based on value of `style`.\n */\nconst defaultExplode = (style: Required<ParameterObject>['style']): boolean => {\n switch (style) {\n // default value for `deepObject` is `false`, but that behavior is undefined\n // so we use `true` to make this work with the `client-fetch` package\n case 'deepObject':\n case 'form':\n return true;\n default:\n return false;\n }\n};\n\n/**\n * Returns default parameter `style` based on value of `in`.\n */\nconst defaultStyle = (\n _in: ParameterObject['in'],\n): Required<ParameterObject>['style'] => {\n switch (_in) {\n case 'header':\n case 'path':\n return 'simple';\n case 'cookie':\n case 'query':\n return 'form';\n }\n};\n\nexport const parametersArrayToObject = ({\n context,\n parameters,\n}: {\n context: Context;\n parameters?: ReadonlyArray<ParameterObject | ReferenceObject>;\n}): IR.ParametersObject | undefined => {\n if (!parameters || !Object.keys(parameters).length) {\n return;\n }\n\n const parametersObject: IR.ParametersObject = {};\n\n for (const parameterOrReference of parameters) {\n const parameter =\n '$ref' in parameterOrReference\n ? context.dereference<ParameterObject>(parameterOrReference)\n : parameterOrReference;\n\n if (!parametersObject[parameter.in]) {\n parametersObject[parameter.in] = {};\n }\n\n // lowercase keys for case insensitive access\n parametersObject[parameter.in]![parameter.name.toLocaleLowerCase()] =\n parameterToIrParameter({\n $ref: `#/todo/real/path/to/parameter/${parameter.name}`,\n context,\n parameter,\n });\n }\n\n return parametersObject;\n};\n\nconst parameterToIrParameter = ({\n $ref,\n context,\n parameter,\n}: {\n $ref: string;\n context: Context;\n parameter: ParameterObject;\n}): IR.ParameterObject => {\n // TODO: parser - fix\n let schema = parameter.schema;\n\n if (!schema) {\n const contents = mediaTypeObjects({ content: parameter.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n if (content) {\n schema = content.schema;\n }\n }\n\n const finalSchema: SchemaObject = {\n deprecated: parameter.deprecated,\n description: parameter.description,\n ...schema,\n };\n\n const pagination = paginationField({\n context,\n name: parameter.name,\n schema: finalSchema,\n });\n\n const style = parameter.style || defaultStyle(parameter.in);\n const explode =\n parameter.explode !== undefined ? parameter.explode : defaultExplode(style);\n const allowReserved =\n parameter.allowReserved !== undefined\n ? parameter.allowReserved\n : defaultAllowReserved(parameter.in);\n\n const irParameter: IR.ParameterObject = {\n allowReserved,\n explode,\n location: parameter.in,\n name: parameter.name,\n schema: schemaToIrSchema({\n context,\n schema: finalSchema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n }),\n style,\n };\n\n if (parameter.deprecated) {\n irParameter.deprecated = parameter.deprecated;\n }\n\n if (parameter.description) {\n irParameter.description = parameter.description;\n }\n\n if (pagination) {\n irParameter.pagination = pagination;\n }\n\n if (parameter.required) {\n irParameter.required = parameter.required;\n }\n\n return irParameter;\n};\n\nexport const parseParameter = ({\n $ref,\n context,\n parameter,\n}: {\n $ref: string;\n context: Context;\n parameter: ParameterObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.parameters) {\n context.ir.components.parameters = {};\n }\n\n context.ir.components.parameters[refToName($ref)] = parameterToIrParameter({\n $ref,\n context,\n parameter,\n });\n};\n","import type { Context } from '~/ir/context';\nimport type { IR } from '~/ir/types';\nimport { refToName } from '~/utils/ref';\n\nimport type { RequestBodyObject, SchemaObject } from '../types/spec';\nimport { mediaTypeObjects } from './mediaType';\nimport { schemaToIrSchema } from './schema';\n\nconst requestBodyToIrRequestBody = ({\n $ref,\n context,\n requestBody,\n}: {\n $ref: string;\n context: Context;\n requestBody: RequestBodyObject;\n}): IR.RequestBodyObject => {\n // TODO: parser - fix\n const contents = mediaTypeObjects({ content: requestBody.content });\n // TODO: add support for multiple content types, for now prefer JSON\n const content =\n contents.find((content) => content.type === 'json') || contents[0];\n const schema = content ? content.schema : undefined;\n\n const finalSchema: SchemaObject = {\n description: requestBody.description,\n ...schema,\n };\n\n const irRequestBody: IR.RequestBodyObject = {\n schema: schemaToIrSchema({\n context,\n schema: finalSchema,\n state: {\n $ref,\n circularReferenceTracker: new Set(),\n },\n }),\n };\n\n if (requestBody.description) {\n irRequestBody.description = requestBody.description;\n }\n\n if (requestBody.required) {\n irRequestBody.required = requestBody.required;\n }\n\n return irRequestBody;\n};\n\nexport const parseRequestBody = ({\n $ref,\n context,\n requestBody,\n}: {\n $ref: string;\n context: Context;\n requestBody: RequestBodyObject;\n}) => {\n if (!context.ir.components) {\n context.ir.components = {};\n }\n\n if (!context.ir.components.requestBodies) {\n context.ir.components.requestBodies = {};\n }\n\n context.ir.components.requestBodies[refToName($ref)] =\n requestBodyToIrRequestBody({\n $ref,\n context,\n requestBody,\n });\n};\n","import type { Context } from '~/ir/context';\nimport { parseUrl } from '~/utils/url';\n\nexport const parseServers = ({ context }: { context: Context }) => {\n if (context.spec.servers) {\n context.ir.servers = context.spec.servers;\n return;\n }\n\n for (const input of context.config.input) {\n if (typeof input.path === 'string') {\n const url = parseUrl(input.path);\n context.ir.servers = [\n {\n url: `${url.protocol ? `${url.protocol}://` : ''}${url.host}${url.port ? `:${url.port}` : ''}`,\n },\n ];\n }\n }\n\n if (!context.ir.servers) {\n context.ir.servers = [\n {\n url: '/',\n },\n ];\n }\n};\n","import { createOperationKey } from '~/ir/operation';\nimport { httpMethods } from '~/openApi/shared/utils/operation';\nimport type {\n ValidatorIssue,\n ValidatorResult,\n} from '~/openApi/shared/utils/validator';\nimport type { Logger } from '~/utils/logger';\n\nimport type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec';\n\nexport const validateOpenApiSpec = (\n spec: OpenApiV3_1_X,\n logger: Logger,\n): ValidatorResult => {\n const eventValidate = logger.timeEvent('validate');\n const issues: Array<ValidatorIssue> = [];\n const operationIds = new Map();\n\n if (spec.paths) {\n for (const entry of Object.entries(spec.paths)) {\n const path = entry[0] as keyof PathsObject;\n const pathItem = entry[1] as PathItemObject;\n for (const method of httpMethods) {\n const operation = pathItem[method];\n if (!operation) {\n continue;\n }\n\n const operationKey = createOperationKey({ method, path });\n\n if (operation.operationId) {\n if (!operationIds.has(operation.operationId)) {\n operationIds.set(operation.operationId, operationKey);\n } else {\n issues.push({\n code: 'duplicate_key',\n context: {\n key: 'operationId',\n value: operation.operationId,\n },\n message:\n 'Duplicate `operationId` found. Each `operationId` must be unique.',\n path: ['paths', path, method, 'operationId'],\n severity: 'error',\n });\n }\n }\n }\n }\n }\n\n if (spec.servers) {\n if (typeof spec.servers !== 'object' || !Array.isArray(spec.servers)) {\n issues.push({\n code: 'invalid_type',\n message: '`servers` must be an array.',\n path: [],\n severity: 'error',\n });\n }\n\n for (let index = 0; index < spec.servers.length; index++) {\n const server = spec.servers[index];\n if (!server || typeof server !== 'object') {\n issues.push({\n code: 'invalid_type',\n context: {\n actual: typeof server,\n expected: 'object',\n },\n message: 'Each entry in `servers` must be an object.',\n path: ['servers', index],\n severity: 'error',\n });\n } else {\n if (!server.url) {\n issues.push({\n code: 'missing_required_field',\n context: {\n field: 'url',\n },\n message: 'Missing required field `url` in server object.',\n path: ['servers', index],\n severity: 'error',\n });\n }\n }\n }\n }\n\n eventValidate.timeEnd();\n return {\n issues,\n valid: !issues.some((issue) => issue.severity === 'error'),\n };\n};\n","import type { Context } from '~/ir/context';\nimport { mergeParametersObjects } from '~/openApi/shared/utils/parameter';\n\nimport type { OpenApiV3_1_X, PathItemObject } from '../types/spec';\nimport { parseWebhookOperation } from './operation';\nimport { parametersArrayToObject } from './parameter';\n\nexport const parseWebhooks = ({\n context,\n securitySchemesMap,\n}: Pick<Parameters<typeof parseWebhookOperation>[0], 'securitySchemesMap'> & {\n context: Context<OpenApiV3_1_X>;\n}) => {\n const state: Parameters<typeof parseWebhookOperation>[0]['state'] = {\n ids: new Map(),\n };\n\n for (const key in context.spec.webhooks) {\n const webhook = context.spec.webhooks[key]!;\n\n const finalWebhook =\n '$ref' in webhook\n ? {\n ...context.resolveRef<PathItemObject>(webhook.$ref!),\n ...webhook,\n }\n : webhook;\n\n const operationArgs: Omit<\n Parameters<typeof parseWebhookOperation>[0],\n 'method'\n > = {\n context,\n key,\n operation: {\n description: finalWebhook.description,\n parameters: parametersArrayToObject({\n context,\n parameters: finalWebhook.parameters,\n }),\n security: context.spec.security,\n servers: finalWebhook.servers,\n summary: finalWebhook.summary,\n },\n securitySchemesMap,\n state,\n };\n\n if (finalWebhook.delete) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'delete',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.delete,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.delete.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.get) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'get',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.get,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.get.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.head) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'head',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.head,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.head.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.options) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'options',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.options,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.options.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.patch) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'patch',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.patch,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.patch.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.post) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'post',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.post,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.post.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.put) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'put',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.put,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.put.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalWebhook.trace) {\n parseWebhookOperation({\n ...operationArgs,\n method: 'trace',\n operation: {\n ...operationArgs.operation,\n ...finalWebhook.trace,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalWebhook.trace.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n }\n};\n","import type { Context } from '~/ir/context';\nimport { buildResourceMetadata } from '~/openApi/shared/graph/meta';\nimport { transformOpenApiSpec } from '~/openApi/shared/transforms';\nimport type { State } from '~/openApi/shared/types/state';\nimport {\n createFilteredDependencies,\n createFilters,\n hasFilters,\n} from '~/openApi/shared/utils/filter';\nimport { buildGraph } from '~/openApi/shared/utils/graph';\nimport { mergeParametersObjects } from '~/openApi/shared/utils/parameter';\nimport { handleValidatorResult } from '~/openApi/shared/utils/validator';\n\nimport type {\n OpenApiV3_1_X,\n ParameterObject,\n PathItemObject,\n PathsObject,\n RequestBodyObject,\n SecuritySchemeObject,\n} from '../types/spec';\nimport { filterSpec } from './filter';\nimport { parsePathOperation } from './operation';\nimport { parametersArrayToObject, parseParameter } from './parameter';\nimport { parseRequestBody } from './requestBody';\nimport { parseSchema } from './schema';\nimport { parseServers } from './server';\nimport { validateOpenApiSpec } from './validate';\nimport { parseWebhooks } from './webhook';\n\nexport const parseV3_1_X = (context: Context<OpenApiV3_1_X>) => {\n if (context.config.parser.validate_EXPERIMENTAL) {\n const result = validateOpenApiSpec(context.spec, context.logger);\n handleValidatorResult({ context, result });\n }\n\n const shouldFilterSpec = hasFilters(context.config.parser.filters);\n if (shouldFilterSpec) {\n const filters = createFilters(\n context.config.parser.filters,\n context.spec,\n context.logger,\n );\n const { graph } = buildGraph(context.spec, context.logger);\n const { resourceMetadata } = buildResourceMetadata(graph, context.logger);\n const sets = createFilteredDependencies({\n filters,\n logger: context.logger,\n resourceMetadata,\n });\n filterSpec({\n ...sets,\n logger: context.logger,\n preserveOrder: filters.preserveOrder,\n spec: context.spec,\n });\n }\n\n transformOpenApiSpec({ context });\n\n const state: State = {\n ids: new Map(),\n };\n const securitySchemesMap = new Map<string, SecuritySchemeObject>();\n\n // TODO: parser - handle more component types, old parser handles only parameters and schemas\n if (context.spec.components) {\n for (const name in context.spec.components.securitySchemes) {\n const securityOrReference =\n context.spec.components.securitySchemes[name]!;\n const securitySchemeObject =\n '$ref' in securityOrReference\n ? context.resolveRef<SecuritySchemeObject>(securityOrReference.$ref)\n : securityOrReference;\n securitySchemesMap.set(name, securitySchemeObject);\n }\n\n for (const name in context.spec.components.parameters) {\n const $ref = `#/components/parameters/${name}`;\n const parameterOrReference = context.spec.components.parameters[name]!;\n const parameter =\n '$ref' in parameterOrReference\n ? context.resolveRef<ParameterObject>(parameterOrReference.$ref)\n : parameterOrReference;\n\n parseParameter({\n $ref,\n context,\n parameter,\n });\n }\n\n for (const name in context.spec.components.requestBodies) {\n const $ref = `#/components/requestBodies/${name}`;\n const requestBodyOrReference =\n context.spec.components.requestBodies[name]!;\n const requestBody =\n '$ref' in requestBodyOrReference\n ? context.resolveRef<RequestBodyObject>(requestBodyOrReference.$ref)\n : requestBodyOrReference;\n\n parseRequestBody({\n $ref,\n context,\n requestBody,\n });\n }\n\n for (const name in context.spec.components.schemas) {\n const $ref = `#/components/schemas/${name}`;\n const schema = context.spec.components.schemas[name]!;\n\n parseSchema({\n $ref,\n context,\n schema,\n });\n }\n }\n\n parseServers({ context });\n\n for (const path in context.spec.paths) {\n const pathItem = context.spec.paths[path as keyof PathsObject]!;\n\n const finalPathItem = pathItem.$ref\n ? {\n ...context.resolveRef<PathItemObject>(pathItem.$ref),\n ...pathItem,\n }\n : pathItem;\n\n const operationArgs: Omit<\n Parameters<typeof parsePathOperation>[0],\n 'method'\n > = {\n context,\n operation: {\n description: finalPathItem.description,\n parameters: parametersArrayToObject({\n context,\n parameters: finalPathItem.parameters,\n }),\n security: context.spec.security,\n servers: finalPathItem.servers,\n summary: finalPathItem.summary,\n },\n path: path as keyof PathsObject,\n securitySchemesMap,\n state,\n };\n\n if (finalPathItem.delete) {\n parsePathOperation({\n ...operationArgs,\n method: 'delete',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.delete,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.delete.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.get) {\n parsePathOperation({\n ...operationArgs,\n method: 'get',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.get,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.get.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.head) {\n parsePathOperation({\n ...operationArgs,\n method: 'head',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.head,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.head.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.options) {\n parsePathOperation({\n ...operationArgs,\n method: 'options',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.options,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.options.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.patch) {\n parsePathOperation({\n ...operationArgs,\n method: 'patch',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.patch,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.patch.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.post) {\n parsePathOperation({\n ...operationArgs,\n method: 'post',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.post,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.post.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.put) {\n parsePathOperation({\n ...operationArgs,\n method: 'put',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.put,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.put.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n\n if (finalPathItem.trace) {\n parsePathOperation({\n ...operationArgs,\n method: 'trace',\n operation: {\n ...operationArgs.operation,\n ...finalPathItem.trace,\n parameters: mergeParametersObjects({\n source: parametersArrayToObject({\n context,\n parameters: finalPathItem.trace.parameters,\n }),\n target: operationArgs.operation.parameters,\n }),\n },\n });\n }\n }\n\n parseWebhooks({ context, securitySchemesMap });\n};\n","import { satisfies } from '~/config/utils/package';\nimport { Context } from '~/ir/context';\nimport { parseV2_0_X } from '~/openApi/2.0.x';\nimport { parseV3_0_X } from '~/openApi/3.0.x';\nimport { parseV3_1_X } from '~/openApi/3.1.x';\nimport type { OpenApi } from '~/openApi/types';\nimport type { Config } from '~/types/config';\nimport type { Logger } from '~/utils/logger';\n\n/**\n * @internal\n * Parse the resolved OpenAPI specification. This will populate and return\n * `context` with intermediate representation obtained from the parsed spec.\n */\nexport const parseOpenApiSpec = ({\n config,\n dependencies,\n logger,\n spec,\n}: {\n config: Config;\n dependencies: Record<string, string>;\n logger: Logger;\n spec: unknown;\n}): Context => {\n const context = new Context({\n config,\n dependencies,\n logger,\n spec: spec as OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X,\n });\n\n if ('swagger' in context.spec) {\n parseV2_0_X(context as Context<OpenApi.V2_0_X>);\n return context;\n }\n\n if (satisfies(context.spec.openapi, '>=3.0.0 <3.1.0')) {\n parseV3_0_X(context as Context<OpenApi.V3_0_X>);\n return context;\n }\n\n if (satisfies(context.spec.openapi, '>=3.1.0')) {\n parseV3_1_X(context as Context<OpenApi.V3_1_X>);\n return context;\n }\n\n throw new Error('Unsupported OpenAPI specification');\n};\n"],"mappings":"saAQA,MAAMA,EAAa,EAAc,OAAO,KAAK,IAAI,CAC3CC,EAAY,EAAK,QAAQD,EAAW,CAE7B,MAA6C,CACxD,IAAI,EAAMC,EACV,KAAO,IAAQ,EAAK,QAAQ,EAAI,EAAE,CAEhC,IAAM,EADQ,EAAG,YAAY,EAAI,CACR,OAAQ,GAAS,IAAS,eAAe,CAElE,GAAI,EAAW,GAAI,CACjB,IAAM,EAAkB,EAAK,KAAK,EAAK,EAAW,GAAG,CACrD,OAAO,KAAK,MACV,EAAG,aAAa,EAAiB,CAC/B,SAAU,OACX,CAAC,CACH,CAGH,EAAM,EAAK,QAAQ,EAAI,GAMd,OAAwB,CACnC,IAAM,EAAc,GAAiB,CAE/B,EAAc,CAClB,KAAM,CACJ,IAAK,GACN,CACD,KAAM,GACN,QAAS,GACV,CA4BD,OA1BI,GAAe,OAAO,GAAgB,WACpC,SAAU,GAAe,OAAO,EAAY,MAAS,WACvD,EAAY,KAAO,EAAY,MAG7B,YAAa,GAAe,OAAO,EAAY,SAAY,WAC7D,EAAY,QAAU,EAAY,SAIlC,SAAU,GACV,EAAY,MACZ,OAAO,EAAY,MAAS,UAG1B,QAAS,EAAY,MACrB,OAAO,EAAY,KAAK,KAAQ,WAEhC,EAAY,KAAK,IAAM,EAAY,KAAK,IACpC,EAAY,KAAK,KAAO,CAAC,EAAY,KAAK,IAAI,SAAS,IAAI,GAC7D,EAAY,KAAK,KAAO,OAMzB,GAGI,GACX,GACkB,CAClB,GAAI,IAAiB,KACnB,OAAO,KAGT,GAAI,EAAc,CAChB,IAAM,EAAW,EAAK,WAAW,EAAa,CAC1C,EACA,EAAK,QAA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