@mx-space/api-client 0.9.2 → 0.10.0
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/adaptors/axios.ts +3 -2
- package/adaptors/umi-request.ts +3 -2
- package/build/index.cjs.js +30 -8
- package/build/index.cjs.js.map +1 -1
- package/build/index.cjs.min.js +1 -1
- package/build/index.cjs.min.js.map +1 -1
- package/build/index.esm.js +30 -9
- package/build/index.esm.js.map +1 -1
- package/build/index.esm.min.js +1 -1
- package/build/index.esm.min.js.map +1 -1
- package/build/index.umd.js +30 -8
- package/build/index.umd.js.map +1 -1
- package/build/index.umd.min.js +1 -1
- package/build/index.umd.min.js.map +1 -1
- package/controllers/aggregate.ts +6 -6
- package/controllers/base.ts +3 -3
- package/controllers/category.ts +7 -7
- package/controllers/comment.ts +8 -8
- package/controllers/index.ts +3 -0
- package/controllers/link.ts +3 -3
- package/controllers/note.ts +37 -11
- package/controllers/page.ts +7 -7
- package/controllers/post.ts +7 -7
- package/controllers/project.ts +3 -3
- package/controllers/recently.ts +5 -5
- package/controllers/say.ts +5 -5
- package/controllers/search.ts +8 -8
- package/controllers/severless.ts +4 -4
- package/controllers/snippet.ts +4 -4
- package/controllers/topic.ts +39 -0
- package/controllers/user.ts +5 -5
- package/core/client.ts +8 -8
- package/esm/adaptors/axios.d.ts +2 -2
- package/esm/adaptors/axios.js.map +1 -1
- package/esm/adaptors/umi-request.d.ts +2 -2
- package/esm/adaptors/umi-request.js.map +1 -1
- package/esm/controllers/aggregate.d.ts +6 -6
- package/esm/controllers/base.d.ts +3 -3
- package/esm/controllers/category.d.ts +7 -6
- package/esm/controllers/category.js +1 -1
- package/esm/controllers/category.js.map +1 -1
- package/esm/controllers/comment.d.ts +8 -8
- package/esm/controllers/index.d.ts +3 -2
- package/esm/controllers/index.js +3 -1
- package/esm/controllers/index.js.map +1 -1
- package/esm/controllers/link.d.ts +3 -3
- package/esm/controllers/note.d.ts +28 -20
- package/esm/controllers/note.js +12 -8
- package/esm/controllers/note.js.map +1 -1
- package/esm/controllers/page.d.ts +7 -7
- package/esm/controllers/post.d.ts +7 -7
- package/esm/controllers/project.d.ts +3 -3
- package/esm/controllers/recently.d.ts +5 -5
- package/esm/controllers/say.d.ts +5 -5
- package/esm/controllers/search.d.ts +8 -8
- package/esm/controllers/severless.d.ts +4 -4
- package/esm/controllers/snippet.d.ts +4 -4
- package/esm/controllers/topic.d.ts +27 -0
- package/esm/controllers/topic.js +18 -0
- package/esm/controllers/topic.js.map +1 -0
- package/esm/controllers/user.d.ts +5 -5
- package/esm/core/client.d.ts +7 -7
- package/esm/core/client.js.map +1 -1
- package/esm/interfaces/adapter.d.ts +1 -1
- package/esm/interfaces/client.d.ts +2 -2
- package/esm/models/aggregate.d.ts +7 -7
- package/esm/models/base.d.ts +1 -0
- package/esm/models/category.d.ts +2 -2
- package/esm/models/comment.d.ts +2 -2
- package/esm/models/link.d.ts +1 -1
- package/esm/models/note.d.ts +1 -1
- package/esm/models/page.d.ts +1 -1
- package/esm/models/post.d.ts +2 -2
- package/esm/models/project.d.ts +1 -1
- package/esm/models/recently.d.ts +1 -1
- package/esm/models/say.d.ts +1 -1
- package/esm/models/snippet.d.ts +1 -1
- package/esm/models/topic.d.ts +8 -0
- package/esm/models/topic.js +2 -0
- package/esm/models/topic.js.map +1 -0
- package/esm/models/user.d.ts +1 -1
- package/esm/utils/index.d.ts +1 -1
- package/interfaces/adapter.ts +1 -1
- package/interfaces/client.ts +2 -2
- package/lib/adaptors/axios.d.ts +2 -2
- package/lib/adaptors/axios.js.map +1 -1
- package/lib/adaptors/umi-request.d.ts +2 -2
- package/lib/adaptors/umi-request.js.map +1 -1
- package/lib/controllers/aggregate.d.ts +6 -6
- package/lib/controllers/base.d.ts +3 -3
- package/lib/controllers/category.d.ts +7 -6
- package/lib/controllers/category.js.map +1 -1
- package/lib/controllers/comment.d.ts +8 -8
- package/lib/controllers/index.d.ts +3 -2
- package/lib/controllers/index.js +4 -1
- package/lib/controllers/index.js.map +1 -1
- package/lib/controllers/link.d.ts +3 -3
- package/lib/controllers/note.d.ts +28 -20
- package/lib/controllers/note.js +12 -8
- package/lib/controllers/note.js.map +1 -1
- package/lib/controllers/page.d.ts +7 -7
- package/lib/controllers/post.d.ts +7 -7
- package/lib/controllers/project.d.ts +3 -3
- package/lib/controllers/recently.d.ts +5 -5
- package/lib/controllers/say.d.ts +5 -5
- package/lib/controllers/search.d.ts +8 -8
- package/lib/controllers/severless.d.ts +4 -4
- package/lib/controllers/snippet.d.ts +4 -4
- package/lib/controllers/topic.d.ts +27 -0
- package/lib/controllers/topic.js +22 -0
- package/lib/controllers/topic.js.map +1 -0
- package/lib/controllers/user.d.ts +5 -5
- package/lib/core/client.d.ts +7 -7
- package/lib/core/client.js.map +1 -1
- package/lib/interfaces/adapter.d.ts +1 -1
- package/lib/interfaces/client.d.ts +2 -2
- package/lib/models/aggregate.d.ts +7 -7
- package/lib/models/base.d.ts +1 -0
- package/lib/models/category.d.ts +2 -2
- package/lib/models/comment.d.ts +2 -2
- package/lib/models/link.d.ts +1 -1
- package/lib/models/note.d.ts +1 -1
- package/lib/models/page.d.ts +1 -1
- package/lib/models/post.d.ts +2 -2
- package/lib/models/project.d.ts +1 -1
- package/lib/models/recently.d.ts +1 -1
- package/lib/models/say.d.ts +1 -1
- package/lib/models/snippet.d.ts +1 -1
- package/lib/models/topic.d.ts +8 -0
- package/lib/models/topic.js +3 -0
- package/lib/models/topic.js.map +1 -0
- package/lib/models/user.d.ts +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/models/aggregate.ts +7 -7
- package/models/base.ts +2 -0
- package/models/category.ts +2 -2
- package/models/comment.ts +2 -2
- package/models/link.ts +1 -1
- package/models/note.ts +1 -1
- package/models/page.ts +1 -1
- package/models/post.ts +2 -2
- package/models/project.ts +1 -1
- package/models/recently.ts +1 -1
- package/models/say.ts +1 -1
- package/models/snippet.ts +1 -1
- package/models/topic.ts +9 -0
- package/models/user.ts +1 -1
- package/package.json +8 -8
- package/types/adaptors/axios.d.ts +2 -2
- package/types/adaptors/umi-request.d.ts +2 -2
- package/types/controllers/aggregate.d.ts +6 -6
- package/types/controllers/base.d.ts +3 -3
- package/types/controllers/category.d.ts +7 -6
- package/types/controllers/comment.d.ts +8 -8
- package/types/controllers/index.d.ts +3 -2
- package/types/controllers/link.d.ts +3 -3
- package/types/controllers/note.d.ts +28 -20
- package/types/controllers/page.d.ts +7 -7
- package/types/controllers/post.d.ts +7 -7
- package/types/controllers/project.d.ts +3 -3
- package/types/controllers/recently.d.ts +5 -5
- package/types/controllers/say.d.ts +5 -5
- package/types/controllers/search.d.ts +8 -8
- package/types/controllers/severless.d.ts +4 -4
- package/types/controllers/snippet.d.ts +4 -4
- package/types/controllers/topic.d.ts +27 -0
- package/types/controllers/user.d.ts +5 -5
- package/types/core/client.d.ts +7 -7
- package/types/interfaces/adapter.d.ts +1 -1
- package/types/interfaces/client.d.ts +2 -2
- package/types/models/aggregate.d.ts +7 -7
- package/types/models/base.d.ts +1 -0
- package/types/models/category.d.ts +2 -2
- package/types/models/comment.d.ts +2 -2
- package/types/models/link.d.ts +1 -1
- package/types/models/note.d.ts +1 -1
- package/types/models/page.d.ts +1 -1
- package/types/models/post.d.ts +2 -2
- package/types/models/project.d.ts +1 -1
- package/types/models/recently.d.ts +1 -1
- package/types/models/say.d.ts +1 -1
- package/types/models/snippet.d.ts +1 -1
- package/types/models/topic.d.ts +8 -0
- package/types/models/user.d.ts +1 -1
- package/types/utils/index.d.ts +1 -1
- package/utils/index.ts +1 -1
package/controllers/link.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { LinkModel } from '~/models/link'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { LinkModel } from '~/models/link'
|
|
3
3
|
import { autoBind } from '~/utils/auto-bind'
|
|
4
4
|
|
|
5
|
-
import { HTTPClient } from '../core'
|
|
5
|
+
import type { HTTPClient } from '../core'
|
|
6
6
|
import { BaseCrudController } from './base'
|
|
7
7
|
|
|
8
8
|
declare module '../core/client' {
|
package/controllers/note.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import { SelectFields } from '~/interfaces/types'
|
|
5
|
-
import { PaginateResult } from '~/models/base'
|
|
6
|
-
import { NoteModel, NoteWrappedPayload } from '~/models/note'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
|
|
4
|
+
import type { SelectFields } from '~/interfaces/types'
|
|
5
|
+
import type { PaginateResult } from '~/models/base'
|
|
6
|
+
import type { NoteModel, NoteWrappedPayload } from '~/models/note'
|
|
7
7
|
import { autoBind } from '~/utils/auto-bind'
|
|
8
8
|
|
|
9
|
-
import { HTTPClient } from '../core/client'
|
|
9
|
+
import type { HTTPClient } from '../core/client'
|
|
10
10
|
|
|
11
11
|
declare module '../core/client' {
|
|
12
12
|
interface HTTPClient<
|
|
@@ -43,18 +43,35 @@ export class NoteController<ResponseWrapper> implements IController {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* 获取一篇日记, 根据 Id 查询需要鉴权
|
|
47
47
|
* @param id id | nid
|
|
48
48
|
* @param password 访问密码
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
|
-
getNoteById(
|
|
51
|
+
getNoteById(
|
|
52
|
+
id: string,
|
|
53
|
+
): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>
|
|
54
|
+
getNoteById(id: number): Promise<NoteWrappedPayload>
|
|
55
|
+
getNoteById(id: number, password: string): Promise<NoteWrappedPayload>
|
|
56
|
+
getNoteById(
|
|
57
|
+
id: number,
|
|
58
|
+
password: undefined,
|
|
59
|
+
singleResult: true,
|
|
60
|
+
): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>
|
|
61
|
+
getNoteById(
|
|
62
|
+
id: number,
|
|
63
|
+
password: string,
|
|
64
|
+
singleResult: true,
|
|
65
|
+
): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>
|
|
66
|
+
getNoteById(...rest: any[]): any {
|
|
67
|
+
const [id, password = undefined, singleResult = false] = rest
|
|
68
|
+
|
|
52
69
|
if (typeof id === 'number') {
|
|
53
70
|
return this.proxy.nid(id.toString()).get<NoteWrappedPayload>({
|
|
54
|
-
params: { password },
|
|
71
|
+
params: { password, single: singleResult ? '1' : undefined },
|
|
55
72
|
})
|
|
56
73
|
} else {
|
|
57
|
-
return this.proxy(id).get<
|
|
74
|
+
return this.proxy(id).get<NoteModel>()
|
|
58
75
|
}
|
|
59
76
|
}
|
|
60
77
|
|
|
@@ -94,4 +111,13 @@ export class NoteController<ResponseWrapper> implements IController {
|
|
|
94
111
|
likeIt(id: string | number) {
|
|
95
112
|
return this.proxy.like(id).get<never>()
|
|
96
113
|
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 获取专栏内的所有日记
|
|
117
|
+
*/
|
|
118
|
+
getNoteByTopicId(topicId: string, page = 1, size = 10) {
|
|
119
|
+
return this.proxy.topics(topicId).get<PaginateResult<NoteModel>>({
|
|
120
|
+
params: { page, size },
|
|
121
|
+
})
|
|
122
|
+
}
|
|
97
123
|
}
|
package/controllers/page.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import { SelectFields } from '~/interfaces/types'
|
|
5
|
-
import { PaginateResult } from '~/models/base'
|
|
6
|
-
import { PageModel } from '~/models/page'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
|
+
import type { SelectFields } from '~/interfaces/types'
|
|
5
|
+
import type { PaginateResult } from '~/models/base'
|
|
6
|
+
import type { PageModel } from '~/models/page'
|
|
7
7
|
import { autoBind } from '~/utils/auto-bind'
|
|
8
8
|
|
|
9
|
-
import { HTTPClient } from '../core'
|
|
9
|
+
import type { HTTPClient } from '../core'
|
|
10
10
|
|
|
11
11
|
declare module '../core/client' {
|
|
12
12
|
interface HTTPClient<
|
package/controllers/post.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
|
|
4
|
-
import { SelectFields } from '~/interfaces/types'
|
|
5
|
-
import { PaginateResult } from '~/models/base'
|
|
6
|
-
import { PostModel } from '~/models/post'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
|
|
4
|
+
import type { SelectFields } from '~/interfaces/types'
|
|
5
|
+
import type { PaginateResult } from '~/models/base'
|
|
6
|
+
import type { PostModel } from '~/models/post'
|
|
7
7
|
import { autoBind } from '~/utils/auto-bind'
|
|
8
8
|
|
|
9
|
-
import { HTTPClient } from '../core/client'
|
|
9
|
+
import type { HTTPClient } from '../core/client'
|
|
10
10
|
|
|
11
11
|
declare module '../core/client' {
|
|
12
12
|
interface HTTPClient<
|
package/controllers/project.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { ProjectModel } from '~/models/project'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { ProjectModel } from '~/models/project'
|
|
3
3
|
import { autoBind } from '~/utils/auto-bind'
|
|
4
4
|
|
|
5
|
-
import { HTTPClient } from '../core'
|
|
5
|
+
import type { HTTPClient } from '../core'
|
|
6
6
|
import { BaseCrudController } from './base'
|
|
7
7
|
|
|
8
8
|
declare module '../core/client' {
|
package/controllers/recently.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import { RecentlyModel } from '~/models/recently'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
|
+
import type { RecentlyModel } from '~/models/recently'
|
|
5
5
|
import { autoBind } from '~/utils/auto-bind'
|
|
6
6
|
|
|
7
|
-
import { HTTPClient } from '../core'
|
|
7
|
+
import type { HTTPClient } from '../core'
|
|
8
8
|
|
|
9
9
|
declare module '../core/client' {
|
|
10
10
|
interface HTTPClient<
|
package/controllers/say.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import { SayModel } from '~/models/say'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
|
+
import type { SayModel } from '~/models/say'
|
|
5
5
|
import { autoBind } from '~/utils/auto-bind'
|
|
6
6
|
|
|
7
|
-
import { HTTPClient } from '../core'
|
|
7
|
+
import type { HTTPClient } from '../core'
|
|
8
8
|
import { BaseCrudController } from './base'
|
|
9
9
|
|
|
10
10
|
declare module '../core/client' {
|
package/controllers/search.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
|
|
4
|
-
import { PaginateResult } from '~/models/base'
|
|
5
|
-
import { NoteModel } from '~/models/note'
|
|
6
|
-
import { PostModel } from '~/models/post'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler, RequestProxyResult } from '~/interfaces/request'
|
|
4
|
+
import type { PaginateResult } from '~/models/base'
|
|
5
|
+
import type { NoteModel } from '~/models/note'
|
|
6
|
+
import type { PostModel } from '~/models/post'
|
|
7
7
|
import { autoBind } from '~/utils/auto-bind'
|
|
8
8
|
|
|
9
|
-
import { PageModel } from '..'
|
|
10
|
-
import { HTTPClient } from '../core'
|
|
9
|
+
import type { PageModel } from '..'
|
|
10
|
+
import type { HTTPClient } from '../core'
|
|
11
11
|
|
|
12
12
|
declare module '../core/client' {
|
|
13
13
|
interface HTTPClient<
|
package/controllers/severless.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
4
|
import { autoBind } from '~/utils/auto-bind'
|
|
5
5
|
|
|
6
|
-
import { HTTPClient } from '../core'
|
|
6
|
+
import type { HTTPClient } from '../core'
|
|
7
7
|
|
|
8
8
|
declare module '../core/client' {
|
|
9
9
|
interface HTTPClient<
|
package/controllers/snippet.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
4
|
import { autoBind } from '~/utils/auto-bind'
|
|
5
5
|
|
|
6
|
-
import { HTTPClient } from '../core'
|
|
6
|
+
import type { HTTPClient } from '../core'
|
|
7
7
|
|
|
8
8
|
declare module '../core/client' {
|
|
9
9
|
interface HTTPClient<
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
+
import type { IController } from '~/interfaces/controller'
|
|
3
|
+
import type { IRequestHandler } from '~/interfaces/request'
|
|
4
|
+
import type { SayModel } from '~/models/say'
|
|
5
|
+
import type { TopicModel } from '~/models/topic'
|
|
6
|
+
import { autoBind } from '~/utils/auto-bind'
|
|
7
|
+
|
|
8
|
+
import type { HTTPClient } from '../core'
|
|
9
|
+
import { BaseCrudController } from './base'
|
|
10
|
+
|
|
11
|
+
declare module '../core/client' {
|
|
12
|
+
interface HTTPClient<
|
|
13
|
+
T extends IRequestAdapter = IRequestAdapter,
|
|
14
|
+
ResponseWrapper = unknown,
|
|
15
|
+
> {
|
|
16
|
+
topic: TopicController<ResponseWrapper>
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class TopicController<ResponseWrapper>
|
|
21
|
+
extends BaseCrudController<SayModel, ResponseWrapper>
|
|
22
|
+
implements IController
|
|
23
|
+
{
|
|
24
|
+
base = 'topics'
|
|
25
|
+
name = 'topic'
|
|
26
|
+
|
|
27
|
+
constructor(protected client: HTTPClient) {
|
|
28
|
+
super(client)
|
|
29
|
+
autoBind(this)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public get proxy(): IRequestHandler<ResponseWrapper> {
|
|
33
|
+
return this.client.proxy(this.base)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getTopicBySlug(slug: string) {
|
|
37
|
+
return this.proxy.slug(slug).get<TopicModel>()
|
|
38
|
+
}
|
|
39
|
+
}
|
package/controllers/user.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IRequestAdapter } from '~/interfaces/adapter'
|
|
2
|
-
import { IController } from '~/interfaces/controller'
|
|
3
|
-
import { IRequestHandler } from '~/interfaces/request'
|
|
4
|
-
import { TLogin, UserModel } from '~/models/user'
|
|
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
5
|
import { autoBind } from '~/utils/auto-bind'
|
|
6
6
|
|
|
7
|
-
import { HTTPClient } from '../core'
|
|
7
|
+
import type { HTTPClient } from '../core'
|
|
8
8
|
|
|
9
9
|
declare module '../core/client' {
|
|
10
10
|
interface HTTPClient<
|
package/core/client.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import camelcaseKeys from 'camelcase-keys'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
4
|
IAdaptorRequestResponseType,
|
|
5
5
|
IRequestAdapter,
|
|
6
6
|
} from '~/interfaces/adapter'
|
|
7
|
-
import { ClientOptions } from '~/interfaces/client'
|
|
8
|
-
import { IController } from '~/interfaces/controller'
|
|
9
|
-
import { RequestOptions } from '~/interfaces/instance'
|
|
10
|
-
import { IRequestHandler, Method } from '~/interfaces/request'
|
|
11
|
-
import { Class } from '~/interfaces/types'
|
|
7
|
+
import type { ClientOptions } from '~/interfaces/client'
|
|
8
|
+
import type { IController } from '~/interfaces/controller'
|
|
9
|
+
import type { RequestOptions } from '~/interfaces/instance'
|
|
10
|
+
import type { IRequestHandler, Method } from '~/interfaces/request'
|
|
11
|
+
import type { Class } from '~/interfaces/types'
|
|
12
12
|
import { isPlainObject } from '~/utils'
|
|
13
13
|
import { resolveFullPath } from '~/utils/path'
|
|
14
14
|
|
|
@@ -22,9 +22,9 @@ class HTTPClient<
|
|
|
22
22
|
T extends IRequestAdapter = IRequestAdapter,
|
|
23
23
|
ResponseWrapper = unknown,
|
|
24
24
|
> {
|
|
25
|
-
private _proxy: IRequestHandler<ResponseWrapper>
|
|
25
|
+
private readonly _proxy: IRequestHandler<ResponseWrapper>
|
|
26
26
|
|
|
27
|
-
constructor(private _endpoint: string, private _adaptor: T) {
|
|
27
|
+
constructor(private readonly _endpoint: string, private _adaptor: T) {
|
|
28
28
|
this._endpoint = _endpoint
|
|
29
29
|
.replace(/\/*$/, '')
|
|
30
30
|
.replace('localhost', '127.0.0.1')
|
package/esm/adaptors/axios.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
3
3
|
export declare const axiosAdaptor: IRequestAdapter<AxiosInstance, AxiosResponse<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../adaptors/axios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../adaptors/axios.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAE9B,2DAA2D;AAC3D,MAAM,CAAC,MAAM,YAAY,GAGrB,MAAM,CAAC,iBAAiB,CAAC;IAC3B,IAAI,OAAO;QACT,OAAO,KAAK,CAAA;IACd,CAAC;IACD,eAAe,EAAE,EAAmC;IACpD,GAAG,CAAC,GAAG,EAAE,OAAO;QACd,aAAa;QACb,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,OAAO;QACf,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QACzC,aAAa;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IACtC,CAAC;IACD,GAAG,CAAC,GAAG,EAAE,OAAO;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QACzC,aAAa;QACb,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,OAAO;QACjB,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QACnC,aAAa;QACb,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;IACD,KAAK,CAAC,GAAG,EAAE,OAAO;QAChB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QACzC,aAAa;QACb,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RequestMethod, RequestResponse } from 'umi-request';
|
|
2
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
|
+
import type { RequestMethod, RequestResponse } from 'umi-request';
|
|
2
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
3
3
|
export declare const umiAdaptor: IRequestAdapter<RequestMethod<true>, RequestResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"umi-request.js","sourceRoot":"","sources":["../../adaptors/umi-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"umi-request.js","sourceRoot":"","sources":["../../adaptors/umi-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIpC,MAAM,KAAK,GAAG,MAAM,CAAC;IACnB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,MAAM;IACnB,YAAY,EAAE,MAAM;CACrB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,UAAU,GAGnB,MAAM,CAAC,iBAAiB,CAAC;IAC3B,IAAI,OAAO;QACT,OAAO,KAAK,CAAA;IACd,CAAC;IACD,eAAe,EAAE,EAA4B;IAC7C,GAAG,CAAC,GAAG,EAAE,OAAO;QACd,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,OAAO;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACjC,CAAC;IACD,GAAG,CAAC,GAAG,EAAE,OAAO;QACd,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,OAAO;QACjB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IACnC,CAAC;IACD,KAAK,CAAC,GAAG,EAAE,OAAO;QAChB,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAClC,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
-
import { IController } from '../interfaces/controller';
|
|
3
|
-
import { SortOrder } from '../interfaces/options';
|
|
4
|
-
import { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
5
|
-
import { AggregateRoot, AggregateStat, AggregateTop, TimelineData, TimelineType } from '../models/aggregate';
|
|
6
|
-
import { HTTPClient } from '../core';
|
|
1
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
+
import type { IController } from '../interfaces/controller';
|
|
3
|
+
import type { SortOrder } from '../interfaces/options';
|
|
4
|
+
import type { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
5
|
+
import type { AggregateRoot, AggregateStat, AggregateTop, TimelineData, TimelineType } from '../models/aggregate';
|
|
6
|
+
import type { HTTPClient } from '../core';
|
|
7
7
|
declare module '../core/client' {
|
|
8
8
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
9
9
|
aggregate: AggregateController<ResponseWrapper>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
2
|
-
import { PaginateResult } from '../models/base';
|
|
3
|
-
import { HTTPClient } from '../core';
|
|
1
|
+
import type { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
2
|
+
import type { PaginateResult } from '../models/base';
|
|
3
|
+
import type { HTTPClient } from '../core';
|
|
4
4
|
export declare abstract class BaseCrudController<T, ResponseWrapper> {
|
|
5
5
|
protected client: HTTPClient;
|
|
6
6
|
base: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
-
import { IController } from '../interfaces/controller';
|
|
3
|
-
import { IRequestHandler, RequestProxyResult, ResponseProxyExtraRaw } from '../interfaces/request';
|
|
4
|
-
import { HTTPClient } from '../core/client';
|
|
5
|
-
import { CategoryModel,
|
|
6
|
-
import {
|
|
1
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
+
import type { IController } from '../interfaces/controller';
|
|
3
|
+
import type { IRequestHandler, RequestProxyResult, ResponseProxyExtraRaw } from '../interfaces/request';
|
|
4
|
+
import type { HTTPClient } from '../core/client';
|
|
5
|
+
import type { CategoryModel, CategoryWithChildrenModel, TagModel } from '../models/category';
|
|
6
|
+
import { CategoryType } from '../models/category';
|
|
7
|
+
import type { PostModel } from '../models/post';
|
|
7
8
|
declare module '../core/client' {
|
|
8
9
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
9
10
|
category: CategoryController<ResponseWrapper>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { attachRawFromOneToAnthor, destructureData } from '../utils';
|
|
2
2
|
import { autoBind } from '../utils/auto-bind';
|
|
3
3
|
import { RequestError } from '../core/error';
|
|
4
|
-
import { CategoryType
|
|
4
|
+
import { CategoryType } from '../models/category';
|
|
5
5
|
export class CategoryController {
|
|
6
6
|
constructor(client) {
|
|
7
7
|
this.client = client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../controllers/category.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../controllers/category.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAO5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAYjD,MAAM,OAAO,kBAAkB;IAG7B,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAFtC,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,YAAY,CAAA;QAEjB,QAAQ,CAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,gBAAgB;QAId,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,MAAM,EAAE;gBACN,IAAI,EAAE,YAAY,CAAC,QAAQ;aAC5B;SACF,CAAC,CAAA;IACJ,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAuB;YAC1C,MAAM,EAAE;gBACN,IAAI,EAAE,YAAY,CAAC,GAAG;aACvB;SACF,CAAC,CAAA;IACJ,CAAC;IAQD,KAAK,CAAC,iBAAiB,CAAC,GAAsB;QAC5C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkB;gBACjD,MAAM,EAAE;oBACN,GAAG;iBACJ;aACF,CAAC,CAAA;YACF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;YAC7C,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;YACtC,OAAO,MAAM,CAAA;SACd;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkB;gBACjD,MAAM,EAAE;oBACN,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;iBACnB;aACF,CAAC,CAAA;YACF,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,CAAA;YAC7B,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,YAAY,CACpB,sBAAsB,EACtB,GAAG,EACH,IAAI,CAAC,QAAQ,CAAC,IAAI,EAClB,IAAI,CACL,CAAA;aACF;YAED,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC,CACxE,CAAA;YAED,wBAAwB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;YACnC,OAAO,GAAG,CAAA;SACX;IACH,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,QAAgB;QAC1C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,EAA6B,CAAA;QACvE,OAAO,eAAe,CAAC,GAAG,CAAe,CAAA;IAC3C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY;QAC7B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAGnC;YACD,MAAM,EAAE;gBACN,GAAG,EAAE,CAAC;aACP;SACF,CAAC,CAAA;QAEF,OAAO,GAAG,CAAA;IACZ,CAAC;CACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
-
import { IController } from '../interfaces/controller';
|
|
3
|
-
import { PaginationParams } from '../interfaces/params';
|
|
4
|
-
import { IRequestHandler } from '../interfaces/request';
|
|
5
|
-
import { PaginateResult } from '../models/base';
|
|
6
|
-
import { CommentModel } from '../models/comment';
|
|
7
|
-
import { HTTPClient } from '../core';
|
|
8
|
-
import { CommentDto } from '../dtos/comment';
|
|
1
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
+
import type { IController } from '../interfaces/controller';
|
|
3
|
+
import type { PaginationParams } from '../interfaces/params';
|
|
4
|
+
import type { IRequestHandler } from '../interfaces/request';
|
|
5
|
+
import type { PaginateResult } from '../models/base';
|
|
6
|
+
import type { CommentModel } from '../models/comment';
|
|
7
|
+
import type { HTTPClient } from '../core';
|
|
8
|
+
import type { CommentDto } from '../dtos/comment';
|
|
9
9
|
declare module '../core/client' {
|
|
10
10
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
11
11
|
comment: CommentController<ResponseWrapper>;
|
|
@@ -11,7 +11,8 @@ import { SayController } from './say';
|
|
|
11
11
|
import { SearchController } from './search';
|
|
12
12
|
import { ServerlessController } from './severless';
|
|
13
13
|
import { SnippetController } from './snippet';
|
|
14
|
+
import { TopicController } from './topic';
|
|
14
15
|
import { UserController } from './user';
|
|
15
16
|
export declare const allControllers: (typeof AggregateController | typeof CategoryController | typeof CommentController | typeof LinkController | typeof NoteController | typeof PageController | typeof PostController | typeof ProjectController | typeof RecentlyController | typeof SayController | typeof SearchController | typeof ServerlessController | typeof SnippetController | typeof UserController)[];
|
|
16
|
-
export declare const allContollerNames: readonly ["aggregate", "category", "comment", "link", "note", "page", "post", "project", "recently", "say", "search", "snippet", "serverless", "user", "friend", "master", "shorthand"];
|
|
17
|
-
export { AggregateController, CategoryController, CommentController, LinkController, NoteController, PageController, PostController, ProjectController, RecentlyController, SayController, SearchController, SnippetController, ServerlessController, UserController, };
|
|
17
|
+
export declare const allContollerNames: readonly ["aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "user", "friend", "master", "shorthand"];
|
|
18
|
+
export { AggregateController, CategoryController, CommentController, LinkController, NoteController, PageController, PostController, ProjectController, RecentlyController, SayController, SearchController, SnippetController, ServerlessController, UserController, TopicController, };
|
package/esm/controllers/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { SayController } from './say';
|
|
|
11
11
|
import { SearchController } from './search';
|
|
12
12
|
import { ServerlessController } from './severless';
|
|
13
13
|
import { SnippetController } from './snippet';
|
|
14
|
+
import { TopicController } from './topic';
|
|
14
15
|
import { UserController } from './user';
|
|
15
16
|
export const allControllers = [
|
|
16
17
|
AggregateController,
|
|
@@ -37,6 +38,7 @@ export const allContollerNames = [
|
|
|
37
38
|
'page',
|
|
38
39
|
'post',
|
|
39
40
|
'project',
|
|
41
|
+
'topic',
|
|
40
42
|
'recently',
|
|
41
43
|
'say',
|
|
42
44
|
'search',
|
|
@@ -48,5 +50,5 @@ export const allContollerNames = [
|
|
|
48
50
|
'master',
|
|
49
51
|
'shorthand',
|
|
50
52
|
];
|
|
51
|
-
export { AggregateController, CategoryController, CommentController, LinkController, NoteController, PageController, PostController, ProjectController, RecentlyController, SayController, SearchController, SnippetController, ServerlessController, UserController, };
|
|
53
|
+
export { AggregateController, CategoryController, CommentController, LinkController, NoteController, PageController, PostController, ProjectController, RecentlyController, SayController, SearchController, SnippetController, ServerlessController, UserController, TopicController, };
|
|
52
54
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,aAAa;IACb,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IACpB,cAAc;CACf,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,KAAK;IACL,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,MAAM;IAEN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,WAAW;CACH,CAAA;AAEV,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,cAAc;IACd,cAAc;IACd,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,aAAa;IACb,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IACpB,cAAc;CACf,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,OAAO;IACP,UAAU;IACV,KAAK;IACL,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,MAAM;IAEN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,WAAW;CACH,CAAA;AAEV,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,eAAe,GAChB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
-
import { LinkModel } from '../models/link';
|
|
3
|
-
import { HTTPClient } from '../core';
|
|
1
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
+
import type { LinkModel } from '../models/link';
|
|
3
|
+
import type { HTTPClient } from '../core';
|
|
4
4
|
import { BaseCrudController } from './base';
|
|
5
5
|
declare module '../core/client' {
|
|
6
6
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
-
import { IController } from '../interfaces/controller';
|
|
3
|
-
import { IRequestHandler } from '../interfaces/request';
|
|
4
|
-
import { SelectFields } from '../interfaces/types';
|
|
5
|
-
import { PaginateResult } from '../models/base';
|
|
6
|
-
import { NoteModel, NoteWrappedPayload } from '../models/note';
|
|
7
|
-
import { HTTPClient } from '../core/client';
|
|
1
|
+
import type { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
+
import type { IController } from '../interfaces/controller';
|
|
3
|
+
import type { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
4
|
+
import type { SelectFields } from '../interfaces/types';
|
|
5
|
+
import type { PaginateResult } from '../models/base';
|
|
6
|
+
import type { NoteModel, NoteWrappedPayload } from '../models/note';
|
|
7
|
+
import type { HTTPClient } from '../core/client';
|
|
8
8
|
declare module '../core/client' {
|
|
9
9
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
10
10
|
note: NoteController<ResponseWrapper>;
|
|
@@ -25,7 +25,7 @@ export declare class NoteController<ResponseWrapper> implements IController {
|
|
|
25
25
|
/**
|
|
26
26
|
* 最新日记
|
|
27
27
|
*/
|
|
28
|
-
getLatest():
|
|
28
|
+
getLatest(): RequestProxyResult<NoteWrappedPayload, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
29
29
|
[key: string]: any;
|
|
30
30
|
data: NoteWrappedPayload;
|
|
31
31
|
} : ResponseWrapper extends {
|
|
@@ -34,22 +34,19 @@ export declare class NoteController<ResponseWrapper> implements IController {
|
|
|
34
34
|
data: NoteWrappedPayload;
|
|
35
35
|
}>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 获取一篇日记, 根据 Id 查询需要鉴权
|
|
38
38
|
* @param id id | nid
|
|
39
39
|
* @param password 访问密码
|
|
40
40
|
*/
|
|
41
|
-
getNoteById(id: string
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
47
|
-
data: NoteWrappedPayload;
|
|
48
|
-
}>;
|
|
41
|
+
getNoteById(id: string): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
42
|
+
getNoteById(id: number): Promise<NoteWrappedPayload>;
|
|
43
|
+
getNoteById(id: number, password: string): Promise<NoteWrappedPayload>;
|
|
44
|
+
getNoteById(id: number, password: undefined, singleResult: true): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
45
|
+
getNoteById(id: number, password: string, singleResult: true): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
49
46
|
/**
|
|
50
47
|
* 日记列表分页
|
|
51
48
|
*/
|
|
52
|
-
getList(page?: number, perPage?: number, options?: NoteListOptions):
|
|
49
|
+
getList(page?: number, perPage?: number, options?: NoteListOptions): RequestProxyResult<PaginateResult<NoteModel>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
53
50
|
[key: string]: any;
|
|
54
51
|
data: PaginateResult<NoteModel>;
|
|
55
52
|
} : ResponseWrapper extends {
|
|
@@ -60,7 +57,7 @@ export declare class NoteController<ResponseWrapper> implements IController {
|
|
|
60
57
|
/**
|
|
61
58
|
* 获取当前日记的上下各 n / 2 篇日记
|
|
62
59
|
*/
|
|
63
|
-
getMiddleList(id: string, size?: number):
|
|
60
|
+
getMiddleList(id: string, size?: number): RequestProxyResult<{
|
|
64
61
|
data: Pick<NoteModel, 'id' | 'title' | 'nid' | 'created'>[];
|
|
65
62
|
size: number;
|
|
66
63
|
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
@@ -83,7 +80,7 @@ export declare class NoteController<ResponseWrapper> implements IController {
|
|
|
83
80
|
/**
|
|
84
81
|
* 喜欢这篇日记
|
|
85
82
|
*/
|
|
86
|
-
likeIt(id: string | number):
|
|
83
|
+
likeIt(id: string | number): RequestProxyResult<never, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
87
84
|
[key: string]: any;
|
|
88
85
|
data: never;
|
|
89
86
|
} : ResponseWrapper extends {
|
|
@@ -91,4 +88,15 @@ export declare class NoteController<ResponseWrapper> implements IController {
|
|
|
91
88
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
92
89
|
data: never;
|
|
93
90
|
}>;
|
|
91
|
+
/**
|
|
92
|
+
* 获取专栏内的所有日记
|
|
93
|
+
*/
|
|
94
|
+
getNoteByTopicId(topicId: string, page?: number, size?: number): RequestProxyResult<PaginateResult<NoteModel>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
data: PaginateResult<NoteModel>;
|
|
97
|
+
} : ResponseWrapper extends {
|
|
98
|
+
data: PaginateResult<NoteModel>;
|
|
99
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
100
|
+
data: PaginateResult<NoteModel>;
|
|
101
|
+
}>;
|
|
94
102
|
}
|