@mx-space/api-client 0.3.1 → 0.3.5
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/build/index.cjs.js +60 -21
- 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.d.ts +245 -149
- package/build/index.esm.js +46 -18
- 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 +60 -21
- 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/esm/core/client.d.ts +5 -7
- package/esm/core/client.js +7 -2
- package/esm/core/client.js.map +1 -1
- package/esm/core/controllers/aggregate.d.ts +5 -7
- package/esm/core/controllers/aggregate.js.map +1 -1
- package/esm/core/controllers/base.d.ts +5 -7
- package/esm/core/controllers/base.js.map +1 -1
- package/esm/core/controllers/category.d.ts +6 -16
- package/esm/core/controllers/category.js +2 -2
- package/esm/core/controllers/category.js.map +1 -1
- package/esm/core/controllers/comment.d.ts +6 -8
- package/esm/core/controllers/comment.js.map +1 -1
- package/esm/core/controllers/note.d.ts +15 -10
- package/esm/core/controllers/note.js +10 -2
- package/esm/core/controllers/note.js.map +1 -1
- package/esm/core/controllers/page.d.ts +11 -4
- package/esm/core/controllers/page.js +9 -2
- package/esm/core/controllers/page.js.map +1 -1
- package/esm/core/controllers/post.d.ts +8 -1
- package/esm/core/controllers/post.js +10 -2
- package/esm/core/controllers/post.js.map +1 -1
- package/esm/core/controllers/recently.d.ts +5 -4
- package/esm/core/controllers/recently.js.map +1 -1
- package/esm/core/controllers/say.d.ts +3 -2
- package/esm/core/controllers/say.js.map +1 -1
- package/esm/core/controllers/search.d.ts +6 -6
- package/esm/core/controllers/snippet.d.ts +4 -3
- package/esm/core/controllers/snippet.js.map +1 -1
- package/esm/core/controllers/user.d.ts +5 -4
- package/esm/core/controllers/user.js.map +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/interfaces/client.d.ts +5 -0
- package/esm/interfaces/client.js +2 -0
- package/esm/interfaces/client.js.map +1 -0
- package/esm/models/aggregate.d.ts +2 -1
- package/esm/models/aggregate.js.map +1 -1
- package/esm/models/post.d.ts +1 -9
- package/lib/core/client.d.ts +5 -7
- package/lib/core/client.js +7 -2
- package/lib/core/client.js.map +1 -1
- package/lib/core/controllers/aggregate.d.ts +5 -7
- package/lib/core/controllers/aggregate.js.map +1 -1
- package/lib/core/controllers/base.d.ts +5 -7
- package/lib/core/controllers/base.js.map +1 -1
- package/lib/core/controllers/category.d.ts +6 -16
- package/lib/core/controllers/category.js +3 -3
- package/lib/core/controllers/category.js.map +1 -1
- package/lib/core/controllers/comment.d.ts +6 -8
- package/lib/core/controllers/comment.js.map +1 -1
- package/lib/core/controllers/note.d.ts +15 -10
- package/lib/core/controllers/note.js +10 -2
- package/lib/core/controllers/note.js.map +1 -1
- package/lib/core/controllers/page.d.ts +11 -4
- package/lib/core/controllers/page.js +9 -2
- package/lib/core/controllers/page.js.map +1 -1
- package/lib/core/controllers/post.d.ts +8 -1
- package/lib/core/controllers/post.js +10 -2
- package/lib/core/controllers/post.js.map +1 -1
- package/lib/core/controllers/recently.d.ts +5 -4
- package/lib/core/controllers/recently.js.map +1 -1
- package/lib/core/controllers/say.d.ts +3 -2
- package/lib/core/controllers/say.js.map +1 -1
- package/lib/core/controllers/search.d.ts +6 -6
- package/lib/core/controllers/snippet.d.ts +4 -3
- package/lib/core/controllers/snippet.js.map +1 -1
- package/lib/core/controllers/user.d.ts +5 -4
- package/lib/core/controllers/user.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +14 -5
- package/lib/index.js.map +1 -1
- package/lib/interfaces/client.d.ts +5 -0
- package/lib/interfaces/client.js +3 -0
- package/lib/interfaces/client.js.map +1 -0
- package/lib/models/aggregate.d.ts +2 -1
- package/lib/models/aggregate.js.map +1 -1
- package/lib/models/post.d.ts +1 -9
- package/package.json +8 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
2
|
import { SortOrder } from "../../interfaces/options";
|
|
3
|
+
import { RequestProxyResult } from "../../interfaces/request";
|
|
3
4
|
import { AggregateRoot, AggregateStat, AggregateTop, TimelineData, TimelineType } from "../../models/aggregate";
|
|
4
5
|
import { HTTPClient } from '..';
|
|
5
6
|
export declare class AggregateController implements IController {
|
|
@@ -11,14 +12,11 @@ export declare class AggregateController implements IController {
|
|
|
11
12
|
/**
|
|
12
13
|
* 获取聚合数据
|
|
13
14
|
*/
|
|
14
|
-
getAggregateData():
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
data: AggregateRoot;
|
|
17
|
-
}>;
|
|
15
|
+
getAggregateData(): RequestProxyResult<AggregateRoot>;
|
|
18
16
|
/**
|
|
19
17
|
* 获取最新发布的内容
|
|
20
18
|
*/
|
|
21
|
-
getTop(size?: number):
|
|
19
|
+
getTop(size?: number): RequestProxyResult<AggregateTop, {
|
|
22
20
|
[key: string]: any;
|
|
23
21
|
data: AggregateTop;
|
|
24
22
|
}>;
|
|
@@ -26,7 +24,7 @@ export declare class AggregateController implements IController {
|
|
|
26
24
|
sort?: SortOrder;
|
|
27
25
|
type?: TimelineType;
|
|
28
26
|
year?: number;
|
|
29
|
-
}):
|
|
27
|
+
}): RequestProxyResult<{
|
|
30
28
|
data: TimelineData;
|
|
31
29
|
}, {
|
|
32
30
|
[key: string]: any;
|
|
@@ -37,7 +35,7 @@ export declare class AggregateController implements IController {
|
|
|
37
35
|
/**
|
|
38
36
|
* 获取聚合数据统计
|
|
39
37
|
*/
|
|
40
|
-
getStat():
|
|
38
|
+
getStat(): RequestProxyResult<AggregateStat, {
|
|
41
39
|
[key: string]: any;
|
|
42
40
|
data: AggregateStat;
|
|
43
41
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../src/core/controllers/aggregate.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../src/core/controllers/aggregate.ts"],"names":[],"mappings":";;;AAUA,uCAA2C;AAG3C,MAAa,mBAAmB;IAG9B,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAFtC,SAAI,GAAG,WAAW,CAAA;QAClB,SAAI,GAAG,WAAW,CAAA;IACuB,CAAC;IAC1C,IAAY,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAiB,CAAA;IACxC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,GAAG,CAAC;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAe,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,WAAW,CAAC,OAIX;QACC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAyB;YACrD,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,IAAI,IAAA,yBAAiB,EAAC,IAAI,CAAC;gBACrC,IAAI;gBACJ,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;IACD;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAiB,CAAA;IAC7C,CAAC;CACF;AA1CD,kDA0CC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
1
2
|
import { PaginateResult } from "../../models/base";
|
|
2
3
|
import { HTTPClient } from '..';
|
|
3
4
|
export declare abstract class BaseCrudController<T> {
|
|
4
5
|
protected client: HTTPClient;
|
|
5
6
|
base: string;
|
|
6
7
|
constructor(client: HTTPClient);
|
|
7
|
-
protected get proxy():
|
|
8
|
-
getById(id: string):
|
|
9
|
-
|
|
10
|
-
data: T;
|
|
11
|
-
}>;
|
|
12
|
-
getAll(): import("../../interfaces/request").RequestProxyResult<{
|
|
8
|
+
protected get proxy(): IRequestHandler;
|
|
9
|
+
getById(id: string): RequestProxyResult<T>;
|
|
10
|
+
getAll(): RequestProxyResult<{
|
|
13
11
|
data: T[];
|
|
14
12
|
}, {
|
|
15
13
|
[key: string]: any;
|
|
@@ -22,7 +20,7 @@ export declare abstract class BaseCrudController<T> {
|
|
|
22
20
|
* @param page
|
|
23
21
|
* @param perPage
|
|
24
22
|
*/
|
|
25
|
-
getAllPaginated(page?: number, perPage?: number):
|
|
23
|
+
getAllPaginated(page?: number, perPage?: number): RequestProxyResult<PaginateResult<T>, {
|
|
26
24
|
[key: string]: any;
|
|
27
25
|
data: PaginateResult<T>;
|
|
28
26
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/core/controllers/base.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/core/controllers/base.ts"],"names":[],"mappings":";;;AAIA,MAAsB,kBAAkB;IAEtC,YAAsB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAC5C,IAAc,KAAK;QACjB,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,EAAK,CAAA;IAChC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAiB,CAAA;IAC5C,CAAC;IACD;;;;OAIG;IACH,eAAe,CAAC,IAAa,EAAE,OAAgB;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAoB;YACvC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE;SAChC,CAAC,CAAA;IACJ,CAAC;CACF;AAxBD,gDAwBC"}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
-
import { ResponseProxyExtraRaw } from "../../interfaces/request";
|
|
3
|
-
import { CategoryWithChildrenModel, TagModel } from
|
|
4
|
-
import {
|
|
5
|
-
import { HTTPClient } from '
|
|
2
|
+
import { RequestProxyResult, ResponseProxyExtraRaw } from "../../interfaces/request";
|
|
3
|
+
import { CategoryModel, CategoryWithChildrenModel, TagModel } from '../../models/category';
|
|
4
|
+
import { PostModel } from '../../models/post';
|
|
5
|
+
import { HTTPClient } from '../client';
|
|
6
6
|
export declare class CategoryController implements IController {
|
|
7
7
|
private client;
|
|
8
8
|
name: string;
|
|
9
9
|
base: string;
|
|
10
10
|
constructor(client: HTTPClient);
|
|
11
11
|
private get proxy();
|
|
12
|
-
getAllCategories():
|
|
12
|
+
getAllCategories(): RequestProxyResult<{
|
|
13
13
|
data: CategoryModel[];
|
|
14
|
-
}, {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
data: {
|
|
17
|
-
data: CategoryModel[];
|
|
18
|
-
};
|
|
19
14
|
}>;
|
|
20
|
-
getAllTags():
|
|
15
|
+
getAllTags(): RequestProxyResult<{
|
|
21
16
|
data: TagModel[];
|
|
22
|
-
}, {
|
|
23
|
-
[key: string]: any;
|
|
24
|
-
data: {
|
|
25
|
-
data: TagModel[];
|
|
26
|
-
};
|
|
27
17
|
}>;
|
|
28
18
|
getCategoryDetail(id: string): Promise<ResponseProxyExtraRaw<CategoryWithChildrenModel>>;
|
|
29
19
|
getCategoryDetail(ids: string[]): Promise<ResponseProxyExtraRaw<Map<string, CategoryWithChildrenModel>>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CategoryController = void 0;
|
|
4
|
-
const category_1 = require("../../models/category");
|
|
5
4
|
const utils_1 = require("../../utils");
|
|
6
|
-
const
|
|
5
|
+
const category_1 = require("../../models/category");
|
|
6
|
+
const error_1 = require("../error");
|
|
7
7
|
class CategoryController {
|
|
8
8
|
constructor(client) {
|
|
9
9
|
this.client = client;
|
|
@@ -46,7 +46,7 @@ class CategoryController {
|
|
|
46
46
|
});
|
|
47
47
|
const entries = data === null || data === void 0 ? void 0 : data.entries;
|
|
48
48
|
if (!entries) {
|
|
49
|
-
throw new
|
|
49
|
+
throw new error_1.RequestError('data structure error', 500, data.$request.path, data);
|
|
50
50
|
}
|
|
51
51
|
const map = new Map(Object.entries(entries).map(([id, value]) => [id.toLowerCase(), value]));
|
|
52
52
|
(0, utils_1.attachRawFromOneToAnthor)(data, map);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/core/controllers/category.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/core/controllers/category.ts"],"names":[],"mappings":";;;AAEA,uCAAmE;AACnE,oDAM8B;AAG9B,oCAAuC;AAEvC,MAAa,kBAAkB;IAG7B,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAFtC,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,YAAY,CAAA;IACsB,CAAC;IAE1C,IAAY,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;YACpB,MAAM,EAAE;gBACN,IAAI,EAAE,uBAAY,CAAC,QAAQ;aAC5B;SACF,CAAC,CAAA;IACJ,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAuB;YAC1C,MAAM,EAAE;gBACN,IAAI,EAAE,uBAAY,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,EAAE,GAAG;iBACT;aACF,CAAC,CAAA;YACF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;YAC7C,IAAA,gCAAwB,EAAC,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,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAA;YAC7B,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,oBAAY,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,IAAA,gCAAwB,EAAC,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,IAAA,uBAAe,EAAC,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;AAnFD,gDAmFC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
2
|
import { PaginationParams } from "../../interfaces/params";
|
|
3
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
3
4
|
import { PaginateResult } from "../../models/base";
|
|
4
5
|
import { CommentModel } from "../../models/comment";
|
|
5
6
|
import { HTTPClient } from '..';
|
|
@@ -9,33 +10,30 @@ export declare class CommentController implements IController {
|
|
|
9
10
|
base: string;
|
|
10
11
|
name: string;
|
|
11
12
|
constructor(client: HTTPClient);
|
|
12
|
-
get proxy():
|
|
13
|
+
get proxy(): IRequestHandler;
|
|
13
14
|
/**
|
|
14
15
|
* 根据 comment id 获取评论, 包括子评论
|
|
15
16
|
*/
|
|
16
|
-
getById(id: string):
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
data: CommentModel;
|
|
19
|
-
}>;
|
|
17
|
+
getById(id: string): RequestProxyResult<CommentModel>;
|
|
20
18
|
/**
|
|
21
19
|
* 获取文章的评论列表
|
|
22
20
|
* @param refId 文章 Id
|
|
23
21
|
*/
|
|
24
|
-
getByRefId(refId: string, pagination?: PaginationParams):
|
|
22
|
+
getByRefId(refId: string, pagination?: PaginationParams): RequestProxyResult<PaginateResult<CommentModel>, {
|
|
25
23
|
[key: string]: any;
|
|
26
24
|
data: PaginateResult<CommentModel>;
|
|
27
25
|
}>;
|
|
28
26
|
/**
|
|
29
27
|
* 评论
|
|
30
28
|
*/
|
|
31
|
-
comment(refId: string, data: CommentDto):
|
|
29
|
+
comment(refId: string, data: CommentDto): RequestProxyResult<CommentModel, {
|
|
32
30
|
[key: string]: any;
|
|
33
31
|
data: CommentModel;
|
|
34
32
|
}>;
|
|
35
33
|
/**
|
|
36
34
|
* 回复评论
|
|
37
35
|
*/
|
|
38
|
-
reply(commentId: string, data: CommentDto):
|
|
36
|
+
reply(commentId: string, data: CommentDto): RequestProxyResult<CommentModel, {
|
|
39
37
|
[key: string]: any;
|
|
40
38
|
data: CommentModel;
|
|
41
39
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/core/controllers/comment.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/core/controllers/comment.ts"],"names":[],"mappings":";;;AAQA,MAAa,iBAAiB;IAI5B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH/C,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,SAAS,CAAA;IAEkC,CAAC;IAEnD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,EAAgB,CAAA;IAC3C,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,KAAa,EAAE,aAA+B,EAAE;QACzD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,UAAU,CAAA;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAA+B;YAC7D,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE;SAC9C,CAAC,CAAA;IACJ,CAAC;IACD;;OAEG;IACH,OAAO,CAAC,KAAa,EAAE,IAAgB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAe;YAC1C,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAiB,EAAE,IAAgB;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAe;YACpD,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;CACF;AA5CD,8CA4CC"}
|
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
2
3
|
import { PaginateResult } from "../../models/base";
|
|
3
4
|
import { NoteModel, NoteWrappedPayload } from "../../models/note";
|
|
4
|
-
import {
|
|
5
|
+
import { SelectFields } from "../../types/helper";
|
|
6
|
+
import { HTTPClient } from '../client';
|
|
7
|
+
export declare type NoteListOptions = {
|
|
8
|
+
select?: SelectFields<keyof NoteModel>;
|
|
9
|
+
year?: number;
|
|
10
|
+
sortBy?: 'weather' | 'mood' | 'title' | 'created' | 'modified';
|
|
11
|
+
sortOrder?: 1 | -1;
|
|
12
|
+
};
|
|
5
13
|
export declare class NoteController implements IController {
|
|
6
14
|
private client;
|
|
7
15
|
base: string;
|
|
8
16
|
name: string;
|
|
9
17
|
constructor(client: HTTPClient);
|
|
10
|
-
get proxy():
|
|
18
|
+
get proxy(): IRequestHandler;
|
|
11
19
|
/**
|
|
12
20
|
* 最新日记
|
|
13
21
|
*/
|
|
14
|
-
getLatest():
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
data: NoteWrappedPayload;
|
|
17
|
-
}>;
|
|
22
|
+
getLatest(): RequestProxyResult<NoteWrappedPayload>;
|
|
18
23
|
/**
|
|
19
24
|
* 获取一篇日记
|
|
20
25
|
* @param id id | nid
|
|
21
26
|
* @param password 访问密码
|
|
22
27
|
*/
|
|
23
|
-
getNoteById(id: string | number, password?: string):
|
|
28
|
+
getNoteById(id: string | number, password?: string): RequestProxyResult<NoteWrappedPayload, {
|
|
24
29
|
[key: string]: any;
|
|
25
30
|
data: NoteWrappedPayload;
|
|
26
31
|
}>;
|
|
27
32
|
/**
|
|
28
33
|
* 日记列表分页
|
|
29
34
|
*/
|
|
30
|
-
getList(page?: number, perPage?: number):
|
|
35
|
+
getList(page?: number, perPage?: number, options?: NoteListOptions): RequestProxyResult<PaginateResult<NoteModel>, {
|
|
31
36
|
[key: string]: any;
|
|
32
37
|
data: PaginateResult<NoteModel>;
|
|
33
38
|
}>;
|
|
34
39
|
/**
|
|
35
40
|
* 获取当前日记的上下各 n / 2 篇日记
|
|
36
41
|
*/
|
|
37
|
-
getMiddleList(id: string, size?: number):
|
|
42
|
+
getMiddleList(id: string, size?: number): RequestProxyResult<{
|
|
38
43
|
data: Pick<NoteModel, 'id' | 'title' | 'nid' | 'created'>[];
|
|
39
44
|
size: number;
|
|
40
45
|
}, {
|
|
@@ -47,7 +52,7 @@ export declare class NoteController implements IController {
|
|
|
47
52
|
/**
|
|
48
53
|
* 喜欢这篇日记
|
|
49
54
|
*/
|
|
50
|
-
likeIt(id: string):
|
|
55
|
+
likeIt(id: string): RequestProxyResult<never, {
|
|
51
56
|
[key: string]: any;
|
|
52
57
|
data: never;
|
|
53
58
|
}>;
|
|
@@ -34,9 +34,17 @@ class NoteController {
|
|
|
34
34
|
/**
|
|
35
35
|
* 日记列表分页
|
|
36
36
|
*/
|
|
37
|
-
getList(page = 1, perPage = 10) {
|
|
37
|
+
getList(page = 1, perPage = 10, options = {}) {
|
|
38
|
+
const { select, sortBy, sortOrder, year } = options;
|
|
38
39
|
return this.proxy.get({
|
|
39
|
-
params: {
|
|
40
|
+
params: {
|
|
41
|
+
page,
|
|
42
|
+
size: perPage,
|
|
43
|
+
select: select === null || select === void 0 ? void 0 : select.join(' '),
|
|
44
|
+
sortBy,
|
|
45
|
+
sortOrder,
|
|
46
|
+
year,
|
|
47
|
+
},
|
|
40
48
|
});
|
|
41
49
|
}
|
|
42
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note.js","sourceRoot":"","sources":["../../../src/core/controllers/note.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"note.js","sourceRoot":"","sources":["../../../src/core/controllers/note.ts"],"names":[],"mappings":";;;AAcA,MAAa,cAAc;IAIzB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAHtC,SAAI,GAAG,OAAO,CAAA;QACd,SAAI,GAAG,MAAM,CAAA;IAE4B,CAAC;IAC1C,IAAI,KAAK;QACP,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,EAAsB,CAAA;IACpD,CAAC;IAED;;;;OAIG;IAEH,WAAW,CAAC,EAAmB,EAAE,QAAiB;QAChD,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;YAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAqB;gBAC3D,MAAM,EAAE,EAAE,QAAQ,EAAE;aACrB,CAAC,CAAA;SACH;aAAM;YACL,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAqB,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;SACxE;IACH,CAAC;IAED;;OAEG;IAEH,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,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,GAAG,CAAC;gBACzB,MAAM;gBACN,SAAS;gBACT,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,EAAU,EAAE,IAAI,GAAG,CAAC;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAG3B;YACD,MAAM,EAAE,EAAE,IAAI,EAAE;SACjB,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,EAAS,CAAA;IACzC,CAAC;CACF;AApED,wCAoEC"}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
2
3
|
import { PaginateResult } from "../../models/base";
|
|
3
4
|
import { PageModel } from "../../models/page";
|
|
5
|
+
import { SelectFields } from "../../types/helper";
|
|
4
6
|
import { HTTPClient } from '..';
|
|
7
|
+
export declare type PageListOptions = {
|
|
8
|
+
select?: SelectFields<keyof PageModel>;
|
|
9
|
+
sortBy?: 'order' | 'subtitle' | 'title' | 'created' | 'modified';
|
|
10
|
+
sortOrder?: 1 | -1;
|
|
11
|
+
};
|
|
5
12
|
export declare class PageController implements IController {
|
|
6
13
|
private readonly client;
|
|
7
14
|
constructor(client: HTTPClient);
|
|
8
15
|
base: string;
|
|
9
16
|
name: string;
|
|
10
|
-
get proxy():
|
|
17
|
+
get proxy(): IRequestHandler;
|
|
11
18
|
/**
|
|
12
19
|
* 页面列表
|
|
13
20
|
*/
|
|
14
|
-
getList(page?: number, perPage?: number):
|
|
21
|
+
getList(page?: number, perPage?: number, options?: PageListOptions): RequestProxyResult<PaginateResult<PageModel>, {
|
|
15
22
|
[key: string]: any;
|
|
16
23
|
data: PaginateResult<PageModel>;
|
|
17
24
|
}>;
|
|
18
25
|
/**
|
|
19
26
|
* 页面详情
|
|
20
27
|
*/
|
|
21
|
-
getById(id: string):
|
|
28
|
+
getById(id: string): RequestProxyResult<PageModel, {
|
|
22
29
|
[key: string]: any;
|
|
23
30
|
data: PageModel;
|
|
24
31
|
}>;
|
|
@@ -27,7 +34,7 @@ export declare class PageController implements IController {
|
|
|
27
34
|
* @param slug 路径
|
|
28
35
|
* @returns
|
|
29
36
|
*/
|
|
30
|
-
getBySlug(slug: string):
|
|
37
|
+
getBySlug(slug: string): RequestProxyResult<PageModel, {
|
|
31
38
|
[key: string]: any;
|
|
32
39
|
data: PageModel;
|
|
33
40
|
}>;
|
|
@@ -13,9 +13,16 @@ class PageController {
|
|
|
13
13
|
/**
|
|
14
14
|
* 页面列表
|
|
15
15
|
*/
|
|
16
|
-
getList(page = 1, perPage = 10) {
|
|
16
|
+
getList(page = 1, perPage = 10, options = {}) {
|
|
17
|
+
const { select, sortBy, sortOrder } = options;
|
|
17
18
|
return this.proxy.get({
|
|
18
|
-
params: {
|
|
19
|
+
params: {
|
|
20
|
+
page,
|
|
21
|
+
size: perPage,
|
|
22
|
+
select: select === null || select === void 0 ? void 0 : select.join(' '),
|
|
23
|
+
sortBy,
|
|
24
|
+
sortOrder,
|
|
25
|
+
},
|
|
19
26
|
});
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/core/controllers/page.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/core/controllers/page.ts"],"names":[],"mappings":";;;AAcA,MAAa,cAAc;IACzB,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAC/C,SAAI,GAAG,OAAO,CAAA;QACd,SAAI,GAAG,MAAM,CAAA;IAFqC,CAAC;IAGnD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IACD;;OAEG;IACH,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,GAAG,EAAE,EAAE,UAA2B,EAAE;QAC3D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B;YAC/C,MAAM,EAAE;gBACN,IAAI;gBACJ,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,GAAG,CAAC;gBACzB,MAAM;gBACN,SAAS;aACV;SACF,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,EAAa,CAAA;IACxC,CAAC;IACD;;;;OAIG;IACH,SAAS,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAY,EAAE,CAAC,CAAA;IACjD,CAAC;CACF;AArCD,wCAqCC"}
|
|
@@ -2,7 +2,14 @@ import { IController } from "../../interfaces/controller";
|
|
|
2
2
|
import { RequestProxyResult } from "../../interfaces/request";
|
|
3
3
|
import { PaginateResult } from "../../models/base";
|
|
4
4
|
import { PostModel } from "../../models/post";
|
|
5
|
+
import { SelectFields } from "../../types/helper";
|
|
5
6
|
import { HTTPClient } from '../client';
|
|
7
|
+
export declare type PostListOptions = {
|
|
8
|
+
select?: SelectFields<keyof PostModel>;
|
|
9
|
+
year?: number;
|
|
10
|
+
sortBy?: 'categoryId' | 'title' | 'created' | 'modified';
|
|
11
|
+
sortOrder?: 1 | -1;
|
|
12
|
+
};
|
|
6
13
|
export declare class PostController implements IController {
|
|
7
14
|
private client;
|
|
8
15
|
constructor(client: HTTPClient);
|
|
@@ -15,7 +22,7 @@ export declare class PostController implements IController {
|
|
|
15
22
|
* @param perPage
|
|
16
23
|
* @returns
|
|
17
24
|
*/
|
|
18
|
-
getList(page?: number, perPage?: number): RequestProxyResult<PaginateResult<PostModel>, {
|
|
25
|
+
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostModel>, {
|
|
19
26
|
[key: string]: any;
|
|
20
27
|
data: PaginateResult<PostModel>;
|
|
21
28
|
}>;
|
|
@@ -16,9 +16,17 @@ class PostController {
|
|
|
16
16
|
* @param perPage
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
|
-
getList(page = 1, perPage = 10) {
|
|
19
|
+
getList(page = 1, perPage = 10, options = {}) {
|
|
20
|
+
const { select, sortBy, sortOrder, year } = options;
|
|
20
21
|
return this.proxy.get({
|
|
21
|
-
params: {
|
|
22
|
+
params: {
|
|
23
|
+
page,
|
|
24
|
+
size: perPage,
|
|
25
|
+
select: select === null || select === void 0 ? void 0 : select.join(' '),
|
|
26
|
+
sortBy,
|
|
27
|
+
sortOrder,
|
|
28
|
+
year,
|
|
29
|
+
},
|
|
22
30
|
});
|
|
23
31
|
}
|
|
24
32
|
getPost(idOrCategoryName, slug) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","sources":["../../../src/core/controllers/post.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../../../src/core/controllers/post.ts"],"names":[],"mappings":";;;AAeA,MAAa,cAAc;IACzB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAEtC,SAAI,GAAG,OAAO,CAAA;QAEd,SAAI,GAAG,MAAM,CAAA;IAJ4B,CAAC;IAM1C,IAAY,KAAK;QACf,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,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,GAAG,CAAC;gBACzB,MAAM;gBACN,SAAS;gBACT,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;IAaD,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;AA/DD,wCA+DC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
2
3
|
import { RecentlyModel } from "../../models/recently";
|
|
3
4
|
import { HTTPClient } from '..';
|
|
4
5
|
export declare class RecentlyController implements IController {
|
|
@@ -6,15 +7,15 @@ export declare class RecentlyController implements IController {
|
|
|
6
7
|
base: string;
|
|
7
8
|
name: string;
|
|
8
9
|
constructor(client: HTTPClient);
|
|
9
|
-
get proxy():
|
|
10
|
+
get proxy(): IRequestHandler;
|
|
10
11
|
/**
|
|
11
12
|
* 获取最新一条
|
|
12
13
|
*/
|
|
13
|
-
getLatestOne():
|
|
14
|
+
getLatestOne(): RequestProxyResult<RecentlyModel, {
|
|
14
15
|
[key: string]: any;
|
|
15
16
|
data: RecentlyModel;
|
|
16
17
|
}>;
|
|
17
|
-
getAll():
|
|
18
|
+
getAll(): RequestProxyResult<{
|
|
18
19
|
data: RecentlyModel[];
|
|
19
20
|
}, {
|
|
20
21
|
[key: string]: any;
|
|
@@ -22,7 +23,7 @@ export declare class RecentlyController implements IController {
|
|
|
22
23
|
data: RecentlyModel[];
|
|
23
24
|
};
|
|
24
25
|
}>;
|
|
25
|
-
getList(before?: string | undefined, after?: string | undefined, size?: number | number):
|
|
26
|
+
getList(before?: string | undefined, after?: string | undefined, size?: number | number): RequestProxyResult<{
|
|
26
27
|
data: RecentlyModel[];
|
|
27
28
|
}, {
|
|
28
29
|
[key: string]: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recently.js","sourceRoot":"","sources":["../../../src/core/controllers/recently.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"recently.js","sourceRoot":"","sources":["../../../src/core/controllers/recently.ts"],"names":[],"mappings":";;;AAMA,MAAa,kBAAkB;IAI7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAH/C,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,UAAU,CAAA;IAEiC,CAAC;IAEnD,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,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;SAC3D;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B;YAC/C,MAAM,EAAE;gBACN,MAAM;gBACN,KAAK;gBACL,IAAI;aACL;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AApCD,gDAoCC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
2
3
|
import { SayModel } from "../../models/say";
|
|
3
4
|
import { HTTPClient } from '..';
|
|
4
5
|
import { BaseCrudController } from './base';
|
|
@@ -7,11 +8,11 @@ export declare class SayController extends BaseCrudController<SayModel> implemen
|
|
|
7
8
|
base: string;
|
|
8
9
|
name: string;
|
|
9
10
|
constructor(client: HTTPClient);
|
|
10
|
-
protected get proxy():
|
|
11
|
+
protected get proxy(): IRequestHandler;
|
|
11
12
|
/**
|
|
12
13
|
* 获取随机一条
|
|
13
14
|
*/
|
|
14
|
-
getRandom():
|
|
15
|
+
getRandom(): RequestProxyResult<{
|
|
15
16
|
data: SayModel | null;
|
|
16
17
|
}, {
|
|
17
18
|
[key: string]: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"say.js","sourceRoot":"","sources":["../../../src/core/controllers/say.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"say.js","sourceRoot":"","sources":["../../../src/core/controllers/say.ts"],"names":[],"mappings":";;;AAKA,iCAA2C;AAE3C,MAAa,aACX,SAAQ,yBAA4B;IAMpC,YAAsB,MAAkB;QACtC,KAAK,CAAC,MAAM,CAAC,CAAA;QADO,WAAM,GAAN,MAAM,CAAY;QAHxC,SAAI,GAAG,MAAM,CAAA;QACb,SAAI,GAAG,KAAK,CAAA;IAIZ,CAAC;IAED,IAAc,KAAK;QACjB,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;AArBD,sCAqBC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
-
import { RequestProxyResult } from "../../interfaces/request";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
3
3
|
import { PaginateResult } from "../../models/base";
|
|
4
4
|
import { NoteModel } from "../../models/note";
|
|
5
5
|
import { PostModel } from "../../models/post";
|
|
@@ -14,7 +14,7 @@ export declare class SearchController implements IController {
|
|
|
14
14
|
base: string;
|
|
15
15
|
name: string;
|
|
16
16
|
constructor(client: HTTPClient);
|
|
17
|
-
get proxy():
|
|
17
|
+
get proxy(): IRequestHandler;
|
|
18
18
|
search(type: 'note', keyword: string, options?: Omit<SearchOption, 'rawAlgolia'>): Promise<RequestProxyResult<PaginateResult<Pick<NoteModel, 'modified' | 'id' | 'title' | 'created' | 'nid'>>>>;
|
|
19
19
|
search(type: 'post', keyword: string, options?: Omit<SearchOption, 'rawAlgolia'>): Promise<RequestProxyResult<PaginateResult<Pick<PostModel, 'modified' | 'id' | 'title' | 'created' | 'slug' | 'category'>>>>;
|
|
20
20
|
/**
|
|
@@ -24,14 +24,14 @@ export declare class SearchController implements IController {
|
|
|
24
24
|
* @param options
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<Pick<PostModel, "
|
|
27
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
28
28
|
/**
|
|
29
29
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
30
30
|
*/
|
|
31
31
|
raw?: any;
|
|
32
32
|
}, {
|
|
33
33
|
[key: string]: any;
|
|
34
|
-
data: PaginateResult<Pick<PostModel, "
|
|
34
|
+
data: PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
35
35
|
/**
|
|
36
36
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
37
37
|
*/
|
|
@@ -39,14 +39,14 @@ export declare class SearchController implements IController {
|
|
|
39
39
|
};
|
|
40
40
|
}>, {
|
|
41
41
|
[key: string]: any;
|
|
42
|
-
data: RequestProxyResult<PaginateResult<Pick<PostModel, "
|
|
42
|
+
data: RequestProxyResult<PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
43
43
|
/**
|
|
44
44
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
45
45
|
*/
|
|
46
46
|
raw?: any;
|
|
47
47
|
}, {
|
|
48
48
|
[key: string]: any;
|
|
49
|
-
data: PaginateResult<Pick<PostModel, "
|
|
49
|
+
data: PaginateResult<Pick<PostModel, "id" | "title" | "slug" | "modified" | "created" | "category">> & {
|
|
50
50
|
/**
|
|
51
51
|
* @see: algoliasearch <https://www.algolia.com/doc/api-reference/api-methods/search/>
|
|
52
52
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
2
3
|
import { SnippetModel } from "../../models/snippet";
|
|
3
4
|
import { HTTPClient } from '..';
|
|
4
5
|
export declare class SnippetController implements IController {
|
|
@@ -6,12 +7,12 @@ export declare class SnippetController implements IController {
|
|
|
6
7
|
base: string;
|
|
7
8
|
name: string;
|
|
8
9
|
constructor(client: HTTPClient);
|
|
9
|
-
get proxy():
|
|
10
|
-
getById(id: string):
|
|
10
|
+
get proxy(): IRequestHandler;
|
|
11
|
+
getById(id: string): RequestProxyResult<SnippetModel, {
|
|
11
12
|
[key: string]: any;
|
|
12
13
|
data: SnippetModel;
|
|
13
14
|
}>;
|
|
14
|
-
getByReferenceAndName(reference: string, name: string):
|
|
15
|
+
getByReferenceAndName(reference: string, name: string): RequestProxyResult<SnippetModel, {
|
|
15
16
|
[key: string]: any;
|
|
16
17
|
data: SnippetModel;
|
|
17
18
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../../src/core/controllers/snippet.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../../src/core/controllers/snippet.ts"],"names":[],"mappings":";;;AAMA,MAAa,iBAAiB;IAI5B,YAAsB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAHxC,SAAI,GAAG,UAAU,CAAA;QACjB,SAAI,GAAG,SAAS,CAAA;IAE2B,CAAC;IAE5C,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,EAAgB,CAAA;IAC3C,CAAC;IAED,qBAAqB,CAAC,SAAiB,EAAE,IAAY;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAgB,CAAA;IACxD,CAAC;CACF;AAjBD,8CAiBC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IController } from "../../interfaces/controller";
|
|
2
|
+
import { IRequestHandler, RequestProxyResult } from "../../interfaces/request";
|
|
2
3
|
import { TLogin, UserModel } from "../../models/user";
|
|
3
4
|
import { HTTPClient } from '..';
|
|
4
5
|
export declare class UserController implements IController {
|
|
@@ -6,16 +7,16 @@ export declare class UserController implements IController {
|
|
|
6
7
|
constructor(client: HTTPClient);
|
|
7
8
|
base: string;
|
|
8
9
|
name: string;
|
|
9
|
-
protected get proxy():
|
|
10
|
-
getMasterInfo():
|
|
10
|
+
protected get proxy(): IRequestHandler;
|
|
11
|
+
getMasterInfo(): RequestProxyResult<UserModel, {
|
|
11
12
|
[key: string]: any;
|
|
12
13
|
data: UserModel;
|
|
13
14
|
}>;
|
|
14
|
-
login(username: string, password: string):
|
|
15
|
+
login(username: string, password: string): RequestProxyResult<TLogin, {
|
|
15
16
|
[key: string]: any;
|
|
16
17
|
data: TLogin;
|
|
17
18
|
}>;
|
|
18
|
-
checkTokenValid(token: string):
|
|
19
|
+
checkTokenValid(token: string): RequestProxyResult<{
|
|
19
20
|
ok: number;
|
|
20
21
|
isGuest: boolean;
|
|
21
22
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/core/controllers/user.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/core/controllers/user.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAc;IACzB,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAE/C,SAAI,GAAG,QAAQ,CAAA;QAEf,SAAI,GAAG,MAAM,CAAA;IAJqC,CAAC;IAMnD,IAAc,KAAK;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAa,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,QAAgB,EAAE,QAAgB;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAS;YACnC,IAAI,EAAE;gBACJ,QAAQ;gBACR,QAAQ;aACT;SACF,CAAC,CAAA;IACJ,CAAC;IAED,eAAe,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAmC;YACnE,MAAM,EAAE;gBACN,KAAK;aACN;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AA/BD,wCA+BC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { allContollerNames
|
|
1
|
+
export { allContollerNames, allControllers, createClient, HTTPClient, RequestError, } from './core';
|
|
2
|
+
export * from './core/controllers';
|