diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..c0e288db --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +dist +node_modules +.vite +coverage +package-lock.json +workflows/api-doc-sync/data/history diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..a7a33f09 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "semi": true, + "singleQuote": false, + "printWidth": 100, + "tabWidth": 2, + "trailingComma": "all" +} diff --git a/dist.tar.gz b/dist.tar.gz index e142115e..a4b20041 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..6ea220f1 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,43 @@ +import js from "@eslint/js"; +import tseslint from "typescript-eslint"; +import vueParser from "vue-eslint-parser"; +import vuePlugin from "eslint-plugin-vue"; +import eslintConfigPrettier from "eslint-config-prettier"; + +export default [ + { + ignores: [ + "dist/**", + "node_modules/**", + "coverage/**", + ".vite/**", + "workflows/api-doc-sync/data/history/**", + ], + }, + js.configs.recommended, + ...tseslint.configs.recommended, + ...vuePlugin.configs["flat/recommended"], + { + files: ["**/*.{ts,tsx,vue,js,mjs,cjs}"], + languageOptions: { + parser: vueParser, + parserOptions: { + parser: tseslint.parser, + ecmaVersion: "latest", + sourceType: "module", + extraFileExtensions: [".vue"], + }, + globals: { + fetch: "readonly", + AbortSignal: "readonly", + console: "readonly", + process: "readonly", + }, + }, + rules: { + "no-console": "off", + "vue/multi-word-component-names": "off", + }, + }, + eslintConfigPrettier, +]; diff --git a/package-lock.json b/package-lock.json index 04a86da6..594aac00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "xlsx": "^0.18.5" }, "devDependencies": { + "@eslint/js": "^10.0.1", "@tsconfig/node24": "^24.0.4", "@types/js-cookie": "^3.0.6", "@types/node": "^24.11.0", @@ -42,14 +43,19 @@ "@types/three": "^0.183.1", "@vitejs/plugin-vue": "^6.0.4", "@vue/tsconfig": "^0.8.1", + "eslint": "^10.2.0", + "eslint-config-prettier": "^10.1.8", "eslint-plugin-vue": "^10.8.0", "fast-glob": "^3.3.3", "npm-run-all2": "^8.0.4", + "prettier": "^3.8.2", "sass": "^1.97.3", "typescript": "~5.9.3", + "typescript-eslint": "^8.58.2", "vite": "^7.3.1", "vite-plugin-svg-icons": "^2.0.1", "vite-plugin-vue-devtools": "^8.0.6", + "vue-eslint-parser": "^10.4.0", "vue-tsc": "^3.2.5" }, "engines": { @@ -1021,13 +1027,13 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.23.3", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.3.tgz", - "integrity": "sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw==", + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^3.0.3", + "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^10.2.4" }, @@ -1036,22 +1042,22 @@ } }, "node_modules/@eslint/config-helpers": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.3.tgz", - "integrity": "sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.5.tgz", + "integrity": "sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.1.1" + "@eslint/core": "^1.2.1" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@eslint/core": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.1.1.tgz", - "integrity": "sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -1061,10 +1067,31 @@ "node": "^20.19.0 || ^22.13.0 || >=24" } }, + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, "node_modules/@eslint/object-schema": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.3.tgz", - "integrity": "sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", "dev": true, "license": "Apache-2.0", "engines": { @@ -1072,13 +1099,13 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.6.1.tgz", - "integrity": "sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.1.tgz", + "integrity": "sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.1.1", + "@eslint/core": "^1.2.1", "levn": "^0.4.1" }, "engines": { @@ -2134,6 +2161,250 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.2.tgz", + "integrity": "sha512-aC2qc5thQahutKjP+cl8cgN9DWe3ZUqVko30CMSZHnFEHyhOYoZSzkGtAI2mcwZ38xeImDucI4dnqsHiOYuuCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.58.2", + "@typescript-eslint/type-utils": "8.58.2", + "@typescript-eslint/utils": "8.58.2", + "@typescript-eslint/visitor-keys": "8.58.2", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.58.2", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.2.tgz", + "integrity": "sha512-/Zb/xaIDfxeJnvishjGdcR4jmr7S+bda8PKNhRGdljDM+elXhlvN0FyPSsMnLmJUrVG9aPO6dof80wjMawsASg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.58.2", + "@typescript-eslint/types": "8.58.2", + "@typescript-eslint/typescript-estree": "8.58.2", + "@typescript-eslint/visitor-keys": "8.58.2", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.2.tgz", + "integrity": "sha512-Cq6UfpZZk15+r87BkIh5rDpi38W4b+Sjnb8wQCPPDDweS/LRCFjCyViEbzHk5Ck3f2QDfgmlxqSa7S7clDtlfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.58.2", + "@typescript-eslint/types": "^8.58.2", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.2.tgz", + "integrity": "sha512-SgmyvDPexWETQek+qzZnrG6844IaO02UVyOLhI4wpo82dpZJY9+6YZCKAMFzXb7qhx37mFK1QcPQ18tud+vo6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.58.2", + "@typescript-eslint/visitor-keys": "8.58.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.2.tgz", + "integrity": "sha512-3SR+RukipDvkkKp/d0jP0dyzuls3DbGmwDpVEc5wqk5f38KFThakqAAO0XMirWAE+kT00oTauTbzMFGPoAzB0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.2.tgz", + "integrity": "sha512-Z7EloNR/B389FvabdGeTo2XMs4W9TjtPiO9DAsmT0yom0bwlPyRjkJ1uCdW1DvrrrYP50AJZ9Xc3sByZA9+dcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.58.2", + "@typescript-eslint/typescript-estree": "8.58.2", + "@typescript-eslint/utils": "8.58.2", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.2.tgz", + "integrity": "sha512-9TukXyATBQf/Jq9AMQXfvurk+G5R2MwfqQGDR2GzGz28HvY/lXNKGhkY+6IOubwcquikWk5cjlgPvD2uAA7htQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.2.tgz", + "integrity": "sha512-ELGuoofuhhoCvNbQjFFiobFcGgcDCEm0ThWdmO4Z0UzLqPXS3KFvnEZ+SHewwOYHjM09tkzOWXNTv9u6Gqtyuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.58.2", + "@typescript-eslint/tsconfig-utils": "8.58.2", + "@typescript-eslint/types": "8.58.2", + "@typescript-eslint/visitor-keys": "8.58.2", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.2.tgz", + "integrity": "sha512-QZfjHNEzPY8+l0+fIXMvuQ2sJlplB4zgDZvA+NmvZsZv3EQwOcc1DuIU1VJUTWZ/RKouBMhDyNaBMx4sWvrzRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.58.2", + "@typescript-eslint/types": "8.58.2", + "@typescript-eslint/typescript-estree": "8.58.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.2.tgz", + "integrity": "sha512-f1WO2Lx8a9t8DARmcWAUPJbu0G20bJlj8L4z72K00TMeJAoyLr/tHhI/pzYBLrR4dXWkcxO1cWYZEOX8DKHTqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.58.2", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@vitejs/plugin-vue": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.4.tgz", @@ -2872,9 +3143,9 @@ "license": "ISC" }, "node_modules/brace-expansion": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", - "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", + "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4209,19 +4480,19 @@ } }, "node_modules/eslint": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.0.3.tgz", - "integrity": "sha512-COV33RzXZkqhG9P2rZCFl9ZmJ7WL+gQSCRzE7RhkbclbQPtLAWReL7ysA0Sh4c8Im2U9ynybdR56PV0XcKvqaQ==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.2.0.tgz", + "integrity": "sha512-+L0vBFYGIpSNIt/KWTpFonPrqYvgKw1eUI5Vn7mEogrQcWtWYtNQ7dNqC+px/J0idT3BAkiWrhfS7k+Tum8TUA==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", - "@eslint/config-array": "^0.23.3", - "@eslint/config-helpers": "^0.5.2", - "@eslint/core": "^1.1.1", - "@eslint/plugin-kit": "^0.6.1", + "@eslint/config-array": "^0.23.4", + "@eslint/config-helpers": "^0.5.4", + "@eslint/core": "^1.2.0", + "@eslint/plugin-kit": "^0.7.0", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -4232,7 +4503,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", - "espree": "^11.1.1", + "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -4265,6 +4536,22 @@ } } }, + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-plugin-vue": { "version": "10.8.0", "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.8.0.tgz", @@ -6240,13 +6527,13 @@ } }, "node_modules/minimatch": { - "version": "10.2.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", - "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^5.0.2" + "brace-expansion": "^5.0.5" }, "engines": { "node": "18 || 20 || >=22" @@ -7065,6 +7352,22 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.2.tgz", + "integrity": "sha512-8c3mgTe0ASwWAJK+78dpviD+A8EqhndQPUBpNUIPt6+xWlIigCwfN01lWr9MAede4uqXGTEKeQWTvzb3vjia0Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -8581,6 +8884,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/tslib": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", @@ -8716,6 +9032,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.58.2", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.58.2.tgz", + "integrity": "sha512-V8iSng9mRbdZjl54VJ9NKr6ZB+dW0J3TzRXRGcSbLIej9jV86ZRtlYeTKDR/QLxXykocJ5icNzbsl2+5TzIvcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.58.2", + "@typescript-eslint/parser": "8.58.2", + "@typescript-eslint/typescript-estree": "8.58.2", + "@typescript-eslint/utils": "8.58.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, "node_modules/ufo": { "version": "1.6.3", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", @@ -9248,6 +9588,7 @@ "integrity": "sha512-Vxi9pJdbN3ZnVGLODVtZ7y4Y2kzAAE2Cm0CZ3ZDRvydVYxZ6VrnBhLikBsRS+dpwj4Jv4UCv21PTEwF5rQ9WXg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "debug": "^4.4.0", "eslint-scope": "^8.2.0 || ^9.0.0", diff --git a/package.json b/package.json index 0a48b3ca..48581eeb 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,11 @@ "preview": "vite preview", "build-only": "vite build", "type-check": "vue-tsc --build", + "update": "node ./workflows/api-doc-sync/update.mjs", + "lint": "eslint . --cache", + "lint:fix": "eslint . --cache --fix", + "format": "prettier . --write", + "format:check": "prettier . --check", "deploy": "sh deploy.sh", "rollback": "sh rollback.sh" }, @@ -38,6 +43,7 @@ "xlsx": "^0.18.5" }, "devDependencies": { + "@eslint/js": "^10.0.1", "@tsconfig/node24": "^24.0.4", "@types/js-cookie": "^3.0.6", "@types/node": "^24.11.0", @@ -47,14 +53,19 @@ "@types/three": "^0.183.1", "@vitejs/plugin-vue": "^6.0.4", "@vue/tsconfig": "^0.8.1", + "eslint": "^10.2.0", + "eslint-config-prettier": "^10.1.8", "eslint-plugin-vue": "^10.8.0", "fast-glob": "^3.3.3", "npm-run-all2": "^8.0.4", + "prettier": "^3.8.2", "sass": "^1.97.3", "typescript": "~5.9.3", + "typescript-eslint": "^8.58.2", "vite": "^7.3.1", "vite-plugin-svg-icons": "^2.0.1", "vite-plugin-vue-devtools": "^8.0.6", + "vue-eslint-parser": "^10.4.0", "vue-tsc": "^3.2.5" }, "engines": { diff --git a/src/api/index.ts b/src/api/index.ts index 326aaeed..04260d99 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -150,3 +150,17 @@ export function listInterfaceTypes() { isSystemApi: true } as any) } + +export function searchSpace(data:any){ + return request({ + url: '/system', + method: 'post', + params: { + method: 'index.searchSpace', + v: '1.0', + timestamp: new Date().getTime() + }, + data: data, + isSystemApi: true + } as any) +} diff --git a/src/api/order/order.ts b/src/api/order/order.ts index b2bc9183..27fcf193 100644 --- a/src/api/order/order.ts +++ b/src/api/order/order.ts @@ -14,6 +14,19 @@ export const getreviewOrderlist = (data: any): Promise => { }) } +export const reviewOrder = (data: any): Promise => { + return request({ + url: '/system', + method: 'post', + params: { + method: 'order.reviewOrder.reviewOrder', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + export function getdeliveryOrderlist(data: any): Promise { return request({ url: '/system', @@ -110,8 +123,8 @@ export const orderDetail = (data: any): Promise => { // New APIs from test.txt export const orderReviewList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.reviewOrder.list', v: '1.0', timestamp: Date.now() }, data: data }); export const orderReviewOrder = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.reviewOrder.reviewOrder', v: '1.0', timestamp: Date.now() }, data: data }); -export const orderPendingList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.pendingOrder.list', v: '1.0', timestamp: Date.now() }, data: data }); -export const orderExpectionList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.expectionOrder.list', v: '1.0', timestamp: Date.now() }, data: data }); +export const orderPendingList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.pendingOrder.getpendingOrderlist', v: '1.0', timestamp: Date.now() }, data: data }); +export const orderExpectionList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.expectionOrder.getexpectionOrderlist', v: '1.0', timestamp: Date.now() }, data: data }); export const orderEntrustList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.entrustOrder.list', v: '1.0', timestamp: Date.now() }, data: data }); export const orderDeliveryList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.deliveryOrder.list', v: '1.0', timestamp: Date.now() }, data: data }); export const orderDeliveryExpectionList = (data: any): Promise => request({ url: '/system', method: 'post', params: { method: 'order.deliveryExpectionOrder.list', v: '1.0', timestamp: Date.now() }, data: data }); diff --git a/src/router/map.ts b/src/router/map.ts index d46c1b34..e163f977 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -21,5 +21,5 @@ export const componentMap: Record = { // 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'), 'system/print/station': () => import('@/views/system/setting/printStation/index.vue'), 'storage/log': () => import('@/views/storage/log/index.vue'), - 'storage/validityperiod':import('@/views/storage/validityperiod/index.vue'), + 'storage/validityperiod':() =>import('@/views/storage/validityperiod/index.vue'), }; \ No newline at end of file diff --git a/src/views/order/orderManagement/component/ArchiveOrderPanel.vue b/src/views/order/orderManagement/component/ArchiveOrderPanel.vue new file mode 100644 index 00000000..16bc922c --- /dev/null +++ b/src/views/order/orderManagement/component/ArchiveOrderPanel.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/views/order/orderManagement/component/OrderReviewDialog.vue b/src/views/order/orderManagement/component/OrderReviewDialog.vue new file mode 100644 index 00000000..fa85ea04 --- /dev/null +++ b/src/views/order/orderManagement/component/OrderReviewDialog.vue @@ -0,0 +1,102 @@ + + + diff --git a/src/views/order/orderManagement/component/detail.vue b/src/views/order/orderManagement/component/detail.vue index 89f0ea4e..99a9ab81 100644 --- a/src/views/order/orderManagement/component/detail.vue +++ b/src/views/order/orderManagement/component/detail.vue @@ -8,14 +8,13 @@ :span="item.span || 1" > @@ -23,17 +22,62 @@ diff --git a/src/views/storage/validityperiod/index.vue b/src/views/storage/validityperiod/index.vue index b587daee..304a08ed 100644 --- a/src/views/storage/validityperiod/index.vue +++ b/src/views/storage/validityperiod/index.vue @@ -2,9 +2,9 @@
刷新 导出 + 消息管理 + 转残 + 出库
+ + @@ -68,47 +82,140 @@
+ + +
+
+ + +
+
+
+ + {{ item.item_name || '--' }} +
+
批次号:{{ item.batch_no || '--' }}
+ +
+ +
+
+ +
+ +
+ +
+
+
+
\ No newline at end of file diff --git a/src/views/storage/validityperiod/validityperiod-config.ts b/src/views/storage/validityperiod/validityperiod-config.ts new file mode 100644 index 00000000..9dbf6d33 --- /dev/null +++ b/src/views/storage/validityperiod/validityperiod-config.ts @@ -0,0 +1,120 @@ +/** 有效期页面:ScanBox / UpperTable / 详情面板 集中配置 */ + +export const availableFields = [ + { label: '商品ID', value: 'stock_id', type: 'text' }, + { label: '库位', value: 'space_id', type: 'text' }, + { label: '货主', value: 'store_id', type: 'select', options: [] as { label: string; value: unknown }[] }, + { + label: '库存类型', + value: 'inventory_type', + type: 'select', + options: [ + { label: '正品', value: 'ZP' }, + { label: '次品', value: 'CC' }, + { label: '机损', value: 'JS' }, + { label: '箱损', value: 'XS' }, + { label: '在途', value: 'ZT' }, + { label: '冻结', value: 'DJ' }, + { label: '分配', value: 'FP' } + ] + }, + { label: '批次号', value: 'batch_no', type: 'text' }, + { label: '入库单号', value: 'inbound_order_no', type: 'text' }, + { label: '创建日期', value: 'created_at', type: 'daterange' } +] + +export const scanBoxConfig = { + width: '320px', + treeProps: { children: 'children', label: 'label' }, + autoSubmit: false +} + +export const upperTableConfig = { + title: '有效期商品列表' +} + +export const validityPeriodColumns = [ + { prop: 'stock_id', label: '商品ID', width: '110' }, + { prop: 'item_code', label: '商品编码', width: '140' }, + { prop: 'item_name', label: '商品名称', minWidth: '180' }, + { prop: 'batch_no', label: '批次号', width: '160' }, + { prop: 'stock_unit', label: '单位', width: '80' }, + { prop: 'quantity', label: '库存数量', width: '100', sortable: true }, + { prop: 'remaining_days', label: '剩余天数', width: '100', sortable: true }, + { prop: 'threshold_days', label: '阈值天数', width: '100', sortable: true }, + { prop: 'expiry_date', label: '到期日期', width: '170', sortable: true }, + { prop: 'production_date', label: '生产日期', width: '170', sortable: true }, + { prop: 'space_code', label: '库位', minWidth: '140' }, + { prop: 'is_expired_text', label: '过期状态', width: '100' } +] + +/** 列表「过期状态」展示文案与样式类(有效绿色 / 已过期红色) */ +export const expiryStatusListClass = { + valid: 'expiry-status--valid', + expired: 'expiry-status--expired' +} as const + +export const expiryStatusText = { + valid: '临期', + expired: '已过期' +} as const + +/** 详情区 warning_status 与 el-tag 映射 */ +export const expiryWarningStatus = { + expired: 'expired', + normal: 'normal' +} as const + +export function getExpiryDetailStatusLabel(status: string) { + if (status === expiryWarningStatus.expired) return expiryStatusText.expired + return '临期' +} + +export function getExpiryDetailStatusTagType(status: string) { + if (status === expiryWarningStatus.expired) return 'danger' + return 'success' +} + +export type ExpiryQueryInfoItem = + | { label: string; field: string; kind?: 'text' } + | { label: string; kind: 'expiry_tag'; expiredField: string } + +export const expiryQueryInfoItems: ExpiryQueryInfoItem[] = [ + { label: '商品编码', field: 'item_code' }, + { label: '商品名称', field: 'item_name' }, + { label: '库位', field: 'space_code' }, + { label: '库存类型', field: 'inventory_type' }, + { label: '阈值天数', field: 'threshold_days' }, + { label: '剩余天数', field: 'remaining_days' }, + { label: '状态', kind: 'expiry_tag', expiredField: 'is_expired' }, + { label: '到期日期', field: 'expiry_date' } +] + +export type ExpiryQueryTableColumn = + | { + prop: string + label: string + width?: number + minWidth?: number + showOverflowTooltip?: boolean + slot?: never + } + | { + prop: string + label: string + width?: number + minWidth?: number + showOverflowTooltip?: boolean + slot: 'expiry' | 'status' + } + +export const expiryQueryTableColumns: ExpiryQueryTableColumn[] = [ + { prop: 'stock_id', label: '商品ID', width: 120 }, + { prop: 'item_name', label: '商品名称', minWidth: 200, showOverflowTooltip: true }, + { prop: 'batch_no', label: '批次号', width: 160 }, + { prop: 'production_date', label: '生产日期', width: 120 }, + { prop: 'expiry_date', label: '有效期至', width: 120, slot: 'expiry' }, + { prop: 'remaining_days', label: '剩余天数', width: 100 }, + { prop: 'quantity', label: '库存数量', width: 100 }, + { prop: 'warning_status', label: '状态', width: 100, slot: 'status' } +] diff --git a/src/需求文档.txt b/src/需求文档.txt index 4e016fe6..1358c839 100644 --- a/src/需求文档.txt +++ b/src/需求文档.txt @@ -1,68 +1,92 @@ -storage.expiry.list -库存有效期列表查询(效期预警),按 wms_storage 查询并计算剩余天数与过期状态,支持 where 条件与分页。注意:无需传 warehouse_id/store_id,服务端会从当前登录用户取仓库上下文。 +order.reviewOrder.getreviewOrderlist +分页查询订单审核列表(目录化路由) Params (2) 名称 类型 必填 说明 -where object 否 统一 where 条件对象;支持字段:item_code、goods_code、item_name、sku_property、stock_unit、is_shelf_life_mgmt、remaining_threshold_days。示例:where.item_code={operator:like,value:ABC}; where.remaining_threshold_days={operator:lte,value:7}。注意:无需传入 store_id 或 warehouse_id,服务端会从当前登录用户获取仓库上下文。 -pagination object 否 分页参数 { page, pageSize },默认 page=1, pageSize=20 - -Response (3) -名称 类型 必填 说明 -data.list array 是 匹配到的库存效期项数组 -data.list[] object 否 列表项,包含至少以下字段 -data.pagination object 是 分页信息,含 page、pageSize、total、totalPages - +pagination object 否 pagination 参数 +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;支持 inspection_status、step、operator_name、operate_time_start、operate_time_end 等字段。示例:where.step={operator:in,value:[0,1]}; where.inspection_status={operator:eq,value:pending}; where.operator_name={operator:like,value:张}; where.operate_time_start={value:2026-03-01}。 接口响应: { "flag": "success", - "code": 200, - "message": "查询成功", + "code": 1, + "message": "ok", "data": { "list": [ { - "id": 142, - "warehouse_id": 100000, - "store_id": 1000000, - "space_id": 1, - "stock_id": 157059, - "batch_no": "R20554119", - "inventory_type": "ZP", - "quantity": 10, - "locked_quantity": 0, - "available_quantity": 10, - "production_date": "2024-01-01 08:00:00", - "expiry_date": "2026-04-12 08:00:00", - "inbound_time": "2026-04-12 00:01:11", - "inbound_order_no": "TEST-ENTRY-1775923270905", - "receiving_id": 666, - "entry_order_id": 189, - "supplier_id": null, - "supplier_batch_no": null, - "is_enabled": 1, - "created_at": "2026-04-12 00:01:11", - "updated_at": "2026-04-13 17:11:15", + "id": 2, + "delivery_order_code": "JY2026041416334", + "pre_delivery_order_code": "", + "pre_delivery_order_id": "", + "order_type": "JYCK", + "warehouse_code": "100000", + "order_flag": "", + "source_platform_code": "TB", + "source_platform_name": "淘宝", + "create_at": "2026-04-14T07:37:11.000Z", "delete_at": null, - "stock": { - "id": 157059, - "item_code": "yjm20260411", - "goods_code": null, - "item_name": "yjm0411", - "sku_property": "", - "stock_unit": "个", - "store_id": 1000000, - "warehouse_id": 100000, - "is_shelf_life_mgmt": "Y", - "remaining_threshold_days": 547 - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "threshold_days": 547, - "remaining_days": 0, - "is_expired": true + "updated_at": "2026-04-14T07:37:11.000Z", + "place_order_time": "2026-04-14T07:34:40.000Z", + "pay_time": "2026-04-14T07:34:40.000Z", + "pay_no": "", + "service_code": null, + "operator_name": "1", + "operate_time": "2026-04-14T07:37:11.000Z", + "delivery_time": null, + "shop_nick": "加能量袜子店", + "seller_nick": "1", + "buyer_nick": "学习18022440198", + "total_amount": "150.00", + "item_amount": "150.00", + "discount_amount": "0.00", + "freight": "0.00", + "ar_amount": "0.00", + "got_amount": "0.00", + "service_fee": null, + "logistics_code": "ZTO", + "logistics_name": "中通快递", + "express_code": "", + "logistics_area_code": "", + "delivery_type": null, + "is_urgency": "N", + "invoice_flag": "N", + "status": "pedding", + "name": "学习", + "zip_code": "", + "tel": "", + "mobile": "18022440198", + "email": "", + "country_code": "CN", + "province": "广东省", + "city": "广州市", + "area": "白云区", + "town": "江高镇", + "detail_address": "广东省 广州市 白云区 江高镇 测试地址", + "id_type": null, + "id_number": null, + "oaid": null, + "sync_status": "padding", + "store_id": 1000000, + "warehouse_id": 100000, + "from_key": 24869601, + "items": "101384+5", + "items_count": 1, + "items_total": 5, + "items_weight": "0.00", + "items_hash": "9e26ada8b89136b8850576a5356026b2", + "items_crc": 2613025742, + "wave_id": 0, + "post_status": "none", + "storage_status": "none", + "pick_status": "none", + "pack_status": "none", + "inspection_status": "none", + "step": 0, + "print_status": null, + "claim_status": "none", + "outbound_status": "none", + "lock_status": null, + "intercept_status": null } ], "pagination": { @@ -74,353 +98,263 @@ data.pagination object 是 分页信息,含 page、pageSize、total、totalPag "hasNext": false } }, - "timestamp": 1776083463 + "timestamp": 1776152560 } ----- -storage.inventory.list -库存列表查询(查 wms_storage),支持 where 条件、分页、排序、批次分组。默认按库位+商品合并数量(合并模式),group_by_batch=true 时返回每条库存明细(明细模式) +order.reviewOrder.reviewOrder +订单审核(目录化路由)。执行后会更新 inspection_status,并同步更新订单整数字段 step。 -Params (4) +Params (6) 名称 类型 必填 说明 -where object 否 统一 where 条件对象,可用字段:stock_id(商品ID)、space_id(库位ID)、store_id(货主ID)、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、batch_no(批次号)、inbound_order_no(入库单号)、available_quantity(可用数量,支持 gt/lt)、inbound_time(入库时间,支持 between)、created_at(创建时间,支持 between) -pagination object 否 分页参数 { page, pageSize },默认 page=1, pageSize=20 -sort object 否 排序参数 { sortField, sortOrder },默认 sortField='created_at', sortOrder='DESC' -group_by_batch boolean 否 是否按批次查询,默认 false。false=合并模式(按库位+商品聚合quantity/locked_quantity/available_quantity),true=明细模式(逐条返回含 batch_no/production_date/expiry_date 等) +delivery_order_code string 否 delivery_order_code 参数 +id number 否 id 参数 +inspection_status string 否 inspection_status 参数(兼容入参) +review_status string 否 review_status 参数,默认 fin +operator_name string 否 operator_name 参数 +operate_time string 否 operate_time 参数 -无参数接口响应: -{ - "flag": "success", - "code": 1, - "message": "ok", - "list": [ - { - "stock_id": 101391, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "200", - "locked_quantity": "0", - "available_quantity": "200", - "first_inbound_time": "2026-04-12 22:04:49", - "last_inbound_time": "2026-04-12 22:04:49", - "batch_count": 1, - "stock": { - "id": 101391, - "item_code": "023802", - "item_name": "空包", - "sku_property": "", - "stock_unit": "个", - "is_shelf_life_mgmt": "Y", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - }, - { - "stock_id": 157059, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "2024-01-01 08:00:00", - "expiry_date": "2026-04-12 08:00:00", - "quantity": "34", - "locked_quantity": "0", - "available_quantity": "34", - "first_inbound_time": "2026-04-12 00:01:11", - "last_inbound_time": "2026-04-12 17:56:28", - "batch_count": 6, - "stock": { - "id": 157059, - "item_code": "yjm20260411", - "item_name": "yjm0411", - "sku_property": "", - "stock_unit": "个", - "is_shelf_life_mgmt": "Y", - "remaining_threshold_days": 547 - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": true - }, - { - "stock_id": 157008, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "367", - "locked_quantity": "0", - "available_quantity": "367", - "first_inbound_time": "2026-04-08 16:45:25", - "last_inbound_time": "2026-04-12 00:01:20", - "batch_count": 46, - "stock": { - "id": 157008, - "item_code": "6902226191553", - "item_name": "测试加货主商品1", - "sku_property": "", - "stock_unit": "件", - "is_shelf_life_mgmt": "N", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - }, - { - "stock_id": 156968, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "316", - "locked_quantity": "0", - "available_quantity": "316", - "first_inbound_time": "2026-04-08 00:39:08", - "last_inbound_time": "2026-04-11 16:32:02", - "batch_count": 56, - "stock": { - "id": 156968, - "item_code": "6902226191552", - "item_name": "新商品", - "sku_property": "", - "stock_unit": "个", - "is_shelf_life_mgmt": "N", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - }, - { - "stock_id": 101841, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "67", - "locked_quantity": "0", - "available_quantity": "67", - "first_inbound_time": "2026-04-08 00:39:08", - "last_inbound_time": "2026-04-08 11:23:27", - "batch_count": 15, - "stock": { - "id": 101841, - "item_code": "纸箱24121410-1", - "item_name": "纸箱24121410yc#zy-消退", - "sku_property": "", - "stock_unit": "盒", - "is_shelf_life_mgmt": "N", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - } - ], - "pagination": { - "page": 1, - "pageSize": 20, - "total": 5, - "totalPages": 1 - }, - "timestamp": 1776083855 -} +----- +order.deliveryOrder.getdeliveryOrderlist +分页查询已进入出库流程的订单列表 --- -请求参数: -{ - "group_by_batch":"true" -} +Params (2) +名称 类型 必填 说明 +pagination object 否 pagination 参数 +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status != none;支持 step 筛选。示例:where.outbound_status={operator:in,value:[created,processing]}; where.step={operator:in,value:[4,5]}; where.store_id={operator:eq,value:1001}。 接口响应:{ "flag": "success", "code": 1, "message": "ok", - "list": [ - { - "stock_id": 101391, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "200", - "locked_quantity": "0", - "available_quantity": "200", - "first_inbound_time": "2026-04-12 22:04:49", - "last_inbound_time": "2026-04-12 22:04:49", - "batch_count": 1, - "stock": { - "id": 101391, - "item_code": "023802", - "item_name": "空包", - "sku_property": "", - "stock_unit": "个", - "is_shelf_life_mgmt": "Y", - "remaining_threshold_days": null - }, - "space": { + "data": { + "list": [ + { "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - }, - { - "stock_id": 157059, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "2024-01-01 08:00:00", - "expiry_date": "2026-04-12 08:00:00", - "quantity": "34", - "locked_quantity": "0", - "available_quantity": "34", - "first_inbound_time": "2026-04-12 00:01:11", - "last_inbound_time": "2026-04-12 17:56:28", - "batch_count": 6, - "stock": { - "id": 157059, - "item_code": "yjm20260411", - "item_name": "yjm0411", - "sku_property": "", - "stock_unit": "个", - "is_shelf_life_mgmt": "Y", - "remaining_threshold_days": 547 - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": true - }, - { - "stock_id": 157008, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "367", - "locked_quantity": "0", - "available_quantity": "367", - "first_inbound_time": "2026-04-08 16:45:25", - "last_inbound_time": "2026-04-12 00:01:20", - "batch_count": 46, - "stock": { - "id": 157008, - "item_code": "6902226191553", - "item_name": "测试加货主商品1", - "sku_property": "", - "stock_unit": "件", - "is_shelf_life_mgmt": "N", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - }, - { - "stock_id": 156968, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "316", - "locked_quantity": "0", - "available_quantity": "316", - "first_inbound_time": "2026-04-08 00:39:08", - "last_inbound_time": "2026-04-11 16:32:02", - "batch_count": 56, - "stock": { - "id": 156968, - "item_code": "6902226191552", - "item_name": "新商品", - "sku_property": "", - "stock_unit": "个", - "is_shelf_life_mgmt": "N", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false - }, - { - "stock_id": 101841, - "space_id": 1, - "inventory_type": "ZP", - "warehouse_id": 100000, - "store_id": 1000000, - "production_date": "", - "expiry_date": "", - "quantity": "67", - "locked_quantity": "0", - "available_quantity": "67", - "first_inbound_time": "2026-04-08 00:39:08", - "last_inbound_time": "2026-04-08 11:23:27", - "batch_count": 15, - "stock": { - "id": 101841, - "item_code": "纸箱24121410-1", - "item_name": "纸箱24121410yc#zy-消退", - "sku_property": "", - "stock_unit": "盒", - "is_shelf_life_mgmt": "N", - "remaining_threshold_days": null - }, - "space": { - "id": 1, - "space_code": "AREA-01-01-01", - "custom_name": "默认收货区" - }, - "is_shelf_life_warning_triggered": false + "delivery_order_code": "TRACE_OUTBOUND_1776007027818_0E2C252D", + "pre_delivery_order_code": "", + "pre_delivery_order_id": "", + "order_type": "JYCK", + "warehouse_code": "100000", + "order_flag": "", + "source_platform_code": "TB", + "source_platform_name": "淘宝", + "create_at": "2026-04-12T15:17:15.000Z", + "delete_at": null, + "updated_at": "2026-04-12T15:17:16.000Z", + "place_order_time": null, + "pay_time": null, + "pay_no": "", + "service_code": null, + "operator_name": null, + "operate_time": null, + "delivery_time": "2026-04-12T15:17:16.000Z", + "shop_nick": null, + "seller_nick": null, + "buyer_nick": null, + "total_amount": "0.00", + "item_amount": "0.00", + "discount_amount": "0.00", + "freight": "0.00", + "ar_amount": "0.00", + "got_amount": "0.00", + "service_fee": null, + "logistics_code": null, + "logistics_name": null, + "express_code": "", + "logistics_area_code": "", + "delivery_type": null, + "is_urgency": "N", + "invoice_flag": "N", + "status": "pedding", + "name": "自动化验证收件人", + "zip_code": "510000", + "tel": "", + "mobile": "13800138000", + "email": "", + "country_code": "", + "province": "广东省", + "city": "广州市", + "area": "黄埔区", + "town": "知识城街道", + "detail_address": "自动化验证地址 TRACE_OUTBOUND_1776007027818_0E2C252D", + "id_type": null, + "id_number": null, + "oaid": null, + "sync_status": "padding", + "store_id": 1000000, + "warehouse_id": 100000, + "from_key": 24869601, + "items": "101391+1", + "items_count": 1, + "items_total": 1, + "items_weight": "0.00", + "items_hash": "c160b2ea32b53aba930f55e3a306de01", + "items_crc": 581302873, + "wave_id": 0, + "post_status": "none", + "storage_status": "none", + "pick_status": "none", + "pack_status": "none", + "inspection_status": "none", + "step": 4, + "print_status": null, + "claim_status": "none", + "outbound_status": "fin", + "lock_status": null, + "intercept_status": null, + "dispatch_lane": "m4" + } + ], + "pagination": { + "page": 1, + "pageSize": 20, + "total": 1, + "totalPages": 1, + "hasPrevious": false, + "hasNext": false } - ], - "pagination": { - "page": 1, - "pageSize": 20, - "total": 5, - "totalPages": 1 }, - "timestamp": 1776084545 + "timestamp": 1776154762 } + + +---------- +order.pendingOrder.getpendingOrderlist +分页查询待处理订单列表 + +Params (2) +名称 类型 必填 说明 +pagination object 否 pagination 参数 +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传时默认 status in [pedding, created] 且 outbound_status = none。示例:where.status={operator:in,value:[pedding,created]}; where.outbound_status={operator:eq,value:none}。 + +接口响应: +{ + "flag": "success", + "code": 1, + "message": "ok", + "data": { + "list": [ + { + "id": 1, + "delivery_order_code": "JY202604142929", + "pre_delivery_order_code": "", + "pre_delivery_order_id": "", + "order_type": "JYCK", + "warehouse_code": "100000", + "order_flag": "", + "source_platform_code": "TB", + "source_platform_name": "淘宝", + "create_at": "2026-04-14T06:53:07.000Z", + "delete_at": null, + "updated_at": "2026-04-14T06:53:07.000Z", + "place_order_time": "2026-04-13T23:09:39.000Z", + "pay_time": "2026-04-13T23:09:39.000Z", + "pay_no": "", + "service_code": null, + "operator_name": "1", + "operate_time": "2026-04-14T06:53:07.000Z", + "delivery_time": null, + "shop_nick": "加能量袜子店", + "seller_nick": "1", + "buyer_nick": "张三", + "total_amount": "600.00", + "item_amount": "600.00", + "discount_amount": "0.00", + "freight": "0.00", + "ar_amount": "0.00", + "got_amount": "0.00", + "service_fee": null, + "logistics_code": "ZTO", + "logistics_name": "中通快递", + "express_code": "", + "logistics_area_code": "", + "delivery_type": null, + "is_urgency": "N", + "invoice_flag": "N", + "status": "pedding", + "name": "张三", + "zip_code": "", + "tel": "", + "mobile": "18022440198", + "email": "", + "country_code": "CN", + "province": "广东省", + "city": "广州市", + "area": "白云区", + "town": "人和镇", + "detail_address": "广东省 广州市 白云区 人和镇 测试地址", + "id_type": null, + "id_number": null, + "oaid": null, + "sync_status": "padding", + "store_id": 1000000, + "warehouse_id": 100000, + "from_key": 24869601, + "items": "101384+20", + "items_count": 1, + "items_total": 20, + "items_weight": "0.00", + "items_hash": "23ef3c5bc7ab12dc9bd25877afded196", + "items_crc": 3353156042, + "wave_id": 0, + "post_status": "none", + "storage_status": "none", + "pick_status": "none", + "pack_status": "none", + "inspection_status": "none", + "step": 1, + "print_status": null, + "claim_status": "none", + "outbound_status": "none", + "lock_status": null, + "intercept_status": null + } + ], + "pagination": { + "page": 1, + "pageSize": 20, + "total": 1, + "totalPages": 1, + "hasPrevious": false, + "hasNext": false + } + }, + "timestamp": 1776154872 +} + +order.expectionOrder.getexpectionOrderlist +分页查询异常订单列表 + +Params (2) +名称 类型 必填 说明 +pagination object 否 pagination 参数 +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传时默认筛选各流程 error 或拦截 exception。示例:where.status={operator:eq,value:error}; where.outbound_status={operator:eq,value:exception}。 + +接口响应:{ + "flag": "success", + "code": 1, + "message": "ok", + "data": { + "list": [], + "pagination": { + "page": 1, + "pageSize": 20, + "total": 0, + "totalPages": 0, + "hasPrevious": false, + "hasNext": false + } + }, + "timestamp": 1776154895 +} + +----- +order.archiveOrder.getarchiveOrderlist +分页查询归档订单列表(暂使用当前订单表完成态数据) + +Params (2) +名称 类型 必填 说明 +pagination object 否 pagination 参数 +where object 否 统一 where 条件对象;推荐使用 { operator, value, type } 标准结构;未传 outbound_status 时默认过滤 outbound_status = fin。示例:where.outbound_status={operator:eq,value:fin}; where.store_id={operator:eq,value:1001}。 + diff --git a/workflows/api-doc-sync/README.md b/workflows/api-doc-sync/README.md new file mode 100644 index 00000000..4e377a0b --- /dev/null +++ b/workflows/api-doc-sync/README.md @@ -0,0 +1,22 @@ +# API Doc Sync Workflow + +该目录集中管理接口文档变更抓取相关的脚本、配置和数据,避免与业务 `src` 代码混放。 + +## 目录说明 + +- `config.mjs`:工作流配置(抓取地址、文件路径、历史保留数量)。 +- `update.mjs`:抓取并更新接口变更的主流程脚本。 +- `data/changes.json`:本地最新接口更新日志(全量)。 +- `data/pending-updates.json`:待更新接口清单(仅 `summary`、`methods`、`notes`)。 +- `data/history/`:历史快照,自动保留最近 5 份。 + +## 运行 + +```bash +npm run update +``` + +## 扩展建议 + +- 新增工作流功能时,优先在 `workflows/api-doc-sync` 内按模块拆分文件。 +- 如果增加新的数据产物,统一放在 `data/` 内并在此文档补充说明。 diff --git a/workflows/api-doc-sync/config.mjs b/workflows/api-doc-sync/config.mjs new file mode 100644 index 00000000..cee43112 --- /dev/null +++ b/workflows/api-doc-sync/config.mjs @@ -0,0 +1,18 @@ +import path from "node:path"; + +const WORKFLOW_ROOT = path.join("workflows", "api-doc-sync"); +const DATA_DIR = path.join(WORKFLOW_ROOT, "data"); + +export const API_DOC_SYNC_CONFIG = { + changesUrl: "http://192.168.11.56:6060/api/docs/system/changes", + historyMaxFiles: 5, + file: { + localChanges: path.join(DATA_DIR, "changes.json"), + pendingChanges: path.join(DATA_DIR, "pending-updates.json"), + historyDir: path.join(DATA_DIR, "history"), + }, + history: { + prefix: "changes-", + suffix: ".json", + }, +}; diff --git a/src/apichanges.txt b/workflows/api-doc-sync/data/changes.json similarity index 77% rename from src/apichanges.txt rename to workflows/api-doc-sync/data/changes.json index c41e86e2..991b8532 100644 --- a/src/apichanges.txt +++ b/workflows/api-doc-sync/data/changes.json @@ -1,11 +1,33 @@ [ + { + "version": "2026.04.14-system-01", + "date": "2026-04-14", + "summary": "库存列表新增货主名称字段 stock.store_name", + "methods": ["storage.inventory.list"], + "notes": [ + "在 methods/system.json 的 storage.inventory.list response 中补充 stock.store_name:来源于签约表 store_remask,若无签约关系则为 null。", + "只同步文档,不修改业务代码。" + ], + "type": "updated" + }, + { + "version": "2026.04.13-system-01", + "date": "2026-04-13", + "summary": "补全 storage.receiving.detailChange 的入参/出参契约与错误码说明", + "methods": ["storage.receiving.detailChange"], + "notes": [ + "在 methods/system.json 中补充 storage.receiving.detailChange 的 params/response/errors,明确 id 与 receiving_id 必填。", + "说明 expiry_date 小于当前日期时返回 400 且 message 为 \"到期日期已过期,不能录入收货\"。", + "说明当传入 system_product_id 时会回填条码、重量、箱规、商品名称与 product_snapshot;未传时 barcode/product_name 也可单独更新。", + "同步补充文档:docs/storage-receiving-api.md 中新增 detailChange 段落。" + ], + "type": "updated" + }, { "version": "2026.04.07-system-01", "date": "2026-04-07", "summary": "修正 warehouse.getAreaRacks 的鉴权/权限链路文档,明确该接口需要 登录并走权限校验。", - "methods": [ - "warehouse.getAreaRacks" - ], + "methods": ["warehouse.getAreaRacks"], "notes": [ "对齐当前 system 文档中的 isNeedAuth=true、isNeedLogin=true。", "用于补充该接口权限链路修正文档的历史上下文,不改变 methods/system.json 的 SSOT 角色。" @@ -58,9 +80,7 @@ "version": "2026.04.07-system-05", "date": "2026-04-07", "summary": "修正 storeWarehouse.store.adjustPrintQuantity 的面单余额调整语义:由增减/累加改为覆盖设置目标余额。", - "methods": [ - "storeWarehouse.store.adjustPrintQuantity" - ], + "methods": ["storeWarehouse.store.adjustPrintQuantity"], "notes": [ "adjustPrintQuantity 当前兼容 print_quantity、target_quantity、change_quantity、adjust_quantity 作为目标面单余额输入,不再按增减量解释。", "变更日志中的 change_quantity 由 before/after 自动计算差值,以兼容历史审计与展示。" @@ -70,9 +90,7 @@ "version": "2026.04.07-system-06", "date": "2026-04-07", "summary": "按接口类型分类限制必填字段,OPEN_API 创建时自动生成 self_app_key/self_app_secret", - "methods": [ - "storeWarehouse.store.saveApiConfig" - ], + "methods": ["storeWarehouse.store.saveApiConfig"], "notes": [ "QM_WMS 类型须填写 qimen_app_key/qimen_customer_id/qimen_warehouse_code;OPEN_API 类型三个奇门字段非必填,创建时自动生成 self_app_key(WMS+32位HEX)和 self_app_secret(64位HEX),更新时保留已有密钥。" ], @@ -82,9 +100,7 @@ "version": "2026.04.07-system-07", "date": "2026-04-07", "summary": "新增接口类型列表查询接口,归属基础模块,无需权限", - "methods": [ - "index.listInterfaceTypes" - ], + "methods": ["index.listInterfaceTypes"], "notes": [ "返回所有已启用的接口类型(wms_interface_type),包含 id、interface_code、interface_name、interface_category、description 字段。设置 isNeedAuth: false, isNeedLogin: true。" ], @@ -94,9 +110,7 @@ "version": "2026.04.07-system-08", "date": "2026-04-07", "summary": "app_name 改为必传参数", - "methods": [ - "storeWarehouse.store.saveApiConfig" - ], + "methods": ["storeWarehouse.store.saveApiConfig"], "notes": [ "app_name 不再有默认值自动生成逻辑,调用方必须传入非空的 app_name,否则返 回 400 错误。" ], @@ -106,9 +120,7 @@ "version": "2026.04.07-system-09", "date": "2026-04-07", "summary": "新增收货单快捷入库上架接口", - "methods": [ - "storage.inventory.quickPutaway" - ], + "methods": ["storage.inventory.quickPutaway"], "notes": [ "新建 storage.inventory 库存操作模块。quickPutaway 从收货单直接生成入库单 (SCRK)并写入 wms_storage 库存表,同时更新 wms_stock_warehouse 库存数量(悲观行锁),回填收货明细入库状态。要求收货单已完成且所有明细已匹配系统商品。" ], @@ -118,9 +130,7 @@ "version": "2026.04.08-system-01", "date": "2026-04-08", "summary": "新增收货单与入库单匹配入库接口", - "methods": [ - "storage.inventory.matchPutaway" - ], + "methods": ["storage.inventory.matchPutaway"], "notes": [ "接收多个收货单和入库单,按商品(stock_warehouse_id)进行数量匹配入库,完 成后根据入库单来源(QM/API)自动触发回传。入参为 receiving_ids(数组)和 entry_order_ids(数组),返回匹配汇总、各收货单入库状态、各入库单状态及回传结果。isNeedAuth=true, isNeedLogin=true, isNeedRight=false。" ], @@ -130,9 +140,7 @@ "version": "2026.04.08-system-02", "date": "2026-04-08", "summary": "saveApiConfig 新增 callback_url 可选参数", - "methods": [ - "storeWarehouse.store.saveApiConfig" - ], + "methods": ["storeWarehouse.store.saveApiConfig"], "notes": [ "新增 callback_url 参数(VARCHAR(500),可选),用于 OPEN_API 类型入库单的 回调地址配置。" ], @@ -142,10 +150,7 @@ "version": "2026.04.08-system-03", "date": "2026-04-08", "summary": "serializeQimenConfig 新增返回 callback_url 字段,影响 list 和 listApiConfig 两个接口", - "methods": [ - "storeWarehouse.store.list", - "storeWarehouse.store.listApiConfig" - ], + "methods": ["storeWarehouse.store.list", "storeWarehouse.store.listApiConfig"], "notes": [ "serializeQimenConfig() 序列化方法新增 callback_url(string)字段。storeWarehouse.store.list 返回的每条记录 api_config 对象中包含 callback_url;storeWarehouse.store.listApiConfig 返回的 list 数组中每条配置包含 callback_url。" ], @@ -155,9 +160,7 @@ "version": "2026.04.08-system-04", "date": "2026-04-08", "summary": "新增库存移库(库位转移)接口", - "methods": [ - "storage.inventory.transferLocation" - ], + "methods": ["storage.inventory.transferLocation"], "notes": [ "新增 storage.inventory.transferLocation 接口,支持批量多商品多库位移库, 包含部分数量移库与全量移库。入参为 warehouse_id(仓库ID)和 transfers 数组(storage_id、target_space_id、quantity),触发 storage_transfer_completed 通知事件, 每条移库记录独立操作日志。isNeedAuth=true, isNeedLogin=true。" ], @@ -167,9 +170,7 @@ "version": "2026.04.08-system-05", "date": "2026-04-08", "summary": "简化移库接口入参,从批量 transfers 数组改为单条移库", - "methods": [ - "storage.inventory.transferLocation" - ], + "methods": ["storage.inventory.transferLocation"], "notes": [ "移除 warehouse_id 和 transfers 数组入参,改为扁平的 storage_id + target_space_id + quantity 三个顶层参数。warehouse_id 从库存记录自动获取,接口从批量移库简化为单商品单库位移库。响应结构同步简化为单条结果对象。" ], @@ -179,9 +180,7 @@ "version": "2026.04.08-system-06", "date": "2026-04-08", "summary": "新增商品库存明细查询接口", - "methods": [ - "stock.warehouse.getStockDetail" - ], + "methods": ["stock.warehouse.getStockDetail"], "notes": [ "新增 stock.warehouse.getStockDetail 接口,按库位/批次维度查询商品库存分布。入参为 stock_id(必填,商品库存ID)和 pagination(可选,含 page/pageSize)。返回 stockItem(商品概要)、storageList(wms_storage 明细数组,含批次号、库位、数 量、锁定数量、生产日期、过期日期等,关联 location_space 库位信息)、pagination 分页信息。isNeedAuth=false, isNeedLogin=true。底层调用 stockStore.getStockDetail,自动校验商品归属当前仓库。" ], @@ -191,9 +190,7 @@ "version": "2026.04.08-system-07", "date": "2026-04-08", "summary": "新增入参 group_by_batch,支持按批次维度切换库存明细聚合方式", - "methods": [ - "stock.warehouse.getStockDetail" - ], + "methods": ["stock.warehouse.getStockDetail"], "notes": [ "新增可选布尔参数 group_by_batch(默认 false)。false 时按库位合并数量,批次相关字段(batch_no, production_date, expiry_date, inbound_time, inbound_order_no, supplier_batch_no)置 null;true 时保持原逻辑返回每条明细。出参结构不变,但 storageList 中批次字段在合并模式下为 null。" ], @@ -203,9 +200,7 @@ "version": "2026.04.08-system-08", "date": "2026-04-08", "summary": "新增按商品维度移库接口", - "methods": [ - "storage.inventory.transferByProduct" - ], + "methods": ["storage.inventory.transferByProduct"], "notes": [ "新增 storage.inventory.transferByProduct 接口,按库位+商品查找所有库存记 录合并移动。入参为 space_id(原库位ID)、stock_id(商品SKU ID,即 wms_stock_warehouse.id)、target_space_id(目标库位ID)、quantity(移库数量)。开启批次管理(is_batch_mgmt=Y)的商品会被拒绝,需使用 transferLocation 按库存记录精确移库。复用 storage_transfer_completed 通知事件,操作日志编码 STORAGE_TRANSFER_BY_PRODUCT。isNeedAuth=true, isNeedLogin=true。" ], @@ -215,9 +210,7 @@ "version": "2026.04.08-system-09", "date": "2026-04-08", "summary": "补充 storeWarehouse.store.list 完整 response 输出字段说明,移除 api_config / apiConfig", - "methods": [ - "storeWarehouse.store.list" - ], + "methods": ["storeWarehouse.store.list"], "notes": [ "从返回结果中移除 api_config 和 apiConfig 字段(代码中 delete serialized.api_config / delete serialized.apiConfig),文档 response 补充完整输出字段列表:id, store_id, store_name, warehouse_id, warehouse_name, counterparty_id, counterparty_name, current_subject_role, auth_status, auth_status_label, apply_reason, review_comment, apply_time, review_time, auth_start, auth_end, actual_end, print_quantity, applied_by, reviewed_by, ended_by, remask, use_status, policy_config, is_auth_valid, remaining_days 以及分页和 current_subject 信息。" ], @@ -227,9 +220,7 @@ "version": "2026.04.08-system-10", "date": "2026-04-08", "summary": "货主列表返回新增 has_qimen_config 布尔字段", - "methods": [ - "storeWarehouse.store.list" - ], + "methods": ["storeWarehouse.store.list"], "notes": [ "storeWarehouse.store.list 返回的 data.list[] 中新增 has_qimen_config(boolean),表示该货主是否已配置奇门。" ], @@ -239,9 +230,7 @@ "version": "2026.04.08-system-11", "date": "2026-04-08", "summary": "补全 stock.warehouse.search 接口文档,新增 params / response / errors 完整说明", - "methods": [ - "stock.warehouse.search" - ], + "methods": ["stock.warehouse.search"], "notes": [ "入参补充 keyword(string,模糊匹配 item_code / item_name / goods_code / barcode)和 store_id(number,按货主筛选)。响应补充 data 数组各字段(id, item_code, goods_code, item_name, sku_property, stock_unit, quantity, locked_quantity, brand_name, item_type, barcodes, store_stock)以及 total。errors 补充 code=0 搜 索失败场景。" ], @@ -251,9 +240,7 @@ "version": "2026.04.08-system-12", "date": "2026-04-08", "summary": "新增 with_stock / is_batch 参数,支持返回关联库存明细(按库位分 组或按批次逐条)", - "methods": [ - "stock.warehouse.search" - ], + "methods": ["stock.warehouse.search"], "notes": [ "入参新增 with_stock(boolean,默认 false,是否返回关联库存数据)和 is_batch(boolean,默认 false,仅 with_stock=true 时生效,按批次明细返回)。响应 data[] 新增 storage[] 字段:is_batch=false 时按库位分组汇总(含 space_id、space、inventory_type、quantity、locked_quantity、available_quantity);is_batch=true 时逐 条返回批次明细(含 id、stock_id、space_id、batch_no、inventory_type、quantity、locked_quantity、available_quantity、production_date、expiry_date、inbound_time、inbound_order_no、supplier_batch_no、created_at、space)。" ], @@ -263,9 +250,7 @@ "version": "2026.04.08-system-13", "date": "2026-04-08", "summary": "新增 wms_stock_transaction 表和模型", - "methods": [ - "wms_stock_transaction" - ], + "methods": ["wms_stock_transaction"], "notes": [ "新增出入库流水记录表 wms_stock_transaction,含 transaction_type(INBOUND/OUTBOUND)、warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type、order_type、order_no、order_id、receiving_id、entry_order_id、operator_id、operator_name、remark 等字段,关联 StockWarehouse 和 Storage 模型。" ], @@ -275,10 +260,7 @@ "version": "2026.04.08-system-14", "date": "2026-04-08", "summary": "quickPutaway 和 matchPutaway 入库时自动写入出入库记录", - "methods": [ - "storage.inventory.quickPutaway", - "storage.inventory.matchPutaway" - ], + "methods": ["storage.inventory.quickPutaway", "storage.inventory.matchPutaway"], "notes": [ "入库操作完成后自动写入 wms_stock_transaction 记录。quickPutaway 写入 order_type='SCRK'(收货入库),matchPutaway 写入 order_type='MATCH'(匹配入库),均 自动填充 warehouse_id、store_id、stock_id、storage_id、space_id、quantity、batch_no、inventory_type 等字段。" ], @@ -288,9 +270,7 @@ "version": "2026.04.08-system-15", "date": "2026-04-08", "summary": "新增 storage.inventory.list 出入库记录列表查询接口", - "methods": [ - "storage.inventory.list" - ], + "methods": ["storage.inventory.list"], "notes": [ "出入库记录列表查询,支持 where 条件(transaction_type、stock_id、space_id、store_id、order_type、order_no、inventory_type、operator_name、created_at)、 分页(pagination)、排序(sort)和 group_by_batch 参数。默认合并模式按库位+商品 聚合返回合计数量与记录条数,group_by_batch=true 时返回每条明细含 batch_no、order_no、operator_name 等完整信息。响应均关联 stockItem(item_code、item_name、sku_property、stock_unit)。" ], @@ -300,9 +280,7 @@ "version": "2026.04.08-system-16", "date": "2026-04-08", "summary": "出入库流水记录查询接口从 storage.inventory.list 改名为 storage.transaction.list", - "methods": [ - "storage.transaction.list" - ], + "methods": ["storage.transaction.list"], "notes": [ "将出入库流水记录查询从 storage.inventory.list 迁移到 storage.transaction.list,避免与库存列表概念混淆。功能和参数不变。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。" ], @@ -313,9 +291,7 @@ "version": "2026.04.08-system-17", "date": "2026-04-08", "summary": "新增 storage.inventory.list 库存列表查询接口", - "methods": [ - "storage.inventory.list" - ], + "methods": ["storage.inventory.list"], "notes": [ "新增库存列表查询接口,查询 wms_storage 表。支持 where 条件(stock_id/space_id/store_id/inventory_type/batch_no/inbound_order_no/available_quantity/inbound_time/created_at)、分页、排序。支持 group_by_batch 参数:默认 false 按库位+商 品合并(SUM quantity/locked_quantity/available_quantity),true 返回每条明细含 batch_no/production_date/expiry_date 等。关联 stockItem(商品信息)和 space(库位信息)。isNeedAuth=false, isNeedLogin=true, isNeedRight=false。" ], @@ -326,9 +302,7 @@ "version": "2026.04.08-system-18", "date": "2026-04-08", "summary": "移除 storage.entry.create 创建入库单接口", - "methods": [ - "storage.entry.create" - ], + "methods": ["storage.entry.create"], "notes": [ "不再允许通过 API 创建入库单。入库单仅由快捷入库(quickPutaway)和匹配入库(matchPutaway)等内部流程自动创建。底层 service 实现保留但不再通过 systemMethods 对外暴露。" ], @@ -354,11 +328,7 @@ "version": "2026.04.08-system-20", "date": "2026-04-08", "summary": "新增 storage.stockout 出库单模块(非订单出库单能力)", - "methods": [ - "storage.stockout.list", - "storage.stockout.toOrder", - "storage.stockout.listItems" - ], + "methods": ["storage.stockout.list", "storage.stockout.toOrder", "storage.stockout.listItems"], "notes": [ "新增 storage.stockout.list / toOrder / listItems 接口,作为非订单出库单的主出口(对应奇门 stockout.create)。storage.delivery.* 仅作为兼容转发保留;底层 部分能力仍复用 order 模块。" ], @@ -369,9 +339,7 @@ "version": "2026.04.08-system-21", "date": "2026-04-08", "summary": "将 storage.stockout.toOrder 标记为占位接口", - "methods": [ - "storage.stockout.toOrder" - ], + "methods": ["storage.stockout.toOrder"], "notes": [ "storage.stockout.toOrder 当前仅保留方法名用于后续扩展,暂不开放实际逻辑。调用时返回 code=405、message=占位接口,暂未开放。" ], @@ -381,9 +349,7 @@ "version": "2026.04.09-system-01", "date": "2026-04-09", "summary": "storage.entry.cancel 支持批量作废,新增 ids 入参并兼容单条 id", - "methods": [ - "storage.entry.cancel" - ], + "methods": ["storage.entry.cancel"], "notes": [ "新增入参 `ids`(number[])以支持批量作废,兼容旧入参 `id`;当同时传入 `ids` 与 `id` 时以 `ids` 为准。", "参数校验:`ids` 必须为非空数组;非法 ID 或空数组返回 400。", @@ -396,9 +362,7 @@ "version": "2026.04.09-system-02", "date": "2026-04-09", "summary": "新增基础模块车牌识别接口 index.recognizeLicensePlate", - "methods": [ - "index.recognizeLicensePlate" - ], + "methods": ["index.recognizeLicensePlate"], "notes": [ "入参:base64(string,必填)或 imageBase64/image_base64(兼容)", "响应:返回归一化后的识别对象,包含 licensePlate、plateNumber、color、confidence、requestId、imageSize、rawData", @@ -411,70 +375,75 @@ "version": "2026.04.09-system-03", "date": "2026-04-09", "summary": "收紧基础模块车牌识别接口响应,仅返回 licensePlate 字段", - "methods": [ - "index.recognizeLicensePlate" - ], + "methods": ["index.recognizeLicensePlate"], "notes": [ "出参由 {licensePlate, plateNumber, color, confidence, requestId, imageSize, rawData} 调整为 {licensePlate}", - "调用方请仅依赖 licensePlate 字段以适配新版本;历史字段已裁剪且不再保证 存 在。", + "调用方请仅依赖 licensePlate 字段以适配新版本;历史字段已裁剪且不再保证存 在。", "文档中未包含任何云密钥或敏感配置信息。" ], "type": "changed" }, { - "version": "2026.04.12-system-01", - "date": "2026-04-12", - "summary": "新增订单工作台各分组 list 接口文档,说明 where 透传与分页上限(pageSize\u003C=200)", + "version": "2026.04.10-system-01", + "date": "2026-04-10", + "summary": "订单审核字段由 audit_status 替换为整数字段 step,并添加数据库迁移", "methods": [ - "order.list", - "order.reviewOrder.list", + "order.getreviewOrderlist", + "order.reviewOrder.getreviewOrderlist", "order.reviewOrder.reviewOrder", - "order.pendingOrder.list", - "order.expectionOrder.list", - "order.entrustOrder.list", - "order.deliveryOrder.list", - "order.deliveryExpectionOrder.list", - "order.archiveOrder.list" + "order.deliveryOrder.getdeliveryOrderlist", + "order.list", + "order.stats" ], "notes": [ - "补充 order 工作台分组 list 接口,并说明所有 list 接口支持 pagination、where、sort;服务端对 pagination.pageSize 做上限截断(MAX=200)。", - "说明 where 参数会被 normalize 并交给解析器 parseWhereConditions,再与模块默认条件合并后用于底层查询;示例:reviewOrder 模块默认 step=0,pendingOrder 默认 step in [1,2],deliveryOrder 默认 dispatch_lane=m4 等。", - "补充待审核模块的审核提交接口 order.reviewOrder.reviewOrder,说明其仅接收 ids 批量入参(number[] 或 string[]),严格同仓校验,不再兼容旧字段。", - "兼容入口(如 getreviewOrderlist / getdeliveryOrderlist 等)作为历史兼容保留,在文档中标为兼容说明,不作为主入口推荐。" + "字段变更:order 相关审核字段从字符串/枚举 audit_status 替换为整数 step。", + "step 映射:0=未审核,1=已审核,2=处理中,3=驳回/异常,4=配送中,5=已完成,9=已关闭。", + "reviewOrder 接口在更新 inspection_status 的同时会写入 step 字段。", + "必须执行迁移脚本:20260410150000-replace-audit-status-with-step-on-order-delivery-tables.js" ], - "type": "added", - "module": "order" - }, - { - "version": "2026.04.13-system-01", - "date": "2026-04-13", - "summary": "新增待处理订单取消接口 order.pendingOrder.cancelOrder(ids-only)", - "methods": [ - "order.pendingOrder.cancelOrder" - ], - "notes": [ - "新增接口 order.pendingOrder.cancelOrder:用于批量取消待处理订单,接口仅接受 ids 数组入参(number[] 或 string[]),不再兼容 id/order_id/逗号字符串等兼容写法。", - "严格同仓校验:仓库上下文由当前登录用户的 store_id 决定,禁止传入 warehouse_id / warehouseId。", - "状态限制:仅允许 step ∈ [1,2] 且 outbound_status != 'padding' 的订单被取消;已取消或已完成的订单不可取消,状态不满足时返回 404/400。", - "取消后语义:接口将把订单表的 status 字段设为 'cancel' 并更新 updated_at;返回首个被取消的订单 id、status、updated_at、updated_count 与 ids 列表。", - "入参/响应契约已按代码侧约定(ids-only、同仓校验、允许状态集合、取消后语义)同步到 methods/system.json。" - ], - "type": "added", - "module": "order" + "type": "changed" }, { "version": "2026.04.13-system-02", "date": "2026-04-13", - "summary": "新增订单工作台角标聚合接口 order.badgeCount", - "methods": [ - "order.badgeCount" - ], + "summary": "stock.warehouse.search 返回新增效期管理字段并保留 is_shelf_life_mgmt", + "methods": ["stock.warehouse.search"], "notes": [ - "聚合返回 8 个订单工作台标签的展示值(用于前端 badge)。", - "按当前登录用户的 store_id 维度做短缓存;5 个模块查表统计数量,≥100 返回 '99+',否则返回实际数字(0..99)。", - "deliveryOrder、deliveryExpectionOrder、archiveOrder 三个字段固定返回 '99+'(不查表)。" + "响应 data[] 中新增字段:inbound_min_days、outbound_min_days、shelf_life_days、remaining_threshold_days(均为 number,单位:天)。", + "保留并说明 is_shelf_life_mgmt 布尔字段(boolean),表示是否启用效期管理(true=启用)。", + "仅更新文档(methods/system.json 与变更记录),代码行为不变。" ], - "type": "added", - "module": "order" + "type": "updated" + }, + { + "version": "2026.04.13-system-02", + "date": "2026-04-13", + "summary": "新增 storage.expiry.list 库存有效期列表查询接口", + "methods": ["storage.expiry.list"], + "notes": [ + "该接口查询 wms_storage,关联 stockWarehouse 和 locationSpace,并按当前仓库与 remaining_threshold_days / expiry_date 过滤。" + ], + "type": "added" + }, + { + "version": "2026.04.13-system-03", + "date": "2026-04-13", + "summary": "新增 storage.inventory.list 库存列表返回效期字段与预警标记", + "methods": ["storage.inventory.list"], + "notes": [ + "库存列表响应增加生产日期、过期日期、效期预警是否触发字段", + "预警标记仅在商品启用保质期管理且到期日满足阈值条件时为 true" + ], + "type": "updated" + }, + { + "version": "2026.04.14-system-01", + "date": "2026-04-14", + "summary": "更新 index.searchSpace 文档", + "methods": ["index.searchSpace"], + "notes": [ + "补充 index.searchSpace 的 params/response,按 ctx.user.store_id 作为仓库上下文;keyword 为可选字符串,对 space_code 与 custom_barcode 做 %keyword% 模糊匹配;返回字段 id、space_code、custom_barcode、custom_name,最多 50 条;仅文档同步,无代码变更。" + ], + "type": "updated" } -] \ No newline at end of file +] diff --git a/workflows/api-doc-sync/data/pending-updates.json b/workflows/api-doc-sync/data/pending-updates.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/workflows/api-doc-sync/data/pending-updates.json @@ -0,0 +1 @@ +[] diff --git a/workflows/api-doc-sync/update.mjs b/workflows/api-doc-sync/update.mjs new file mode 100644 index 00000000..13fdf07e --- /dev/null +++ b/workflows/api-doc-sync/update.mjs @@ -0,0 +1,182 @@ +import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises"; +import { createHash } from "node:crypto"; +import path from "node:path"; +import { API_DOC_SYNC_CONFIG } from "./config.mjs"; + +const LEGACY_FILES = { + localChanges: path.join("src", "apichanges.txt"), +}; + +function stableId(record) { + if (record?.version) { + return String(record.version); + } + + const payload = JSON.stringify({ + date: record?.date ?? "", + summary: record?.summary ?? "", + methods: Array.isArray(record?.methods) ? record.methods : [], + notes: Array.isArray(record?.notes) ? record.notes : [], + }); + return createHash("sha1").update(payload).digest("hex"); +} + +function normalizePendingRecord(record) { + return { + summary: record?.summary ?? "", + methods: Array.isArray(record?.methods) ? record.methods : [], + notes: Array.isArray(record?.notes) ? record.notes : [], + }; +} + +async function readJsonArray(filePath) { + try { + const content = await readFile(filePath, "utf8"); + const parsed = JSON.parse(content); + return Array.isArray(parsed) ? parsed : []; + } catch (error) { + if (error?.code === "ENOENT") { + return []; + } + throw error; + } +} + +async function readLocalChangesWithLegacyFallback() { + const { + file: { localChanges }, + } = API_DOC_SYNC_CONFIG; + + const localData = await readJsonArray(localChanges); + if (localData.length > 0) { + return localData; + } + + const legacyData = await readJsonArray(LEGACY_FILES.localChanges); + if (legacyData.length > 0) { + await writeJson(localChanges, legacyData); + return legacyData; + } + + return []; +} + +function parseChangesPayload(content) { + const trimmed = content.trim(); + + try { + const parsed = JSON.parse(trimmed); + if (Array.isArray(parsed)) { + return parsed; + } + } catch { + // Fallback: extract JSON array from HTML/text. + } + + const start = trimmed.indexOf("["); + const end = trimmed.lastIndexOf("]"); + if (start < 0 || end < 0 || end <= start) { + throw new Error("远端返回内容中未找到可解析的 JSON 数组。"); + } + + const parsedFallback = JSON.parse(trimmed.slice(start, end + 1)); + if (!Array.isArray(parsedFallback)) { + throw new Error("远端返回内容解析后不是数组。"); + } + return parsedFallback; +} + +async function fetchRemoteChanges() { + const response = await fetch(API_DOC_SYNC_CONFIG.changesUrl, { + method: "GET", + signal: AbortSignal.timeout(20000), + }); + + if (!response.ok) { + throw new Error(`抓取接口日志失败:HTTP ${response.status}`); + } + + const text = await response.text(); + return parseChangesPayload(text); +} + +async function writeJson(filePath, data) { + await mkdir(path.dirname(filePath), { recursive: true }); + await writeFile(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf8"); +} + +async function writeHistorySnapshot(changes) { + const { + file: { historyDir }, + history: { prefix, suffix }, + } = API_DOC_SYNC_CONFIG; + await mkdir(historyDir, { recursive: true }); + + const timestamp = new Date().toISOString().replace(/[:.]/g, "-"); + const snapshotPath = path.join(historyDir, `${prefix}${timestamp}${suffix}`); + await writeJson(snapshotPath, changes); + return snapshotPath; +} + +async function pruneHistory() { + const { + file: { historyDir }, + history: { prefix, suffix }, + historyMaxFiles, + } = API_DOC_SYNC_CONFIG; + + await mkdir(historyDir, { recursive: true }); + const files = await readdir(historyDir); + const historyFiles = files.filter((file) => file.startsWith(prefix) && file.endsWith(suffix)); + if (historyFiles.length <= historyMaxFiles) { + return; + } + + const fileStats = await Promise.all( + historyFiles.map(async (file) => { + const filePath = path.join(historyDir, file); + const fileInfo = await stat(filePath); + return { + filePath, + mtimeMs: fileInfo.mtimeMs, + }; + }), + ); + + fileStats.sort((a, b) => b.mtimeMs - a.mtimeMs); + const expired = fileStats.slice(historyMaxFiles); + await Promise.all(expired.map((item) => rm(item.filePath))); +} + +async function run() { + const { + file: { localChanges, pendingChanges }, + } = API_DOC_SYNC_CONFIG; + + const localData = await readLocalChangesWithLegacyFallback(); + const remoteData = await fetchRemoteChanges(); + + const localIds = new Set(localData.map(stableId)); + const newRecords = remoteData.filter((item) => !localIds.has(stableId(item))); + + if (newRecords.length === 0) { + await writeJson(pendingChanges, []); + console.log("未检测到接口更新,已清理待更新接口文件。"); + return; + } + + await writeJson(localChanges, remoteData); + await writeJson(pendingChanges, newRecords.map(normalizePendingRecord)); + const snapshotPath = await writeHistorySnapshot(remoteData); + await pruneHistory(); + + console.log(`检测到 ${newRecords.length} 条接口更新。`); + console.log(`已更新本地日志:${localChanges}`); + console.log(`已更新待更新文件:${pendingChanges}`); + console.log(`已生成历史快照:${snapshotPath}`); +} + +run().catch((error) => { + console.error("执行 API 文档更新流程失败:", error); + process.exitCode = 1; +});