From 92e80bd93a8b35a91a442267bef326b507eb479a Mon Sep 17 00:00:00 2001 From: abearxiong Date: Tue, 3 Mar 2026 15:48:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=9F=AD=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=94=AF=E6=8C=81=EF=BC=8C=E6=9B=B4=E6=96=B0=20API=20?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=B7=AF=E5=BE=84=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=97=A7=E7=9A=84=20convex.ts=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convex/components/n-code/schema.ts | 12 ++++++++++-- package.json | 3 ++- src/{convex.ts => admin.ts} | 0 test/get-list.ts | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) rename src/{convex.ts => admin.ts} (100%) diff --git a/convex/components/n-code/schema.ts b/convex/components/n-code/schema.ts index ccb6220..a0eef7c 100644 --- a/convex/components/n-code/schema.ts +++ b/convex/components/n-code/schema.ts @@ -7,7 +7,12 @@ export type Permission = { password?: string; // 仅当 type 为 'protected' 时有效 'expiration-time'?: string; // ISO 8601 格式的过期时间 } - +// shortLink的使用方式 +// link模式,linkType默认为redirect,使用302跳转到目标地址 +// 1. 短链跳转,直接访问对用的地址 +// 2. 请求模式, +// 1. 访问短链去请求另一个接口,内容是code: 200,判断是否执行成功(默认不透传结果) +// export default defineSchema({ // Other tables here... shortLink: defineTable({ @@ -21,7 +26,10 @@ export default defineSchema({ data: v.object({ // action: v.string(), // 动作类型,如 "open_url", "run_agent" 等 permission: v.optional(v.any()), // 权限设置 - link: v.optional(v.string()), // 仅当 type 为 'link' 时有效,表示跳转链接 + // 仅当 type 为 'link' 时有效,表示跳转链接 + link: v.optional(v.string()), + // 仅当 type 为 'link' 时有效,表示链接类型,如 'redirect' 等,默认为 'redirect' + linkType: v.optional(v.string()), }), // 码的标题 title: v.string(), diff --git a/package.json b/package.json index ce9c7b6..7dbeef9 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "nanoid": "^5.1.6" }, "exports": { - ".": "./convex/_generated/api.js" + ".": "./convex/_generated/api.js", + "./admin.ts": "./convex/admin.ts" }, "publishConfig": { "access": "public" diff --git a/src/convex.ts b/src/admin.ts similarity index 100% rename from src/convex.ts rename to src/admin.ts diff --git a/test/get-list.ts b/test/get-list.ts index e7455cd..4066a3d 100644 --- a/test/get-list.ts +++ b/test/get-list.ts @@ -1,4 +1,4 @@ -import { client, api } from '../src/convex.ts' +import { client, api } from '../src/admin.ts' // client.query(api.nCode.getList, {}).then((res) => {