typespeed 2.0.14 → 2.0.18

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 (220) hide show
  1. package/dist/core.decorator.js +0 -1
  2. package/dist/database.decorator.js +0 -1
  3. package/dist/default/express-server.class.js +0 -1
  4. package/dist/default/log-default.class.js +0 -1
  5. package/dist/default/node-cache.class.js +0 -1
  6. package/dist/default/rabbitmq.class.js +0 -1
  7. package/dist/default/read-write-db.class.js +0 -1
  8. package/dist/default/redis.class.js +0 -1
  9. package/dist/factory/cache-factory.class.js +0 -1
  10. package/dist/factory/data-source-factory.class.js +0 -1
  11. package/dist/factory/log-factory.class.js +0 -1
  12. package/dist/factory/server-factory.class.js +0 -1
  13. package/dist/route.decorator.js +0 -1
  14. package/dist/scaffold/command.js +0 -1
  15. package/dist/typespeed.d.ts +325 -13
  16. package/dist/typespeed.js +0 -1
  17. package/package.json +2 -2
  18. package/src/typespeed.d.ts +325 -0
  19. package/test/node_modules/.package-lock.json +112 -4
  20. package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +17 -0
  21. package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +30 -0
  22. package/test/node_modules/@acuminous/bitsyntax/LICENSE +6 -0
  23. package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +21 -0
  24. package/test/node_modules/@acuminous/bitsyntax/Makefile +15 -0
  25. package/test/node_modules/@acuminous/bitsyntax/README.md +308 -0
  26. package/test/node_modules/@acuminous/bitsyntax/index.js +10 -0
  27. package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +303 -0
  28. package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +142 -0
  29. package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +67 -0
  30. package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +232 -0
  31. package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +32 -0
  32. package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +1173 -0
  33. package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +119 -0
  34. package/test/node_modules/@acuminous/bitsyntax/package.json +36 -0
  35. package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +50 -0
  36. package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +193 -0
  37. package/test/node_modules/@types/node/README.md +1 -1
  38. package/test/node_modules/@types/node/buffer.d.ts +5 -2
  39. package/test/node_modules/@types/node/child_process.d.ts +27 -0
  40. package/test/node_modules/@types/node/globals.d.ts +1 -0
  41. package/test/node_modules/@types/node/package.json +2 -2
  42. package/test/node_modules/@types/node/test.d.ts +43 -20
  43. package/test/node_modules/@types/node/ts4.8/buffer.d.ts +5 -2
  44. package/test/node_modules/@types/node/ts4.8/child_process.d.ts +27 -0
  45. package/test/node_modules/@types/node/ts4.8/globals.d.ts +1 -0
  46. package/test/node_modules/@types/node/ts4.8/test.d.ts +43 -19
  47. package/test/node_modules/@types/node/ts4.8/url.d.ts +3 -3
  48. package/test/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  49. package/test/node_modules/@types/node/url.d.ts +3 -3
  50. package/test/node_modules/@types/node/util.d.ts +1 -1
  51. package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  52. package/test/node_modules/amqplib/.github/workflows/test.yml +38 -0
  53. package/test/node_modules/amqplib/CHANGELOG.md +430 -0
  54. package/test/node_modules/amqplib/LICENSE +6 -0
  55. package/test/node_modules/amqplib/LICENSE-MIT +21 -0
  56. package/test/node_modules/amqplib/Makefile +47 -0
  57. package/test/node_modules/amqplib/README.md +157 -0
  58. package/test/node_modules/amqplib/bin/generate-defs.js +722 -0
  59. package/test/node_modules/amqplib/callback_api.js +22 -0
  60. package/test/node_modules/amqplib/channel_api.js +16 -0
  61. package/test/node_modules/amqplib/examples/headers.js +42 -0
  62. package/test/node_modules/amqplib/examples/receive_generator.js +39 -0
  63. package/test/node_modules/amqplib/examples/send_generators.js +42 -0
  64. package/test/node_modules/amqplib/examples/ssl.js +64 -0
  65. package/test/node_modules/amqplib/examples/tutorials/README.md +93 -0
  66. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +28 -0
  67. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +30 -0
  68. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +27 -0
  69. package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +27 -0
  70. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +30 -0
  71. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +36 -0
  72. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +56 -0
  73. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +55 -0
  74. package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +49 -0
  75. package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +45 -0
  76. package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +29 -0
  77. package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +35 -0
  78. package/test/node_modules/amqplib/examples/tutorials/emit_log.js +19 -0
  79. package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +20 -0
  80. package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +19 -0
  81. package/test/node_modules/amqplib/examples/tutorials/new_task.js +18 -0
  82. package/test/node_modules/amqplib/examples/tutorials/package.json +16 -0
  83. package/test/node_modules/amqplib/examples/tutorials/receive.js +21 -0
  84. package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +28 -0
  85. package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +44 -0
  86. package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +43 -0
  87. package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +52 -0
  88. package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +39 -0
  89. package/test/node_modules/amqplib/examples/tutorials/send.js +23 -0
  90. package/test/node_modules/amqplib/examples/tutorials/worker.js +28 -0
  91. package/test/node_modules/amqplib/examples/waitForConfirms.js +22 -0
  92. package/test/node_modules/amqplib/lib/api_args.js +314 -0
  93. package/test/node_modules/amqplib/lib/bitset.js +130 -0
  94. package/test/node_modules/amqplib/lib/callback_model.js +327 -0
  95. package/test/node_modules/amqplib/lib/channel.js +499 -0
  96. package/test/node_modules/amqplib/lib/channel_model.js +302 -0
  97. package/test/node_modules/amqplib/lib/codec.js +321 -0
  98. package/test/node_modules/amqplib/lib/connect.js +189 -0
  99. package/test/node_modules/amqplib/lib/connection.js +663 -0
  100. package/test/node_modules/amqplib/lib/credentials.js +42 -0
  101. package/test/node_modules/amqplib/lib/defs.js +4966 -0
  102. package/test/node_modules/amqplib/lib/error.js +24 -0
  103. package/test/node_modules/amqplib/lib/format.js +40 -0
  104. package/test/node_modules/amqplib/lib/frame.js +113 -0
  105. package/test/node_modules/amqplib/lib/heartbeat.js +89 -0
  106. package/test/node_modules/amqplib/lib/mux.js +129 -0
  107. package/test/node_modules/amqplib/package.json +37 -0
  108. package/test/node_modules/amqplib/test/bitset.js +69 -0
  109. package/test/node_modules/amqplib/test/callback_api.js +312 -0
  110. package/test/node_modules/amqplib/test/channel.js +621 -0
  111. package/test/node_modules/amqplib/test/channel_api.js +596 -0
  112. package/test/node_modules/amqplib/test/codec.js +237 -0
  113. package/test/node_modules/amqplib/test/connect.js +197 -0
  114. package/test/node_modules/amqplib/test/connection.js +390 -0
  115. package/test/node_modules/amqplib/test/data.js +254 -0
  116. package/test/node_modules/amqplib/test/frame.js +198 -0
  117. package/test/node_modules/amqplib/test/mux.js +204 -0
  118. package/test/node_modules/amqplib/test/util.js +219 -0
  119. package/test/node_modules/buffer-more-ints/.travis.yml +6 -0
  120. package/test/node_modules/buffer-more-ints/LICENSE +19 -0
  121. package/test/node_modules/buffer-more-ints/README.md +69 -0
  122. package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +183 -0
  123. package/test/node_modules/buffer-more-ints/buffer-more-ints.js +432 -0
  124. package/test/node_modules/buffer-more-ints/package.json +19 -0
  125. package/test/node_modules/buffer-more-ints/polyfill.js +71 -0
  126. package/test/node_modules/core-util-is/LICENSE +19 -0
  127. package/test/node_modules/core-util-is/README.md +3 -0
  128. package/test/node_modules/core-util-is/lib/util.js +107 -0
  129. package/test/node_modules/core-util-is/package.json +38 -0
  130. package/test/node_modules/debug/LICENSE +20 -0
  131. package/test/node_modules/debug/README.md +481 -0
  132. package/test/node_modules/debug/package.json +59 -0
  133. package/test/node_modules/debug/src/browser.js +269 -0
  134. package/test/node_modules/debug/src/common.js +274 -0
  135. package/test/node_modules/debug/src/index.js +10 -0
  136. package/test/node_modules/debug/src/node.js +263 -0
  137. package/test/node_modules/inherits/LICENSE +16 -0
  138. package/test/node_modules/inherits/README.md +42 -0
  139. package/test/node_modules/inherits/inherits.js +9 -0
  140. package/test/node_modules/inherits/inherits_browser.js +27 -0
  141. package/test/node_modules/inherits/package.json +29 -0
  142. package/test/node_modules/isarray/README.md +54 -0
  143. package/test/node_modules/isarray/build/build.js +209 -0
  144. package/test/node_modules/isarray/component.json +19 -0
  145. package/test/node_modules/isarray/index.js +3 -0
  146. package/test/node_modules/isarray/package.json +25 -0
  147. package/test/node_modules/ms/index.js +162 -0
  148. package/test/node_modules/ms/license.md +21 -0
  149. package/test/node_modules/ms/package.json +37 -0
  150. package/test/node_modules/ms/readme.md +60 -0
  151. package/test/node_modules/querystringify/LICENSE +22 -0
  152. package/test/node_modules/querystringify/README.md +61 -0
  153. package/test/node_modules/querystringify/index.js +118 -0
  154. package/test/node_modules/querystringify/package.json +38 -0
  155. package/test/node_modules/readable-stream/LICENSE +18 -0
  156. package/test/node_modules/readable-stream/README.md +15 -0
  157. package/test/node_modules/readable-stream/duplex.js +1 -0
  158. package/test/node_modules/readable-stream/float.patch +923 -0
  159. package/test/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
  160. package/test/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
  161. package/test/node_modules/readable-stream/lib/_stream_readable.js +951 -0
  162. package/test/node_modules/readable-stream/lib/_stream_transform.js +209 -0
  163. package/test/node_modules/readable-stream/lib/_stream_writable.js +477 -0
  164. package/test/node_modules/readable-stream/package.json +32 -0
  165. package/test/node_modules/readable-stream/passthrough.js +1 -0
  166. package/test/node_modules/readable-stream/readable.js +10 -0
  167. package/test/node_modules/readable-stream/transform.js +1 -0
  168. package/test/node_modules/readable-stream/writable.js +1 -0
  169. package/test/node_modules/requires-port/.travis.yml +19 -0
  170. package/test/node_modules/requires-port/LICENSE +22 -0
  171. package/test/node_modules/requires-port/README.md +47 -0
  172. package/test/node_modules/requires-port/index.js +38 -0
  173. package/test/node_modules/requires-port/package.json +47 -0
  174. package/test/node_modules/requires-port/test.js +98 -0
  175. package/test/node_modules/safe-buffer/LICENSE +21 -0
  176. package/test/node_modules/safe-buffer/README.md +584 -0
  177. package/test/node_modules/safe-buffer/index.d.ts +187 -0
  178. package/test/node_modules/safe-buffer/index.js +62 -0
  179. package/test/node_modules/safe-buffer/package.json +37 -0
  180. package/test/node_modules/string_decoder/LICENSE +20 -0
  181. package/test/node_modules/string_decoder/README.md +7 -0
  182. package/test/node_modules/string_decoder/index.js +221 -0
  183. package/test/node_modules/string_decoder/package.json +25 -0
  184. package/test/node_modules/url-parse/LICENSE +22 -0
  185. package/test/node_modules/url-parse/README.md +153 -0
  186. package/test/node_modules/url-parse/dist/url-parse.js +755 -0
  187. package/test/node_modules/url-parse/dist/url-parse.min.js +1 -0
  188. package/test/node_modules/url-parse/dist/url-parse.min.js.map +1 -0
  189. package/test/node_modules/url-parse/index.js +589 -0
  190. package/test/node_modules/url-parse/package.json +49 -0
  191. package/tsconfig.json +4 -3
  192. package/dist/core.decorator.d.ts +0 -18
  193. package/dist/core.decorator.js.map +0 -1
  194. package/dist/database.decorator.d.ts +0 -24
  195. package/dist/database.decorator.js.map +0 -1
  196. package/dist/default/express-server.class.d.ts +0 -15
  197. package/dist/default/express-server.class.js.map +0 -1
  198. package/dist/default/log-default.class.d.ts +0 -6
  199. package/dist/default/log-default.class.js.map +0 -1
  200. package/dist/default/node-cache.class.d.ts +0 -13
  201. package/dist/default/node-cache.class.js.map +0 -1
  202. package/dist/default/rabbitmq.class.d.ts +0 -9
  203. package/dist/default/rabbitmq.class.js.map +0 -1
  204. package/dist/default/read-write-db.class.d.ts +0 -10
  205. package/dist/default/read-write-db.class.js.map +0 -1
  206. package/dist/default/redis.class.d.ts +0 -5
  207. package/dist/default/redis.class.js.map +0 -1
  208. package/dist/factory/cache-factory.class.d.ts +0 -7
  209. package/dist/factory/cache-factory.class.js.map +0 -1
  210. package/dist/factory/data-source-factory.class.d.ts +0 -4
  211. package/dist/factory/data-source-factory.class.js.map +0 -1
  212. package/dist/factory/log-factory.class.d.ts +0 -4
  213. package/dist/factory/log-factory.class.js.map +0 -1
  214. package/dist/factory/server-factory.class.d.ts +0 -6
  215. package/dist/factory/server-factory.class.js.map +0 -1
  216. package/dist/route.decorator.d.ts +0 -8
  217. package/dist/route.decorator.js.map +0 -1
  218. package/dist/scaffold/command.d.ts +0 -2
  219. package/dist/scaffold/command.js.map +0 -1
  220. package/dist/typespeed.js.map +0 -1
@@ -182,4 +182,3 @@ function schedule(cronTime) {
182
182
  };
183
183
  }
184
184
  exports.schedule = schedule;
185
- //# sourceMappingURL=core.decorator.js.map
@@ -332,4 +332,3 @@ class Model {
332
332
  }
333
333
  }
334
334
  exports.Model = Model;
335
- //# sourceMappingURL=database.decorator.js.map
@@ -145,4 +145,3 @@ __decorate([
145
145
  __metadata("design:returntype", server_factory_class_1.default)
146
146
  ], ExpressServer.prototype, "getSever", null);
147
147
  exports.default = ExpressServer;
148
- //# sourceMappingURL=express-server.class.js.map
@@ -29,4 +29,3 @@ __decorate([
29
29
  __metadata("design:returntype", log_factory_class_1.default)
30
30
  ], LogDefault.prototype, "createLog", null);
31
31
  exports.default = LogDefault;
32
- //# sourceMappingURL=log-default.class.js.map
@@ -48,4 +48,3 @@ __decorate([
48
48
  __metadata("design:returntype", cache_factory_class_1.default)
49
49
  ], NodeCache.prototype, "getNodeCache", null);
50
50
  exports.default = NodeCache;
51
- //# sourceMappingURL=node-cache.class.js.map
@@ -66,4 +66,3 @@ function rabbitListener(queue) {
66
66
  };
67
67
  }
68
68
  exports.rabbitListener = rabbitListener;
69
- //# sourceMappingURL=rabbitmq.class.js.map
@@ -63,4 +63,3 @@ __decorate([
63
63
  __metadata("design:returntype", data_source_factory_class_1.default)
64
64
  ], ReadWriteDb.prototype, "getDataSource", null);
65
65
  exports.default = ReadWriteDb;
66
- //# sourceMappingURL=read-write-db.class.js.map
@@ -29,4 +29,3 @@ __decorate([
29
29
  __metadata("design:returntype", Redis)
30
30
  ], Redis.prototype, "getRedis", null);
31
31
  exports.default = Redis;
32
- //# sourceMappingURL=redis.class.js.map
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class CacheFactory {
4
4
  }
5
5
  exports.default = CacheFactory;
6
- //# sourceMappingURL=cache-factory.class.js.map
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class DataSourceFactory {
4
4
  }
5
5
  exports.default = DataSourceFactory;
6
- //# sourceMappingURL=data-source-factory.class.js.map
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class LogFactory {
4
4
  }
5
5
  exports.default = LogFactory;
6
- //# sourceMappingURL=log-factory.class.js.map
@@ -6,4 +6,3 @@ class ServerFactory {
6
6
  }
7
7
  }
8
8
  exports.default = ServerFactory;
9
- //# sourceMappingURL=server-factory.class.js.map
@@ -84,4 +84,3 @@ const postMapping = (value) => mapperFunction("post", value);
84
84
  exports.postMapping = postMapping;
85
85
  const requestMapping = (value) => mapperFunction("all", value);
86
86
  exports.requestMapping = requestMapping;
87
- //# sourceMappingURL=route.decorator.js.map
@@ -33,4 +33,3 @@ function mkFile(fileName, targetPath, appName) {
33
33
  const fileContents = fs.readFileSync(tplPath + "/" + fileName + ".tpl", "utf-8");
34
34
  fs.writeFileSync(targetPath + "/" + fileName, fileContents.replace("###appName###", appName));
35
35
  }
36
- //# sourceMappingURL=command.js.map
@@ -1,13 +1,325 @@
1
- export * from "./core.decorator";
2
- export * from "./route.decorator";
3
- export * from "./database.decorator";
4
- export { default as LogFactory } from "./factory/log-factory.class";
5
- export { default as CacheFactory } from "./factory/cache-factory.class";
6
- export { default as DataSourceFactory } from "./factory/data-source-factory.class";
7
- export { default as ServerFactory } from "./factory/server-factory.class";
8
- export { default as ExpressServer } from "./default/express-server.class";
9
- export { default as LogDefault } from "./default/log-default.class";
10
- export { default as NodeCache } from "./default/node-cache.class";
11
- export { default as Redis } from "./default/redis.class";
12
- export { default as ReadWriteDb } from "./default/read-write-db.class";
13
- export * from "./default/rabbitmq.class";
1
+ import * as express from "express";
2
+ import IoRedis from "ioredis";
3
+ import "reflect-metadata";
4
+
5
+ /**设置路由中间件 */
6
+ declare function setRouter(app: express.Application): void;
7
+ /**上传文件装饰器,装饰页面具备解析上传文件的能力 */
8
+ declare function upload(target: any, propertyKey: string): void;
9
+ /**
10
+ * 页面支持 JWT 鉴权能力
11
+ * @param jwtConfig jwt 配置
12
+ */
13
+ declare function jwt(jwtConfig: any): (target: any, propertyKey: string) => void;
14
+ /**
15
+ * GET 请求装饰器
16
+ * @param value 请求路径
17
+ */
18
+ declare const getMapping: (value: string) => (target: any, propertyKey: string) => void;
19
+ /**
20
+ * POST 请求装饰器
21
+ * @param value 请求路径
22
+ */
23
+ declare const postMapping: (value: string) => (target: any, propertyKey: string) => void;
24
+ /**
25
+ * 请求装饰器,不区分请求类型
26
+ * @param value 请求路径
27
+ */
28
+ declare const requestMapping: (value: string) => (target: any, propertyKey: string) => void;
29
+ /**
30
+ * INSERT 装饰器
31
+ * 将方法作为 INSERT SQL 使用
32
+ * @param sql INSERT SQL 语句
33
+ */
34
+ declare function insert(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
35
+ /**
36
+ * UPDATE 装饰器
37
+ * 将方法作为 UPDATE SQL 使用
38
+ * @param sql UPDATE SQL 语句
39
+ */
40
+ declare function update(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
41
+ /**
42
+ * DELETE 装饰器
43
+ * 将方法作为 DELETE SQL 使用
44
+ * @param sql DELETE SQL 语句
45
+ */
46
+ declare function remove(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
47
+ /**
48
+ * SELECT 装饰器
49
+ * 将方法作为 SELECT SQL 使用
50
+ * @param sql SELECT SQL 语句
51
+ */
52
+ declare function select(sql: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
53
+ /**
54
+ * SELECT 结果类型装饰器,和 @select 配合使用
55
+ * @param dataClass 结果类型
56
+ */
57
+ declare function resultType(dataClass: any): (target: any, propertyKey: string) => void;
58
+ /**
59
+ * SQL 参数装饰器,标注 SQL 语句的绑定参数值,和 @select @insert @update @remove 配合使用
60
+ * @param name 参数在 SQL 语句内的标记值
61
+ */
62
+ declare function param(name: string): (target: any, propertyKey: string | symbol, parameterIndex: number) => void;
63
+ /**
64
+ * SELECT 缓存装饰器,自动缓存 SELECT 查询结果,和 @select 配合使用
65
+ * 当执行 @insert @update @remove 时,会自动清除缓存。
66
+ * @param ttl 缓存时间,单位秒
67
+ */
68
+ declare function cache(ttl: number): (target: any, propertyKey: string) => void;
69
+ /**模型数据操作类 */
70
+ declare class Model {
71
+ /**分页数据 */
72
+ page: any;
73
+ private table;
74
+ constructor(table?: string);
75
+ /**
76
+ * 查询多条数据
77
+ * @param conditions 查询条件,支持对象和字符串
78
+ * @param sort 排序字段
79
+ * @param fields 定义返回字段
80
+ * @param limit 限制返回数据条数
81
+ */
82
+ findAll<T>(conditions: object | string, sort?: string | object, fields?: string | [string], limit?: number | object): Promise<T[]>;
83
+ /**
84
+ * 插入数据,支持单条或多条数据同时插入
85
+ * @param rows 插入数据,支持对象和数组;对象为单条数据,数组为多条数据。
86
+ */
87
+ create(rows: any): Promise<number>;
88
+ /**
89
+ * 查询单条数据
90
+ * @param conditions 查询条件,支持对象和字符串
91
+ * @param sort 排序字段
92
+ * @param fields 定义返回字段
93
+ */
94
+ find<T>(conditions: any, sort: any, fields?: string): Promise<T>;
95
+ /**
96
+ * 更新数据
97
+ * @param conditions 更新条件,支持对象和字符串,符合条件的数据将被更新
98
+ * @param fieldToValues 更新字段和值
99
+ */
100
+ update(conditions: any, fieldToValues: any): Promise<number>;
101
+ /**
102
+ * 删除数据
103
+ * @param conditions 删除条件,支持对象和字符串,符合条件的数据将被删除
104
+ */
105
+ delete(conditions: any): Promise<number>;
106
+ /**
107
+ * 查询数据条数,返回符合条件的记录条数
108
+ * @param conditions 查询条件,支持对象和字符串
109
+ */
110
+ findCount(conditions: any): Promise<number>;
111
+ /**
112
+ * 增加字段值
113
+ * @param conditions 查询条件,支持对象和字符串,符合条件的数据将被增加
114
+ * @param field 需要增加的字段
115
+ * @param optval 增加数量值,默认为 1
116
+ */
117
+ incr(conditions: any, field: any, optval?: number): Promise<number>;
118
+ /**
119
+ * 减少字段值
120
+ * @param conditions 查询条件,支持对象和字符串,符合条件的数据将被减少
121
+ * @param field 需要减少的字段
122
+ * @param optval 减少数量值,默认为 1
123
+ */
124
+ decr(conditions: any, field: any, optval?: number): Promise<number>;
125
+ /**
126
+ * 计算分页数据
127
+ * @param page 当前页码
128
+ * @param total 记录总条数
129
+ * @param pageSize 每页显示条数
130
+ * @param scope 分页显示页码数量
131
+ */
132
+ pager(page: any, total: any, pageSize?: number, scope?: number): any;
133
+ private where;
134
+ private range;
135
+ }
136
+ /**
137
+ * 应用程序入口装饰器
138
+ *
139
+ * 被装饰的类将作为应用程序入口,框架将启动该类的 main 方法
140
+ */
141
+ declare function app<T extends {
142
+ new (...args: any[]): {};
143
+ }>(constructor: T): void;
144
+ /**获取配置文件中的配置项 */
145
+ declare function config(node: string): any;
146
+ /**组件装饰器,被装饰的类可以通过 @autoware 取得实例 */
147
+ declare function component(constructorFunction: any): void;
148
+ /**获取组件实例函数,返回结果同 @autoware */
149
+ declare function getComponent(constructorFunction: any): any;
150
+ /**提供对象装饰器,框架将使用 @bean 装饰的方法来获取对象实例 */
151
+ declare function bean(target: any, propertyKey: string): void;
152
+ /**获取对象实例函数,返回结果由 @bean 装饰的方法提供 */
153
+ declare function getBean(mappingClass: Function): any;
154
+ /**配置装饰器,装饰类成员变量值,获取配置文件中的配置项 */
155
+ declare function value(configPath: string): any;
156
+ /**自动装配装饰器,无参数版本,被装饰的类成员变量将自动注入实例 */
157
+ declare function autoware(target: any, propertyKey: string): void;
158
+ /**自动装配装饰器,带参数版本,可输入参数作为实例初始化参数,被装饰的类成员变量将自动注入实例 */
159
+ declare function resource(...args: any[]): any;
160
+ /**日志函数,输出打印日志 */
161
+ declare function log(message?: any, ...optionalParams: any[]): void;
162
+ /**错误日志函数,输出打印错误日志 */
163
+ declare function error(message?: any, ...optionalParams: any[]): void;
164
+ /**路由页面前置执行装饰器,参数指向路由页面方法,被装饰的方法将在路由页面之前执行 */
165
+ declare function before(constructorFunction: any, methodName: string): (target: any, propertyKey: string) => void;
166
+ /**路由页面后置执行装饰器,参数指向路由页面方法,被装饰的方法将在路由页面之后执行 */
167
+ declare function after(constructorFunction: any, methodName: string): (target: any, propertyKey: string) => void;
168
+ /**定时程序装饰器,参数支持 crontab 格式字符串,可根据参数定时执行被装饰的方法 */
169
+ declare function schedule(cronTime: string | Date): (target: any, propertyKey: string) => void;
170
+ /**RabbitMQ 监听装饰器,参数是监听的队列名称,当接受到消息时将执行被装饰方法 */
171
+ declare function rabbitListener(queue: string): (target: any, propertyKey: string) => void;
172
+ /**框架 Web 服务工厂类 */
173
+ declare abstract class ServerFactory {
174
+ /**Web 服务实例 */
175
+ app: any;
176
+ /**中间件列表 */
177
+ protected middlewareList: Array<any>;
178
+ /**
179
+ * 设置一个中间件
180
+ * @param middleware 中间件
181
+ */
182
+ abstract setMiddleware(middleware: any): any;
183
+ /**
184
+ * 启动 Web 服务
185
+ * @param port 端口号
186
+ */
187
+ abstract start(port: number): any;
188
+ }
189
+ /**日志工厂类 */
190
+ declare abstract class LogFactory {
191
+ /**
192
+ * 日志打印方法
193
+ * @param message 日志内容
194
+ */
195
+ abstract log(message?: any, ...optionalParams: any[]): void;
196
+ /**
197
+ * 错误日志打印方法
198
+ * @param message 日志内容
199
+ */
200
+ abstract error(message?: any, ...optionalParams: any[]): void;
201
+ }
202
+ /**数据源工厂类 */
203
+ declare abstract class DataSourceFactory {
204
+ /**获取读库连接 */
205
+ abstract readConnection(): any;
206
+ /**获取写库连接 */
207
+ abstract writeConnection(): any;
208
+ }
209
+ /**缓存工厂类 */
210
+ declare abstract class CacheFactory {
211
+ /**
212
+ * 获取缓存
213
+ * @param key 缓存键
214
+ */
215
+ abstract get(key: string): any;
216
+ /**
217
+ * 设置缓存
218
+ * @param key 缓存键
219
+ * @param value 缓存值
220
+ * @param expire 过期时间,单位秒
221
+ */
222
+ abstract set(key: string, value: any, expire?: number): void;
223
+ /**
224
+ * 删除缓存
225
+ * @param key 缓存键
226
+ */
227
+ abstract del(key: string): void;
228
+ /**
229
+ * 判断缓存是否存在
230
+ * @param key 缓存键
231
+ * @returns 是否存在
232
+ */
233
+ abstract has(key: string): boolean;
234
+ /**清空缓存 */
235
+ abstract flush(): void;
236
+ }
237
+ /**Redis 操作类 */
238
+ declare class Redis extends IoRedis {
239
+ /**获取 Redis 实例 */
240
+ getRedis(): Redis;
241
+ constructor(config: any);
242
+ }
243
+ /**读写数据源实现类 */
244
+ declare class ReadWriteDb extends DataSourceFactory {
245
+ private readonly readSession;
246
+ private readonly writeSession;
247
+ /**获取数据源实例 */
248
+ getDataSource(): DataSourceFactory;
249
+ constructor();
250
+ private getConnectionByConfig;
251
+ readConnection(): any;
252
+ writeConnection(): any;
253
+ }
254
+ /**RabbitMQ 操作类 */
255
+ declare class RabbitMQ {
256
+ /**获取 RabbitMQ 实例 */
257
+ getRabbitMQ(): RabbitMQ;
258
+ /**
259
+ * 发送消息到交换机
260
+ * @alias publish
261
+ * @param exchange 交换机名称
262
+ * @param routingKey 交换机路由名称,默认为 ''
263
+ * @param message 发送的消息
264
+ */
265
+ publishMessageToExchange(exchange: string, routingKey: string, message: string): Promise<void>;
266
+ /**
267
+ * 发送消息到队列
268
+ * @alias send
269
+ * @param queue 队列名称
270
+ * @param message 发送的消息
271
+ */
272
+ sendMessageToQueue(queue: string, message: string): Promise<void>;
273
+ /**
274
+ * 发送消息到交换机
275
+ * @param exchange 交换机名称
276
+ * @param routingKey 交换机路由名称,默认为 ''
277
+ * @param message 发送的消息
278
+ */
279
+ publish(exchange: string, routingKey: string, message: string): Promise<void>;
280
+ /**
281
+ * 发送消息到队列
282
+ * @param queue 队列名称
283
+ * @param message 发送的消息
284
+ */
285
+ send(queue: string, message: string): Promise<void>;
286
+ }
287
+ /**缓存实现类 */
288
+ declare class NodeCache extends CacheFactory {
289
+ private NodeCache;
290
+ private nodeCacheOptions;
291
+ private config;
292
+ constructor();
293
+ /**获取缓存对象 */
294
+ getNodeCache(): CacheFactory;
295
+ get(key: string): any;
296
+ set(key: string, value: any, expire?: number): void;
297
+ del(key: string): void;
298
+ has(key: string): boolean;
299
+ flush(): void;
300
+ }
301
+ /**日志实现类 */
302
+ declare class LogDefault extends LogFactory {
303
+ /**获取日志实例 */
304
+ createLog(): LogFactory;
305
+ log(message?: any, ...optionalParams: any[]): void;
306
+ error(message?: any, ...optionalParams: any[]): void;
307
+ }
308
+ /**Web 服务实现类,使用 ExpressJS 提供 Web 服务 */
309
+ declare class ExpressServer extends ServerFactory {
310
+ view: string;
311
+ private static;
312
+ private favicon;
313
+ private compression;
314
+ private cookieConfig;
315
+ private session;
316
+ private redisConfig;
317
+ private redisClient;
318
+ /**获取 Web 服务实例 */
319
+ getSever(): ServerFactory;
320
+ setMiddleware(middleware: any): void;
321
+ start(port: number): void;
322
+ private setDefaultMiddleware;
323
+ }
324
+
325
+ export { ExpressServer, LogDefault, NodeCache, RabbitMQ, rabbitListener, ReadWriteDb, Redis, CacheFactory, DataSourceFactory, LogFactory, ServerFactory, component, bean, resource, log, app, before, after, value, error, config, autoware, getBean, getComponent, schedule, getMapping, postMapping, requestMapping, setRouter, upload, jwt, insert, update, remove, select, param, resultType, cache, Model };
package/dist/typespeed.js CHANGED
@@ -37,4 +37,3 @@ Object.defineProperty(exports, "Redis", { enumerable: true, get: function () { r
37
37
  var read_write_db_class_1 = require("./default/read-write-db.class");
38
38
  Object.defineProperty(exports, "ReadWriteDb", { enumerable: true, get: function () { return read_write_db_class_1.default; } });
39
39
  __exportStar(require("./default/rabbitmq.class"), exports);
40
- //# sourceMappingURL=typespeed.js.map
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "typespeed",
3
- "version": "2.0.14",
3
+ "version": "2.0.18",
4
4
  "description": "A new Framework for TypeScript.",
5
5
  "author": "speedphp",
6
6
  "license": "MIT License",
7
7
  "scripts": {
8
8
  "build": "tsc -p .",
9
- "postbuild": "cp -r src/default/pages dist/default/pages && cp -r src/scaffold/templates dist/scaffold/templates",
9
+ "postbuild": "cp src/typespeed.d.ts dist/typespeed.d.ts && cp -r src/default/pages dist/default/pages && cp -r src/scaffold/templates dist/scaffold/templates",
10
10
  "prebuild": "rm -rf dist",
11
11
  "prepublishOnly": "npm version patch && npm run build",
12
12
  "upgrade": "npm version minor",