@zhubangyun/lowcode-core 5.3.132 → 5.3.182

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 (51) hide show
  1. package/es/components/schema-render/components/schema-render-base.js +1 -1
  2. package/es/index.d.ts +2 -3
  3. package/es/index.js +2 -3
  4. package/es/utils/{common → api}/RestApi.d.ts +9 -7
  5. package/es/utils/{common → api}/RestApi.js +142 -85
  6. package/es/utils/api/index.d.ts +2 -0
  7. package/es/utils/api/index.js +49 -2
  8. package/es/utils/cache/index.d.ts +9 -0
  9. package/es/utils/cache/index.js +75 -0
  10. package/es/utils/common/SingletonInstanceMap.d.ts +7 -0
  11. package/es/utils/common/SingletonInstanceMap.js +73 -0
  12. package/es/utils/common/index.d.ts +0 -2
  13. package/es/utils/common/index.js +1 -30
  14. package/es/utils/{common/RestFormApi.d.ts → form/form.api.d.ts} +9 -4
  15. package/es/utils/{common/RestFormApi.js → form/form.api.js} +85 -36
  16. package/es/utils/form/form.handler.js +0 -0
  17. package/es/utils/form/form.instance.d.ts +26 -0
  18. package/es/utils/form/form.instance.js +100 -0
  19. package/es/utils/form/form.process.js +0 -0
  20. package/es/utils/index.d.ts +2 -0
  21. package/es/utils/index.js +2 -0
  22. package/lib/components/schema-render/components/schema-render-base.js +1 -1
  23. package/lib/index.d.ts +2 -3
  24. package/lib/index.js +4 -6
  25. package/lib/utils/{common → api}/RestApi.d.ts +9 -7
  26. package/lib/utils/{common → api}/RestApi.js +142 -85
  27. package/lib/utils/api/index.d.ts +2 -0
  28. package/lib/utils/api/index.js +51 -2
  29. package/lib/utils/cache/index.d.ts +9 -0
  30. package/lib/utils/cache/index.js +80 -0
  31. package/lib/utils/common/SingletonInstanceMap.d.ts +7 -0
  32. package/lib/utils/common/SingletonInstanceMap.js +78 -0
  33. package/lib/utils/common/index.d.ts +0 -2
  34. package/lib/utils/common/index.js +2 -32
  35. package/lib/utils/{common/RestFormApi.d.ts → form/form.api.d.ts} +9 -4
  36. package/lib/utils/{common/RestFormApi.js → form/form.api.js} +85 -36
  37. package/lib/utils/form/form.handler.js +1 -0
  38. package/lib/utils/form/form.instance.d.ts +26 -0
  39. package/lib/utils/form/form.instance.js +105 -0
  40. package/lib/utils/form/form.process.js +1 -0
  41. package/lib/utils/index.d.ts +2 -0
  42. package/lib/utils/index.js +2 -0
  43. package/package.json +1 -1
  44. package/es/utils/common/ClientCache.d.ts +0 -36
  45. package/es/utils/common/ClientCache.js +0 -120
  46. package/lib/utils/common/ClientCache.d.ts +0 -36
  47. package/lib/utils/common/ClientCache.js +0 -125
  48. /package/es/utils/{common → api}/Request.d.ts +0 -0
  49. /package/es/utils/{common → api}/Request.js +0 -0
  50. /package/lib/utils/{common → api}/Request.d.ts +0 -0
  51. /package/lib/utils/{common → api}/Request.js +0 -0
@@ -6,13 +6,18 @@ exports.RestFormApi = void 0;
6
6
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
7
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
8
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
9
- var _RestApi2 = require("./RestApi");
9
+ var _RestApi2 = require("../api/RestApi");
10
+ var _api = require("../api");
10
11
  var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
11
- function RestFormApi(formName, options) {
12
+ function RestFormApi(formId, mock) {
12
13
  var _this;
13
- _this = _RestApi.call(this, "forms/" + formName, options) || this;
14
+ _this = _RestApi.call(this, "forms", {}) || this;
15
+ _this.formId = void 0;
16
+ _this.mock = void 0;
14
17
  _this.initialized = false;
15
18
  _this.schema = void 0;
19
+ _this.formId = formId;
20
+ _this.mock = !!mock;
16
21
  return _this;
17
22
  }
18
23
  (0, _inheritsLoose2["default"])(RestFormApi, _RestApi);
@@ -22,28 +27,35 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
22
27
  return _regenerator["default"].wrap(function _callee$(_context) {
23
28
  while (1) switch (_context.prev = _context.next) {
24
29
  case 0:
25
- if (this.initialized) {
26
- _context.next = 8;
30
+ if (!this.initialized) {
31
+ _context.next = 4;
27
32
  break;
28
33
  }
29
- _context.prev = 1;
30
- //this.schema = await schemaCache.get(super.uri)
31
- /* this.schema = await PageUtils.schemaCache.lazyGet(this.title);
32
- this.handler = new FormDataHandler(this.schema);*/
33
- this.initialized = true;
34
- _context.next = 8;
34
+ return _context.abrupt("return", true);
35
+ case 4:
36
+ _context.prev = 4;
37
+ _context.next = 7;
38
+ return (0, _api.getSchema)(this.formId, this.mock);
39
+ case 7:
40
+ this.schema = _context.sent;
41
+ this.initialized = !!this.schema;
42
+ _context.next = 15;
35
43
  break;
36
- case 5:
37
- _context.prev = 5;
38
- _context.t0 = _context["catch"](1);
44
+ case 11:
45
+ _context.prev = 11;
46
+ _context.t0 = _context["catch"](4);
47
+ console.log("获取schema失败!", {
48
+ id: this.formId,
49
+ mock: this.mock
50
+ });
39
51
  throw _context.t0;
40
- case 8:
52
+ case 15:
41
53
  return _context.abrupt("return", this.initialized);
42
- case 9:
54
+ case 16:
43
55
  case "end":
44
56
  return _context.stop();
45
57
  }
46
- }, _callee, this, [[1, 5]]);
58
+ }, _callee, this, [[4, 11]]);
47
59
  }));
48
60
  function initialize() {
49
61
  return _initialize.apply(this, arguments);
@@ -99,65 +111,102 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
99
111
  }
100
112
  return getById;
101
113
  }();
102
- _proto.create = /*#__PURE__*/function () {
103
- var _create = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data, options) {
114
+ _proto.save = /*#__PURE__*/function () {
115
+ var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data, options) {
116
+ var config;
104
117
  return _regenerator["default"].wrap(function _callee4$(_context4) {
105
118
  while (1) switch (_context4.prev = _context4.next) {
106
119
  case 0:
107
120
  _context4.next = 2;
108
121
  return this.initialize();
109
122
  case 2:
110
- return _context4.abrupt("return", _RestApi.prototype.create.call(this, data, options));
111
- case 3:
123
+ config = {};
124
+ this.handleRequestConfig(config);
125
+ return _context4.abrupt("return", _RestApi.prototype.save.call(this, data, options));
126
+ case 5:
112
127
  case "end":
113
128
  return _context4.stop();
114
129
  }
115
130
  }, _callee4, this);
116
131
  }));
117
- function create(_x6, _x7) {
118
- return _create.apply(this, arguments);
132
+ function save(_x6, _x7) {
133
+ return _save.apply(this, arguments);
119
134
  }
120
- return create;
135
+ return save;
121
136
  }();
122
- _proto.update = /*#__PURE__*/function () {
123
- var _update = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(id, data, options) {
137
+ _proto.create = /*#__PURE__*/function () {
138
+ var _create = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(data, options) {
139
+ var config;
124
140
  return _regenerator["default"].wrap(function _callee5$(_context5) {
125
141
  while (1) switch (_context5.prev = _context5.next) {
126
142
  case 0:
127
143
  _context5.next = 2;
128
144
  return this.initialize();
129
145
  case 2:
130
- return _context5.abrupt("return", _RestApi.prototype.update.call(this, id, data, options));
131
- case 3:
146
+ config = {};
147
+ this.handleRequestConfig(config);
148
+ return _context5.abrupt("return", _RestApi.prototype.create.call(this, data, options));
149
+ case 5:
132
150
  case "end":
133
151
  return _context5.stop();
134
152
  }
135
153
  }, _callee5, this);
136
154
  }));
137
- function update(_x8, _x9, _x10) {
138
- return _update.apply(this, arguments);
155
+ function create(_x8, _x9) {
156
+ return _create.apply(this, arguments);
139
157
  }
140
- return update;
158
+ return create;
141
159
  }();
142
- _proto.deleteById = /*#__PURE__*/function () {
143
- var _deleteById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(id, options) {
160
+ _proto.update = /*#__PURE__*/function () {
161
+ var _update = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(id, data, options) {
162
+ var config;
144
163
  return _regenerator["default"].wrap(function _callee6$(_context6) {
145
164
  while (1) switch (_context6.prev = _context6.next) {
146
165
  case 0:
147
166
  _context6.next = 2;
148
167
  return this.initialize();
149
168
  case 2:
150
- return _context6.abrupt("return", _RestApi.prototype.deleteById.call(this, id, options));
151
- case 3:
169
+ config = {};
170
+ this.handleRequestConfig(config);
171
+ return _context6.abrupt("return", _RestApi.prototype.update.call(this, id, data, options));
172
+ case 5:
152
173
  case "end":
153
174
  return _context6.stop();
154
175
  }
155
176
  }, _callee6, this);
156
177
  }));
157
- function deleteById(_x11, _x12) {
178
+ function update(_x10, _x11, _x12) {
179
+ return _update.apply(this, arguments);
180
+ }
181
+ return update;
182
+ }();
183
+ _proto.deleteById = /*#__PURE__*/function () {
184
+ var _deleteById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(id, options) {
185
+ var config;
186
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
187
+ while (1) switch (_context7.prev = _context7.next) {
188
+ case 0:
189
+ _context7.next = 2;
190
+ return this.initialize();
191
+ case 2:
192
+ config = {};
193
+ this.handleRequestConfig(config);
194
+ return _context7.abrupt("return", _RestApi.prototype.deleteById.call(this, id, options));
195
+ case 5:
196
+ case "end":
197
+ return _context7.stop();
198
+ }
199
+ }, _callee7, this);
200
+ }));
201
+ function deleteById(_x13, _x14) {
158
202
  return _deleteById.apply(this, arguments);
159
203
  }
160
204
  return deleteById;
161
205
  }();
206
+ _proto.handleRequestConfig = function handleRequestConfig(config) {
207
+ config.params = config.params || {};
208
+ config.params.formId = this.formId;
209
+ config.params.mock = this.mock;
210
+ };
162
211
  return RestFormApi;
163
212
  }(_RestApi2.RestApi);
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,26 @@
1
+ import { FormInstance } from "antd/lib";
2
+ import { NamePath, StoreValue } from "antd/es/form/interface";
3
+ declare type NamePaths = (string | number)[];
4
+ export declare class SubFormInstance implements FormInstance {
5
+ parentForm: FormInstance;
6
+ namePath: NamePaths;
7
+ constructor(form: FormInstance, namePath: NamePaths);
8
+ overwritePathName(name: NamePath): any[];
9
+ overwriteFields(fields: any[]): any[];
10
+ getFieldError(name: NamePath): string[];
11
+ getFieldValue(name: NamePath): StoreValue;
12
+ getFieldWarning(name: NamePath): string[];
13
+ getFieldsError(nameList: NamePath[] | undefined): any[];
14
+ getFieldsValue(nameList?: NamePath[] | true, filterFunc?: (meta: any) => boolean): any;
15
+ isFieldTouched(name: NamePath): boolean;
16
+ isFieldValidating(name: NamePath): boolean;
17
+ isFieldsTouched(): boolean;
18
+ isFieldsValidating(nameList: NamePath[]): boolean;
19
+ resetFields(fields: NamePath[] | undefined): void;
20
+ setFieldValue(name: NamePath, value: any): void;
21
+ setFields(fields: any[]): void;
22
+ setFieldsValue(values: any): void;
23
+ submit(): void;
24
+ validateFields(nameList: NamePath[] | undefined): Promise<any>;
25
+ }
26
+ export {};
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.SubFormInstance = void 0;
6
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
+ var SubFormInstance = exports.SubFormInstance = /*#__PURE__*/function () {
8
+ function SubFormInstance(form, namePath) {
9
+ this.parentForm = void 0;
10
+ this.namePath = void 0;
11
+ this.parentForm = form;
12
+ this.namePath = namePath;
13
+ }
14
+ var _proto = SubFormInstance.prototype;
15
+ _proto.overwritePathName = function overwritePathName(name) {
16
+ if (Array.isArray(name)) {
17
+ return [].concat(this.namePath, name);
18
+ } else {
19
+ return [].concat(this.namePath, [name]);
20
+ }
21
+ };
22
+ _proto.overwriteFields = function overwriteFields(fields) {
23
+ var _this = this;
24
+ return fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
25
+ return (0, _extends2["default"])({}, field, {
26
+ name: _this.overwritePathName(field.name)
27
+ });
28
+ });
29
+ };
30
+ _proto.getFieldError = function getFieldError(name) {
31
+ return this.parentForm.getFieldError(this.overwritePathName(name));
32
+ };
33
+ _proto.getFieldValue = function getFieldValue(name) {
34
+ return this.parentForm.getFieldValue(this.overwritePathName(name));
35
+ };
36
+ _proto.getFieldWarning = function getFieldWarning(name) {
37
+ return this.parentForm.getFieldWarning(this.overwritePathName(name));
38
+ }
39
+
40
+ // @ts-ignore
41
+ ;
42
+ _proto.getFieldsError = function getFieldsError(nameList) {
43
+ var _this2 = this;
44
+ return this.parentForm.getFieldsError(nameList === null || nameList === void 0 ? void 0 : nameList.map(function (name) {
45
+ return _this2.overwritePathName(name);
46
+ }));
47
+ }
48
+
49
+ // @ts-ignore
50
+ ;
51
+ _proto.getFieldsValue = function getFieldsValue(nameList, filterFunc) {
52
+ var values = (0, _extends2["default"])({}, this.parentForm.getFieldValue(this.namePath));
53
+ values.parent = this.parentForm.getFieldsValue(true);
54
+ return values;
55
+ };
56
+ _proto.isFieldTouched = function isFieldTouched(name) {
57
+ return this.parentForm.isFieldTouched(this.overwritePathName(name));
58
+ };
59
+ _proto.isFieldValidating = function isFieldValidating(name) {
60
+ return this.parentForm.isFieldValidating(this.overwritePathName(name));
61
+ };
62
+ _proto.isFieldsTouched = function isFieldsTouched() {
63
+ return this.parentForm.isFieldsTouched();
64
+ };
65
+ // @ts-ignore
66
+ _proto.isFieldsValidating = function isFieldsValidating(nameList) {
67
+ var _this3 = this;
68
+ return this.parentForm.isFieldsValidating(nameList.map(function (name) {
69
+ return _this3.overwritePathName(name);
70
+ }));
71
+ };
72
+ _proto.resetFields = function resetFields(fields) {
73
+ if (Array.isArray(fields)) {
74
+ // @ts-ignore
75
+ this.parentForm.resetFields(this.overwriteFields(fields));
76
+ } else {
77
+ this.parentForm.resetFields();
78
+ }
79
+ };
80
+ _proto.setFieldValue = function setFieldValue(name, value) {
81
+ return this.parentForm.setFieldValue(this.overwritePathName(name), value);
82
+ };
83
+ _proto.setFields = function setFields(fields) {
84
+ this.parentForm.setFields(this.overwriteFields(fields));
85
+ };
86
+ _proto.setFieldsValue = function setFieldsValue(values) {
87
+ var _this4 = this;
88
+ if (!values) return;
89
+ //删除父值
90
+ delete values.parent;
91
+ Object.keys(values).forEach(function (name) {
92
+ return _this4.parentForm.setFieldValue(_this4.overwritePathName(name), values[name]);
93
+ });
94
+ };
95
+ _proto.submit = function submit() {
96
+ this.parentForm.submit();
97
+ }
98
+
99
+ // @ts-ignore
100
+ ;
101
+ _proto.validateFields = function validateFields(nameList) {
102
+ return this.parentForm.validateFields(nameList);
103
+ };
104
+ return SubFormInstance;
105
+ }();
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,8 +1,10 @@
1
+ import * as cache from "./cache";
1
2
  import * as common from "./common";
2
3
  import * as api from "./api";
3
4
  import * as designer from "./designer";
4
5
  declare const _default: {
5
6
  api: typeof api;
7
+ cache: typeof cache;
6
8
  designer: typeof designer;
7
9
  common: typeof common;
8
10
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports["default"] = void 0;
5
+ var cache = _interopRequireWildcard(require("./cache"));
5
6
  var common = _interopRequireWildcard(require("./common"));
6
7
  var api = _interopRequireWildcard(require("./api"));
7
8
  var designer = _interopRequireWildcard(require("./designer"));
@@ -9,6 +10,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
9
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
10
11
  var _default = exports["default"] = {
11
12
  api: api,
13
+ cache: cache,
12
14
  designer: designer,
13
15
  common: common
14
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhubangyun/lowcode-core",
3
- "version": "5.3.132",
3
+ "version": "5.3.182",
4
4
  "description": "低代码核心",
5
5
  "files": [
6
6
  "lib",
@@ -1,36 +0,0 @@
1
- export declare type LoadData = (key: string) => Promise<any>;
2
- export declare class ClientCache {
3
- private cacheMap;
4
- name: string;
5
- loadData: LoadData;
6
- constructor(options: {
7
- name: string;
8
- loadData: LoadData;
9
- });
10
- /**
11
- * 获取值
12
- * @param key
13
- * @param cache 是否从缓存中获取
14
- */
15
- get(key: string, cache?: boolean): Promise<any>;
16
- /**
17
- * 重新加载
18
- * @param key
19
- */
20
- reload(key: string): Promise<any>;
21
- /**
22
- * 手动设置
23
- * @param key
24
- * @param value
25
- */
26
- set(key: string, value: any): void;
27
- /**
28
- * 删除某个缓存
29
- * @param key
30
- */
31
- delete(key: string): void;
32
- /**
33
- * 删除全部缓存
34
- */
35
- clear(): void;
36
- }
@@ -1,120 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- export var ClientCache = /*#__PURE__*/function () {
4
- function ClientCache(options) {
5
- this.cacheMap = void 0;
6
- this.name = void 0;
7
- this.loadData = void 0;
8
- this.cacheMap = new Map();
9
- this.name = options.name;
10
- if (typeof options.loadData == "function") {
11
- this.loadData = options.loadData;
12
- } else {
13
- this.loadData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
14
- return _regeneratorRuntime.wrap(function _callee$(_context) {
15
- while (1) switch (_context.prev = _context.next) {
16
- case 0:
17
- return _context.abrupt("return", null);
18
- case 1:
19
- case "end":
20
- return _context.stop();
21
- }
22
- }, _callee);
23
- }));
24
- }
25
- }
26
-
27
- /**
28
- * 获取值
29
- * @param key
30
- * @param cache 是否从缓存中获取
31
- */
32
- var _proto = ClientCache.prototype;
33
- _proto.get =
34
- /*#__PURE__*/
35
- function () {
36
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, cache) {
37
- var value;
38
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
39
- while (1) switch (_context2.prev = _context2.next) {
40
- case 0:
41
- if (!(!cache && this.cacheMap.has(key))) {
42
- _context2.next = 2;
43
- break;
44
- }
45
- return _context2.abrupt("return", this.cacheMap.get(key));
46
- case 2:
47
- _context2.prev = 2;
48
- _context2.next = 5;
49
- return this.loadData(key);
50
- case 5:
51
- value = _context2.sent;
52
- this.cacheMap.set(key, value);
53
- return _context2.abrupt("return", value);
54
- case 10:
55
- _context2.prev = 10;
56
- _context2.t0 = _context2["catch"](2);
57
- console.log("\u7F13\u5B58 {" + this.name + "} \u83B7\u53D6\u503C\u5931\u8D25!\u5C06\u8FD4\u56DEnull", _context2.t0);
58
- this.cacheMap.set(key, null);
59
- return _context2.abrupt("return", null);
60
- case 15:
61
- case "end":
62
- return _context2.stop();
63
- }
64
- }, _callee2, this, [[2, 10]]);
65
- }));
66
- function get(_x, _x2) {
67
- return _get.apply(this, arguments);
68
- }
69
- return get;
70
- }()
71
- /**
72
- * 重新加载
73
- * @param key
74
- */
75
- ;
76
- _proto.reload =
77
- /*#__PURE__*/
78
- function () {
79
- var _reload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(key) {
80
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
81
- while (1) switch (_context3.prev = _context3.next) {
82
- case 0:
83
- return _context3.abrupt("return", this.get(key, false));
84
- case 1:
85
- case "end":
86
- return _context3.stop();
87
- }
88
- }, _callee3, this);
89
- }));
90
- function reload(_x3) {
91
- return _reload.apply(this, arguments);
92
- }
93
- return reload;
94
- }()
95
- /**
96
- * 手动设置
97
- * @param key
98
- * @param value
99
- */
100
- ;
101
- _proto.set = function set(key, value) {
102
- this.cacheMap.set(key, value);
103
- }
104
-
105
- /**
106
- * 删除某个缓存
107
- * @param key
108
- */;
109
- _proto["delete"] = function _delete(key) {
110
- this.cacheMap["delete"](key);
111
- }
112
-
113
- /**
114
- * 删除全部缓存
115
- */;
116
- _proto.clear = function clear() {
117
- this.cacheMap.clear();
118
- };
119
- return ClientCache;
120
- }();
@@ -1,36 +0,0 @@
1
- export declare type LoadData = (key: string) => Promise<any>;
2
- export declare class ClientCache {
3
- private cacheMap;
4
- name: string;
5
- loadData: LoadData;
6
- constructor(options: {
7
- name: string;
8
- loadData: LoadData;
9
- });
10
- /**
11
- * 获取值
12
- * @param key
13
- * @param cache 是否从缓存中获取
14
- */
15
- get(key: string, cache?: boolean): Promise<any>;
16
- /**
17
- * 重新加载
18
- * @param key
19
- */
20
- reload(key: string): Promise<any>;
21
- /**
22
- * 手动设置
23
- * @param key
24
- * @param value
25
- */
26
- set(key: string, value: any): void;
27
- /**
28
- * 删除某个缓存
29
- * @param key
30
- */
31
- delete(key: string): void;
32
- /**
33
- * 删除全部缓存
34
- */
35
- clear(): void;
36
- }