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"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# SQL migrations
|
||||
|
||||
此目录只保存按序号命名、不可修改历史的 SQL migration,例如 `001_foundation.sql`。
|
||||
|
||||
迁移执行器必须使用 `atlas_migrator` 连接;API 和 Worker 只允许使用 `atlas_app_login`。每个涉及工作空间数据的应用事务,都必须在查询前执行 `SET LOCAL app.workspace_id`。详细权限规则见 [`docs/architecture/database-security.md`](../../../docs/architecture/database-security.md)。
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@atlas/database",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"pg": "8.23.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "26.3.0",
|
||||
"@types/pg": "8.23.1",
|
||||
"typescript": "7.0.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 数据库访问层的唯一入口。
|
||||
* 后续在此封装迁移连接与应用连接,应用事务必须先设置 app.workspace_id。
|
||||
*/
|
||||
export const databasePackageName = '@atlas/database';
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user