Skip to content

Commit

Permalink
feat: 删除就API
Browse files Browse the repository at this point in the history
  • Loading branch information
rowthan committed Nov 11, 2022
1 parent 617e21d commit 5fb289f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pagenote/shared",
"version": "1.8.2",
"version": "1.8.3",
"description": "",
"main": "lib/",
"dependencies": {
Expand Down
14 changes: 10 additions & 4 deletions shared/src/@types/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ export interface FindResponse<T> {
next_cursor?: number | string
}

export type Projection<Model> = Partial<Record<keyof Model, 1|-1>> & {[key:string]:1|-1}
export type Projection<Model> = {
[key in keyof Model]?: 1 | -1
}

export type Sort<Model> = Partial<Record<keyof Model, 1|-1>>
export type Sort<Model> = {
[key in keyof Model]: 1 | -1
}

export type QueryValue = string | number | {
export type QueryValue = string | number | boolean | {
$like?: string; // 模糊搜索
$in?: string[]; // 数组
$gt?: number; // 大于
$lt?: number; // 小于
};

export type Query<Model> = Partial<Record<keyof Model, QueryValue>>
export type Query<Model> = {
[key in keyof Model]?: QueryValue
}

export interface Pagination {
total: number,
Expand Down
6 changes: 2 additions & 4 deletions shared/src/extApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ export namespace lightpage {
export type response = {
/**旧 API start 待删除 0.24 之后不支持**/
saveLightPage: IExtenstionMessageListener<Partial<WebPage>, WebPage | null>,
removeLightPage: IExtenstionMessageListener<{ key: string }, number>,
removeLightPages: IExtenstionMessageListener<string[], number>
/**查询列表pages*/
getLightPages: IExtenstionMessageListener<Find<WebPageKeys>, { pages: WebPage[] | WebPageKeys[], pagination: Pagination }>,
getLightPageDetail: IExtenstionMessageListener<Query<WebPageKeys>, WebPage | null>,
Expand All @@ -125,14 +123,14 @@ export namespace lightpage {
importPages: IExtenstionMessageListener<BackupData | string, number>,
/** 旧 API end*/

// 页面操作
// 页面
addPages: IExtenstionMessageListener<WebPage[], number>
removePages: IExtenstionMessageListener<{ keys: string[] }, number>
updatePages: IExtenstionMessageListener<Partial<WebPage>[], number>
queryPages: IExtenstionMessageListener<Find<WebPage>, FindResponse<Partial<WebPage>>>
groupPages: IExtenstionMessageListener<{ groupBy: keyof WebPageKeys, query?: Query<WebPageKeys>, projection?: Projection<WebPage> }, Record<string, Partial<WebPage>[]>>,

// 标记操作
// 标记
addLights: IExtenstionMessageListener<Step[], number>;
removeLights: IExtenstionMessageListener<{ keys: string[] }, number>;
updateLights: IExtenstionMessageListener<Partial<Step>[], number>;
Expand Down

0 comments on commit 5fb289f

Please sign in to comment.