moonflower 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/errors/BaseHttpError.cjs +1 -1
  2. package/dist/errors/BaseHttpError.cjs.map +1 -1
  3. package/dist/errors/BaseHttpError.d.ts +4 -4
  4. package/dist/errors/BaseHttpError.d.ts.map +1 -1
  5. package/dist/errors/BaseHttpError.mjs +1 -1
  6. package/dist/errors/BaseHttpError.mjs.map +1 -1
  7. package/dist/errors/ReasonPhrases.cjs +2 -0
  8. package/dist/errors/ReasonPhrases.cjs.map +1 -0
  9. package/dist/errors/ReasonPhrases.d.ts +5 -0
  10. package/dist/errors/ReasonPhrases.d.ts.map +1 -0
  11. package/dist/errors/ReasonPhrases.mjs +368 -0
  12. package/dist/errors/ReasonPhrases.mjs.map +1 -0
  13. package/dist/errors/StatusCodes.cjs +2 -0
  14. package/dist/errors/StatusCodes.cjs.map +1 -0
  15. package/dist/errors/StatusCodes.d.ts +63 -0
  16. package/dist/errors/StatusCodes.d.ts.map +1 -0
  17. package/dist/errors/StatusCodes.mjs +360 -0
  18. package/dist/errors/StatusCodes.mjs.map +1 -0
  19. package/dist/errors/UserFacingErrors.cjs +1 -1
  20. package/dist/errors/UserFacingErrors.cjs.map +1 -1
  21. package/dist/errors/UserFacingErrors.d.ts.map +1 -1
  22. package/dist/errors/UserFacingErrors.mjs +1 -1
  23. package/dist/errors/UserFacingErrors.mjs.map +1 -1
  24. package/dist/openapi/analyzerModule/nodeParsers.cjs.map +1 -1
  25. package/dist/openapi/analyzerModule/nodeParsers.d.ts +1 -1
  26. package/dist/openapi/analyzerModule/nodeParsers.d.ts.map +1 -1
  27. package/dist/openapi/analyzerModule/nodeParsers.mjs.map +1 -1
  28. package/dist/utils/object.cjs +1 -1
  29. package/dist/utils/object.cjs.map +1 -1
  30. package/dist/utils/object.d.ts +1 -0
  31. package/dist/utils/object.d.ts.map +1 -1
  32. package/dist/utils/object.mjs +4 -3
  33. package/dist/utils/object.mjs.map +1 -1
  34. package/package.json +1 -3
  35. package/src/errors/BaseHttpError.ts +5 -4
  36. package/src/errors/ReasonPhrases.ts +367 -0
  37. package/src/errors/StatusCodes.ts +359 -0
  38. package/src/errors/UserFacingErrors.ts +1 -2
  39. package/src/openapi/analyzerModule/nodeParsers.ts +0 -1
  40. package/src/utils/object.ts +4 -0
  41. package/vite.config.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParsers.cjs","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"sourcesContent":["import {\n\tNode,\n\tPropertyAccessExpression,\n\tPropertyAssignment,\n\tPropertySignature,\n\tShorthandPropertyAssignment,\n\tSyntaxKind,\n\tts,\n\tType,\n\tTypeReferenceNode,\n} from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { debugNode } from '../../utils/printers'\nimport { OpenApiManager } from '../manager/OpenApiManager'\nimport { ShapeOfProperty, ShapeOfType, ShapeOfUnionEntry } from './types'\n\nconst implementationCache = new WeakMap<Node, Node>()\n\nexport const findNodeImplementation = (node: Node): Node => {\n\tconst cached = implementationCache.get(node)\n\tif (cached) {\n\t\treturn cached\n\t}\n\n\tif (node.getKind() === SyntaxKind.Identifier) {\n\t\tconst implementationNode = node.asKind(SyntaxKind.Identifier)!.getImplementations()[0]?.getNode()\n\t\tif (implementationNode) {\n\t\t\tconst implementationParentNode = implementationNode.getParent()!\n\t\t\tconst assignmentValueNode = implementationParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\n\t\tconst definitionNode = node.asKind(SyntaxKind.Identifier)!.getDefinitions()[0]?.getNode()\n\t\tif (definitionNode) {\n\t\t\tconst definitionParentNode = definitionNode.getParent()!\n\t\t\tconst assignmentValueNode = definitionParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\t\tthrow new Error('No implementation nor definition available')\n\t}\n\n\timplementationCache.set(node, node)\n\treturn node\n}\n\nexport const findPropertyAssignmentValueNode = (\n\tnode:\n\t\t| PropertyAssignment\n\t\t| TypeReferenceNode\n\t\t| PropertySignature\n\t\t| PropertyAccessExpression\n\t\t| ShorthandPropertyAssignment,\n): Node => {\n\tconst identifierChildren = node.getChildrenOfKind(SyntaxKind.Identifier)\n\tif (identifierChildren.length === 2) {\n\t\treturn findNodeImplementation(identifierChildren[1])\n\t}\n\tconst lastMatchingChild = node.getChildren().reverse()\n\treturn lastMatchingChild.find(\n\t\t(child) =>\n\t\t\tchild.getKind() !== SyntaxKind.GreaterThanToken &&\n\t\t\tchild.getKind() !== SyntaxKind.CommaToken &&\n\t\t\tchild.getKind() !== SyntaxKind.SemicolonToken,\n\t)!\n}\n\nexport const getTypeReferenceShape = (node: TypeReferenceNode): ShapeOfType['shape'] => {\n\tconst firstChild = node.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tif (firstChild.isKind(SyntaxKind.SyntaxList)) {\n\t\treturn getRecursiveNodeShape(firstChild.getFirstChild()!)\n\t} else {\n\t\treturn getRecursiveNodeShape(firstChild)\n\t}\n}\n\nexport const getRecursiveNodeShape = (nodeOrReference: Node): ShapeOfType['shape'] => {\n\tconst typeName = nodeOrReference.getSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\t// Undefined\n\tconst undefinedNode = node.asKind(SyntaxKind.UndefinedKeyword)\n\tif (undefinedNode) {\n\t\treturn 'undefined'\n\t}\n\n\t// Literal type\n\tconst literalNode = node.asKind(SyntaxKind.LiteralType)\n\tif (literalNode) {\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.TrueKeyword)) {\n\t\t\treturn 'true'\n\t\t}\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.FalseKeyword)) {\n\t\t\treturn 'false'\n\t\t}\n\t}\n\n\t// Boolean literal\n\tconst booleanLiteralNode =\n\t\tnode.asKind(SyntaxKind.BooleanKeyword) ||\n\t\tnode.asKind(SyntaxKind.TrueKeyword) ||\n\t\tnode.asKind(SyntaxKind.FalseKeyword)\n\tif (booleanLiteralNode) {\n\t\treturn 'boolean'\n\t}\n\n\t// String literal\n\tconst stringLiteralNode = node.asKind(SyntaxKind.StringKeyword) || node.asKind(SyntaxKind.StringLiteral)\n\tif (stringLiteralNode) {\n\t\treturn 'string'\n\t}\n\n\t// Number literal\n\tconst numberLiteralNode = node.asKind(SyntaxKind.NumberKeyword) || node.asKind(SyntaxKind.NumericLiteral)\n\tif (numberLiteralNode) {\n\t\treturn 'number'\n\t}\n\n\t// BigInt literal\n\tconst bigIntNode = node.asKind(SyntaxKind.BigIntKeyword) || node.asKind(SyntaxKind.BigIntLiteral)\n\tif (bigIntNode) {\n\t\treturn 'bigint'\n\t}\n\n\t// Type literal\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\tconst properties = typeLiteralNode\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getChildrenOfKind(SyntaxKind.PropertySignature)\n\n\t\tconst propertyShapes = properties.map((propNode) => {\n\t\t\tconst identifier = propNode.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\t\tconst valueNode = findPropertyAssignmentValueNode(propNode)\n\t\t\tconst questionMarkToken = identifier.getNextSiblingIfKind(SyntaxKind.QuestionToken)\n\t\t\treturn {\n\t\t\t\trole: 'property' as const,\n\t\t\t\tidentifier: identifier.getText(),\n\t\t\t\tshape: getRecursiveNodeShape(valueNode),\n\t\t\t\toptional: valueNode.getType().isNullable() || !!questionMarkToken,\n\t\t\t}\n\t\t})\n\t\treturn propertyShapes\n\t}\n\n\t// Type reference\n\tconst typeReferenceNode = node.asKind(SyntaxKind.TypeReference)\n\tif (typeReferenceNode) {\n\t\treturn getRecursiveNodeShape(typeReferenceNode.getFirstChild()!)\n\t}\n\n\t// Property access expression\n\tconst propertyAccessNode = node.asKind(SyntaxKind.PropertyAccessExpression)\n\tif (propertyAccessNode) {\n\t\tconst lastChild = findNodeImplementation(node.getLastChild()!)\n\t\treturn getProperTypeShape(lastChild.asKind(SyntaxKind.CallExpression)!.getReturnType(), lastChild)\n\t}\n\n\t// Union type\n\tconst unionTypeNode = node.asKind(SyntaxKind.UnionType)\n\tif (unionTypeNode) {\n\t\treturn getProperTypeShape(unionTypeNode.getType(), node)\n\t}\n\n\t// Typeof query\n\tconst typeQueryNode = node.asKind(SyntaxKind.TypeQuery)\n\tif (typeQueryNode) {\n\t\treturn getRecursiveNodeShape(typeQueryNode.getLastChild()!)\n\t}\n\n\t// Qualified name\n\tconst qualifiedNameNode = node.asKind(SyntaxKind.QualifiedName)\n\tif (qualifiedNameNode) {\n\t\treturn getRecursiveNodeShape(qualifiedNameNode.getLastChild()!)\n\t}\n\n\t// Call expression\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\treturn getProperTypeShape(callExpressionNode.getReturnType(), callExpressionNode)\n\t}\n\n\t// Await expression\n\tconst awaitExpressionNode = node.asKind(SyntaxKind.AwaitExpression)\n\tif (awaitExpressionNode) {\n\t\treturn getRecursiveNodeShape(awaitExpressionNode.getChildAtIndex(1)!)\n\t}\n\n\t// 'As' Expression\n\tconst asExpressionNode = node.asKind(SyntaxKind.AsExpression)\n\tif (asExpressionNode) {\n\t\treturn getRecursiveNodeShape(asExpressionNode.getChildAtIndex(2)!)\n\t}\n\n\t// TODO\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown node type: ${node.getKindName()}`)\n\treturn 'unknown_1'\n}\n\nexport const getShapeOfValidatorLiteral = (\n\tobjectLiteralNode: Node<ts.ObjectLiteralExpression>,\n): (ShapeOfProperty & { description: string; errorMessage: string })[] => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstChild()!\n\t\tconst identifierName = (() => {\n\t\t\tif (identifierNode.isKind(SyntaxKind.Identifier)) {\n\t\t\t\treturn identifierNode.getText()\n\t\t\t}\n\t\t\tif (identifierNode.isKind(SyntaxKind.StringLiteral)) {\n\t\t\t\treturn identifierNode.getLiteralText()\n\t\t\t}\n\t\t\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\t\t\tLogger.warn(`[${fileName}] Unknown identifier name: ${identifierNode.getText()}`)\n\t\t\treturn 'unknown_30'\n\t\t})()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst innerLiteralNode = findNodeImplementation(assignmentValueNode)\n\n\t\treturn {\n\t\t\trole: 'property' as const,\n\t\t\tidentifier: identifierName,\n\t\t\tshape: getValidatorPropertyShape(innerLiteralNode),\n\t\t\toptional: getValidatorPropertyOptionality(innerLiteralNode),\n\t\t\tdescription: getValidatorPropertyStringValue(innerLiteralNode, 'description'),\n\t\t\terrorMessage: getValidatorPropertyStringValue(innerLiteralNode, 'errorMessage'),\n\t\t}\n\t})\n\n\treturn properties || []\n}\n\nexport const getValidatorPropertyShape = (innerLiteralNode: Node): ShapeOfType['shape'] => {\n\t// Inline definition with `as Validator<...>` clause\n\tconst inlineValidatorAsExpression = innerLiteralNode\n\t\t.getParent()!\n\t\t.getFirstChildByKind(SyntaxKind.AsExpression)\n\tif (inlineValidatorAsExpression) {\n\t\tconst typeReference = inlineValidatorAsExpression.getLastChildByKind(SyntaxKind.TypeReference)!\n\t\treturn getTypeReferenceShape(typeReference)\n\t}\n\n\t// Variable with `: Validator<...>` clause\n\tconst childTypeReferenceNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.TypeReference)\n\tif (childTypeReferenceNode) {\n\t\treturn getTypeReferenceShape(childTypeReferenceNode)\n\t}\n\n\t// `RequiredParam<...>` inline call expression\n\tif (innerLiteralNode.getParent()!.getChildrenOfKind(SyntaxKind.SyntaxList).length >= 2) {\n\t\tconst typeNode = innerLiteralNode\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getFirstChild()!\n\t\treturn getRecursiveNodeShape(typeNode)\n\t}\n\n\t// `RequestParam | RequiredParam | OptionalParam` call expression\n\tconst childCallExpressionNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.CallExpression)\n\tif (childCallExpressionNode) {\n\t\tconst callExpressionArgument = findNodeImplementation(\n\t\t\tchildCallExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!.getFirstChild()!,\n\t\t)\n\n\t\t// Param is a type reference\n\t\tconst typeReferenceNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.TypeReference)!\n\t\tif (typeReferenceNode) {\n\t\t\treturn getProperTypeShape(typeReferenceNode.getType(), typeReferenceNode, [])\n\t\t}\n\n\t\tconst thingyNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.ObjectLiteralExpression)!\n\t\tif (thingyNode) {\n\t\t\treturn getValidatorPropertyShape(thingyNode)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.CallExpression) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.IntersectionType) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\t\tLogger.warn(`[${fileName}] Unknown call expression argument: ${callExpressionArgument.getKindName()}`)\n\t\treturn 'unknown_3'\n\t}\n\n\t// Attempting to infer type from `parse` function\n\tconst innerNodePropertyAssignments = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t.getChildrenOfKind(SyntaxKind.PropertyAssignment)\n\tconst parsePropertyAssignment = innerNodePropertyAssignments.find((prop) => {\n\t\treturn prop.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === 'parse'\n\t})\n\tif (parsePropertyAssignment) {\n\t\tconst returnType = findPropertyAssignmentValueNode(parsePropertyAssignment)\n\t\t\t.asKind(SyntaxKind.ArrowFunction)!\n\t\t\t.getReturnType()\n\t\treturn getProperTypeShape(returnType, parsePropertyAssignment)\n\t}\n\n\t// Import statement\n\tconst importTypeNode = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)\n\t\t?.getFirstChildByKind(SyntaxKind.ImportType)\n\tif (importTypeNode) {\n\t\tconst indexOfGreaterThanToken = importTypeNode\n\t\t\t.getLastChildByKind(SyntaxKind.GreaterThanToken)!\n\t\t\t.getChildIndex()\n\t\tconst targetSyntaxList = importTypeNode.getChildAtIndex(indexOfGreaterThanToken - 1)\n\t\treturn getRecursiveNodeShape(targetSyntaxList.getFirstChild()!)\n\t}\n\n\t// Intersection type with Validator\n\tconst intersectionType = innerLiteralNode.isKind(SyntaxKind.IntersectionType)\n\t\t? innerLiteralNode\n\t\t: innerLiteralNode.getParent()?.isKind(SyntaxKind.VariableDeclaration)\n\t\t\t? innerLiteralNode.getParent()?.getFirstChildByKind(SyntaxKind.IntersectionType)\n\t\t\t: null\n\n\tif (intersectionType) {\n\t\tconst validatorType = intersectionType.getFirstChildByKind(SyntaxKind.TypeReference)\n\t\tif (validatorType) {\n\t\t\treturn getTypeReferenceShape(validatorType)\n\t\t}\n\t}\n\n\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown import type node`)\n\n\treturn 'unknown_2'\n}\n\nexport const getValidatorPropertyOptionality = (node: Node): boolean => {\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst identifierNode = callExpressionNode.getFirstChildByKind(SyntaxKind.Identifier)\n\t\tif (identifierNode?.getText() === 'OptionalParam') {\n\t\t\treturn true\n\t\t} else if (identifierNode?.getText() === 'RequiredParam') {\n\t\t\treturn false\n\t\t}\n\n\t\tconst syntaxListNode = callExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\tconst literalExpression = findNodeImplementation(syntaxListNode.getFirstChild()!)\n\t\treturn getValidatorPropertyOptionality(literalExpression)\n\t}\n\n\tconst syntaxListNode = node.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\treturn assignmentNodes.some((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tif (identifierName === 'optional') {\n\t\t\tconst value = findPropertyAssignmentValueNode(node)\n\t\t\treturn value.getKind() === SyntaxKind.TrueKeyword\n\t\t}\n\t\treturn false\n\t})\n}\n\nexport const getValidatorPropertyStringValue = (\n\tnodeOrReference: Node,\n\tname: 'description' | 'errorMessage',\n): string => {\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst targetChild = callExpressionNode.getLastChildByKind(SyntaxKind.SyntaxList)!\n\t\treturn getValidatorPropertyStringValue(targetChild, name)\n\t}\n\n\tconst syntaxListNode = node.asKind(SyntaxKind.SyntaxList)\n\tif (syntaxListNode) {\n\t\tconst children = syntaxListNode.getChildren().map((c) => getValidatorPropertyStringValue(c, name))\n\t\treturn children.find((value) => !!value && value !== 'unknown_25') || ''\n\t}\n\n\tconst objectLiteralNode = node.asKind(SyntaxKind.ObjectLiteralExpression)\n\tif (objectLiteralNode) {\n\t\tconst values = getValuesOfObjectLiteral(objectLiteralNode)\n\t\tconst targetValue = values.find((value) => value.identifier === name)\n\t\tif (!targetValue) {\n\t\t\treturn ''\n\t\t}\n\t\tif (Array.isArray(targetValue.value)) {\n\t\t\treturn 'array'\n\t\t}\n\t\treturn targetValue.value || ''\n\t}\n\n\tconst intersectionTypeNode = node.asKind(SyntaxKind.IntersectionType)\n\tif (intersectionTypeNode) {\n\t\treturn (\n\t\t\tintersectionTypeNode\n\t\t\t\t.getTypeNodes()\n\t\t\t\t.flatMap((t) => getValidatorPropertyStringValue(t, name))\n\t\t\t\t.filter((v) => !!v && v !== 'unknown_25')[0] || 'unknown_27'\n\t\t)\n\t}\n\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\treturn getValidatorPropertyStringValue(typeLiteralNode.getFirstChildByKind(SyntaxKind.SyntaxList)!, name)\n\t}\n\n\tconst propertySignatureNode = node.asKind(SyntaxKind.PropertySignature)\n\tif (propertySignatureNode) {\n\t\tconst identifier = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tif (identifier.getText() === name) {\n\t\t\tconst targetNode = findPropertyAssignmentValueNode(propertySignatureNode).getFirstDescendantByKind(\n\t\t\t\tSyntaxKind.StringLiteral,\n\t\t\t)!\n\t\t\treturn targetNode.getLiteralText()\n\t\t}\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown property string value node ${node.getKindName()}`)\n\treturn 'unknown_25'\n}\n\nconst isPromise = (type: Type) => {\n\tconst symbol = type.getSymbol()\n\tif (!type.isObject() || !symbol) {\n\t\treturn false\n\t}\n\tconst args = type.getTypeArguments()\n\treturn symbol.getName() === 'Promise' && args.length === 1\n}\n\nexport const getProperTypeShape = (\n\ttypeOrPromise: Type,\n\tatLocation: Node,\n\tstack: Type[] = [],\n): ShapeOfType['shape'] => {\n\tconst typeName = typeOrPromise.getAliasSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst type = isPromise(typeOrPromise) ? typeOrPromise.getTypeArguments()[0] : typeOrPromise\n\n\tif (stack.some((previousType) => previousType === type)) {\n\t\treturn 'circular'\n\t}\n\n\tconst nextStack = stack.concat(type)\n\n\tif (type.getText() === 'void') {\n\t\treturn 'void'\n\t}\n\n\tif (type.isAny()) {\n\t\treturn 'any'\n\t}\n\n\tif (type.isNull()) {\n\t\treturn 'null'\n\t}\n\n\tif (type.isUndefined()) {\n\t\treturn 'undefined'\n\t}\n\n\tif (type.isBoolean() || type.isBooleanLiteral()) {\n\t\treturn 'boolean'\n\t}\n\n\tif (type.isStringLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_string' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isNumberLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_number' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isString() || type.isTemplateLiteral()) {\n\t\treturn 'string'\n\t}\n\n\tif (type.isNumber()) {\n\t\treturn 'number'\n\t}\n\n\tif (type.getText() === 'bigint') {\n\t\treturn 'bigint'\n\t}\n\n\tif (type.isTuple()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'tuple' as const,\n\t\t\t\tshape: type.getTupleElements().map((t) => ({\n\t\t\t\t\trole: 'tuple_entry' as const,\n\t\t\t\t\tshape: getProperTypeShape(t, atLocation, nextStack),\n\t\t\t\t\toptional: false,\n\t\t\t\t})),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isArray()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'array' as const,\n\t\t\t\tshape: getProperTypeShape(type.getArrayElementType()!, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getText() === 'Buffer') {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'buffer' as const,\n\t\t\t\tshape: 'buffer',\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getProperties().length === 0) {\n\t\tconst targetType = type.getAliasTypeArguments()[1]\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'record' as const,\n\t\t\t\tshape: getProperTypeShape(targetType, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject()) {\n\t\tif (type.getText() === 'Date') {\n\t\t\treturn 'Date'\n\t\t}\n\t\treturn type\n\t\t\t.getProperties()\n\t\t\t.map((prop) => {\n\t\t\t\tconst valueDeclaration = prop.getValueDeclaration() || prop.getDeclarations()[0]!\n\t\t\t\tif (!valueDeclaration) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst valueDeclarationNode =\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertySignature) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertyAssignment) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.ShorthandPropertyAssignment)\n\n\t\t\t\tif (!valueDeclarationNode) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst isOptional = prop.getTypeAtLocation(atLocation).isNullable()\n\n\t\t\t\tconst shape = getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack)\n\t\t\t\treturn {\n\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\tshape: shape,\n\t\t\t\t\toptional: isOptional,\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((val) => val.shape !== 'undefined')\n\t}\n\n\tif (type.isUnion()) {\n\t\tconst unfilteredShapes: ShapeOfUnionEntry[] = type.getUnionTypes().map((type) => ({\n\t\t\trole: 'union_entry',\n\t\t\tshape: getProperTypeShape(type, atLocation, nextStack),\n\t\t\toptional: false,\n\t\t}))\n\n\t\tconst dedupedShapes = unfilteredShapes.filter(\n\t\t\t(type, index, arr) => !arr.find((dup, dupIndex) => dup.shape === type.shape && dupIndex > index),\n\t\t)\n\t\tconst isNullable = dedupedShapes.some((shape) => shape.shape === 'undefined')\n\t\tconst shapes = dedupedShapes.filter((shape) => shape.shape !== 'undefined')\n\t\tif (shapes.length === 1) {\n\t\t\treturn shapes[0].shape\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'union',\n\t\t\t\tshape: shapes,\n\t\t\t\toptional: isNullable,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isIntersection()) {\n\t\tconst children = type.getIntersectionTypes()\n\t\tconst shapesOfChildren = children\n\t\t\t.map((child) => getProperTypeShape(child, atLocation, nextStack))\n\t\t\t.filter((shape) => typeof shape !== 'string') as ShapeOfProperty[][]\n\t\treturn shapesOfChildren.reduce<ShapeOfType[]>((total, current) => [...total, ...current], [])\n\t}\n\n\tconst fileName = atLocation.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown type shape node ${typeOrPromise.getText()}`)\n\treturn 'unknown_5'\n}\n\nconst getLiteralValueOfNode = (node: Node): string | string[] | unknown[] => {\n\tif (node.isKind(SyntaxKind.Identifier)) {\n\t\treturn getLiteralValueOfNode(findNodeImplementation(node))\n\t} else if (node.isKind(SyntaxKind.StringLiteral)) {\n\t\treturn node.getLiteralValue()\n\t} else if (node.isKind(SyntaxKind.ArrayLiteralExpression)) {\n\t\treturn node.forEachChildAsArray().map((child) => getLiteralValueOfNode(child)) as string[]\n\t} else if (node.isKind(SyntaxKind.PropertyAccessExpression)) {\n\t\treturn getLiteralValueOfNode(findPropertyAssignmentValueNode(node))\n\t} else if (node.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\treturn getValuesOfObjectLiteral(node)\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown literal value node ${node.getKindName()}`)\n\n\treturn 'unknown_6'\n}\n\nexport const getValuesOfObjectLiteral = (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst targetNode = findNodeImplementation(assignmentValueNode)\n\t\tconst value = getLiteralValueOfNode(targetNode)\n\n\t\treturn {\n\t\t\tidentifier: identifierName,\n\t\t\tvalue,\n\t\t}\n\t})\n\n\treturn properties || []\n}\n"],"names":["implementationCache","findNodeImplementation","node","cached","SyntaxKind","implementationNode","assignmentValueNode","result","definitionNode","findPropertyAssignmentValueNode","identifierChildren","child","getTypeReferenceShape","firstChild","getRecursiveNodeShape","nodeOrReference","typeName","OpenApiManager","literalNode","typeLiteralNode","propNode","identifier","valueNode","questionMarkToken","typeReferenceNode","lastChild","getProperTypeShape","unionTypeNode","typeQueryNode","qualifiedNameNode","callExpressionNode","awaitExpressionNode","asExpressionNode","fileName","Logger","getShapeOfValidatorLiteral","objectLiteralNode","identifierNode","identifierName","innerLiteralNode","getValidatorPropertyShape","getValidatorPropertyOptionality","getValidatorPropertyStringValue","inlineValidatorAsExpression","typeReference","childTypeReferenceNode","typeNode","childCallExpressionNode","callExpressionArgument","thingyNode","parsePropertyAssignment","prop","returnType","importTypeNode","indexOfGreaterThanToken","targetSyntaxList","intersectionType","validatorType","syntaxListNode","literalExpression","name","targetChild","c","value","targetValue","getValuesOfObjectLiteral","intersectionTypeNode","t","v","propertySignatureNode","isPromise","type","symbol","args","typeOrPromise","atLocation","stack","previousType","nextStack","targetType","valueDeclaration","isOptional","shape","val","dedupedShapes","index","arr","dup","dupIndex","isNullable","shapes","total","current","getLiteralValueOfNode","targetNode"],"mappings":"2LAiBMA,MAA0B,QAEnBC,EAA0BC,GAAqB,CACrD,MAAAC,EAASH,EAAoB,IAAIE,CAAI,EAC3C,GAAIC,EACI,OAAAA,EAGR,GAAID,EAAK,YAAcE,EAAAA,WAAW,WAAY,CACvC,MAAAC,EAAqBH,EAAK,OAAOE,EAAW,WAAA,UAAU,EAAG,mBAAmB,EAAE,CAAC,GAAG,QAAQ,EAChG,GAAIC,EAAoB,CAEjB,MAAAC,EAD2BD,EAAmB,UAAU,EACT,aAAa,EAClE,GAAIC,IAAwBJ,EACrB,MAAA,IAAI,MAAM,gCAAgC,EAE3C,MAAAK,EAASN,EAAuBK,CAAmB,EACrC,OAAAN,EAAA,IAAIE,EAAMK,CAAM,EAC7BA,CAAA,CAGF,MAAAC,EAAiBN,EAAK,OAAOE,EAAW,WAAA,UAAU,EAAG,eAAe,EAAE,CAAC,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AAyB/D,CAAI,EAG/B,MAAA+B,EAAW/B,EAAK,cAAc,EAAE,cAAc,MAAM,GAAG,EAAE,IAAI,EACnEgC,OAAAA,SAAO,IAAI,IAAID,CAAQ,gCAAgC/B,EAAK,YAAa,CAAA,EAAE,EAEpE,WACR,EAEa+D,EAA4B7B,GACjBA,EAAkB,yBAAyBhC,EAAAA,WAAW,UAAU,EAChD,kBAAkBA,EAAAA,WAAW,kBAAkB,EAEnD,IAAKF,GAAS,CAE1C,MAAAoC,EADiBpC,EAAK,yBAAyBE,EAAAA,WAAW,UAAU,EACpC,QAAQ,EAExCE,EAAsBJ,EAAK,aAAa,EACxC4F,EAAa7F,EAAuBK,CAAmB,EACvDyD,EAAQ8B,EAAsBC,CAAU,EAEvC,MAAA,CACN,WAAYxD,EACZ,MAAAyB,CACD,CAAA,CACA,GAEoB,CAAC"}
1
+ {"version":3,"file":"nodeParsers.cjs","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"sourcesContent":["import {\n\tNode,\n\tPropertyAccessExpression,\n\tPropertyAssignment,\n\tPropertySignature,\n\tShorthandPropertyAssignment,\n\tSyntaxKind,\n\tts,\n\tType,\n\tTypeReferenceNode,\n} from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { OpenApiManager } from '../manager/OpenApiManager'\nimport { ShapeOfProperty, ShapeOfType, ShapeOfUnionEntry } from './types'\n\nconst implementationCache = new WeakMap<Node, Node>()\n\nexport const findNodeImplementation = (node: Node): Node => {\n\tconst cached = implementationCache.get(node)\n\tif (cached) {\n\t\treturn cached\n\t}\n\n\tif (node.getKind() === SyntaxKind.Identifier) {\n\t\tconst implementationNode = node.asKind(SyntaxKind.Identifier)!.getImplementations()[0]?.getNode()\n\t\tif (implementationNode) {\n\t\t\tconst implementationParentNode = implementationNode.getParent()!\n\t\t\tconst assignmentValueNode = implementationParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\n\t\tconst definitionNode = node.asKind(SyntaxKind.Identifier)!.getDefinitions()[0]?.getNode()\n\t\tif (definitionNode) {\n\t\t\tconst definitionParentNode = definitionNode.getParent()!\n\t\t\tconst assignmentValueNode = definitionParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\t\tthrow new Error('No implementation nor definition available')\n\t}\n\n\timplementationCache.set(node, node)\n\treturn node\n}\n\nexport const findPropertyAssignmentValueNode = (\n\tnode:\n\t\t| PropertyAssignment\n\t\t| TypeReferenceNode\n\t\t| PropertySignature\n\t\t| PropertyAccessExpression\n\t\t| ShorthandPropertyAssignment,\n): Node => {\n\tconst identifierChildren = node.getChildrenOfKind(SyntaxKind.Identifier)\n\tif (identifierChildren.length === 2) {\n\t\treturn findNodeImplementation(identifierChildren[1])\n\t}\n\tconst lastMatchingChild = node.getChildren().reverse()\n\treturn lastMatchingChild.find(\n\t\t(child) =>\n\t\t\tchild.getKind() !== SyntaxKind.GreaterThanToken &&\n\t\t\tchild.getKind() !== SyntaxKind.CommaToken &&\n\t\t\tchild.getKind() !== SyntaxKind.SemicolonToken,\n\t)!\n}\n\nexport const getTypeReferenceShape = (node: TypeReferenceNode): ShapeOfType['shape'] => {\n\tconst firstChild = node.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tif (firstChild.isKind(SyntaxKind.SyntaxList)) {\n\t\treturn getRecursiveNodeShape(firstChild.getFirstChild()!)\n\t} else {\n\t\treturn getRecursiveNodeShape(firstChild)\n\t}\n}\n\nexport const getRecursiveNodeShape = (nodeOrReference: Node): ShapeOfType['shape'] => {\n\tconst typeName = nodeOrReference.getSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\t// Undefined\n\tconst undefinedNode = node.asKind(SyntaxKind.UndefinedKeyword)\n\tif (undefinedNode) {\n\t\treturn 'undefined'\n\t}\n\n\t// Literal type\n\tconst literalNode = node.asKind(SyntaxKind.LiteralType)\n\tif (literalNode) {\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.TrueKeyword)) {\n\t\t\treturn 'true'\n\t\t}\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.FalseKeyword)) {\n\t\t\treturn 'false'\n\t\t}\n\t}\n\n\t// Boolean literal\n\tconst booleanLiteralNode =\n\t\tnode.asKind(SyntaxKind.BooleanKeyword) ||\n\t\tnode.asKind(SyntaxKind.TrueKeyword) ||\n\t\tnode.asKind(SyntaxKind.FalseKeyword)\n\tif (booleanLiteralNode) {\n\t\treturn 'boolean'\n\t}\n\n\t// String literal\n\tconst stringLiteralNode = node.asKind(SyntaxKind.StringKeyword) || node.asKind(SyntaxKind.StringLiteral)\n\tif (stringLiteralNode) {\n\t\treturn 'string'\n\t}\n\n\t// Number literal\n\tconst numberLiteralNode = node.asKind(SyntaxKind.NumberKeyword) || node.asKind(SyntaxKind.NumericLiteral)\n\tif (numberLiteralNode) {\n\t\treturn 'number'\n\t}\n\n\t// BigInt literal\n\tconst bigIntNode = node.asKind(SyntaxKind.BigIntKeyword) || node.asKind(SyntaxKind.BigIntLiteral)\n\tif (bigIntNode) {\n\t\treturn 'bigint'\n\t}\n\n\t// Type literal\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\tconst properties = typeLiteralNode\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getChildrenOfKind(SyntaxKind.PropertySignature)\n\n\t\tconst propertyShapes = properties.map((propNode) => {\n\t\t\tconst identifier = propNode.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\t\tconst valueNode = findPropertyAssignmentValueNode(propNode)\n\t\t\tconst questionMarkToken = identifier.getNextSiblingIfKind(SyntaxKind.QuestionToken)\n\t\t\treturn {\n\t\t\t\trole: 'property' as const,\n\t\t\t\tidentifier: identifier.getText(),\n\t\t\t\tshape: getRecursiveNodeShape(valueNode),\n\t\t\t\toptional: valueNode.getType().isNullable() || !!questionMarkToken,\n\t\t\t}\n\t\t})\n\t\treturn propertyShapes\n\t}\n\n\t// Type reference\n\tconst typeReferenceNode = node.asKind(SyntaxKind.TypeReference)\n\tif (typeReferenceNode) {\n\t\treturn getRecursiveNodeShape(typeReferenceNode.getFirstChild()!)\n\t}\n\n\t// Property access expression\n\tconst propertyAccessNode = node.asKind(SyntaxKind.PropertyAccessExpression)\n\tif (propertyAccessNode) {\n\t\tconst lastChild = findNodeImplementation(node.getLastChild()!)\n\t\treturn getProperTypeShape(lastChild.asKind(SyntaxKind.CallExpression)!.getReturnType(), lastChild)\n\t}\n\n\t// Union type\n\tconst unionTypeNode = node.asKind(SyntaxKind.UnionType)\n\tif (unionTypeNode) {\n\t\treturn getProperTypeShape(unionTypeNode.getType(), node)\n\t}\n\n\t// Typeof query\n\tconst typeQueryNode = node.asKind(SyntaxKind.TypeQuery)\n\tif (typeQueryNode) {\n\t\treturn getRecursiveNodeShape(typeQueryNode.getLastChild()!)\n\t}\n\n\t// Qualified name\n\tconst qualifiedNameNode = node.asKind(SyntaxKind.QualifiedName)\n\tif (qualifiedNameNode) {\n\t\treturn getRecursiveNodeShape(qualifiedNameNode.getLastChild()!)\n\t}\n\n\t// Call expression\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\treturn getProperTypeShape(callExpressionNode.getReturnType(), callExpressionNode)\n\t}\n\n\t// Await expression\n\tconst awaitExpressionNode = node.asKind(SyntaxKind.AwaitExpression)\n\tif (awaitExpressionNode) {\n\t\treturn getRecursiveNodeShape(awaitExpressionNode.getChildAtIndex(1)!)\n\t}\n\n\t// 'As' Expression\n\tconst asExpressionNode = node.asKind(SyntaxKind.AsExpression)\n\tif (asExpressionNode) {\n\t\treturn getRecursiveNodeShape(asExpressionNode.getChildAtIndex(2)!)\n\t}\n\n\t// TODO\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown node type: ${node.getKindName()}`)\n\treturn 'unknown_1'\n}\n\nexport const getShapeOfValidatorLiteral = (\n\tobjectLiteralNode: Node<ts.ObjectLiteralExpression>,\n): (ShapeOfProperty & { description: string; errorMessage: string })[] => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstChild()!\n\t\tconst identifierName = (() => {\n\t\t\tif (identifierNode.isKind(SyntaxKind.Identifier)) {\n\t\t\t\treturn identifierNode.getText()\n\t\t\t}\n\t\t\tif (identifierNode.isKind(SyntaxKind.StringLiteral)) {\n\t\t\t\treturn identifierNode.getLiteralText()\n\t\t\t}\n\t\t\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\t\t\tLogger.warn(`[${fileName}] Unknown identifier name: ${identifierNode.getText()}`)\n\t\t\treturn 'unknown_30'\n\t\t})()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst innerLiteralNode = findNodeImplementation(assignmentValueNode)\n\n\t\treturn {\n\t\t\trole: 'property' as const,\n\t\t\tidentifier: identifierName,\n\t\t\tshape: getValidatorPropertyShape(innerLiteralNode),\n\t\t\toptional: getValidatorPropertyOptionality(innerLiteralNode),\n\t\t\tdescription: getValidatorPropertyStringValue(innerLiteralNode, 'description'),\n\t\t\terrorMessage: getValidatorPropertyStringValue(innerLiteralNode, 'errorMessage'),\n\t\t}\n\t})\n\n\treturn properties || []\n}\n\nexport const getValidatorPropertyShape = (innerLiteralNode: Node): ShapeOfType['shape'] => {\n\t// Inline definition with `as Validator<...>` clause\n\tconst inlineValidatorAsExpression = innerLiteralNode\n\t\t.getParent()!\n\t\t.getFirstChildByKind(SyntaxKind.AsExpression)\n\tif (inlineValidatorAsExpression) {\n\t\tconst typeReference = inlineValidatorAsExpression.getLastChildByKind(SyntaxKind.TypeReference)!\n\t\treturn getTypeReferenceShape(typeReference)\n\t}\n\n\t// Variable with `: Validator<...>` clause\n\tconst childTypeReferenceNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.TypeReference)\n\tif (childTypeReferenceNode) {\n\t\treturn getTypeReferenceShape(childTypeReferenceNode)\n\t}\n\n\t// `RequiredParam<...>` inline call expression\n\tif (innerLiteralNode.getParent()!.getChildrenOfKind(SyntaxKind.SyntaxList).length >= 2) {\n\t\tconst typeNode = innerLiteralNode\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getFirstChild()!\n\t\treturn getRecursiveNodeShape(typeNode)\n\t}\n\n\t// `RequestParam | RequiredParam | OptionalParam` call expression\n\tconst childCallExpressionNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.CallExpression)\n\tif (childCallExpressionNode) {\n\t\tconst callExpressionArgument = findNodeImplementation(\n\t\t\tchildCallExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!.getFirstChild()!,\n\t\t)\n\n\t\t// Param is a type reference\n\t\tconst typeReferenceNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.TypeReference)!\n\t\tif (typeReferenceNode) {\n\t\t\treturn getProperTypeShape(typeReferenceNode.getType(), typeReferenceNode, [])\n\t\t}\n\n\t\tconst thingyNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.ObjectLiteralExpression)!\n\t\tif (thingyNode) {\n\t\t\treturn getValidatorPropertyShape(thingyNode)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.CallExpression) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.IntersectionType) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\t\tLogger.warn(`[${fileName}] Unknown call expression argument: ${callExpressionArgument.getKindName()}`)\n\t\treturn 'unknown_3'\n\t}\n\n\t// Attempting to infer type from `parse` function\n\tconst innerNodePropertyAssignments = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t.getChildrenOfKind(SyntaxKind.PropertyAssignment)\n\tconst parsePropertyAssignment = innerNodePropertyAssignments.find((prop) => {\n\t\treturn prop.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === 'parse'\n\t})\n\tif (parsePropertyAssignment) {\n\t\tconst returnType = findPropertyAssignmentValueNode(parsePropertyAssignment)\n\t\t\t.asKind(SyntaxKind.ArrowFunction)!\n\t\t\t.getReturnType()\n\t\treturn getProperTypeShape(returnType, parsePropertyAssignment)\n\t}\n\n\t// Import statement\n\tconst importTypeNode = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)\n\t\t?.getFirstChildByKind(SyntaxKind.ImportType)\n\tif (importTypeNode) {\n\t\tconst indexOfGreaterThanToken = importTypeNode\n\t\t\t.getLastChildByKind(SyntaxKind.GreaterThanToken)!\n\t\t\t.getChildIndex()\n\t\tconst targetSyntaxList = importTypeNode.getChildAtIndex(indexOfGreaterThanToken - 1)\n\t\treturn getRecursiveNodeShape(targetSyntaxList.getFirstChild()!)\n\t}\n\n\t// Intersection type with Validator\n\tconst intersectionType = innerLiteralNode.isKind(SyntaxKind.IntersectionType)\n\t\t? innerLiteralNode\n\t\t: innerLiteralNode.getParent()?.isKind(SyntaxKind.VariableDeclaration)\n\t\t\t? innerLiteralNode.getParent()?.getFirstChildByKind(SyntaxKind.IntersectionType)\n\t\t\t: null\n\n\tif (intersectionType) {\n\t\tconst validatorType = intersectionType.getFirstChildByKind(SyntaxKind.TypeReference)\n\t\tif (validatorType) {\n\t\t\treturn getTypeReferenceShape(validatorType)\n\t\t}\n\t}\n\n\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown import type node`)\n\n\treturn 'unknown_2'\n}\n\nexport const getValidatorPropertyOptionality = (node: Node): boolean => {\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst identifierNode = callExpressionNode.getFirstChildByKind(SyntaxKind.Identifier)\n\t\tif (identifierNode?.getText() === 'OptionalParam') {\n\t\t\treturn true\n\t\t} else if (identifierNode?.getText() === 'RequiredParam') {\n\t\t\treturn false\n\t\t}\n\n\t\tconst syntaxListNode = callExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\tconst literalExpression = findNodeImplementation(syntaxListNode.getFirstChild()!)\n\t\treturn getValidatorPropertyOptionality(literalExpression)\n\t}\n\n\tconst syntaxListNode = node.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\treturn assignmentNodes.some((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tif (identifierName === 'optional') {\n\t\t\tconst value = findPropertyAssignmentValueNode(node)\n\t\t\treturn value.getKind() === SyntaxKind.TrueKeyword\n\t\t}\n\t\treturn false\n\t})\n}\n\nexport const getValidatorPropertyStringValue = (\n\tnodeOrReference: Node,\n\tname: 'description' | 'errorMessage',\n): string => {\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst targetChild = callExpressionNode.getLastChildByKind(SyntaxKind.SyntaxList)!\n\t\treturn getValidatorPropertyStringValue(targetChild, name)\n\t}\n\n\tconst syntaxListNode = node.asKind(SyntaxKind.SyntaxList)\n\tif (syntaxListNode) {\n\t\tconst children = syntaxListNode.getChildren().map((c) => getValidatorPropertyStringValue(c, name))\n\t\treturn children.find((value) => !!value && value !== 'unknown_25') || ''\n\t}\n\n\tconst objectLiteralNode = node.asKind(SyntaxKind.ObjectLiteralExpression)\n\tif (objectLiteralNode) {\n\t\tconst values = getValuesOfObjectLiteral(objectLiteralNode)\n\t\tconst targetValue = values.find((value) => value.identifier === name)\n\t\tif (!targetValue) {\n\t\t\treturn ''\n\t\t}\n\t\tif (Array.isArray(targetValue.value)) {\n\t\t\treturn 'array'\n\t\t}\n\t\treturn targetValue.value || ''\n\t}\n\n\tconst intersectionTypeNode = node.asKind(SyntaxKind.IntersectionType)\n\tif (intersectionTypeNode) {\n\t\treturn (\n\t\t\tintersectionTypeNode\n\t\t\t\t.getTypeNodes()\n\t\t\t\t.flatMap((t) => getValidatorPropertyStringValue(t, name))\n\t\t\t\t.filter((v) => !!v && v !== 'unknown_25')[0] || 'unknown_27'\n\t\t)\n\t}\n\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\treturn getValidatorPropertyStringValue(typeLiteralNode.getFirstChildByKind(SyntaxKind.SyntaxList)!, name)\n\t}\n\n\tconst propertySignatureNode = node.asKind(SyntaxKind.PropertySignature)\n\tif (propertySignatureNode) {\n\t\tconst identifier = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tif (identifier.getText() === name) {\n\t\t\tconst targetNode = findPropertyAssignmentValueNode(propertySignatureNode).getFirstDescendantByKind(\n\t\t\t\tSyntaxKind.StringLiteral,\n\t\t\t)!\n\t\t\treturn targetNode.getLiteralText()\n\t\t}\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown property string value node ${node.getKindName()}`)\n\treturn 'unknown_25'\n}\n\nconst isPromise = (type: Type) => {\n\tconst symbol = type.getSymbol()\n\tif (!type.isObject() || !symbol) {\n\t\treturn false\n\t}\n\tconst args = type.getTypeArguments()\n\treturn symbol.getName() === 'Promise' && args.length === 1\n}\n\nexport const getProperTypeShape = (\n\ttypeOrPromise: Type,\n\tatLocation: Node,\n\tstack: Type[] = [],\n): ShapeOfType['shape'] => {\n\tconst typeName = typeOrPromise.getAliasSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst type = isPromise(typeOrPromise) ? typeOrPromise.getTypeArguments()[0] : typeOrPromise\n\n\tif (stack.some((previousType) => previousType === type)) {\n\t\treturn 'circular'\n\t}\n\n\tconst nextStack = stack.concat(type)\n\n\tif (type.getText() === 'void') {\n\t\treturn 'void'\n\t}\n\n\tif (type.isAny()) {\n\t\treturn 'any'\n\t}\n\n\tif (type.isNull()) {\n\t\treturn 'null'\n\t}\n\n\tif (type.isUndefined()) {\n\t\treturn 'undefined'\n\t}\n\n\tif (type.isBoolean() || type.isBooleanLiteral()) {\n\t\treturn 'boolean'\n\t}\n\n\tif (type.isStringLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_string' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isNumberLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_number' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isString() || type.isTemplateLiteral()) {\n\t\treturn 'string'\n\t}\n\n\tif (type.isNumber()) {\n\t\treturn 'number'\n\t}\n\n\tif (type.getText() === 'bigint') {\n\t\treturn 'bigint'\n\t}\n\n\tif (type.isTuple()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'tuple' as const,\n\t\t\t\tshape: type.getTupleElements().map((t) => ({\n\t\t\t\t\trole: 'tuple_entry' as const,\n\t\t\t\t\tshape: getProperTypeShape(t, atLocation, nextStack),\n\t\t\t\t\toptional: false,\n\t\t\t\t})),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isArray()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'array' as const,\n\t\t\t\tshape: getProperTypeShape(type.getArrayElementType()!, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getText() === 'Buffer') {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'buffer' as const,\n\t\t\t\tshape: 'buffer',\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getProperties().length === 0) {\n\t\tconst targetType = type.getAliasTypeArguments()[1]\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'record' as const,\n\t\t\t\tshape: getProperTypeShape(targetType, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject()) {\n\t\tif (type.getText() === 'Date') {\n\t\t\treturn 'Date'\n\t\t}\n\t\treturn type\n\t\t\t.getProperties()\n\t\t\t.map((prop) => {\n\t\t\t\tconst valueDeclaration = prop.getValueDeclaration() || prop.getDeclarations()[0]!\n\t\t\t\tif (!valueDeclaration) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst valueDeclarationNode =\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertySignature) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertyAssignment) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.ShorthandPropertyAssignment)\n\n\t\t\t\tif (!valueDeclarationNode) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst isOptional = prop.getTypeAtLocation(atLocation).isNullable()\n\n\t\t\t\tconst shape = getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack)\n\t\t\t\treturn {\n\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\tshape: shape,\n\t\t\t\t\toptional: isOptional,\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((val) => val.shape !== 'undefined')\n\t}\n\n\tif (type.isUnion()) {\n\t\tconst unfilteredShapes: ShapeOfUnionEntry[] = type.getUnionTypes().map((type) => ({\n\t\t\trole: 'union_entry',\n\t\t\tshape: getProperTypeShape(type, atLocation, nextStack),\n\t\t\toptional: false,\n\t\t}))\n\n\t\tconst dedupedShapes = unfilteredShapes.filter(\n\t\t\t(type, index, arr) => !arr.find((dup, dupIndex) => dup.shape === type.shape && dupIndex > index),\n\t\t)\n\t\tconst isNullable = dedupedShapes.some((shape) => shape.shape === 'undefined')\n\t\tconst shapes = dedupedShapes.filter((shape) => shape.shape !== 'undefined')\n\t\tif (shapes.length === 1) {\n\t\t\treturn shapes[0].shape\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'union',\n\t\t\t\tshape: shapes,\n\t\t\t\toptional: isNullable,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isIntersection()) {\n\t\tconst children = type.getIntersectionTypes()\n\t\tconst shapesOfChildren = children\n\t\t\t.map((child) => getProperTypeShape(child, atLocation, nextStack))\n\t\t\t.filter((shape) => typeof shape !== 'string') as ShapeOfProperty[][]\n\t\treturn shapesOfChildren.reduce<ShapeOfType[]>((total, current) => [...total, ...current], [])\n\t}\n\n\tconst fileName = atLocation.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown type shape node ${typeOrPromise.getText()}`)\n\treturn 'unknown_5'\n}\n\nconst getLiteralValueOfNode = (node: Node): string | string[] | unknown[] => {\n\tif (node.isKind(SyntaxKind.Identifier)) {\n\t\treturn getLiteralValueOfNode(findNodeImplementation(node))\n\t} else if (node.isKind(SyntaxKind.StringLiteral)) {\n\t\treturn node.getLiteralValue()\n\t} else if (node.isKind(SyntaxKind.ArrayLiteralExpression)) {\n\t\treturn node.forEachChildAsArray().map((child) => getLiteralValueOfNode(child)) as string[]\n\t} else if (node.isKind(SyntaxKind.PropertyAccessExpression)) {\n\t\treturn getLiteralValueOfNode(findPropertyAssignmentValueNode(node))\n\t} else if (node.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\treturn getValuesOfObjectLiteral(node)\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown literal value node ${node.getKindName()}`)\n\n\treturn 'unknown_6'\n}\n\nexport const getValuesOfObjectLiteral = (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst targetNode = findNodeImplementation(assignmentValueNode)\n\t\tconst value = getLiteralValueOfNode(targetNode)\n\n\t\treturn {\n\t\t\tidentifier: identifierName,\n\t\t\tvalue,\n\t\t}\n\t})\n\n\treturn properties || []\n}\n"],"names":["implementationCache","findNodeImplementation","node","cached","SyntaxKind","implementationNode","assignmentValueNode","result","definitionNode","findPropertyAssignmentValueNode","identifierChildren","child","getTypeReferenceShape","firstChild","getRecursiveNodeShape","nodeOrReference","typeName","OpenApiManager","literalNode","typeLiteralNode","propNode","identifier","valueNode","questionMarkToken","typeReferenceNode","lastChild","getProperTypeShape","unionTypeNode","typeQueryNode","qualifiedNameNode","callExpressionNode","awaitExpressionNode","asExpressionNode","fileName","Logger","getShapeOfValidatorLiteral","objectLiteralNode","identifierNode","identifierName","innerLiteralNode","getValidatorPropertyShape","getValidatorPropertyOptionality","getValidatorPropertyStringValue","inlineValidatorAsExpression","typeReference","childTypeReferenceNode","typeNode","childCallExpressionNode","callExpressionArgument","thingyNode","parsePropertyAssignment","prop","returnType","importTypeNode","indexOfGreaterThanToken","targetSyntaxList","intersectionType","validatorType","syntaxListNode","literalExpression","name","targetChild","c","value","targetValue","getValuesOfObjectLiteral","intersectionTypeNode","t","v","propertySignatureNode","isPromise","type","symbol","args","typeOrPromise","atLocation","stack","previousType","nextStack","targetType","valueDeclaration","isOptional","shape","val","dedupedShapes","index","arr","dup","dupIndex","isNullable","shapes","total","current","getLiteralValueOfNode","targetNode"],"mappings":"2LAgBMA,MAA0B,QAEnBC,EAA0BC,GAAqB,CACrD,MAAAC,EAASH,EAAoB,IAAIE,CAAI,EAC3C,GAAIC,EACI,OAAAA,EAGR,GAAID,EAAK,YAAcE,EAAAA,WAAW,WAAY,CACvC,MAAAC,EAAqBH,EAAK,OAAOE,EAAW,WAAA,UAAU,EAAG,mBAAmB,EAAE,CAAC,GAAG,QAAQ,EAChG,GAAIC,EAAoB,CAEjB,MAAAC,EAD2BD,EAAmB,UAAU,EACT,aAAa,EAClE,G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D,OAAAF,EAAK,sBAAsB,IAAKS,GAAUkF,EAAsBlF,CAAK,CAAC,EACnE,GAAAT,EAAK,OAAOE,EAAA,WAAW,wBAAwB,EAClD,OAAAyF,EAAsBpF,EAAgCP,CAAI,CAAC,EACxD,GAAAA,EAAK,OAAOE,EAAA,WAAW,uBAAuB,EACxD,OAAO6D,EAAyB/D,CAAI,EAG/B,MAAA+B,EAAW/B,EAAK,cAAc,EAAE,cAAc,MAAM,GAAG,EAAE,IAAI,EACnEgC,OAAAA,SAAO,IAAI,IAAID,CAAQ,gCAAgC/B,EAAK,YAAa,CAAA,EAAE,EAEpE,WACR,EAEa+D,EAA4B7B,GACjBA,EAAkB,yBAAyBhC,EAAAA,WAAW,UAAU,EAChD,kBAAkBA,EAAAA,WAAW,kBAAkB,EAEnD,IAAKF,GAAS,CAE1C,MAAAoC,EADiBpC,EAAK,yBAAyBE,EAAAA,WAAW,UAAU,EACpC,QAAQ,EAExCE,EAAsBJ,EAAK,aAAa,EACxC4F,EAAa7F,EAAuBK,CAAmB,EACvDyD,EAAQ8B,EAAsBC,CAAU,EAEvC,MAAA,CACN,WAAYxD,EACZ,MAAAyB,CACD,CAAA,CACA,GAEoB,CAAC"}
@@ -15,6 +15,6 @@ export declare const getValidatorPropertyStringValue: (nodeOrReference: Node, na
15
15
  export declare const getProperTypeShape: (typeOrPromise: Type, atLocation: Node, stack?: Type[]) => ShapeOfType["shape"];
16
16
  export declare const getValuesOfObjectLiteral: (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {
17
17
  identifier: string;
18
- value: string | unknown[] | string[];
18
+ value: string | string[] | unknown[];
19
19
  }[];
20
20
  //# sourceMappingURL=nodeParsers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParsers.d.ts","sourceRoot":"","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,IAAI,EACJ,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA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AE3B,EAAE,EACF,IAAI,EACJ,iBAAiB,EACjB,MAAM,UAAU,CAAA;AAIjB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAA;AAIzE,eAAO,MAAM,sBAAsB,SAAU,IAAI,KAAG,IAmCnD,CAAA;AAED,eAAO,MAAM,+BAA+B,SAExC,kBAAkB,GAClB,iBAAiB,GACjB,iBAAiB,GACjB,wBAAwB,GACxB,2BAA2B,KAC5B,IAYF,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,iBAAiB,KAAG,WAAW,CAAC,OAAO,CAOlF,CAAA;AAED,eAAO,MAAM,qBAAqB,oBAAqB,IAAI,KAAG,WAAW,CAAC,OAAO,CAoIhF,CAAA;AAED,eAAO,MAAM,0BAA0B,sBACnB,IAAI,CAAC,EAAE,CAAC,uBAAuB,CAAC,KACjD,CAAC,eAAe,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAgCnE,CAAA;AAED,eAAO,MAAM,yBAAyB,qBAAsB,IAAI,KAAG,WAAW,CAAC,OAAO,CAwGrF,CAAA;AAED,eAAO,MAAM,+BAA+B,SAAU,IAAI,KAAG,OA4B5D,CAAA;AAED,eAAO,MAAM,+BAA+B,oBAC1B,IAAI,QACf,aAAa,GAAG,cAAc,KAClC,MAyDF,CAAA;AAWD,eAAO,MAAM,kBAAkB,kBACf,IAAI,cACP,IAAI,UACT,IAAI,EAAE,KACX,WAAW,CAAC,OAAO,CAmMrB,CAAA;AAqBD,eAAO,MAAM,wBAAwB,sBAAuB,IAAI,CAAC,EAAE,CAAC,uBAAuB,CAAC;;;GAmB3F,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParsers.mjs","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"sourcesContent":["import {\n\tNode,\n\tPropertyAccessExpression,\n\tPropertyAssignment,\n\tPropertySignature,\n\tShorthandPropertyAssignment,\n\tSyntaxKind,\n\tts,\n\tType,\n\tTypeReferenceNode,\n} from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { debugNode } from '../../utils/printers'\nimport { OpenApiManager } from '../manager/OpenApiManager'\nimport { ShapeOfProperty, ShapeOfType, ShapeOfUnionEntry } from './types'\n\nconst implementationCache = new WeakMap<Node, Node>()\n\nexport const findNodeImplementation = (node: Node): Node => {\n\tconst cached = implementationCache.get(node)\n\tif (cached) {\n\t\treturn cached\n\t}\n\n\tif (node.getKind() === SyntaxKind.Identifier) {\n\t\tconst implementationNode = node.asKind(SyntaxKind.Identifier)!.getImplementations()[0]?.getNode()\n\t\tif (implementationNode) {\n\t\t\tconst implementationParentNode = implementationNode.getParent()!\n\t\t\tconst assignmentValueNode = implementationParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\n\t\tconst definitionNode = node.asKind(SyntaxKind.Identifier)!.getDefinitions()[0]?.getNode()\n\t\tif (definitionNode) {\n\t\t\tconst definitionParentNode = definitionNode.getParent()!\n\t\t\tconst assignmentValueNode = definitionParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\t\tthrow new Error('No implementation nor definition available')\n\t}\n\n\timplementationCache.set(node, node)\n\treturn node\n}\n\nexport const findPropertyAssignmentValueNode = (\n\tnode:\n\t\t| PropertyAssignment\n\t\t| TypeReferenceNode\n\t\t| PropertySignature\n\t\t| PropertyAccessExpression\n\t\t| ShorthandPropertyAssignment,\n): Node => {\n\tconst identifierChildren = node.getChildrenOfKind(SyntaxKind.Identifier)\n\tif (identifierChildren.length === 2) {\n\t\treturn findNodeImplementation(identifierChildren[1])\n\t}\n\tconst lastMatchingChild = node.getChildren().reverse()\n\treturn lastMatchingChild.find(\n\t\t(child) =>\n\t\t\tchild.getKind() !== SyntaxKind.GreaterThanToken &&\n\t\t\tchild.getKind() !== SyntaxKind.CommaToken &&\n\t\t\tchild.getKind() !== SyntaxKind.SemicolonToken,\n\t)!\n}\n\nexport const getTypeReferenceShape = (node: TypeReferenceNode): ShapeOfType['shape'] => {\n\tconst firstChild = node.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tif (firstChild.isKind(SyntaxKind.SyntaxList)) {\n\t\treturn getRecursiveNodeShape(firstChild.getFirstChild()!)\n\t} else {\n\t\treturn getRecursiveNodeShape(firstChild)\n\t}\n}\n\nexport const getRecursiveNodeShape = (nodeOrReference: Node): ShapeOfType['shape'] => {\n\tconst typeName = nodeOrReference.getSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\t// Undefined\n\tconst undefinedNode = node.asKind(SyntaxKind.UndefinedKeyword)\n\tif (undefinedNode) {\n\t\treturn 'undefined'\n\t}\n\n\t// Literal type\n\tconst literalNode = node.asKind(SyntaxKind.LiteralType)\n\tif (literalNode) {\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.TrueKeyword)) {\n\t\t\treturn 'true'\n\t\t}\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.FalseKeyword)) {\n\t\t\treturn 'false'\n\t\t}\n\t}\n\n\t// Boolean literal\n\tconst booleanLiteralNode =\n\t\tnode.asKind(SyntaxKind.BooleanKeyword) ||\n\t\tnode.asKind(SyntaxKind.TrueKeyword) ||\n\t\tnode.asKind(SyntaxKind.FalseKeyword)\n\tif (booleanLiteralNode) {\n\t\treturn 'boolean'\n\t}\n\n\t// String literal\n\tconst stringLiteralNode = node.asKind(SyntaxKind.StringKeyword) || node.asKind(SyntaxKind.StringLiteral)\n\tif (stringLiteralNode) {\n\t\treturn 'string'\n\t}\n\n\t// Number literal\n\tconst numberLiteralNode = node.asKind(SyntaxKind.NumberKeyword) || node.asKind(SyntaxKind.NumericLiteral)\n\tif (numberLiteralNode) {\n\t\treturn 'number'\n\t}\n\n\t// BigInt literal\n\tconst bigIntNode = node.asKind(SyntaxKind.BigIntKeyword) || node.asKind(SyntaxKind.BigIntLiteral)\n\tif (bigIntNode) {\n\t\treturn 'bigint'\n\t}\n\n\t// Type literal\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\tconst properties = typeLiteralNode\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getChildrenOfKind(SyntaxKind.PropertySignature)\n\n\t\tconst propertyShapes = properties.map((propNode) => {\n\t\t\tconst identifier = propNode.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\t\tconst valueNode = findPropertyAssignmentValueNode(propNode)\n\t\t\tconst questionMarkToken = identifier.getNextSiblingIfKind(SyntaxKind.QuestionToken)\n\t\t\treturn {\n\t\t\t\trole: 'property' as const,\n\t\t\t\tidentifier: identifier.getText(),\n\t\t\t\tshape: getRecursiveNodeShape(valueNode),\n\t\t\t\toptional: valueNode.getType().isNullable() || !!questionMarkToken,\n\t\t\t}\n\t\t})\n\t\treturn propertyShapes\n\t}\n\n\t// Type reference\n\tconst typeReferenceNode = node.asKind(SyntaxKind.TypeReference)\n\tif (typeReferenceNode) {\n\t\treturn getRecursiveNodeShape(typeReferenceNode.getFirstChild()!)\n\t}\n\n\t// Property access expression\n\tconst propertyAccessNode = node.asKind(SyntaxKind.PropertyAccessExpression)\n\tif (propertyAccessNode) {\n\t\tconst lastChild = findNodeImplementation(node.getLastChild()!)\n\t\treturn getProperTypeShape(lastChild.asKind(SyntaxKind.CallExpression)!.getReturnType(), lastChild)\n\t}\n\n\t// Union type\n\tconst unionTypeNode = node.asKind(SyntaxKind.UnionType)\n\tif (unionTypeNode) {\n\t\treturn getProperTypeShape(unionTypeNode.getType(), node)\n\t}\n\n\t// Typeof query\n\tconst typeQueryNode = node.asKind(SyntaxKind.TypeQuery)\n\tif (typeQueryNode) {\n\t\treturn getRecursiveNodeShape(typeQueryNode.getLastChild()!)\n\t}\n\n\t// Qualified name\n\tconst qualifiedNameNode = node.asKind(SyntaxKind.QualifiedName)\n\tif (qualifiedNameNode) {\n\t\treturn getRecursiveNodeShape(qualifiedNameNode.getLastChild()!)\n\t}\n\n\t// Call expression\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\treturn getProperTypeShape(callExpressionNode.getReturnType(), callExpressionNode)\n\t}\n\n\t// Await expression\n\tconst awaitExpressionNode = node.asKind(SyntaxKind.AwaitExpression)\n\tif (awaitExpressionNode) {\n\t\treturn getRecursiveNodeShape(awaitExpressionNode.getChildAtIndex(1)!)\n\t}\n\n\t// 'As' Expression\n\tconst asExpressionNode = node.asKind(SyntaxKind.AsExpression)\n\tif (asExpressionNode) {\n\t\treturn getRecursiveNodeShape(asExpressionNode.getChildAtIndex(2)!)\n\t}\n\n\t// TODO\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown node type: ${node.getKindName()}`)\n\treturn 'unknown_1'\n}\n\nexport const getShapeOfValidatorLiteral = (\n\tobjectLiteralNode: Node<ts.ObjectLiteralExpression>,\n): (ShapeOfProperty & { description: string; errorMessage: string })[] => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstChild()!\n\t\tconst identifierName = (() => {\n\t\t\tif (identifierNode.isKind(SyntaxKind.Identifier)) {\n\t\t\t\treturn identifierNode.getText()\n\t\t\t}\n\t\t\tif (identifierNode.isKind(SyntaxKind.StringLiteral)) {\n\t\t\t\treturn identifierNode.getLiteralText()\n\t\t\t}\n\t\t\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\t\t\tLogger.warn(`[${fileName}] Unknown identifier name: ${identifierNode.getText()}`)\n\t\t\treturn 'unknown_30'\n\t\t})()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst innerLiteralNode = findNodeImplementation(assignmentValueNode)\n\n\t\treturn {\n\t\t\trole: 'property' as const,\n\t\t\tidentifier: identifierName,\n\t\t\tshape: getValidatorPropertyShape(innerLiteralNode),\n\t\t\toptional: getValidatorPropertyOptionality(innerLiteralNode),\n\t\t\tdescription: getValidatorPropertyStringValue(innerLiteralNode, 'description'),\n\t\t\terrorMessage: getValidatorPropertyStringValue(innerLiteralNode, 'errorMessage'),\n\t\t}\n\t})\n\n\treturn properties || []\n}\n\nexport const getValidatorPropertyShape = (innerLiteralNode: Node): ShapeOfType['shape'] => {\n\t// Inline definition with `as Validator<...>` clause\n\tconst inlineValidatorAsExpression = innerLiteralNode\n\t\t.getParent()!\n\t\t.getFirstChildByKind(SyntaxKind.AsExpression)\n\tif (inlineValidatorAsExpression) {\n\t\tconst typeReference = inlineValidatorAsExpression.getLastChildByKind(SyntaxKind.TypeReference)!\n\t\treturn getTypeReferenceShape(typeReference)\n\t}\n\n\t// Variable with `: Validator<...>` clause\n\tconst childTypeReferenceNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.TypeReference)\n\tif (childTypeReferenceNode) {\n\t\treturn getTypeReferenceShape(childTypeReferenceNode)\n\t}\n\n\t// `RequiredParam<...>` inline call expression\n\tif (innerLiteralNode.getParent()!.getChildrenOfKind(SyntaxKind.SyntaxList).length >= 2) {\n\t\tconst typeNode = innerLiteralNode\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getFirstChild()!\n\t\treturn getRecursiveNodeShape(typeNode)\n\t}\n\n\t// `RequestParam | RequiredParam | OptionalParam` call expression\n\tconst childCallExpressionNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.CallExpression)\n\tif (childCallExpressionNode) {\n\t\tconst callExpressionArgument = findNodeImplementation(\n\t\t\tchildCallExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!.getFirstChild()!,\n\t\t)\n\n\t\t// Param is a type reference\n\t\tconst typeReferenceNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.TypeReference)!\n\t\tif (typeReferenceNode) {\n\t\t\treturn getProperTypeShape(typeReferenceNode.getType(), typeReferenceNode, [])\n\t\t}\n\n\t\tconst thingyNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.ObjectLiteralExpression)!\n\t\tif (thingyNode) {\n\t\t\treturn getValidatorPropertyShape(thingyNode)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.CallExpression) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.IntersectionType) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\t\tLogger.warn(`[${fileName}] Unknown call expression argument: ${callExpressionArgument.getKindName()}`)\n\t\treturn 'unknown_3'\n\t}\n\n\t// Attempting to infer type from `parse` function\n\tconst innerNodePropertyAssignments = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t.getChildrenOfKind(SyntaxKind.PropertyAssignment)\n\tconst parsePropertyAssignment = innerNodePropertyAssignments.find((prop) => {\n\t\treturn prop.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === 'parse'\n\t})\n\tif (parsePropertyAssignment) {\n\t\tconst returnType = findPropertyAssignmentValueNode(parsePropertyAssignment)\n\t\t\t.asKind(SyntaxKind.ArrowFunction)!\n\t\t\t.getReturnType()\n\t\treturn getProperTypeShape(returnType, parsePropertyAssignment)\n\t}\n\n\t// Import statement\n\tconst importTypeNode = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)\n\t\t?.getFirstChildByKind(SyntaxKind.ImportType)\n\tif (importTypeNode) {\n\t\tconst indexOfGreaterThanToken = importTypeNode\n\t\t\t.getLastChildByKind(SyntaxKind.GreaterThanToken)!\n\t\t\t.getChildIndex()\n\t\tconst targetSyntaxList = importTypeNode.getChildAtIndex(indexOfGreaterThanToken - 1)\n\t\treturn getRecursiveNodeShape(targetSyntaxList.getFirstChild()!)\n\t}\n\n\t// Intersection type with Validator\n\tconst intersectionType = innerLiteralNode.isKind(SyntaxKind.IntersectionType)\n\t\t? innerLiteralNode\n\t\t: innerLiteralNode.getParent()?.isKind(SyntaxKind.VariableDeclaration)\n\t\t\t? innerLiteralNode.getParent()?.getFirstChildByKind(SyntaxKind.IntersectionType)\n\t\t\t: null\n\n\tif (intersectionType) {\n\t\tconst validatorType = intersectionType.getFirstChildByKind(SyntaxKind.TypeReference)\n\t\tif (validatorType) {\n\t\t\treturn getTypeReferenceShape(validatorType)\n\t\t}\n\t}\n\n\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown import type node`)\n\n\treturn 'unknown_2'\n}\n\nexport const getValidatorPropertyOptionality = (node: Node): boolean => {\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst identifierNode = callExpressionNode.getFirstChildByKind(SyntaxKind.Identifier)\n\t\tif (identifierNode?.getText() === 'OptionalParam') {\n\t\t\treturn true\n\t\t} else if (identifierNode?.getText() === 'RequiredParam') {\n\t\t\treturn false\n\t\t}\n\n\t\tconst syntaxListNode = callExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\tconst literalExpression = findNodeImplementation(syntaxListNode.getFirstChild()!)\n\t\treturn getValidatorPropertyOptionality(literalExpression)\n\t}\n\n\tconst syntaxListNode = node.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\treturn assignmentNodes.some((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tif (identifierName === 'optional') {\n\t\t\tconst value = findPropertyAssignmentValueNode(node)\n\t\t\treturn value.getKind() === SyntaxKind.TrueKeyword\n\t\t}\n\t\treturn false\n\t})\n}\n\nexport const getValidatorPropertyStringValue = (\n\tnodeOrReference: Node,\n\tname: 'description' | 'errorMessage',\n): string => {\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst targetChild = callExpressionNode.getLastChildByKind(SyntaxKind.SyntaxList)!\n\t\treturn getValidatorPropertyStringValue(targetChild, name)\n\t}\n\n\tconst syntaxListNode = node.asKind(SyntaxKind.SyntaxList)\n\tif (syntaxListNode) {\n\t\tconst children = syntaxListNode.getChildren().map((c) => getValidatorPropertyStringValue(c, name))\n\t\treturn children.find((value) => !!value && value !== 'unknown_25') || ''\n\t}\n\n\tconst objectLiteralNode = node.asKind(SyntaxKind.ObjectLiteralExpression)\n\tif (objectLiteralNode) {\n\t\tconst values = getValuesOfObjectLiteral(objectLiteralNode)\n\t\tconst targetValue = values.find((value) => value.identifier === name)\n\t\tif (!targetValue) {\n\t\t\treturn ''\n\t\t}\n\t\tif (Array.isArray(targetValue.value)) {\n\t\t\treturn 'array'\n\t\t}\n\t\treturn targetValue.value || ''\n\t}\n\n\tconst intersectionTypeNode = node.asKind(SyntaxKind.IntersectionType)\n\tif (intersectionTypeNode) {\n\t\treturn (\n\t\t\tintersectionTypeNode\n\t\t\t\t.getTypeNodes()\n\t\t\t\t.flatMap((t) => getValidatorPropertyStringValue(t, name))\n\t\t\t\t.filter((v) => !!v && v !== 'unknown_25')[0] || 'unknown_27'\n\t\t)\n\t}\n\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\treturn getValidatorPropertyStringValue(typeLiteralNode.getFirstChildByKind(SyntaxKind.SyntaxList)!, name)\n\t}\n\n\tconst propertySignatureNode = node.asKind(SyntaxKind.PropertySignature)\n\tif (propertySignatureNode) {\n\t\tconst identifier = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tif (identifier.getText() === name) {\n\t\t\tconst targetNode = findPropertyAssignmentValueNode(propertySignatureNode).getFirstDescendantByKind(\n\t\t\t\tSyntaxKind.StringLiteral,\n\t\t\t)!\n\t\t\treturn targetNode.getLiteralText()\n\t\t}\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown property string value node ${node.getKindName()}`)\n\treturn 'unknown_25'\n}\n\nconst isPromise = (type: Type) => {\n\tconst symbol = type.getSymbol()\n\tif (!type.isObject() || !symbol) {\n\t\treturn false\n\t}\n\tconst args = type.getTypeArguments()\n\treturn symbol.getName() === 'Promise' && args.length === 1\n}\n\nexport const getProperTypeShape = (\n\ttypeOrPromise: Type,\n\tatLocation: Node,\n\tstack: Type[] = [],\n): ShapeOfType['shape'] => {\n\tconst typeName = typeOrPromise.getAliasSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst type = isPromise(typeOrPromise) ? typeOrPromise.getTypeArguments()[0] : typeOrPromise\n\n\tif (stack.some((previousType) => previousType === type)) {\n\t\treturn 'circular'\n\t}\n\n\tconst nextStack = stack.concat(type)\n\n\tif (type.getText() === 'void') {\n\t\treturn 'void'\n\t}\n\n\tif (type.isAny()) {\n\t\treturn 'any'\n\t}\n\n\tif (type.isNull()) {\n\t\treturn 'null'\n\t}\n\n\tif (type.isUndefined()) {\n\t\treturn 'undefined'\n\t}\n\n\tif (type.isBoolean() || type.isBooleanLiteral()) {\n\t\treturn 'boolean'\n\t}\n\n\tif (type.isStringLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_string' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isNumberLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_number' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isString() || type.isTemplateLiteral()) {\n\t\treturn 'string'\n\t}\n\n\tif (type.isNumber()) {\n\t\treturn 'number'\n\t}\n\n\tif (type.getText() === 'bigint') {\n\t\treturn 'bigint'\n\t}\n\n\tif (type.isTuple()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'tuple' as const,\n\t\t\t\tshape: type.getTupleElements().map((t) => ({\n\t\t\t\t\trole: 'tuple_entry' as const,\n\t\t\t\t\tshape: getProperTypeShape(t, atLocation, nextStack),\n\t\t\t\t\toptional: false,\n\t\t\t\t})),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isArray()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'array' as const,\n\t\t\t\tshape: getProperTypeShape(type.getArrayElementType()!, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getText() === 'Buffer') {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'buffer' as const,\n\t\t\t\tshape: 'buffer',\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getProperties().length === 0) {\n\t\tconst targetType = type.getAliasTypeArguments()[1]\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'record' as const,\n\t\t\t\tshape: getProperTypeShape(targetType, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject()) {\n\t\tif (type.getText() === 'Date') {\n\t\t\treturn 'Date'\n\t\t}\n\t\treturn type\n\t\t\t.getProperties()\n\t\t\t.map((prop) => {\n\t\t\t\tconst valueDeclaration = prop.getValueDeclaration() || prop.getDeclarations()[0]!\n\t\t\t\tif (!valueDeclaration) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst valueDeclarationNode =\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertySignature) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertyAssignment) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.ShorthandPropertyAssignment)\n\n\t\t\t\tif (!valueDeclarationNode) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst isOptional = prop.getTypeAtLocation(atLocation).isNullable()\n\n\t\t\t\tconst shape = getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack)\n\t\t\t\treturn {\n\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\tshape: shape,\n\t\t\t\t\toptional: isOptional,\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((val) => val.shape !== 'undefined')\n\t}\n\n\tif (type.isUnion()) {\n\t\tconst unfilteredShapes: ShapeOfUnionEntry[] = type.getUnionTypes().map((type) => ({\n\t\t\trole: 'union_entry',\n\t\t\tshape: getProperTypeShape(type, atLocation, nextStack),\n\t\t\toptional: false,\n\t\t}))\n\n\t\tconst dedupedShapes = unfilteredShapes.filter(\n\t\t\t(type, index, arr) => !arr.find((dup, dupIndex) => dup.shape === type.shape && dupIndex > index),\n\t\t)\n\t\tconst isNullable = dedupedShapes.some((shape) => shape.shape === 'undefined')\n\t\tconst shapes = dedupedShapes.filter((shape) => shape.shape !== 'undefined')\n\t\tif (shapes.length === 1) {\n\t\t\treturn shapes[0].shape\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'union',\n\t\t\t\tshape: shapes,\n\t\t\t\toptional: isNullable,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isIntersection()) {\n\t\tconst children = type.getIntersectionTypes()\n\t\tconst shapesOfChildren = children\n\t\t\t.map((child) => getProperTypeShape(child, atLocation, nextStack))\n\t\t\t.filter((shape) => typeof shape !== 'string') as ShapeOfProperty[][]\n\t\treturn shapesOfChildren.reduce<ShapeOfType[]>((total, current) => [...total, ...current], [])\n\t}\n\n\tconst fileName = atLocation.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown type shape node ${typeOrPromise.getText()}`)\n\treturn 'unknown_5'\n}\n\nconst getLiteralValueOfNode = (node: Node): string | string[] | unknown[] => {\n\tif (node.isKind(SyntaxKind.Identifier)) {\n\t\treturn getLiteralValueOfNode(findNodeImplementation(node))\n\t} else if (node.isKind(SyntaxKind.StringLiteral)) {\n\t\treturn node.getLiteralValue()\n\t} else if (node.isKind(SyntaxKind.ArrayLiteralExpression)) {\n\t\treturn node.forEachChildAsArray().map((child) => getLiteralValueOfNode(child)) as string[]\n\t} else if (node.isKind(SyntaxKind.PropertyAccessExpression)) {\n\t\treturn getLiteralValueOfNode(findPropertyAssignmentValueNode(node))\n\t} else if (node.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\treturn getValuesOfObjectLiteral(node)\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown literal value node ${node.getKindName()}`)\n\n\treturn 'unknown_6'\n}\n\nexport const getValuesOfObjectLiteral = (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst targetNode = findNodeImplementation(assignmentValueNode)\n\t\tconst value = getLiteralValueOfNode(targetNode)\n\n\t\treturn {\n\t\t\tidentifier: identifierName,\n\t\t\tvalue,\n\t\t}\n\t})\n\n\treturn properties || []\n}\n"],"names":["implementationCache","findNodeImplementation","node","cached","SyntaxKind","implementationNode","assignmentValueNode","result","definitionNode","findPropertyAssignmentValueNode","identifierChildren","child","getTypeReferenceShape","firstChild","getRecursiveNodeShape","nodeOrReference","typeName","OpenApiManager","literalNode","typeLiteralNode","propNode","identifier","valueNode","questionMarkToken","typeReferenceNode","lastChild","getProperTypeShape","unionTypeNode","typeQueryNode","qualifiedNameNode","callExpressionNode","awaitExpressionNode","asExpressionNode","fileName","Logger","getShapeOfValidatorLiteral","objectLiteralNode","identifierNode","identifierName","innerLiteralNode","getValidatorPropertyShape","getValidatorPropertyOptionality","getValidatorPropertyStringValue","inlineValidatorAsExpression","typeReference","childTypeReferenceNode","typeNode","childCallExpressionNode","callExpressionArgument","thingyNode","parsePropertyAssignment","prop","returnType","importTypeNode","indexOfGreaterThanToken","targetSyntaxList","intersectionType","validatorType","syntaxListNode","literalExpression","name","targetChild","c","value","targetValue","getValuesOfObjectLiteral","intersectionTypeNode","t","v","propertySignatureNode","isPromise","type","symbol","args","typeOrPromise","atLocation","stack","previousType","nextStack","targetType","valueDeclaration","isOptional","shape","val","dedupedShapes","index","arr","dup","dupIndex","isNullable","shapes","total","current","getLiteralValueOfNode","targetNode"],"mappings":";;;AAiBA,MAAMA,wBAA0B,QAAoB,GAEvCC,IAAyB,CAACC,MAAqB;AACrD,QAAAC,IAASH,EAAoB,IAAIE,CAAI;AAC3C,MAAIC;AACI,WAAAA;AAGR,MAAID,EAAK,cAAcE,EAAW,YAAY;AACvC,UAAAC,IAAqBH,EAAK,OAAOE,EAAW,UAAU,EAAG,mBAAmB,EAAE,CAAC,GAAG,QAAQ;AAChG,QAAIC,GAAoB;AAEjB,YAAAC,IAD2BD,EAAmB,UAAU,EACT,aAAa;AAClE,UAAIC,MAAwBJ;AACrB,cAAA,IAAI,MAAM,gCAAgC;AAE3C,YAAAK,IAASN,EAAuBK,CAAmB;AACrC,aAAAN,EAAA,IAAIE,GAAMK,CAAM,GAC7BA;AAAA,IAAA;AAGF,UAAAC,IAAiBN,EAAK,OAAOE,EAAW,UAAU,EAAG,eAAe,EAAE,CAAC,GAAG,QAAQ;AACxF,QAAII,GAAgB;AAEb,YAAAF,IADuBE,EAAe,UAAU,EACL,aAAa;AAC9D,UAAIF,MAAwBJ;AACrB,cAAA,IAAI,MAAM,gCAAgC;AAE3C,YAAAK,IAASN,EAAuBK,CAAmB;AACrC,aAAAN,EAAA,IAAIE,GAAMK,CAAM,GAC7BA;AAAA,IAAA;AAEF,UAAA,IAAI,MAAM,4CAA4C;AAAA,EAAA;AAGzC,SAAAP,EAAA,IAAIE,GAAMA,CAAI,GAC3BA;AACR,GAEaO,IAAkC,CAC9CP,MAMU;AACV,QAAMQ,IAAqBR,EAAK,kBAAkBE,EAAW,UAAU;AACnE,SAAAM,EAAmB,WAAW,IAC1BT,EAAuBS,EAA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B,EAAK,YAAa,CAAA,EAAE,GAEpE;AACR,GAEa+D,IAA2B,CAAC7B,MACjBA,EAAkB,yBAAyBhC,EAAW,UAAU,EAChD,kBAAkBA,EAAW,kBAAkB,EAEnD,IAAI,CAACF,MAAS;AAE1C,QAAAoC,IADiBpC,EAAK,yBAAyBE,EAAW,UAAU,EACpC,QAAQ,GAExCE,IAAsBJ,EAAK,aAAa,GACxC4F,IAAa7F,EAAuBK,CAAmB,GACvDyD,IAAQ8B,EAAsBC,CAAU;AAEvC,SAAA;AAAA,IACN,YAAYxD;AAAA,IACZ,OAAAyB;AAAA,EACD;AAAA,CACA,KAEoB,CAAC;"}
1
+ {"version":3,"file":"nodeParsers.mjs","sources":["../../../src/openapi/analyzerModule/nodeParsers.ts"],"sourcesContent":["import {\n\tNode,\n\tPropertyAccessExpression,\n\tPropertyAssignment,\n\tPropertySignature,\n\tShorthandPropertyAssignment,\n\tSyntaxKind,\n\tts,\n\tType,\n\tTypeReferenceNode,\n} from 'ts-morph'\n\nimport { Logger } from '../../utils/logger'\nimport { OpenApiManager } from '../manager/OpenApiManager'\nimport { ShapeOfProperty, ShapeOfType, ShapeOfUnionEntry } from './types'\n\nconst implementationCache = new WeakMap<Node, Node>()\n\nexport const findNodeImplementation = (node: Node): Node => {\n\tconst cached = implementationCache.get(node)\n\tif (cached) {\n\t\treturn cached\n\t}\n\n\tif (node.getKind() === SyntaxKind.Identifier) {\n\t\tconst implementationNode = node.asKind(SyntaxKind.Identifier)!.getImplementations()[0]?.getNode()\n\t\tif (implementationNode) {\n\t\t\tconst implementationParentNode = implementationNode.getParent()!\n\t\t\tconst assignmentValueNode = implementationParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\n\t\tconst definitionNode = node.asKind(SyntaxKind.Identifier)!.getDefinitions()[0]?.getNode()\n\t\tif (definitionNode) {\n\t\t\tconst definitionParentNode = definitionNode.getParent()!\n\t\t\tconst assignmentValueNode = definitionParentNode.getLastChild()!\n\t\t\tif (assignmentValueNode === node) {\n\t\t\t\tthrow new Error('Recursive implementation found')\n\t\t\t}\n\t\t\tconst result = findNodeImplementation(assignmentValueNode)\n\t\t\timplementationCache.set(node, result)\n\t\t\treturn result\n\t\t}\n\t\tthrow new Error('No implementation nor definition available')\n\t}\n\n\timplementationCache.set(node, node)\n\treturn node\n}\n\nexport const findPropertyAssignmentValueNode = (\n\tnode:\n\t\t| PropertyAssignment\n\t\t| TypeReferenceNode\n\t\t| PropertySignature\n\t\t| PropertyAccessExpression\n\t\t| ShorthandPropertyAssignment,\n): Node => {\n\tconst identifierChildren = node.getChildrenOfKind(SyntaxKind.Identifier)\n\tif (identifierChildren.length === 2) {\n\t\treturn findNodeImplementation(identifierChildren[1])\n\t}\n\tconst lastMatchingChild = node.getChildren().reverse()\n\treturn lastMatchingChild.find(\n\t\t(child) =>\n\t\t\tchild.getKind() !== SyntaxKind.GreaterThanToken &&\n\t\t\tchild.getKind() !== SyntaxKind.CommaToken &&\n\t\t\tchild.getKind() !== SyntaxKind.SemicolonToken,\n\t)!\n}\n\nexport const getTypeReferenceShape = (node: TypeReferenceNode): ShapeOfType['shape'] => {\n\tconst firstChild = node.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\tif (firstChild.isKind(SyntaxKind.SyntaxList)) {\n\t\treturn getRecursiveNodeShape(firstChild.getFirstChild()!)\n\t} else {\n\t\treturn getRecursiveNodeShape(firstChild)\n\t}\n}\n\nexport const getRecursiveNodeShape = (nodeOrReference: Node): ShapeOfType['shape'] => {\n\tconst typeName = nodeOrReference.getSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\t// Undefined\n\tconst undefinedNode = node.asKind(SyntaxKind.UndefinedKeyword)\n\tif (undefinedNode) {\n\t\treturn 'undefined'\n\t}\n\n\t// Literal type\n\tconst literalNode = node.asKind(SyntaxKind.LiteralType)\n\tif (literalNode) {\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.TrueKeyword)) {\n\t\t\treturn 'true'\n\t\t}\n\t\tif (literalNode.getFirstChildByKind(SyntaxKind.FalseKeyword)) {\n\t\t\treturn 'false'\n\t\t}\n\t}\n\n\t// Boolean literal\n\tconst booleanLiteralNode =\n\t\tnode.asKind(SyntaxKind.BooleanKeyword) ||\n\t\tnode.asKind(SyntaxKind.TrueKeyword) ||\n\t\tnode.asKind(SyntaxKind.FalseKeyword)\n\tif (booleanLiteralNode) {\n\t\treturn 'boolean'\n\t}\n\n\t// String literal\n\tconst stringLiteralNode = node.asKind(SyntaxKind.StringKeyword) || node.asKind(SyntaxKind.StringLiteral)\n\tif (stringLiteralNode) {\n\t\treturn 'string'\n\t}\n\n\t// Number literal\n\tconst numberLiteralNode = node.asKind(SyntaxKind.NumberKeyword) || node.asKind(SyntaxKind.NumericLiteral)\n\tif (numberLiteralNode) {\n\t\treturn 'number'\n\t}\n\n\t// BigInt literal\n\tconst bigIntNode = node.asKind(SyntaxKind.BigIntKeyword) || node.asKind(SyntaxKind.BigIntLiteral)\n\tif (bigIntNode) {\n\t\treturn 'bigint'\n\t}\n\n\t// Type literal\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\tconst properties = typeLiteralNode\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getChildrenOfKind(SyntaxKind.PropertySignature)\n\n\t\tconst propertyShapes = properties.map((propNode) => {\n\t\t\tconst identifier = propNode.getFirstChildByKind(SyntaxKind.Identifier)!\n\t\t\tconst valueNode = findPropertyAssignmentValueNode(propNode)\n\t\t\tconst questionMarkToken = identifier.getNextSiblingIfKind(SyntaxKind.QuestionToken)\n\t\t\treturn {\n\t\t\t\trole: 'property' as const,\n\t\t\t\tidentifier: identifier.getText(),\n\t\t\t\tshape: getRecursiveNodeShape(valueNode),\n\t\t\t\toptional: valueNode.getType().isNullable() || !!questionMarkToken,\n\t\t\t}\n\t\t})\n\t\treturn propertyShapes\n\t}\n\n\t// Type reference\n\tconst typeReferenceNode = node.asKind(SyntaxKind.TypeReference)\n\tif (typeReferenceNode) {\n\t\treturn getRecursiveNodeShape(typeReferenceNode.getFirstChild()!)\n\t}\n\n\t// Property access expression\n\tconst propertyAccessNode = node.asKind(SyntaxKind.PropertyAccessExpression)\n\tif (propertyAccessNode) {\n\t\tconst lastChild = findNodeImplementation(node.getLastChild()!)\n\t\treturn getProperTypeShape(lastChild.asKind(SyntaxKind.CallExpression)!.getReturnType(), lastChild)\n\t}\n\n\t// Union type\n\tconst unionTypeNode = node.asKind(SyntaxKind.UnionType)\n\tif (unionTypeNode) {\n\t\treturn getProperTypeShape(unionTypeNode.getType(), node)\n\t}\n\n\t// Typeof query\n\tconst typeQueryNode = node.asKind(SyntaxKind.TypeQuery)\n\tif (typeQueryNode) {\n\t\treturn getRecursiveNodeShape(typeQueryNode.getLastChild()!)\n\t}\n\n\t// Qualified name\n\tconst qualifiedNameNode = node.asKind(SyntaxKind.QualifiedName)\n\tif (qualifiedNameNode) {\n\t\treturn getRecursiveNodeShape(qualifiedNameNode.getLastChild()!)\n\t}\n\n\t// Call expression\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\treturn getProperTypeShape(callExpressionNode.getReturnType(), callExpressionNode)\n\t}\n\n\t// Await expression\n\tconst awaitExpressionNode = node.asKind(SyntaxKind.AwaitExpression)\n\tif (awaitExpressionNode) {\n\t\treturn getRecursiveNodeShape(awaitExpressionNode.getChildAtIndex(1)!)\n\t}\n\n\t// 'As' Expression\n\tconst asExpressionNode = node.asKind(SyntaxKind.AsExpression)\n\tif (asExpressionNode) {\n\t\treturn getRecursiveNodeShape(asExpressionNode.getChildAtIndex(2)!)\n\t}\n\n\t// TODO\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown node type: ${node.getKindName()}`)\n\treturn 'unknown_1'\n}\n\nexport const getShapeOfValidatorLiteral = (\n\tobjectLiteralNode: Node<ts.ObjectLiteralExpression>,\n): (ShapeOfProperty & { description: string; errorMessage: string })[] => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstChild()!\n\t\tconst identifierName = (() => {\n\t\t\tif (identifierNode.isKind(SyntaxKind.Identifier)) {\n\t\t\t\treturn identifierNode.getText()\n\t\t\t}\n\t\t\tif (identifierNode.isKind(SyntaxKind.StringLiteral)) {\n\t\t\t\treturn identifierNode.getLiteralText()\n\t\t\t}\n\t\t\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\t\t\tLogger.warn(`[${fileName}] Unknown identifier name: ${identifierNode.getText()}`)\n\t\t\treturn 'unknown_30'\n\t\t})()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst innerLiteralNode = findNodeImplementation(assignmentValueNode)\n\n\t\treturn {\n\t\t\trole: 'property' as const,\n\t\t\tidentifier: identifierName,\n\t\t\tshape: getValidatorPropertyShape(innerLiteralNode),\n\t\t\toptional: getValidatorPropertyOptionality(innerLiteralNode),\n\t\t\tdescription: getValidatorPropertyStringValue(innerLiteralNode, 'description'),\n\t\t\terrorMessage: getValidatorPropertyStringValue(innerLiteralNode, 'errorMessage'),\n\t\t}\n\t})\n\n\treturn properties || []\n}\n\nexport const getValidatorPropertyShape = (innerLiteralNode: Node): ShapeOfType['shape'] => {\n\t// Inline definition with `as Validator<...>` clause\n\tconst inlineValidatorAsExpression = innerLiteralNode\n\t\t.getParent()!\n\t\t.getFirstChildByKind(SyntaxKind.AsExpression)\n\tif (inlineValidatorAsExpression) {\n\t\tconst typeReference = inlineValidatorAsExpression.getLastChildByKind(SyntaxKind.TypeReference)!\n\t\treturn getTypeReferenceShape(typeReference)\n\t}\n\n\t// Variable with `: Validator<...>` clause\n\tconst childTypeReferenceNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.TypeReference)\n\tif (childTypeReferenceNode) {\n\t\treturn getTypeReferenceShape(childTypeReferenceNode)\n\t}\n\n\t// `RequiredParam<...>` inline call expression\n\tif (innerLiteralNode.getParent()!.getChildrenOfKind(SyntaxKind.SyntaxList).length >= 2) {\n\t\tconst typeNode = innerLiteralNode\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t\t.getFirstChild()!\n\t\treturn getRecursiveNodeShape(typeNode)\n\t}\n\n\t// `RequestParam | RequiredParam | OptionalParam` call expression\n\tconst childCallExpressionNode = innerLiteralNode.getParent()!.getFirstChildByKind(SyntaxKind.CallExpression)\n\tif (childCallExpressionNode) {\n\t\tconst callExpressionArgument = findNodeImplementation(\n\t\t\tchildCallExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!.getFirstChild()!,\n\t\t)\n\n\t\t// Param is a type reference\n\t\tconst typeReferenceNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.TypeReference)!\n\t\tif (typeReferenceNode) {\n\t\t\treturn getProperTypeShape(typeReferenceNode.getType(), typeReferenceNode, [])\n\t\t}\n\n\t\tconst thingyNode = callExpressionArgument\n\t\t\t.getParent()!\n\t\t\t.getFirstChildByKind(SyntaxKind.ObjectLiteralExpression)!\n\t\tif (thingyNode) {\n\t\t\treturn getValidatorPropertyShape(thingyNode)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.CallExpression) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tif (callExpressionArgument.getKind() === SyntaxKind.IntersectionType) {\n\t\t\treturn getValidatorPropertyShape(callExpressionArgument)\n\t\t}\n\n\t\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\t\tLogger.warn(`[${fileName}] Unknown call expression argument: ${callExpressionArgument.getKindName()}`)\n\t\treturn 'unknown_3'\n\t}\n\n\t// Attempting to infer type from `parse` function\n\tconst innerNodePropertyAssignments = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\t.getChildrenOfKind(SyntaxKind.PropertyAssignment)\n\tconst parsePropertyAssignment = innerNodePropertyAssignments.find((prop) => {\n\t\treturn prop.getFirstChildByKind(SyntaxKind.Identifier)?.getText() === 'parse'\n\t})\n\tif (parsePropertyAssignment) {\n\t\tconst returnType = findPropertyAssignmentValueNode(parsePropertyAssignment)\n\t\t\t.asKind(SyntaxKind.ArrowFunction)!\n\t\t\t.getReturnType()\n\t\treturn getProperTypeShape(returnType, parsePropertyAssignment)\n\t}\n\n\t// Import statement\n\tconst importTypeNode = innerLiteralNode\n\t\t.getFirstChildByKind(SyntaxKind.SyntaxList)\n\t\t?.getFirstChildByKind(SyntaxKind.ImportType)\n\tif (importTypeNode) {\n\t\tconst indexOfGreaterThanToken = importTypeNode\n\t\t\t.getLastChildByKind(SyntaxKind.GreaterThanToken)!\n\t\t\t.getChildIndex()\n\t\tconst targetSyntaxList = importTypeNode.getChildAtIndex(indexOfGreaterThanToken - 1)\n\t\treturn getRecursiveNodeShape(targetSyntaxList.getFirstChild()!)\n\t}\n\n\t// Intersection type with Validator\n\tconst intersectionType = innerLiteralNode.isKind(SyntaxKind.IntersectionType)\n\t\t? innerLiteralNode\n\t\t: innerLiteralNode.getParent()?.isKind(SyntaxKind.VariableDeclaration)\n\t\t\t? innerLiteralNode.getParent()?.getFirstChildByKind(SyntaxKind.IntersectionType)\n\t\t\t: null\n\n\tif (intersectionType) {\n\t\tconst validatorType = intersectionType.getFirstChildByKind(SyntaxKind.TypeReference)\n\t\tif (validatorType) {\n\t\t\treturn getTypeReferenceShape(validatorType)\n\t\t}\n\t}\n\n\tconst fileName = innerLiteralNode.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown import type node`)\n\n\treturn 'unknown_2'\n}\n\nexport const getValidatorPropertyOptionality = (node: Node): boolean => {\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst identifierNode = callExpressionNode.getFirstChildByKind(SyntaxKind.Identifier)\n\t\tif (identifierNode?.getText() === 'OptionalParam') {\n\t\t\treturn true\n\t\t} else if (identifierNode?.getText() === 'RequiredParam') {\n\t\t\treturn false\n\t\t}\n\n\t\tconst syntaxListNode = callExpressionNode.getFirstChildByKind(SyntaxKind.SyntaxList)!\n\t\tconst literalExpression = findNodeImplementation(syntaxListNode.getFirstChild()!)\n\t\treturn getValidatorPropertyOptionality(literalExpression)\n\t}\n\n\tconst syntaxListNode = node.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\treturn assignmentNodes.some((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tif (identifierName === 'optional') {\n\t\t\tconst value = findPropertyAssignmentValueNode(node)\n\t\t\treturn value.getKind() === SyntaxKind.TrueKeyword\n\t\t}\n\t\treturn false\n\t})\n}\n\nexport const getValidatorPropertyStringValue = (\n\tnodeOrReference: Node,\n\tname: 'description' | 'errorMessage',\n): string => {\n\tconst node = findNodeImplementation(nodeOrReference)\n\n\tconst callExpressionNode = node.asKind(SyntaxKind.CallExpression)\n\tif (callExpressionNode) {\n\t\tconst targetChild = callExpressionNode.getLastChildByKind(SyntaxKind.SyntaxList)!\n\t\treturn getValidatorPropertyStringValue(targetChild, name)\n\t}\n\n\tconst syntaxListNode = node.asKind(SyntaxKind.SyntaxList)\n\tif (syntaxListNode) {\n\t\tconst children = syntaxListNode.getChildren().map((c) => getValidatorPropertyStringValue(c, name))\n\t\treturn children.find((value) => !!value && value !== 'unknown_25') || ''\n\t}\n\n\tconst objectLiteralNode = node.asKind(SyntaxKind.ObjectLiteralExpression)\n\tif (objectLiteralNode) {\n\t\tconst values = getValuesOfObjectLiteral(objectLiteralNode)\n\t\tconst targetValue = values.find((value) => value.identifier === name)\n\t\tif (!targetValue) {\n\t\t\treturn ''\n\t\t}\n\t\tif (Array.isArray(targetValue.value)) {\n\t\t\treturn 'array'\n\t\t}\n\t\treturn targetValue.value || ''\n\t}\n\n\tconst intersectionTypeNode = node.asKind(SyntaxKind.IntersectionType)\n\tif (intersectionTypeNode) {\n\t\treturn (\n\t\t\tintersectionTypeNode\n\t\t\t\t.getTypeNodes()\n\t\t\t\t.flatMap((t) => getValidatorPropertyStringValue(t, name))\n\t\t\t\t.filter((v) => !!v && v !== 'unknown_25')[0] || 'unknown_27'\n\t\t)\n\t}\n\n\tconst typeLiteralNode = node.asKind(SyntaxKind.TypeLiteral)\n\tif (typeLiteralNode) {\n\t\treturn getValidatorPropertyStringValue(typeLiteralNode.getFirstChildByKind(SyntaxKind.SyntaxList)!, name)\n\t}\n\n\tconst propertySignatureNode = node.asKind(SyntaxKind.PropertySignature)\n\tif (propertySignatureNode) {\n\t\tconst identifier = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tif (identifier.getText() === name) {\n\t\t\tconst targetNode = findPropertyAssignmentValueNode(propertySignatureNode).getFirstDescendantByKind(\n\t\t\t\tSyntaxKind.StringLiteral,\n\t\t\t)!\n\t\t\treturn targetNode.getLiteralText()\n\t\t}\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown property string value node ${node.getKindName()}`)\n\treturn 'unknown_25'\n}\n\nconst isPromise = (type: Type) => {\n\tconst symbol = type.getSymbol()\n\tif (!type.isObject() || !symbol) {\n\t\treturn false\n\t}\n\tconst args = type.getTypeArguments()\n\treturn symbol.getName() === 'Promise' && args.length === 1\n}\n\nexport const getProperTypeShape = (\n\ttypeOrPromise: Type,\n\tatLocation: Node,\n\tstack: Type[] = [],\n): ShapeOfType['shape'] => {\n\tconst typeName = typeOrPromise.getAliasSymbol()?.getName()\n\tif (typeName && OpenApiManager.getInstance().hasExposedModel(typeName)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'ref',\n\t\t\t\tshape: typeName,\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst type = isPromise(typeOrPromise) ? typeOrPromise.getTypeArguments()[0] : typeOrPromise\n\n\tif (stack.some((previousType) => previousType === type)) {\n\t\treturn 'circular'\n\t}\n\n\tconst nextStack = stack.concat(type)\n\n\tif (type.getText() === 'void') {\n\t\treturn 'void'\n\t}\n\n\tif (type.isAny()) {\n\t\treturn 'any'\n\t}\n\n\tif (type.isNull()) {\n\t\treturn 'null'\n\t}\n\n\tif (type.isUndefined()) {\n\t\treturn 'undefined'\n\t}\n\n\tif (type.isBoolean() || type.isBooleanLiteral()) {\n\t\treturn 'boolean'\n\t}\n\n\tif (type.isStringLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_string' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isNumberLiteral()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'literal_number' as const,\n\t\t\t\tshape: String(type.getLiteralValue()!),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isString() || type.isTemplateLiteral()) {\n\t\treturn 'string'\n\t}\n\n\tif (type.isNumber()) {\n\t\treturn 'number'\n\t}\n\n\tif (type.getText() === 'bigint') {\n\t\treturn 'bigint'\n\t}\n\n\tif (type.isTuple()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'tuple' as const,\n\t\t\t\tshape: type.getTupleElements().map((t) => ({\n\t\t\t\t\trole: 'tuple_entry' as const,\n\t\t\t\t\tshape: getProperTypeShape(t, atLocation, nextStack),\n\t\t\t\t\toptional: false,\n\t\t\t\t})),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isArray()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'array' as const,\n\t\t\t\tshape: getProperTypeShape(type.getArrayElementType()!, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getText() === 'Buffer') {\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'buffer' as const,\n\t\t\t\tshape: 'buffer',\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject() && type.getProperties().length === 0) {\n\t\tconst targetType = type.getAliasTypeArguments()[1]\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'record' as const,\n\t\t\t\tshape: getProperTypeShape(targetType, atLocation, nextStack),\n\t\t\t\toptional: false,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isObject()) {\n\t\tif (type.getText() === 'Date') {\n\t\t\treturn 'Date'\n\t\t}\n\t\treturn type\n\t\t\t.getProperties()\n\t\t\t.map((prop) => {\n\t\t\t\tconst valueDeclaration = prop.getValueDeclaration() || prop.getDeclarations()[0]!\n\t\t\t\tif (!valueDeclaration) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst valueDeclarationNode =\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertySignature) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.PropertyAssignment) ||\n\t\t\t\t\tvalueDeclaration.asKind(SyntaxKind.ShorthandPropertyAssignment)\n\n\t\t\t\tif (!valueDeclarationNode) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\t\tshape: getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack),\n\t\t\t\t\t\toptional: false,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst isOptional = prop.getTypeAtLocation(atLocation).isNullable()\n\n\t\t\t\tconst shape = getProperTypeShape(prop.getTypeAtLocation(atLocation), atLocation, nextStack)\n\t\t\t\treturn {\n\t\t\t\t\trole: 'property' as const,\n\t\t\t\t\tidentifier: prop.getName(),\n\t\t\t\t\tshape: shape,\n\t\t\t\t\toptional: isOptional,\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter((val) => val.shape !== 'undefined')\n\t}\n\n\tif (type.isUnion()) {\n\t\tconst unfilteredShapes: ShapeOfUnionEntry[] = type.getUnionTypes().map((type) => ({\n\t\t\trole: 'union_entry',\n\t\t\tshape: getProperTypeShape(type, atLocation, nextStack),\n\t\t\toptional: false,\n\t\t}))\n\n\t\tconst dedupedShapes = unfilteredShapes.filter(\n\t\t\t(type, index, arr) => !arr.find((dup, dupIndex) => dup.shape === type.shape && dupIndex > index),\n\t\t)\n\t\tconst isNullable = dedupedShapes.some((shape) => shape.shape === 'undefined')\n\t\tconst shapes = dedupedShapes.filter((shape) => shape.shape !== 'undefined')\n\t\tif (shapes.length === 1) {\n\t\t\treturn shapes[0].shape\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\trole: 'union',\n\t\t\t\tshape: shapes,\n\t\t\t\toptional: isNullable,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (type.isIntersection()) {\n\t\tconst children = type.getIntersectionTypes()\n\t\tconst shapesOfChildren = children\n\t\t\t.map((child) => getProperTypeShape(child, atLocation, nextStack))\n\t\t\t.filter((shape) => typeof shape !== 'string') as ShapeOfProperty[][]\n\t\treturn shapesOfChildren.reduce<ShapeOfType[]>((total, current) => [...total, ...current], [])\n\t}\n\n\tconst fileName = atLocation.getSourceFile().getFilePath().split('/').pop()\n\tLogger.warn(`[${fileName}] Unknown type shape node ${typeOrPromise.getText()}`)\n\treturn 'unknown_5'\n}\n\nconst getLiteralValueOfNode = (node: Node): string | string[] | unknown[] => {\n\tif (node.isKind(SyntaxKind.Identifier)) {\n\t\treturn getLiteralValueOfNode(findNodeImplementation(node))\n\t} else if (node.isKind(SyntaxKind.StringLiteral)) {\n\t\treturn node.getLiteralValue()\n\t} else if (node.isKind(SyntaxKind.ArrayLiteralExpression)) {\n\t\treturn node.forEachChildAsArray().map((child) => getLiteralValueOfNode(child)) as string[]\n\t} else if (node.isKind(SyntaxKind.PropertyAccessExpression)) {\n\t\treturn getLiteralValueOfNode(findPropertyAssignmentValueNode(node))\n\t} else if (node.isKind(SyntaxKind.ObjectLiteralExpression)) {\n\t\treturn getValuesOfObjectLiteral(node)\n\t}\n\n\tconst fileName = node.getSourceFile().getFilePath().split('/').pop()\n\tLogger.dev(`[${fileName}] Unknown literal value node ${node.getKindName()}`)\n\n\treturn 'unknown_6'\n}\n\nexport const getValuesOfObjectLiteral = (objectLiteralNode: Node<ts.ObjectLiteralExpression>) => {\n\tconst syntaxListNode = objectLiteralNode.getFirstDescendantByKind(SyntaxKind.SyntaxList)!\n\tconst assignmentNodes = syntaxListNode.getChildrenOfKind(SyntaxKind.PropertyAssignment)!\n\n\tconst properties = assignmentNodes.map((node) => {\n\t\tconst identifierNode = node.getFirstDescendantByKind(SyntaxKind.Identifier)!\n\t\tconst identifierName = identifierNode.getText()\n\n\t\tconst assignmentValueNode = node.getLastChild()!\n\t\tconst targetNode = findNodeImplementation(assignmentValueNode)\n\t\tconst value = getLiteralValueOfNode(targetNode)\n\n\t\treturn {\n\t\t\tidentifier: identifierName,\n\t\t\tvalue,\n\t\t}\n\t})\n\n\treturn properties || []\n}\n"],"names":["implementationCache","findNodeImplementation","node","cached","SyntaxKind","implementationNode","assignmentValueNode","result","definitionNode","findPropertyAssignmentValueNode","identifierChildren","child","getTypeReferenceShape","firstChild","getRecursiveNodeShape","nodeOrReference","typeName","OpenApiManager","literalNode","typeLiteralNode","propNode","identifier","valueNode","questionMarkToken","typeReferenceNode","lastChild","getProperTypeShape","unionTypeNode","typeQueryNode","qualifiedNameNode","callExpressionNode","awaitExpressionNode","asExpressionNode","fileName","Logger","getShapeOfValidatorLiteral","objectLiteralNode","identifierNode","identifierName","innerLiteralNode","getValidatorPropertyShape","getValidatorPropertyOptionality","getValidatorPropertyStringValue","inlineValidatorAsExpression","typeReference","childTypeReferenceNode","typeNode","childCallExpressionNode","callExpressionArgument","thingyNode","parsePropertyAssignment","prop","returnType","importTypeNode","indexOfGreaterThanToken","targetSyntaxList","intersectionType","validatorType","syntaxListNode","literalExpression","name","targetChild","c","value","targetValue","getValuesOfObjectLiteral","intersectionTypeNode","t","v","propertySignatureNode","isPromise","type","symbol","args","typeOrPromise","atLocation","stack","previousType","nextStack","targetType","valueDeclaration","isOptional","shape","val","dedupedShapes","index","arr","dup","dupIndex","isNullable","shapes","total","current","getLiteralValueOfNode","targetNode"],"mappings":";;;AAgBA,MAAMA,wBAA0B,QAAoB,GAEvCC,IAAyB,CAACC,MAAqB;AACrD,QAAAC,IAASH,EAAoB,IAAIE,CAAI;AAC3C,MAAIC;AACI,WAAAA;AAGR,MAAID,EAAK,cAAcE,EAAW,YAAY;AACvC,UAAAC,IAAqBH,EAAK,OAAOE,EAAW,UAAU,EAAG,mBAAmB,EAAE,CAAC,GAAG,QAAQ;AAChG,QAAIC,GAAoB;AAEjB,YAAAC,IAD2BD,EAAmB,UAAU,EACT,aAAa;AAClE,UAAIC,MAAwBJ;AACrB,cAAA,IAAI,MAAM,gCAAgC;AAE3C,YAAAK,IAASN,EAAuBK,CAAmB;AACrC,aAAAN,EAAA,IAAIE,GAAMK,CA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AA8C;AAC5E,MAAIA,EAAK,OAAOE,EAAW,UAAU;AAC7B,WAAAyF,EAAsB5F,EAAuBC,CAAI,CAAC;AAC/C,MAAAA,EAAK,OAAOE,EAAW,aAAa;AAC9C,WAAOF,EAAK,gBAAgB;AAClB,MAAAA,EAAK,OAAOE,EAAW,sBAAsB;AAChD,WAAAF,EAAK,sBAAsB,IAAI,CAACS,MAAUkF,EAAsBlF,CAAK,CAAC;AACnE,MAAAT,EAAK,OAAOE,EAAW,wBAAwB;AAClD,WAAAyF,EAAsBpF,EAAgCP,CAAI,CAAC;AACxD,MAAAA,EAAK,OAAOE,EAAW,uBAAuB;AACxD,WAAO6D,EAAyB/D,CAAI;AAG/B,QAAA+B,IAAW/B,EAAK,cAAc,EAAE,cAAc,MAAM,GAAG,EAAE,IAAI;AACnE,SAAAgC,EAAO,IAAI,IAAID,CAAQ,gCAAgC/B,EAAK,YAAa,CAAA,EAAE,GAEpE;AACR,GAEa+D,IAA2B,CAAC7B,MACjBA,EAAkB,yBAAyBhC,EAAW,UAAU,EAChD,kBAAkBA,EAAW,kBAAkB,EAEnD,IAAI,CAACF,MAAS;AAE1C,QAAAoC,IADiBpC,EAAK,yBAAyBE,EAAW,UAAU,EACpC,QAAQ,GAExCE,IAAsBJ,EAAK,aAAa,GACxC4F,IAAa7F,EAAuBK,CAAmB,GACvDyD,IAAQ8B,EAAsBC,CAAU;AAEvC,SAAA;AAAA,IACN,YAAYxD;AAAA,IACZ,OAAAyB;AAAA,EACD;AAAA,CACA,KAEoB,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=e=>Object.keys(e),t=e=>`${e.substring(0,1).toLowerCase()}${e.substring(1)}`,r=e=>t(e).replace(/(?!^)-(.)/g,(o,s)=>s.toUpperCase());exports.kebabToCamelCase=r;exports.keysOf=a;exports.uncapitalize=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=e=>Object.keys(e),n=e=>Object.entries(e),t=e=>`${e.substring(0,1).toLowerCase()}${e.substring(1)}`,a=e=>t(e).replace(/(?!^)-(.)/g,(o,s)=>s.toUpperCase());exports.entriesOf=n;exports.kebabToCamelCase=a;exports.keysOf=r;exports.uncapitalize=t;
2
2
  //# sourceMappingURL=object.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.cjs","sources":["../../src/utils/object.ts"],"sourcesContent":["export const keysOf = <T extends string | number | symbol>(object: Record<T, unknown>) => {\n\treturn Object.keys(object) as (keyof typeof object)[]\n}\n\nexport const uncapitalize = (value: string) => `${value.substring(0, 1).toLowerCase()}${value.substring(1)}`\n\nexport const snakeToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)_(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const kebabToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)-(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const camelToSnakeCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`)\n}\n\nexport const camelToKebabCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)\n}\n"],"names":["keysOf","object","uncapitalize","value","kebabToCamelCase","_","char"],"mappings":"gFAAa,MAAAA,EAA8CC,GACnD,OAAO,KAAKA,CAAM,EAGbC,EAAgBC,GAAkB,GAAGA,EAAM,UAAU,EAAG,CAAC,EAAE,aAAa,GAAGA,EAAM,UAAU,CAAC,CAAC,GAM7FC,EAAoBD,GACzBD,EAAaC,CAAK,EAAE,QAAQ,aAAc,CAACE,EAAGC,IAASA,EAAK,aAAa"}
1
+ {"version":3,"file":"object.cjs","sources":["../../src/utils/object.ts"],"sourcesContent":["export const keysOf = <T extends string | number | symbol>(object: Record<T, unknown>) => {\n\treturn Object.keys(object) as (keyof typeof object)[]\n}\n\nexport const entriesOf = <T extends string | number | symbol>(object: Record<T, unknown>) => {\n\treturn Object.entries(object) as [keyof typeof object, (typeof object)[keyof typeof object]][]\n}\n\nexport const uncapitalize = (value: string) => `${value.substring(0, 1).toLowerCase()}${value.substring(1)}`\n\nexport const snakeToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)_(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const kebabToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)-(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const camelToSnakeCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`)\n}\n\nexport const camelToKebabCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)\n}\n"],"names":["keysOf","object","entriesOf","uncapitalize","value","kebabToCamelCase","_","char"],"mappings":"gFAAa,MAAAA,EAA8CC,GACnD,OAAO,KAAKA,CAAM,EAGbC,EAAiDD,GACtD,OAAO,QAAQA,CAAM,EAGhBE,EAAgBC,GAAkB,GAAGA,EAAM,UAAU,EAAG,CAAC,EAAE,aAAa,GAAGA,EAAM,UAAU,CAAC,CAAC,GAM7FC,EAAoBD,GACzBD,EAAaC,CAAK,EAAE,QAAQ,aAAc,CAACE,EAAGC,IAASA,EAAK,aAAa"}
@@ -1,4 +1,5 @@
1
1
  export declare const keysOf: <T extends string | number | symbol>(object: Record<T, unknown>) => (keyof typeof object)[];
2
+ export declare const entriesOf: <T extends string | number | symbol>(object: Record<T, unknown>) => [keyof typeof object, (typeof object)[keyof typeof object]][];
2
3
  export declare const uncapitalize: (value: string) => string;
3
4
  export declare const snakeToCamelCase: (value: string) => string;
4
5
  export declare const kebabToCamelCase: (value: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,UAAU,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,KACtD,CAAC,MAAM,OAAO,MAAM,CAAC,EACnD,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,MAAM,WAAkE,CAAA;AAE5G,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA"}
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,UAAU,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,KACtD,CAAC,MAAM,OAAO,MAAM,CAAC,EACnD,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,UAAU,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,KACtD,CAAC,MAAM,OAAO,MAAM,EAAE,CAAC,OAAO,MAAM,EAAE,MAAM,OAAO,MAAM,CAAC,CAAC,EAC5F,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,MAAM,WAAkE,CAAA;AAE5G,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAE7C,CAAA"}
@@ -1,7 +1,8 @@
1
- const n = (e) => Object.keys(e), t = (e) => `${e.substring(0, 1).toLowerCase()}${e.substring(1)}`, o = (e) => t(e).replace(/(?!^)-(.)/g, (r, s) => s.toUpperCase());
1
+ const n = (e) => Object.keys(e), o = (e) => Object.entries(e), s = (e) => `${e.substring(0, 1).toLowerCase()}${e.substring(1)}`, c = (e) => s(e).replace(/(?!^)-(.)/g, (r, t) => t.toUpperCase());
2
2
  export {
3
- o as kebabToCamelCase,
3
+ o as entriesOf,
4
+ c as kebabToCamelCase,
4
5
  n as keysOf,
5
- t as uncapitalize
6
+ s as uncapitalize
6
7
  };
7
8
  //# sourceMappingURL=object.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.mjs","sources":["../../src/utils/object.ts"],"sourcesContent":["export const keysOf = <T extends string | number | symbol>(object: Record<T, unknown>) => {\n\treturn Object.keys(object) as (keyof typeof object)[]\n}\n\nexport const uncapitalize = (value: string) => `${value.substring(0, 1).toLowerCase()}${value.substring(1)}`\n\nexport const snakeToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)_(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const kebabToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)-(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const camelToSnakeCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`)\n}\n\nexport const camelToKebabCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)\n}\n"],"names":["keysOf","object","uncapitalize","value","kebabToCamelCase","_","char"],"mappings":"AAAa,MAAAA,IAAS,CAAqCC,MACnD,OAAO,KAAKA,CAAM,GAGbC,IAAe,CAACC,MAAkB,GAAGA,EAAM,UAAU,GAAG,CAAC,EAAE,aAAa,GAAGA,EAAM,UAAU,CAAC,CAAC,IAM7FC,IAAmB,CAACD,MACzBD,EAAaC,CAAK,EAAE,QAAQ,cAAc,CAACE,GAAGC,MAASA,EAAK,aAAa;"}
1
+ {"version":3,"file":"object.mjs","sources":["../../src/utils/object.ts"],"sourcesContent":["export const keysOf = <T extends string | number | symbol>(object: Record<T, unknown>) => {\n\treturn Object.keys(object) as (keyof typeof object)[]\n}\n\nexport const entriesOf = <T extends string | number | symbol>(object: Record<T, unknown>) => {\n\treturn Object.entries(object) as [keyof typeof object, (typeof object)[keyof typeof object]][]\n}\n\nexport const uncapitalize = (value: string) => `${value.substring(0, 1).toLowerCase()}${value.substring(1)}`\n\nexport const snakeToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)_(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const kebabToCamelCase = (value: string) => {\n\treturn uncapitalize(value).replace(/(?!^)-(.)/g, (_, char) => char.toUpperCase())\n}\n\nexport const camelToSnakeCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`)\n}\n\nexport const camelToKebabCase = (value: string) => {\n\treturn uncapitalize(value).replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`)\n}\n"],"names":["keysOf","object","entriesOf","uncapitalize","value","kebabToCamelCase","_","char"],"mappings":"AAAa,MAAAA,IAAS,CAAqCC,MACnD,OAAO,KAAKA,CAAM,GAGbC,IAAY,CAAqCD,MACtD,OAAO,QAAQA,CAAM,GAGhBE,IAAe,CAACC,MAAkB,GAAGA,EAAM,UAAU,GAAG,CAAC,EAAE,aAAa,GAAGA,EAAM,UAAU,CAAC,CAAC,IAM7FC,IAAmB,CAACD,MACzBD,EAAaC,CAAK,EAAE,QAAQ,cAAc,CAACE,GAAGC,MAASA,EAAK,aAAa;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moonflower",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "author": "tenebrie",
6
6
  "license": "MIT",
@@ -115,8 +115,6 @@
115
115
  "test-coverage": "vitest --coverage"
116
116
  },
117
117
  "dependencies": {
118
- "http-status-codes": "^2.3.0",
119
- "module-alias": "^2.2.3",
120
118
  "ts-morph": "^24.0.0",
121
119
  "typescript": "^5.7.2"
122
120
  },
@@ -1,7 +1,8 @@
1
- import { getReasonPhrase, StatusCodes } from 'http-status-codes'
1
+ import { StatusToReasonPhrase } from './ReasonPhrases'
2
+ import { StatusCodeValue } from './StatusCodes'
2
3
 
3
4
  export interface HttpError {
4
- status: StatusCodes
5
+ status: StatusCodeValue
5
6
  reason: string
6
7
  message: string
7
8
  }
@@ -10,10 +11,10 @@ export class BaseHttpError extends Error implements HttpError {
10
11
  public reason: string
11
12
 
12
13
  constructor(
13
- public status: StatusCodes,
14
+ public status: StatusCodeValue,
14
15
  public message: string,
15
16
  ) {
16
17
  super(message)
17
- this.reason = getReasonPhrase(status)
18
+ this.reason = StatusToReasonPhrase(status)
18
19
  }
19
20
  }