@mx-space/api-client 1.5.1 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/ack.ts +44 -0
- package/controllers/index.ts +5 -1
- package/controllers/note.ts +2 -8
- package/controllers/post.ts +2 -8
- package/dist/adaptors/axios.global.js +120 -95
- package/dist/adaptors/ky.cjs +1 -1
- package/dist/adaptors/ky.global.js +25 -39
- package/dist/adaptors/ky.js +1 -1
- package/dist/index.cjs +32 -16
- package/dist/index.d.cts +27 -25
- package/dist/index.d.ts +27 -25
- package/dist/index.global.js +28 -14
- package/dist/index.js +30 -15
- package/package.json +9 -9
package/dist/adaptors/ky.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
|
-
// ../../node_modules/.pnpm/ky@
|
|
3
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/errors/HTTPError.js
|
|
4
4
|
var HTTPError = class extends Error {
|
|
5
5
|
constructor(response, request, options) {
|
|
6
6
|
const code = response.status || response.status === 0 ? response.status : "";
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/ky@
|
|
36
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/errors/TimeoutError.js
|
|
37
37
|
var TimeoutError = class extends Error {
|
|
38
38
|
constructor(request) {
|
|
39
39
|
super("Request timed out");
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// ../../node_modules/.pnpm/ky@
|
|
51
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/utils/is.js
|
|
52
52
|
var isObject = (value) => value !== null && typeof value === "object";
|
|
53
53
|
|
|
54
|
-
// ../../node_modules/.pnpm/ky@
|
|
54
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/utils/merge.js
|
|
55
55
|
var validateAndMerge = (...sources) => {
|
|
56
56
|
for (const source of sources) {
|
|
57
|
-
if ((!isObject(source) || Array.isArray(source)) &&
|
|
57
|
+
if ((!isObject(source) || Array.isArray(source)) && source !== void 0) {
|
|
58
58
|
throw new TypeError("The `options` argument must be an object");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -98,14 +98,14 @@
|
|
|
98
98
|
return returnValue;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
// ../../node_modules/.pnpm/ky@
|
|
101
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/core/constants.js
|
|
102
102
|
var supportsRequestStreams = (() => {
|
|
103
103
|
let duplexAccessed = false;
|
|
104
104
|
let hasContentType = false;
|
|
105
105
|
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
106
106
|
const supportsRequest = typeof globalThis.Request === "function";
|
|
107
107
|
if (supportsReadableStream && supportsRequest) {
|
|
108
|
-
hasContentType = new globalThis.Request("https://
|
|
108
|
+
hasContentType = new globalThis.Request("https://empty.invalid", {
|
|
109
109
|
body: new globalThis.ReadableStream(),
|
|
110
110
|
method: "POST",
|
|
111
111
|
// @ts-expect-error - Types are outdated.
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
var maxSafeTimeout = 2147483647;
|
|
134
134
|
var stop = Symbol("stop");
|
|
135
135
|
|
|
136
|
-
// ../../node_modules/.pnpm/ky@
|
|
136
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/utils/normalize.js
|
|
137
137
|
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
138
138
|
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
139
139
|
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
@@ -144,7 +144,8 @@
|
|
|
144
144
|
statusCodes: retryStatusCodes,
|
|
145
145
|
afterStatusCodes: retryAfterStatusCodes,
|
|
146
146
|
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
147
|
-
backoffLimit: Number.POSITIVE_INFINITY
|
|
147
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
148
|
+
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1e3
|
|
148
149
|
};
|
|
149
150
|
var normalizeRetryOptions = (retry = {}) => {
|
|
150
151
|
if (typeof retry === "number") {
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
};
|
|
167
168
|
};
|
|
168
169
|
|
|
169
|
-
// ../../node_modules/.pnpm/ky@
|
|
170
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/utils/timeout.js
|
|
170
171
|
async function timeout(request, abortController, options) {
|
|
171
172
|
return new Promise((resolve, reject) => {
|
|
172
173
|
const timeoutId = setTimeout(() => {
|
|
@@ -181,45 +182,30 @@
|
|
|
181
182
|
});
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
// ../../node_modules/.pnpm/ky@
|
|
185
|
-
var isDomExceptionSupported = Boolean(globalThis.DOMException);
|
|
186
|
-
function composeAbortError(signal) {
|
|
187
|
-
if (isDomExceptionSupported) {
|
|
188
|
-
return new DOMException(signal?.reason ?? "The operation was aborted.", "AbortError");
|
|
189
|
-
}
|
|
190
|
-
const error = new Error(signal?.reason ?? "The operation was aborted.");
|
|
191
|
-
error.name = "AbortError";
|
|
192
|
-
return error;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// ../../node_modules/.pnpm/ky@0.33.3/node_modules/ky/distribution/utils/delay.js
|
|
185
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/utils/delay.js
|
|
196
186
|
async function delay(ms, { signal }) {
|
|
197
187
|
return new Promise((resolve, reject) => {
|
|
198
188
|
if (signal) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
signal.addEventListener("abort", handleAbort, { once: true });
|
|
189
|
+
signal.throwIfAborted();
|
|
190
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
204
191
|
}
|
|
205
|
-
function
|
|
206
|
-
reject(composeAbortError(signal));
|
|
192
|
+
function abortHandler() {
|
|
207
193
|
clearTimeout(timeoutId);
|
|
194
|
+
reject(signal.reason);
|
|
208
195
|
}
|
|
209
196
|
const timeoutId = setTimeout(() => {
|
|
210
|
-
signal?.removeEventListener("abort",
|
|
197
|
+
signal?.removeEventListener("abort", abortHandler);
|
|
211
198
|
resolve();
|
|
212
199
|
}, ms);
|
|
213
200
|
});
|
|
214
201
|
}
|
|
215
202
|
|
|
216
|
-
// ../../node_modules/.pnpm/ky@
|
|
203
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/core/Ky.js
|
|
217
204
|
var Ky = class _Ky {
|
|
218
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
219
205
|
static create(input, options) {
|
|
220
206
|
const ky2 = new _Ky(input, options);
|
|
221
207
|
const fn = async () => {
|
|
222
|
-
if (ky2._options.timeout > maxSafeTimeout) {
|
|
208
|
+
if (typeof ky2._options.timeout === "number" && ky2._options.timeout > maxSafeTimeout) {
|
|
223
209
|
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
224
210
|
}
|
|
225
211
|
await Promise.resolve();
|
|
@@ -323,7 +309,7 @@
|
|
|
323
309
|
prefixUrl: String(options.prefixUrl || ""),
|
|
324
310
|
retry: normalizeRetryOptions(options.retry),
|
|
325
311
|
throwHttpErrors: options.throwHttpErrors !== false,
|
|
326
|
-
timeout:
|
|
312
|
+
timeout: options.timeout ?? 1e4,
|
|
327
313
|
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
328
314
|
};
|
|
329
315
|
if (typeof this._input !== "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {
|
|
@@ -382,7 +368,7 @@
|
|
|
382
368
|
} else {
|
|
383
369
|
after *= 1e3;
|
|
384
370
|
}
|
|
385
|
-
if (
|
|
371
|
+
if (this._options.retry.maxRetryAfter !== void 0 && after > this._options.retry.maxRetryAfter) {
|
|
386
372
|
return 0;
|
|
387
373
|
}
|
|
388
374
|
return after;
|
|
@@ -391,8 +377,8 @@
|
|
|
391
377
|
return 0;
|
|
392
378
|
}
|
|
393
379
|
}
|
|
394
|
-
const
|
|
395
|
-
return Math.min(this._options.retry.backoffLimit,
|
|
380
|
+
const retryDelay = this._options.retry.delay(this._retryCount);
|
|
381
|
+
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
|
396
382
|
}
|
|
397
383
|
return 0;
|
|
398
384
|
}
|
|
@@ -485,7 +471,7 @@
|
|
|
485
471
|
}
|
|
486
472
|
};
|
|
487
473
|
|
|
488
|
-
// ../../node_modules/.pnpm/ky@
|
|
474
|
+
// ../../node_modules/.pnpm/ky@1.1.0/node_modules/ky/distribution/index.js
|
|
489
475
|
var createInstance = (defaults) => {
|
|
490
476
|
const ky2 = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
491
477
|
for (const method of requestMethods) {
|
|
@@ -520,7 +506,7 @@
|
|
|
520
506
|
get(url, options) {
|
|
521
507
|
return getDataFromKyResponse(ky2.get(url, options));
|
|
522
508
|
},
|
|
523
|
-
post(url, options) {
|
|
509
|
+
async post(url, options) {
|
|
524
510
|
const data = options.data;
|
|
525
511
|
delete options.data;
|
|
526
512
|
const kyOptions = {
|
package/dist/adaptors/ky.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// index.ts
|
|
21
21
|
var api_client_exports = {};
|
|
22
22
|
__export(api_client_exports, {
|
|
23
|
+
AckController: () => AckController,
|
|
23
24
|
ActivityController: () => ActivityController,
|
|
24
25
|
AggregateController: () => AggregateController,
|
|
25
26
|
CategoryController: () => CategoryController,
|
|
@@ -55,7 +56,7 @@ __export(api_client_exports, {
|
|
|
55
56
|
TimelineType: () => TimelineType,
|
|
56
57
|
TopicController: () => TopicController,
|
|
57
58
|
UserController: () => UserController,
|
|
58
|
-
|
|
59
|
+
allControllerNames: () => allControllerNames,
|
|
59
60
|
allControllers: () => allControllers,
|
|
60
61
|
createClient: () => createClient,
|
|
61
62
|
default: () => api_client_default,
|
|
@@ -163,6 +164,30 @@ function autoBind(self, { include, exclude } = {}) {
|
|
|
163
164
|
return self;
|
|
164
165
|
}
|
|
165
166
|
|
|
167
|
+
// controllers/ack.ts
|
|
168
|
+
var AckController = class {
|
|
169
|
+
constructor(client) {
|
|
170
|
+
this.client = client;
|
|
171
|
+
this.base = "ack";
|
|
172
|
+
this.name = "ack";
|
|
173
|
+
autoBind(this);
|
|
174
|
+
}
|
|
175
|
+
get proxy() {
|
|
176
|
+
return this.client.proxy(this.base);
|
|
177
|
+
}
|
|
178
|
+
read(type, id) {
|
|
179
|
+
return this.proxy.ack.post({
|
|
180
|
+
data: {
|
|
181
|
+
type: "read",
|
|
182
|
+
payload: {
|
|
183
|
+
type,
|
|
184
|
+
id
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
166
191
|
// controllers/activity.ts
|
|
167
192
|
var ActivityController = class {
|
|
168
193
|
constructor(client) {
|
|
@@ -460,12 +485,6 @@ var NoteController = class {
|
|
|
460
485
|
params: { size }
|
|
461
486
|
});
|
|
462
487
|
}
|
|
463
|
-
/**
|
|
464
|
-
* 喜欢这篇日记
|
|
465
|
-
*/
|
|
466
|
-
likeIt(id) {
|
|
467
|
-
return this.proxy.like(id).get();
|
|
468
|
-
}
|
|
469
488
|
/**
|
|
470
489
|
* 获取专栏内的所有日记
|
|
471
490
|
*/
|
|
@@ -561,12 +580,6 @@ var PostController = class {
|
|
|
561
580
|
getLatest() {
|
|
562
581
|
return this.proxy.latest.get();
|
|
563
582
|
}
|
|
564
|
-
/**
|
|
565
|
-
* 点赞
|
|
566
|
-
*/
|
|
567
|
-
thumbsUp(id) {
|
|
568
|
-
return this.proxy("_thumbs-up").get({ params: { id } });
|
|
569
|
-
}
|
|
570
583
|
};
|
|
571
584
|
|
|
572
585
|
// controllers/project.ts
|
|
@@ -804,6 +817,7 @@ var UserController = class {
|
|
|
804
817
|
|
|
805
818
|
// controllers/index.ts
|
|
806
819
|
var allControllers = [
|
|
820
|
+
AckController,
|
|
807
821
|
ActivityController,
|
|
808
822
|
AggregateController,
|
|
809
823
|
CategoryController,
|
|
@@ -822,7 +836,8 @@ var allControllers = [
|
|
|
822
836
|
SubscribeController,
|
|
823
837
|
UserController
|
|
824
838
|
];
|
|
825
|
-
var
|
|
839
|
+
var allControllerNames = [
|
|
840
|
+
"ack",
|
|
826
841
|
"activity",
|
|
827
842
|
"aggregate",
|
|
828
843
|
"category",
|
|
@@ -894,7 +909,7 @@ var HTTPClient = class {
|
|
|
894
909
|
attachRequestMethod(this);
|
|
895
910
|
}
|
|
896
911
|
initGetClient() {
|
|
897
|
-
for (const name of
|
|
912
|
+
for (const name of allControllerNames) {
|
|
898
913
|
Object.defineProperty(this, name, {
|
|
899
914
|
get() {
|
|
900
915
|
const client = Reflect.get(this, `${methodPrefix}${name}`);
|
|
@@ -1137,6 +1152,7 @@ var SubscribeTypeToBitMap = {
|
|
|
1137
1152
|
var api_client_default = createClient;
|
|
1138
1153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1139
1154
|
0 && (module.exports = {
|
|
1155
|
+
AckController,
|
|
1140
1156
|
ActivityController,
|
|
1141
1157
|
AggregateController,
|
|
1142
1158
|
CategoryController,
|
|
@@ -1172,7 +1188,7 @@ var api_client_default = createClient;
|
|
|
1172
1188
|
TimelineType,
|
|
1173
1189
|
TopicController,
|
|
1174
1190
|
UserController,
|
|
1175
|
-
|
|
1191
|
+
allControllerNames,
|
|
1176
1192
|
allControllers,
|
|
1177
1193
|
createClient,
|
|
1178
1194
|
simpleCamelcaseKeys
|
package/dist/index.d.cts
CHANGED
|
@@ -92,6 +92,30 @@ declare class RequestError extends Error {
|
|
|
92
92
|
constructor(message: string, status: number, path: string, raw: any);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
declare module '../core/client' {
|
|
96
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
97
|
+
ack: AckController<ResponseWrapper>;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @support core >= 4.4.0
|
|
102
|
+
*/
|
|
103
|
+
declare class AckController<ResponseWrapper> implements IController {
|
|
104
|
+
private client;
|
|
105
|
+
base: string;
|
|
106
|
+
name: string;
|
|
107
|
+
constructor(client: HTTPClient);
|
|
108
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
109
|
+
read(type: 'post' | 'note', id: string): RequestProxyResult<never, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
110
|
+
[key: string]: any;
|
|
111
|
+
data: never;
|
|
112
|
+
} : ResponseWrapper extends {
|
|
113
|
+
data: never;
|
|
114
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
115
|
+
data: never;
|
|
116
|
+
}>;
|
|
117
|
+
}
|
|
118
|
+
|
|
95
119
|
declare module '../core/client' {
|
|
96
120
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
97
121
|
activity: ActivityController<ResponseWrapper>;
|
|
@@ -860,17 +884,6 @@ declare class NoteController<ResponseWrapper> implements IController {
|
|
|
860
884
|
size: number;
|
|
861
885
|
};
|
|
862
886
|
}>;
|
|
863
|
-
/**
|
|
864
|
-
* 喜欢这篇日记
|
|
865
|
-
*/
|
|
866
|
-
likeIt(id: string | number): RequestProxyResult<never, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
867
|
-
[key: string]: any;
|
|
868
|
-
data: never;
|
|
869
|
-
} : ResponseWrapper extends {
|
|
870
|
-
data: never;
|
|
871
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
872
|
-
data: never;
|
|
873
|
-
}>;
|
|
874
887
|
/**
|
|
875
888
|
* 获取专栏内的所有日记
|
|
876
889
|
*/
|
|
@@ -990,17 +1003,6 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
990
1003
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
991
1004
|
data: ModelWithLiked<PostModel>;
|
|
992
1005
|
}>;
|
|
993
|
-
/**
|
|
994
|
-
* 点赞
|
|
995
|
-
*/
|
|
996
|
-
thumbsUp(id: string): RequestProxyResult<void, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
997
|
-
[key: string]: any;
|
|
998
|
-
data: void;
|
|
999
|
-
} : ResponseWrapper extends {
|
|
1000
|
-
data: void;
|
|
1001
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1002
|
-
data: void;
|
|
1003
|
-
}>;
|
|
1004
1006
|
}
|
|
1005
1007
|
|
|
1006
1008
|
interface ProjectModel extends BaseModel {
|
|
@@ -1467,8 +1469,8 @@ declare class UserController<ResponseWrapper> implements IController {
|
|
|
1467
1469
|
}>;
|
|
1468
1470
|
}
|
|
1469
1471
|
|
|
1470
|
-
declare const allControllers: (typeof ActivityController | 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 SubscribeController | typeof TopicController | typeof UserController)[];
|
|
1471
|
-
declare const
|
|
1472
|
+
declare const allControllers: (typeof AckController | typeof ActivityController | 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 SubscribeController | typeof TopicController | typeof UserController)[];
|
|
1473
|
+
declare const allControllerNames: readonly ["ack", "activity", "aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "subscribe", "user", "friend", "master", "shorthand"];
|
|
1472
1474
|
|
|
1473
1475
|
declare enum SnippetType {
|
|
1474
1476
|
JSON = "json",
|
|
@@ -1494,4 +1496,4 @@ interface SnippetModel<T = unknown> extends BaseModel {
|
|
|
1494
1496
|
*/
|
|
1495
1497
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
1496
1498
|
|
|
1497
|
-
export { ActivityController, AdminExtraModel, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, HTTPClient, IConfig, IConfigKeys, Image, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteMusicRecord, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RefType, RequestError, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel,
|
|
1499
|
+
export { AckController, ActivityController, AdminExtraModel, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, HTTPClient, IConfig, IConfigKeys, Image, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteMusicRecord, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RefType, RequestError, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,30 @@ declare class RequestError extends Error {
|
|
|
92
92
|
constructor(message: string, status: number, path: string, raw: any);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
declare module '@mx-space/api-client' {
|
|
96
|
+
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
97
|
+
ack: AckController<ResponseWrapper>;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @support core >= 4.4.0
|
|
102
|
+
*/
|
|
103
|
+
declare class AckController<ResponseWrapper> implements IController {
|
|
104
|
+
private client;
|
|
105
|
+
base: string;
|
|
106
|
+
name: string;
|
|
107
|
+
constructor(client: HTTPClient);
|
|
108
|
+
get proxy(): IRequestHandler<ResponseWrapper>;
|
|
109
|
+
read(type: 'post' | 'note', id: string): RequestProxyResult<never, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
110
|
+
[key: string]: any;
|
|
111
|
+
data: never;
|
|
112
|
+
} : ResponseWrapper extends {
|
|
113
|
+
data: never;
|
|
114
|
+
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
115
|
+
data: never;
|
|
116
|
+
}>;
|
|
117
|
+
}
|
|
118
|
+
|
|
95
119
|
declare module '@mx-space/api-client' {
|
|
96
120
|
interface HTTPClient<T extends IRequestAdapter = IRequestAdapter, ResponseWrapper = unknown> {
|
|
97
121
|
activity: ActivityController<ResponseWrapper>;
|
|
@@ -860,17 +884,6 @@ declare class NoteController<ResponseWrapper> implements IController {
|
|
|
860
884
|
size: number;
|
|
861
885
|
};
|
|
862
886
|
}>;
|
|
863
|
-
/**
|
|
864
|
-
* 喜欢这篇日记
|
|
865
|
-
*/
|
|
866
|
-
likeIt(id: string | number): RequestProxyResult<never, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
867
|
-
[key: string]: any;
|
|
868
|
-
data: never;
|
|
869
|
-
} : ResponseWrapper extends {
|
|
870
|
-
data: never;
|
|
871
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
872
|
-
data: never;
|
|
873
|
-
}>;
|
|
874
887
|
/**
|
|
875
888
|
* 获取专栏内的所有日记
|
|
876
889
|
*/
|
|
@@ -990,17 +1003,6 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
990
1003
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
991
1004
|
data: ModelWithLiked<PostModel>;
|
|
992
1005
|
}>;
|
|
993
|
-
/**
|
|
994
|
-
* 点赞
|
|
995
|
-
*/
|
|
996
|
-
thumbsUp(id: string): RequestProxyResult<void, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
997
|
-
[key: string]: any;
|
|
998
|
-
data: void;
|
|
999
|
-
} : ResponseWrapper extends {
|
|
1000
|
-
data: void;
|
|
1001
|
-
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1002
|
-
data: void;
|
|
1003
|
-
}>;
|
|
1004
1006
|
}
|
|
1005
1007
|
|
|
1006
1008
|
interface ProjectModel extends BaseModel {
|
|
@@ -1467,8 +1469,8 @@ declare class UserController<ResponseWrapper> implements IController {
|
|
|
1467
1469
|
}>;
|
|
1468
1470
|
}
|
|
1469
1471
|
|
|
1470
|
-
declare const allControllers: (typeof ActivityController | 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 SubscribeController | typeof TopicController | typeof UserController)[];
|
|
1471
|
-
declare const
|
|
1472
|
+
declare const allControllers: (typeof AckController | typeof ActivityController | 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 SubscribeController | typeof TopicController | typeof UserController)[];
|
|
1473
|
+
declare const allControllerNames: readonly ["ack", "activity", "aggregate", "category", "comment", "link", "note", "page", "post", "project", "topic", "recently", "say", "search", "snippet", "serverless", "subscribe", "user", "friend", "master", "shorthand"];
|
|
1472
1474
|
|
|
1473
1475
|
declare enum SnippetType {
|
|
1474
1476
|
JSON = "json",
|
|
@@ -1494,4 +1496,4 @@ interface SnippetModel<T = unknown> extends BaseModel {
|
|
|
1494
1496
|
*/
|
|
1495
1497
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
1496
1498
|
|
|
1497
|
-
export { ActivityController, AdminExtraModel, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, HTTPClient, IConfig, IConfigKeys, Image, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteMusicRecord, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RefType, RequestError, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel,
|
|
1499
|
+
export { AckController, ActivityController, AdminExtraModel, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, HTTPClient, IConfig, IConfigKeys, Image, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteMusicRecord, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RefType, RequestError, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
package/dist/index.global.js
CHANGED
|
@@ -100,6 +100,30 @@
|
|
|
100
100
|
return self;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
// controllers/ack.ts
|
|
104
|
+
var AckController = class {
|
|
105
|
+
constructor(client) {
|
|
106
|
+
this.client = client;
|
|
107
|
+
this.base = "ack";
|
|
108
|
+
this.name = "ack";
|
|
109
|
+
autoBind(this);
|
|
110
|
+
}
|
|
111
|
+
get proxy() {
|
|
112
|
+
return this.client.proxy(this.base);
|
|
113
|
+
}
|
|
114
|
+
read(type, id) {
|
|
115
|
+
return this.proxy.ack.post({
|
|
116
|
+
data: {
|
|
117
|
+
type: "read",
|
|
118
|
+
payload: {
|
|
119
|
+
type,
|
|
120
|
+
id
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
103
127
|
// controllers/activity.ts
|
|
104
128
|
var ActivityController = class {
|
|
105
129
|
constructor(client) {
|
|
@@ -397,12 +421,6 @@
|
|
|
397
421
|
params: { size }
|
|
398
422
|
});
|
|
399
423
|
}
|
|
400
|
-
/**
|
|
401
|
-
* 喜欢这篇日记
|
|
402
|
-
*/
|
|
403
|
-
likeIt(id) {
|
|
404
|
-
return this.proxy.like(id).get();
|
|
405
|
-
}
|
|
406
424
|
/**
|
|
407
425
|
* 获取专栏内的所有日记
|
|
408
426
|
*/
|
|
@@ -498,12 +516,6 @@
|
|
|
498
516
|
getLatest() {
|
|
499
517
|
return this.proxy.latest.get();
|
|
500
518
|
}
|
|
501
|
-
/**
|
|
502
|
-
* 点赞
|
|
503
|
-
*/
|
|
504
|
-
thumbsUp(id) {
|
|
505
|
-
return this.proxy("_thumbs-up").get({ params: { id } });
|
|
506
|
-
}
|
|
507
519
|
};
|
|
508
520
|
|
|
509
521
|
// controllers/project.ts
|
|
@@ -741,6 +753,7 @@
|
|
|
741
753
|
|
|
742
754
|
// controllers/index.ts
|
|
743
755
|
var allControllers = [
|
|
756
|
+
AckController,
|
|
744
757
|
ActivityController,
|
|
745
758
|
AggregateController,
|
|
746
759
|
CategoryController,
|
|
@@ -759,7 +772,8 @@
|
|
|
759
772
|
SubscribeController,
|
|
760
773
|
UserController
|
|
761
774
|
];
|
|
762
|
-
var
|
|
775
|
+
var allControllerNames = [
|
|
776
|
+
"ack",
|
|
763
777
|
"activity",
|
|
764
778
|
"aggregate",
|
|
765
779
|
"category",
|
|
@@ -831,7 +845,7 @@
|
|
|
831
845
|
attachRequestMethod(this);
|
|
832
846
|
}
|
|
833
847
|
initGetClient() {
|
|
834
|
-
for (const name of
|
|
848
|
+
for (const name of allControllerNames) {
|
|
835
849
|
Object.defineProperty(this, name, {
|
|
836
850
|
get() {
|
|
837
851
|
const client = Reflect.get(this, `${methodPrefix}${name}`);
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,30 @@ function autoBind(self, { include, exclude } = {}) {
|
|
|
98
98
|
return self;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// controllers/ack.ts
|
|
102
|
+
var AckController = class {
|
|
103
|
+
constructor(client) {
|
|
104
|
+
this.client = client;
|
|
105
|
+
this.base = "ack";
|
|
106
|
+
this.name = "ack";
|
|
107
|
+
autoBind(this);
|
|
108
|
+
}
|
|
109
|
+
get proxy() {
|
|
110
|
+
return this.client.proxy(this.base);
|
|
111
|
+
}
|
|
112
|
+
read(type, id) {
|
|
113
|
+
return this.proxy.ack.post({
|
|
114
|
+
data: {
|
|
115
|
+
type: "read",
|
|
116
|
+
payload: {
|
|
117
|
+
type,
|
|
118
|
+
id
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
101
125
|
// controllers/activity.ts
|
|
102
126
|
var ActivityController = class {
|
|
103
127
|
constructor(client) {
|
|
@@ -395,12 +419,6 @@ var NoteController = class {
|
|
|
395
419
|
params: { size }
|
|
396
420
|
});
|
|
397
421
|
}
|
|
398
|
-
/**
|
|
399
|
-
* 喜欢这篇日记
|
|
400
|
-
*/
|
|
401
|
-
likeIt(id) {
|
|
402
|
-
return this.proxy.like(id).get();
|
|
403
|
-
}
|
|
404
422
|
/**
|
|
405
423
|
* 获取专栏内的所有日记
|
|
406
424
|
*/
|
|
@@ -496,12 +514,6 @@ var PostController = class {
|
|
|
496
514
|
getLatest() {
|
|
497
515
|
return this.proxy.latest.get();
|
|
498
516
|
}
|
|
499
|
-
/**
|
|
500
|
-
* 点赞
|
|
501
|
-
*/
|
|
502
|
-
thumbsUp(id) {
|
|
503
|
-
return this.proxy("_thumbs-up").get({ params: { id } });
|
|
504
|
-
}
|
|
505
517
|
};
|
|
506
518
|
|
|
507
519
|
// controllers/project.ts
|
|
@@ -739,6 +751,7 @@ var UserController = class {
|
|
|
739
751
|
|
|
740
752
|
// controllers/index.ts
|
|
741
753
|
var allControllers = [
|
|
754
|
+
AckController,
|
|
742
755
|
ActivityController,
|
|
743
756
|
AggregateController,
|
|
744
757
|
CategoryController,
|
|
@@ -757,7 +770,8 @@ var allControllers = [
|
|
|
757
770
|
SubscribeController,
|
|
758
771
|
UserController
|
|
759
772
|
];
|
|
760
|
-
var
|
|
773
|
+
var allControllerNames = [
|
|
774
|
+
"ack",
|
|
761
775
|
"activity",
|
|
762
776
|
"aggregate",
|
|
763
777
|
"category",
|
|
@@ -829,7 +843,7 @@ var HTTPClient = class {
|
|
|
829
843
|
attachRequestMethod(this);
|
|
830
844
|
}
|
|
831
845
|
initGetClient() {
|
|
832
|
-
for (const name of
|
|
846
|
+
for (const name of allControllerNames) {
|
|
833
847
|
Object.defineProperty(this, name, {
|
|
834
848
|
get() {
|
|
835
849
|
const client = Reflect.get(this, `${methodPrefix}${name}`);
|
|
@@ -1071,6 +1085,7 @@ var SubscribeTypeToBitMap = {
|
|
|
1071
1085
|
// index.ts
|
|
1072
1086
|
var api_client_default = createClient;
|
|
1073
1087
|
export {
|
|
1088
|
+
AckController,
|
|
1074
1089
|
ActivityController,
|
|
1075
1090
|
AggregateController,
|
|
1076
1091
|
CategoryController,
|
|
@@ -1106,7 +1121,7 @@ export {
|
|
|
1106
1121
|
TimelineType,
|
|
1107
1122
|
TopicController,
|
|
1108
1123
|
UserController,
|
|
1109
|
-
|
|
1124
|
+
allControllerNames,
|
|
1110
1125
|
allControllers,
|
|
1111
1126
|
createClient,
|
|
1112
1127
|
api_client_default as default,
|