feat: 初始化项目
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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>;
|
||||
@@ -0,0 +1 @@
|
||||
export * from './collection';
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user