@byted-apaas/server-sdk-node 0.0.2-beta.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.
Files changed (215) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +1 -0
  3. package/application/application.d.ts +27 -0
  4. package/application/application.js +3 -0
  5. package/application/application.js.map +1 -0
  6. package/application/application.ts +40 -0
  7. package/application/function/function.d.ts +14 -0
  8. package/application/function/function.js +22 -0
  9. package/application/function/function.js.map +1 -0
  10. package/application/function/function.ts +37 -0
  11. package/application/impl/common.d.ts +2 -0
  12. package/application/impl/common.js +51 -0
  13. package/application/impl/common.js.map +1 -0
  14. package/application/impl/common.ts +50 -0
  15. package/application/impl/impl.d.ts +16 -0
  16. package/application/impl/impl.js +39 -0
  17. package/application/impl/impl.js.map +1 -0
  18. package/application/impl/impl.ts +48 -0
  19. package/constants/constants.d.ts +10 -0
  20. package/constants/constants.js +14 -0
  21. package/constants/constants.js.map +1 -0
  22. package/constants/constants.ts +12 -0
  23. package/context/context.d.ts +74 -0
  24. package/context/context.js +24 -0
  25. package/context/context.js.map +1 -0
  26. package/context/context.ts +127 -0
  27. package/context/db/db.d.ts +73 -0
  28. package/context/db/db.js +3 -0
  29. package/context/db/db.js.map +1 -0
  30. package/context/db/db.ts +77 -0
  31. package/context/db/impl/IObject.d.ts +251 -0
  32. package/context/db/impl/IObject.js +4 -0
  33. package/context/db/impl/IObject.js.map +1 -0
  34. package/context/db/impl/IObject.ts +244 -0
  35. package/context/db/impl/db.d.ts +61 -0
  36. package/context/db/impl/db.js +87 -0
  37. package/context/db/impl/db.js.map +1 -0
  38. package/context/db/impl/db.ts +95 -0
  39. package/context/db/impl/object.d.ts +92 -0
  40. package/context/db/impl/object.js +523 -0
  41. package/context/db/impl/object.js.map +1 -0
  42. package/context/db/impl/object.ts +628 -0
  43. package/context/db/impl/oql/ioql.d.ts +6 -0
  44. package/context/db/impl/oql/ioql.js +3 -0
  45. package/context/db/impl/oql/ioql.js.map +1 -0
  46. package/context/db/impl/oql/ioql.ts +6 -0
  47. package/context/db/impl/oql/oql.d.ts +8 -0
  48. package/context/db/impl/oql/oql.js +20 -0
  49. package/context/db/impl/oql/oql.js.map +1 -0
  50. package/context/db/impl/oql/oql.ts +22 -0
  51. package/context/db/impl/order.d.ts +9 -0
  52. package/context/db/impl/order.js +14 -0
  53. package/context/db/impl/order.js.map +1 -0
  54. package/context/db/impl/order.ts +16 -0
  55. package/context/db/impl/propertiesStore.d.ts +8 -0
  56. package/context/db/impl/propertiesStore.js +28 -0
  57. package/context/db/impl/propertiesStore.js.map +1 -0
  58. package/context/db/impl/propertiesStore.ts +28 -0
  59. package/context/db/impl/queryBuilder.d.ts +29 -0
  60. package/context/db/impl/queryBuilder.js +77 -0
  61. package/context/db/impl/queryBuilder.js.map +1 -0
  62. package/context/db/impl/queryBuilder.ts +103 -0
  63. package/context/db/impl/transaction/index.d.ts +20 -0
  64. package/context/db/impl/transaction/index.js +276 -0
  65. package/context/db/impl/transaction/index.js.map +1 -0
  66. package/context/db/impl/transaction/index.ts +337 -0
  67. package/context/db/impl/transaction/operation.d.ts +27 -0
  68. package/context/db/impl/transaction/operation.js +70 -0
  69. package/context/db/impl/transaction/operation.js.map +1 -0
  70. package/context/db/impl/transaction/operation.ts +72 -0
  71. package/context/db/impl/transaction.d.ts +67 -0
  72. package/context/db/impl/transaction.js +3 -0
  73. package/context/db/impl/transaction.js.map +1 -0
  74. package/context/db/impl/transaction.ts +76 -0
  75. package/context/globalConfig/globalConfig.d.ts +7 -0
  76. package/context/globalConfig/globalConfig.js +15 -0
  77. package/context/globalConfig/globalConfig.js.map +1 -0
  78. package/context/globalConfig/globalConfig.ts +11 -0
  79. package/context/metadata/components/common.d.ts +6 -0
  80. package/context/metadata/components/common.js +16 -0
  81. package/context/metadata/components/common.js.map +1 -0
  82. package/context/metadata/components/common.ts +19 -0
  83. package/context/metadata/components/components.d.ts +12 -0
  84. package/context/metadata/components/components.js +18 -0
  85. package/context/metadata/components/components.js.map +1 -0
  86. package/context/metadata/components/components.ts +19 -0
  87. package/context/metadata/components/desktop/list.d.ts +16 -0
  88. package/context/metadata/components/desktop/list.js +403 -0
  89. package/context/metadata/components/desktop/list.js.map +1 -0
  90. package/context/metadata/components/desktop/list.ts +457 -0
  91. package/context/metadata/components/desktop/recordDetail.d.ts +11 -0
  92. package/context/metadata/components/desktop/recordDetail.js +52 -0
  93. package/context/metadata/components/desktop/recordDetail.js.map +1 -0
  94. package/context/metadata/components/desktop/recordDetail.ts +64 -0
  95. package/context/metadata/components/mobile/list.d.ts +24 -0
  96. package/context/metadata/components/mobile/list.js +144 -0
  97. package/context/metadata/components/mobile/list.js.map +1 -0
  98. package/context/metadata/components/mobile/list.ts +176 -0
  99. package/context/metadata/metadata.d.ts +61 -0
  100. package/context/metadata/metadata.js +102 -0
  101. package/context/metadata/metadata.js.map +1 -0
  102. package/context/metadata/metadata.ts +175 -0
  103. package/context/metadata/objects/fields.d.ts +130 -0
  104. package/context/metadata/objects/fields.js +333 -0
  105. package/context/metadata/objects/fields.js.map +1 -0
  106. package/context/metadata/objects/fields.ts +454 -0
  107. package/context/metadata/objects/fields.util.d.ts +40 -0
  108. package/context/metadata/objects/fields.util.js +320 -0
  109. package/context/metadata/objects/fields.util.js.map +1 -0
  110. package/context/metadata/objects/fields.util.ts +360 -0
  111. package/context/metadata/objects/objects.d.ts +11 -0
  112. package/context/metadata/objects/objects.js +19 -0
  113. package/context/metadata/objects/objects.js.map +1 -0
  114. package/context/metadata/objects/objects.ts +27 -0
  115. package/context/metadata/types/common.d.ts +6 -0
  116. package/context/metadata/types/common.js +8 -0
  117. package/context/metadata/types/common.js.map +1 -0
  118. package/context/metadata/types/common.ts +10 -0
  119. package/context/metadata/types/components.d.ts +90 -0
  120. package/context/metadata/types/components.js +3 -0
  121. package/context/metadata/types/components.js.map +1 -0
  122. package/context/metadata/types/components.ts +105 -0
  123. package/context/metadata/types/objects.d.ts +226 -0
  124. package/context/metadata/types/objects.js +3 -0
  125. package/context/metadata/types/objects.js.map +1 -0
  126. package/context/metadata/types/objects.ts +251 -0
  127. package/context/msg/msg.d.ts +38 -0
  128. package/context/msg/msg.js +34 -0
  129. package/context/msg/msg.js.map +1 -0
  130. package/context/msg/msg.ts +49 -0
  131. package/context/resources/IResources.d.ts +66 -0
  132. package/context/resources/IResources.js +3 -0
  133. package/context/resources/IResources.js.map +1 -0
  134. package/context/resources/IResources.ts +73 -0
  135. package/context/resources/impl/resources.d.ts +42 -0
  136. package/context/resources/impl/resources.js +149 -0
  137. package/context/resources/impl/resources.js.map +1 -0
  138. package/context/resources/impl/resources.ts +170 -0
  139. package/context/tasks/tasks.d.ts +33 -0
  140. package/context/tasks/tasks.js +140 -0
  141. package/context/tasks/tasks.js.map +1 -0
  142. package/context/tasks/tasks.ts +159 -0
  143. package/data/index.d.ts +27 -0
  144. package/data/index.js +5 -0
  145. package/data/index.js.map +1 -0
  146. package/data/index.ts +30 -0
  147. package/hooks/api.d.ts +61 -0
  148. package/hooks/api.js +328 -0
  149. package/hooks/api.js.map +1 -0
  150. package/hooks/api.ts +341 -0
  151. package/hooks/hooks.d.ts +1 -0
  152. package/hooks/hooks.js +89 -0
  153. package/hooks/hooks.js.map +1 -0
  154. package/hooks/hooks.ts +100 -0
  155. package/kunlun/kunlun.d.ts +55 -0
  156. package/kunlun/kunlun.js +57 -0
  157. package/kunlun/kunlun.js.map +1 -0
  158. package/kunlun/kunlun.ts +69 -0
  159. package/kunlun/operator/IOperator.d.ts +158 -0
  160. package/kunlun/operator/IOperator.js +3 -0
  161. package/kunlun/operator/IOperator.js.map +1 -0
  162. package/kunlun/operator/IOperator.ts +163 -0
  163. package/kunlun/operator/impl/expression.d.ts +47 -0
  164. package/kunlun/operator/impl/expression.js +55 -0
  165. package/kunlun/operator/impl/expression.js.map +1 -0
  166. package/kunlun/operator/impl/expression.ts +71 -0
  167. package/kunlun/operator/impl/logic.d.ts +50 -0
  168. package/kunlun/operator/impl/logic.js +508 -0
  169. package/kunlun/operator/impl/logic.js.map +1 -0
  170. package/kunlun/operator/impl/logic.ts +595 -0
  171. package/kunlun/operator/impl/logicV2.d.ts +58 -0
  172. package/kunlun/operator/impl/logicV2.js +201 -0
  173. package/kunlun/operator/impl/logicV2.js.map +1 -0
  174. package/kunlun/operator/impl/logicV2.ts +254 -0
  175. package/kunlun/operator/impl/operator.d.ts +179 -0
  176. package/kunlun/operator/impl/operator.js +221 -0
  177. package/kunlun/operator/impl/operator.js.map +1 -0
  178. package/kunlun/operator/impl/operator.ts +255 -0
  179. package/kunlun/operator/impl/operatorV2.d.ts +180 -0
  180. package/kunlun/operator/impl/operatorV2.js +217 -0
  181. package/kunlun/operator/impl/operatorV2.js.map +1 -0
  182. package/kunlun/operator/impl/operatorV2.ts +249 -0
  183. package/lib/core.d.ts +4 -0
  184. package/lib/core.js +18 -0
  185. package/lib/core.js.map +1 -0
  186. package/lib/core.ts +4 -0
  187. package/package.json +50 -0
  188. package/request/common.d.ts +13 -0
  189. package/request/common.js +88 -0
  190. package/request/common.js.map +1 -0
  191. package/request/common.ts +91 -0
  192. package/request/constants.d.ts +10 -0
  193. package/request/constants.js +26 -0
  194. package/request/constants.js.map +1 -0
  195. package/request/constants.ts +25 -0
  196. package/request/faasinfra.d.ts +8 -0
  197. package/request/faasinfra.js +359 -0
  198. package/request/faasinfra.js.map +1 -0
  199. package/request/faasinfra.ts +393 -0
  200. package/request/innerapi.d.ts +67 -0
  201. package/request/innerapi.js +1411 -0
  202. package/request/innerapi.js.map +1 -0
  203. package/request/innerapi.ts +1645 -0
  204. package/request/interface.d.ts +95 -0
  205. package/request/interface.js +40 -0
  206. package/request/interface.js.map +1 -0
  207. package/request/interface.ts +166 -0
  208. package/request/openapi.d.ts +69 -0
  209. package/request/openapi.js +1013 -0
  210. package/request/openapi.js.map +1 -0
  211. package/request/openapi.ts +1220 -0
  212. package/types/types.d.ts +79 -0
  213. package/types/types.js +3 -0
  214. package/types/types.js.map +1 -0
  215. package/types/types.ts +105 -0
@@ -0,0 +1,73 @@
1
+ import { Stream } from "stream";
2
+ import { _KunlunOpenSDKFile } from "./impl/resources";
3
+ import { UploadFileResp } from "../../request/interface";
4
+
5
+ export interface _FileInfo {
6
+ id: string;
7
+ }
8
+
9
+ export interface _IKunlunFile {
10
+ /**
11
+ * 上传文件
12
+ * @param filePath 文件路径
13
+ * @param expire 文件过期时间,可选,单位:秒
14
+ */
15
+ upload(filePath: string, expire?: number): Promise<UploadFileResp>;
16
+ /**
17
+ * 上传文件
18
+ * @param stream 文件流
19
+ * @param expire 文件过期时间,可选,单位:秒
20
+ */
21
+ upload(stream: Stream, expire?: number): Promise<UploadFileResp>;
22
+ /**
23
+ * 下载文件
24
+ * @param fileToken 文件令牌
25
+ */
26
+ download(fileToken: string): Promise<Buffer>;
27
+
28
+ /**
29
+ * 下载文件
30
+ * @param fileToken 文件令牌
31
+ * @param filePath 文件保存的路径
32
+ */
33
+ download(fileToken: string, filePath: string): Promise<void>;
34
+
35
+ /**
36
+ * 下载文件
37
+ * @param fileInfo 文件信息
38
+ */
39
+ download(fileInfo: _FileInfo): Promise<Buffer>;
40
+
41
+ /**
42
+ * 下载文件
43
+ * @param fileInfo 文件信息
44
+ * @param filePath 文件保存的路径
45
+ */
46
+ download(fileInfo: _FileInfo, filePath: string): Promise<void>;
47
+ }
48
+
49
+ export type FileUploadResult = {
50
+ fileId: string;
51
+ type: string;
52
+ name: string;
53
+ size: number;
54
+ };
55
+
56
+ export type UploadAvatarResult = {
57
+ ImageId: string;
58
+ PreviewImageId: string;
59
+ };
60
+ export interface _IOpenSDKFile {
61
+ Upload(fileName: string, path: string): Promise<FileUploadResult>;
62
+ Upload(fileName: string, reader: Stream): Promise<FileUploadResult>;
63
+ Upload(fileName: string, buffer: Buffer): Promise<FileUploadResult>;
64
+ UploadAvatar(fileName: string, path: string): Promise<UploadAvatarResult>;
65
+ UploadAvatar(fileName: string, reader: Stream): Promise<UploadAvatarResult>;
66
+ UploadAvatar(fileName: string, buffer: Buffer): Promise<UploadAvatarResult>;
67
+ Download(fileID: string): Promise<Buffer>;
68
+ DownloadAvatar(imageID: string): Promise<Buffer>;
69
+ }
70
+
71
+ export interface _IOpenSDKResources {
72
+ file: _IOpenSDKFile;
73
+ }
@@ -0,0 +1,42 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Stream } from "stream";
4
+ import { _FileInfo, _IKunlunFile, _IOpenSDKFile, UploadAvatarResult, FileUploadResult } from "../IResources";
5
+ import * as Request from "../../../request/interface";
6
+ import { AppCtx } from "../../../application/application";
7
+ export declare class _KunlunOpenSDKFile implements _IOpenSDKFile {
8
+ appCtx: AppCtx;
9
+ constructor(appCtx: AppCtx);
10
+ Upload(fileName: string, path: string): Promise<FileUploadResult>;
11
+ Upload(fileName: string, reader: Stream): Promise<FileUploadResult>;
12
+ Upload(fileName: string, buffer: Buffer): Promise<FileUploadResult>;
13
+ UploadAvatar(fileName: string, path: string): Promise<UploadAvatarResult>;
14
+ UploadAvatar(fileName: string, reader: Stream): Promise<UploadAvatarResult>;
15
+ UploadAvatar(fileName: string, buffer: Buffer): Promise<UploadAvatarResult>;
16
+ Download(fileID: string): Promise<Buffer>;
17
+ DownloadAvatar(imageID: string): Promise<Buffer>;
18
+ }
19
+ export declare class _KunlunFile implements _IKunlunFile {
20
+ download(fileToken: string): Promise<Buffer>;
21
+ download(fileToken: string, filePath?: string): Promise<void>;
22
+ download(fileToken: _FileInfo): Promise<Buffer>;
23
+ download(fileInfo: _FileInfo, filePath: string): Promise<void>;
24
+ upload(filePath: string): Promise<Request.UploadFileResp>;
25
+ upload(stream: Stream): Promise<Request.UploadFileResp>;
26
+ upload(filePath: string, expire: number): Promise<Request.UploadFileResp>;
27
+ upload(stream: Stream, expire: number): Promise<Request.UploadFileResp>;
28
+ }
29
+ /**
30
+ * OpenSDK 静态资源操作类
31
+ */
32
+ export declare class _OpenSDKResources {
33
+ file: _IOpenSDKFile;
34
+ constructor(appCtx: AppCtx);
35
+ }
36
+ /**
37
+ * 静态资源操作类
38
+ */
39
+ export declare class _Resources {
40
+ file: _IKunlunFile;
41
+ constructor();
42
+ }
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._Resources = exports._OpenSDKResources = exports._KunlunFile = exports._KunlunOpenSDKFile = void 0;
4
+ const stream_1 = require("stream");
5
+ const Request = require("../../../request/interface");
6
+ const common_1 = require("../../../application/impl/common");
7
+ const common = require("@byted-apaas/server-common-node");
8
+ const stream_to_buffer_1 = require("@jorgeferrero/stream-to-buffer");
9
+ const exceptions = common.exceptions;
10
+ const fs = require('fs');
11
+ class _KunlunOpenSDKFile {
12
+ constructor(appCtx) {
13
+ this.appCtx = appCtx;
14
+ }
15
+ async Upload(fileName, source) {
16
+ // 1. check parameters type
17
+ if (typeof fileName !== 'string') {
18
+ throw new exceptions.InvalidParamError('upload method parameter fileName must be string. ');
19
+ }
20
+ if (typeof source !== 'string' && !(source instanceof stream_1.Stream) && !(source instanceof Buffer)) {
21
+ throw new exceptions.InvalidParamError('upload method parameter source must be string or stream or buffer. ');
22
+ }
23
+ // 2. divide by source type
24
+ if (typeof source === 'string') {
25
+ // upload from path
26
+ if (!fs.existsSync(source)) {
27
+ throw new exceptions.InvalidParamError(`no such file '${source}'`);
28
+ }
29
+ source = fs.createReadStream(source);
30
+ }
31
+ if (source instanceof stream_1.Stream) {
32
+ // upload from stream
33
+ source = await (0, stream_to_buffer_1.streamToBuffer)(source);
34
+ }
35
+ if (source instanceof Buffer) {
36
+ return await (0, common_1.runCtxForOpenSDK)(this.appCtx, async () => {
37
+ return await Request.GetInstance().openSDKUploadFile(fileName, source);
38
+ });
39
+ }
40
+ return null;
41
+ }
42
+ ;
43
+ async UploadAvatar(fileName, source) {
44
+ // 1. check parameters type
45
+ if (typeof fileName !== 'string') {
46
+ throw new exceptions.InvalidParamError('upload method parameter fileName must be string. ');
47
+ }
48
+ if (typeof source !== 'string' && !(source instanceof stream_1.Stream) && !(source instanceof Buffer)) {
49
+ throw new exceptions.InvalidParamError('upload method parameter source must be string or stream or buffer. ');
50
+ }
51
+ // 2. divide by source type
52
+ if (typeof source === 'string') {
53
+ // upload from path
54
+ if (!fs.existsSync(source)) {
55
+ throw new exceptions.InvalidParamError(`no such file '${source}'`);
56
+ }
57
+ source = fs.createReadStream(source);
58
+ }
59
+ if (source instanceof stream_1.Stream) {
60
+ // upload from stream
61
+ source = await (0, stream_to_buffer_1.streamToBuffer)(source);
62
+ }
63
+ if (source instanceof Buffer) {
64
+ // upload from buffer
65
+ return await (0, common_1.runCtxForOpenSDK)(this.appCtx, async () => {
66
+ return await Request.GetInstance().openSDKUploadAvatar(fileName, source);
67
+ });
68
+ }
69
+ return null;
70
+ }
71
+ ;
72
+ async Download(fileID) {
73
+ // 1. check parameters type
74
+ if (typeof fileID !== 'string') {
75
+ throw new exceptions.InvalidParamError('download method parameter fileID must be string. ');
76
+ }
77
+ return await (0, common_1.runCtxForOpenSDK)(this.appCtx, async () => {
78
+ return await Request.GetInstance().downloadFileByID(fileID);
79
+ });
80
+ }
81
+ ;
82
+ async DownloadAvatar(imageID) {
83
+ // 1. check parameters type
84
+ if (typeof imageID !== 'string') {
85
+ throw new exceptions.InvalidParamError('download method parameter imageID must be string. ');
86
+ }
87
+ return await (0, common_1.runCtxForOpenSDK)(this.appCtx, async () => {
88
+ return await Request.GetInstance().openSDKDownloadAvatar(imageID);
89
+ });
90
+ }
91
+ ;
92
+ }
93
+ exports._KunlunOpenSDKFile = _KunlunOpenSDKFile;
94
+ class _KunlunFile {
95
+ async download(fileTokenOrInfo, filePath) {
96
+ if (typeof (fileTokenOrInfo) === "string") {
97
+ return await Request.GetInstance().downloadFileByToken(fileTokenOrInfo, filePath);
98
+ }
99
+ else if (typeof (fileTokenOrInfo) === "object") {
100
+ if (!fileTokenOrInfo.id) {
101
+ throw new exceptions.InvalidParamError(`The value of fileInfo.id is empty`);
102
+ }
103
+ if (typeof (fileTokenOrInfo.id) !== "string") {
104
+ throw new exceptions.InvalidParamError(`The type of fileInfo.id should be string, but ${typeof (fileTokenOrInfo)}`);
105
+ }
106
+ return await Request.GetInstance().downloadFileByID(fileTokenOrInfo.id, filePath);
107
+ }
108
+ else {
109
+ throw new exceptions.InvalidParamError(`The type of first param should be string or object, but ${typeof (fileTokenOrInfo)}`);
110
+ }
111
+ }
112
+ async upload(data, expire, ...ret) {
113
+ if (ret.length > 0) {
114
+ throw new exceptions.InvalidParamError(`params is too many, as ${ret.length + 2}`);
115
+ }
116
+ if (!data) {
117
+ throw new exceptions.InvalidParamError(`params is null`);
118
+ }
119
+ // 1. data is filePath, read it from disk, convert it to Steam.
120
+ if (typeof (data) === 'string') {
121
+ if (!fs.existsSync(data)) {
122
+ throw new exceptions.InvalidParamError(`no such file '${data}'`);
123
+ }
124
+ data = fs.createReadStream(data);
125
+ }
126
+ // 2. data must be Stream at here.
127
+ return await Request.GetInstance().uploadFile(data, expire);
128
+ }
129
+ }
130
+ exports._KunlunFile = _KunlunFile;
131
+ /**
132
+ * OpenSDK 静态资源操作类
133
+ */
134
+ class _OpenSDKResources {
135
+ constructor(appCtx) {
136
+ this.file = new _KunlunOpenSDKFile(appCtx);
137
+ }
138
+ }
139
+ exports._OpenSDKResources = _OpenSDKResources;
140
+ /**
141
+ * 静态资源操作类
142
+ */
143
+ class _Resources {
144
+ constructor() {
145
+ this.file = new _KunlunFile();
146
+ }
147
+ }
148
+ exports._Resources = _Resources;
149
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["resources.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,sDAAsD;AACtD,6DAAoE;AACpE,0DAAyD;AAEzD,qEAAgE;AAEhE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAErC,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAa,kBAAkB;IAG3B,YAAY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UAAU,CAAC,iBAAiB,CAAC,2DAA2D,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;SACjI;IACL,CAAC;IAMD,KAAK,CAAC,MAAM,CAAC,IAAqB,EAAE,MAAe,EAAE,GAAG,GAAa;QACjE,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;YAChB,MAAM,IAAI,UAAU,CAAC,iBAAiB,CAAC,0BAA0B,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAA;SACrF;QACD,IAAI,CAAC,IAAI,EAAE;YACP,MAAM,IAAI,UAAU,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;SAC3D;QAED,+DAA+D;QAC/D,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE;YAC5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACtB,MAAM,IAAI,UAAU,CAAC,iBAAiB,CAAC,iBAAiB,IAAI,GAAG,CAAC,CAAA;aACnE;YACD,IAAI,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;SACpC;QAED,kCAAkC;QAClC,OAAO,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAc,EAAE,MAAM,CAAC,CAAC;IAC1E,CAAC;CACJ;AA7CD,kCA6CC;AAED;;GAEG;AACH,MAAa,iBAAiB;IAG1B,YAAY,MAAc;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CACJ;AAND,8CAMC;AAED;;GAEG;AACH,MAAa,UAAU;IAInB;QACI,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,CAAC;CAEJ;AARD,gCAQC"}
@@ -0,0 +1,170 @@
1
+ import { Stream } from "stream";
2
+ import { _FileInfo, _IKunlunFile, _IOpenSDKFile, UploadAvatarResult, FileUploadResult } from "../IResources";
3
+ import * as Request from "../../../request/interface";
4
+ import { runCtxForOpenSDK } from "../../../application/impl/common";
5
+ import * as common from "@byted-apaas/server-common-node"
6
+ import { AppCtx } from "../../../application/application";
7
+ import { streamToBuffer } from "@jorgeferrero/stream-to-buffer";
8
+
9
+ const exceptions = common.exceptions;
10
+
11
+ const fs = require('fs');
12
+
13
+ export class _KunlunOpenSDKFile implements _IOpenSDKFile {
14
+ appCtx: AppCtx
15
+
16
+ constructor(appCtx: AppCtx) {
17
+ this.appCtx = appCtx;
18
+ }
19
+
20
+ async Upload(fileName: string, path: string): Promise<FileUploadResult>;
21
+ async Upload(fileName: string, reader: Stream): Promise<FileUploadResult>;
22
+ async Upload(fileName: string, buffer: Buffer): Promise<FileUploadResult>;
23
+ async Upload(fileName: string, source: string | Stream | Buffer): Promise<FileUploadResult> {
24
+ // 1. check parameters type
25
+ if (typeof fileName !== 'string') {
26
+ throw new exceptions.InvalidParamError('upload method parameter fileName must be string. ');
27
+ }
28
+ if (typeof source !== 'string' && !(source instanceof Stream) && !(source instanceof Buffer)) {
29
+ throw new exceptions.InvalidParamError('upload method parameter source must be string or stream or buffer. ');
30
+ }
31
+ // 2. divide by source type
32
+ if (typeof source === 'string') {
33
+ // upload from path
34
+ if (!fs.existsSync(source)) {
35
+ throw new exceptions.InvalidParamError(`no such file '${source}'`)
36
+ }
37
+ source = fs.createReadStream(source);
38
+ }
39
+ if (source instanceof Stream) {
40
+ // upload from stream
41
+ source = await streamToBuffer(source as any);
42
+ }
43
+ if (source instanceof Buffer) {
44
+ return await runCtxForOpenSDK(this.appCtx, async () => {
45
+ return await Request.GetInstance().openSDKUploadFile(fileName, source as Buffer);
46
+ });
47
+ }
48
+ return null;
49
+ };
50
+ async UploadAvatar(fileName: string, path: string): Promise<UploadAvatarResult>;
51
+ async UploadAvatar(fileName: string, reader: Stream): Promise<UploadAvatarResult>;
52
+ async UploadAvatar(fileName: string, buffer: Buffer): Promise<UploadAvatarResult>;
53
+ async UploadAvatar(fileName: string, source: string | Stream | Buffer): Promise<UploadAvatarResult> {
54
+ // 1. check parameters type
55
+ if (typeof fileName !== 'string') {
56
+ throw new exceptions.InvalidParamError('upload method parameter fileName must be string. ');
57
+ }
58
+ if (typeof source !== 'string' && !(source instanceof Stream) && !(source instanceof Buffer)) {
59
+ throw new exceptions.InvalidParamError('upload method parameter source must be string or stream or buffer. ');
60
+ }
61
+ // 2. divide by source type
62
+ if (typeof source === 'string') {
63
+ // upload from path
64
+ if (!fs.existsSync(source)) {
65
+ throw new exceptions.InvalidParamError(`no such file '${source}'`)
66
+ }
67
+ source = fs.createReadStream(source);
68
+ }
69
+ if (source instanceof Stream) {
70
+ // upload from stream
71
+ source = await streamToBuffer(source as any);
72
+ }
73
+ if (source instanceof Buffer) {
74
+ // upload from buffer
75
+ return await runCtxForOpenSDK(this.appCtx, async () => {
76
+ return await Request.GetInstance().openSDKUploadAvatar(fileName, source as Buffer);
77
+ })
78
+ }
79
+ return null;
80
+ };
81
+ async Download(fileID: string): Promise<Buffer> {
82
+ // 1. check parameters type
83
+ if (typeof fileID !== 'string') {
84
+ throw new exceptions.InvalidParamError('download method parameter fileID must be string. ');
85
+ }
86
+ return await runCtxForOpenSDK(this.appCtx, async () => {
87
+ return await Request.GetInstance().downloadFileByID(fileID) as Buffer;
88
+ })
89
+ };
90
+ async DownloadAvatar(imageID: string): Promise<Buffer> {
91
+ // 1. check parameters type
92
+ if (typeof imageID !== 'string') {
93
+ throw new exceptions.InvalidParamError('download method parameter imageID must be string. ');
94
+ }
95
+ return await runCtxForOpenSDK(this.appCtx, async () => {
96
+ return await Request.GetInstance().openSDKDownloadAvatar(imageID) as Buffer;
97
+ })
98
+ };
99
+ }
100
+
101
+ export class _KunlunFile implements _IKunlunFile {
102
+ async download(fileToken: string): Promise<Buffer>;
103
+ async download(fileToken: string, filePath?: string): Promise<void>;
104
+ async download(fileToken: _FileInfo): Promise<Buffer>;
105
+ async download(fileInfo: _FileInfo, filePath: string): Promise<void>;
106
+ async download(fileTokenOrInfo: string | _FileInfo, filePath?: string): Promise<Buffer | void> {
107
+ if (typeof (fileTokenOrInfo) === "string") {
108
+ return await Request.GetInstance().downloadFileByToken(fileTokenOrInfo, filePath);
109
+ } else if (typeof (fileTokenOrInfo) === "object") {
110
+ if (!fileTokenOrInfo.id) {
111
+ throw new exceptions.InvalidParamError(`The value of fileInfo.id is empty`);
112
+ }
113
+
114
+ if (typeof (fileTokenOrInfo.id) !== "string") {
115
+ throw new exceptions.InvalidParamError(`The type of fileInfo.id should be string, but ${typeof (fileTokenOrInfo)}`);
116
+ }
117
+ return await Request.GetInstance().downloadFileByID(fileTokenOrInfo.id, filePath);
118
+ } else {
119
+ throw new exceptions.InvalidParamError(`The type of first param should be string or object, but ${typeof (fileTokenOrInfo)}`);
120
+ }
121
+ }
122
+
123
+ async upload(filePath: string): Promise<Request.UploadFileResp>;
124
+ async upload(stream: Stream): Promise<Request.UploadFileResp>;
125
+ async upload(filePath: string, expire: number): Promise<Request.UploadFileResp>;
126
+ async upload(stream: Stream, expire: number): Promise<Request.UploadFileResp>;
127
+ async upload(data: string | Stream, expire?: number, ...ret: string[]): Promise<Request.UploadFileResp> {
128
+ if (ret.length > 0) {
129
+ throw new exceptions.InvalidParamError(`params is too many, as ${ret.length + 2}`)
130
+ }
131
+ if (!data) {
132
+ throw new exceptions.InvalidParamError(`params is null`)
133
+ }
134
+
135
+ // 1. data is filePath, read it from disk, convert it to Steam.
136
+ if (typeof (data) === 'string') {
137
+ if (!fs.existsSync(data)) {
138
+ throw new exceptions.InvalidParamError(`no such file '${data}'`)
139
+ }
140
+ data = fs.createReadStream(data);
141
+ }
142
+
143
+ // 2. data must be Stream at here.
144
+ return await Request.GetInstance().uploadFile(data as Stream, expire);
145
+ }
146
+ }
147
+
148
+ /**
149
+ * OpenSDK 静态资源操作类
150
+ */
151
+ export class _OpenSDKResources {
152
+ file: _IOpenSDKFile;
153
+
154
+ constructor(appCtx: AppCtx) {
155
+ this.file = new _KunlunOpenSDKFile(appCtx);
156
+ }
157
+ }
158
+
159
+ /**
160
+ * 静态资源操作类
161
+ */
162
+ export class _Resources {
163
+
164
+ file: _IKunlunFile;
165
+
166
+ constructor() {
167
+ this.file = new _KunlunFile();
168
+ }
169
+
170
+ }
@@ -0,0 +1,33 @@
1
+ export declare class _Options {
2
+ /**
3
+ * 并发数量,默认值为 5,最大可设置值为 10
4
+ */
5
+ concurrency?: number;
6
+ /**
7
+ * 单个子任务的最大数据量,默认值为 5,最大可设置值为 100
8
+ */
9
+ maxSliceNumber?: number;
10
+ /**
11
+ * 触发进度回调函数的步长,以百分比为单位,每当发生大于等于步长的进度变化时,便触发进度回调函数。默认为每当有进度变化时,便触发进度回调函数(进度变化精度为 1%)
12
+ */
13
+ progressCallbackStep?: number;
14
+ }
15
+ export declare class Tasks<cf> {
16
+ private f;
17
+ constructor(_f?: Function);
18
+ /**
19
+ * 创建异步任务
20
+ * @param apiName 函数的 apiName
21
+ * @param params 参数
22
+ */
23
+ createAsyncTask(apiName: cf, params: object): Promise<void>;
24
+ /**
25
+ * 创建分布式任务
26
+ * @param dataset 待处理数据组成的数组
27
+ * @param handlerFunc 用于处理数据集的全局函数的 API name
28
+ * @param progressCallbackFunc 任务进度发生变化时回调的全局函数的 API name,可通过传入 "" / null / undefined 跳过此步骤
29
+ * @param completedCallbackFunc 任务完成时回调的全局函数的 API name,可通过传入 "" / null / undefined 跳过此步骤
30
+ * @param options 高级配置参数,可选
31
+ */
32
+ createDistributedTask(dataset: any[], handlerFunc: cf, progressCallbackFunc: cf | "" | null | undefined, completedCallbackFunc: cf | "" | null | undefined, options?: _Options): Promise<number>;
33
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tasks = exports._Options = void 0;
4
+ const common = require("@byted-apaas/server-common-node");
5
+ const Request = require("../../request/interface");
6
+ const utils = common.utils;
7
+ const exceptions = common.exceptions;
8
+ class _Options {
9
+ }
10
+ exports._Options = _Options;
11
+ // export async function asyncTaskV1(apiName: string, params: any, oldFuncName: string, isSync: boolean) {
12
+ // return await invokeFuncSync(apiName, params, oldFuncName, false);
13
+ // }
14
+ class Tasks {
15
+ constructor(_f) {
16
+ this.f = _f;
17
+ }
18
+ /**
19
+ * 创建异步任务
20
+ * @param apiName 函数的 apiName
21
+ * @param params 参数
22
+ */
23
+ async createAsyncTask(apiName, params) {
24
+ if (apiName && params) {
25
+ // low_code 1.0
26
+ if (utils.isOnlineDev()) { // TODO 区分 4.0 vs 5.0
27
+ // 1.debug模式
28
+ if (utils.isDebug()) {
29
+ return await this.f(apiName).invoke(params);
30
+ }
31
+ // 2.运行时
32
+ let newApiName = utils.handleFuncName(null, apiName);
33
+ if (!newApiName) {
34
+ throw new exceptions.InvalidParamError(`The function (${apiName}) does not exist, please confirm ${apiName} exists and has been deployed.`);
35
+ }
36
+ let idOrName = {};
37
+ if (newApiName === apiName) {
38
+ idOrName = {
39
+ APIName: newApiName,
40
+ isInvokeByAPIName: true,
41
+ };
42
+ }
43
+ else if (utils.isMicroservice()) {
44
+ idOrName = {
45
+ APIName: apiName,
46
+ isInvokeByAPIName: true,
47
+ };
48
+ }
49
+ else {
50
+ idOrName = {
51
+ APIId: newApiName,
52
+ isInvokeByAPIName: false,
53
+ };
54
+ }
55
+ return {
56
+ task_id: await Request.GetInstance().createAsyncTaskV1(idOrName, params),
57
+ };
58
+ }
59
+ // low_code 2.0
60
+ // 如果是本地调试模式,则直接异步执行
61
+ if (utils.isLocalDebug()) {
62
+ this.f(apiName).invoke(params);
63
+ return { task_id: 1234567890123456 };
64
+ }
65
+ return {
66
+ task_id: await Request.GetInstance().createAsyncTaskV2(apiName, params),
67
+ };
68
+ }
69
+ else {
70
+ throw new exceptions.InvalidParamError(`context.tasks.createAsyncTask params is error`);
71
+ }
72
+ }
73
+ ;
74
+ /**
75
+ * 创建分布式任务
76
+ * @param dataset 待处理数据组成的数组
77
+ * @param handlerFunc 用于处理数据集的全局函数的 API name
78
+ * @param progressCallbackFunc 任务进度发生变化时回调的全局函数的 API name,可通过传入 "" / null / undefined 跳过此步骤
79
+ * @param completedCallbackFunc 任务完成时回调的全局函数的 API name,可通过传入 "" / null / undefined 跳过此步骤
80
+ * @param options 高级配置参数,可选
81
+ */
82
+ async createDistributedTask(dataset, handlerFunc, progressCallbackFunc, completedCallbackFunc, options) {
83
+ if (utils.isLocalDebug()) {
84
+ throw new exceptions.InvalidParamError("Local debugging isn't supported for distributed tasks. You can only deploy them to the cloud");
85
+ }
86
+ if (utils.getDistributedHandleMask()) {
87
+ throw new exceptions.InvalidParamError("Does not support creating distributed tasks in handler function and progress callback function");
88
+ }
89
+ // dataset
90
+ if (!(dataset instanceof Array)) {
91
+ throw new exceptions.InvalidParamError(`parameter dataset is not list`);
92
+ }
93
+ // handlerFunc
94
+ if (!handlerFunc || typeof handlerFunc !== 'string') {
95
+ throw new exceptions.InvalidParamError(`parameter handlerFunc is not string or handlerFunc is empty`);
96
+ }
97
+ // progressCallbackFunc
98
+ if (progressCallbackFunc === null || progressCallbackFunc === undefined) {
99
+ progressCallbackFunc = "";
100
+ }
101
+ if (typeof progressCallbackFunc !== 'string') {
102
+ throw new exceptions.InvalidParamError(`parameter progressCallbackFunc is not string`);
103
+ }
104
+ // completedCallbackFunc
105
+ if (completedCallbackFunc === null || completedCallbackFunc === undefined) {
106
+ completedCallbackFunc = "";
107
+ }
108
+ if (typeof completedCallbackFunc !== 'string') {
109
+ throw new exceptions.InvalidParamError(`parameter completedCallbackFunc is not string`);
110
+ }
111
+ // option.concurrency
112
+ if (options.concurrency === null || options.concurrency === undefined) {
113
+ options.concurrency = 5;
114
+ }
115
+ if ((typeof options.concurrency !== 'number') || options.concurrency <= 0) {
116
+ throw new exceptions.InvalidParamError(`parameter option.concurrency is not Number or not graterThan 0`);
117
+ }
118
+ // option.maxSliceNumber
119
+ if (options.maxSliceNumber === null || options.maxSliceNumber === undefined) {
120
+ options.maxSliceNumber = 5;
121
+ }
122
+ if ((typeof options.maxSliceNumber !== 'number') || options.maxSliceNumber <= 0) {
123
+ throw new exceptions.InvalidParamError(`parameter option.maxSliceNumber is not Number or not graterThan 0`);
124
+ }
125
+ // option.notifyStep
126
+ if (options.progressCallbackStep === null || options.progressCallbackStep === undefined) {
127
+ options.progressCallbackStep = 1;
128
+ }
129
+ if ((typeof options.progressCallbackStep !== 'number') || options.progressCallbackStep <= 0 || options.progressCallbackStep > 100) {
130
+ throw new exceptions.InvalidParamError(`parameter option.progressCallbackStep is not Number or not between 0 and 100`);
131
+ }
132
+ if (utils.isOnlineDev()) {
133
+ return Request.GetFaaSInfraInstance().createDistributeTaskV1([dataset], handlerFunc, progressCallbackFunc, completedCallbackFunc, options);
134
+ }
135
+ return Request.GetFaaSInfraInstance().createDistributeTaskV2([dataset], handlerFunc, progressCallbackFunc, completedCallbackFunc, options);
136
+ }
137
+ ;
138
+ }
139
+ exports.Tasks = Tasks;
140
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["tasks.ts"],"names":[],"mappings":";;;AAAA,0DAAyD;AACzD,mDAAkD;AAElD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;AAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;AAEpC,MAAa,QAAQ;CAapB;AAbD,4BAaC;AAED,0GAA0G;AAC1G,wEAAwE;AACxE,IAAI;AAEJ,MAAa,KAAK;IAGd,YAAY,EAAa;QACrB,IAAI,CAAC,CAAC,GAAG,EAAE,CAAA;IACf,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,eAAe,CAAC,OAAW,EAAE,MAAc;QACpD,IAAI,OAAO,IAAI,MAAM,EAAE;YACnB,eAAe;YACf,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,EAAC,qBAAqB;gBAC3C,YAAY;gBACZ,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE;oBACjB,OAAO,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,CAA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