Compare commits

...
Author SHA1 Message Date
lixu ef358b0a76 Merge pull request 'chore(frontend): 升级 vite 6、postcss,修复 npm audit 漏洞 (#60)' (#61) from devin/1793622104-goods-60-frontend-deps into main
Merge pull request 'chore(frontend): 升级 vite 6、postcss,修复 npm audit 漏洞 (#60)' (#61)
2026-11-02 20:26:12 +08:00
fu500fandDevin AI e6dbc39d3f chore(frontend): 升级 vite 6、postcss,修复 npm audit 漏洞 (#60)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-02 12:23:39 +00:00
lixu c9563a83d0 Merge pull request 'feat(bypos-collector): 跨次去重、重试、导入 Goods 等采集器改进(取代 #24)' (#59) from devin/1793411261-goods-24-collector-improvements into main 2026-10-31 09:51:55 +08:00
z8jd98andDevin AI a72366566e feat(bypos-collector): 跨次去重、重试、CSV 补全、端口自动选择、Windows 日志和一键导入(取代 #24)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-31 01:48:15 +00:00
lixu c163f2b741 Merge pull request 'docs: 完善 README,移除未使用的 MinIO,修正 openapi 路径 (#48)' (#58) from devin/1793408463-goods-48-docs-minio into main 2026-10-31 09:45:44 +08:00
lixu 08140d7c6b Merge pull request 'test(admin): 补充后台接口测试,修复 bypos 导入不认 JSON 数组 (#47)' (#57) from devin/1793408183-goods-47-admin-api-tests into main 2026-10-31 09:45:39 +08:00
lixu 44d0bfc217 Merge pull request 'feat(api): HTTP 服务补齐超时并支持优雅退出 (#46)' (#56) from devin/1793408086-goods-46-graceful-shutdown into main 2026-10-31 09:45:33 +08:00
lixu 17eb6c134e Merge pull request 'fix(api): 公开投稿限流器定期清理过期记录 (#44)' (#54) from devin/1793407948-goods-44-submission-rate-prune into main 2026-10-31 09:45:29 +08:00
z8jd98andDevin AI 8779f0fe81 docs: document trusted proxy configuration
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-31 01:40:02 +00:00
z8jd98 04112c4fd2 Merge remote-tracking branch 'origin/main' into devin/1793408463-goods-48-docs-minio 2026-10-31 01:39:53 +00:00
z8jd98 3172928306 Merge remote-tracking branch 'origin/main' into devin/1793408086-goods-46-graceful-shutdown
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	api/cmd/admin/main.go
#	api/cmd/server/main.go
2026-10-31 01:39:49 +00:00
z8jd98 62bc2c6fda Merge remote-tracking branch 'origin/main' into devin/1793407948-goods-44-submission-rate-prune 2026-10-31 01:39:20 +00:00
fu500fandDevin AI 007fc7b938 docs: 完善 README,移除未使用的 MinIO,修正 openapi 路径 (#48)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-31 01:01:59 +00:00
fu500fandDevin AI 3aaa7b1d0c feat(api): 增加服务优雅关闭与超时配置 (#46)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-31 00:56:16 +00:00
fu500fandDevin AI 31e1a8977b fix(api): 清理投稿限流器的过期 IP 记录 (#44)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-31 00:52:56 +00:00
20 changed files with 1194 additions and 457 deletions
-2
View File
@@ -3,8 +3,6 @@
POSTGRES_USER=opengoods POSTGRES_USER=opengoods
POSTGRES_PASSWORD=change-me POSTGRES_PASSWORD=change-me
POSTGRES_DB=opengoods POSTGRES_DB=opengoods
MINIO_ROOT_USER=opengoods
MINIO_ROOT_PASSWORD=change-me
# Empty uses loopback and private-network defaults; use "none" to trust no proxies. # Empty uses loopback and private-network defaults; use "none" to trust no proxies.
OPENGOODS_TRUSTED_PROXIES= OPENGOODS_TRUSTED_PROXIES=
+108 -2
View File
@@ -1,2 +1,108 @@
# goods # OpenGoods
商品档案公开API
OpenGoods(天工·商品标签)提供公开、只读的商品事实 API,并配套运营后台和数据采集工具。项目整理商品名称、品牌、品类、条码、配料、营养成分、产地等客观信息,不提供购买或交易功能。
## 项目组成
- **公开 API**:Go 服务,提供商品搜索、品牌和商品详情等只读接口。
- **运营后台**:独立的 Go 管理服务,提供登录、商品维护、投稿审核、API Key 和导入功能。
- **数据采集**:`ingestion/` 是 Python 采集与 ETL 包;`tools/bypos-collector/` 包含 BYPOS 采集工具。
- **前端**:`public-frontend/` 是公开站点,`admin-frontend/` 是运营后台界面;两者均使用 React、Vite 和 TypeScript。
- **数据库迁移**:`migrations/` 保存 PostgreSQL schema 的正向与回滚迁移。
## API 与文档
- API 使用说明:[`docs/api.md`](docs/api.md)
- OpenAPI 规范源文件:[`api/internal/handler/openapi.json`](api/internal/handler/openapi.json)
- 数据契约:[`docs/data-contract.md`](docs/data-contract.md)
- 采集说明:[`docs/etl-openfoodfacts.md`](docs/etl-openfoodfacts.md) 和 [`docs/ingestion-management.md`](docs/ingestion-management.md)
- 部署指南:[`docs/deploy.md`](docs/deploy.md)
运行中的公开服务也通过 `GET /api/v1/openapi.json` 提供机器可读规范。
## 本地开发
需要 Go(版本要求见 `api/go.mod`)、Docker Compose、Node.js(18.x、20.x 或 22 及以上)和 npm,以及 Python 3.11 或更新版本(用于采集侧开发)。
启动 PostgreSQL 和 Redis:
```bash
docker compose up -d postgres redis
```
安装迁移工具并应用数据库迁移:
```bash
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.1
migrate -path migrations \
-database 'postgres://opengoods:opengoods@localhost:5432/opengoods?sslmode=disable' up
```
启动公开 API:
```bash
cd api
export OPENGOODS_DATABASE_URL='postgres://opengoods:opengoods@localhost:5432/opengoods?sslmode=disable'
export OPENGOODS_REDIS_URL='redis://localhost:6379/0'
go run ./cmd/server
```
在另一个终端启动运营后台(本地示例凭据请自行替换):
```bash
cd api
export OPENGOODS_DATABASE_URL='postgres://opengoods:opengoods@localhost:5432/opengoods?sslmode=disable'
export OPENGOODS_REDIS_URL='redis://localhost:6379/0'
export GOODS_ADMIN_ADDR=':8081'
export GOODS_ADMIN_USER='admin'
export GOODS_ADMIN_PASSWORD='local-development-password'
export GOODS_ADMIN_JWT_SECRET='local-development-secret-change-before-use'
go run ./cmd/admin
```
前端可在各自目录启动 Vite 开发服务器(分别在两个终端运行):
```bash
cd public-frontend
npm install
npm run dev
```
```bash
cd admin-frontend
npm install
npm run dev
```
## 测试与构建
Go API:
```bash
cd api
test -z "$(gofmt -l .)"
go vet ./...
go build ./...
go test ./...
```
Python 采集侧:
```bash
cd ingestion
pip install -e ".[dev]"
ruff check .
ruff format --check .
pytest -q
```
前端构建:
```bash
(cd public-frontend && npm install && npm run build)
(cd admin-frontend && npm install && npm run build)
```
生产部署步骤、环境变量和反向代理配置见[部署文档](docs/deploy.md)。
可信代理通过 `OPENGOODS_TRUSTED_PROXIES` 配置;支持格式与默认行为见部署指南。
+267 -167
View File
@@ -17,10 +17,10 @@
"@types/react-dom": "^18.2.19", "@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.17",
"postcss": "^8.4.35", "postcss": "^8.5.32",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "^5.3.3", "typescript": "^5.3.3",
"vite": "^5.1.0" "vite": "^6.4.5"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@@ -319,9 +319,9 @@
} }
}, },
"node_modules/@esbuild/aix-ppc64": { "node_modules/@esbuild/aix-ppc64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
"integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@@ -332,13 +332,13 @@
"aix" "aix"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/android-arm": { "node_modules/@esbuild/android-arm": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
"integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -349,13 +349,13 @@
"android" "android"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/android-arm64": { "node_modules/@esbuild/android-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
"integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -366,13 +366,13 @@
"android" "android"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/android-x64": { "node_modules/@esbuild/android-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
"integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -383,13 +383,13 @@
"android" "android"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/darwin-arm64": { "node_modules/@esbuild/darwin-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -400,13 +400,13 @@
"darwin" "darwin"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/darwin-x64": { "node_modules/@esbuild/darwin-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
"integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -417,13 +417,13 @@
"darwin" "darwin"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/freebsd-arm64": { "node_modules/@esbuild/freebsd-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
"integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -434,13 +434,13 @@
"freebsd" "freebsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/freebsd-x64": { "node_modules/@esbuild/freebsd-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
"integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -451,13 +451,13 @@
"freebsd" "freebsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-arm": { "node_modules/@esbuild/linux-arm": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
"integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -468,13 +468,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-arm64": { "node_modules/@esbuild/linux-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
"integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -485,13 +485,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-ia32": { "node_modules/@esbuild/linux-ia32": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
"integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -502,13 +502,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-loong64": { "node_modules/@esbuild/linux-loong64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
"integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
@@ -519,13 +519,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-mips64el": { "node_modules/@esbuild/linux-mips64el": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
"integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
"cpu": [ "cpu": [
"mips64el" "mips64el"
], ],
@@ -536,13 +536,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-ppc64": { "node_modules/@esbuild/linux-ppc64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
"integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@@ -553,13 +553,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-riscv64": { "node_modules/@esbuild/linux-riscv64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
"integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@@ -570,13 +570,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-s390x": { "node_modules/@esbuild/linux-s390x": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
"integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
@@ -587,13 +587,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-x64": { "node_modules/@esbuild/linux-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
"integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -604,13 +604,30 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}
},
"node_modules/@esbuild/netbsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
} }
}, },
"node_modules/@esbuild/netbsd-x64": { "node_modules/@esbuild/netbsd-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
"integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -621,13 +638,30 @@
"netbsd" "netbsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
} }
}, },
"node_modules/@esbuild/openbsd-x64": { "node_modules/@esbuild/openbsd-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
"integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -638,13 +672,30 @@
"openbsd" "openbsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}
},
"node_modules/@esbuild/openharmony-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
} }
}, },
"node_modules/@esbuild/sunos-x64": { "node_modules/@esbuild/sunos-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
"integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -655,13 +706,13 @@
"sunos" "sunos"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/win32-arm64": { "node_modules/@esbuild/win32-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
"integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -672,13 +723,13 @@
"win32" "win32"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/win32-ia32": { "node_modules/@esbuild/win32-ia32": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
"integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -689,13 +740,13 @@
"win32" "win32"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/win32-x64": { "node_modules/@esbuild/win32-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
"integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -706,7 +757,7 @@
"win32" "win32"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
@@ -1321,9 +1372,9 @@
} }
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.10.38", "version": "2.11.34",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.38.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.34.tgz",
"integrity": "sha512-31/02mVB4yuQU6adKk5SlY6m+mxDwUq5KZkyYgnLrrKl7TEm1+3PyDtDBz2kOv/wxZz41GHsvV1A/u6RmiyBvw==", "integrity": "sha512-Aqr8mA1kIvyJ3UY5YAY7ib8LSo1DmDMbMnVqGPtsKW1LxaFQFwn9Eb3yvq2fUKJsRvaXjnAV7R5osqETapzNiA==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@@ -1360,9 +1411,9 @@
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.2", "version": "4.29.5",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz",
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1380,11 +1431,11 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.10.12", "baseline-browser-mapping": "^2.11.33",
"caniuse-lite": "^1.0.30001782", "caniuse-lite": "^1.0.30001819",
"electron-to-chromium": "^1.5.328", "electron-to-chromium": "^1.5.464",
"node-releases": "^2.0.36", "node-releases": "^2.0.60",
"update-browserslist-db": "^1.2.3" "update-browserslist-db": "^1.3.4"
}, },
"bin": { "bin": {
"browserslist": "cli.js" "browserslist": "cli.js"
@@ -1404,9 +1455,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001799", "version": "1.0.30001820",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001820.tgz",
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", "integrity": "sha512-gfWD6MxqVCqAOwmODfZf7DchWvlrA+SRdNX7ceLfg3xRqe5ssjjpF7EgslC/0tiLiNTajdaNN/q8c/5u/7Gz8w==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1532,9 +1583,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.376", "version": "1.5.472",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.376.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.472.tgz",
"integrity": "sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==", "integrity": "sha512-s4+nfT29b0FKpVKoaIxl2pWsoNcn7A/nMPSrxayw4T3BsmPeV2lF9Y06BsAQeMGhCTQ4nYJ5XST7jkqe4ZEqFw==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -1549,9 +1600,9 @@
} }
}, },
"node_modules/esbuild": { "node_modules/esbuild": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
@@ -1559,32 +1610,35 @@
"esbuild": "bin/esbuild" "esbuild": "bin/esbuild"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}, },
"optionalDependencies": { "optionalDependencies": {
"@esbuild/aix-ppc64": "0.21.5", "@esbuild/aix-ppc64": "0.25.12",
"@esbuild/android-arm": "0.21.5", "@esbuild/android-arm": "0.25.12",
"@esbuild/android-arm64": "0.21.5", "@esbuild/android-arm64": "0.25.12",
"@esbuild/android-x64": "0.21.5", "@esbuild/android-x64": "0.25.12",
"@esbuild/darwin-arm64": "0.21.5", "@esbuild/darwin-arm64": "0.25.12",
"@esbuild/darwin-x64": "0.21.5", "@esbuild/darwin-x64": "0.25.12",
"@esbuild/freebsd-arm64": "0.21.5", "@esbuild/freebsd-arm64": "0.25.12",
"@esbuild/freebsd-x64": "0.21.5", "@esbuild/freebsd-x64": "0.25.12",
"@esbuild/linux-arm": "0.21.5", "@esbuild/linux-arm": "0.25.12",
"@esbuild/linux-arm64": "0.21.5", "@esbuild/linux-arm64": "0.25.12",
"@esbuild/linux-ia32": "0.21.5", "@esbuild/linux-ia32": "0.25.12",
"@esbuild/linux-loong64": "0.21.5", "@esbuild/linux-loong64": "0.25.12",
"@esbuild/linux-mips64el": "0.21.5", "@esbuild/linux-mips64el": "0.25.12",
"@esbuild/linux-ppc64": "0.21.5", "@esbuild/linux-ppc64": "0.25.12",
"@esbuild/linux-riscv64": "0.21.5", "@esbuild/linux-riscv64": "0.25.12",
"@esbuild/linux-s390x": "0.21.5", "@esbuild/linux-s390x": "0.25.12",
"@esbuild/linux-x64": "0.21.5", "@esbuild/linux-x64": "0.25.12",
"@esbuild/netbsd-x64": "0.21.5", "@esbuild/netbsd-arm64": "0.25.12",
"@esbuild/openbsd-x64": "0.21.5", "@esbuild/netbsd-x64": "0.25.12",
"@esbuild/sunos-x64": "0.21.5", "@esbuild/openbsd-arm64": "0.25.12",
"@esbuild/win32-arm64": "0.21.5", "@esbuild/openbsd-x64": "0.25.12",
"@esbuild/win32-ia32": "0.21.5", "@esbuild/openharmony-arm64": "0.25.12",
"@esbuild/win32-x64": "0.21.5" "@esbuild/sunos-x64": "0.25.12",
"@esbuild/win32-arm64": "0.25.12",
"@esbuild/win32-ia32": "0.25.12",
"@esbuild/win32-x64": "0.25.12"
} }
}, },
"node_modules/escalade": { "node_modules/escalade": {
@@ -1924,9 +1978,9 @@
} }
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.13", "version": "3.3.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.13.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
"integrity": "sha512-sPdqC6ByMVVGvF1ynvvMo0/o+oD1VX7DaHhijt1bFgjvBkHBib4t49GoNDhf2NDta4oeUNlaGbSt5K7qjZ955Q==", "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1943,9 +1997,9 @@
} }
}, },
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.48", "version": "2.0.63",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.48.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.63.tgz",
"integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==", "integrity": "sha512-6li2QanLsAXpIH2R6j77MzRyvOyrvdTqlKtO4CgBdHGNvN99ZZfyxszHc5o5+IZBWD5u6Hzwg83JoGXmqZNG9Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -2030,9 +2084,9 @@
} }
}, },
"node_modules/postcss": { "node_modules/postcss": {
"version": "8.5.15", "version": "8.5.32",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
"integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2050,9 +2104,9 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"nanoid": "^3.3.12", "nanoid": "^3.3.20",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"source-map-js": "^1.2.1" "source-map-js": "^1.2.2"
}, },
"engines": { "engines": {
"node": "^10 || ^12 || >=14" "node": "^10 || ^12 || >=14"
@@ -2172,9 +2226,9 @@
} }
}, },
"node_modules/postcss-selector-parser": { "node_modules/postcss-selector-parser": {
"version": "6.1.4", "version": "6.1.5",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.5.tgz",
"integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==", "integrity": "sha512-TEHFzb5KRDKaOgJ4TYE+0jyJtFbjLvkdVOu0fZ2b6MTWzoqZd4Le+61aEppWkvTlYePgOX4ATL1wsAIPMLTw6Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2393,9 +2447,9 @@
} }
}, },
"node_modules/source-map-js": { "node_modules/source-map-js": {
"version": "1.2.1", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"dev": true, "dev": true,
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"engines": { "engines": {
@@ -2582,9 +2636,9 @@
} }
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.2.3", "version": "1.3.4",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz",
"integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2620,21 +2674,24 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "5.4.21", "version": "6.4.5",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz",
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", "integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"esbuild": "^0.21.3", "esbuild": "^0.25.0",
"postcss": "^8.4.43", "fdir": "^6.4.4",
"rollup": "^4.20.0" "picomatch": "^4.0.2",
"postcss": "^8.5.3",
"rollup": "^4.34.9",
"tinyglobby": "^0.2.13"
}, },
"bin": { "bin": {
"vite": "bin/vite.js" "vite": "bin/vite.js"
}, },
"engines": { "engines": {
"node": "^18.0.0 || >=20.0.0" "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
}, },
"funding": { "funding": {
"url": "https://github.com/vitejs/vite?sponsor=1" "url": "https://github.com/vitejs/vite?sponsor=1"
@@ -2643,19 +2700,25 @@
"fsevents": "~2.3.3" "fsevents": "~2.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@types/node": "^18.0.0 || >=20.0.0", "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
"jiti": ">=1.21.0",
"less": "*", "less": "*",
"lightningcss": "^1.21.0", "lightningcss": "^1.21.0",
"sass": "*", "sass": "*",
"sass-embedded": "*", "sass-embedded": "*",
"stylus": "*", "stylus": "*",
"sugarss": "*", "sugarss": "*",
"terser": "^5.4.0" "terser": "^5.16.0",
"tsx": "^4.8.1",
"yaml": "^2.4.2"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@types/node": { "@types/node": {
"optional": true "optional": true
}, },
"jiti": {
"optional": true
},
"less": { "less": {
"optional": true "optional": true
}, },
@@ -2676,9 +2739,46 @@
}, },
"terser": { "terser": {
"optional": true "optional": true
},
"tsx": {
"optional": true
},
"yaml": {
"optional": true
} }
} }
}, },
"node_modules/vite/node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0.0"
},
"peerDependencies": {
"picomatch": "^3 || ^4"
},
"peerDependenciesMeta": {
"picomatch": {
"optional": true
}
}
},
"node_modules/vite/node_modules/picomatch": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/yallist": { "node_modules/yallist": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+2 -2
View File
@@ -18,9 +18,9 @@
"@types/react-dom": "^18.2.19", "@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.17",
"postcss": "^8.4.35", "postcss": "^8.5.32",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "^5.3.3", "typescript": "^5.3.3",
"vite": "^5.1.0" "vite": "^6.4.5"
} }
} }
+33 -6
View File
@@ -8,7 +8,9 @@ import (
"log" "log"
"net/http" "net/http"
"os" "os"
"os/signal"
"strconv" "strconv"
"syscall"
"time" "time"
"github.com/jackc/pgx/v5/pgxpool" "github.com/jackc/pgx/v5/pgxpool"
@@ -51,6 +53,8 @@ func main() {
if err != nil { if err != nil {
log.Fatalf("invalid OPENGOODS_TRUSTED_PROXIES: %v", err) log.Fatalf("invalid OPENGOODS_TRUSTED_PROXIES: %v", err)
} }
runCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
// Password: prefer a bcrypt hash; otherwise hash a plaintext password. // Password: prefer a bcrypt hash; otherwise hash a plaintext password.
var passwordHash []byte var passwordHash []byte
@@ -75,14 +79,12 @@ func main() {
log.Print("warning: GOODS_ADMIN_JWT_SECRET not set; using a random secret (tokens invalidate on restart)") log.Print("warning: GOODS_ADMIN_JWT_SECRET not set; using a random secret (tokens invalidate on restart)")
} }
ctx := context.Background() pool, err := pgxpool.New(context.Background(), dbURL)
pool, err := pgxpool.New(ctx, dbURL)
if err != nil { if err != nil {
log.Fatalf("failed to create db pool: %v", err) log.Fatalf("failed to create db pool: %v", err)
} }
defer pool.Close()
pingCtx, cancel := context.WithTimeout(ctx, 5*time.Second) pingCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel() defer cancel()
if err := pool.Ping(pingCtx); err != nil { if err := pool.Ping(pingCtx); err != nil {
log.Printf("warning: database not reachable at startup: %v", err) log.Printf("warning: database not reachable at startup: %v", err)
@@ -102,9 +104,34 @@ func main() {
Addr: addr, Addr: addr,
Handler: h.Router(), Handler: h.Router(),
ReadHeaderTimeout: 10 * time.Second, ReadHeaderTimeout: 10 * time.Second,
ReadTimeout: 60 * time.Second,
WriteTimeout: 60 * time.Second,
IdleTimeout: 120 * time.Second,
} }
log.Printf("OpenGoods admin console listening on %s (base path %s)", addr, basePath) log.Printf("OpenGoods admin console listening on %s (base path %s)", addr, basePath)
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { serverErr := make(chan error, 1)
log.Fatalf("server error: %v", err) go func() {
serverErr <- srv.ListenAndServe()
}()
select {
case err := <-serverErr:
pool.Close()
if err != nil && err != http.ErrServerClosed {
log.Fatalf("server error: %v", err)
}
case <-runCtx.Done():
log.Print("shutdown signal received")
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 25*time.Second)
err := srv.Shutdown(shutdownCtx)
shutdownCancel()
if err != nil {
log.Printf("server shutdown: %v", err)
}
pool.Close()
if err := <-serverErr; err != nil && err != http.ErrServerClosed {
log.Printf("server error after shutdown: %v", err)
}
log.Print("OpenGoods admin console shutdown complete")
} }
} }
+34 -6
View File
@@ -5,6 +5,9 @@ import (
"context" "context"
"log" "log"
"net/http" "net/http"
"os"
"os/signal"
"syscall"
"time" "time"
"github.com/jackc/pgx/v5/pgxpool" "github.com/jackc/pgx/v5/pgxpool"
@@ -24,15 +27,15 @@ func main() {
if err != nil { if err != nil {
log.Fatalf("invalid OPENGOODS_TRUSTED_PROXIES: %v", err) log.Fatalf("invalid OPENGOODS_TRUSTED_PROXIES: %v", err)
} }
runCtx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
ctx := context.Background() pool, err := pgxpool.New(context.Background(), cfg.DatabaseURL)
pool, err := pgxpool.New(ctx, cfg.DatabaseURL)
if err != nil { if err != nil {
log.Fatalf("failed to create db pool: %v", err) log.Fatalf("failed to create db pool: %v", err)
} }
defer pool.Close()
pingCtx, cancel := context.WithTimeout(ctx, 5*time.Second) pingCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel() defer cancel()
if err := pool.Ping(pingCtx); err != nil { if err := pool.Ping(pingCtx); err != nil {
log.Printf("warning: database not reachable at startup: %v", err) log.Printf("warning: database not reachable at startup: %v", err)
@@ -56,10 +59,35 @@ func main() {
Addr: cfg.Addr, Addr: cfg.Addr,
Handler: h.Router(), Handler: h.Router(),
ReadHeaderTimeout: 10 * time.Second, ReadHeaderTimeout: 10 * time.Second,
ReadTimeout: 60 * time.Second,
WriteTimeout: 60 * time.Second,
IdleTimeout: 120 * time.Second,
} }
log.Printf("OpenGoods API listening on %s", cfg.Addr) log.Printf("OpenGoods API listening on %s", cfg.Addr)
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { serverErr := make(chan error, 1)
log.Fatalf("server error: %v", err) go func() {
serverErr <- srv.ListenAndServe()
}()
select {
case err := <-serverErr:
pool.Close()
if err != nil && err != http.ErrServerClosed {
log.Fatalf("server error: %v", err)
}
case <-runCtx.Done():
log.Print("shutdown signal received")
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 25*time.Second)
err := srv.Shutdown(shutdownCtx)
shutdownCancel()
if err != nil {
log.Printf("server shutdown: %v", err)
}
pool.Close()
if err := <-serverErr; err != nil && err != http.ErrServerClosed {
log.Printf("server error after shutdown: %v", err)
}
log.Print("OpenGoods API shutdown complete")
} }
} }
+26 -8
View File
@@ -8,10 +8,11 @@ import (
// rateLimiter is a simple fixed-window per-key limiter used to throttle // rateLimiter is a simple fixed-window per-key limiter used to throttle
// anonymous public submissions (basic anti-spam; captcha can be added later). // anonymous public submissions (basic anti-spam; captcha can be added later).
type rateLimiter struct { type rateLimiter struct {
mu sync.Mutex mu sync.Mutex
hits map[string][]time.Time hits map[string][]time.Time
limit int limit int
window time.Duration window time.Duration
lastPrune time.Time
} }
func newRateLimiter(limit int, window time.Duration) *rateLimiter { func newRateLimiter(limit int, window time.Duration) *rateLimiter {
@@ -26,12 +27,19 @@ func (r *rateLimiter) allow(key string) bool {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()
kept := r.hits[key][:0] if now.Sub(r.lastPrune) > r.window {
for _, t := range r.hits[key] { for expiredKey, hits := range r.hits {
if t.After(cutoff) { kept := pruneRateLimitHits(hits, cutoff)
kept = append(kept, t) if len(kept) == 0 {
delete(r.hits, expiredKey)
} else {
r.hits[expiredKey] = kept
}
} }
r.lastPrune = now
} }
kept := pruneRateLimitHits(r.hits[key], cutoff)
if len(kept) >= r.limit { if len(kept) >= r.limit {
r.hits[key] = kept r.hits[key] = kept
return false return false
@@ -39,3 +47,13 @@ func (r *rateLimiter) allow(key string) bool {
r.hits[key] = append(kept, now) r.hits[key] = append(kept, now)
return true return true
} }
func pruneRateLimitHits(hits []time.Time, cutoff time.Time) []time.Time {
kept := hits[:0]
for _, hit := range hits {
if hit.After(cutoff) {
kept = append(kept, hit)
}
}
return kept
}
@@ -0,0 +1,31 @@
package adminhandler
import (
"testing"
"time"
)
func TestRateLimiterPrunesExpiredKeysAndPreservesLiveLimits(t *testing.T) {
window := time.Minute
now := time.Now()
limiter := newRateLimiter(2, window)
limiter.hits["expired"] = []time.Time{now.Add(-2 * window)}
limiter.hits["live"] = []time.Time{now.Add(-time.Second)}
limiter.lastPrune = now.Add(-2 * window)
if !limiter.allow("live") {
t.Fatal("allow rejected a live key below its limit")
}
if _, ok := limiter.hits["expired"]; ok {
t.Fatal("expired key was not pruned")
}
if got := len(limiter.hits["live"]); got != 2 {
t.Fatalf("live key hit count = %d, want 2", got)
}
if limiter.allow("live") {
t.Fatal("allow accepted a live key at its limit")
}
if got := len(limiter.hits["live"]); got != 2 {
t.Fatalf("live key hit count after rejection = %d, want 2", got)
}
}
+2 -16
View File
@@ -24,26 +24,12 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
minio:
image: minio/minio:latest
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
volumes:
- miniodata:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 10
api: api:
build: build:
context: . context: .
dockerfile: api/Dockerfile.prod dockerfile: api/Dockerfile.prod
restart: unless-stopped restart: unless-stopped
stop_grace_period: 30s
depends_on: depends_on:
postgres: postgres:
condition: service_healthy condition: service_healthy
@@ -61,6 +47,7 @@ services:
context: . context: .
dockerfile: api/Dockerfile.admin dockerfile: api/Dockerfile.admin
restart: unless-stopped restart: unless-stopped
stop_grace_period: 30s
depends_on: depends_on:
postgres: postgres:
condition: service_healthy condition: service_healthy
@@ -76,4 +63,3 @@ services:
volumes: volumes:
pgdata: pgdata:
miniodata:
-18
View File
@@ -25,23 +25,6 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: opengoods
MINIO_ROOT_PASSWORD: opengoods123
ports:
- "9000:9000"
- "9001:9001"
volumes:
- miniodata:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 5
api: api:
build: ./api build: ./api
depends_on: depends_on:
@@ -58,4 +41,3 @@ services:
volumes: volumes:
pgdata: pgdata:
miniodata:
+1 -1
View File
@@ -33,4 +33,4 @@
- 对外 API 在 `sources` 中透明返回来源与其许可。 - 对外 API 在 `sources` 中透明返回来源与其许可。
## 6. 版本 ## 6. 版本
- 本契约随 schema 演进版本化;任何 schema 变更需同步更新:迁移(SQL) + 本契约 + `docs/openapi.yaml`。 - 本契约随 schema 演进版本化;任何 schema 变更需同步更新:迁移(SQL) + 本契约 + `api/internal/handler/openapi.json`。
+1 -1
View File
@@ -2,7 +2,7 @@
用 `docker-compose.prod.yml` 部署,与本地 `docker-compose.yml` 的区别: 用 `docker-compose.prod.yml` 部署,与本地 `docker-compose.yml` 的区别:
- 仅 `api` 映射宿主端口,且绑定 `127.0.0.1:8120`(由外层 nginx 反代 + HTTPS);`postgres`/`redis`/`minio` 不对外暴露端口,仅容器内网互通。 - 仅 `api` 映射宿主端口,且绑定 `127.0.0.1:8120`(由外层 nginx 反代 + HTTPS);`postgres`/`redis` 不对外暴露端口,仅容器内网互通。
- 所有服务 `restart: unless-stopped`。 - 所有服务 `restart: unless-stopped`。
- 凭据从 `.env` 注入(见 `.env.example`),不写入仓库。 - 凭据从 `.env` 注入(见 `.env.example`),不写入仓库。
- `api` 使用 `api/Dockerfile.prod`:运行镜像用 `scratch`(从构建镜像拷贝 ca-certs),适用于 `gcr.io/distroless` 不可达的环境;Go 模块走 `goproxy.cn`。 - `api` 使用 `api/Dockerfile.prod`:运行镜像用 `scratch`(从构建镜像拷贝 ca-certs),适用于 `gcr.io/distroless` 不可达的环境;Go 模块走 `goproxy.cn`。
+1 -1
View File
@@ -110,4 +110,4 @@
## 6. 版本 ## 6. 版本
- 本路线图随规模演进更新;任何落地改动需同步:迁移(SQL) + 本文档 +(涉及对外字段时) - 本路线图随规模演进更新;任何落地改动需同步:迁移(SQL) + 本文档 +(涉及对外字段时)
`docs/data-contract.md` / `docs/openapi.yaml`。 `docs/data-contract.md` / `api/internal/handler/openapi.json`。
+268 -168
View File
@@ -17,10 +17,10 @@
"@types/react-dom": "^18.2.19", "@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.17",
"postcss": "^8.4.35", "postcss": "^8.5.32",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "^5.3.3", "typescript": "^5.3.3",
"vite": "^5.1.0" "vite": "^6.4.5"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@@ -319,9 +319,9 @@
} }
}, },
"node_modules/@esbuild/aix-ppc64": { "node_modules/@esbuild/aix-ppc64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
"integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@@ -332,13 +332,13 @@
"aix" "aix"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/android-arm": { "node_modules/@esbuild/android-arm": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
"integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -349,13 +349,13 @@
"android" "android"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/android-arm64": { "node_modules/@esbuild/android-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
"integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -366,13 +366,13 @@
"android" "android"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/android-x64": { "node_modules/@esbuild/android-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
"integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -383,13 +383,13 @@
"android" "android"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/darwin-arm64": { "node_modules/@esbuild/darwin-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -400,13 +400,13 @@
"darwin" "darwin"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/darwin-x64": { "node_modules/@esbuild/darwin-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
"integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -417,13 +417,13 @@
"darwin" "darwin"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/freebsd-arm64": { "node_modules/@esbuild/freebsd-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
"integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -434,13 +434,13 @@
"freebsd" "freebsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/freebsd-x64": { "node_modules/@esbuild/freebsd-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
"integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -451,13 +451,13 @@
"freebsd" "freebsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-arm": { "node_modules/@esbuild/linux-arm": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
"integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -468,13 +468,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-arm64": { "node_modules/@esbuild/linux-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
"integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -485,13 +485,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-ia32": { "node_modules/@esbuild/linux-ia32": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
"integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -502,13 +502,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-loong64": { "node_modules/@esbuild/linux-loong64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
"integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
@@ -519,13 +519,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-mips64el": { "node_modules/@esbuild/linux-mips64el": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
"integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
"cpu": [ "cpu": [
"mips64el" "mips64el"
], ],
@@ -536,13 +536,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-ppc64": { "node_modules/@esbuild/linux-ppc64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
"integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@@ -553,13 +553,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-riscv64": { "node_modules/@esbuild/linux-riscv64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
"integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@@ -570,13 +570,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-s390x": { "node_modules/@esbuild/linux-s390x": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
"integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
@@ -587,13 +587,13 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/linux-x64": { "node_modules/@esbuild/linux-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
"integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -604,13 +604,30 @@
"linux" "linux"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}
},
"node_modules/@esbuild/netbsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
} }
}, },
"node_modules/@esbuild/netbsd-x64": { "node_modules/@esbuild/netbsd-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
"integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -621,13 +638,30 @@
"netbsd" "netbsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
} }
}, },
"node_modules/@esbuild/openbsd-x64": { "node_modules/@esbuild/openbsd-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
"integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -638,13 +672,30 @@
"openbsd" "openbsd"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}
},
"node_modules/@esbuild/openharmony-arm64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
} }
}, },
"node_modules/@esbuild/sunos-x64": { "node_modules/@esbuild/sunos-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
"integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -655,13 +706,13 @@
"sunos" "sunos"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/win32-arm64": { "node_modules/@esbuild/win32-arm64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
"integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -672,13 +723,13 @@
"win32" "win32"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/win32-ia32": { "node_modules/@esbuild/win32-ia32": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
"integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -689,13 +740,13 @@
"win32" "win32"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@esbuild/win32-x64": { "node_modules/@esbuild/win32-x64": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
"integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -706,7 +757,7 @@
"win32" "win32"
], ],
"engines": { "engines": {
"node": ">=12" "node": ">=18"
} }
}, },
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
@@ -1321,9 +1372,9 @@
} }
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.10.38", "version": "2.11.34",
"resolved": "https://registry.npmmirror.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.38.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.34.tgz",
"integrity": "sha512-31/02mVB4yuQU6adKk5SlY6m+mxDwUq5KZkyYgnLrrKl7TEm1+3PyDtDBz2kOv/wxZz41GHsvV1A/u6RmiyBvw==", "integrity": "sha512-Aqr8mA1kIvyJ3UY5YAY7ib8LSo1DmDMbMnVqGPtsKW1LxaFQFwn9Eb3yvq2fUKJsRvaXjnAV7R5osqETapzNiA==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@@ -1360,9 +1411,9 @@
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.2", "version": "4.29.5",
"resolved": "https://registry.npmmirror.com/browserslist/-/browserslist-4.28.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz",
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1380,11 +1431,11 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.10.12", "baseline-browser-mapping": "^2.11.33",
"caniuse-lite": "^1.0.30001782", "caniuse-lite": "^1.0.30001819",
"electron-to-chromium": "^1.5.328", "electron-to-chromium": "^1.5.464",
"node-releases": "^2.0.36", "node-releases": "^2.0.60",
"update-browserslist-db": "^1.2.3" "update-browserslist-db": "^1.3.4"
}, },
"bin": { "bin": {
"browserslist": "cli.js" "browserslist": "cli.js"
@@ -1404,9 +1455,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001799", "version": "1.0.30001820",
"resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001820.tgz",
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", "integrity": "sha512-gfWD6MxqVCqAOwmODfZf7DchWvlrA+SRdNX7ceLfg3xRqe5ssjjpF7EgslC/0tiLiNTajdaNN/q8c/5u/7Gz8w==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1532,9 +1583,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.376", "version": "1.5.472",
"resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.376.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.472.tgz",
"integrity": "sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==", "integrity": "sha512-s4+nfT29b0FKpVKoaIxl2pWsoNcn7A/nMPSrxayw4T3BsmPeV2lF9Y06BsAQeMGhCTQ4nYJ5XST7jkqe4ZEqFw==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -1549,9 +1600,9 @@
} }
}, },
"node_modules/esbuild": { "node_modules/esbuild": {
"version": "0.21.5", "version": "0.25.12",
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
@@ -1559,37 +1610,40 @@
"esbuild": "bin/esbuild" "esbuild": "bin/esbuild"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=18"
}, },
"optionalDependencies": { "optionalDependencies": {
"@esbuild/aix-ppc64": "0.21.5", "@esbuild/aix-ppc64": "0.25.12",
"@esbuild/android-arm": "0.21.5", "@esbuild/android-arm": "0.25.12",
"@esbuild/android-arm64": "0.21.5", "@esbuild/android-arm64": "0.25.12",
"@esbuild/android-x64": "0.21.5", "@esbuild/android-x64": "0.25.12",
"@esbuild/darwin-arm64": "0.21.5", "@esbuild/darwin-arm64": "0.25.12",
"@esbuild/darwin-x64": "0.21.5", "@esbuild/darwin-x64": "0.25.12",
"@esbuild/freebsd-arm64": "0.21.5", "@esbuild/freebsd-arm64": "0.25.12",
"@esbuild/freebsd-x64": "0.21.5", "@esbuild/freebsd-x64": "0.25.12",
"@esbuild/linux-arm": "0.21.5", "@esbuild/linux-arm": "0.25.12",
"@esbuild/linux-arm64": "0.21.5", "@esbuild/linux-arm64": "0.25.12",
"@esbuild/linux-ia32": "0.21.5", "@esbuild/linux-ia32": "0.25.12",
"@esbuild/linux-loong64": "0.21.5", "@esbuild/linux-loong64": "0.25.12",
"@esbuild/linux-mips64el": "0.21.5", "@esbuild/linux-mips64el": "0.25.12",
"@esbuild/linux-ppc64": "0.21.5", "@esbuild/linux-ppc64": "0.25.12",
"@esbuild/linux-riscv64": "0.21.5", "@esbuild/linux-riscv64": "0.25.12",
"@esbuild/linux-s390x": "0.21.5", "@esbuild/linux-s390x": "0.25.12",
"@esbuild/linux-x64": "0.21.5", "@esbuild/linux-x64": "0.25.12",
"@esbuild/netbsd-x64": "0.21.5", "@esbuild/netbsd-arm64": "0.25.12",
"@esbuild/openbsd-x64": "0.21.5", "@esbuild/netbsd-x64": "0.25.12",
"@esbuild/sunos-x64": "0.21.5", "@esbuild/openbsd-arm64": "0.25.12",
"@esbuild/win32-arm64": "0.21.5", "@esbuild/openbsd-x64": "0.25.12",
"@esbuild/win32-ia32": "0.21.5", "@esbuild/openharmony-arm64": "0.25.12",
"@esbuild/win32-x64": "0.21.5" "@esbuild/sunos-x64": "0.25.12",
"@esbuild/win32-arm64": "0.25.12",
"@esbuild/win32-ia32": "0.25.12",
"@esbuild/win32-x64": "0.25.12"
} }
}, },
"node_modules/escalade": { "node_modules/escalade": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
@@ -1924,9 +1978,9 @@
} }
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.13", "version": "3.3.20",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.13.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
"integrity": "sha512-sPdqC6ByMVVGvF1ynvvMo0/o+oD1VX7DaHhijt1bFgjvBkHBib4t49GoNDhf2NDta4oeUNlaGbSt5K7qjZ955Q==", "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -1943,9 +1997,9 @@
} }
}, },
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.48", "version": "2.0.63",
"resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.48.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.63.tgz",
"integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==", "integrity": "sha512-6li2QanLsAXpIH2R6j77MzRyvOyrvdTqlKtO4CgBdHGNvN99ZZfyxszHc5o5+IZBWD5u6Hzwg83JoGXmqZNG9Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -2030,9 +2084,9 @@
} }
}, },
"node_modules/postcss": { "node_modules/postcss": {
"version": "8.5.15", "version": "8.5.32",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.15.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
"integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2050,9 +2104,9 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"nanoid": "^3.3.12", "nanoid": "^3.3.20",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"source-map-js": "^1.2.1" "source-map-js": "^1.2.2"
}, },
"engines": { "engines": {
"node": "^10 || ^12 || >=14" "node": "^10 || ^12 || >=14"
@@ -2172,9 +2226,9 @@
} }
}, },
"node_modules/postcss-selector-parser": { "node_modules/postcss-selector-parser": {
"version": "6.1.4", "version": "6.1.5",
"resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.5.tgz",
"integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==", "integrity": "sha512-TEHFzb5KRDKaOgJ4TYE+0jyJtFbjLvkdVOu0fZ2b6MTWzoqZd4Le+61aEppWkvTlYePgOX4ATL1wsAIPMLTw6Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2393,9 +2447,9 @@
} }
}, },
"node_modules/source-map-js": { "node_modules/source-map-js": {
"version": "1.2.1", "version": "1.2.2",
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"dev": true, "dev": true,
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"engines": { "engines": {
@@ -2582,9 +2636,9 @@
} }
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.2.3", "version": "1.3.4",
"resolved": "https://registry.npmmirror.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz",
"integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2620,21 +2674,24 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "5.4.21", "version": "6.4.5",
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.21.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz",
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", "integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"esbuild": "^0.21.3", "esbuild": "^0.25.0",
"postcss": "^8.4.43", "fdir": "^6.4.4",
"rollup": "^4.20.0" "picomatch": "^4.0.2",
"postcss": "^8.5.3",
"rollup": "^4.34.9",
"tinyglobby": "^0.2.13"
}, },
"bin": { "bin": {
"vite": "bin/vite.js" "vite": "bin/vite.js"
}, },
"engines": { "engines": {
"node": "^18.0.0 || >=20.0.0" "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
}, },
"funding": { "funding": {
"url": "https://github.com/vitejs/vite?sponsor=1" "url": "https://github.com/vitejs/vite?sponsor=1"
@@ -2643,19 +2700,25 @@
"fsevents": "~2.3.3" "fsevents": "~2.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@types/node": "^18.0.0 || >=20.0.0", "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
"jiti": ">=1.21.0",
"less": "*", "less": "*",
"lightningcss": "^1.21.0", "lightningcss": "^1.21.0",
"sass": "*", "sass": "*",
"sass-embedded": "*", "sass-embedded": "*",
"stylus": "*", "stylus": "*",
"sugarss": "*", "sugarss": "*",
"terser": "^5.4.0" "terser": "^5.16.0",
"tsx": "^4.8.1",
"yaml": "^2.4.2"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"@types/node": { "@types/node": {
"optional": true "optional": true
}, },
"jiti": {
"optional": true
},
"less": { "less": {
"optional": true "optional": true
}, },
@@ -2676,9 +2739,46 @@
}, },
"terser": { "terser": {
"optional": true "optional": true
},
"tsx": {
"optional": true
},
"yaml": {
"optional": true
} }
} }
}, },
"node_modules/vite/node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0.0"
},
"peerDependencies": {
"picomatch": "^3 || ^4"
},
"peerDependenciesMeta": {
"picomatch": {
"optional": true
}
}
},
"node_modules/vite/node_modules/picomatch": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/yallist": { "node_modules/yallist": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz", "resolved": "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz",
+2 -2
View File
@@ -18,9 +18,9 @@
"@types/react-dom": "^18.2.19", "@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1", "@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17", "autoprefixer": "^10.4.17",
"postcss": "^8.4.35", "postcss": "^8.5.32",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "^5.3.3", "typescript": "^5.3.3",
"vite": "^5.1.0" "vite": "^6.4.5"
} }
} }
+4 -3
View File
@@ -58,9 +58,10 @@ GET http://zc.bypos.net/byGoodsService/byMessage.asmx/GetGoodsinfo
## 配置 ## 配置
- `sdogid`:中心库账号 id(本项目所属云店账号的授权 id)。默认值见 - `sdogid`:中心库账号 id(本项目所属云店账号的授权 id)。
`collect.go` 的 `defaultSdogID`,也可用 `-sdogid` 参数或控制台覆盖。 优先从环境变量 `BYPOS_SDOGID` 读取,其次是命令行 `-sdogid` 参数,
**这是账号级凭证**——若本仓库对外公开,建议改为从环境变量/外部配置读取。 也可以在 Web 控制台的输入框中填写。**三者都未设时启动会警告、开始采集时会报错。**
- 网络错误自动重试(最多 3 次,指数退避 500ms/1s/2s)。
## 导入 goods/天工库 ## 导入 goods/天工库
+105 -39
View File
@@ -1,6 +1,7 @@
package main package main
import ( import (
"bufio"
"context" "context"
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
@@ -20,12 +21,21 @@ import (
) )
// ---- upstream config ---- // ---- upstream config ----
// sdogid is the 云店 account license id observed in the live request. It is
// configurable so the tool is not tied to a single account.
const defaultSdogID = "137966"
const endpoint = "http://zc.bypos.net/byGoodsService/byMessage.asmx/GetGoodsinfo" const endpoint = "http://zc.bypos.net/byGoodsService/byMessage.asmx/GetGoodsinfo"
// maxRetries is the number of retry attempts for transient network errors.
const maxRetries = 3
// resolveSdogID reads the account id from $BYPOS_SDOGID, falling back to the
// explicit argument (CLI flag or Web UI input). Returns empty if neither set.
func resolveSdogID(explicit string) string {
if v := os.Getenv("BYPOS_SDOGID"); v != "" {
return v
}
return explicit
}
var stringTagRe = regexp.MustCompile(`(?s)<string[^>]*>(.*)</string>`) var stringTagRe = regexp.MustCompile(`(?s)<string[^>]*>(.*)</string>`)
// Product is the normalized record we persist (one JSON object per line). // Product is the normalized record we persist (one JSON object per line).
@@ -87,8 +97,8 @@ func ean13Check(body string) (string, bool) {
return body + strconv.Itoa(chk), true return body + strconv.Itoa(chk), true
} }
// lookup queries the upstream central library for one barcode. // lookupOnce performs a single HTTP request to the upstream central library.
func (c *Collector) lookup(ctx context.Context, barcode string) (*Product, error) { func (c *Collector) lookupOnce(ctx context.Context, barcode string) (*Product, error) {
tsMs := strconv.FormatInt(time.Now().Unix()*1000, 10) // always ends in 000 tsMs := strconv.FormatInt(time.Now().Unix()*1000, 10) // always ends in 000
sparm1 := md5hex(c.sdogID) sparm1 := md5hex(c.sdogID)
sparm2 := md5hex(barcode + tsMs) sparm2 := md5hex(barcode + tsMs)
@@ -147,21 +157,48 @@ func (c *Collector) lookup(ctx context.Context, barcode string) (*Product, error
return p, nil return p, nil
} }
// lookup queries the upstream with up to maxRetries retries on transient errors.
func (c *Collector) lookup(ctx context.Context, barcode string) (*Product, error) {
var lastErr error
for attempt := 0; attempt <= maxRetries; attempt++ {
if ctx.Err() != nil {
return nil, ctx.Err()
}
p, err := c.lookupOnce(ctx, barcode)
if err == nil {
return p, nil
}
lastErr = err
if attempt < maxRetries {
backoff := time.Duration(1<<uint(attempt)) * 500 * time.Millisecond
select {
case <-time.After(backoff):
case <-ctx.Done():
return nil, ctx.Err()
}
}
}
return nil, lastErr
}
// ---- job / collector state ---- // ---- job / collector state ----
const collectedFile = "collected.txt"
type Stats struct { type Stats struct {
Running bool `json:"running"` Running bool `json:"running"`
Total int64 `json:"total"` Total int64 `json:"total"`
Done int64 `json:"done"` Done int64 `json:"done"`
Hits int64 `json:"hits"` Hits int64 `json:"hits"`
Miss int64 `json:"miss"` Miss int64 `json:"miss"`
Invalid int64 `json:"invalid"` Invalid int64 `json:"invalid"`
Errors int64 `json:"errors"` Errors int64 `json:"errors"`
Skipped int64 `json:"skipped"` Skipped int64 `json:"skipped"`
Current string `json:"current"` Current string `json:"current"`
OutFile string `json:"out_file"` OutFile string `json:"out_file"`
StartedAt string `json:"started_at"` StartedAt string `json:"started_at"`
Message string `json:"message"` Message string `json:"message"`
HistoryCount int `json:"history_count"`
} }
type Collector struct { type Collector struct {
@@ -182,20 +219,20 @@ type Collector struct {
startedAt string startedAt string
message string message string
seen map[string]struct{} // barcodes already in output (dedupe / resume) seen map[string]struct{} // barcodes already collected (dedupe)
recent []Product // ring of last results for UI collectedFp *os.File // persistent history file handle
recent []Product // ring of last results for UI
} }
func NewCollector(sdogID string) *Collector { func NewCollector(sdogID string) *Collector {
if sdogID == "" { sdogID = resolveSdogID(sdogID)
sdogID = defaultSdogID
}
c := &Collector{ c := &Collector{
client: &http.Client{Timeout: 25 * time.Second}, client: &http.Client{Timeout: 25 * time.Second},
sdogID: sdogID, sdogID: sdogID,
seen: map[string]struct{}{}, seen: map[string]struct{}{},
} }
c.current.Store("") c.current.Store("")
c.loadCollected()
return c return c
} }
@@ -207,20 +244,22 @@ func (c *Collector) snapshot() Stats {
msg := c.message msg := c.message
out := c.outPath out := c.outPath
started := c.startedAt started := c.startedAt
hist := len(c.seen)
c.mu.Unlock() c.mu.Unlock()
return Stats{ return Stats{
Running: c.isRunning(), Running: c.isRunning(),
Total: atomic.LoadInt64(&c.total), Total: atomic.LoadInt64(&c.total),
Done: atomic.LoadInt64(&c.done), Done: atomic.LoadInt64(&c.done),
Hits: atomic.LoadInt64(&c.hits), Hits: atomic.LoadInt64(&c.hits),
Miss: atomic.LoadInt64(&c.miss), Miss: atomic.LoadInt64(&c.miss),
Invalid: atomic.LoadInt64(&c.invalid), Invalid: atomic.LoadInt64(&c.invalid),
Errors: atomic.LoadInt64(&c.errors), Errors: atomic.LoadInt64(&c.errors),
Skipped: atomic.LoadInt64(&c.skipped), Skipped: atomic.LoadInt64(&c.skipped),
Current: cur, Current: cur,
OutFile: out, OutFile: out,
StartedAt: started, StartedAt: started,
Message: msg, Message: msg,
HistoryCount: hist,
} }
} }
@@ -241,9 +280,24 @@ func (c *Collector) pushRecent(p Product) {
c.mu.Unlock() c.mu.Unlock()
} }
// loadSeen reads an existing output file to build the dedupe set (for resume). // loadCollected reads the persistent history file (one barcode per line).
func (c *Collector) loadCollected() {
f, err := os.Open(collectedFile)
if err != nil {
return
}
defer f.Close()
sc := bufio.NewScanner(f)
for sc.Scan() {
bc := strings.TrimSpace(sc.Text())
if bc != "" {
c.seen[bc] = struct{}{}
}
}
}
// loadSeen reads an existing output file and adds to the dedupe set (for resume).
func (c *Collector) loadSeen(path string) error { func (c *Collector) loadSeen(path string) error {
c.seen = map[string]struct{}{}
f, err := os.Open(path) f, err := os.Open(path)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
@@ -308,6 +362,9 @@ func (c *Collector) Start(req JobReq) error {
if req.SdogID != "" { if req.SdogID != "" {
c.sdogID = req.SdogID c.sdogID = req.SdogID
} }
if c.sdogID == "" {
return fmt.Errorf("未指定 sdogid,请通过控制台输入框、环境变量 $BYPOS_SDOGID 或 -sdogid 参数配置")
}
// Build the list of barcodes to query. // Build the list of barcodes to query.
var barcodes []string var barcodes []string
@@ -353,6 +410,7 @@ func (c *Collector) Start(req JobReq) error {
} }
c.outFile = f c.outFile = f
c.outPath = abs c.outPath = abs
c.collectedFp, _ = os.OpenFile(collectedFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
// reset counters // reset counters
atomic.StoreInt64(&c.total, int64(len(barcodes))) atomic.StoreInt64(&c.total, int64(len(barcodes)))
@@ -390,6 +448,11 @@ func (c *Collector) run(ctx context.Context, barcodes []string, req JobReq) {
c.outFile.Close() c.outFile.Close()
c.outFile = nil c.outFile = nil
} }
if c.collectedFp != nil {
c.collectedFp.Sync()
c.collectedFp.Close()
c.collectedFp = nil
}
c.current.Store("") c.current.Store("")
}() }()
@@ -438,14 +501,17 @@ func (c *Collector) run(ctx context.Context, barcodes []string, req JobReq) {
} }
atomic.AddInt64(&c.done, 1) atomic.AddInt64(&c.done, 1)
c.pushRecent(*p) c.pushRecent(*p)
writeMu.Lock()
if p.Status == "hit" || req.LogMiss { if p.Status == "hit" || req.LogMiss {
line, _ := json.Marshal(p) line, _ := json.Marshal(p)
writeMu.Lock()
c.outFile.Write(line) c.outFile.Write(line)
c.outFile.Write([]byte("\n")) c.outFile.Write([]byte("\n"))
c.seen[bc] = struct{}{}
writeMu.Unlock()
} }
c.seen[bc] = struct{}{}
if c.collectedFp != nil {
c.collectedFp.WriteString(bc + "\n")
}
writeMu.Unlock()
} }
} }
+113
View File
@@ -0,0 +1,113 @@
package main
import (
"os"
"testing"
)
func TestEan13Check_valid(t *testing.T) {
tests := []struct {
body string
want string
}{
{"692045990501", "6920459905012"},
{"690100000000", "6901000000004"},
{"690100000099", "6901000000998"},
}
for _, tt := range tests {
got, ok := ean13Check(tt.body)
if !ok {
t.Errorf("ean13Check(%q) returned not ok", tt.body)
continue
}
if got != tt.want {
t.Errorf("ean13Check(%q) = %q, want %q", tt.body, got, tt.want)
}
}
}
func TestEan13Check_invalid(t *testing.T) {
cases := []string{"", "12345", "12345678901", "1234567890123", "69010000a000"}
for _, body := range cases {
_, ok := ean13Check(body)
if ok {
t.Errorf("ean13Check(%q) should return not ok", body)
}
}
}
func TestMd5hex(t *testing.T) {
got := md5hex("137966")
if len(got) != 32 {
t.Errorf("md5hex should return 32-char hex, got len=%d", len(got))
}
if got != md5hex("137966") {
t.Error("md5hex should be deterministic")
}
if got == md5hex("other") {
t.Error("md5hex should differ for different inputs")
}
}
func TestSanitizeBarcodes(t *testing.T) {
got := sanitizeBarcodes("6920459905012\n6901028941068 123")
want := []string{"6920459905012", "6901028941068", "123"}
if len(got) != len(want) {
t.Fatalf("len = %d, want %d", len(got), len(want))
}
for i := range want {
if got[i] != want[i] {
t.Errorf("got[%d] = %q, want %q", i, got[i], want[i])
}
}
}
func TestSanitizeBarcodes_empty(t *testing.T) {
got := sanitizeBarcodes(" \n\t ")
if len(got) != 0 {
t.Errorf("expected empty, got %v", got)
}
}
func TestResolveSdogID_envOverride(t *testing.T) {
os.Setenv("BYPOS_SDOGID", "999999")
defer os.Unsetenv("BYPOS_SDOGID")
got := resolveSdogID("111111")
if got != "999999" {
t.Errorf("expected env var override, got %q", got)
}
}
func TestResolveSdogID_fallback(t *testing.T) {
os.Unsetenv("BYPOS_SDOGID")
got := resolveSdogID("111111")
if got != "111111" {
t.Errorf("expected fallback to explicit, got %q", got)
}
}
func TestResolveSdogID_empty(t *testing.T) {
os.Unsetenv("BYPOS_SDOGID")
got := resolveSdogID("")
if got != "" {
t.Errorf("expected empty, got %q", got)
}
}
func TestNewCollector_sdogFromEnv(t *testing.T) {
os.Setenv("BYPOS_SDOGID", "888888")
defer os.Unsetenv("BYPOS_SDOGID")
c := NewCollector("")
if c.sdogID != "888888" {
t.Errorf("expected sdogID from env, got %q", c.sdogID)
}
}
func TestStartRejectsEmptySdogID(t *testing.T) {
os.Unsetenv("BYPOS_SDOGID")
c := NewCollector("")
err := c.Start(JobReq{Mode: "list", List: "6920459905012"})
if err == nil {
t.Fatal("expected error for empty sdogid")
}
}
+129 -12
View File
@@ -1,6 +1,8 @@
package main package main
import ( import (
"bufio"
"bytes"
"embed" "embed"
"encoding/csv" "encoding/csv"
"encoding/json" "encoding/json"
@@ -14,24 +16,55 @@ import (
"os" "os"
"os/exec" "os/exec"
"runtime" "runtime"
"strings"
"time" "time"
) )
//go:embed web/* //go:embed web/*
var webFS embed.FS var webFS embed.FS
var collector = NewCollector("") var collector *Collector
// waitExit keeps the console window open on Windows so the user can read errors.
func waitExit() {
if runtime.GOOS == "windows" {
fmt.Println("\n按回车键退出...")
bufio.NewReader(os.Stdin).ReadBytes('\n')
}
}
func main() { func main() {
addr := flag.String("addr", "127.0.0.1:8765", "本地监听地址") // Log to file so crashes are diagnosable even if console closes.
noOpen := flag.Bool("no-open", false, "不自动打开浏览器") lf, lfErr := os.OpenFile("bypos-collector.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
sdog := flag.String("sdogid", "", "中心库账号 id(默认使用内置值)") if lfErr == nil {
flag.Parse() log.SetOutput(io.MultiWriter(os.Stderr, lf))
if *sdog != "" { defer lf.Close()
collector.sdogID = *sdog
} }
sub, _ := fs.Sub(webFS, "web") defer func() {
if r := recover(); r != nil {
log.Printf("程序崩溃: %v", r)
waitExit()
}
}()
log.Println("bypos-collector 启动中...")
addr := flag.String("addr", "127.0.0.1:8765", "本地监听地址")
noOpen := flag.Bool("no-open", false, "不自动打开浏览器")
sdog := flag.String("sdogid", "", "中心库账号 id(优先读 $BYPOS_SDOGID 环境变量)")
flag.Parse()
collector = NewCollector(*sdog)
if collector.sdogID == "" {
log.Println("警告: 未配置 sdogid,请通过 $BYPOS_SDOGID 环境变量、-sdogid 参数或控制台输入框指定")
}
sub, err := fs.Sub(webFS, "web")
if err != nil {
log.Printf("错误: 无法加载内嵌 web 资源: %v", err)
waitExit()
return
}
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/", http.FileServer(http.FS(sub))) mux.Handle("/", http.FileServer(http.FS(sub)))
mux.HandleFunc("/api/start", handleStart) mux.HandleFunc("/api/start", handleStart)
@@ -39,10 +72,17 @@ func main() {
mux.HandleFunc("/api/stats", handleStats) mux.HandleFunc("/api/stats", handleStats)
mux.HandleFunc("/api/download", handleDownload) mux.HandleFunc("/api/download", handleDownload)
mux.HandleFunc("/api/export.csv", handleExportCSV) mux.HandleFunc("/api/export.csv", handleExportCSV)
mux.HandleFunc("/api/import", handleImport)
ln, err := net.Listen("tcp", *addr) ln, err := net.Listen("tcp", *addr)
if err != nil { if err != nil {
log.Fatalf("无法监听 %s: %v", *addr, err) log.Printf("端口 %s 被占用,自动选择可用端口...", *addr)
ln, err = net.Listen("tcp", "127.0.0.1:0")
if err != nil {
log.Printf("错误: 无法监听: %v", err)
waitExit()
return
}
} }
realAddr := ln.Addr().String() realAddr := ln.Addr().String()
urlStr := "http://" + realAddr + "/" urlStr := "http://" + realAddr + "/"
@@ -51,10 +91,14 @@ func main() {
fmt.Println(" 控制台: " + urlStr) fmt.Println(" 控制台: " + urlStr)
fmt.Println(" 关闭本窗口即停止程序") fmt.Println(" 关闭本窗口即停止程序")
fmt.Println("==============================================") fmt.Println("==============================================")
log.Printf("监听地址: %s", realAddr)
if !*noOpen { if !*noOpen {
go openBrowser(urlStr) go openBrowser(urlStr)
} }
log.Fatal(http.Serve(ln, mux)) if err := http.Serve(ln, mux); err != nil {
log.Printf("HTTP 服务异常退出: %v", err)
waitExit()
}
} }
func openBrowser(url string) { func openBrowser(url string) {
@@ -127,6 +171,79 @@ func handleDownload(w http.ResponseWriter, r *http.Request) {
io.Copy(w, f) io.Copy(w, f)
} }
func handleImport(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.Error(w, "method", 405)
return
}
var req struct {
APIURL string `json:"api_url"`
Username string `json:"username"`
Password string `json:"password"`
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
writeJSON(w, 400, map[string]string{"error": "请求格式错误"})
return
}
req.APIURL = strings.TrimRight(req.APIURL, "/")
if req.APIURL == "" || req.Username == "" || req.Password == "" {
writeJSON(w, 400, map[string]string{"error": "请填写完整的 API 地址、用户名和密码"})
return
}
s := collector.snapshot()
if s.OutFile == "" {
writeJSON(w, 400, map[string]string{"error": "没有采集数据可导入"})
return
}
client := &http.Client{Timeout: 60 * time.Second}
loginBody, _ := json.Marshal(map[string]string{"username": req.Username, "password": req.Password})
loginResp, err := client.Post(req.APIURL+"/api/login", "application/json", bytes.NewReader(loginBody))
if err != nil {
writeJSON(w, 502, map[string]string{"error": "无法连接 Goods 系统: " + err.Error()})
return
}
defer loginResp.Body.Close()
var loginResult struct {
Token string `json:"token"`
Error *struct {
Message string `json:"message"`
} `json:"error"`
}
json.NewDecoder(loginResp.Body).Decode(&loginResult)
if loginResp.StatusCode != 200 || loginResult.Token == "" {
msg := "登录失败"
if loginResult.Error != nil {
msg = loginResult.Error.Message
}
writeJSON(w, 401, map[string]string{"error": msg})
return
}
jsonlData, err := os.ReadFile(s.OutFile)
if err != nil {
writeJSON(w, 500, map[string]string{"error": "读取采集文件失败: " + err.Error()})
return
}
importReq, _ := http.NewRequest("POST", req.APIURL+"/api/import/bypos", bytes.NewReader(jsonlData))
importReq.Header.Set("Content-Type", "application/x-ndjson")
importReq.Header.Set("Authorization", "Bearer "+loginResult.Token)
importResp, err := client.Do(importReq)
if err != nil {
writeJSON(w, 502, map[string]string{"error": "导入请求失败: " + err.Error()})
return
}
defer importResp.Body.Close()
respBody, _ := io.ReadAll(importResp.Body)
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(importResp.StatusCode)
w.Write(respBody)
}
func handleExportCSV(w http.ResponseWriter, r *http.Request) { func handleExportCSV(w http.ResponseWriter, r *http.Request) {
s := collector.snapshot() s := collector.snapshot()
if s.OutFile == "" { if s.OutFile == "" {
@@ -143,14 +260,14 @@ func handleExportCSV(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Disposition", "attachment; filename=products.csv") w.Header().Set("Content-Disposition", "attachment; filename=products.csv")
w.Write([]byte{0xEF, 0xBB, 0xBF}) // UTF-8 BOM so Excel reads Chinese correctly w.Write([]byte{0xEF, 0xBB, 0xBF}) // UTF-8 BOM so Excel reads Chinese correctly
cw := csv.NewWriter(w) cw := csv.NewWriter(w)
cw.Write([]string{"barcode", "name", "spec", "unit", "area", "manufacturer", "license", "in_price", "sell_price", "status", "fetched_at"}) cw.Write([]string{"barcode", "name", "spec", "unit", "area", "manufacturer", "license", "in_price", "sell_price", "status", "retmsg", "fetched_at", "source"})
dec := json.NewDecoder(f) dec := json.NewDecoder(f)
for { for {
var p Product var p Product
if err := dec.Decode(&p); err != nil { if err := dec.Decode(&p); err != nil {
break break
} }
cw.Write([]string{p.Barcode, p.Name, p.Spec, p.Unit, p.Area, p.Manufacturer, p.License, p.InPrice, p.SellPrice, p.Status, p.FetchedAt}) cw.Write([]string{p.Barcode, p.Name, p.Spec, p.Unit, p.Area, p.Manufacturer, p.License, p.InPrice, p.SellPrice, p.Status, p.RetMsg, p.FetchedAt, p.Source})
} }
cw.Flush() cw.Flush()
} }
+67 -3
View File
@@ -37,6 +37,11 @@
.hit { color:#2da44e; } .miss { color:#999; } .invalid { color:#d1242f; } .error { color:#bf8700; } .hit { color:#2da44e; } .miss { color:#999; } .invalid { color:#d1242f; } .error { color:#bf8700; }
.hint { font-size:12px; color:#888; margin-top:6px; line-height:1.5; } .hint { font-size:12px; color:#888; margin-top:6px; line-height:1.5; }
.est { font-size:13px; color:#1f6feb; margin-top:6px; } .est { font-size:13px; color:#1f6feb; margin-top:6px; }
.history-badge { display:inline-block; background:#e8f0fe; color:#1f6feb; padding:4px 12px; border-radius:12px; font-size:13px; font-weight:600; margin-bottom:10px; }
.import-result { margin-top:10px; padding:10px; border-radius:6px; font-size:13px; }
.import-result.ok { background:#dcfce7; color:#166534; }
.import-result.fail { background:#fee2e2; color:#991b1b; }
input[type=password] { width:100%; padding:8px 10px; border:1px solid #cdd5e0; border-radius:6px; font-size:14px; }
</style> </style>
</head> </head>
<body> <body>
@@ -79,6 +84,10 @@
<div class="card"> <div class="card">
<h3>② 采集参数</h3> <h3>② 采集参数</h3>
<div class="row"> <div class="row">
<div>
<label>中心库账号 sdogid</label>
<input type="text" id="sdogid" placeholder="留空则使用环境变量或启动参数"/>
</div>
<div> <div>
<label>并发数</label> <label>并发数</label>
<input type="number" id="concurrency" value="3" min="1" max="20"/> <input type="number" id="concurrency" value="3" min="1" max="20"/>
@@ -93,11 +102,12 @@
</div> </div>
</div> </div>
<label style="margin-top:12px"><input type="checkbox" id="logmiss"/> 同时记录未命中/无效条码(默认只存命中)</label> <label style="margin-top:12px"><input type="checkbox" id="logmiss"/> 同时记录未命中/无效条码(默认只存命中)</label>
<div class="hint">速度越快越容易触发上游频控。建议并发 3、间隔 300ms 起步,稳定后再调。已采过的条码会自动跳过(断点续采)。</div> <div class="hint">速度越快越容易触发上游频控。建议并发 3、间隔 300ms 起步,稳定后再调。已采过的条码会自动跳过(跨次去重)。</div>
</div> </div>
<div class="card"> <div class="card">
<h3>③ 运行</h3> <h3>③ 运行</h3>
<div class="history-badge" id="history-badge">历史已采集: 0 个条码</div>
<div style="margin-bottom:12px"> <div style="margin-bottom:12px">
<button class="primary" id="btnStart" onclick="start()">开始采集</button> <button class="primary" id="btnStart" onclick="start()">开始采集</button>
<button class="danger" id="btnStop" onclick="stop()" disabled>停止</button> <button class="danger" id="btnStop" onclick="stop()" disabled>停止</button>
@@ -112,13 +122,36 @@
<div class="stat"><div class="n miss" id="s-miss">0</div><div class="l">未命中</div></div> <div class="stat"><div class="n miss" id="s-miss">0</div><div class="l">未命中</div></div>
<div class="stat"><div class="n invalid" id="s-invalid">0</div><div class="l">无效</div></div> <div class="stat"><div class="n invalid" id="s-invalid">0</div><div class="l">无效</div></div>
<div class="stat"><div class="n error" id="s-errors">0</div><div class="l">错误</div></div> <div class="stat"><div class="n error" id="s-errors">0</div><div class="l">错误</div></div>
<div class="stat"><div class="n" id="s-skipped">0</div><div class="l">跳过</div></div> <div class="stat"><div class="n" id="s-skipped">0</div><div class="l">跳过(已采)</div></div>
</div> </div>
<div class="hint" id="msg"></div> <div class="hint" id="msg"></div>
</div> </div>
<div class="card"> <div class="card">
<h3>④ 实时结果(最近 60 条)</h3> <h3>④ 导入到 Goods 系统</h3>
<div class="hint" style="margin-top:0;margin-bottom:10px">采集完成后,将数据一键导入到 OpenGoods 商品档案系统。</div>
<div class="row">
<div>
<label>Goods 管理后台地址</label>
<input type="text" id="import-url" placeholder="如 http://192.168.1.100:8080/ping"/>
</div>
<div>
<label>管理员用户名</label>
<input type="text" id="import-user" placeholder="admin"/>
</div>
<div>
<label>管理员密码</label>
<input type="password" id="import-pass"/>
</div>
</div>
<div style="margin-top:12px">
<button class="primary" id="btnImport" onclick="doImport()">导入到 Goods</button>
</div>
<div id="import-result"></div>
</div>
<div class="card">
<h3>⑤ 实时结果(最近 60 条)</h3>
<div style="max-height:340px; overflow:auto"> <div style="max-height:340px; overflow:auto">
<table> <table>
<thead><tr><th>条码</th><th>品名</th><th>规格</th><th>单位</th><th>产地</th><th>进价</th><th>零售价</th><th>状态</th></tr></thead> <thead><tr><th>条码</th><th>品名</th><th>规格</th><th>单位</th><th>产地</th><th>进价</th><th>零售价</th><th>状态</th></tr></thead>
@@ -165,6 +198,7 @@ async function start(){
start_body: document.getElementById('start').value.trim(), start_body: document.getElementById('start').value.trim(),
end_body: document.getElementById('end').value.trim(), end_body: document.getElementById('end').value.trim(),
list: document.getElementById('list').value, list: document.getElementById('list').value,
sdog_id: document.getElementById('sdogid').value.trim(),
concurrency: parseInt(document.getElementById('concurrency').value)||3, concurrency: parseInt(document.getElementById('concurrency').value)||3,
delay_ms: parseInt(document.getElementById('delay').value)||0, delay_ms: parseInt(document.getElementById('delay').value)||0,
log_miss: document.getElementById('logmiss').checked, log_miss: document.getElementById('logmiss').checked,
@@ -191,6 +225,7 @@ async function poll(){
document.getElementById('s-skipped').textContent = s.skipped; document.getElementById('s-skipped').textContent = s.skipped;
let pct = s.total>0 ? Math.floor(s.done*100/s.total) : 0; let pct = s.total>0 ? Math.floor(s.done*100/s.total) : 0;
document.getElementById('prog').style.width = pct + '%'; document.getElementById('prog').style.width = pct + '%';
document.getElementById('history-badge').textContent = '历史已采集: ' + (s.history_count||0) + ' 个条码';
document.getElementById('msg').textContent = (s.running? ('采集中… 当前 '+s.current) : (s.message||'空闲')); document.getElementById('msg').textContent = (s.running? ('采集中… 当前 '+s.current) : (s.message||'空闲'));
document.getElementById('btnStart').disabled = s.running; document.getElementById('btnStart').disabled = s.running;
document.getElementById('btnStop').disabled = !s.running; document.getElementById('btnStop').disabled = !s.running;
@@ -201,6 +236,35 @@ async function poll(){
}catch(e){} }catch(e){}
} }
setInterval(poll, 1000); poll(); setInterval(poll, 1000); poll();
async function doImport(){
let url = document.getElementById('import-url').value.trim();
let user = document.getElementById('import-user').value.trim();
let pass = document.getElementById('import-pass').value;
if(!url || !user || !pass){ alert('请填写完整的 Goods 系统地址、用户名和密码'); return; }
let btn = document.getElementById('btnImport');
let res = document.getElementById('import-result');
btn.disabled = true;
btn.textContent = '导入中...';
res.innerHTML = '';
try {
let r = await fetch('/api/import', {
method:'POST',
headers:{'Content-Type':'application/json'},
body:JSON.stringify({api_url:url, username:user, password:pass})
});
let j = await r.json();
if(j.error){
res.innerHTML = '<div class="import-result fail">导入失败: '+esc(j.error.message||j.error)+'</div>';
} else {
res.innerHTML = '<div class="import-result ok">导入完成: 成功 '+j.loaded+' 条, 跳过 '+j.skipped+' 条, 失败 '+j.errored+' 条</div>';
}
} catch(e){
res.innerHTML = '<div class="import-result fail">导入失败: '+esc(e.message)+'</div>';
}
btn.disabled = false;
btn.textContent = '导入到 Goods';
}
</script> </script>
</body> </body>
</html> </html>