feat: 初始化项目

This commit is contained in:
R524809
2026-09-02 17:47:25 +08:00
parent 04c94e75db
commit 1a2caba2b3
51 changed files with 6793 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
{
"name": "@atlas/contracts",
"version": "0.1.0",
"private": true,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"zod": "4.5.4"
},
"devDependencies": {
"typescript": "7.0.2"
}
}
+24
View File
@@ -0,0 +1,24 @@
import { z } from 'zod';
/**
* 浏览器扩展与 API 共享的采集载荷最小契约。
* 领域字段会随采集模块实现逐步补全,不能在扩展侧绕过此契约直接构造 API 请求。
*/
export const collectedProductPayloadSchema = z.object({
source: z.object({
platform: z.enum(['ozon', '1688', 'taobao', 'tmall']),
itemKey: z.string().min(1),
canonicalUrl: z.url(),
collectedAt: z.iso.datetime(),
parserVersion: z.string().min(1),
}),
common: z.object({
title: z.string().min(1).optional(),
}),
variantAxes: z.array(z.unknown()),
variants: z.array(z.unknown()),
assets: z.array(z.unknown()),
evidence: z.array(z.unknown()),
});
export type CollectedProductPayload = z.infer<typeof collectedProductPayloadSchema>;
+1
View File
@@ -0,0 +1 @@
export * from './collection';
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": ["src/**/*.ts"]
}