@mx-space/api-client 0.7.0 → 0.7.3
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 +34 -32
- package/adaptors/umi-request.ts +25 -22
- package/build/index.cjs.js +30 -32
- 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 -32
- 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 -32
- 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 +9 -5
- package/controllers/base.ts +3 -3
- package/controllers/category.ts +18 -7
- package/controllers/comment.ts +10 -6
- package/controllers/index.ts +4 -0
- package/controllers/link.ts +11 -4
- package/controllers/note.ts +11 -7
- package/controllers/page.ts +10 -5
- package/controllers/post.ts +15 -8
- package/controllers/project.ts +10 -3
- package/controllers/recently.ts +10 -5
- package/controllers/say.ts +10 -5
- package/controllers/search.ts +14 -7
- package/controllers/severless.ts +31 -0
- package/controllers/snippet.ts +11 -6
- package/controllers/user.ts +10 -5
- package/core/attach-request.ts +1 -1
- package/core/client.ts +37 -47
- package/coverage/clover.xml +357 -337
- package/coverage/coverage-final.json +27 -26
- package/coverage/lcov-report/adaptors/axios.ts.html +50 -44
- package/coverage/lcov-report/adaptors/index.html +24 -24
- package/coverage/lcov-report/adaptors/umi-request.ts.html +42 -33
- package/coverage/lcov-report/auto-bind.ts.html +229 -0
- package/coverage/lcov-report/controllers/aggregate.ts.html +23 -11
- package/coverage/lcov-report/controllers/base.ts.html +6 -6
- package/coverage/lcov-report/controllers/category.ts.html +48 -15
- package/coverage/lcov-report/controllers/comment.ts.html +23 -11
- package/coverage/lcov-report/controllers/index.html +26 -11
- package/coverage/lcov-report/controllers/index.ts.html +40 -28
- package/coverage/lcov-report/controllers/link.ts.html +31 -10
- package/coverage/lcov-report/controllers/note.ts.html +24 -12
- package/coverage/lcov-report/controllers/page.ts.html +25 -10
- package/coverage/lcov-report/controllers/post.ts.html +39 -18
- package/coverage/lcov-report/controllers/project.ts.html +30 -9
- package/coverage/lcov-report/controllers/recently.ts.html +25 -10
- package/coverage/lcov-report/controllers/say.ts.html +26 -11
- package/coverage/lcov-report/controllers/search.ts.html +33 -12
- package/coverage/lcov-report/controllers/severless.ts.html +178 -0
- package/coverage/lcov-report/controllers/snippet.ts.html +26 -11
- package/coverage/lcov-report/controllers/user.ts.html +25 -10
- package/coverage/lcov-report/core/attach-request.ts.html +14 -14
- package/coverage/lcov-report/core/client.ts.html +120 -150
- package/coverage/lcov-report/core/error.ts.html +2 -2
- package/coverage/lcov-report/core/index.html +18 -18
- package/coverage/lcov-report/core/index.ts.html +3 -3
- package/coverage/lcov-report/index.html +34 -34
- package/coverage/lcov-report/index.ts.html +244 -0
- package/coverage/lcov-report/models/aggregate.ts.html +1 -1
- package/coverage/lcov-report/models/category.ts.html +4 -4
- package/coverage/lcov-report/models/index.html +1 -1
- package/coverage/lcov-report/utils/auto-bind.ts.html +20 -20
- package/coverage/lcov-report/utils/index.html +1 -1
- package/coverage/lcov-report/utils/index.ts.html +7 -7
- package/coverage/lcov.info +615 -577
- package/esm/adaptors/axios.d.ts +2 -2
- package/esm/adaptors/axios.js +1 -0
- package/esm/adaptors/axios.js.map +1 -1
- package/esm/adaptors/umi-request.d.ts +2 -2
- package/esm/adaptors/umi-request.js +1 -0
- package/esm/adaptors/umi-request.js.map +1 -1
- package/esm/controllers/aggregate.d.ts +25 -8
- package/esm/controllers/aggregate.js.map +1 -1
- package/esm/controllers/base.d.ts +17 -5
- package/esm/controllers/category.d.ts +64 -13
- package/esm/controllers/category.js.map +1 -1
- package/esm/controllers/comment.d.ts +42 -10
- package/esm/controllers/comment.js.map +1 -1
- package/esm/controllers/index.d.ts +4 -3
- package/esm/controllers/index.js +4 -1
- package/esm/controllers/index.js.map +1 -1
- package/esm/controllers/link.d.ts +5 -4
- package/esm/controllers/link.js.map +1 -1
- package/esm/controllers/note.d.ts +42 -12
- package/esm/controllers/note.js.map +1 -1
- package/esm/controllers/page.d.ts +22 -8
- package/esm/controllers/page.js.map +1 -1
- package/esm/controllers/post.d.ts +24 -11
- package/esm/controllers/post.js.map +1 -1
- package/esm/controllers/project.d.ts +4 -3
- package/esm/controllers/project.js.map +1 -1
- package/esm/controllers/recently.d.ts +30 -8
- package/esm/controllers/recently.js.map +1 -1
- package/esm/controllers/say.d.ts +15 -5
- package/esm/controllers/say.js.map +1 -1
- package/esm/controllers/search.d.ts +168 -9
- package/esm/controllers/search.js.map +1 -1
- package/esm/controllers/severless.d.ts +24 -0
- package/esm/controllers/severless.js +16 -0
- package/esm/controllers/severless.js.map +1 -0
- package/esm/controllers/snippet.d.ts +17 -7
- package/esm/controllers/snippet.js.map +1 -1
- package/esm/controllers/user.d.ts +28 -8
- package/esm/controllers/user.js.map +1 -1
- package/esm/core/attach-request.d.ts +1 -1
- package/esm/core/attach-request.js.map +1 -1
- package/esm/core/client.d.ts +9 -6
- package/esm/core/client.js +13 -32
- package/esm/core/client.js.map +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/interfaces/adapter.d.ts +9 -8
- package/esm/interfaces/client.d.ts +1 -1
- package/esm/interfaces/request.d.ts +22 -13
- package/esm/interfaces/types.d.ts +2 -0
- package/esm/interfaces/types.js +2 -0
- package/esm/interfaces/types.js.map +1 -0
- package/esm/models/post.d.ts +0 -1
- package/index.ts +2 -1
- package/interfaces/adapter.ts +29 -24
- package/interfaces/client.ts +1 -1
- package/interfaces/request.ts +45 -20
- package/{types/helper.d.ts → interfaces/types.ts} +0 -0
- package/lib/adaptors/axios.d.ts +2 -2
- package/lib/adaptors/axios.js +1 -0
- package/lib/adaptors/axios.js.map +1 -1
- package/lib/adaptors/umi-request.d.ts +2 -2
- package/lib/adaptors/umi-request.js +1 -0
- package/lib/adaptors/umi-request.js.map +1 -1
- package/lib/controllers/aggregate.d.ts +25 -8
- package/lib/controllers/aggregate.js.map +1 -1
- package/lib/controllers/base.d.ts +17 -5
- package/lib/controllers/category.d.ts +64 -13
- package/lib/controllers/category.js.map +1 -1
- package/lib/controllers/comment.d.ts +42 -10
- package/lib/controllers/comment.js.map +1 -1
- package/lib/controllers/index.d.ts +4 -3
- package/lib/controllers/index.js +5 -1
- package/lib/controllers/index.js.map +1 -1
- package/lib/controllers/link.d.ts +5 -4
- package/lib/controllers/link.js.map +1 -1
- package/lib/controllers/note.d.ts +42 -12
- package/lib/controllers/note.js.map +1 -1
- package/lib/controllers/page.d.ts +22 -8
- package/lib/controllers/page.js.map +1 -1
- package/lib/controllers/post.d.ts +24 -11
- package/lib/controllers/post.js.map +1 -1
- package/lib/controllers/project.d.ts +4 -3
- package/lib/controllers/project.js.map +1 -1
- package/lib/controllers/recently.d.ts +30 -8
- package/lib/controllers/recently.js.map +1 -1
- package/lib/controllers/say.d.ts +15 -5
- package/lib/controllers/say.js.map +1 -1
- package/lib/controllers/search.d.ts +168 -9
- package/lib/controllers/search.js.map +1 -1
- package/lib/controllers/severless.d.ts +24 -0
- package/lib/controllers/severless.js +20 -0
- package/lib/controllers/severless.js.map +1 -0
- package/lib/controllers/snippet.d.ts +17 -7
- package/lib/controllers/snippet.js.map +1 -1
- package/lib/controllers/user.d.ts +28 -8
- package/lib/controllers/user.js.map +1 -1
- package/lib/core/attach-request.d.ts +1 -1
- package/lib/core/attach-request.js.map +1 -1
- package/lib/core/client.d.ts +9 -6
- package/lib/core/client.js +13 -33
- package/lib/core/client.js.map +1 -1
- package/lib/core/index.js +5 -1
- package/lib/core/index.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/interfaces/adapter.d.ts +9 -8
- package/lib/interfaces/client.d.ts +1 -1
- package/lib/interfaces/request.d.ts +22 -13
- package/lib/interfaces/types.d.ts +2 -0
- package/lib/interfaces/types.js +3 -0
- package/lib/interfaces/types.js.map +1 -0
- package/lib/models/index.js +5 -1
- package/lib/models/index.js.map +1 -1
- package/lib/models/post.d.ts +0 -1
- package/models/post.ts +0 -1
- package/package.json +12 -12
- package/tsconfig.json +25 -4
- package/tsconfig.types.json +18 -0
- package/types/adaptors/axios.d.ts +3 -0
- package/types/adaptors/umi-request.d.ts +3 -0
- package/types/controllers/aggregate.d.ts +64 -0
- package/types/controllers/base.d.ts +39 -0
- package/types/controllers/category.d.ts +114 -0
- package/types/controllers/comment.d.ts +81 -0
- package/types/controllers/index.d.ts +17 -0
- package/types/controllers/link.d.ts +16 -0
- package/types/controllers/note.d.ts +94 -0
- package/types/controllers/page.d.ts +59 -0
- package/types/controllers/post.d.ts +72 -0
- package/types/controllers/project.d.ts +15 -0
- package/types/controllers/recently.d.ts +61 -0
- package/types/controllers/say.d.ts +37 -0
- package/types/controllers/search.d.ts +247 -0
- package/types/controllers/severless.d.ts +24 -0
- package/types/controllers/snippet.d.ts +33 -0
- package/types/controllers/user.d.ts +54 -0
- package/types/core/attach-request.d.ts +2 -0
- package/types/core/client.d.ts +29 -0
- package/types/core/error.d.ts +6 -0
- package/types/core/index.d.ts +2 -0
- package/types/dtos/comment.d.ts +6 -0
- package/types/index.d.ts +7 -0
- package/types/interfaces/adapter.d.ts +14 -0
- package/types/interfaces/client.d.ts +5 -0
- package/types/interfaces/controller.d.ts +4 -0
- package/types/interfaces/instance.d.ts +7 -0
- package/types/interfaces/options.d.ts +1 -0
- package/types/interfaces/params.d.ts +4 -0
- package/types/interfaces/request.d.ts +43 -0
- package/types/interfaces/types.d.ts +2 -0
- package/types/models/aggregate.d.ts +53 -0
- package/types/models/base.d.ts +37 -0
- package/types/models/category.d.ts +22 -0
- package/types/models/comment.d.ts +34 -0
- package/types/models/index.d.ts +14 -0
- package/types/models/link.d.ts +20 -0
- package/types/models/note.d.ts +30 -0
- package/types/models/page.d.ts +14 -0
- package/types/models/post.d.ts +14 -0
- package/types/models/project.d.ts +11 -0
- package/types/models/recently.d.ts +6 -0
- package/types/models/say.d.ts +6 -0
- package/types/models/setting.d.ts +66 -0
- package/types/models/snippet.d.ts +16 -0
- package/types/models/user.d.ts +21 -0
- package/types/utils/auto-bind.d.ts +4 -0
- package/types/utils/index.d.ts +5 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { IController } from '../interfaces/controller';
|
|
2
|
-
import { RequestProxyResult } from '../interfaces/request';
|
|
3
|
+
import { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
4
|
+
import { SelectFields } from '../interfaces/types';
|
|
3
5
|
import { PaginateResult } from '../models/base';
|
|
4
6
|
import { PostModel } from '../models/post';
|
|
5
|
-
import { SelectFields } from '../types/helper';
|
|
6
7
|
import { HTTPClient } from '../core/client';
|
|
7
8
|
declare module '../core/client' {
|
|
8
|
-
interface HTTPClient {
|
|
9
|
-
post: PostController
|
|
9
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
10
|
+
post: PostController<ResponseWrapper>;
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
export declare type PostListOptions = {
|
|
@@ -15,45 +16,57 @@ export declare type PostListOptions = {
|
|
|
15
16
|
sortBy?: 'categoryId' | 'title' | 'created' | 'modified';
|
|
16
17
|
sortOrder?: 1 | -1;
|
|
17
18
|
};
|
|
18
|
-
export declare class PostController implements IController {
|
|
19
|
+
export declare class PostController<ResponseWrapper> implements IController {
|
|
19
20
|
private client;
|
|
20
21
|
constructor(client: HTTPClient);
|
|
21
22
|
base: string;
|
|
22
23
|
name: string;
|
|
23
|
-
get proxy():
|
|
24
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
24
25
|
/**
|
|
25
26
|
* 获取文章列表分页
|
|
26
27
|
* @param page
|
|
27
28
|
* @param perPage
|
|
28
29
|
* @returns
|
|
29
30
|
*/
|
|
30
|
-
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostModel>, {
|
|
31
|
+
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostModel>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
31
32
|
[key: string]: any;
|
|
32
33
|
data: PaginateResult<PostModel>;
|
|
34
|
+
} : ResponseWrapper extends {
|
|
35
|
+
data: PaginateResult<PostModel>;
|
|
36
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
37
|
+
data: PaginateResult<PostModel>;
|
|
33
38
|
}>;
|
|
34
39
|
/**
|
|
35
40
|
* 根据分类和路径查找文章
|
|
36
41
|
* @param categoryName
|
|
37
42
|
* @param slug
|
|
38
43
|
*/
|
|
39
|
-
getPost(categoryName: string, slug: string): RequestProxyResult<PostModel>;
|
|
44
|
+
getPost(categoryName: string, slug: string): RequestProxyResult<PostModel, ResponseWrapper>;
|
|
40
45
|
/**
|
|
41
46
|
* 根据 ID 查找文章
|
|
42
47
|
* @param id
|
|
43
48
|
*/
|
|
44
|
-
getPost(id: string): RequestProxyResult<PostModel>;
|
|
49
|
+
getPost(id: string): RequestProxyResult<PostModel, ResponseWrapper>;
|
|
45
50
|
/**
|
|
46
51
|
* 获取最新的文章
|
|
47
52
|
*/
|
|
48
|
-
getLatest(): RequestProxyResult<PostModel, {
|
|
53
|
+
getLatest(): RequestProxyResult<PostModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
49
54
|
[key: string]: any;
|
|
50
55
|
data: PostModel;
|
|
56
|
+
} : ResponseWrapper extends {
|
|
57
|
+
data: PostModel;
|
|
58
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
59
|
+
data: PostModel;
|
|
51
60
|
}>;
|
|
52
61
|
/**
|
|
53
62
|
* 点赞
|
|
54
63
|
*/
|
|
55
|
-
thumbsUp(id: string): RequestProxyResult<void, {
|
|
64
|
+
thumbsUp(id: string): RequestProxyResult<void, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
56
65
|
[key: string]: any;
|
|
57
66
|
data: void;
|
|
67
|
+
} : ResponseWrapper extends {
|
|
68
|
+
data: void;
|
|
69
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
70
|
+
data: void;
|
|
58
71
|
}>;
|
|
59
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","sources":["../../controllers/post.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../../controllers/post.ts"],"names":[],"mappings":";;;AAMA,iDAA4C;AAmB5C,MAAa,cAAc;IACzB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAItC,SAAI,GAAG,OAAO,CAAA;QAEd,SAAI,GAAG,MAAM,CAAA;QALX,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,GAAG,EAAE,EAAE,UAA2B,EAAE;QAC3D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B;YAC/C,MAAM,EAAE;gBACN,IAAI;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC;gBACzB,MAAM;gBACN,SAAS;gBACT,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;IAgBD,OAAO,CAAC,gBAAwB,EAAE,IAAa;QAC7C,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE;YACzB,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,EAAa,CAAA;SACrD;aAAM;YACL,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAa,CAAA;SAC3D;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAa,CAAA;IAC3C,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,CAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CACF;AApED,wCAoEC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { ProjectModel } from '../models/project';
|
|
2
3
|
import { HTTPClient } from '../core';
|
|
3
4
|
import { BaseCrudController } from './base';
|
|
4
5
|
declare module '../core/client' {
|
|
5
|
-
interface HTTPClient {
|
|
6
|
-
project: ProjectController
|
|
6
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
7
|
+
project: ProjectController<ResponseWrapper>;
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
export declare class ProjectController extends BaseCrudController<ProjectModel> {
|
|
10
|
+
export declare class ProjectController<ResponseWrapper> extends BaseCrudController<ProjectModel, ResponseWrapper> {
|
|
10
11
|
protected readonly client: HTTPClient;
|
|
11
12
|
constructor(client: HTTPClient);
|
|
12
13
|
base: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../controllers/project.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../controllers/project.ts"],"names":[],"mappings":";;;AAEA,iDAA4C;AAE5C,iCAA2C;AAW3C,MAAa,iBAAmC,SAAQ,yBAGvD;IACC,YAA+B,MAAkB;QAC/C,KAAK,CAAC,MAAM,CAAC,CAAA;QADgB,WAAM,GAAN,MAAM,CAAY;QAKjD,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,SAAS,CAAA;QAJd,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;CAIF;AAXD,8CAWC"}
|
|
@@ -1,39 +1,61 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { IController } from '../interfaces/controller';
|
|
3
|
+
import { IRequestHandler } from '../interfaces/request';
|
|
2
4
|
import { RecentlyModel } from '../models/recently';
|
|
3
5
|
import { HTTPClient } from '../core';
|
|
4
6
|
declare module '../core/client' {
|
|
5
|
-
interface HTTPClient {
|
|
6
|
-
recently: RecentlyController
|
|
7
|
-
shorthand: RecentlyController
|
|
7
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
8
|
+
recently: RecentlyController<ResponseWrapper>;
|
|
9
|
+
shorthand: RecentlyController<ResponseWrapper>;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
|
-
export declare class RecentlyController implements IController {
|
|
12
|
+
export declare class RecentlyController<ResponseWrapper> implements IController {
|
|
11
13
|
private readonly client;
|
|
12
14
|
base: string;
|
|
13
15
|
name: string[];
|
|
14
16
|
constructor(client: HTTPClient);
|
|
15
|
-
get proxy():
|
|
17
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
16
18
|
/**
|
|
17
19
|
* 获取最新一条
|
|
18
20
|
*/
|
|
19
|
-
getLatestOne(): import("../interfaces/request").RequestProxyResult<RecentlyModel, {
|
|
21
|
+
getLatestOne(): import("../interfaces/request").RequestProxyResult<RecentlyModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
20
22
|
[key: string]: any;
|
|
21
23
|
data: RecentlyModel;
|
|
24
|
+
} : ResponseWrapper extends {
|
|
25
|
+
data: RecentlyModel;
|
|
26
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
27
|
+
data: RecentlyModel;
|
|
22
28
|
}>;
|
|
23
29
|
getAll(): import("../interfaces/request").RequestProxyResult<{
|
|
24
30
|
data: RecentlyModel[];
|
|
25
|
-
}, {
|
|
31
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
26
32
|
[key: string]: any;
|
|
27
33
|
data: {
|
|
28
34
|
data: RecentlyModel[];
|
|
29
35
|
};
|
|
36
|
+
} : ResponseWrapper extends {
|
|
37
|
+
data: {
|
|
38
|
+
data: RecentlyModel[];
|
|
39
|
+
};
|
|
40
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
41
|
+
data: {
|
|
42
|
+
data: RecentlyModel[];
|
|
43
|
+
};
|
|
30
44
|
}>;
|
|
31
45
|
getList(before?: string | undefined, after?: string | undefined, size?: number | number): import("../interfaces/request").RequestProxyResult<{
|
|
32
46
|
data: RecentlyModel[];
|
|
33
|
-
}, {
|
|
47
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
34
48
|
[key: string]: any;
|
|
35
49
|
data: {
|
|
36
50
|
data: RecentlyModel[];
|
|
37
51
|
};
|
|
52
|
+
} : ResponseWrapper extends {
|
|
53
|
+
data: {
|
|
54
|
+
data: RecentlyModel[];
|
|
55
|
+
};
|
|
56
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
57
|
+
data: {
|
|
58
|
+
data: RecentlyModel[];
|
|
59
|
+
};
|
|
38
60
|
}>;
|
|
39
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recently.js","sourceRoot":"","sources":["../../controllers/recently.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"recently.js","sourceRoot":"","sources":["../../controllers/recently.ts"],"names":[],"mappings":";;;AAIA,iDAA4C;AAa5C,MAAa,kBAAkB;IAI7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH/C,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;QAG9B,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IACD;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAiB,CAAA;IAC/C,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAA6B,CAAA;IACxD,CAAC;IAED,OAAO,CACL,MAA2B,EAC3B,KAA0B,EAC1B,IAAsB;QAEtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B;YAC/C,MAAM,EAAE;gBACN,MAAM;gBACN,KAAK;gBACL,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAnCD,gDAmCC"}
|
package/lib/controllers/say.d.ts
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { IController } from '../interfaces/controller';
|
|
3
|
+
import { IRequestHandler } from '../interfaces/request';
|
|
2
4
|
import { SayModel } from '../models/say';
|
|
3
5
|
import { HTTPClient } from '../core';
|
|
4
6
|
import { BaseCrudController } from './base';
|
|
5
7
|
declare module '../core/client' {
|
|
6
|
-
interface HTTPClient {
|
|
7
|
-
say: SayController
|
|
8
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
9
|
+
say: SayController<ResponseWrapper>;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
|
-
export declare class SayController extends BaseCrudController<SayModel> implements IController {
|
|
12
|
+
export declare class SayController<ResponseWrapper> extends BaseCrudController<SayModel, ResponseWrapper> implements IController {
|
|
11
13
|
protected client: HTTPClient;
|
|
12
14
|
base: string;
|
|
13
15
|
name: string;
|
|
14
16
|
constructor(client: HTTPClient);
|
|
15
|
-
get proxy():
|
|
17
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
16
18
|
/**
|
|
17
19
|
* 获取随机一条
|
|
18
20
|
*/
|
|
19
21
|
getRandom(): import("../interfaces/request").RequestProxyResult<{
|
|
20
22
|
data: SayModel | null;
|
|
21
|
-
}, {
|
|
23
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
22
24
|
[key: string]: any;
|
|
23
25
|
data: {
|
|
24
26
|
data: SayModel | null;
|
|
25
27
|
};
|
|
28
|
+
} : ResponseWrapper extends {
|
|
29
|
+
data: {
|
|
30
|
+
data: SayModel | null;
|
|
31
|
+
};
|
|
32
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
33
|
+
data: {
|
|
34
|
+
data: SayModel | null;
|
|
35
|
+
};
|
|
26
36
|
}>;
|
|
27
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"say.js","sourceRoot":"","sources":["../../controllers/say.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"say.js","sourceRoot":"","sources":["../../controllers/say.ts"],"names":[],"mappings":";;;AAIA,iDAA4C;AAE5C,iCAA2C;AAW3C,MAAa,aACX,SAAQ,yBAA6C;IAMrD,YAAsB,MAAkB;QACtC,KAAK,CAAC,MAAM,CAAC,CAAA;QADO,WAAM,GAAN,MAAM,CAAY;QAHxC,SAAI,GAAG,MAAM,CAAA;QACb,SAAI,GAAG,KAAK,CAAA;QAIV,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAA6B,CAAA;IAC3D,CAAC;CACF;AAtBD,sCAsBC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { IController } from '../interfaces/controller';
|
|
2
3
|
import { IRequestHandler, RequestProxyResult } from '../interfaces/request';
|
|
3
4
|
import { PaginateResult } from '../models/base';
|
|
@@ -6,8 +7,8 @@ import { PostModel } from '../models/post';
|
|
|
6
7
|
import { PageModel } from '..';
|
|
7
8
|
import { HTTPClient } from '../core';
|
|
8
9
|
declare module '../core/client' {
|
|
9
|
-
interface HTTPClient {
|
|
10
|
-
search: SearchController
|
|
10
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
11
|
+
search: SearchController<ResponseWrapper>;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
export declare type SearchType = 'post' | 'note';
|
|
@@ -16,14 +17,14 @@ export declare type SearchOption = {
|
|
|
16
17
|
order?: number;
|
|
17
18
|
rawAlgolia?: boolean;
|
|
18
19
|
};
|
|
19
|
-
export declare class SearchController implements IController {
|
|
20
|
+
export declare class SearchController<ResponseWrapper> implements IController {
|
|
20
21
|
private readonly client;
|
|
21
22
|
base: string;
|
|
22
23
|
name: string;
|
|
23
24
|
constructor(client: HTTPClient);
|
|
24
|
-
get proxy(): IRequestHandler
|
|
25
|
-
search(type: 'note', keyword: string, options?: Omit<SearchOption, 'rawAlgolia'>): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'
|
|
26
|
-
search(type: 'post', keyword: string, options?: Omit<SearchOption, 'rawAlgolia'>): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'
|
|
25
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
26
|
+
search(type: 'note', keyword: string, options?: Omit<SearchOption, 'rawAlgolia'>): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'>>, ResponseWrapper>>;
|
|
27
|
+
search(type: 'post', keyword: string, options?: Omit<SearchOption, 'rawAlgolia'>): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'>>, ResponseWrapper>>;
|
|
27
28
|
/**
|
|
28
29
|
* 从 algolya 搜索
|
|
29
30
|
* https://www.algolia.com/doc/api-reference/api-methods/search/
|
|
@@ -42,7 +43,7 @@ export declare class SearchController implements IController {
|
|
|
42
43
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
43
44
|
*/
|
|
44
45
|
raw?: any;
|
|
45
|
-
}, {
|
|
46
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
46
47
|
[key: string]: any;
|
|
47
48
|
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
48
49
|
type: 'post';
|
|
@@ -56,7 +57,33 @@ export declare class SearchController implements IController {
|
|
|
56
57
|
*/
|
|
57
58
|
raw?: any;
|
|
58
59
|
};
|
|
59
|
-
}
|
|
60
|
+
} : ResponseWrapper extends {
|
|
61
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
62
|
+
type: 'post';
|
|
63
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
64
|
+
type: 'note';
|
|
65
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
66
|
+
type: 'page';
|
|
67
|
+
})> & {
|
|
68
|
+
/**
|
|
69
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
70
|
+
*/
|
|
71
|
+
raw?: any;
|
|
72
|
+
};
|
|
73
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
74
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
75
|
+
type: 'post';
|
|
76
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
77
|
+
type: 'note';
|
|
78
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
79
|
+
type: 'page';
|
|
80
|
+
})> & {
|
|
81
|
+
/**
|
|
82
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
83
|
+
*/
|
|
84
|
+
raw?: any;
|
|
85
|
+
};
|
|
86
|
+
}>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
60
87
|
[key: string]: any;
|
|
61
88
|
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
62
89
|
type: 'post';
|
|
@@ -69,7 +96,60 @@ export declare class SearchController implements IController {
|
|
|
69
96
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
70
97
|
*/
|
|
71
98
|
raw?: any;
|
|
72
|
-
}, {
|
|
99
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
102
|
+
type: 'post';
|
|
103
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
104
|
+
type: 'note';
|
|
105
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
106
|
+
type: 'page';
|
|
107
|
+
})> & {
|
|
108
|
+
/**
|
|
109
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
110
|
+
*/
|
|
111
|
+
raw?: any;
|
|
112
|
+
};
|
|
113
|
+
} : ResponseWrapper extends {
|
|
114
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
115
|
+
type: 'post';
|
|
116
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
117
|
+
type: 'note';
|
|
118
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
119
|
+
type: 'page';
|
|
120
|
+
})> & {
|
|
121
|
+
/**
|
|
122
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
123
|
+
*/
|
|
124
|
+
raw?: any;
|
|
125
|
+
};
|
|
126
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
127
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
128
|
+
type: 'post';
|
|
129
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
130
|
+
type: 'note';
|
|
131
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
132
|
+
type: 'page';
|
|
133
|
+
})> & {
|
|
134
|
+
/**
|
|
135
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
136
|
+
*/
|
|
137
|
+
raw?: any;
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
140
|
+
} : ResponseWrapper extends {
|
|
141
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
142
|
+
type: 'post';
|
|
143
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
144
|
+
type: 'note';
|
|
145
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
146
|
+
type: 'page';
|
|
147
|
+
})> & {
|
|
148
|
+
/**
|
|
149
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
150
|
+
*/
|
|
151
|
+
raw?: any;
|
|
152
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
73
153
|
[key: string]: any;
|
|
74
154
|
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
75
155
|
type: 'post';
|
|
@@ -83,6 +163,85 @@ export declare class SearchController implements IController {
|
|
|
83
163
|
*/
|
|
84
164
|
raw?: any;
|
|
85
165
|
};
|
|
166
|
+
} : ResponseWrapper extends {
|
|
167
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
168
|
+
type: 'post';
|
|
169
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
170
|
+
type: 'note';
|
|
171
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
172
|
+
type: 'page';
|
|
173
|
+
})> & {
|
|
174
|
+
/**
|
|
175
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
176
|
+
*/
|
|
177
|
+
raw?: any;
|
|
178
|
+
};
|
|
179
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
180
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
181
|
+
type: 'post';
|
|
182
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
183
|
+
type: 'note';
|
|
184
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
185
|
+
type: 'page';
|
|
186
|
+
})> & {
|
|
187
|
+
/**
|
|
188
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
189
|
+
*/
|
|
190
|
+
raw?: any;
|
|
191
|
+
};
|
|
192
|
+
}>;
|
|
193
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
194
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
195
|
+
type: 'post';
|
|
196
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
197
|
+
type: 'note';
|
|
198
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
199
|
+
type: 'page';
|
|
200
|
+
})> & {
|
|
201
|
+
/**
|
|
202
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
203
|
+
*/
|
|
204
|
+
raw?: any;
|
|
205
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
208
|
+
type: 'post';
|
|
209
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
210
|
+
type: 'note';
|
|
211
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
212
|
+
type: 'page';
|
|
213
|
+
})> & {
|
|
214
|
+
/**
|
|
215
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
216
|
+
*/
|
|
217
|
+
raw?: any;
|
|
218
|
+
};
|
|
219
|
+
} : ResponseWrapper extends {
|
|
220
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
221
|
+
type: 'post';
|
|
222
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
223
|
+
type: 'note';
|
|
224
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
225
|
+
type: 'page';
|
|
226
|
+
})> & {
|
|
227
|
+
/**
|
|
228
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
229
|
+
*/
|
|
230
|
+
raw?: any;
|
|
231
|
+
};
|
|
232
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
233
|
+
data: PaginateResult<(Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category"> & {
|
|
234
|
+
type: 'post';
|
|
235
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
236
|
+
type: 'note';
|
|
237
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
238
|
+
type: 'page';
|
|
239
|
+
})> & {
|
|
240
|
+
/**
|
|
241
|
+
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
242
|
+
*/
|
|
243
|
+
raw?: any;
|
|
244
|
+
};
|
|
86
245
|
}>;
|
|
87
246
|
}>;
|
|
88
247
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../controllers/search.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../controllers/search.ts"],"names":[],"mappings":";;;AAMA,iDAA4C;AAoB5C,MAAa,gBAAgB;IAI3B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH/C,SAAI,GAAG,QAAQ,CAAA;QACf,SAAI,GAAG,QAAQ,CAAA;QAGb,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IA6BD,MAAM,CACJ,IAAgB,EAChB,OAAe,EACf,UAA4C,EAAE;QAE9C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;YAC1B,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE;SAChC,CAAC,CAAA;IACJ,CAAC;IACD;;;;;;OAMG;IACH,eAAe,CAAC,OAAe,EAAE,OAAsB;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAuB9B,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,CAAA;IACxC,CAAC;CACF;AAjFD,4CAiFC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
2
|
+
import { IController } from '../interfaces/controller';
|
|
3
|
+
import { IRequestHandler } from '../interfaces/request';
|
|
4
|
+
import { HTTPClient } from '../core';
|
|
5
|
+
declare module '../core/client' {
|
|
6
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
7
|
+
serverless: ServerlessController<ResponseWrapper>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ServerlessController<ResponseWrapper> implements IController {
|
|
11
|
+
protected client: HTTPClient;
|
|
12
|
+
base: string;
|
|
13
|
+
name: string;
|
|
14
|
+
constructor(client: HTTPClient);
|
|
15
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
16
|
+
getByReferenceAndName<T = unknown>(reference: string, name: string): import("../interfaces/request").RequestProxyResult<T, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
data: T;
|
|
19
|
+
} : ResponseWrapper extends {
|
|
20
|
+
data: T;
|
|
21
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
22
|
+
data: T;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerlessController = void 0;
|
|
4
|
+
const auto_bind_1 = require("../utils/auto-bind");
|
|
5
|
+
class ServerlessController {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
this.base = 'serverless';
|
|
9
|
+
this.name = 'serverless';
|
|
10
|
+
(0, auto_bind_1.autoBind)(this);
|
|
11
|
+
}
|
|
12
|
+
get proxy() {
|
|
13
|
+
return this.client.proxy(this.base);
|
|
14
|
+
}
|
|
15
|
+
getByReferenceAndName(reference, name) {
|
|
16
|
+
return this.proxy(reference)(name).get();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ServerlessController = ServerlessController;
|
|
20
|
+
//# sourceMappingURL=severless.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"severless.js","sourceRoot":"","sources":["../../controllers/severless.ts"],"names":[],"mappings":";;;AAGA,iDAA4C;AAY5C,MAAa,oBAAoB;IAI/B,YAAsB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAHxC,SAAI,GAAG,YAAY,CAAA;QACnB,SAAI,GAAG,YAAY,CAAA;QAGjB,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,qBAAqB,CAAc,SAAiB,EAAE,IAAY;QAChE,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAK,CAAA;IAC7C,CAAC;CACF;AAfD,oDAeC"}
|
|
@@ -1,23 +1,33 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { IController } from '../interfaces/controller';
|
|
3
|
+
import { IRequestHandler } from '../interfaces/request';
|
|
2
4
|
import { SnippetModel } from '../models/snippet';
|
|
3
5
|
import { HTTPClient } from '../core';
|
|
4
6
|
declare module '../core/client' {
|
|
5
|
-
interface HTTPClient {
|
|
6
|
-
snippet: SnippetController
|
|
7
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
8
|
+
snippet: SnippetController<ResponseWrapper>;
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
|
-
export declare class SnippetController implements IController {
|
|
11
|
+
export declare class SnippetController<ResponseWrapper> implements IController {
|
|
10
12
|
protected client: HTTPClient;
|
|
11
13
|
base: string;
|
|
12
14
|
name: string;
|
|
13
15
|
constructor(client: HTTPClient);
|
|
14
|
-
get proxy():
|
|
15
|
-
getById
|
|
16
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
17
|
+
getById(id: string): import("../interfaces/request").RequestProxyResult<Omit<SnippetModel<unknown>, "data">, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
16
18
|
[key: string]: any;
|
|
17
|
-
data: SnippetModel<
|
|
19
|
+
data: Omit<SnippetModel<unknown>, "data">;
|
|
20
|
+
} : ResponseWrapper extends {
|
|
21
|
+
data: Omit<SnippetModel<unknown>, "data">;
|
|
22
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
23
|
+
data: Omit<SnippetModel<unknown>, "data">;
|
|
18
24
|
}>;
|
|
19
|
-
getByReferenceAndName<T = unknown>(reference: string, name: string): import("../interfaces/request").RequestProxyResult<T, {
|
|
25
|
+
getByReferenceAndName<T = unknown>(reference: string, name: string): import("../interfaces/request").RequestProxyResult<T, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
20
26
|
[key: string]: any;
|
|
21
27
|
data: T;
|
|
28
|
+
} : ResponseWrapper extends {
|
|
29
|
+
data: T;
|
|
30
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
31
|
+
data: T;
|
|
22
32
|
}>;
|
|
23
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../controllers/snippet.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../controllers/snippet.ts"],"names":[],"mappings":";;;AAIA,iDAA4C;AAY5C,MAAa,iBAAiB;IAI5B,YAAsB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAHxC,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,SAAS,CAAA;QAGd,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;IAChB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,EAA8B,CAAA;IACzD,CAAC;IAED,qBAAqB,CAAc,SAAiB,EAAE,IAAY;QAChE,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAK,CAAA;IAC7C,CAAC;CACF;AAnBD,8CAmBC"}
|
|
@@ -1,34 +1,54 @@
|
|
|
1
|
+
import { IRequestAdapter } from '../interfaces/adapter';
|
|
1
2
|
import { IController } from '../interfaces/controller';
|
|
3
|
+
import { IRequestHandler } from '../interfaces/request';
|
|
2
4
|
import { TLogin, UserModel } from '../models/user';
|
|
3
5
|
import { HTTPClient } from '../core';
|
|
4
6
|
declare module '../core/client' {
|
|
5
|
-
interface HTTPClient {
|
|
6
|
-
user: UserController
|
|
7
|
-
master: UserController
|
|
7
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
8
|
+
user: UserController<ResponseWrapper>;
|
|
9
|
+
master: UserController<ResponseWrapper>;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
|
-
export declare class UserController implements IController {
|
|
12
|
+
export declare class UserController<ResponseWrapper> implements IController {
|
|
11
13
|
private readonly client;
|
|
12
14
|
constructor(client: HTTPClient);
|
|
13
15
|
base: string;
|
|
14
16
|
name: string[];
|
|
15
|
-
get proxy():
|
|
16
|
-
getMasterInfo(): import("../interfaces/request").RequestProxyResult<UserModel, {
|
|
17
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
18
|
+
getMasterInfo(): import("../interfaces/request").RequestProxyResult<UserModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
17
19
|
[key: string]: any;
|
|
18
20
|
data: UserModel;
|
|
21
|
+
} : ResponseWrapper extends {
|
|
22
|
+
data: UserModel;
|
|
23
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
24
|
+
data: UserModel;
|
|
19
25
|
}>;
|
|
20
|
-
login(username: string, password: string): import("../interfaces/request").RequestProxyResult<TLogin, {
|
|
26
|
+
login(username: string, password: string): import("../interfaces/request").RequestProxyResult<TLogin, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
21
27
|
[key: string]: any;
|
|
22
28
|
data: TLogin;
|
|
29
|
+
} : ResponseWrapper extends {
|
|
30
|
+
data: TLogin;
|
|
31
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
32
|
+
data: TLogin;
|
|
23
33
|
}>;
|
|
24
34
|
checkTokenValid(token: string): import("../interfaces/request").RequestProxyResult<{
|
|
25
35
|
ok: number;
|
|
26
36
|
isGuest: boolean;
|
|
27
|
-
}, {
|
|
37
|
+
}, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
28
38
|
[key: string]: any;
|
|
29
39
|
data: {
|
|
30
40
|
ok: number;
|
|
31
41
|
isGuest: boolean;
|
|
32
42
|
};
|
|
43
|
+
} : ResponseWrapper extends {
|
|
44
|
+
data: {
|
|
45
|
+
ok: number;
|
|
46
|
+
isGuest: boolean;
|
|
47
|
+
};
|
|
48
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
49
|
+
data: {
|
|
50
|
+
ok: number;
|
|
51
|
+
isGuest: boolean;
|
|
52
|
+
};
|
|
33
53
|
}>;
|
|
34
54
|
}
|