From 0c9f687c5253de9380fdf910b37e4eae6e865f8f Mon Sep 17 00:00:00 2001 From: abearxiong Date: Thu, 18 Dec 2025 16:06:18 +0800 Subject: [PATCH] update --- package.json | 2 +- src/main.ts | 8 ++++++++ test/common.ts | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2425431..8f05662 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/noco", - "version": "0.0.9", + "version": "0.0.10", "description": "", "main": "index.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 5d9bf47..6f45603 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,6 +29,14 @@ export class NocoApi { set baseURL(url: string) { this.query.baseURL = url; } + async getTableByName(table: string, baseId: string) { + const res = await this.meta.tables.list(baseId) + if (res.code === 200) { + const tableMeta = res.data.list.find(t => t.table_name === table); + return tableMeta; + } + return null; + } /** * * @param baseId diff --git a/test/common.ts b/test/common.ts index 18218c6..f71eb0a 100644 --- a/test/common.ts +++ b/test/common.ts @@ -34,4 +34,8 @@ export const showMore = (obj: any) => { export const users = new Users({ query: nocoApi.query, -}); \ No newline at end of file +}); + +// const res = await nocoApi.getTableByName('控制中枢', 'p0np8adsoc79odk'); + +// console.log(showMore(res)); \ No newline at end of file