@mx-space/api-client 1.3.2 → 1.3.4

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.
Files changed (56) hide show
  1. package/.eslintcache +1 -1
  2. package/controllers/subscribe.ts +1 -1
  3. package/dist/adaptors/axios.cjs +4 -0
  4. package/dist/adaptors/axios.global.js +188 -85
  5. package/dist/adaptors/ky.cjs +4 -0
  6. package/dist/adaptors/ky.global.js +11 -1
  7. package/dist/adaptors/umi-request.global.js +137 -44
  8. package/dist/index.cjs +90 -1
  9. package/dist/index.global.js +90 -1
  10. package/dist/index.js +90 -1
  11. package/package.json +3 -11
  12. package/coverage/clover.xml +0 -591
  13. package/coverage/coverage-final.json +0 -5944
  14. package/coverage/lcov-report/adaptors/axios.ts.html +0 -201
  15. package/coverage/lcov-report/adaptors/index.html +0 -196
  16. package/coverage/lcov-report/adaptors/umi-request.ts.html +0 -186
  17. package/coverage/lcov-report/auto-bind.ts.html +0 -228
  18. package/coverage/lcov-report/base.css +0 -354
  19. package/coverage/lcov-report/block-navigation.js +0 -85
  20. package/coverage/lcov-report/controllers/aggregate.ts.html +0 -294
  21. package/coverage/lcov-report/controllers/base.ts.html +0 -183
  22. package/coverage/lcov-report/controllers/category.ts.html +0 -441
  23. package/coverage/lcov-report/controllers/comment.ts.html +0 -291
  24. package/coverage/lcov-report/controllers/index.html +0 -476
  25. package/coverage/lcov-report/controllers/index.ts.html +0 -297
  26. package/coverage/lcov-report/controllers/link.ts.html +0 -216
  27. package/coverage/lcov-report/controllers/note.ts.html +0 -375
  28. package/coverage/lcov-report/controllers/page.ts.html +0 -279
  29. package/coverage/lcov-report/controllers/post.ts.html +0 -369
  30. package/coverage/lcov-report/controllers/project.ts.html +0 -168
  31. package/coverage/lcov-report/controllers/recently.ts.html +0 -246
  32. package/coverage/lcov-report/controllers/say.ts.html +0 -207
  33. package/coverage/lcov-report/controllers/search.ts.html +0 -411
  34. package/coverage/lcov-report/controllers/severless.ts.html +0 -180
  35. package/coverage/lcov-report/controllers/snippet.ts.html +0 -195
  36. package/coverage/lcov-report/controllers/user.ts.html +0 -240
  37. package/coverage/lcov-report/core/attach-request.ts.html +0 -216
  38. package/coverage/lcov-report/core/client.ts.html +0 -786
  39. package/coverage/lcov-report/core/error.ts.html +0 -117
  40. package/coverage/lcov-report/core/index.html +0 -236
  41. package/coverage/lcov-report/core/index.ts.html +0 -93
  42. package/coverage/lcov-report/favicon.png +0 -0
  43. package/coverage/lcov-report/index.html +0 -276
  44. package/coverage/lcov-report/index.ts.html +0 -243
  45. package/coverage/lcov-report/models/aggregate.ts.html +0 -300
  46. package/coverage/lcov-report/models/category.ts.html +0 -162
  47. package/coverage/lcov-report/models/index.html +0 -196
  48. package/coverage/lcov-report/prettify.css +0 -101
  49. package/coverage/lcov-report/prettify.js +0 -1004
  50. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  51. package/coverage/lcov-report/sorter.js +0 -191
  52. package/coverage/lcov-report/utils/auto-bind.ts.html +0 -231
  53. package/coverage/lcov-report/utils/index.html +0 -216
  54. package/coverage/lcov-report/utils/index.ts.html +0 -246
  55. package/coverage/lcov-report/utils/path.ts.html +0 -105
  56. package/coverage/lcov.info +0 -1209
@@ -25,6 +25,10 @@
25
25
  return to;
26
26
  };
27
27
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
32
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
33
  mod
30
34
  ));
@@ -237,6 +241,7 @@
237
241
  "%encodeURIComponent%": encodeURIComponent,
238
242
  "%Error%": Error,
239
243
  "%eval%": eval,
244
+ // eslint-disable-line no-eval
240
245
  "%EvalError%": EvalError,
241
246
  "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
242
247
  "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
@@ -1076,6 +1081,7 @@
1076
1081
  node.value = value;
1077
1082
  } else {
1078
1083
  objects.next = {
1084
+ // eslint-disable-line no-param-reassign
1079
1085
  key,
1080
1086
  next: objects.next,
1081
1087
  value
@@ -1414,6 +1420,7 @@
1414
1420
  encodeValuesOnly: false,
1415
1421
  format: defaultFormat,
1416
1422
  formatter: formats.formatters[defaultFormat],
1423
+ // deprecated
1417
1424
  indices: false,
1418
1425
  serializeDate: function serializeDate(date) {
1419
1426
  return toISO.call(date);
@@ -1808,6 +1815,7 @@
1808
1815
  comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma,
1809
1816
  decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder,
1810
1817
  delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
1818
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
1811
1819
  depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth,
1812
1820
  ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
1813
1821
  interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
@@ -1975,6 +1983,7 @@
1975
1983
  "use strict";
1976
1984
  var Buffer2 = require_safer().Buffer;
1977
1985
  module.exports = {
1986
+ // Encodings
1978
1987
  utf8: { type: "_internal", bomAware: true },
1979
1988
  cesu8: { type: "_internal", bomAware: true },
1980
1989
  unicode11utf8: "utf8",
@@ -1983,6 +1992,7 @@
1983
1992
  binary: { type: "_internal" },
1984
1993
  base64: { type: "_internal" },
1985
1994
  hex: { type: "_internal" },
1995
+ // Codec.
1986
1996
  _internal: InternalCodec
1987
1997
  };
1988
1998
  function InternalCodec(codecOptions, iconv) {
@@ -2746,6 +2756,7 @@
2746
2756
  "../../node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/sbcs-data.js"(exports, module) {
2747
2757
  "use strict";
2748
2758
  module.exports = {
2759
+ // Not supported by iconv, not sure why.
2749
2760
  "10029": "maccenteuro",
2750
2761
  "maccenteuro": {
2751
2762
  "type": "_sbcs",
@@ -2765,6 +2776,7 @@
2765
2776
  "type": "_sbcs",
2766
2777
  "chars": "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
2767
2778
  },
2779
+ // Aliases of generated encodings.
2768
2780
  "ascii8bit": "ascii",
2769
2781
  "usascii": "ascii",
2770
2782
  "ansix34": "ascii",
@@ -5021,6 +5033,36 @@
5021
5033
  "../../node_modules/.pnpm/iconv-lite@0.6.3/node_modules/iconv-lite/encodings/dbcs-data.js"(exports, module) {
5022
5034
  "use strict";
5023
5035
  module.exports = {
5036
+ // == Japanese/ShiftJIS ====================================================
5037
+ // All japanese encodings are based on JIS X set of standards:
5038
+ // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
5039
+ // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
5040
+ // Has several variations in 1978, 1983, 1990 and 1997.
5041
+ // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
5042
+ // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
5043
+ // 2 planes, first is superset of 0208, second - revised 0212.
5044
+ // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx)
5045
+ // Byte encodings are:
5046
+ // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte
5047
+ // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC.
5048
+ // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI.
5049
+ // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes.
5050
+ // 0x00-0x7F - lower part of 0201
5051
+ // 0x8E, 0xA1-0xDF - upper part of 0201
5052
+ // (0xA1-0xFE)x2 - 0208 plane (94x94).
5053
+ // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
5054
+ // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
5055
+ // Used as-is in ISO2022 family.
5056
+ // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
5057
+ // 0201-1976 Roman, 0208-1978, 0208-1983.
5058
+ // * ISO2022-JP-1: Adds esc seq for 0212-1990.
5059
+ // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
5060
+ // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2.
5061
+ // * ISO2022-JP-2004: Adds 0213-2004 Plane 1.
5062
+ //
5063
+ // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
5064
+ //
5065
+ // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
5024
5066
  "shiftjis": {
5025
5067
  type: "_dbcs",
5026
5068
  table: function() {
@@ -5046,12 +5088,20 @@
5046
5088
  },
5047
5089
  encodeAdd: { "\xA5": 92, "\u203E": 126 }
5048
5090
  },
5091
+ // TODO: KDDI extension to Shift_JIS
5092
+ // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes.
5093
+ // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars.
5094
+ // == Chinese/GBK ==========================================================
5095
+ // http://en.wikipedia.org/wiki/GBK
5096
+ // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
5097
+ // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
5049
5098
  "gb2312": "cp936",
5050
5099
  "gb231280": "cp936",
5051
5100
  "gb23121980": "cp936",
5052
5101
  "csgb2312": "cp936",
5053
5102
  "csiso58gb231280": "cp936",
5054
5103
  "euccn": "cp936",
5104
+ // Microsoft's CP936 is a subset and approximation of GBK.
5055
5105
  "windows936": "cp936",
5056
5106
  "ms936": "cp936",
5057
5107
  "936": "cp936",
@@ -5061,6 +5111,7 @@
5061
5111
  return require_cp936();
5062
5112
  }
5063
5113
  },
5114
+ // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
5064
5115
  "gbk": {
5065
5116
  type: "_dbcs",
5066
5117
  table: function() {
@@ -5069,6 +5120,11 @@
5069
5120
  },
5070
5121
  "xgbk": "gbk",
5071
5122
  "isoir58": "gbk",
5123
+ // GB18030 is an algorithmic extension of GBK.
5124
+ // Main source: https://www.w3.org/TR/encoding/#gbk-encoder
5125
+ // http://icu-project.org/docs/papers/gb18030.html
5126
+ // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
5127
+ // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
5072
5128
  "gb18030": {
5073
5129
  type: "_dbcs",
5074
5130
  table: function() {
@@ -5081,6 +5137,8 @@
5081
5137
  encodeAdd: { "\u20AC": 41699 }
5082
5138
  },
5083
5139
  "chinese": "gb18030",
5140
+ // == Korean ===============================================================
5141
+ // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
5084
5142
  "windows949": "cp949",
5085
5143
  "ms949": "cp949",
5086
5144
  "949": "cp949",
@@ -5098,6 +5156,28 @@
5098
5156
  "ksc56011987": "cp949",
5099
5157
  "ksc56011989": "cp949",
5100
5158
  "ksc5601": "cp949",
5159
+ // == Big5/Taiwan/Hong Kong ================================================
5160
+ // There are lots of tables for Big5 and cp950. Please see the following links for history:
5161
+ // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
5162
+ // Variations, in roughly number of defined chars:
5163
+ // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT
5164
+ // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
5165
+ // * Big5-2003 (Taiwan standard) almost superset of cp950.
5166
+ // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
5167
+ // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
5168
+ // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
5169
+ // Plus, it has 4 combining sequences.
5170
+ // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
5171
+ // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way.
5172
+ // Implementations are not consistent within browsers; sometimes labeled as just big5.
5173
+ // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied.
5174
+ // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31
5175
+ // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
5176
+ // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
5177
+ // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
5178
+ //
5179
+ // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
5180
+ // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
5101
5181
  "windows950": "cp950",
5102
5182
  "ms950": "cp950",
5103
5183
  "950": "cp950",
@@ -5107,6 +5187,7 @@
5107
5187
  return require_cp950();
5108
5188
  }
5109
5189
  },
5190
+ // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
5110
5191
  "big5": "big5hkscs",
5111
5192
  "big5hkscs": {
5112
5193
  type: "_dbcs",
@@ -5114,6 +5195,9 @@
5114
5195
  return require_cp950().concat(require_big5_added());
5115
5196
  },
5116
5197
  encodeSkipVals: [
5198
+ // Although Encoding Standard says we should avoid encoding to HKSCS area (See Step 1 of
5199
+ // https://encoding.spec.whatwg.org/#index-big5-pointer), we still do it to increase compatibility with ICU.
5200
+ // But if a single unicode point can be encoded both as HKSCS and regular Big5, we prefer the latter.
5117
5201
  36457,
5118
5202
  36463,
5119
5203
  36478,
@@ -5175,6 +5259,7 @@
5175
5259
  37576,
5176
5260
  38468,
5177
5261
  38637,
5262
+ // Step 2 of https://encoding.spec.whatwg.org/#index-big5-pointer: Use last pointer for U+2550, U+255E, U+2561, U+256A, U+5341, or U+5345
5178
5263
  41636,
5179
5264
  41637,
5180
5265
  41639,
@@ -6277,40 +6362,43 @@
6277
6362
  }
6278
6363
  _createClass(Onion2, [{
6279
6364
  key: "use",
6280
- value: function use(newMiddleware) {
6281
- var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
6282
- global: false,
6283
- core: false,
6284
- defaultInstance: false
6285
- };
6286
- var core = false;
6287
- var global2 = false;
6288
- var defaultInstance = false;
6289
- if (typeof opts === "number") {
6290
- if (process && process.env && process.env.NODE_ENV === "development") {
6291
- console.warn('use() options should be object, number property would be deprecated in future\uFF0Cplease update use() options to "{ core: true }".');
6292
- }
6293
- core = true;
6294
- global2 = false;
6295
- } else if (_typeof(opts) === "object" && opts) {
6296
- global2 = opts.global || false;
6297
- core = opts.core || false;
6298
- defaultInstance = opts.defaultInstance || false;
6299
- }
6300
- if (global2) {
6301
- Onion2.globalMiddlewares.splice(Onion2.globalMiddlewares.length - Onion2.defaultGlobalMiddlewaresLength, 0, newMiddleware);
6302
- return;
6303
- }
6304
- if (core) {
6305
- Onion2.coreMiddlewares.splice(Onion2.coreMiddlewares.length - Onion2.defaultCoreMiddlewaresLength, 0, newMiddleware);
6306
- return;
6307
- }
6308
- if (defaultInstance) {
6309
- this.defaultMiddlewares.push(newMiddleware);
6310
- return;
6365
+ value: (
6366
+ // 内置内核中间件长度
6367
+ function use(newMiddleware) {
6368
+ var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
6369
+ global: false,
6370
+ core: false,
6371
+ defaultInstance: false
6372
+ };
6373
+ var core = false;
6374
+ var global2 = false;
6375
+ var defaultInstance = false;
6376
+ if (typeof opts === "number") {
6377
+ if (process && process.env && process.env.NODE_ENV === "development") {
6378
+ console.warn('use() options should be object, number property would be deprecated in future\uFF0Cplease update use() options to "{ core: true }".');
6379
+ }
6380
+ core = true;
6381
+ global2 = false;
6382
+ } else if (_typeof(opts) === "object" && opts) {
6383
+ global2 = opts.global || false;
6384
+ core = opts.core || false;
6385
+ defaultInstance = opts.defaultInstance || false;
6386
+ }
6387
+ if (global2) {
6388
+ Onion2.globalMiddlewares.splice(Onion2.globalMiddlewares.length - Onion2.defaultGlobalMiddlewaresLength, 0, newMiddleware);
6389
+ return;
6390
+ }
6391
+ if (core) {
6392
+ Onion2.coreMiddlewares.splice(Onion2.coreMiddlewares.length - Onion2.defaultCoreMiddlewaresLength, 0, newMiddleware);
6393
+ return;
6394
+ }
6395
+ if (defaultInstance) {
6396
+ this.defaultMiddlewares.push(newMiddleware);
6397
+ return;
6398
+ }
6399
+ this.middlewares.push(newMiddleware);
6311
6400
  }
6312
- this.middlewares.push(newMiddleware);
6313
- }
6401
+ )
6314
6402
  }, {
6315
6403
  key: "execute",
6316
6404
  value: function execute() {
@@ -6795,6 +6883,7 @@
6795
6883
  this.initOptions = mergeRequestOptions(this.initOptions, options);
6796
6884
  this.mapCache.extendOptions(options);
6797
6885
  }
6886
+ // 执行请求前拦截器
6798
6887
  }, {
6799
6888
  key: "dealRequestInterceptors",
6800
6889
  value: function dealRequestInterceptors(ctx) {
@@ -6855,18 +6944,22 @@
6855
6944
  }
6856
6945
  }], [{
6857
6946
  key: "requestUse",
6858
- value: function requestUse(handler) {
6859
- var opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
6860
- global: true
6861
- };
6862
- if (typeof handler !== "function")
6863
- throw new TypeError("Interceptor must be function!");
6864
- if (opt.global) {
6865
- Core2.requestInterceptors.push(handler);
6866
- } else {
6867
- this.instanceRequestInterceptors.push(handler);
6947
+ value: (
6948
+ // 请求拦截器 默认 { global: true } 兼容旧版本拦截器
6949
+ function requestUse(handler) {
6950
+ var opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
6951
+ global: true
6952
+ };
6953
+ if (typeof handler !== "function")
6954
+ throw new TypeError("Interceptor must be function!");
6955
+ if (opt.global) {
6956
+ Core2.requestInterceptors.push(handler);
6957
+ } else {
6958
+ this.instanceRequestInterceptors.push(handler);
6959
+ }
6868
6960
  }
6869
- }
6961
+ )
6962
+ // 响应拦截器 默认 { global: true } 兼容旧版本拦截器
6870
6963
  }, {
6871
6964
  key: "responseUse",
6872
6965
  value: function responseUse(handler) {
package/dist/index.cjs CHANGED
@@ -173,9 +173,15 @@ var AggregateController = class {
173
173
  get proxy() {
174
174
  return this.client.proxy(this.base);
175
175
  }
176
+ /**
177
+ * 获取聚合数据
178
+ */
176
179
  getAggregateData() {
177
180
  return this.proxy.get();
178
181
  }
182
+ /**
183
+ * 获取最新发布的内容
184
+ */
179
185
  getTop(size = 5) {
180
186
  return this.proxy.top.get({ params: { size } });
181
187
  }
@@ -189,6 +195,9 @@ var AggregateController = class {
189
195
  }
190
196
  });
191
197
  }
198
+ /**
199
+ * 获取聚合数据统计
200
+ */
192
201
  getStat() {
193
202
  return this.proxy.stat.get();
194
203
  }
@@ -293,20 +302,33 @@ var CommentController = class {
293
302
  get proxy() {
294
303
  return this.client.proxy(this.base);
295
304
  }
305
+ /**
306
+ * 根据 comment id 获取评论, 包括子评论
307
+ */
296
308
  getById(id) {
297
309
  return this.proxy(id).get();
298
310
  }
311
+ /**
312
+ * 获取文章的评论列表
313
+ * @param refId 文章 Id
314
+ */
299
315
  getByRefId(refId, pagination = {}) {
300
316
  const { page, size } = pagination;
301
317
  return this.proxy.ref(refId).get({
302
318
  params: { page: page || 1, size: size || 10 }
303
319
  });
304
320
  }
321
+ /**
322
+ * 评论
323
+ */
305
324
  comment(refId, data) {
306
325
  return this.proxy(refId).post({
307
326
  data
308
327
  });
309
328
  }
329
+ /**
330
+ * 回复评论
331
+ */
310
332
  reply(commentId, data) {
311
333
  return this.proxy.reply(commentId).post({
312
334
  data
@@ -329,6 +351,11 @@ var BaseCrudController = class {
329
351
  getAll() {
330
352
  return this.proxy.all.get();
331
353
  }
354
+ /**
355
+ * 带分页的查询
356
+ * @param page
357
+ * @param perPage
358
+ */
332
359
  getAllPaginated(page, perPage, sortOption) {
333
360
  return this.proxy.get({
334
361
  params: { page, size: perPage, ...sortOption }
@@ -345,10 +372,12 @@ var LinkController = class extends BaseCrudController {
345
372
  this.base = "links";
346
373
  autoBind(this);
347
374
  }
375
+ // 是否可以申请友链
348
376
  async canApplyLink() {
349
377
  const { can } = await this.proxy.audit.get();
350
378
  return can;
351
379
  }
380
+ // 申请友链
352
381
  async applyLink(data) {
353
382
  return await this.proxy.audit.post({ data });
354
383
  }
@@ -365,6 +394,9 @@ var NoteController = class {
365
394
  get proxy() {
366
395
  return this.client.proxy(this.base);
367
396
  }
397
+ /**
398
+ * 最新日记
399
+ */
368
400
  getLatest() {
369
401
  return this.proxy.latest.get();
370
402
  }
@@ -378,6 +410,9 @@ var NoteController = class {
378
410
  return this.proxy(id).get();
379
411
  }
380
412
  }
413
+ /**
414
+ * 日记列表分页
415
+ */
381
416
  getList(page = 1, perPage = 10, options = {}) {
382
417
  const { select, sortBy, sortOrder, year } = options;
383
418
  return this.proxy.get({
@@ -391,14 +426,23 @@ var NoteController = class {
391
426
  }
392
427
  });
393
428
  }
429
+ /**
430
+ * 获取当前日记的上下各 n / 2 篇日记
431
+ */
394
432
  getMiddleList(id, size = 5) {
395
433
  return this.proxy.list(id).get({
396
434
  params: { size }
397
435
  });
398
436
  }
437
+ /**
438
+ * 喜欢这篇日记
439
+ */
399
440
  likeIt(id) {
400
441
  return this.proxy.like(id).get();
401
442
  }
443
+ /**
444
+ * 获取专栏内的所有日记
445
+ */
402
446
  getNoteByTopicId(topicId, page = 1, size = 10, sortOptions = {}) {
403
447
  return this.proxy.topics(topicId).get({
404
448
  params: { page, size, ...sortOptions }
@@ -417,6 +461,9 @@ var PageController = class {
417
461
  get proxy() {
418
462
  return this.client.proxy(this.base);
419
463
  }
464
+ /**
465
+ * 页面列表
466
+ */
420
467
  getList(page = 1, perPage = 10, options = {}) {
421
468
  const { select, sortBy, sortOrder } = options;
422
469
  return this.proxy.get({
@@ -429,9 +476,17 @@ var PageController = class {
429
476
  }
430
477
  });
431
478
  }
479
+ /**
480
+ * 页面详情
481
+ */
432
482
  getById(id) {
433
483
  return this.proxy(id).get();
434
484
  }
485
+ /**
486
+ * 根据路径获取页面
487
+ * @param slug 路径
488
+ * @returns
489
+ */
435
490
  getBySlug(slug) {
436
491
  return this.proxy.slug(slug).get({});
437
492
  }
@@ -448,6 +503,12 @@ var PostController = class {
448
503
  get proxy() {
449
504
  return this.client.proxy(this.base);
450
505
  }
506
+ /**
507
+ * 获取文章列表分页
508
+ * @param page
509
+ * @param perPage
510
+ * @returns
511
+ */
451
512
  getList(page = 1, perPage = 10, options = {}) {
452
513
  const { select, sortBy, sortOrder, year } = options;
453
514
  return this.proxy.get({
@@ -468,9 +529,15 @@ var PostController = class {
468
529
  return this.proxy(idOrCategoryName)(slug).get();
469
530
  }
470
531
  }
532
+ /**
533
+ * 获取最新的文章
534
+ */
471
535
  getLatest() {
472
536
  return this.proxy.latest.get();
473
537
  }
538
+ /**
539
+ * 点赞
540
+ */
474
541
  thumbsUp(id) {
475
542
  return this.proxy("_thumbs-up").get({ params: { id } });
476
543
  }
@@ -508,6 +575,9 @@ var RecentlyController = class {
508
575
  get proxy() {
509
576
  return this.client.proxy(this.base);
510
577
  }
578
+ /**
579
+ * 获取最新一条
580
+ */
511
581
  getLatestOne() {
512
582
  return this.proxy.latest.get();
513
583
  }
@@ -523,6 +593,7 @@ var RecentlyController = class {
523
593
  }
524
594
  });
525
595
  }
596
+ /** 表态:点赞,点踩 */
526
597
  attitude(id, attitude) {
527
598
  return this.proxy.attitude(id).get({
528
599
  params: {
@@ -544,6 +615,9 @@ var SayController = class extends BaseCrudController {
544
615
  get proxy() {
545
616
  return this.client.proxy(this.base);
546
617
  }
618
+ /**
619
+ * 获取随机一条
620
+ */
547
621
  getRandom() {
548
622
  return this.proxy.random.get();
549
623
  }
@@ -565,6 +639,13 @@ var SearchController = class {
565
639
  params: { keyword, ...options }
566
640
  });
567
641
  }
642
+ /**
643
+ * 从 algolya 搜索
644
+ * https://www.algolia.com/doc/api-reference/api-methods/search/
645
+ * @param keyword
646
+ * @param options
647
+ * @returns
648
+ */
568
649
  searchByAlgolia(keyword, options) {
569
650
  return this.proxy("algolia").get({ params: { keyword, ...options } });
570
651
  }
@@ -597,6 +678,9 @@ var SnippetController = class {
597
678
  get proxy() {
598
679
  return this.client.proxy(this.base);
599
680
  }
681
+ // getById(id: string) {
682
+ // return this.proxy(id).get<Omit<SnippetModel, 'data'>>()
683
+ // }
600
684
  getByReferenceAndName(reference, name) {
601
685
  return this.proxy(reference)(name).get();
602
686
  }
@@ -613,12 +697,15 @@ var SubscribeController = class {
613
697
  get proxy() {
614
698
  return this.client.proxy(this.base);
615
699
  }
700
+ /**
701
+ * 检查开启状态
702
+ */
616
703
  check() {
617
704
  return this.proxy.status.get();
618
705
  }
619
706
  subscribe(email, types) {
620
707
  return this.proxy.post({
621
- params: {
708
+ data: {
622
709
  email,
623
710
  types
624
711
  }
@@ -725,6 +812,7 @@ var allContollerNames = [
725
812
  "serverless",
726
813
  "subscribe",
727
814
  "user",
815
+ // alias,
728
816
  "friend",
729
817
  "master",
730
818
  "shorthand"
@@ -910,6 +998,7 @@ var HTTPClient = class {
910
998
  route.push(name);
911
999
  return new Proxy(noop, handler);
912
1000
  },
1001
+ // @ts-ignore
913
1002
  apply(target, _, args) {
914
1003
  route.push(...args.filter((x) => x !== null));
915
1004
  return new Proxy(noop, handler);