@mx-space/api-client 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -2
- package/controllers/ack.ts +0 -42
- package/controllers/activity.ts +0 -108
- package/controllers/aggregate.ts +0 -75
- package/controllers/ai.ts +0 -70
- package/controllers/base.ts +0 -36
- package/controllers/category.ts +0 -118
- package/controllers/comment.ts +0 -71
- package/controllers/index.ts +0 -97
- package/controllers/link.ts +0 -46
- package/controllers/note.ts +0 -128
- package/controllers/page.ts +0 -64
- package/controllers/post.ts +0 -93
- package/controllers/project.ts +0 -27
- package/controllers/recently.ts +0 -82
- package/controllers/say.ts +0 -40
- package/controllers/search.ts +0 -108
- package/controllers/severless.ts +0 -31
- package/controllers/snippet.ts +0 -35
- package/controllers/subscribe.ts +0 -58
- package/controllers/topic.ts +0 -37
- package/controllers/user.ts +0 -61
- package/dtos/comment.ts +0 -12
- package/dtos/index.ts +0 -1
- package/index.ts +0 -12
- package/interfaces/adapter.ts +0 -36
- package/interfaces/client.ts +0 -20
- package/interfaces/controller.ts +0 -5
- package/interfaces/instance.ts +0 -8
- package/interfaces/options.ts +0 -1
- package/interfaces/params.ts +0 -4
- package/interfaces/request.ts +0 -87
- package/interfaces/types.ts +0 -3
- package/mod-dts.mjs +0 -21
- package/models/activity.ts +0 -133
- package/models/aggregate.ts +0 -97
- package/models/ai.ts +0 -17
- package/models/auth.ts +0 -9
- package/models/base.ts +0 -48
- package/models/category.ts +0 -25
- package/models/comment.ts +0 -44
- package/models/index.ts +0 -20
- package/models/link.ts +0 -25
- package/models/note.ts +0 -41
- package/models/page.ts +0 -20
- package/models/post.ts +0 -28
- package/models/project.ts +0 -12
- package/models/reader.ts +0 -9
- package/models/recently.ts +0 -24
- package/models/say.ts +0 -7
- package/models/setting.ts +0 -73
- package/models/snippet.ts +0 -19
- package/models/subscribe.ts +0 -5
- package/models/topic.ts +0 -9
- package/models/user.ts +0 -27
- package/test.d.ts +0 -3
- package/tsconfig.json +0 -37
- package/tsdown.config.ts +0 -18
- package/vitest.config.ts +0 -13
package/controllers/topic.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import type { IController } from '~/interfaces/controller'
|
|
3
|
-
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import type { TopicModel } from '~/models/topic'
|
|
5
|
-
import { autoBind } from '~/utils/auto-bind'
|
|
6
|
-
import type { HTTPClient } from '../core'
|
|
7
|
-
import { BaseCrudController } from './base'
|
|
8
|
-
|
|
9
|
-
declare module '../core/client' {
|
|
10
|
-
interface HTTPClient<
|
|
11
|
-
T extends IRequestAdapter = IRequestAdapter,
|
|
12
|
-
ResponseWrapper = unknown,
|
|
13
|
-
> {
|
|
14
|
-
topic: TopicController<ResponseWrapper>
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class TopicController<ResponseWrapper>
|
|
19
|
-
extends BaseCrudController<TopicModel, ResponseWrapper>
|
|
20
|
-
implements IController
|
|
21
|
-
{
|
|
22
|
-
base = 'topics'
|
|
23
|
-
name = 'topic'
|
|
24
|
-
|
|
25
|
-
constructor(protected client: HTTPClient) {
|
|
26
|
-
super(client)
|
|
27
|
-
autoBind(this)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public get proxy(): IRequestHandler<ResponseWrapper> {
|
|
31
|
-
return this.client.proxy(this.base)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getTopicBySlug(slug: string) {
|
|
35
|
-
return this.proxy.slug(slug).get<TopicModel>()
|
|
36
|
-
}
|
|
37
|
-
}
|
package/controllers/user.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import type { IController } from '~/interfaces/controller'
|
|
3
|
-
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import type { TLogin, UserModel } from '~/models/user'
|
|
5
|
-
import { autoBind } from '~/utils/auto-bind'
|
|
6
|
-
import type { HTTPClient } from '../core'
|
|
7
|
-
|
|
8
|
-
declare module '../core/client' {
|
|
9
|
-
interface HTTPClient<
|
|
10
|
-
T extends IRequestAdapter = IRequestAdapter,
|
|
11
|
-
ResponseWrapper = unknown,
|
|
12
|
-
> {
|
|
13
|
-
user: UserController<ResponseWrapper>
|
|
14
|
-
master: UserController<ResponseWrapper>
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class UserController<ResponseWrapper> implements IController {
|
|
19
|
-
constructor(private readonly client: HTTPClient) {
|
|
20
|
-
autoBind(this)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
base = 'master'
|
|
24
|
-
|
|
25
|
-
name = ['user', 'master']
|
|
26
|
-
|
|
27
|
-
public get proxy(): IRequestHandler<ResponseWrapper> {
|
|
28
|
-
return this.client.proxy(this.base)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getMasterInfo() {
|
|
32
|
-
return this.proxy.get<UserModel>()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
login(username: string, password: string) {
|
|
36
|
-
return this.proxy.login.post<TLogin>({
|
|
37
|
-
data: {
|
|
38
|
-
username,
|
|
39
|
-
password,
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
loginWithToken(token?: string) {
|
|
45
|
-
return this.proxy.login.put<{ token: string }>({
|
|
46
|
-
params: token
|
|
47
|
-
? {
|
|
48
|
-
token: `bearer ${token.replace(/^bearer\s/i, '')}`,
|
|
49
|
-
}
|
|
50
|
-
: undefined,
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
checkTokenValid(token: string) {
|
|
55
|
-
return this.proxy.check_logged.get<{ ok: number; isGuest: boolean }>({
|
|
56
|
-
params: {
|
|
57
|
-
token: `bearer ${token.replace(/^bearer\s/i, '')}`,
|
|
58
|
-
},
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
}
|
package/dtos/comment.ts
DELETED
package/dtos/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './comment'
|
package/index.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { createClient } from './core'
|
|
2
|
-
|
|
3
|
-
export * from './controllers'
|
|
4
|
-
export * from './models'
|
|
5
|
-
export * from './dtos'
|
|
6
|
-
|
|
7
|
-
export { createClient, RequestError } from './core'
|
|
8
|
-
export type { HTTPClient } from './core'
|
|
9
|
-
export { camelcaseKeys as simpleCamelcaseKeys } from './utils/camelcase-keys'
|
|
10
|
-
|
|
11
|
-
export default createClient
|
|
12
|
-
export type { IRequestAdapter } from './interfaces/adapter'
|
package/interfaces/adapter.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { RequestOptions } from './instance'
|
|
2
|
-
|
|
3
|
-
export type IAdaptorRequestResponseType<P> = Promise<
|
|
4
|
-
Record<string, any> & { data: P }
|
|
5
|
-
>
|
|
6
|
-
|
|
7
|
-
export type IRequestAdapter<T = any, Response = undefined> = Readonly<
|
|
8
|
-
(Response extends undefined ? {} : { responseWrapper: Response }) & {
|
|
9
|
-
default: T
|
|
10
|
-
|
|
11
|
-
get: <P = unknown>(
|
|
12
|
-
url: string,
|
|
13
|
-
options?: Omit<RequestOptions, 'data'>,
|
|
14
|
-
) => IAdaptorRequestResponseType<P>
|
|
15
|
-
|
|
16
|
-
post: <P = unknown>(
|
|
17
|
-
url: string,
|
|
18
|
-
options: Partial<RequestOptions>,
|
|
19
|
-
) => IAdaptorRequestResponseType<P>
|
|
20
|
-
|
|
21
|
-
patch: <P = unknown>(
|
|
22
|
-
url: string,
|
|
23
|
-
options: Partial<RequestOptions>,
|
|
24
|
-
) => IAdaptorRequestResponseType<P>
|
|
25
|
-
|
|
26
|
-
delete: <P = unknown>(
|
|
27
|
-
url: string,
|
|
28
|
-
options?: Omit<RequestOptions, 'data'>,
|
|
29
|
-
) => IAdaptorRequestResponseType<P>
|
|
30
|
-
|
|
31
|
-
put: <P = unknown>(
|
|
32
|
-
url: string,
|
|
33
|
-
options: Partial<RequestOptions>,
|
|
34
|
-
) => IAdaptorRequestResponseType<P>
|
|
35
|
-
}
|
|
36
|
-
>
|
package/interfaces/client.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { IController } from './controller'
|
|
2
|
-
import type { Class } from './types'
|
|
3
|
-
|
|
4
|
-
interface IClientOptions {
|
|
5
|
-
controllers: Class<IController>[]
|
|
6
|
-
getCodeMessageFromException: <T = Error>(
|
|
7
|
-
error: T,
|
|
8
|
-
) => {
|
|
9
|
-
message?: string | undefined | null
|
|
10
|
-
code?: number | undefined | null
|
|
11
|
-
}
|
|
12
|
-
customThrowResponseError: <T extends Error = Error>(err: any) => T
|
|
13
|
-
transformResponse: <T = any>(data: any) => T
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @default (res) => res.data
|
|
17
|
-
*/
|
|
18
|
-
getDataFromResponse: <T = any>(response: unknown) => T
|
|
19
|
-
}
|
|
20
|
-
export type ClientOptions = Partial<IClientOptions>
|
package/interfaces/controller.ts
DELETED
package/interfaces/instance.ts
DELETED
package/interfaces/options.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type SortOrder = 'asc' | 'desc'
|
package/interfaces/params.ts
DELETED
package/interfaces/request.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type { RequestOptions } from './instance'
|
|
2
|
-
|
|
3
|
-
type NoStringIndex<T> = {
|
|
4
|
-
[K in keyof T as string extends K ? never : K]: T[K]
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type Method = 'get' | 'delete' | 'post' | 'put' | 'patch'
|
|
8
|
-
|
|
9
|
-
export interface IRequestHandler<ResponseWrapper> {
|
|
10
|
-
(path?: string | number): IRequestHandler<ResponseWrapper>
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
get: <P = unknown>(
|
|
13
|
-
options?: Omit<NoStringIndex<RequestOptions>, 'data'>,
|
|
14
|
-
) => RequestProxyResult<P, ResponseWrapper>
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
post: <P = unknown>(
|
|
17
|
-
options?: RequestOptions,
|
|
18
|
-
) => RequestProxyResult<P, ResponseWrapper>
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
patch: <P = unknown>(
|
|
21
|
-
options?: RequestOptions,
|
|
22
|
-
) => RequestProxyResult<P, ResponseWrapper>
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
delete: <P = unknown>(
|
|
25
|
-
options?: Omit<NoStringIndex<RequestOptions>, 'data'>,
|
|
26
|
-
) => RequestProxyResult<P, ResponseWrapper>
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
put: <P = unknown>(
|
|
29
|
-
options?: RequestOptions,
|
|
30
|
-
) => RequestProxyResult<P, ResponseWrapper>
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
toString: (withBase?: boolean) => string
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
valueOf: (withBase?: boolean) => string
|
|
35
|
-
[key: string]: IRequestHandler<ResponseWrapper>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type RequestProxyResult<
|
|
39
|
-
T,
|
|
40
|
-
ResponseWrapper,
|
|
41
|
-
R = ResponseWrapper extends unknown
|
|
42
|
-
? { data: T; [key: string]: any }
|
|
43
|
-
: ResponseWrapper extends { data: T }
|
|
44
|
-
? ResponseWrapper
|
|
45
|
-
: Omit<ResponseWrapper, 'data'> & { data: T },
|
|
46
|
-
> = Promise<ResponseProxyExtraRaw<T, R, ResponseWrapper>>
|
|
47
|
-
|
|
48
|
-
type CamelToSnake<T extends string, P extends string = ''> = string extends T
|
|
49
|
-
? string
|
|
50
|
-
: T extends `${infer C0}${infer R}`
|
|
51
|
-
? CamelToSnake<
|
|
52
|
-
R,
|
|
53
|
-
`${P}${C0 extends Lowercase<C0> ? '' : '_'}${Lowercase<C0>}`
|
|
54
|
-
>
|
|
55
|
-
: P
|
|
56
|
-
|
|
57
|
-
type CamelKeysToSnake<T> = {
|
|
58
|
-
[K in keyof T as CamelToSnake<Extract<K, string>>]: T[K]
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
type ResponseWrapperType<Response, RawData, T> = {
|
|
62
|
-
$raw: Response extends { data: infer T }
|
|
63
|
-
? Response
|
|
64
|
-
: Response extends unknown
|
|
65
|
-
? {
|
|
66
|
-
[i: string]: any
|
|
67
|
-
data: RawData extends unknown ? CamelKeysToSnake<T> : RawData
|
|
68
|
-
}
|
|
69
|
-
: Response
|
|
70
|
-
$request: {
|
|
71
|
-
path: string
|
|
72
|
-
method: string
|
|
73
|
-
[k: string]: string
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
$serialized: T
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type ResponseProxyExtraRaw<
|
|
80
|
-
T,
|
|
81
|
-
RawData = unknown,
|
|
82
|
-
Response = unknown,
|
|
83
|
-
> = T extends object
|
|
84
|
-
? T & ResponseWrapperType<Response, RawData, T>
|
|
85
|
-
: T extends unknown
|
|
86
|
-
? T & ResponseWrapperType<Response, RawData, T>
|
|
87
|
-
: unknown
|
package/interfaces/types.ts
DELETED
package/mod-dts.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
|
|
4
|
-
const __dirname = new URL(import.meta.url).pathname.replace(/\/[^/]*$/, '')
|
|
5
|
-
const PKG = JSON.parse(readFileSync(path.resolve(__dirname, './package.json')))
|
|
6
|
-
|
|
7
|
-
const dts = path.resolve(__dirname, './dist/index.d.cts')
|
|
8
|
-
const dtsm = path.resolve(__dirname, './dist/index.d.mts')
|
|
9
|
-
const content = readFileSync(dts, 'utf-8')
|
|
10
|
-
|
|
11
|
-
for (const file of [dts, dtsm]) {
|
|
12
|
-
// replace declare module '../core/client'
|
|
13
|
-
// with declare module '@mx-space/api-client'
|
|
14
|
-
writeFileSync(
|
|
15
|
-
file,
|
|
16
|
-
content.replaceAll(
|
|
17
|
-
/declare module '..\/core\/client'/g,
|
|
18
|
-
'declare module ' + `'${PKG.name}'`,
|
|
19
|
-
),
|
|
20
|
-
)
|
|
21
|
-
}
|
package/models/activity.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type { CollectionRefTypes } from '@core/constants/db.constant'
|
|
2
|
-
import type { CategoryModel } from './category'
|
|
3
|
-
|
|
4
|
-
export interface ActivityPresence {
|
|
5
|
-
operationTime: number
|
|
6
|
-
identity: string
|
|
7
|
-
roomName: string
|
|
8
|
-
position: number
|
|
9
|
-
joinedAt: number
|
|
10
|
-
connectedAt: number
|
|
11
|
-
updatedAt: number
|
|
12
|
-
readerId?: string
|
|
13
|
-
|
|
14
|
-
displayName?: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface RoomOmittedNote {
|
|
18
|
-
title: string
|
|
19
|
-
nid: number
|
|
20
|
-
id: string
|
|
21
|
-
created: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface RoomOmittedPage {
|
|
25
|
-
title: string
|
|
26
|
-
slug: string
|
|
27
|
-
id: string
|
|
28
|
-
created: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface RoomOmittedPost {
|
|
32
|
-
slug: string
|
|
33
|
-
title: string
|
|
34
|
-
categoryId: string
|
|
35
|
-
category: CategoryModel
|
|
36
|
-
id: string
|
|
37
|
-
created: string
|
|
38
|
-
}
|
|
39
|
-
export interface RoomsData {
|
|
40
|
-
rooms: string[]
|
|
41
|
-
roomCount: {
|
|
42
|
-
[key: string]: number
|
|
43
|
-
}
|
|
44
|
-
objects: {
|
|
45
|
-
posts: RoomOmittedPost[]
|
|
46
|
-
notes: RoomOmittedNote[]
|
|
47
|
-
pages: RoomOmittedPage[]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface RecentActivities {
|
|
52
|
-
like: RecentLike[]
|
|
53
|
-
comment: RecentComment[]
|
|
54
|
-
recent: RecentRecent[]
|
|
55
|
-
post: RecentPost[]
|
|
56
|
-
note: RecentNote[]
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface RecentComment {
|
|
60
|
-
created: string
|
|
61
|
-
author: string
|
|
62
|
-
text: string
|
|
63
|
-
id: string
|
|
64
|
-
title: string
|
|
65
|
-
slug?: string
|
|
66
|
-
type: string
|
|
67
|
-
avatar: string
|
|
68
|
-
nid?: string
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface RecentLike {
|
|
72
|
-
created: string
|
|
73
|
-
id: string
|
|
74
|
-
type: CollectionRefTypes.Post | CollectionRefTypes.Note
|
|
75
|
-
nid?: number
|
|
76
|
-
slug?: string
|
|
77
|
-
title: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface RecentNote {
|
|
81
|
-
id: string
|
|
82
|
-
created: string
|
|
83
|
-
title: string
|
|
84
|
-
modified: string
|
|
85
|
-
nid: number
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface RecentPost {
|
|
89
|
-
id: string
|
|
90
|
-
created: string
|
|
91
|
-
title: string
|
|
92
|
-
modified: string
|
|
93
|
-
slug: string
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface RecentRecent {
|
|
97
|
-
id: string
|
|
98
|
-
|
|
99
|
-
content: string
|
|
100
|
-
up: number
|
|
101
|
-
down: number
|
|
102
|
-
created: string
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface LastYearPublication {
|
|
106
|
-
posts: PostsItem[]
|
|
107
|
-
notes: NotesItem[]
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
interface PostsItem {
|
|
111
|
-
id: string
|
|
112
|
-
created: string
|
|
113
|
-
title: string
|
|
114
|
-
slug: string
|
|
115
|
-
categoryId: string
|
|
116
|
-
category: Category
|
|
117
|
-
}
|
|
118
|
-
interface Category {
|
|
119
|
-
id: string
|
|
120
|
-
type: number
|
|
121
|
-
name: string
|
|
122
|
-
slug: string
|
|
123
|
-
created: string
|
|
124
|
-
}
|
|
125
|
-
interface NotesItem {
|
|
126
|
-
id: string
|
|
127
|
-
created: string
|
|
128
|
-
title: string
|
|
129
|
-
mood: string
|
|
130
|
-
weather: string
|
|
131
|
-
nid: number
|
|
132
|
-
bookmark: boolean
|
|
133
|
-
}
|
package/models/aggregate.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { CategoryModel } from './category'
|
|
2
|
-
import type { NoteModel } from './note'
|
|
3
|
-
import type { PageModel } from './page'
|
|
4
|
-
import type { PostModel } from './post'
|
|
5
|
-
import type { SayModel } from './say'
|
|
6
|
-
import type { SeoOptionModel } from './setting'
|
|
7
|
-
import type { UserModel } from './user'
|
|
8
|
-
|
|
9
|
-
export interface AggregateAIConfig {
|
|
10
|
-
enableSummary: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface AggregateRoot {
|
|
14
|
-
user: UserModel
|
|
15
|
-
seo: SeoOptionModel
|
|
16
|
-
url: Url
|
|
17
|
-
categories: CategoryModel[]
|
|
18
|
-
pageMeta: Pick<PageModel, 'title' | 'id' | 'slug' | 'order'>[] | null
|
|
19
|
-
/**
|
|
20
|
-
* @available 4.2.2
|
|
21
|
-
*/
|
|
22
|
-
latestNoteId: { id: string; nid: number }
|
|
23
|
-
/**
|
|
24
|
-
* @available 9.2.0
|
|
25
|
-
*/
|
|
26
|
-
ai?: AggregateAIConfig
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface AggregateRootWithTheme<Theme = unknown> extends AggregateRoot {
|
|
30
|
-
theme?: Theme
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface Url {
|
|
34
|
-
wsUrl: string
|
|
35
|
-
serverUrl: string
|
|
36
|
-
webUrl: string
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface AggregateTopNote extends Pick<
|
|
40
|
-
NoteModel,
|
|
41
|
-
'id' | 'title' | 'created' | 'nid' | 'images'
|
|
42
|
-
> {}
|
|
43
|
-
|
|
44
|
-
export interface AggregateTopPost extends Pick<
|
|
45
|
-
PostModel,
|
|
46
|
-
'id' | 'slug' | 'created' | 'title' | 'category' | 'images'
|
|
47
|
-
> {}
|
|
48
|
-
|
|
49
|
-
export interface AggregateTop {
|
|
50
|
-
notes: AggregateTopNote[]
|
|
51
|
-
posts: AggregateTopPost[]
|
|
52
|
-
says: SayModel[]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export enum TimelineType {
|
|
56
|
-
Post,
|
|
57
|
-
Note,
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface TimelineData {
|
|
61
|
-
notes?: Pick<
|
|
62
|
-
NoteModel,
|
|
63
|
-
| 'id'
|
|
64
|
-
| 'nid'
|
|
65
|
-
| 'title'
|
|
66
|
-
| 'weather'
|
|
67
|
-
| 'mood'
|
|
68
|
-
| 'created'
|
|
69
|
-
| 'modified'
|
|
70
|
-
| 'bookmark'
|
|
71
|
-
>[]
|
|
72
|
-
|
|
73
|
-
posts?: (Pick<
|
|
74
|
-
PostModel,
|
|
75
|
-
'id' | 'title' | 'slug' | 'created' | 'modified' | 'category'
|
|
76
|
-
> & { url: string })[]
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface AggregateStat {
|
|
80
|
-
allComments: number
|
|
81
|
-
categories: number
|
|
82
|
-
comments: number
|
|
83
|
-
linkApply: number
|
|
84
|
-
links: number
|
|
85
|
-
notes: number
|
|
86
|
-
pages: number
|
|
87
|
-
posts: number
|
|
88
|
-
says: number
|
|
89
|
-
recently: number
|
|
90
|
-
unreadComments: number
|
|
91
|
-
online: number
|
|
92
|
-
todayMaxOnline: string
|
|
93
|
-
todayOnlineTotal: string
|
|
94
|
-
callTime: number
|
|
95
|
-
uv: number
|
|
96
|
-
todayIpAccessCount: number
|
|
97
|
-
}
|
package/models/ai.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface AISummaryModel {
|
|
2
|
-
id: string
|
|
3
|
-
created: string
|
|
4
|
-
summary: string
|
|
5
|
-
hash: string
|
|
6
|
-
refId: string
|
|
7
|
-
lang: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface AIDeepReadingModel {
|
|
11
|
-
id: string
|
|
12
|
-
hash: string
|
|
13
|
-
refId: string
|
|
14
|
-
keyPoints: string[]
|
|
15
|
-
criticalAnalysis: string
|
|
16
|
-
content: string
|
|
17
|
-
}
|
package/models/auth.ts
DELETED
package/models/base.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export interface Count {
|
|
2
|
-
read: number
|
|
3
|
-
like: number
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface Image {
|
|
7
|
-
height: number
|
|
8
|
-
width: number
|
|
9
|
-
type: string
|
|
10
|
-
accent?: string
|
|
11
|
-
src: string
|
|
12
|
-
blurHash?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface Pager {
|
|
16
|
-
total: number
|
|
17
|
-
size: number
|
|
18
|
-
currentPage: number
|
|
19
|
-
totalPage: number
|
|
20
|
-
hasPrevPage: boolean
|
|
21
|
-
hasNextPage: boolean
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface PaginateResult<T> {
|
|
25
|
-
data: T[]
|
|
26
|
-
pagination: Pager
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface BaseModel {
|
|
30
|
-
created: string
|
|
31
|
-
id: string
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface BaseCommentIndexModel extends BaseModel {
|
|
35
|
-
commentsIndex?: number
|
|
36
|
-
|
|
37
|
-
allowComment: boolean
|
|
38
|
-
}
|
|
39
|
-
export interface TextBaseModel extends BaseCommentIndexModel {
|
|
40
|
-
title: string
|
|
41
|
-
text: string
|
|
42
|
-
images?: Image[]
|
|
43
|
-
modified: string | null
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type ModelWithLiked<T> = T & {
|
|
47
|
-
liked: boolean
|
|
48
|
-
}
|
package/models/category.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { BaseModel } from './base'
|
|
2
|
-
import type { PostModel } from './post'
|
|
3
|
-
|
|
4
|
-
export enum CategoryType {
|
|
5
|
-
Category,
|
|
6
|
-
Tag,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface CategoryModel extends BaseModel {
|
|
10
|
-
type: CategoryType
|
|
11
|
-
count: number
|
|
12
|
-
slug: string
|
|
13
|
-
name: string
|
|
14
|
-
}
|
|
15
|
-
export type CategoryWithChildrenModel = CategoryModel & {
|
|
16
|
-
children: Pick<PostModel, 'id' | 'title' | 'slug' | 'modified' | 'created'>[]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CategoryEntries = {
|
|
20
|
-
entries: Record<string, CategoryWithChildrenModel>
|
|
21
|
-
}
|
|
22
|
-
export interface TagModel {
|
|
23
|
-
count: number
|
|
24
|
-
name: string
|
|
25
|
-
}
|