@ultipa-graph/ultipa-driver 5.1.4-s5.1 → 6.0.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 (215) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/client.d.ts +194 -0
  4. package/dist/client.js +390 -0
  5. package/dist/config.d.ts +65 -0
  6. package/dist/config.js +135 -0
  7. package/dist/connection.d.ts +30 -0
  8. package/dist/connection.js +190 -0
  9. package/dist/errors.d.ts +99 -0
  10. package/dist/errors.js +237 -0
  11. package/dist/index.d.ts +14 -5
  12. package/dist/index.js +88 -39
  13. package/dist/printers.d.ts +33 -0
  14. package/dist/printers.js +312 -0
  15. package/dist/proto/gqldb.proto +632 -0
  16. package/dist/response.d.ts +256 -0
  17. package/dist/response.js +723 -0
  18. package/dist/services/admin-service.d.ts +40 -0
  19. package/dist/services/admin-service.js +115 -0
  20. package/dist/services/bulk-import-service.d.ts +35 -0
  21. package/dist/services/bulk-import-service.js +108 -0
  22. package/dist/services/converters.d.ts +57 -0
  23. package/dist/services/converters.js +254 -0
  24. package/dist/services/data-service.d.ts +44 -0
  25. package/dist/services/data-service.js +206 -0
  26. package/dist/services/graph-service.d.ts +32 -0
  27. package/dist/services/graph-service.js +127 -0
  28. package/dist/services/health-service.d.ts +50 -0
  29. package/dist/services/health-service.js +78 -0
  30. package/dist/services/index.d.ts +13 -0
  31. package/dist/services/index.js +30 -0
  32. package/dist/services/query-service.d.ts +39 -0
  33. package/dist/services/query-service.js +112 -0
  34. package/dist/services/service-context.d.ts +39 -0
  35. package/dist/services/service-context.js +73 -0
  36. package/dist/services/session-service.d.ts +24 -0
  37. package/dist/services/session-service.js +66 -0
  38. package/dist/services/transaction-service.d.ts +33 -0
  39. package/dist/services/transaction-service.js +100 -0
  40. package/dist/services.d.ts +28 -0
  41. package/dist/services.js +122 -0
  42. package/dist/session.d.ts +45 -0
  43. package/dist/session.js +75 -0
  44. package/dist/transaction.d.ts +42 -0
  45. package/dist/transaction.js +89 -0
  46. package/dist/types/bulk_import.d.ts +53 -0
  47. package/dist/types/bulk_import.js +6 -0
  48. package/dist/types/data_types.d.ts +116 -0
  49. package/dist/types/data_types.js +122 -0
  50. package/dist/types/enums.d.ts +59 -0
  51. package/dist/types/enums.js +67 -0
  52. package/dist/types/graph_models.d.ts +54 -0
  53. package/dist/types/graph_models.js +6 -0
  54. package/dist/types/index.d.ts +11 -5
  55. package/dist/types/index.js +36 -37
  56. package/dist/types/metadata.d.ts +60 -0
  57. package/dist/types/metadata.js +6 -0
  58. package/dist/types/schema.d.ts +31 -0
  59. package/dist/types/schema.js +6 -0
  60. package/dist/types/typed_value.d.ts +25 -0
  61. package/dist/types/typed_value.js +1176 -0
  62. package/dist/types/wrappers.d.ts +23 -0
  63. package/dist/types/wrappers.js +39 -0
  64. package/dist/types.d.ts +7 -0
  65. package/dist/types.js +24 -0
  66. package/package.json +40 -53
  67. package/dist/connection/connection.final.d.ts +0 -14
  68. package/dist/connection/connection.final.js +0 -96
  69. package/dist/connection/connection.final.js.map +0 -1
  70. package/dist/connection/connection.pool.d.ts +0 -21
  71. package/dist/connection/connection.pool.js +0 -103
  72. package/dist/connection/connection.pool.js.map +0 -1
  73. package/dist/connection/extra/base.extra.d.ts +0 -18
  74. package/dist/connection/extra/base.extra.js +0 -111
  75. package/dist/connection/extra/base.extra.js.map +0 -1
  76. package/dist/connection/extra/batch.insert.extra.d.ts +0 -58
  77. package/dist/connection/extra/batch.insert.extra.js +0 -353
  78. package/dist/connection/extra/batch.insert.extra.js.map +0 -1
  79. package/dist/connection/extra/connection.base.d.ts +0 -112
  80. package/dist/connection/extra/connection.base.js +0 -528
  81. package/dist/connection/extra/connection.base.js.map +0 -1
  82. package/dist/connection/extra/connection.d.ts +0 -17
  83. package/dist/connection/extra/connection.js +0 -44
  84. package/dist/connection/extra/connection.js.map +0 -1
  85. package/dist/connection/extra/graph.extra.d.ts +0 -54
  86. package/dist/connection/extra/graph.extra.js +0 -151
  87. package/dist/connection/extra/graph.extra.js.map +0 -1
  88. package/dist/connection/extra/hdc.extra.d.ts +0 -89
  89. package/dist/connection/extra/hdc.extra.js +0 -322
  90. package/dist/connection/extra/hdc.extra.js.map +0 -1
  91. package/dist/connection/extra/index.extra.d.ts +0 -102
  92. package/dist/connection/extra/index.extra.js +0 -210
  93. package/dist/connection/extra/index.extra.js.map +0 -1
  94. package/dist/connection/extra/job.extra.d.ts +0 -32
  95. package/dist/connection/extra/job.extra.js +0 -122
  96. package/dist/connection/extra/job.extra.js.map +0 -1
  97. package/dist/connection/extra/policy.extra.d.ts +0 -32
  98. package/dist/connection/extra/policy.extra.js +0 -114
  99. package/dist/connection/extra/policy.extra.js.map +0 -1
  100. package/dist/connection/extra/privilege.extra.d.ts +0 -8
  101. package/dist/connection/extra/privilege.extra.js +0 -20
  102. package/dist/connection/extra/privilege.extra.js.map +0 -1
  103. package/dist/connection/extra/property.extra.d.ts +0 -66
  104. package/dist/connection/extra/property.extra.js +0 -190
  105. package/dist/connection/extra/property.extra.js.map +0 -1
  106. package/dist/connection/extra/schema.extra.d.ts +0 -108
  107. package/dist/connection/extra/schema.extra.js +0 -253
  108. package/dist/connection/extra/schema.extra.js.map +0 -1
  109. package/dist/connection/extra/user.extra.d.ts +0 -28
  110. package/dist/connection/extra/user.extra.js +0 -91
  111. package/dist/connection/extra/user.extra.js.map +0 -1
  112. package/dist/connection/index.d.ts +0 -5
  113. package/dist/connection/index.js +0 -13
  114. package/dist/connection/index.js.map +0 -1
  115. package/dist/connection/network.manager.d.ts +0 -28
  116. package/dist/connection/network.manager.js +0 -179
  117. package/dist/connection/network.manager.js.map +0 -1
  118. package/dist/index.js.map +0 -1
  119. package/dist/printers/alias.d.ts +0 -2
  120. package/dist/printers/alias.js +0 -39
  121. package/dist/printers/alias.js.map +0 -1
  122. package/dist/printers/any.d.ts +0 -2
  123. package/dist/printers/any.js +0 -63
  124. package/dist/printers/any.js.map +0 -1
  125. package/dist/printers/array.aio.d.ts +0 -3
  126. package/dist/printers/array.aio.js +0 -259
  127. package/dist/printers/array.aio.js.map +0 -1
  128. package/dist/printers/edge.d.ts +0 -5
  129. package/dist/printers/edge.js +0 -78
  130. package/dist/printers/edge.js.map +0 -1
  131. package/dist/printers/explain.plan.d.ts +0 -2
  132. package/dist/printers/explain.plan.js +0 -46
  133. package/dist/printers/explain.plan.js.map +0 -1
  134. package/dist/printers/index.d.ts +0 -24
  135. package/dist/printers/index.js +0 -43
  136. package/dist/printers/index.js.map +0 -1
  137. package/dist/printers/node.d.ts +0 -5
  138. package/dist/printers/node.js +0 -77
  139. package/dist/printers/node.js.map +0 -1
  140. package/dist/printers/path.d.ts +0 -3
  141. package/dist/printers/path.js +0 -62
  142. package/dist/printers/path.js.map +0 -1
  143. package/dist/printers/status.d.ts +0 -3
  144. package/dist/printers/status.js +0 -68
  145. package/dist/printers/status.js.map +0 -1
  146. package/dist/printers/table.d.ts +0 -2
  147. package/dist/printers/table.js +0 -56
  148. package/dist/printers/table.js.map +0 -1
  149. package/dist/proto/tmp.js +0 -366
  150. package/dist/proto/ultipa_grpc_pb.d.ts +0 -258
  151. package/dist/proto/ultipa_grpc_pb.js +0 -366
  152. package/dist/proto/ultipa_grpc_pb.js.map +0 -1
  153. package/dist/proto/ultipa_pb.d.ts +0 -1
  154. package/dist/proto/ultipa_pb.js +0 -11002
  155. package/dist/proto/ultipa_pb.js.map +0 -1
  156. package/dist/types/index.js.map +0 -1
  157. package/dist/types/types.algos.params.d.ts +0 -545
  158. package/dist/types/types.algos.params.js +0 -16
  159. package/dist/types/types.algos.params.js.map +0 -1
  160. package/dist/types/types.d.ts +0 -1204
  161. package/dist/types/types.extra.d.ts +0 -146
  162. package/dist/types/types.extra.js +0 -27
  163. package/dist/types/types.extra.js.map +0 -1
  164. package/dist/types/types.js +0 -1596
  165. package/dist/types/types.js.map +0 -1
  166. package/dist/types/util.d.ts +0 -15
  167. package/dist/types/util.js +0 -136
  168. package/dist/types/util.js.map +0 -1
  169. package/dist/utils/common.d.ts +0 -3
  170. package/dist/utils/common.js +0 -22
  171. package/dist/utils/common.js.map +0 -1
  172. package/dist/utils/format.d.ts +0 -45
  173. package/dist/utils/format.js +0 -877
  174. package/dist/utils/format.js.map +0 -1
  175. package/dist/utils/index.d.ts +0 -10
  176. package/dist/utils/index.js +0 -30
  177. package/dist/utils/index.js.map +0 -1
  178. package/dist/utils/property.d.ts +0 -18
  179. package/dist/utils/property.js +0 -153
  180. package/dist/utils/property.js.map +0 -1
  181. package/dist/utils/serialize/commont.d.ts +0 -12
  182. package/dist/utils/serialize/commont.js +0 -46
  183. package/dist/utils/serialize/commont.js.map +0 -1
  184. package/dist/utils/serialize/deserialize.d.ts +0 -9
  185. package/dist/utils/serialize/deserialize.js +0 -166
  186. package/dist/utils/serialize/deserialize.js.map +0 -1
  187. package/dist/utils/serialize/null.d.ts +0 -25
  188. package/dist/utils/serialize/null.js +0 -136
  189. package/dist/utils/serialize/null.js.map +0 -1
  190. package/dist/utils/serialize/serialize.d.ts +0 -10
  191. package/dist/utils/serialize/serialize.js +0 -144
  192. package/dist/utils/serialize/serialize.js.map +0 -1
  193. package/dist/utils/stream.helper.d.ts +0 -10
  194. package/dist/utils/stream.helper.js +0 -71
  195. package/dist/utils/stream.helper.js.map +0 -1
  196. package/dist/utils/time.record.d.ts +0 -15
  197. package/dist/utils/time.record.js +0 -52
  198. package/dist/utils/time.record.js.map +0 -1
  199. package/dist/utils/ultipa.datetime.d.ts +0 -14
  200. package/dist/utils/ultipa.datetime.js +0 -160
  201. package/dist/utils/ultipa.datetime.js.map +0 -1
  202. package/dist/utils/uql-maker.d.ts +0 -165
  203. package/dist/utils/uql-maker.js +0 -402
  204. package/dist/utils/uql-maker.js.map +0 -1
  205. package/dist/utils/uql.parse.d.ts +0 -27
  206. package/dist/utils/uql.parse.js +0 -205
  207. package/dist/utils/uql.parse.js.map +0 -1
  208. package/readme.md +0 -65
  209. package/src/proto/build.sh +0 -41
  210. package/src/proto/build_windows.sh +0 -40
  211. package/src/proto/ultipa.proto +0 -492
  212. package/src/proto/ultipa_grpc_pb.d.ts +0 -92
  213. package/src/proto/ultipa_grpc_pb.js +0 -414
  214. package/src/proto/ultipa_pb.d.ts +0 -1806
  215. package/src/proto/ultipa_pb.js +0 -13499
@@ -1,1596 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.JobResponse = exports.ResponseWithExistCheck = exports.InsertResponse = exports.Response = exports.DataItem = exports.getExplainPlansTreeTopNode = exports.PlanNode = exports.ExplainPlan = exports.Attr = exports.Table = exports.Header = exports.Property = exports.SchemaStats = exports.SchemaStat = exports.Schema = exports.GraphSet = exports.Graph = exports.Path = exports.Edge = exports.Node = exports.Projection = exports.HDCGraph = exports.Process = exports.Job = exports.Privilege = exports.Policy = exports.User = exports.Index = exports.JOB_STATUS = exports.DBType = exports.QueryType = exports.HDCSyncType = exports.PrivilegeLevel = exports.AuthenticateType = exports.ResultType = exports.ErrorCode = exports.Algo = exports.InsertType = exports.UltipaPropertyType = exports.getInsertErrorMessage = exports.InsertErrorMessages = exports.InsertErrorCode = exports.InsertRequestConfig = exports.RequestConfig = exports.UltipaConfig = void 0;
27
- const utils_1 = require("../utils");
28
- const ULTIPA_RPC = __importStar(require("../proto/ultipa_pb"));
29
- let { PropertyType: RRC_PropertyType, ResultType: RRC_ResultType, ErrorCode: RPC_ErrorCode, DBType: RPC_DBType, JOB_STATUS: RPC_JOB_STATUS, FollowerRole: RCP_FollowerRole, ResultType: RPC_ResultType, InsertType: RPC_InsertType, PlanNode: RPC_PlanNode, QueryType: RPC_QueryType } = ULTIPA_RPC;
30
- /**
31
- * Ultipa Configuration is the basic configuration that used for establishing the connections.
32
- */
33
- class UltipaConfig {
34
- /**
35
- * List of host addresses (IPs or URLs)
36
- * - Supports IPv4 and IPv6 addresses
37
- * - Supports URLs (if prefixed with https://, uses secure connection)
38
- * - Required
39
- */
40
- hosts;
41
- /** Username for authentication (Required) */
42
- username;
43
- /** Password for authentication (Required) */
44
- password;
45
- /** Default graph to interact with (Optional) */
46
- defaultGraph;
47
- /** Path string to CRT file, used for SSL connections. */
48
- crt = undefined;
49
- /**
50
- * Password encryption method
51
- * @default "MD5"
52
- */
53
- passwordEncrypt = "MD5";
54
- /**
55
- * Request timeout in seconds
56
- * @default 2147483647
57
- */
58
- timeout = 2147483647;
59
- /**
60
- * Heartbeat interval in milliseconds
61
- * Set to 0 to disable heartbeat
62
- * Used for keeping connection alive
63
- * @default 0
64
- */
65
- heartbeat = 0;
66
- /**
67
- * Maximum receive size in megabytes
68
- * @default 32
69
- */
70
- maxRecvSize = 32;
71
- }
72
- exports.UltipaConfig = UltipaConfig;
73
- /**
74
- * Configuration for each request, can be null
75
- */
76
- class RequestConfig {
77
- /**
78
- * specify graphName, if null will use defaultGraph of UltipaConfiguration
79
- */
80
- graph;
81
- /**
82
- * Operation timeout in seconds
83
- */
84
- timeout;
85
- /**
86
- * Specify the host to execute the request
87
- * */
88
- host;
89
- /**
90
- * request,thread num
91
- */
92
- thread;
93
- /**
94
- * name of time zone,
95
- * default: current time zone.
96
- * e.g. Aisa/Shanghai
97
- */
98
- timezone;
99
- /**
100
- * hour elapse from UTC
101
- * When both `timezone` and `timezoneOffset` are provided, `timezoneOffset` takes precedence.
102
- * Unit: hour. Example:” +08:30”,”-05:00”,“+2”,“-0300”
103
- */
104
- timezoneOffset;
105
- /**
106
- * If true the queryText will be logged.
107
- */
108
- logQueryText = false;
109
- /**
110
- * If true the request info will be logged.
111
- */
112
- withRequestInfo = false;
113
- }
114
- exports.RequestConfig = RequestConfig;
115
- /**
116
- * configuration for insert request. extends RequestConfig,have all RequestConfig property
117
- */
118
- class InsertRequestConfig extends RequestConfig {
119
- /**
120
- * NORMAL,
121
- * OVERWRITE,
122
- * UPSERT
123
- */
124
- insertType = InsertType.NORMAL;
125
- /**
126
- * Return data or not when insert/delete batch. true - not return data, false - return data.
127
- */
128
- silent = true;
129
- }
130
- exports.InsertRequestConfig = InsertRequestConfig;
131
- /**
132
- * The insert error code from server.
133
- */
134
- var InsertErrorCode;
135
- (function (InsertErrorCode) {
136
- InsertErrorCode[InsertErrorCode["ID_NOT_MATCH_UUID"] = 10001] = "ID_NOT_MATCH_UUID";
137
- InsertErrorCode[InsertErrorCode["ID_UUID_NOT_MATCH_SCHEMA"] = 10002] = "ID_UUID_NOT_MATCH_SCHEMA";
138
- InsertErrorCode[InsertErrorCode["FROM_ID_NOT_EXISTED"] = 10003] = "FROM_ID_NOT_EXISTED";
139
- InsertErrorCode[InsertErrorCode["TO_ID_NOT_EXISTED"] = 10004] = "TO_ID_NOT_EXISTED";
140
- InsertErrorCode[InsertErrorCode["ID_LEN"] = 10005] = "ID_LEN";
141
- InsertErrorCode[InsertErrorCode["NOT_NULL"] = 10006] = "NOT_NULL";
142
- InsertErrorCode[InsertErrorCode["UNIQUCHECK"] = 10007] = "UNIQUCHECK";
143
- InsertErrorCode[InsertErrorCode["ID_EMPTY"] = 10008] = "ID_EMPTY";
144
- InsertErrorCode[InsertErrorCode["FROM_ID_EMPTY"] = 10009] = "FROM_ID_EMPTY";
145
- InsertErrorCode[InsertErrorCode["TO_ID_EMPTY"] = 10010] = "TO_ID_EMPTY";
146
- InsertErrorCode[InsertErrorCode["DUPLICATE_ID"] = 10011] = "DUPLICATE_ID";
147
- InsertErrorCode[InsertErrorCode["KEY_CONSTRAINT_VIOLATED"] = 10012] = "KEY_CONSTRAINT_VIOLATED";
148
- InsertErrorCode[InsertErrorCode["OK_BUT_ID_EXISTED"] = 11001] = "OK_BUT_ID_EXISTED";
149
- InsertErrorCode[InsertErrorCode["OTHERS"] = 19999] = "OTHERS";
150
- })(InsertErrorCode = exports.InsertErrorCode || (exports.InsertErrorCode = {}));
151
- exports.InsertErrorMessages = {
152
- [InsertErrorCode.ID_NOT_MATCH_UUID]: "id and uuid do not match",
153
- [InsertErrorCode.ID_UUID_NOT_MATCH_SCHEMA]: "id and schema do not match",
154
- [InsertErrorCode.FROM_ID_NOT_EXISTED]: "fromId does not exist",
155
- [InsertErrorCode.TO_ID_NOT_EXISTED]: "toId does not exist",
156
- [InsertErrorCode.ID_LEN]: "length of id exceeds the maximum length (128 bytes)",
157
- [InsertErrorCode.NOT_NULL]: "violation of the NOT NULL constraint",
158
- [InsertErrorCode.UNIQUCHECK]: "violation of the UNIQUE constraint",
159
- [InsertErrorCode.ID_EMPTY]: "id cannot be empty",
160
- [InsertErrorCode.FROM_ID_EMPTY]: "fromId cannot be empty",
161
- [InsertErrorCode.TO_ID_EMPTY]: "toId cannot be empty",
162
- [InsertErrorCode.DUPLICATE_ID]: "duplicated id",
163
- [InsertErrorCode.KEY_CONSTRAINT_VIOLATED]: "violation of the EDGE KEY constraint",
164
- [InsertErrorCode.OK_BUT_ID_EXISTED]: "id already exists",
165
- [InsertErrorCode.OTHERS]: "other error"
166
- };
167
- function getInsertErrorMessage(errorCode) {
168
- return exports.InsertErrorMessages[errorCode] || exports.InsertErrorMessages[InsertErrorCode.OTHERS];
169
- }
170
- exports.getInsertErrorMessage = getInsertErrorMessage;
171
- /**
172
- * The schema property type.When create property.Need set property type.
173
- */
174
- var UltipaPropertyType;
175
- (function (UltipaPropertyType) {
176
- /**
177
- * Ultipa schema id type
178
- */
179
- UltipaPropertyType[UltipaPropertyType["ID"] = -1] = "ID";
180
- /**
181
- * Ultipa schema uuid type
182
- */
183
- UltipaPropertyType[UltipaPropertyType["UUID"] = -2] = "UUID";
184
- /**
185
- * Ultipa edge schema from_id type
186
- */
187
- UltipaPropertyType[UltipaPropertyType["FROM"] = -3] = "FROM";
188
- /**
189
- * Ultipa edge schema to_id type
190
- */
191
- UltipaPropertyType[UltipaPropertyType["TO"] = -4] = "TO";
192
- /**
193
- * Ultipa edge schema from_uuid type
194
- */
195
- UltipaPropertyType[UltipaPropertyType["FROM_UUID"] = -5] = "FROM_UUID";
196
- /**
197
- * Ultipa edge schema to_uuid type
198
- */
199
- UltipaPropertyType[UltipaPropertyType["TO_UUID"] = -6] = "TO_UUID";
200
- /**
201
- * Ignore
202
- */
203
- UltipaPropertyType[UltipaPropertyType["IGNORE"] = -7] = "IGNORE";
204
- /**
205
- * No type set
206
- */
207
- UltipaPropertyType[UltipaPropertyType["UNSET"] = 0] = "UNSET";
208
- /**
209
- * Signed 32 integer
210
- */
211
- UltipaPropertyType[UltipaPropertyType["INT32"] = 1] = "INT32";
212
- /**
213
- * Unsigned 32 integer
214
- */
215
- UltipaPropertyType[UltipaPropertyType["UINT32"] = 2] = "UINT32";
216
- /**
217
- * Signed 64 integer
218
- */
219
- UltipaPropertyType[UltipaPropertyType["INT64"] = 3] = "INT64";
220
- /**
221
- * Unsigned 64 integer
222
- */
223
- UltipaPropertyType[UltipaPropertyType["UINT64"] = 4] = "UINT64";
224
- /**
225
- * Single floating-point number
226
- */
227
- UltipaPropertyType[UltipaPropertyType["FLOAT"] = 5] = "FLOAT";
228
- /**
229
- * Double-precision floating-point numbers
230
- */
231
- UltipaPropertyType[UltipaPropertyType["DOUBLE"] = 6] = "DOUBLE";
232
- /**
233
- * A data type that represents a sequence of characters
234
- */
235
- UltipaPropertyType[UltipaPropertyType["STRING"] = 7] = "STRING";
236
- /**
237
- * Represents a combination of a date and a time
238
- */
239
- UltipaPropertyType[UltipaPropertyType["DATETIME"] = 8] = "DATETIME";
240
- /**
241
- * A data type that typically represents a specific point in time, often with a high level of precision
242
- */
243
- UltipaPropertyType[UltipaPropertyType["TIMESTAMP"] = 9] = "TIMESTAMP";
244
- /**
245
- * Used to store large amounts of text data
246
- */
247
- UltipaPropertyType[UltipaPropertyType["TEXT"] = 10] = "TEXT";
248
- /**
249
- * Stands for Binary Large Object
250
- */
251
- UltipaPropertyType[UltipaPropertyType["BLOB"] = 11] = "BLOB";
252
- /**
253
- * In the context of databases dealing with spatial data (e.g., in GIS systems)
254
- */
255
- UltipaPropertyType[UltipaPropertyType["POINT"] = 12] = "POINT";
256
- /**
257
- * Represents a fixed-point number with a specified precision and scale
258
- */
259
- UltipaPropertyType[UltipaPropertyType["DECIMAL"] = 13] = "DECIMAL";
260
- /**
261
- * A data structure that can hold a collection of elements
262
- */
263
- UltipaPropertyType[UltipaPropertyType["LIST"] = 14] = "LIST";
264
- /**
265
- * A data structure that stores a collection of unique elements
266
- */
267
- UltipaPropertyType[UltipaPropertyType["SET"] = 15] = "SET";
268
- /**
269
- * A data structure that stores key-value pairs
270
- */
271
- UltipaPropertyType[UltipaPropertyType["MAP"] = 16] = "MAP";
272
- /**
273
- * Null type
274
- */
275
- UltipaPropertyType[UltipaPropertyType["NULL"] = 17] = "NULL";
276
- /**
277
- * Stands for Boolean
278
- */
279
- UltipaPropertyType[UltipaPropertyType["BOOL"] = 18] = "BOOL";
280
- })(UltipaPropertyType = exports.UltipaPropertyType || (exports.UltipaPropertyType = {}));
281
- /**
282
- * The insertion mode.
283
- */
284
- var InsertType;
285
- (function (InsertType) {
286
- /**
287
- * Insert new data
288
- */
289
- InsertType[InsertType["NORMAL"] = 0] = "NORMAL";
290
- /**
291
- * The insert overwrite operation first clears the existing data in the target location and then inserts new data
292
- */
293
- InsertType[InsertType["OVERWRITE"] = 1] = "OVERWRITE";
294
- /**
295
- * If the data record to be inserted already exists in the target location the record will be updated; if it does not exist, a new record will be inserted
296
- */
297
- InsertType[InsertType["UPSERT"] = 2] = "UPSERT";
298
- })(InsertType = exports.InsertType || (exports.InsertType = {}));
299
- /**
300
- * Algorithm Detail Response Data
301
- */
302
- class Algo {
303
- /**
304
- * name
305
- */
306
- name;
307
- /**
308
- * type
309
- */
310
- type;
311
- /**
312
- * write support type
313
- */
314
- writeSupportType;
315
- /**
316
- * Whether the algorithm can be rolled back to previous version.
317
- */
318
- canRollback;
319
- /**
320
- * config context
321
- */
322
- configContext;
323
- /**
324
- * version
325
- */
326
- version;
327
- /**
328
- * algo params
329
- */
330
- params;
331
- /**
332
- * algo description
333
- */
334
- description;
335
- }
336
- exports.Algo = Algo;
337
- /**
338
- * TODO delete Code
339
- */
340
- var ErrorCode;
341
- (function (ErrorCode) {
342
- ErrorCode[ErrorCode["SUCCESS"] = RPC_ErrorCode.SUCCESS] = "SUCCESS";
343
- ErrorCode[ErrorCode["FAILED"] = RPC_ErrorCode.FAILED] = "FAILED";
344
- ErrorCode[ErrorCode["PARAM_ERROR"] = RPC_ErrorCode.PARAM_ERROR] = "PARAM_ERROR";
345
- ErrorCode[ErrorCode["BASE_DB_ERROR"] = RPC_ErrorCode.BASE_DB_ERROR] = "BASE_DB_ERROR";
346
- ErrorCode[ErrorCode["ENGINE_ERROR"] = RPC_ErrorCode.ENGINE_ERROR] = "ENGINE_ERROR";
347
- ErrorCode[ErrorCode["SYSTEM_ERROR"] = RPC_ErrorCode.SYSTEM_ERROR] = "SYSTEM_ERROR";
348
- ErrorCode[ErrorCode["SYNTAX_ERROR"] = RPC_ErrorCode.SYNTAX_ERROR] = "SYNTAX_ERROR";
349
- ErrorCode[ErrorCode["PERMISSION_DENIED"] = RPC_ErrorCode.PERMISSION_DENIED] = "PERMISSION_DENIED";
350
- ErrorCode[ErrorCode["DUPLICATE_ID"] = RPC_ErrorCode.DUPLICATE_ID] = "DUPLICATE_ID";
351
- ErrorCode[ErrorCode["RAFT_REDIRECT"] = RPC_ErrorCode.RAFT_REDIRECT] = "RAFT_REDIRECT";
352
- ErrorCode[ErrorCode["RAFT_LEADER_NOT_YET_ELECTED"] = RPC_ErrorCode.RAFT_LEADER_NOT_YET_ELECTED] = "RAFT_LEADER_NOT_YET_ELECTED";
353
- ErrorCode[ErrorCode["RAFT_LOG_ERROR"] = RPC_ErrorCode.RAFT_LOG_ERROR] = "RAFT_LOG_ERROR";
354
- ErrorCode[ErrorCode["NOT_RAFT_MODE"] = RPC_ErrorCode.NOT_RAFT_MODE] = "NOT_RAFT_MODE";
355
- ErrorCode[ErrorCode["RAFT_NO_AVAILABLE_FOLLOWERS"] = RPC_ErrorCode.RAFT_NO_AVAILABLE_FOLLOWERS] = "RAFT_NO_AVAILABLE_FOLLOWERS";
356
- ErrorCode[ErrorCode["RAFT_NO_AVAILABLE_ALGO_SERVERS"] = RPC_ErrorCode.RAFT_NO_AVAILABLE_ALGO_SERVERS] = "RAFT_NO_AVAILABLE_ALGO_SERVERS";
357
- ErrorCode[ErrorCode["UNKNOWN_ERROR"] = 1000] = "UNKNOWN_ERROR";
358
- })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
359
- var ResultType;
360
- (function (ResultType) {
361
- ResultType[ResultType["RESULT_TYPE_UNSET"] = RPC_ResultType.RESULT_TYPE_UNSET] = "RESULT_TYPE_UNSET";
362
- ResultType[ResultType["RESULT_TYPE_PATH"] = RPC_ResultType.RESULT_TYPE_PATH] = "RESULT_TYPE_PATH";
363
- ResultType[ResultType["RESULT_TYPE_NODE"] = RPC_ResultType.RESULT_TYPE_NODE] = "RESULT_TYPE_NODE";
364
- ResultType[ResultType["RESULT_TYPE_EDGE"] = RPC_ResultType.RESULT_TYPE_EDGE] = "RESULT_TYPE_EDGE";
365
- ResultType[ResultType["RESULT_TYPE_ATTR"] = RPC_ResultType.RESULT_TYPE_ATTR] = "RESULT_TYPE_ATTR";
366
- ResultType[ResultType["RESULT_TYPE_TABLE"] = RPC_ResultType.RESULT_TYPE_TABLE] = "RESULT_TYPE_TABLE";
367
- })(ResultType = exports.ResultType || (exports.ResultType = {}));
368
- var AuthenticateType;
369
- (function (AuthenticateType) {
370
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_UNSET"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_UNSET] = "PERMISSION_TYPE_UNSET";
371
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_UQL"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_UQL] = "PERMISSION_TYPE_UQL";
372
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_GQL"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_GQL] = "PERMISSION_TYPE_GQL";
373
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_INSERTNODES"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_INSERTNODES] = "PERMISSION_TYPE_INSERTNODES";
374
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_INSERTEDGES"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_INSERTEDGES] = "PERMISSION_TYPE_INSERTEDGES";
375
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_EXPORT"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_EXPORT] = "PERMISSION_TYPE_EXPORT";
376
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_DOWNLOADFILE"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_DOWNLOADFILE] = "PERMISSION_TYPE_DOWNLOADFILE";
377
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_INSTALLALGO"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_INSTALLALGO] = "PERMISSION_TYPE_INSTALLALGO";
378
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_UNINSTALLALGO"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_UNINSTALLALGO] = "PERMISSION_TYPE_UNINSTALLALGO";
379
- AuthenticateType[AuthenticateType["PERMISSION_TYPE_ROLLBACKALGO"] = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_ROLLBACKALGO] = "PERMISSION_TYPE_ROLLBACKALGO";
380
- // PERMISSION_TYPE_UPLOADER = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_UPLOADER,
381
- // PERMISSION_TYPE_CREATEGRAPHBYUPLOADER = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_CREATEGRAPHBYUPLOADER,
382
- // PERMISSION_TYPE_INSTALLEXTA = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_INSTALLEXTA,
383
- // PERMISSION_TYPE_UNINSTALLEXTA = ULTIPA_RPC.AuthenticateType.PERMISSION_TYPE_UNINSTALLEXTA,
384
- })(AuthenticateType = exports.AuthenticateType || (exports.AuthenticateType = {}));
385
- /**
386
- * privilege level type
387
- */
388
- var PrivilegeLevel;
389
- (function (PrivilegeLevel) {
390
- /**
391
- * Graph privilege type
392
- */
393
- PrivilegeLevel[PrivilegeLevel["GraphLevel"] = 0] = "GraphLevel";
394
- /**
395
- * System privilege type
396
- */
397
- PrivilegeLevel[PrivilegeLevel["SystemLevel"] = 1] = "SystemLevel";
398
- })(PrivilegeLevel = exports.PrivilegeLevel || (exports.PrivilegeLevel = {}));
399
- /**
400
- * HDC synchronization type.
401
- */
402
- var HDCSyncType;
403
- (function (HDCSyncType) {
404
- /**
405
- * Static synchronization
406
- */
407
- HDCSyncType["STATIC"] = "static";
408
- /**
409
- * Asynchronous synchronization
410
- */
411
- HDCSyncType["ASYNC"] = "async";
412
- /**
413
- * Synchronous synchronization
414
- */
415
- HDCSyncType["SYNC"] = "sync";
416
- })(HDCSyncType = exports.HDCSyncType || (exports.HDCSyncType = {}));
417
- /** Query type contains UQL,GQL */
418
- var QueryType;
419
- (function (QueryType) {
420
- QueryType[QueryType["QL_UNSET"] = 0] = "QL_UNSET";
421
- QueryType[QueryType["UQL"] = 1] = "UQL";
422
- QueryType[QueryType["GQL"] = 2] = "GQL";
423
- })(QueryType = exports.QueryType || (exports.QueryType = {}));
424
- /**
425
- * The schema type in database.
426
- */
427
- var DBType;
428
- (function (DBType) {
429
- /**
430
- * Node
431
- */
432
- DBType[DBType["DBNODE"] = RPC_DBType.DBNODE] = "DBNODE";
433
- /**
434
- * Edge
435
- */
436
- DBType[DBType["DBEDGE"] = RPC_DBType.DBEDGE] = "DBEDGE";
437
- })(DBType = exports.DBType || (exports.DBType = {}));
438
- /**
439
- * Job status
440
- */
441
- var JOB_STATUS;
442
- (function (JOB_STATUS) {
443
- JOB_STATUS[JOB_STATUS["JOB_PENDING"] = RPC_JOB_STATUS.JOB_PENDING] = "JOB_PENDING";
444
- JOB_STATUS[JOB_STATUS["JOB_COMPUTING"] = RPC_JOB_STATUS.JOB_COMPUTING] = "JOB_COMPUTING";
445
- JOB_STATUS[JOB_STATUS["JOB_WRITING"] = RPC_JOB_STATUS.JOB_WRITING] = "JOB_WRITING";
446
- JOB_STATUS[JOB_STATUS["JOB_DONE"] = RPC_JOB_STATUS.JOB_DONE] = "JOB_DONE";
447
- JOB_STATUS[JOB_STATUS["JOB_FAILED"] = RPC_JOB_STATUS.JOB_FAILED] = "JOB_FAILED";
448
- JOB_STATUS[JOB_STATUS["JOB_STOPPED"] = RPC_JOB_STATUS.JOB_STOPPED] = "JOB_STOPPED";
449
- })(JOB_STATUS = exports.JOB_STATUS || (exports.JOB_STATUS = {}));
450
- /**
451
- * Property index
452
- */
453
- class Index {
454
- id;
455
- /**
456
- * Index name
457
- */
458
- name;
459
- /**
460
- * Index on which properties
461
- */
462
- properties;
463
- /**
464
- * Index on which scehma
465
- */
466
- schema;
467
- /**
468
- * Index status
469
- */
470
- status;
471
- /**
472
- * Index size
473
- */
474
- size;
475
- /**
476
- * Node index or edge index
477
- */
478
- dbType;
479
- }
480
- exports.Index = Index;
481
- /**
482
- * User
483
- */
484
- class User {
485
- /**
486
- * username
487
- */
488
- username;
489
- /**
490
- * pasword
491
- */
492
- password;
493
- /**
494
- * create time
495
- */
496
- createdTime;
497
- /**
498
- * System privileges list
499
- */
500
- systemPrivileges;
501
- /**
502
- * Graph privileges key value map
503
- */
504
- graphPrivileges;
505
- /**
506
- * Property privileges
507
- */
508
- propertyPrivileges;
509
- /**
510
- * Policy list
511
- */
512
- policies;
513
- }
514
- exports.User = User;
515
- /**
516
- * A policy is a set of privileges designed for a specific user role, often encompassing multiple privileges and other policies. Effective policy design and usage enable role-based access control.
517
- */
518
- class Policy {
519
- /** Policy name */
520
- name;
521
- /** Atlas permissions included in the policy */
522
- systemPrivileges;
523
- /** System permissions included in the policy */
524
- graphPrivileges;
525
- /** Permissions for properties included in the policy */
526
- propertyPrivileges;
527
- /** Other strategies included in the policy */
528
- policies;
529
- }
530
- exports.Policy = Policy;
531
- /**
532
- * Control user permissions to operate on the graph database
533
- */
534
- class Privilege {
535
- /**
536
- * privilege name
537
- */
538
- name;
539
- /**
540
- * privilege type
541
- */
542
- level;
543
- }
544
- exports.Privilege = Privilege;
545
- /**
546
- * The background job INFO from database.
547
- */
548
- class Job {
549
- /**
550
- * job id
551
- */
552
- id;
553
- /**
554
- * job run in graph name
555
- */
556
- graphName;
557
- /**
558
- * job query
559
- */
560
- query;
561
- /**
562
- * Job types, such as CREATE_INDEX, CACHE, COMPACT
563
- */
564
- type;
565
- /**
566
- * Error messages encountered during job execution (if any)
567
- */
568
- errMsg;
569
- /**
570
- * The results generated by assignments, such as output files or statistical overviews of algorithms.
571
- */
572
- result;
573
- /**
574
- * job start time
575
- */
576
- startTime;
577
- /**
578
- * job end time
579
- */
580
- endTime;
581
- /**
582
- * Current state of the job, which can be FINISHED, RUNNING, STOPPING, STOPPED or FAILED.
583
- */
584
- status;
585
- /**
586
- * Progress updates for the job, such as indications that the write operation has been started.
587
- */
588
- progress;
589
- }
590
- exports.Job = Job;
591
- /**
592
- * The response items of top()
593
- */
594
- class Process {
595
- /**
596
- * process id
597
- */
598
- processId;
599
- /**
600
- * process query
601
- */
602
- processQuery;
603
- /**
604
- * duration
605
- */
606
- duration;
607
- /**
608
- * status
609
- */
610
- status;
611
- }
612
- exports.Process = Process;
613
- /**
614
- * hdc.graph.show()
615
- */
616
- class HDCGraph {
617
- /**
618
- * name
619
- */
620
- name;
621
- /**
622
- * graph name
623
- */
624
- graphName;
625
- /**
626
- * status
627
- */
628
- status;
629
- /**
630
- * stats
631
- */
632
- stats;
633
- /**
634
- * is default
635
- */
636
- isDefault;
637
- /**
638
- * hdc server name
639
- */
640
- hdcServerName;
641
- /**
642
- * hdc server status
643
- */
644
- hdcServerStatus;
645
- /**
646
- * hdc config name
647
- */
648
- config;
649
- }
650
- exports.HDCGraph = HDCGraph;
651
- /**
652
- * projection
653
- */
654
- class Projection {
655
- /**
656
- * name
657
- */
658
- name;
659
- /**
660
- * graph name
661
- */
662
- graphName;
663
- /**
664
- * status
665
- */
666
- status;
667
- /**
668
- * stats
669
- */
670
- stats;
671
- /**
672
- * config
673
- */
674
- config;
675
- }
676
- exports.Projection = Projection;
677
- /**
678
- * The graph data about nodes.
679
- */
680
- class Node {
681
- /**
682
- * _uuid
683
- */
684
- uuid;
685
- /**
686
- * _id
687
- */
688
- id;
689
- /**
690
- * schema
691
- */
692
- schema;
693
- /**
694
- * key: value
695
- */
696
- values;
697
- /**
698
- * returns property value
699
- * @param propName property name
700
- * @returns property value
701
- */
702
- get(propName) {
703
- return this.values[propName];
704
- }
705
- /**
706
- * sets property value
707
- * @param propName
708
- * @param value
709
- */
710
- set(propName, value) {
711
- if (!this.values) {
712
- this.values = {};
713
- }
714
- if (this.values) {
715
- this.values[propName] = value;
716
- }
717
- }
718
- }
719
- exports.Node = Node;
720
- function NewNodeRow(jsonObj) {
721
- let v = new Node();
722
- Object.assign(v, jsonObj);
723
- return v;
724
- }
725
- function NewNodeTable(jsonArray) {
726
- let v = [];
727
- jsonArray?.forEach(o => {
728
- v.push(NewNodeRow(o));
729
- });
730
- return v;
731
- }
732
- /**
733
- * Stores edge data.
734
- */
735
- class Edge {
736
- // _id: string; TBD
737
- /**
738
- * _uuid
739
- */
740
- uuid;
741
- /**
742
- * _from_uuid
743
- */
744
- fromUuid;
745
- /**
746
- * _to_uuid
747
- */
748
- toUuid;
749
- /**
750
- * _from: from id
751
- */
752
- from;
753
- /**
754
- * _to: to id
755
- */
756
- to;
757
- /**
758
- * schema
759
- */
760
- schema;
761
- /**
762
- * key: value
763
- */
764
- values;
765
- /**
766
- * returns property value
767
- * @param propName property name
768
- * @returns property value
769
- */
770
- get(propName) {
771
- return this.values[propName];
772
- }
773
- /**
774
- * set property value
775
- * @param propName
776
- * @param value
777
- */
778
- set(propName, value) {
779
- if (!this.values) {
780
- this.values = {};
781
- }
782
- if (this.values) {
783
- this.values[propName] = value;
784
- }
785
- }
786
- }
787
- exports.Edge = Edge;
788
- function NewEdgeRow(jsonObj) {
789
- let v = new Edge();
790
- Object.assign(v, jsonObj);
791
- return v;
792
- }
793
- function NewEdgeTable(jsonArray) {
794
- let v = [];
795
- jsonArray?.forEach(o => {
796
- v.push(NewEdgeRow(o));
797
- });
798
- return v;
799
- }
800
- function NewEdgeAlias(jsonObj) {
801
- let v = {};
802
- Object.assign(v, jsonObj);
803
- v.edges = NewEdgeTable(v.edges);
804
- return v;
805
- }
806
- /**
807
- * Path entity
808
- */
809
- class Path {
810
- /**
811
- * Node uuid list
812
- */
813
- nodeUuids;
814
- /**
815
- * Edge uuid list
816
- */
817
- edgeUuids;
818
- /**
819
- * nodes details
820
- */
821
- nodes = new Map();
822
- /**
823
- * edges details
824
- */
825
- edges = new Map();
826
- /**
827
- * return node by index
828
- * @param index node index
829
- * @returns node
830
- /**
831
- * return edge length
832
- * @returns edge length
833
- */
834
- length() {
835
- return this.edgeUuids?.length || 0;
836
- }
837
- }
838
- exports.Path = Path;
839
- function NewPath(jsonObj) {
840
- let v = new Path();
841
- Object.assign(v, jsonObj);
842
- if (v.nodeUuids) {
843
- v.nodeUuids = NewNodeTable(jsonObj).map(j => j.uuid);
844
- }
845
- if (v.edgeUuids) {
846
- v.edgeUuids = NewEdgeTable(jsonObj).map(j => j.uuid);
847
- }
848
- return v;
849
- }
850
- function NewPaths(jsonArray) {
851
- let v = [];
852
- jsonArray?.forEach(obj => {
853
- v.push(NewPath(obj));
854
- });
855
- return v;
856
- }
857
- /**
858
- * Graph that contains nodes, edges maps and paths.
859
- */
860
- class Graph {
861
- /**
862
- * Graph path list
863
- */
864
- paths;
865
- /**
866
- * Graph all nodes
867
- */
868
- nodes;
869
- /**
870
- * Graph all edges
871
- */
872
- edges;
873
- /**
874
- * Convert path list to
875
- * @returns Path[]
876
- */
877
- getPaths() {
878
- return this.paths;
879
- }
880
- /**
881
- * Add node to nodes
882
- * @param node new Node
883
- */
884
- addNode(node) {
885
- this.nodes.set(node.uuid, node);
886
- }
887
- /**
888
- * Add edge to graph
889
- * @param edge new Edge
890
- */
891
- addEdge(edge) {
892
- this.edges.set(edge.uuid, edge);
893
- }
894
- }
895
- exports.Graph = Graph;
896
- function NewGraph(jsonArray) {
897
- let v = new Graph();
898
- Object.assign(v, jsonArray);
899
- if (v.paths) {
900
- v.paths = NewPaths(jsonArray.paths);
901
- }
902
- if (v.edges) {
903
- v.edges = new Map();
904
- NewEdgeTable(jsonArray.edges).forEach(e => {
905
- v.edges.set(e.uuid, e);
906
- });
907
- }
908
- if (v.nodes) {
909
- v.nodes = new Map();
910
- NewNodeTable(jsonArray.nodes).forEach(n => {
911
- v.nodes.set(n.uuid, n);
912
- });
913
- }
914
- return v;
915
- }
916
- /**
917
- * GraphSet that contains the graph name and total nodes and edges.
918
- */
919
- class GraphSet {
920
- /**
921
- * graph id
922
- */
923
- id;
924
- /**
925
- * graph name
926
- */
927
- name;
928
- /**
929
- * number of nodes
930
- */
931
- totalNodes;
932
- /**
933
- * number of edges
934
- */
935
- totalEdges;
936
- /**
937
- * graph shards list
938
- */
939
- shards;
940
- /**
941
- * the partition type of graph
942
- */
943
- partitionBy;
944
- /**
945
- * status
946
- */
947
- status;
948
- /**
949
- * graph description
950
- */
951
- description;
952
- /**
953
- * the number of slots
954
- */
955
- slotNum;
956
- }
957
- exports.GraphSet = GraphSet;
958
- /**
959
- * Node or edge schemas
960
- */
961
- class Schema {
962
- /**
963
- * schema name
964
- */
965
- name;
966
- /**
967
- * schema description
968
- */
969
- description;
970
- /**
971
- * properties of schema
972
- */
973
- properties;
974
- /**
975
- * schema type
976
- */
977
- dbType;
978
- /**
979
- * node or edge count
980
- */
981
- total;
982
- /**
983
- * schema id
984
- */
985
- id;
986
- /**
987
- * store the count for each pair of start and end node schemas of current edge schema.
988
- */
989
- stats = [];
990
- /**
991
- * Convert list of schemas to a map of schema Schema name -> Schema
992
- * @param schemas
993
- * @returns
994
- */
995
- static toDict(schemas) {
996
- let dict = new Map();
997
- schemas.forEach(schema => {
998
- dict.set(schema.name, schema);
999
- });
1000
- return dict;
1001
- }
1002
- }
1003
- exports.Schema = Schema;
1004
- /**
1005
- * Statistics for node schema pairs in edge schema
1006
- */
1007
- class SchemaStat {
1008
- /**
1009
- * Schema type
1010
- */
1011
- dbType;
1012
- /**
1013
- * Schema name
1014
- */
1015
- schema;
1016
- /**
1017
- * From Schema name
1018
- */
1019
- fromSchema;
1020
- /**
1021
- * To Schema name
1022
- */
1023
- toSchema;
1024
- /**
1025
- * Number of edges between these node schemas
1026
- */
1027
- count;
1028
- }
1029
- exports.SchemaStat = SchemaStat;
1030
- class SchemaStats {
1031
- stats = [];
1032
- }
1033
- exports.SchemaStats = SchemaStats;
1034
- /**
1035
- * The properties of schema
1036
- */
1037
- class Property {
1038
- /**
1039
- * Property name
1040
- */
1041
- name;
1042
- /**
1043
- * PropertyType Enum
1044
- */
1045
- type;
1046
- /**
1047
- * Sub PropertyType Enum
1048
- */
1049
- subType;
1050
- /**
1051
- * This property is lte
1052
- */
1053
- lte;
1054
- /**
1055
- * Whether it has read permission or not true-yes,false-no
1056
- */
1057
- read;
1058
- /**
1059
- * Whether it has write permission or not true-yes,false-no
1060
- */
1061
- write;
1062
- /**
1063
- * Property`s schema name
1064
- */
1065
- schema;
1066
- /**
1067
- * Property`s description
1068
- */
1069
- description;
1070
- /**
1071
- * encrypt method for this property, if null, value is not encrypted
1072
- */
1073
- encrypt;
1074
- /**
1075
- * additional info for this property. For decimal property, it represents the length and precision in parentheses, default is "(20,8)"
1076
- */
1077
- decimalExtra;
1078
- }
1079
- exports.Property = Property;
1080
- class Header {
1081
- propertyName;
1082
- propertyType;
1083
- }
1084
- exports.Header = Header;
1085
- /**
1086
- * Table
1087
- */
1088
- class Table {
1089
- /**
1090
- * Table name
1091
- */
1092
- name;
1093
- /**
1094
- * Table headers
1095
- */
1096
- headers;
1097
- /**
1098
- * Table rows
1099
- */
1100
- rows;
1101
- /**
1102
- * Convert table to list of KV
1103
- * @returns
1104
- */
1105
- toKV() {
1106
- return utils_1.FormatResponse.tableToArray(this);
1107
- }
1108
- getHeaders() {
1109
- return this.headers;
1110
- }
1111
- getRows() {
1112
- return this.rows;
1113
- }
1114
- }
1115
- exports.Table = Table;
1116
- ;
1117
- /**
1118
- * Attribute Response Data
1119
- */
1120
- class Attr {
1121
- /**
1122
- * Ultipa property type
1123
- */
1124
- propertyType;
1125
- /**
1126
- * Ultipa result type
1127
- */
1128
- resultType;
1129
- /**
1130
- * Attr values
1131
- */
1132
- values;
1133
- /**
1134
- * Attr name
1135
- */
1136
- name;
1137
- }
1138
- exports.Attr = Attr;
1139
- class ExplainPlan {
1140
- planNodes = [];
1141
- }
1142
- exports.ExplainPlan = ExplainPlan;
1143
- class PlanNode {
1144
- alias;
1145
- childrenNum;
1146
- uql;
1147
- infos;
1148
- }
1149
- exports.PlanNode = PlanNode;
1150
- function getExplainPlansTreeTopNode(plans) {
1151
- let top = null;
1152
- let nodes = [];
1153
- plans?.planNodes.forEach((node, i) => {
1154
- node = {
1155
- ...node
1156
- };
1157
- if (i == 0) {
1158
- top = node;
1159
- }
1160
- let lastNode = nodes[nodes.length - 1];
1161
- // if (node.childrenNum > 0) {
1162
- // node.children = []
1163
- // nodes.push(node)
1164
- // }
1165
- // if (lastNode) {
1166
- // lastNode.children.push(node)
1167
- // if (lastNode.children.length == lastNode.childrenNum) {
1168
- // nodes = nodes.filter(n => n != lastNode)
1169
- // }
1170
- // }
1171
- });
1172
- return top;
1173
- }
1174
- exports.getExplainPlansTreeTopNode = getExplainPlansTreeTopNode;
1175
- /**
1176
- * The get () method or alias () method of the Response class returns a DataItem embedded in the query result. You need to use the as < Type > () method of the DataItem to convert the result to the appropriate driver type.
1177
- */
1178
- class DataItem {
1179
- /**
1180
- * Alias name
1181
- */
1182
- alias;
1183
- /**
1184
- * Ultipa result type
1185
- */
1186
- type;
1187
- /**
1188
- * result entity
1189
- */
1190
- entities;
1191
- constructor(alias, type, entities) {
1192
- this.entities = entities;
1193
- this.alias = alias;
1194
- this.type = type;
1195
- }
1196
- _asTypeError(type) {
1197
- if (this.type != type) {
1198
- throw new Error(`DataItem ${this.alias} is not type ${ResultType[type]}, but ${ResultType[this.type]}`);
1199
- }
1200
- }
1201
- asNodes() {
1202
- this._asTypeError(ResultType.RESULT_TYPE_NODE);
1203
- return this.entities;
1204
- }
1205
- asFirstNode() {
1206
- return this.asNodes()[0];
1207
- }
1208
- asEdges() {
1209
- this._asTypeError(ResultType.RESULT_TYPE_EDGE);
1210
- return this.entities;
1211
- }
1212
- asFirstEdge() {
1213
- this._asTypeError(ResultType.RESULT_TYPE_EDGE);
1214
- return this.asEdges()[0];
1215
- }
1216
- asPaths() {
1217
- this._asTypeError(ResultType.RESULT_TYPE_PATH);
1218
- return this.asGraph().paths;
1219
- }
1220
- asGraph() {
1221
- this._asTypeError(ResultType.RESULT_TYPE_PATH);
1222
- let graph = this.entities;
1223
- graph.paths.forEach(p => {
1224
- p.nodes = new Map();
1225
- p.edges = new Map();
1226
- p.nodeUuids.forEach(uuid => {
1227
- p.nodes.set(uuid, graph.nodes.get(uuid));
1228
- });
1229
- p.edgeUuids.forEach(uuid => {
1230
- p.edges.set(uuid, graph.edges.get(uuid));
1231
- });
1232
- });
1233
- return graph;
1234
- }
1235
- asTable() {
1236
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1237
- let table = new Table();
1238
- Object.assign(table, this.entities);
1239
- return table;
1240
- }
1241
- asAttr() {
1242
- this._asTypeError(ResultType.RESULT_TYPE_ATTR);
1243
- return this.entities;
1244
- }
1245
- asGraphSets() {
1246
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1247
- let table = this.asTable().toKV();
1248
- let graphSets = [];
1249
- table.forEach((kv) => {
1250
- let graphSet = new GraphSet();
1251
- graphSet.name = kv["name"];
1252
- graphSet.totalEdges = kv["total_edges"];
1253
- graphSet.totalNodes = kv["total_nodes"];
1254
- graphSet.description = kv["description"];
1255
- graphSet.status = kv["status"];
1256
- graphSet.partitionBy = kv["partition_by"];
1257
- graphSet.slotNum = parseInt(kv["slot_num"]);
1258
- graphSet.shards = kv["shards"].split(',').map(shard => shard.trim());
1259
- graphSet.id = kv["id"];
1260
- graphSets.push(graphSet);
1261
- });
1262
- return graphSets;
1263
- }
1264
- asProperties() {
1265
- let properties = [];
1266
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1267
- let dbType;
1268
- if (this.alias.startsWith("_node")) {
1269
- dbType = DBType.DBNODE;
1270
- }
1271
- else if (this.alias.startsWith("_edge")) {
1272
- dbType = DBType.DBEDGE;
1273
- }
1274
- else {
1275
- throw new Error(`DataItem ${this.alias} cannot transfer to Property`);
1276
- }
1277
- let table = this.asTable().toKV();
1278
- table.forEach(row => {
1279
- let property = new Property();
1280
- property.name = row["name"];
1281
- property.lte = row["lte"].toLowerCase() === "true" ? true : false;
1282
- property.read = row["read"] === "1" ? true : false;
1283
- property.write = row["write"] === "1" ? true : false;
1284
- property.schema = row["schema"];
1285
- property.description = row["description"];
1286
- property.encrypt = row["encrypt"];
1287
- let type = row['type'];
1288
- let resType = utils_1.PropertyUtils.GetPropertyType(type);
1289
- if (resType.decimalExtra) {
1290
- property.decimalExtra = resType.decimalExtra;
1291
- }
1292
- property.type = resType.type;
1293
- property.subType = resType.subTypes;
1294
- properties.push(property);
1295
- });
1296
- return properties;
1297
- }
1298
- asSchemas() {
1299
- // return this.asTableWithT<Schema>()
1300
- let schemas = [];
1301
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1302
- // let dbType = this.alias?.startsWith("_node") ? DBType.DBNODE;
1303
- let dbType;
1304
- if (this.alias.startsWith("_node")) {
1305
- dbType = DBType.DBNODE;
1306
- }
1307
- else if (this.alias.startsWith("_edge")) {
1308
- dbType = DBType.DBEDGE;
1309
- }
1310
- else {
1311
- throw new Error(`DataItem ${this.alias} cannot transfer to Schema`);
1312
- }
1313
- let table = this.asTable().toKV();
1314
- table.forEach(row => {
1315
- let schema = new Schema();
1316
- schema.dbType = dbType;
1317
- schema.id = row["id"];
1318
- schema.name = row["name"];
1319
- schema.description = row["description"];
1320
- let properties = [];
1321
- JSON.parse(row['properties'].toString()).forEach(o => {
1322
- let property = new Property();
1323
- let type = utils_1.PropertyUtils.GetPropertyType(o.type);
1324
- property.name = o.name;
1325
- property.type = type.type;
1326
- property.subType = type.subTypes;
1327
- property.lte = o.lte === "true" ? true : false;
1328
- property.read = o.read;
1329
- property.write = o.write;
1330
- property.schema = schema.name;
1331
- property.description = o.description;
1332
- property.encrypt = o.encrypt;
1333
- properties.push(property);
1334
- });
1335
- schema.properties = properties;
1336
- schemas.push(schema);
1337
- });
1338
- return schemas;
1339
- }
1340
- asIndexes() {
1341
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1342
- let dbType;
1343
- if (this.alias.startsWith("_node")) {
1344
- dbType = DBType.DBNODE;
1345
- }
1346
- else if (this.alias.startsWith("_edge")) {
1347
- dbType = DBType.DBEDGE;
1348
- }
1349
- let indexes = [];
1350
- let table = this.asTable().toKV();
1351
- table.forEach(row => {
1352
- let index = new Index();
1353
- index.id = row["id"];
1354
- index.name = row["name"];
1355
- index.schema = row["schema"];
1356
- index.properties = row["properties"];
1357
- index.status = row["status"];
1358
- index.dbType = dbType;
1359
- indexes.push(index);
1360
- });
1361
- return indexes;
1362
- }
1363
- asPolicies() {
1364
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1365
- let policies = [];
1366
- let table = this.asTable().toKV();
1367
- table.forEach(row => {
1368
- let policy = new Policy();
1369
- policy.name = row["name"];
1370
- policy.graphPrivileges = new Map(Object.entries(JSON.parse(row["graphPrivileges"])));
1371
- policy.systemPrivileges = JSON.parse(row["systemPrivileges"]);
1372
- policy.propertyPrivileges = JSON.parse(row["propertyPrivileges"]);
1373
- policy.policies = JSON.parse(row["policies"]);
1374
- policies.push(policy);
1375
- });
1376
- return policies;
1377
- }
1378
- asUsers() {
1379
- // return this.asTableWithT<User>()
1380
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1381
- let users = [];
1382
- let table = this.asTable().toKV();
1383
- table.forEach(row => {
1384
- let user = new User();
1385
- user.username = row["username"];
1386
- user.createdTime = row["create"];
1387
- user.graphPrivileges = new Map(Object.entries(JSON.parse(row["graphPrivileges"])));
1388
- user.systemPrivileges = JSON.parse(row["systemPrivileges"]);
1389
- user.propertyPrivileges = JSON.parse(row["propertyPrivileges"]);
1390
- user.policies = JSON.parse(row["policies"]);
1391
- users.push(user);
1392
- });
1393
- return users;
1394
- }
1395
- asPrivileges() {
1396
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1397
- let privileges = [];
1398
- let table = this.asTable().toKV();
1399
- table.forEach(row => {
1400
- let graphPrivileges = JSON.parse(row['graphPrivileges']);
1401
- graphPrivileges.forEach((privilege) => {
1402
- let graphPrivilege = new Privilege();
1403
- graphPrivilege.name = privilege;
1404
- graphPrivilege.level = PrivilegeLevel.GraphLevel;
1405
- privileges.push(graphPrivilege);
1406
- });
1407
- let systemPrivileges = JSON.parse(row['systemPrivileges']);
1408
- systemPrivileges.forEach((privilege) => {
1409
- let systemPrivilege = new Privilege();
1410
- systemPrivilege.name = privilege;
1411
- systemPrivilege.level = PrivilegeLevel.SystemLevel;
1412
- privileges.push(systemPrivilege);
1413
- });
1414
- });
1415
- return privileges;
1416
- }
1417
- asProcesses() {
1418
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1419
- let processes = [];
1420
- let table = this.asTable().toKV();
1421
- table.forEach(row => {
1422
- let process = new Process();
1423
- process.processId = row["process_id"];
1424
- process.processQuery = row["process_query"];
1425
- process.duration = row["duration"];
1426
- process.status = row["status"];
1427
- processes.push(process);
1428
- });
1429
- return processes;
1430
- }
1431
- asHDCGraphs() {
1432
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1433
- let hdcGraphs = [];
1434
- let table = this.asTable().toKV();
1435
- table.forEach(row => {
1436
- let hdcGraph = new HDCGraph();
1437
- hdcGraph.name = row['name'];
1438
- hdcGraph.graphName = row['graph_name'];
1439
- hdcGraph.status = row['status'];
1440
- hdcGraph.stats = row['stats'];
1441
- hdcGraph.isDefault = row['is_default'];
1442
- hdcGraph.hdcServerName = row['hdc_server_name'];
1443
- hdcGraph.hdcServerStatus = row['hdc_server_status'];
1444
- hdcGraph.config = row['config'];
1445
- hdcGraphs.push(hdcGraph);
1446
- });
1447
- return hdcGraphs;
1448
- }
1449
- asProjections() {
1450
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1451
- let projections = [];
1452
- let table = this.asTable();
1453
- table.rows.forEach(row => {
1454
- let projection = new Projection();
1455
- projection.name = row[0];
1456
- projection.graphName = row[1];
1457
- projection.status = row[2];
1458
- projection.stats = row[3];
1459
- projection.config = row[4];
1460
- projections.push(projection);
1461
- });
1462
- return projections;
1463
- }
1464
- asAlgos() {
1465
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1466
- let algos = [];
1467
- let table = this.asTable().toKV();
1468
- table.forEach(row => {
1469
- let algo = new Algo();
1470
- algo.name = row["name"];
1471
- algo.version = row["version"];
1472
- algo.type = row["type"];
1473
- algo.writeSupportType = row["write_support_type"];
1474
- algo.canRollback = row["can_rollback"];
1475
- algo.description = row["description"];
1476
- algo.configContext = row["config_context"];
1477
- // algo.params = []
1478
- algos.push(algo);
1479
- });
1480
- return algos;
1481
- }
1482
- asJobs() {
1483
- this._asTypeError(ResultType.RESULT_TYPE_TABLE);
1484
- let jobs = [];
1485
- let table = this.asTable().toKV();
1486
- table.forEach(row => {
1487
- let job = new Job();
1488
- job.id = row['job_id'];
1489
- job.graphName = row['graph_name'];
1490
- job.type = row['type'];
1491
- job.query = row['query'];
1492
- job.status = row['status'];
1493
- job.errMsg = row['err_msg'];
1494
- job.result = row['result'] ? new Map(Object.entries(JSON.parse(row['result']))) : null;
1495
- job.startTime = row['start_time'];
1496
- job.endTime = row['end_time'];
1497
- job.progress = row['progress'];
1498
- jobs.push(job);
1499
- });
1500
- return jobs;
1501
- }
1502
- asAny() {
1503
- return this.entities;
1504
- }
1505
- asTableWithT() {
1506
- return this.asTable()?.toKV();
1507
- }
1508
- toJSONString() {
1509
- return JSON.stringify(this);
1510
- }
1511
- }
1512
- exports.DataItem = DataItem;
1513
- /**
1514
- * Unified response structure for all requests
1515
- */
1516
- class Response {
1517
- /**
1518
- * Holds statistics field of rpc response
1519
- */
1520
- statistics;
1521
- /**
1522
- * Holds status field of rpc response
1523
- */
1524
- status;
1525
- /**
1526
- * Holds all alias result of grpc api
1527
- */
1528
- aliases = [];
1529
- /**
1530
- * Holds all result of grpc api, from aliases
1531
- */
1532
- items = {};
1533
- requestInfo;
1534
- /**
1535
- * Holds result of explain uql.
1536
- */
1537
- explainPlan;
1538
- constructor(status) {
1539
- this.status = status;
1540
- }
1541
- get(index) {
1542
- const keys = Object.keys(this.items);
1543
- if (index >= keys.length) {
1544
- throw new Error(`index ${index} out of range`);
1545
- }
1546
- return this.items[keys[index]];
1547
- }
1548
- alias(alias) {
1549
- if (!(alias in this.items)) {
1550
- throw new Error(`alias ${alias} not found`);
1551
- }
1552
- return this.items[alias];
1553
- }
1554
- }
1555
- exports.Response = Response;
1556
- class InsertResponse {
1557
- ids;
1558
- uuids;
1559
- errorItems;
1560
- /**
1561
- * Holds statistics field of rpc response
1562
- */
1563
- statistics;
1564
- /**
1565
- * Holds status field of rpc response
1566
- */
1567
- status;
1568
- }
1569
- exports.InsertResponse = InsertResponse;
1570
- /**
1571
- * Remarks: A language that cannot return two results, use this to return results
1572
- */
1573
- class ResponseWithExistCheck {
1574
- /**
1575
- * When insert,return insert item exist
1576
- */
1577
- exist;
1578
- /**
1579
- * The insert response
1580
- */
1581
- response;
1582
- }
1583
- exports.ResponseWithExistCheck = ResponseWithExistCheck;
1584
- class JobResponse {
1585
- jobId;
1586
- /**
1587
- * Holds statistics field of response
1588
- */
1589
- statistics;
1590
- /**
1591
- * Holds status field of response
1592
- */
1593
- status;
1594
- }
1595
- exports.JobResponse = JobResponse;
1596
- //# sourceMappingURL=types.js.map