anl 1.3.9 → 1.3.12

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="3.0.0",t={"/api/test":{get:{operationId:"AppController_apiTest",parameters:[],responses:{200:{description:""}},tags:["Test Server"]}},"/api/lsp/compile":{post:{operationId:"LspController_compile",summary:"Get code completions based on given input",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CompletionDto"}}}},responses:{200:{description:"Successfully fetched the completion list."},400:{description:"Failed to fetch the completion list."}},tags:["LSP"]}},"/api/manageGame/createGame":{post:{operationId:"ManageGameController_createGame",summary:"创建新的游戏",parameters:[],requestBody:{required:!0,description:"创建游戏报文",content:{"application/json":{schema:{$ref:"#/components/schemas/CreateGameDto"}}}},responses:{200:{description:"游戏创建成功"}},tags:["Manage Game"]}},"/api/manageGame/gameList":{get:{operationId:"ManageGameController_getGameList",summary:"游戏列表",parameters:[],responses:{200:{description:"返回游戏列表"}},tags:["Manage Game"]}},"/api/manageGame/getGameConfig/{gameName}":{get:{operationId:"ManageGameController_getGameConfig",summary:"获取游戏的配置信息",parameters:[{name:"gameName",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"返回游戏配置"},400:{description:"获取游戏配置失败"}},tags:["Manage Game"]}},"/api/manageGame/rename":{post:{operationId:"ManageGameController_rename",summary:"游戏名称重命名",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/RenameDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Manage Game"]}},"/api/manageGame/delete":{post:{operationId:"ManageGameController_deleteFileOrDir",summary:"删除游戏",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/DeleteGameDto"}}}},responses:{200:{description:"Successfully"},400:{description:"Failed."}},tags:["Manage Game"]}},"/api/manageGame/readGameAssets/{readDirPath}":{get:{operationId:"ManageGameController_readGameAssets",summary:"Read Game Assets",parameters:[{name:"readDirPath",required:!0,in:"path",description:"Path of the game directory to read assets from, including subdirectories.",schema:{type:"string"}}],responses:{200:{description:"Retrieve the assets of the specified game directory."}},tags:["Manage Game"]}},"/api/manageGame/readUserAssets/{readDirPath}":{get:{operationId:"ManageGameController_readUserAssets",summary:"读取用户资源",parameters:[{name:"readDirPath",required:!0,in:"path",description:"读取资产的用户目录路径,包括子目录.",schema:{type:"string"}}],responses:{200:{description:"检索指定用户目录下的资源."}},tags:["Manage Game"]}},"/api/manageGame/setGameConfig":{post:{operationId:"ManageGameController_setGameConfig",summary:"Set Game Configuration",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/GameConfigDto"}}}},responses:{200:{description:"Game configuration set successfully."},400:{description:"Failed to set the game configuration."}},tags:["Manage Game"]}},"/api/manageGame/resource/uploadFiles":{post:{operationId:"ManageGameController_uploadUserResource",summary:"上传用户资源文件",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/UploadResourceDto"}}}},responses:{200:{description:"Files uploaded successfully."},400:{description:"Failed to upload files."}},tags:["Manage Game"]}},"/api/manageGame/resource/rename":{post:{operationId:"ManageGameController_resourceRename",summary:"用户资源文件重命名",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/RenameDto"}}}},responses:{200:{description:"Successfully"},400:{description:"Failed"}},tags:["Manage Game"]}},"/api/manageGame/resource/delete":{post:{operationId:"ManageGameController_resourceDelete",summary:"删除用户资源文件",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/DeleteResourceDto"}}}},responses:{200:{description:"Successfully"},400:{description:"Failed"}},tags:["Manage Game"]}},"/api/manageGame/resource/mkdir":{post:{operationId:"ManageGameController_resourceMkDir",summary:"新建用户资源文件夹",parameters:[{name:"resource",required:!0,in:"path",schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/MkDirDto"}}}},responses:{200:{description:"Directory created successfully."},400:{description:"Failed to create directory."}},tags:["Manage Game"]}},"/api/manageGame/openGameDict/{gameName}":{get:{operationId:"ManageGameController_openGameDict",summary:"Open Game Dictionary",parameters:[{name:"gameName",required:!0,in:"path",description:"Name of the game.",schema:{type:"string"}}],responses:{200:{description:"Opens the dictionary for a specified game."}},tags:["Manage Game"]}},"/api/manageGame/openGameAssetsDict/{gameName}":{get:{operationId:"ManageGameController_openGameAssetsDict",summary:"Open Game Assets Dictionary",parameters:[{name:"gameName",required:!0,in:"path",description:"Name of the game.",schema:{type:"string"}},{name:"subFolder",required:!0,in:"query",schema:{type:"string"}}],responses:{200:{description:"Opens the assets dictionary for a specified game."}},tags:["Manage Game"]}},"/api/manageGame/ejectGameAsWeb/{gameName}":{get:{operationId:"ManageGameController_ejectGameAsWeb",summary:"Eject Game As Web App",parameters:[{name:"gameName",required:!0,in:"path",description:"Name of the game to be exported as web app.",schema:{type:"string"}}],responses:{200:{description:"Exports the specified game as a web app."}},tags:["Manage Game"]}},"/api/manageGame/ejectGameAsExe/{gameName}":{get:{operationId:"ManageGameController_ejectGameAsExe",summary:"Eject Game As EXE",parameters:[{name:"gameName",required:!0,in:"path",description:"Name of the game to be exported as EXE.",schema:{type:"string"}}],responses:{200:{description:"Exports the specified game as an EXE (Windows Electron App)."}},tags:["Manage Game"]}},"/api/manageGame/ejectGameAsAndroid/{gameName}":{get:{operationId:"ManageGameController_ejectGameAsAndroid",summary:"Eject Game As Android App",parameters:[{name:"gameName",required:!0,in:"path",description:"Name of the game to be exported as an Android app.",schema:{type:"string"}}],responses:{200:{description:"Exports the specified game as an Android app."}},tags:["Manage Game"]}},"/api/manageGame/deleteFile":{post:{operationId:"ManageGameController_deleteFile",summary:"Delete File",parameters:[],requestBody:{required:!0,description:"File deletion data",content:{"application/json":{schema:{$ref:"#/components/schemas/DeleteFileDto"}}}},responses:{200:{description:"Successfully deleted the file."},400:{description:"Failed to delete the file."}},tags:["Manage Game"]}},"/api/manageGame/createNewScene":{post:{operationId:"ManageGameController_createNewScene",summary:"Create a New Scene",parameters:[],requestBody:{required:!0,description:"Scene creation data",content:{"application/json":{schema:{$ref:"#/components/schemas/CreateNewSceneDto"}}}},responses:{200:{description:"Successfully created the scene."},400:{description:"Failed to create the scene or scene already exists."}},tags:["Manage Game"]}},"/api/manageGame/editScene":{post:{operationId:"ManageGameController_editScene",summary:"Edit Scene",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/EditSceneDto"}}}},responses:{200:{description:"Scene edited successfully."},400:{description:"Failed to edit the scene."}},tags:["Manage Game"]}},"/api/manageGame/editTextFile":{post:{operationId:"ManageGameController_editTextFile",summary:"Edit TextFile",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/EditTextFileDto"}}}},responses:{200:{description:"File edited successfully."},400:{description:"Failed to edit the file."}},tags:["Manage Game"]}},"/api/manageGame/uploadFiles":{post:{operationId:"ManageGameController_uploadFiles",summary:"Upload Files",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/UploadFilesDto"}}}},responses:{200:{description:"Files uploaded successfully."},400:{description:"Failed to upload files."}},tags:["Manage Game"]}},"/api/manageGame/mkdir":{post:{operationId:"ManageGameController_mkDir",summary:"Create Directory",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/MkDirDto"}}}},responses:{200:{description:"Directory created successfully."},400:{description:"Failed to create directory."}},tags:["Manage Game"]}},"/api/manageGame/{gameName}/scene/{fileName}":{get:{operationId:"ManageGameController_laodSceneFile",summary:"read scene file",parameters:[{name:"gameName",required:!0,in:"path",description:"game name.",schema:{type:"string"}},{name:"fileName",required:!0,in:"path",description:"scene file name.",schema:{type:"string"}}],responses:{200:{description:"return zh and en scene file"}},tags:["Manage Game"]}},"/api/llm/txt/v2/cache":{post:{operationId:"LlmController_mCache",summary:"Kimi模型资源存储",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/Llm"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["LLM"]}},"/api/llm/txt/v2/{tlmId}":{get:{operationId:"LlmController_txtV3",summary:"Maas文生文",parameters:[{name:"tlmId",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["LLM"]}},"/api/llm/recommend/{rid}/features":{get:{operationId:"LlmController_recommendFeatures",summary:"推荐角色人格",parameters:[{name:"rid",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["LLM"]}},"/api/llm/recommend/{bgid}/category":{get:{operationId:"LlmController_recommendCategory",summary:"推荐背景分类",parameters:[{name:"bgid",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["LLM"]}},"/api/llm/txt/v3/upload":{post:{operationId:"LlmController_uploadV3",summary:"发起文生文SSE处理",parameters:[],responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["LLM"]}},"/api/llm/image/upload":{post:{operationId:"LlmController_imageUpload",summary:"大模型图片上传接口",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/ImageUploadDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["LLM"]}},"/api/llm/sseTest":{get:{operationId:"LlmController_sse",parameters:[],responses:{200:{description:""}},tags:["LLM"]}},"/api/llm/upload/text":{post:{operationId:"LlmController_uploadText",summary:"上传文本文件返回文本,最大可接收5000字符",parameters:[],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["LLM"]}},"/api/llm/get/expression/list":{get:{operationId:"LlmController_getExpressionList",summary:"获取表情标签列表",parameters:[],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["LLM"]}},"/api/llm/draw/{event}/{reqId}":{get:{operationId:"LlmController_draw",summary:"获取绘图结果",parameters:[{name:"event",required:!0,in:"path",schema:{type:"string"}},{name:"reqId",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["LLM"]}},"/api/llm/draw/task":{get:{operationId:"LlmController_drawing",summary:"获取该用户下正在绘图的Reqs",parameters:[],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["LLM"]}},"/api/role/figure":{post:{operationId:"RoleController_createFigure",summary:"保存角色",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/AddRoleDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Role"]}},"/api/role/figure/img":{post:{operationId:"RoleController_uploadFigureImg",summary:"保存立绘/表情差分图图片",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/AddFigureDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Role"]}},"/api/role/list":{get:{operationId:"RoleController_listRole",summary:"获取该用户下角色列表",parameters:[],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Role"]}},"/api/role/{rid}":{put:{operationId:"RoleController_updateRole",summary:"更新角色",parameters:[{name:"rid",required:!0,in:"path",description:"角色ID",schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/UpdateRoleDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Role"]},delete:{operationId:"RoleController_deletedRole",summary:"删除角色",parameters:[{name:"rid",required:!0,in:"path",description:"角色ID",schema:{type:"string"}}],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Role"]}},"/api/role/test1":{get:{operationId:"RoleController_test",parameters:[],responses:{200:{description:""}},tags:["Role"]}},"/api/resource":{post:{operationId:"ResourceController_create",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CreateResourceDto"}}}},responses:{201:{description:""}},tags:["Resource"]}},"/api/resource/{id}":{get:{operationId:"ResourceController_findOne",parameters:[{name:"id",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:""}},tags:["Resource"]},patch:{operationId:"ResourceController_update",parameters:[{name:"id",required:!0,in:"path",schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/UpdateResourceDto"}}}},responses:{200:{description:""}},tags:["Resource"]},delete:{operationId:"ResourceController_remove",parameters:[{name:"id",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:""}},tags:["Resource"]}},"/api/bg/add":{post:{operationId:"BgController_createBg",summary:"保存背景信息",parameters:[],requestBody:{required:!0,description:"保存背景信息",content:{"application/json":{schema:{$ref:"#/components/schemas/CreateBgDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Bg"]}},"/api/bg/list":{get:{operationId:"BgController_list",summary:"获取背景信息列表",parameters:[],responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Bg"]}},"/api/bg/update/{bid}":{post:{operationId:"BgController_updateBg",summary:"更新背景信息",parameters:[{name:"bid",required:!0,in:"path",schema:{type:"string"}}],requestBody:{required:!0,description:"更新背景信息",content:{"application/json":{schema:{$ref:"#/components/schemas/UpdateBgDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Bg"]}},"/api/bg/uploadImage/{bid}":{post:{operationId:"BgController_uploadBgImg",summary:"保存背景图片",parameters:[{name:"bid",required:!0,in:"path",schema:{type:"string"}}],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/UploadImageDto"}}}},responses:{200:{description:"Successfully."},501:{description:"Failed."}},tags:["Bg"]}},"/api/bg/remove/{bid}":{delete:{operationId:"BgController_remove",summary:"删除背景信息",parameters:[{name:"bid",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:""}},tags:["Bg"]}},"/api/user/login":{post:{operationId:"UserController_login",summary:"用户登录",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CreateUserDto"}}}},responses:{200:{description:"Successfully."}},tags:["User"]}},"/api/user":{post:{operationId:"UserController_create",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/CreateUserDto"}}}},responses:{201:{description:""}},tags:["User"]}},"/api/editor/createNewScene":{post:{operationId:"EditorController_createNewScene",summary:"创建章节/场景",parameters:[],requestBody:{required:!0,description:"创建章节/场景",content:{"application/json":{schema:{$ref:"#/components/schemas/DialogueDto"}}}},responses:{200:{description:"Successfully created the scene."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/deleteScene":{post:{operationId:"EditorController_deleteScene",summary:"删除章节/场景",parameters:[],requestBody:{required:!0,description:"删除章节/场景",content:{"application/json":{schema:{$ref:"#/components/schemas/SceneDto"}}}},responses:{200:{description:"Successfully delete the scene."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/sceneDetail":{post:{operationId:"EditorController_getSceneDetail",summary:"查询场景详情内容",parameters:[],requestBody:{required:!0,description:"查询场景详情内容",content:{"application/json":{schema:{$ref:"#/components/schemas/SceneDetailDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/editUiScene/upload":{post:{operationId:"EditorController_uploadUiSceneDialogue",summary:"上传文本更新UI对话资源",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/DialogueDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/editUiScene/dialogue":{post:{operationId:"EditorController_editUiSceneDialogue",summary:"更新UI编辑器对话资源",parameters:[],requestBody:{required:!0,description:"更新UI编辑器对话资源",content:{"application/json":{schema:{$ref:"#/components/schemas/DialogueDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/scene/command/{id}":{post:{operationId:"EditorController_commandLine",summary:"根据行ID获取指令行",parameters:[{name:"id",required:!0,in:"path",description:"id",schema:{type:"string"}}],requestBody:{required:!0,description:"场景信息",content:{"application/json":{schema:{$ref:"#/components/schemas/SceneDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/scene/check":{post:{operationId:"EditorController_checkScene",summary:"校验场景信息",parameters:[],requestBody:{required:!0,description:"校验场景信息",content:{"application/json":{schema:{$ref:"#/components/schemas/SceneDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/editUiScene/resource":{post:{operationId:"EditorController_editUiSceneResource",summary:"更新UI编辑器场景资源",parameters:[],requestBody:{required:!0,description:"更新UI编辑器场景资源",content:{"application/json":{schema:{$ref:"#/components/schemas/UpdateUiResourceDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/editTxtScene/upload":{post:{operationId:"EditorController_uploadTxtSceneDialogue",summary:"上传文本更新TXT对话资源",parameters:[],requestBody:{required:!0,description:"更新文本编辑器内容",content:{"application/json":{schema:{$ref:"#/components/schemas/UpdateTxtSceneDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/editTxtScene":{post:{operationId:"EditorController_editTxtScene",summary:"更新文本编辑器内容",parameters:[],requestBody:{required:!0,description:"更新文本编辑器内容",content:{"application/json":{schema:{$ref:"#/components/schemas/UpdateTxtSceneDto"}}}},responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/rename":{post:{operationId:"EditorController_sceneFileRename",summary:"场景文件重命名",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/SceneReNameDto"}}}},responses:{200:{description:"Rename successfully."},400:{description:"Failed"}},tags:["Editor"]}},"/api/editor/getSectionSceneList/{gameName}":{post:{operationId:"EditorController_getSectionSceneList",summary:"获取章节场景列表数据",parameters:[{name:"gameName",required:!0,in:"path",description:"游戏名称",schema:{type:"string"}}],responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}},"/api/editor/launch/{gameName}":{get:{operationId:"EditorController_launchGame",summary:"发布游戏",parameters:[{name:"gameName",required:!0,in:"path",description:"游戏名称",schema:{type:"string"}}],responses:{200:{description:"Successfully."},400:{description:"Failed."}},tags:["Editor"]}}},r={title:"UMPAY.NETA Terre API",description:"API Refrence of UMPAY.NETA Terre Editor",version:"1.0",contact:{}},s=[],a=[],i={schemas:{CompletionDto:{type:"object",properties:{editorValue:{type:"string",description:"Editor input value for which the completion is required"},sceneType:{type:"string",description:"scene file type en or zh"},params:{type:"object",description:"Parameters required for completion"}},required:["editorValue","sceneType","params"]},CreateGameDto:{type:"object",properties:{gameName:{type:"string",description:"The name of the game to be created"}},required:["gameName"]},RenameDto:{type:"object",properties:{source:{type:"string",description:"The source path of the file or directory to be renamed"},newName:{type:"string",description:"New name for renaming the file or directory"}},required:["source","newName"]},DeleteGameDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"}},required:["gameName"]},GameConfigDto:{type:"object",properties:{gameName:{type:"string",description:"The name of the game"},newConfig:{type:"string",description:"New game configuration"}},required:["gameName","newConfig"]},UploadResourceDto:{type:"object",properties:{folder:{type:"string",description:"资源所属文件夹"}},required:["folder"]},DeleteResourceDto:{type:"object",properties:{name:{type:"string",description:"资源名称"}},required:["name"]},MkDirDto:{type:"object",properties:{source:{type:"string",description:"已有的资源文件夹"},name:{type:"string",description:"Name for the new directory"}},required:["source","name"]},DeleteFileDto:{type:"object",properties:{path:{type:"string",description:"The path to the file to be deleted"}},required:["path"]},CreateNewSceneDto:{type:"object",properties:{gameName:{type:"string",description:"The name of the game"},sceneName:{type:"string",description:"The name of the scene"}},required:["gameName","sceneName"]},EditSceneDto:{type:"object",properties:{gameName:{type:"string",description:"The name of the game"},sceneName:{type:"string",description:"The name of the scene"},type:{type:"string",description:"Scene data type en or zh"},sceneData:{type:"string",description:"Scene data content",format:"{ value: string }"}},required:["gameName","sceneName","type","sceneData"]},EditTextFileDto:{type:"object",properties:{path:{type:"string",description:"The path of textfile"},textFile:{type:"string",description:"Text data content"}},required:["path","textFile"]},UploadFilesDto:{type:"object",properties:{targetDirectory:{type:"string",description:"Target directory for the uploaded files"}},required:["targetDirectory"]},Llm:{type:"object",properties:{}},ImageUploadDto:{type:"object",properties:{category:{type:"string",description:"图片类别"},original:{type:"string",description:"蒙版对应原始图片名称"}},required:["category","original"]},AddRoleDto:{type:"object",properties:{name:{type:"string",description:"角色名字"},gender:{type:"string",description:"性别",enum:["male","female"]},style:{type:"string",description:"立绘风格"},age:{type:"string",description:"年纪",enum:["child","adult","hoariness"]}},required:["name","gender","style","age"]},AddFigureDto:{type:"object",properties:{fileUrl:{type:"string",description:"需要保存的文件地址"},rid:{type:"string",description:"角色ID"},expression:{type:"string",description:"差分名"}},required:["fileUrl","rid","expression"]},UpdateRoleDto:{type:"object",properties:{fileUrl:{type:"string",description:"主立绘的图片地址"},fileLink:{type:"string",description:"主立绘图片链接"},seed:{type:"string",description:"主立绘随机种子"},tlmId:{type:"string",description:"角色对应的大模型信息ID"},feature:{type:"string",description:"人格"},referPic:{type:"string",description:"人格参考图"},expression:{type:"string",description:"差分名"},prompts:{type:"string",description:"提示词"},figures:{description:"表情差分图",type:"array",items:{type:"string"}}},required:["fileUrl","fileLink","seed","tlmId","feature","referPic","expression","prompts","figures"]},CreateResourceDto:{type:"object",properties:{name:{type:"string",description:"资源名称"},path:{type:"string",description:"资源路径"},type:{type:"string",description:"资源类型"},uid:{type:"string",description:"用户ID"},pid:{type:"string",description:"父级资源ID"},remark:{type:"string",description:"备注"}},required:["name","path","type","uid","pid","remark"]},UpdateResourceDto:{type:"object",properties:{}},CreateBgDto:{type:"object",properties:{name:{type:"string",description:"背景名称"},style:{type:"string",description:"背景风格"}},required:["name","style"]},UpdateBgDto:{type:"object",properties:{prompts:{type:"string",description:"提示词"},tlmId:{type:"string",description:"背景对应大模型输出ID"},bgPath:{type:"string",description:"背景图片的相对地址"},category:{type:"string",description:"背景分类"},referPic:{type:"string",description:"背景分类参考图"}},required:["prompts","tlmId","bgPath","category","referPic"]},UploadImageDto:{type:"object",properties:{imageName:{type:"string",description:"图片名称"},imageUrl:{type:"string",description:"图片地址"},imageRelevancy:{type:"string",description:"图片所属:用户"},imageCategory:{type:"string",description:"图片类别"}},required:["imageName","imageUrl","imageRelevancy","imageCategory"]},CreateUserDto:{type:"object",properties:{username:{type:"string",description:"用户名"},password:{type:"string",description:"密码"},nickname:{type:"string",description:"昵称(可选填)"}},required:["username","password","nickname"]},DialogueDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"},sectionName:{type:"string",description:"章节名称(文本编辑器忽略)"},sceneName:{type:"string",description:"场景名称"},editorType:{type:"string",description:"编辑器类型"},dialogue:{type:"string",description:"更新对话"}},required:["gameName","sectionName","sceneName","editorType","dialogue"]},SceneDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"},sectionName:{type:"string",description:"章节名称(文本编辑器忽略)"},sceneName:{type:"string",description:"场景名称"},editorType:{type:"string",description:"编辑器类型"}},required:["gameName","sectionName","sceneName","editorType"]},SceneDetailDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"},sectionName:{type:"string",description:"章节名称(文本编辑器忽略)"},sceneName:{type:"string",description:"场景名称"},editorType:{type:"string",description:"编辑器类型"},sceneType:{type:"string",description:"场景类型"}},required:["gameName","sectionName","sceneName","editorType","sceneType"]},UpdateUiResourceDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"},sectionName:{type:"string",description:"章节名称(文本编辑器忽略)"},sceneName:{type:"string",description:"场景名称"},editorType:{type:"string",description:"编辑器类型"},bg:{type:"string",description:"更新背景"},bgm:{type:"string",description:"更新音乐"}},required:["gameName","sectionName","sceneName","editorType","bg","bgm"]},UpdateTxtSceneDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"},sectionName:{type:"string",description:"章节名称(文本编辑器忽略)"},sceneName:{type:"string",description:"场景名称"},editorType:{type:"string",description:"编辑器类型"},text:{type:"string",description:"编辑文本"}},required:["gameName","sectionName","sceneName","editorType","text"]},SceneReNameDto:{type:"object",properties:{gameName:{type:"string",description:"游戏名称"},sectionName:{type:"string",description:"章节名称(文本编辑器忽略)"},sceneName:{type:"string",description:"场景名称"},editorType:{type:"string",description:"编辑器类型"},newSectionName:{type:"string",description:"新章节名称"},newSceneName:{type:"string",description:"新场景名称"}},required:["gameName","sectionName","sceneName","editorType","newSectionName","newSceneName"]}}},o={openapi:e,paths:t,info:r,tags:s,servers:a,components:i};exports.components=i,exports.default=o,exports.info=r,exports.openapi=e,exports.paths=t,exports.servers=a,exports.tags=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="1.3.8",i="FE command line tool",s="bin/an-cli.js",t={dev:"rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript -w",build:"rimraf lib && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",pub:"bash publish.sh",ts:"tsc ./src/int.ts --noEmit --watch"},p={anl:"bin/an-cli.js"},l="Gleason <bianliuzhu@gmail.com>",r={"@commitlint/cli":"^17.4.3","@commitlint/config-conventional":"^17.4.3","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.1.3","@rollup/plugin-typescript":"^8.3.0","@types/inquirer":"^9.0.3","@types/shelljs":"^0.8.11","@typescript-eslint/eslint-plugin":"^5.52.0","@typescript-eslint/parser":"^5.52.0",eslint:"^8.7.0",husky:"^8.0.3","openapi-types":"^9.3.0",prettier:"^3.3.2",rimraf:"^5.0.7",rollup:"^2.64.0","rollup-plugin-cleandir":"^2.0.0","rollup-plugin-terser":"^7.0.2",typescript:"^4.5.4"},o={"app-root-path":"^3.1.0",cac:"^6.7.12",chalk:"4.*","clear-console":"^1.1.0",commander:"^10.0.0",figures:"^6.1.0",inquirer:"^10.1.8","log-symbols":"^5.1.0",ora:"5.*","progress-estimator":"^0.3.0",shelljs:"^0.8.5"},n=["typescript","cli","typescript 脚手架","ts 脚手架","ts-cli","脚手架"],c=["package.json","README.md","lib","template"],u={type:"git",url:"https://github.com/bianliuzhu/an-cli.git"},a="commonjs",g={name:"anl",version:e,description:i,main:s,scripts:t,bin:p,author:l,license:"ISC",devDependencies:r,dependencies:o,keywords:n,files:c,repository:u,type:a};exports.author=l,exports.bin=p,exports.default=g,exports.dependencies=o,exports.description=i,exports.devDependencies=r,exports.files=c,exports.keywords=n,exports.license="ISC",exports.main=s,exports.name="anl",exports.repository=u,exports.scripts=t,exports.type=a,exports.version=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="1.3.11",i="FE command line tool",s="bin/an-cli.js",t={dev:"rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript -w",build:"rimraf lib && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",pub:"bash publish.sh",ts:"tsc ./src/int.ts --noEmit --watch"},p={anl:"bin/an-cli.js"},l="Gleason <bianliuzhu@gmail.com>",r={"@commitlint/cli":"^17.4.3","@commitlint/config-conventional":"^17.4.3","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.1.3","@rollup/plugin-typescript":"^8.3.0","@types/inquirer":"^9.0.3","@types/shelljs":"^0.8.11","@typescript-eslint/eslint-plugin":"^5.52.0","@typescript-eslint/parser":"^5.52.0",eslint:"^8.7.0",husky:"^8.0.3","openapi-types":"^9.3.0",prettier:"^3.3.2",rimraf:"^5.0.7",rollup:"^2.64.0","rollup-plugin-cleandir":"^2.0.0","rollup-plugin-terser":"^7.0.2",typescript:"^4.5.4"},o={"app-root-path":"^3.1.0",cac:"^6.7.12",chalk:"4.*","clear-console":"^1.1.0",commander:"^10.0.0",figures:"^6.1.0",inquirer:"^10.1.8","log-symbols":"^5.1.0",ora:"5.*","progress-estimator":"^0.3.0",shelljs:"^0.8.5"},n=["typescript","cli","typescript 脚手架","ts 脚手架","ts-cli","脚手架"],c=["package.json","README.md","lib","template"],u={type:"git",url:"https://github.com/bianliuzhu/an-cli.git"},a="commonjs",g={name:"anl",version:e,description:i,main:s,scripts:t,bin:p,author:l,license:"ISC",devDependencies:r,dependencies:o,keywords:n,files:c,repository:u,type:a};exports.author=l,exports.bin=p,exports.default=g,exports.dependencies=o,exports.description=i,exports.devDependencies=r,exports.files=c,exports.keywords=n,exports.license="ISC",exports.main=s,exports.name="anl",exports.repository=u,exports.scripts=t,exports.type=a,exports.version=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/index.js");const t="\t";var n;!function(e){e.GET="get",e.PUT="put",e.POST="post",e.DELETE="delete",e.OPTIONS="options",e.HEAD="head",e.PATCH="patch",e.TRACE="trace"}(n||(n={}));const s={namespace:"",payload:{path:[],query:[],body:[]},response:"",_response:"",fileName:"",method:"",path:"",summary:""};class r{pathsObject={};nonArrayType=["boolean","object","number","string","integer"];pathKey="";contentBody=s;Map=new Map;config;constructor(e,t){this.pathsObject=e,this.config=t}pathTranslantionName(e,t){let n=e;e.startsWith("/")||(n="/"+e);return{name:n.slice(1).replace(/\/\{\w+\}/g,(()=>"")).replace(/\/\w/g,(e=>{const[,t]=e.split("");return t.toUpperCase()})).replace(/(\/api)|(api)/g,""),method:t}}pathTranslantionFileName(e){let t=e;e.startsWith("/")||(t="/"+e);const n=t.replace(/(\/api)|(api)/g,"").replace(/\{\w+\}/g,(e=>`$${e}`));return{name:t.slice(1).replace(/\//g,"-").replace("api-",""),path:n}}typeNameToFileName(e){return e.replace(/([A-Z][a-z])/g,(e=>"-"+e.toLowerCase())).replace(/([A-Z]{2,})/g,"-$1").toLowerCase().slice(1)}propertiesParse(e){const n=[];for(const s in e){const r=e[s],a=this.schemaParse(r);let o="";o=Array.isArray(a)?`${t}${t}${s}:{${a.join("\n")}};`:`${t}${t}${s}:${a};`,n.push(o)}return n}nonArraySchemaObjectParse(e){if(!e)return"unknown";switch(e.type){case"boolean":return"boolean";case"integer":case"number":return"number";case"object":return this.propertiesParse(e.properties);case"string":return"string";default:return"unknown"}}arraySchemaObjectParse(e){if("array"!==e.type)return"";const{items:t}=e,n="$ref"in t?t:null,s=t;if(n){return`Array<${this.referenceObjectParse(n)}>`}if(s){const e=this.schemaParse(t);if(Array.isArray(e)){return`Array<{${e.join("\n")}}>`}return`Array<${e}>`}return""}referenceObjectParse(e){if(!e)return"";const t=e.$ref.replace("#/components/schemas/","");return`import('../models/${this.typeNameToFileName(t)}').${t}`}schemaParse(e){if(!e)return"unknown";const t=e?.type,n="$ref"in e?e:null,s="array"===t?e:null,r=t&&this.nonArrayType.includes(t)?e:null;return n?this.referenceObjectParse(n):s?this.arraySchemaObjectParse(s):r?this.nonArraySchemaObjectParse(r):"unknown"}responseObjectParse(e){const t=e.content;if(!t)return"";const{schema:n}=Object.values(t)[0];if(n){return this.schemaParse(n)}}responseHandle(e){const t=e[200];if(!t)return;const n="content"in t?t:null,s="$ref"in t?t:null;if(null===n&&null===s&&(this.contentBody.response="type Response = void",this.contentBody._response="void"),s){const e=this.referenceObjectParse(s);this.contentBody.response=`type Response = ${e}`,this.contentBody._response=e}if(n){const e=this.responseObjectParse(n);Array.isArray(e)?(this.contentBody.response=`interface Response {${e.join("\n")}} `,this.contentBody._response=`${e.join("\n")}`):(this.contentBody.response=`type Response = ${e}`,this.contentBody._response=`${e}`)}}requestBodyObjectParse(e){const n=Object.values(e.content),{schema:s}=Array.isArray(n)&&n.length>0?n[0]:{schema:null};if(s){const e=s?.type,n="$ref"in s?s:null,r="array"===e?s:null,a=e&&this.nonArrayType.includes(e)?s:null;if(n){const e=this.referenceObjectParse(n);return`${t}type Body = ${e}`}if(r){const e=this.arraySchemaObjectParse(r);return`${t}type Body = ${e}`}if(a){const e=this.nonArraySchemaObjectParse(a);return Array.isArray(e)?0===e.length?[`${t}type Body = void`]:[`${t}interface Body {`,...e,"}"]:[`${t}type Body = ${e}`]}}}requestBodyParse(e){if(!e)return"{}";const n="$ref"in e?e:null,s="content"in e?e:null;if(n){const e=this.referenceObjectParse(n);return`${t}type Body = ${e}`}return s&&"[object Object]"===String(e)&&0!==Reflect.ownKeys(e).length?this.requestBodyObjectParse(s):"{}"}requestParametersParse(e){const n=[],s=[];e?.map((e=>{const r="$ref"in e?e:null,a="name"in e?e:null;if(r){const e=this.referenceObjectParse(r);return console.log(this.pathKey,e,"item 是 ReferenceObject 类型","----未处理---"),e}if(a){if("path"===a.in){const e=this.schemaParse(a.schema);n.push(`${t}${t}type ${a.name} = ${e};`),this.contentBody.payload._path?"string"==typeof e?this.contentBody.payload._path[a.name]=e:console.log(e):"string"==typeof e?this.contentBody.payload._path={[a.name]:e}:console.log(e)}if("query"===a.in){const e=this.schemaParse(a.schema);s.push(`${t}${t}${a.name}: ${e};`),this.contentBody.payload._query?"string"==typeof e?this.contentBody.payload._query[a.name]=e:console.log(e):"string"==typeof e?this.contentBody.payload._query={[a.name]:e}:console.log(e)}}})),0!==n.length&&(n.unshift(`${t}namespace Path {`),n.push(`${t}}`)),0!==s.length&&(s.unshift(`${t}interface Query {`),s.push(`${t}}`)),this.contentBody.payload.path=n,this.contentBody.payload.query=s}requestHandle(e){if(e.parameters&&this.requestParametersParse(e.parameters),e.requestBody){const t=this.requestBodyParse(e.requestBody);if(Array.isArray(t))this.contentBody.payload.body=t;else if(t){const e=t?.split("\n")||[];this.contentBody.payload.body=e}}}parsePathItemObject(e){for(const t in n){const n=e[t.toLowerCase()];if(n){this.pathKey;const{name:e,method:s}=this.pathTranslantionName(this.pathKey,t);this.requestHandle(n),this.responseHandle(n.responses),this.contentBody.method=s,this.contentBody.namespace=e+s,this.contentBody.summary=n.summary}}}initialize(){return new Promise(((e,t)=>{try{for(const e in this.pathsObject){const t=this.pathsObject[e];if(this.pathKey=e,t){const n=this.pathTranslantionFileName(e);this.contentBody.fileName=n.name,this.contentBody.path=n.path,this.parsePathItemObject(t),this.Map.set(e,this.contentBody),this.contentBody={namespace:"",payload:{path:[],query:[],body:[]},response:"",_response:"",fileName:"",method:"",path:"",summary:""}}}e(this.Map)}catch(e){t(e)}}))}writeApiListFile(e){const{namespace:t,payload:n,method:s,path:r,_response:a,summary:o}=e,{_path:i,_query:c,body:p}=n,h=t.replace(t[0],t[0].toLowerCase()),l=e=>{const n=[];for(const s in e)n.push(`${s}: ${t}.Path.${s}`);return n.length>1?n.join(","):n.join("")},y=i?l(i):"",u=c?`params: ${t}.Query`:"",d=p.length>0?`params: ${t}.Body`:"",m={};y&&(m.apiParamsPath=y),u&&(m.apiParamsQuery=u),d&&(m.apiParamsBody=d);const f=Object.keys(m).length>=2;return[`export const ${h} = `,"(",i?l(i):"",""+(f?",":""),c?`params: ${t}.Query`:"",p.length>0?`params: ${t}.Body`:"",")"," => ",`${s}${a?`<${t}.Response>`:""}`,"(`"+r+"`"+(u||d?", params":"")+");"].join("")}writeFileHabdler(){const n=[],s=[],r=this.config.saveTypeFolderPath,a=[],o=(n,o)=>new Promise(((n,i)=>{try{const{namespace:c,payload:p,response:h,fileName:l,method:y,summary:u}=o;!a.includes(y)&&a.push(y);const d=[`declare namespace ${c} {`,...p.path,...p.query,...p.body,`${t}${h}`,"}"],m=["/**","\n",` * ${u}`,"\n"," */"].join("");u&&s.push(m);const f=this.writeApiListFile(o);s.push(f,"\n"),e.writeFileRecursive(`${r}/api/${l}.d.ts`,d.join("\n")).then((()=>n(1))).catch((e=>{i(e),console.error(e)}))}catch(e){console.error(e,!0),i()}}));for(const[e,t]of this.Map)n.push(o(0,t));Promise.all(n).then((()=>{s.unshift(`import { ${a.join(", ")} } from './api';`,"\n"),e.clearDir(this.config.apiListFilePath+"/index.ts").finally((()=>{e.writeFileRecursive(this.config.apiListFilePath+"/index.ts",s.join("\n")).then((()=>{console.log("path parse done!"),this.Map=new Map})).catch((e=>{console.error("-----------\x3e",e)}))}))}))}handle(){this.initialize().then((()=>this.writeFileHabdler()))}}exports.PathParse=r,exports.default=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/index.js");const t="\t";var n;!function(e){e.GET="get",e.PUT="put",e.POST="post",e.DELETE="delete",e.OPTIONS="options",e.HEAD="head",e.PATCH="patch",e.TRACE="trace"}(n||(n={}));const s={payload:{path:[],query:[],body:[]},response:"",_response:"",fileName:"",apiName:"",typeName:"",method:"",requestPath:"",summary:""};class r{pathsObject={};nonArrayType=["boolean","object","number","string","integer"];pathKey="";contentBody=s;Map=new Map;config;constructor(e,t){this.pathsObject=e,this.config=t}typeNameToFileName(e){return e.replace(/([A-Z][a-z])/g,(e=>"-"+e.toLowerCase())).replace(/([A-Z]{2,})/g,"-$1").toLowerCase().slice(1)}propertiesParse(e){const n=[];for(const s in e){const r=e[s],a=this.schemaParse(r);let o="";o=Array.isArray(a)?`${t}${t}${s}:{${a.join("\n")}};`:`${t}${t}${s}:${a};`,n.push(o)}return n}nonArraySchemaObjectParse(e){if(!e)return"unknown";switch(e.type){case"boolean":return"boolean";case"integer":case"number":return"number";case"object":return this.propertiesParse(e.properties);case"string":return"string";default:return"unknown"}}arraySchemaObjectParse(e){if("array"!==e.type)return"";const{items:t}=e,n="$ref"in t?t:null,s=t;if(n){return`Array<${this.referenceObjectParse(n)}>`}if(s){const e=this.schemaParse(t);if(Array.isArray(e)){return`Array<{${e.join("\n")}}>`}return`Array<${e}>`}return""}referenceObjectParse(e){if(!e)return"";const t=e.$ref.replace("#/components/schemas/","");return`import('../models/${this.typeNameToFileName(t)}').${t}`}schemaParse(e){if(!e)return"unknown";const t=e?.type,n="$ref"in e?e:null,s="array"===t?e:null,r=t&&this.nonArrayType.includes(t)?e:null;return n?this.referenceObjectParse(n):s?this.arraySchemaObjectParse(s):r?this.nonArraySchemaObjectParse(r):"unknown"}responseObjectParse(e){const t=e.content;if(!t)return"";const{schema:n}=Object.values(t)[0];if(n){return this.schemaParse(n)}}responseHandle(e){const t=e[200];if(!t)return;const n="content"in t?t:null,s="$ref"in t?t:null;if(null===n&&null===s&&(this.contentBody.response="type Response = unknown",this.contentBody._response="unknown"),s){const e=this.referenceObjectParse(s);this.contentBody.response=`type Response = ${e}`,this.contentBody._response=e}if(n){const e=this.responseObjectParse(n);Array.isArray(e)?(this.contentBody.response=`interface Response {${e.join("\n")}} `,this.contentBody._response=`${e.join("\n")}`):(this.contentBody.response=`type Response = ${e}`,this.contentBody._response=`${e}`)}}requestBodyObjectParse(e){const n=Object.values(e.content),{schema:s}=Array.isArray(n)&&n.length>0?n[0]:{schema:null};if(s){const e=s?.type,n="$ref"in s?s:null,r="array"===e?s:null,a=e&&this.nonArrayType.includes(e)?s:null;if(n){const e=this.referenceObjectParse(n);return`${t}type Body = ${e}`}if(r){const e=this.arraySchemaObjectParse(r);return`${t}type Body = ${e}`}if(a){const e=this.nonArraySchemaObjectParse(a);return Array.isArray(e)?0===e.length?[`${t}type Body = unknown`]:[`${t}interface Body {`,...e,"}"]:[`${t}type Body = ${e}`]}}}requestBodyParse(e){if(!e)return"{}";const n="$ref"in e?e:null,s="content"in e?e:null;if(n){const e=this.referenceObjectParse(n);return`${t}type Body = ${e}`}return s&&"[object Object]"===String(e)&&0!==Reflect.ownKeys(e).length?this.requestBodyObjectParse(s):"{}"}requestParametersParse(e){const n=[],s=[];e?.map((e=>{const r="$ref"in e?e:null,a="name"in e?e:null;if(r){const e=this.referenceObjectParse(r);return console.log(this.pathKey,e,"item 是 ReferenceObject 类型","----未处理---"),e}if(a){if("path"===a.in){const e=this.schemaParse(a.schema);n.push(`${t}${t}type ${a.name} = ${e};`),this.contentBody.payload._path?"string"==typeof e?this.contentBody.payload._path[a.name]=e:console.log(e):"string"==typeof e?this.contentBody.payload._path={[a.name]:e}:console.log(e)}if("query"===a.in){const e=this.schemaParse(a.schema);s.push(`${t}${t}${a.name}: ${e};`),this.contentBody.payload._query?"string"==typeof e?this.contentBody.payload._query[a.name]=e:console.log(e):"string"==typeof e?this.contentBody.payload._query={[a.name]:e}:console.log(e)}}})),0!==n.length&&(n.unshift(`${t}namespace Path {`),n.push(`${t}}`)),0!==s.length&&(s.unshift(`${t}interface Query {`),s.push(`${t}}`)),this.contentBody.payload.path=n,this.contentBody.payload.query=s}requestHandle(e){if(e.parameters&&this.requestParametersParse(e.parameters),e.requestBody){const t=this.requestBodyParse(e.requestBody);if(Array.isArray(t))this.contentBody.payload.body=t;else if(t){const e=t?.split("\n")||[];this.contentBody.payload.body=e}}}parsePathItemObject(e,t){if(e)for(const n in e){const s=e[n];if(s){const e=n.toUpperCase(),r=t+"|"+e,{apiName:a,typeName:o,fileName:i,path:c}=this.convertEndpointString(r);this.contentBody.method=e,this.contentBody.typeName=o,this.contentBody.summary=s.summary,this.contentBody.fileName=i,this.contentBody.requestPath=c,this.contentBody.apiName=a,this.requestHandle(s),this.responseHandle(s.responses),this.Map.has(r)||this.Map.set(r,JSON.parse(JSON.stringify(this.contentBody))),this.contentBody={payload:{path:[],query:[],body:[]},response:"",_response:"",fileName:"",method:"",requestPath:"",summary:"",apiName:"",typeName:""}}}}initialize(){return new Promise(((e,t)=>{try{for(const e in this.pathsObject){const t=this.pathsObject[e];t&&this.parsePathItemObject(t,e)}e(this.Map)}catch(e){t(e)}}))}convertEndpointString(e){let t=e;e.startsWith("/")||(t="/"+e);const[n,s]=t.split("|"),r=`${n.replace("/api/","").split("/").map((e=>e.includes("{")?`$${e.slice(1,-1)}`:e.charAt(0).toUpperCase()+e.slice(1))).join("")}_${s}`;return{apiName:r.charAt(0).toLowerCase()+r.slice(1),fileName:(n.slice(1).replace(/\//g,"-").replace("api-","")+"-"+s).toLowerCase(),typeName:r.charAt(0).toUpperCase()+r.slice(1),path:n.replace(/(\/api)|(api)/g,"").replace(/\{\w+\}/g,(e=>`$${e}`))}}apiRequestItemHandle(e){const{payload:t,requestPath:n,_response:s,method:r,typeName:a,apiName:o}=e,{_path:i,_query:c,body:p}=t,h=e=>{const t=[];for(const n in e)t.push(`${n}: ${a}.Path.${n}`);return t.length>1?t.join(","):t.join("")},y=i?h(i):"",l=c?`params: ${a}.Query`:"",u=p.length>0?`params: ${a}.Body`:"",d={};y&&(d.apiParamsPath=y),l&&(d.apiParamsQuery=l),u&&(d.apiParamsBody=u);const m=Object.keys(d).length>=2;return[`export const ${o} = `,"(",i?h(i):"",""+(m?",":""),c?`params: ${a}.Query`:"",p.length>0?`params: ${a}.Body`:"",")"," => ",`${r}${s?`<${a}.Response>`:""}`,"(`"+n+"`"+(l||u?", params":"")+");"].join("")}writeFileHabdler(){const n=[],s=[],r=this.config.saveTypeFolderPath,a=[],o=(n,o)=>new Promise(((i,c)=>{try{const{payload:p,response:h,fileName:y,summary:l,typeName:u}=o,[,d]=n.split("|");!a.includes(d)&&a.push(d);const m=[`declare namespace ${u} {`,...p.path,...p.query,...p.body,`${t}${h}`,"}"],f=["/**","\n",` * ${l}`,"\n"," */"].join("");l&&s.push(f);const $=this.apiRequestItemHandle(o);s.push($,"\n"),e.writeFileRecursive(`${r}/api/${y}.d.ts`,m.join("\n")).then((()=>i(1))).catch((e=>{c(e),console.error(e)}))}catch(e){console.error(e,!0),c()}}));for(const[e,t]of this.Map)console.log(e),n.push(o(e,t));Promise.all(n).then((()=>{s.unshift(`import { ${a.join(", ")} } from '${this.config.requestMethodsImportPath||"./api"}';`,"\n"),e.clearDir(this.config.apiListFilePath+"/index.ts").finally((()=>{e.writeFileRecursive(this.config.apiListFilePath+"/index.ts",s.join("\n")).then((()=>{console.log("path parse done!"),this.Map=new Map})).catch((e=>{console.error("-----------\x3e",e)}))}))}))}handle(){this.initialize().then((()=>this.writeFileHabdler()))}}exports.PathParse=r,exports.default=r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),s=require("../utils/index.js"),t=require("./core/components.js"),r=require("./core/get-data.js"),a=require("./core/path.js"),o=require("shelljs");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e);const l={saveTypeFolderPath:"apps/types",apiListFilePath:"apps/services",swaggerJsonUrl:"",indent:"\t",headers:{}};exports.Main=class{schemas={};paths={};handle(e){return new Promise((s=>{if(!e.swaggerJsonUrl)return s({});r.getSwaggerJson(e).then((r=>{const o=r;this.schemas=o.components?.schemas,this.paths=o.paths;new t.default(this.schemas,e).handle();new a.PathParse(this.paths,e).handle(),s({})})).catch((()=>{s({})}))}))}initialize(){const e=process.cwd()+"/an.config.json";s.isFileExisted(e).then((()=>{n.default.readFile(e,"utf8",((e,t)=>{if(e)return void console.error(e);const r=JSON.parse(t);console.log("config ----\x3e",r),s.clearDir(r.saveTypeFolderPath).then((()=>{this.handle(r).then((e=>{console.log("format: ",`prettier --write "${r.saveTypeFolderPath}/**/*.{ts,d.ts}"`),o.exec(`prettier --write "${r.saveTypeFolderPath}/**/*.{ts,d.ts}"`)})).catch((e=>{console.log(e)}))}))}))})).catch((t=>{s.clearDir(l.saveTypeFolderPath).then((()=>{s.writeFileRecursive(e,JSON.stringify(l,null,2)).catch((e=>{console.log(e)})).finally((()=>{this.handle(l)}))})),console.error(t)}))}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs"),t=require("../../data/umf.json.js"),s=require("../utils/index.js"),r=require("./core/components.js");require("http"),require("https"),require("path");var a=require("./core/path.js"),i=require("shelljs");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(e);const l={saveTypeFolderPath:"apps/types",apiListFilePath:"apps/services",swaggerJsonUrl:"",requestMethodsImportPath:"./fetch",indent:"\t",headers:{}};class h{schemas={};paths={};handle(e){return new Promise(((s,i)=>{const o=t.default;this.schemas=o.components?.schemas,this.paths=o.paths;new r.default(this.schemas,e).handle();return new a.PathParse(this.paths,e).handle(),s(!0)}))}initialize(){const e=process.cwd()+"/an.config.json";s.isFileExisted(e).then((()=>{n.default.readFile(e,"utf8",((e,t)=>{if(e)return void console.error(e);const r=JSON.parse(t);console.log("config ----\x3e",r),s.clearDir(r.saveTypeFolderPath).then((()=>{this.handle(r).then((e=>{console.log("format: ",`prettier --write "${r.saveTypeFolderPath}/**/*.{ts,d.ts}"`),i.exec(`prettier --write "${r.saveTypeFolderPath}/**/*.{ts,d.ts}"`)})).catch((e=>{console.log(e)}))}))}))})).catch((t=>{console.error("配置文件不存在,将自动创建配置文件!"),s.clearDir(l.saveTypeFolderPath).then((()=>{s.writeFileRecursive(e,JSON.stringify(l,null,2)).catch((e=>{console.log(e)})).finally((()=>{this.handle(l)}))}))}))}}(new h).initialize(),exports.Main=h;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anl",
3
- "version": "1.3.9",
3
+ "version": "1.3.12",
4
4
  "description": "FE command line tool",
5
5
  "main": "bin/an-cli.js",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("http"),t=require("https"),r=require("path"),o=require("../tools/index.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=s(e),u=s(t),c=s(r);function i({swaggerJsonUrl:e,headers:t={}}){return new Promise(((r,o)=>{let s;const c=/^https/.test(e)?u.default.request:n.default.request;console.info(`Request Start: ${e}`);const i=c(e,{method:"GET",rejectUnauthorized:!1,headers:{Accept:"*/*","Accept-Encoding":"utf-8","Content-Type":"application/x-www-form-urlencoded",...t}},(t=>{t.setEncoding("utf-8");let n="";t.on("data",(e=>{n+=e.toString()})),t.on("end",(()=>{clearTimeout(s);try{const t=JSON.parse(n);console.info(`Request Successful: ${e}`),r(t)}catch(t){console.error(`Request Failed: ${e}`,!0),o(t)}})),t.on("error",(t=>{console.error(`Request Failed: ${e}`,!0),o(t)}))}));i.on("timeout",(e=>{console.error(e,!0),o(e)})),s=setTimeout((()=>{const t=new Error;t.name="Request Timeout",t.message=e,i.emit("timeout",t)}),15e3),i.end()}))}exports.getSwaggerJson=async function(e){if(/^https?:\/\//.test(e.swaggerJsonUrl))return i(e);try{const t=o.requireModule(c.default.join("",e.swaggerJsonUrl));return Promise.resolve(t)}catch(e){return console.error(e,!0),Promise.reject(e)}},exports.requestJson=i;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("fs"),require("path"),exports.requireModule=function(e,r=!0){try{const t=require(e);return r&&setTimeout((()=>{delete require.cache[require.resolve(e)]}),200),t}catch(e){throw new Error(e)}};