@ultipa-graph/ultipa-driver 5.0.0-s5.0

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 (202) hide show
  1. package/dist/.DS_Store +0 -0
  2. package/dist/connection/connection.final.d.ts +45 -0
  3. package/dist/connection/connection.final.js +600 -0
  4. package/dist/connection/connection.final.js.map +1 -0
  5. package/dist/connection/connection.pool.d.ts +26 -0
  6. package/dist/connection/connection.pool.js +121 -0
  7. package/dist/connection/connection.pool.js.map +1 -0
  8. package/dist/connection/extra/algos/algo.extra.d.ts +34 -0
  9. package/dist/connection/extra/algos/algo.extra.js +81 -0
  10. package/dist/connection/extra/algos/algo.extra.js.map +1 -0
  11. package/dist/connection/extra/algos/algo.utils.d.ts +3 -0
  12. package/dist/connection/extra/algos/algo.utils.js +71 -0
  13. package/dist/connection/extra/algos/algo.utils.js.map +1 -0
  14. package/dist/connection/extra/algos/community.d.ts +27 -0
  15. package/dist/connection/extra/algos/community.js +129 -0
  16. package/dist/connection/extra/algos/community.js.map +1 -0
  17. package/dist/connection/extra/algos/degrees.d.ts +10 -0
  18. package/dist/connection/extra/algos/degrees.js +43 -0
  19. package/dist/connection/extra/algos/degrees.js.map +1 -0
  20. package/dist/connection/extra/algos/embedding.d.ts +13 -0
  21. package/dist/connection/extra/algos/embedding.js +58 -0
  22. package/dist/connection/extra/algos/embedding.js.map +1 -0
  23. package/dist/connection/extra/algos/index.d.ts +5 -0
  24. package/dist/connection/extra/algos/index.js +14 -0
  25. package/dist/connection/extra/algos/index.js.map +1 -0
  26. package/dist/connection/extra/base.extra.d.ts +71 -0
  27. package/dist/connection/extra/base.extra.js +183 -0
  28. package/dist/connection/extra/base.extra.js.map +1 -0
  29. package/dist/connection/extra/connection.base.d.ts +82 -0
  30. package/dist/connection/extra/connection.base.js +623 -0
  31. package/dist/connection/extra/connection.base.js.map +1 -0
  32. package/dist/connection/extra/connection.d.ts +16 -0
  33. package/dist/connection/extra/connection.js +46 -0
  34. package/dist/connection/extra/connection.js.map +1 -0
  35. package/dist/connection/extra/graph.extra.d.ts +85 -0
  36. package/dist/connection/extra/graph.extra.js +241 -0
  37. package/dist/connection/extra/graph.extra.js.map +1 -0
  38. package/dist/connection/extra/index.extra.d.ts +70 -0
  39. package/dist/connection/extra/index.extra.js +201 -0
  40. package/dist/connection/extra/index.extra.js.map +1 -0
  41. package/dist/connection/extra/job.extra.d.ts +32 -0
  42. package/dist/connection/extra/job.extra.js +145 -0
  43. package/dist/connection/extra/job.extra.js.map +1 -0
  44. package/dist/connection/extra/meta.extra.d.ts +91 -0
  45. package/dist/connection/extra/meta.extra.js +441 -0
  46. package/dist/connection/extra/meta.extra.js.map +1 -0
  47. package/dist/connection/extra/property.extra.d.ts +81 -0
  48. package/dist/connection/extra/property.extra.js +268 -0
  49. package/dist/connection/extra/property.extra.js.map +1 -0
  50. package/dist/connection/extra/schema.extra.d.ts +50 -0
  51. package/dist/connection/extra/schema.extra.js +248 -0
  52. package/dist/connection/extra/schema.extra.js.map +1 -0
  53. package/dist/connection/extra/search.extra.d.ts +12 -0
  54. package/dist/connection/extra/search.extra.js +126 -0
  55. package/dist/connection/extra/search.extra.js.map +1 -0
  56. package/dist/connection/extra/task.extra.d.ts +24 -0
  57. package/dist/connection/extra/task.extra.js +126 -0
  58. package/dist/connection/extra/task.extra.js.map +1 -0
  59. package/dist/connection/extra/user.privilege.extra.d.ts +64 -0
  60. package/dist/connection/extra/user.privilege.extra.js +348 -0
  61. package/dist/connection/extra/user.privilege.extra.js.map +1 -0
  62. package/dist/connection/index.d.ts +4 -0
  63. package/dist/connection/index.js +10 -0
  64. package/dist/connection/index.js.map +1 -0
  65. package/dist/connection/network.manager.d.ts +27 -0
  66. package/dist/connection/network.manager.js +178 -0
  67. package/dist/connection/network.manager.js.map +1 -0
  68. package/dist/index.d.ts +4 -0
  69. package/dist/index.js +14 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/printers/alias.d.ts +2 -0
  72. package/dist/printers/alias.js +15 -0
  73. package/dist/printers/alias.js.map +1 -0
  74. package/dist/printers/any.d.ts +2 -0
  75. package/dist/printers/any.js +40 -0
  76. package/dist/printers/any.js.map +1 -0
  77. package/dist/printers/array.aio.d.ts +44 -0
  78. package/dist/printers/array.aio.js +240 -0
  79. package/dist/printers/array.aio.js.map +1 -0
  80. package/dist/printers/common.d.ts +0 -0
  81. package/dist/printers/common.js +1 -0
  82. package/dist/printers/common.js.map +1 -0
  83. package/dist/printers/edge.d.ts +5 -0
  84. package/dist/printers/edge.js +49 -0
  85. package/dist/printers/edge.js.map +1 -0
  86. package/dist/printers/explain.plan.d.ts +2 -0
  87. package/dist/printers/explain.plan.js +24 -0
  88. package/dist/printers/explain.plan.js.map +1 -0
  89. package/dist/printers/graph.d.ts +2 -0
  90. package/dist/printers/graph.js +34 -0
  91. package/dist/printers/graph.js.map +1 -0
  92. package/dist/printers/index.d.ts +25 -0
  93. package/dist/printers/index.js +44 -0
  94. package/dist/printers/index.js.map +1 -0
  95. package/dist/printers/node.d.ts +5 -0
  96. package/dist/printers/node.js +49 -0
  97. package/dist/printers/node.js.map +1 -0
  98. package/dist/printers/path.d.ts +3 -0
  99. package/dist/printers/path.js +42 -0
  100. package/dist/printers/path.js.map +1 -0
  101. package/dist/printers/status.d.ts +3 -0
  102. package/dist/printers/status.js +45 -0
  103. package/dist/printers/status.js.map +1 -0
  104. package/dist/printers/table.d.ts +2 -0
  105. package/dist/printers/table.js +31 -0
  106. package/dist/printers/table.js.map +1 -0
  107. package/dist/proto/tmp.js +366 -0
  108. package/dist/proto/ultipa_grpc_pb.d.ts +257 -0
  109. package/dist/proto/ultipa_grpc_pb.js +366 -0
  110. package/dist/proto/ultipa_grpc_pb.js.map +1 -0
  111. package/dist/proto/ultipa_pb.d.ts +1 -0
  112. package/dist/proto/ultipa_pb.js +11002 -0
  113. package/dist/proto/ultipa_pb.js.map +1 -0
  114. package/dist/transaction/UltipaSession.d.ts +28 -0
  115. package/dist/transaction/UltipaSession.js +148 -0
  116. package/dist/transaction/UltipaSession.js.map +1 -0
  117. package/dist/transaction/UltipaTransaction.Recorder.d.ts +20 -0
  118. package/dist/transaction/UltipaTransaction.Recorder.js +23 -0
  119. package/dist/transaction/UltipaTransaction.Recorder.js.map +1 -0
  120. package/dist/transaction/UltipaTransaction.d.ts +35 -0
  121. package/dist/transaction/UltipaTransaction.js +203 -0
  122. package/dist/transaction/UltipaTransaction.js.map +1 -0
  123. package/dist/transaction/UltipaTransactionSession.d.ts +15 -0
  124. package/dist/transaction/UltipaTransactionSession.js +46 -0
  125. package/dist/transaction/UltipaTransactionSession.js.map +1 -0
  126. package/dist/transaction/operations/Transaction.Deletes.d.ts +4 -0
  127. package/dist/transaction/operations/Transaction.Deletes.js +52 -0
  128. package/dist/transaction/operations/Transaction.Deletes.js.map +1 -0
  129. package/dist/transaction/operations/Transaction.Inserts.d.ts +4 -0
  130. package/dist/transaction/operations/Transaction.Inserts.js +78 -0
  131. package/dist/transaction/operations/Transaction.Inserts.js.map +1 -0
  132. package/dist/transaction/operations/Transaction.Update.d.ts +4 -0
  133. package/dist/transaction/operations/Transaction.Update.js +43 -0
  134. package/dist/transaction/operations/Transaction.Update.js.map +1 -0
  135. package/dist/types/index.d.ts +4 -0
  136. package/dist/types/index.js +13 -0
  137. package/dist/types/index.js.map +1 -0
  138. package/dist/types/types.algos.params.d.ts +545 -0
  139. package/dist/types/types.algos.params.js +16 -0
  140. package/dist/types/types.algos.params.js.map +1 -0
  141. package/dist/types/types.d.ts +496 -0
  142. package/dist/types/types.extra.d.ts +788 -0
  143. package/dist/types/types.extra.js +49 -0
  144. package/dist/types/types.extra.js.map +1 -0
  145. package/dist/types/types.js +706 -0
  146. package/dist/types/types.js.map +1 -0
  147. package/dist/types/util.d.ts +15 -0
  148. package/dist/types/util.js +163 -0
  149. package/dist/types/util.js.map +1 -0
  150. package/dist/utils/common.d.ts +3 -0
  151. package/dist/utils/common.js +31 -0
  152. package/dist/utils/common.js.map +1 -0
  153. package/dist/utils/config.d.ts +3 -0
  154. package/dist/utils/config.js +7 -0
  155. package/dist/utils/config.js.map +1 -0
  156. package/dist/utils/format.d.ts +49 -0
  157. package/dist/utils/format.js +990 -0
  158. package/dist/utils/format.js.map +1 -0
  159. package/dist/utils/index.d.ts +12 -0
  160. package/dist/utils/index.js +34 -0
  161. package/dist/utils/index.js.map +1 -0
  162. package/dist/utils/params.validate.d.ts +4 -0
  163. package/dist/utils/params.validate.js +14 -0
  164. package/dist/utils/params.validate.js.map +1 -0
  165. package/dist/utils/property.d.ts +15 -0
  166. package/dist/utils/property.js +117 -0
  167. package/dist/utils/property.js.map +1 -0
  168. package/dist/utils/raft.retry.d.ts +0 -0
  169. package/dist/utils/raft.retry.js +1 -0
  170. package/dist/utils/raft.retry.js.map +1 -0
  171. package/dist/utils/serialize/commont.d.ts +12 -0
  172. package/dist/utils/serialize/commont.js +46 -0
  173. package/dist/utils/serialize/commont.js.map +1 -0
  174. package/dist/utils/serialize/deserialize.d.ts +9 -0
  175. package/dist/utils/serialize/deserialize.js +164 -0
  176. package/dist/utils/serialize/deserialize.js.map +1 -0
  177. package/dist/utils/serialize/null.d.ts +24 -0
  178. package/dist/utils/serialize/null.js +133 -0
  179. package/dist/utils/serialize/null.js.map +1 -0
  180. package/dist/utils/serialize/serialize.d.ts +10 -0
  181. package/dist/utils/serialize/serialize.js +135 -0
  182. package/dist/utils/serialize/serialize.js.map +1 -0
  183. package/dist/utils/stream.helper.d.ts +9 -0
  184. package/dist/utils/stream.helper.js +97 -0
  185. package/dist/utils/stream.helper.js.map +1 -0
  186. package/dist/utils/time.record.d.ts +15 -0
  187. package/dist/utils/time.record.js +50 -0
  188. package/dist/utils/time.record.js.map +1 -0
  189. package/dist/utils/timezone.d.ts +7 -0
  190. package/dist/utils/timezone.js +21 -0
  191. package/dist/utils/timezone.js.map +1 -0
  192. package/dist/utils/ultipa.datetime.d.ts +8 -0
  193. package/dist/utils/ultipa.datetime.js +120 -0
  194. package/dist/utils/ultipa.datetime.js.map +1 -0
  195. package/dist/utils/uql-maker.d.ts +164 -0
  196. package/dist/utils/uql-maker.js +400 -0
  197. package/dist/utils/uql-maker.js.map +1 -0
  198. package/dist/utils/uql.parse.d.ts +27 -0
  199. package/dist/utils/uql.parse.js +206 -0
  200. package/dist/utils/uql.parse.js.map +1 -0
  201. package/package.json +62 -0
  202. package/readme.md +63 -0
@@ -0,0 +1,13 @@
1
+ import { ConnectionBase } from "../connection.base";
2
+ import { AlgoParams, ULTIPA, RequestType } from "../../../types";
3
+ declare class AlgorithmsEmbedding extends ConnectionBase {
4
+ private __common_AlgorithmsEmbedding;
5
+ algo_random_walk(req: AlgoParams.random_walk, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
6
+ algo_random_walk_node2vec(req: AlgoParams.random_walk_node2vec, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
7
+ algo_random_walk_struc2vec(req: AlgoParams.random_walk_struc2vec, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
8
+ algo_node2vec(req: AlgoParams.node2vec, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
9
+ algo_line(req: AlgoParams.line, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
10
+ algo_struc2vec(req: AlgoParams.struc2vec, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
11
+ algo_fastRP(req: AlgoParams.fastRP, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
12
+ }
13
+ export { AlgorithmsEmbedding };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AlgorithmsEmbedding = void 0;
13
+ const connection_base_1 = require("../connection.base");
14
+ const algo_utils_1 = require("./algo.utils");
15
+ class AlgorithmsEmbedding extends connection_base_1.ConnectionBase {
16
+ __common_AlgorithmsEmbedding(req, name, commonReq) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ return (0, algo_utils_1.algoCommonSend)(this, req, name, commonReq);
19
+ });
20
+ }
21
+ algo_random_walk(req, commonReq) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ return this.__common_AlgorithmsEmbedding(req, "algo_random_walk", commonReq);
24
+ });
25
+ }
26
+ algo_random_walk_node2vec(req, commonReq) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ return this.__common_AlgorithmsEmbedding(req, "algo_random_walk_node2vec", commonReq);
29
+ });
30
+ }
31
+ algo_random_walk_struc2vec(req, commonReq) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ return this.__common_AlgorithmsEmbedding(req, "algo_random_walk_struc2vec", commonReq);
34
+ });
35
+ }
36
+ algo_node2vec(req, commonReq) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ return this.__common_AlgorithmsEmbedding(req, "algo_node2vec", commonReq);
39
+ });
40
+ }
41
+ algo_line(req, commonReq) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ return this.__common_AlgorithmsEmbedding(req, "algo_line", commonReq);
44
+ });
45
+ }
46
+ algo_struc2vec(req, commonReq) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ return this.__common_AlgorithmsEmbedding(req, "algo_struc2vec", commonReq);
49
+ });
50
+ }
51
+ algo_fastRP(req, commonReq) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ return this.__common_AlgorithmsEmbedding(req, "algo_fastRP", commonReq);
54
+ });
55
+ }
56
+ }
57
+ exports.AlgorithmsEmbedding = AlgorithmsEmbedding;
58
+ //# sourceMappingURL=embedding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedding.js","sourceRoot":"","sources":["../../../../src/connection/extra/algos/embedding.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,wDAAmD;AAEnD,6CAA8C;AAG9C,MAAM,mBAAoB,SAAQ,gCAAc;IAC/B,4BAA4B,CAAC,GAAoB,EAAE,IAAY,EAAE,SAAqC;;YACjH,OAAO,IAAA,2BAAc,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;QACpD,CAAC;KAAA;IAEK,gBAAgB,CAAC,GAA2B,EAAE,SAAqC;;YACtF,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAA;QAC/E,CAAC;KAAA;IACK,yBAAyB,CAAC,GAAoC,EAAE,SAAqC;;YACxG,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,2BAA2B,EAAE,SAAS,CAAC,CAAA;QACxF,CAAC;KAAA;IACK,0BAA0B,CAAC,GAAqC,EAAE,SAAqC;;YAC1G,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,4BAA4B,EAAE,SAAS,CAAC,CAAA;QACzF,CAAC;KAAA;IACK,aAAa,CAAC,GAAwB,EAAE,SAAqC;;YAChF,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,CAAC,CAAA;QAC5E,CAAC;KAAA;IACK,SAAS,CAAC,GAAoB,EAAE,SAAqC;;YACxE,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA;QACxE,CAAC;KAAA;IACK,cAAc,CAAC,GAAyB,EAAE,SAAqC;;YAClF,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAA;QAC7E,CAAC;KAAA;IACK,WAAW,CAAC,GAAsB,EAAE,SAAqC;;YAC5E,OAAO,IAAI,CAAC,4BAA4B,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;QAC1E,CAAC;KAAA;CACH;AAEQ,kDAAmB"}
@@ -0,0 +1,5 @@
1
+ export { AlgoExtra } from "./algo.extra";
2
+ export { AlgorithmsDegrees } from "./degrees";
3
+ export { AlgorithmsCommunity } from "./community";
4
+ export { AlgorithmsEmbedding } from "./embedding";
5
+ export { algoCommonSend } from "./algo.utils";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.algoCommonSend = exports.AlgorithmsEmbedding = exports.AlgorithmsCommunity = exports.AlgorithmsDegrees = exports.AlgoExtra = void 0;
4
+ var algo_extra_1 = require("./algo.extra");
5
+ Object.defineProperty(exports, "AlgoExtra", { enumerable: true, get: function () { return algo_extra_1.AlgoExtra; } });
6
+ var degrees_1 = require("./degrees");
7
+ Object.defineProperty(exports, "AlgorithmsDegrees", { enumerable: true, get: function () { return degrees_1.AlgorithmsDegrees; } });
8
+ var community_1 = require("./community");
9
+ Object.defineProperty(exports, "AlgorithmsCommunity", { enumerable: true, get: function () { return community_1.AlgorithmsCommunity; } });
10
+ var embedding_1 = require("./embedding");
11
+ Object.defineProperty(exports, "AlgorithmsEmbedding", { enumerable: true, get: function () { return embedding_1.AlgorithmsEmbedding; } });
12
+ var algo_utils_1 = require("./algo.utils");
13
+ Object.defineProperty(exports, "algoCommonSend", { enumerable: true, get: function () { return algo_utils_1.algoCommonSend; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/connection/extra/algos/index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,qCAA8C;AAArC,4GAAA,iBAAiB,OAAA;AAC1B,yCAAkD;AAAzC,gHAAA,mBAAmB,OAAA;AAC5B,yCAAkD;AAAzC,gHAAA,mBAAmB,OAAA;AAC5B,2CAA4C;AAAnC,4GAAA,cAAc,OAAA"}
@@ -0,0 +1,71 @@
1
+ import { ConnectionBase } from "./connection.base";
2
+ import { ULTIPA, RequestType, ResponseType } from "../../types";
3
+ import { ExportReply } from "../../proto/ultipa_pb";
4
+ export declare class BaseExtra extends ConnectionBase {
5
+ /**
6
+ * 查看节点状态
7
+ */
8
+ stats(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Stat>>;
9
+ /**
10
+ * 下载文件,一般为算法生成的文件
11
+ *
12
+ * @example
13
+ * ```js
14
+ * let res = await client.download({
15
+ path: "file_path",
16
+ }, {
17
+ stream: {
18
+ onData: (data) => {
19
+ // deal data
20
+ },
21
+ onEnd: () => {
22
+ // end
23
+ }
24
+ }
25
+ })
26
+ * ```
27
+ */
28
+ download(params: RequestType.Download, commonReq: RequestType.CommonStreamRequire): Promise<grpc.ClientReadableStream<import("../../proto/ultipa_pb").DownloadFileReply>>;
29
+ /**
30
+ * 导出点或边的数据
31
+ *
32
+ * @example
33
+ * ```js
34
+ * let conn = ...
35
+ * let res = await client.export({
36
+ dbType: ULTIPA.DBType.DBNODE,
37
+ limit: 100,
38
+ properties: ["name"]
39
+ }, {
40
+ stream: {
41
+ onData: (data) => {
42
+ // deal data
43
+ },
44
+ onEnd: () => {
45
+ // end
46
+ }
47
+ }
48
+ })
49
+ * ```
50
+ */
51
+ export(params: RequestType.Export, commonReq: RequestType.CommonStreamRequire): Promise<grpc.ClientReadableStream<ExportReply>>;
52
+ /**
53
+ * 清空所有数据
54
+ *
55
+ * @example
56
+ * ```js
57
+ * let conn = ...
58
+ * // 清除所有数据
59
+ * let res = await client.truncate({name: "graph_set_name"})
60
+ * // 清除点数据
61
+ * let res = await client.truncate({name: "graph_set_name", schema:'node_name', dbType: ULTIPA.DBType.DBNODE})
62
+ * // 清除边数据
63
+ * let res = await client.truncate({name: "graph_set_name", schema:'edge_name', dbType: ULTIPA.DBType.DBEDGE})
64
+ * ```
65
+ */
66
+ truncate(request: RequestType.Truncate, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
67
+ /**
68
+ * 碎片整理
69
+ */
70
+ compact(graphName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
71
+ }
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BaseExtra = void 0;
13
+ const connection_base_1 = require("./connection.base");
14
+ const types_1 = require("../../types");
15
+ const utils_1 = require("../../utils");
16
+ const ultipa_pb_1 = require("../../proto/ultipa_pb");
17
+ const { CommandList, SchemaStringWithDefault } = utils_1.UQLMAKER;
18
+ class BaseExtra extends connection_base_1.ConnectionBase {
19
+ /**
20
+ * 查看节点状态
21
+ */
22
+ stats(requestConfig) {
23
+ var _a;
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ // let command = CommandList.stats
26
+ let command = CommandList.licenseDump;
27
+ let uqlMaker = new utils_1.UQLMAKER(command, requestConfig);
28
+ let res = yield this.uqlSingle(uqlMaker);
29
+ let tableKV = (_a = res.QueryReply.singleDataTables()) === null || _a === void 0 ? void 0 : _a.toKV();
30
+ return Object.assign(Object.assign({}, res.responseWithoutData), { data: (tableKV === null || tableKV === void 0 ? void 0 : tableKV.length) > 0 ? tableKV[0] : {} });
31
+ });
32
+ }
33
+ /**
34
+ * 下载文件,一般为算法生成的文件
35
+ *
36
+ * @example
37
+ * ```js
38
+ * let res = await client.download({
39
+ path: "file_path",
40
+ }, {
41
+ stream: {
42
+ onData: (data) => {
43
+ // deal data
44
+ },
45
+ onEnd: () => {
46
+ // end
47
+ }
48
+ }
49
+ })
50
+ * ```
51
+ */
52
+ download(params, commonReq) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ // let req = new DownloadFileRequestV2()
55
+ // req.setTaskId(params.taskId + "")
56
+ let req = new ultipa_pb_1.DownloadFileRequest();
57
+ req.setFileName(params.fileName);
58
+ let clientInfo = yield this.getClientInfo({
59
+ graphSetName: commonReq === null || commonReq === void 0 ? void 0 : commonReq.graphSetName,
60
+ clusterId: commonReq === null || commonReq === void 0 ? void 0 : commonReq.clusterId,
61
+ timeZone: commonReq === null || commonReq === void 0 ? void 0 : commonReq.timeZone,
62
+ timeZoneOffset: commonReq === null || commonReq === void 0 ? void 0 : commonReq.timeZoneOffset,
63
+ });
64
+ // let stream = clientInfo.client.controlsClient.downloadFileV2(req, clientInfo.metadata)
65
+ let stream = clientInfo.client.controlsClient.downloadFile(req, clientInfo.metadata);
66
+ utils_1.streamHelper.commonDeal(stream, commonReq === null || commonReq === void 0 ? void 0 : commonReq.stream, (chunkData) => {
67
+ let status = utils_1.FormatType.status(chunkData.getStatus());
68
+ if (status.code != types_1.ULTIPA.Code.SUCCESS) {
69
+ let err = new Error(status.message);
70
+ err.code = status.code;
71
+ throw err;
72
+ }
73
+ let data = Buffer.from(chunkData.getChunk());
74
+ return data;
75
+ });
76
+ return stream;
77
+ });
78
+ }
79
+ /**
80
+ * 导出点或边的数据
81
+ *
82
+ * @example
83
+ * ```js
84
+ * let conn = ...
85
+ * let res = await client.export({
86
+ dbType: ULTIPA.DBType.DBNODE,
87
+ limit: 100,
88
+ properties: ["name"]
89
+ }, {
90
+ stream: {
91
+ onData: (data) => {
92
+ // deal data
93
+ },
94
+ onEnd: () => {
95
+ // end
96
+ }
97
+ }
98
+ })
99
+ * ```
100
+ */
101
+ export(params, commonReq) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ let req = new ultipa_pb_1.ExportRequest();
104
+ let isTypeNode = types_1.ULTIPA.DBType.DBNODE == params.dbType;
105
+ req.setDbType(isTypeNode ? ultipa_pb_1.DBType.DBNODE : ultipa_pb_1.DBType.DBEDGE);
106
+ req.setLimit(params.limit);
107
+ req.setSelectPropertiesList(params.properties);
108
+ req.setSchema(params.schema);
109
+ let clientInfo = yield this.getClientInfo({
110
+ graphSetName: commonReq === null || commonReq === void 0 ? void 0 : commonReq.graphSetName,
111
+ clusterId: commonReq === null || commonReq === void 0 ? void 0 : commonReq.clusterId,
112
+ timeZone: commonReq === null || commonReq === void 0 ? void 0 : commonReq.timeZone,
113
+ timeZoneOffset: commonReq === null || commonReq === void 0 ? void 0 : commonReq.timeZoneOffset,
114
+ });
115
+ let stream = clientInfo.client.controlsClient.export(req, clientInfo.metadata);
116
+ utils_1.streamHelper.commonDeal(stream, commonReq === null || commonReq === void 0 ? void 0 : commonReq.stream, (chunkData) => {
117
+ let status = utils_1.FormatType.status(chunkData.getStatus());
118
+ if (status.code != types_1.ULTIPA.Code.SUCCESS) {
119
+ let err = new Error(status.message);
120
+ err.code = status.code;
121
+ throw err;
122
+ }
123
+ if (isTypeNode) {
124
+ let nodes = chunkData.getNodeTable();
125
+ return utils_1.FormatType.nodeTable(nodes, this.getTimeZoneType(commonReq));
126
+ }
127
+ else {
128
+ let edges = chunkData.getEdgeTable();
129
+ return utils_1.FormatType.edgeTable(edges, this.getTimeZoneType(commonReq));
130
+ }
131
+ });
132
+ return stream;
133
+ });
134
+ }
135
+ /**
136
+ * 清空所有数据
137
+ *
138
+ * @example
139
+ * ```js
140
+ * let conn = ...
141
+ * // 清除所有数据
142
+ * let res = await client.truncate({name: "graph_set_name"})
143
+ * // 清除点数据
144
+ * let res = await client.truncate({name: "graph_set_name", schema:'node_name', dbType: ULTIPA.DBType.DBNODE})
145
+ * // 清除边数据
146
+ * let res = await client.truncate({name: "graph_set_name", schema:'edge_name', dbType: ULTIPA.DBType.DBEDGE})
147
+ * ```
148
+ */
149
+ truncate(request, requestConfig) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ let command = CommandList.truncate;
152
+ let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, request.graphName);
153
+ let scope = "*";
154
+ if (request.schema) {
155
+ scope = SchemaStringWithDefault(request.schema);
156
+ }
157
+ if (request.dbType === types_1.ULTIPA.DBType.DBNODE) {
158
+ uqlMaker.addParam("nodes", scope);
159
+ }
160
+ else if (request.dbType === types_1.ULTIPA.DBType.DBEDGE) {
161
+ uqlMaker.addParam("edges", scope);
162
+ }
163
+ else {
164
+ if (request.schema) {
165
+ throw new Error("To truncate schema, DbType is required in the parameters.");
166
+ }
167
+ }
168
+ return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
169
+ });
170
+ }
171
+ /**
172
+ * 碎片整理
173
+ */
174
+ compact(graphName, requestConfig) {
175
+ return __awaiter(this, void 0, void 0, function* () {
176
+ let command = CommandList.compact;
177
+ let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, graphName);
178
+ return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
179
+ });
180
+ }
181
+ }
182
+ exports.BaseExtra = BaseExtra;
183
+ //# sourceMappingURL=base.extra.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.extra.js","sourceRoot":"","sources":["../../../src/connection/extra/base.extra.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAA6D;AAE7D,uCAAgE;AAGhE,uCAAyF;AACzF,qDAAmF;AAInF,MAAM,EAAC,WAAW,EAAE,uBAAuB,EAAC,GAAG,gBAAQ,CAAA;AAEvD,M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are class GrpcClientInfo {
5
+ host: string;
6
+ username: string;
7
+ password: string;
8
+ crt: Buffer;
9
+ constructor(host: string, username: string, password: string, crt?: Buffer);
10
+ getMetadata(graphSetName: string, clusterId: string, timeZone: string, timeZoneOffset: number): any;
11
+ getClient(): import("../network.manager").UltipaClientAio;
12
+ }
13
+ export declare const RAFT_GLOBAL = "global";
14
+ export declare class ConnectionBase {
15
+ grpcClintInfo: GrpcClientInfo;
16
+ protected username: string;
17
+ protected password: string;
18
+ protected crt: Buffer;
19
+ defaultConfig: ULTIPA.UltipaConfig;
20
+ constructor(host: string, username: string, password: string, crt?: Buffer, defaultConfig?: ULTIPA.UltipaConfig, isMd5?: boolean);
21
+ setDefaultConfig(config?: ULTIPA.UltipaConfig): void;
22
+ protected getGraphSetName(currentGraphName: string, uql?: string, isGlobal?: boolean): string;
23
+ protected getTimeout(timeout: number): number;
24
+ protected getThreadNum(threadNum: number): number;
25
+ protected getLogUql(logUql: boolean): boolean;
26
+ protected getTimeZone(timeZone: string): string;
27
+ protected getTimeZoneOffset(timeZoneOffset: number): number;
28
+ protected getTimestampToString(timestampToString: boolean): boolean;
29
+ protected getClientInfo(params: {
30
+ type?: ULTIPA.ClientType;
31
+ graphSetName?: string;
32
+ uql?: string;
33
+ isGlobal?: boolean;
34
+ useHost?: string;
35
+ clusterId?: string;
36
+ forceRefresh?: boolean;
37
+ timeZone: string;
38
+ timeZoneOffset: number;
39
+ }): Promise<{
40
+ client: import("../network.manager").UltipaClientAio;
41
+ host: string;
42
+ metadata: any;
43
+ goGraphName: string;
44
+ }>;
45
+ protected getTimeZoneType(commonReq?: RequestType.RequestConfig): ULTIPA.TimeZone;
46
+ uql(uql: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.QueryResponse>;
47
+ uqlStream(uql: string, stream: RequestType.QueryResponseStream, requestConfig?: RequestType.RequestConfig): Promise<void>;
48
+ gqlStream(gql: string, stream: RequestType.QueryResponseStream, requestConfig?: RequestType.RequestConfig): Promise<void>;
49
+ gql(gql: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.QueryResponse>;
50
+ /**
51
+ * 运行UQL
52
+ */
53
+ private _query_without_catch;
54
+ /**
55
+ * 通过UQLMaker运行uql
56
+ */
57
+ uqlSingle(uqlMaker: UQLMAKER): Promise<ULTIPA.UQLSingleResponse>;
58
+ auth(req: RequestType.Auth, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<any>>;
59
+ /**
60
+ * 登录
61
+ */
62
+ login(commonReq?: RequestType.RequestConfig): Promise<boolean>;
63
+ /**
64
+ * 测试连接
65
+ */
66
+ test(commonReq?: RequestType.RequestConfig): Promise<boolean>;
67
+ /**
68
+ * 测试连接
69
+ */
70
+ test_has_message(commonReq?: RequestType.RequestConfig): Promise<{
71
+ connect: boolean;
72
+ msg: string;
73
+ }>;
74
+ protected static UqlUpdateSimple(conn: ConnectionBase, uqlMaker: UQLMAKER): Promise<ULTIPA.Response<null>>;
75
+ protected static UqlListSimple<T>(conn: ConnectionBase, uqlMaker: UQLMAKER, keyFormat?: ResponseKeyFormat): Promise<ULTIPA.Response<T[]>>;
76
+ protected static UqlListSimpleAuto<T>(conn: ConnectionBase, uqlMaker: UQLMAKER, keyFormat?: ResponseKeyFormat): Promise<ULTIPA.Response<{
77
+ name: string;
78
+ values: T[];
79
+ }[]>>;
80
+ protected static UqlGetSimple<T>(conn: ConnectionBase, uqlMaker: UQLMAKER, keyFormat?: ResponseKeyFormat): Promise<ULTIPA.Response<T>>;
81
+ }
82
+ export {};