@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 +0,0 @@
1
- {"version":3,"file":"privilege.extra.js","sourceRoot":"","sources":["../../../src/connection/extra/privilege.extra.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAElD,uCAAuC;AAEvC,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAQ,CAAA;AAEhC,MAAa,cAAe,SAAQ,gCAAc;IAC9C;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,MAAsB;QACtC,IAAI,OAAO,GAAG,WAAW,CAAC,aAAa,CAAA;QACvC,IAAI,QAAQ,GAAG,IAAI,gBAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC5C,IAAI,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAA;QACrD,IAAI,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,YAAY,EAAE,CAAA;QACnD,OAAO,MAAM,CAAA;IACjB,CAAC;CAEJ;AAZD,wCAYC"}
@@ -1,66 +0,0 @@
1
- import { ConnectionBase } from "./connection.base";
2
- import { AllProperties, DBType, Property, RequestConfig, Response, ResponseWithExistCheck } from "../../types/types";
3
- export declare class PropertyExtra extends ConnectionBase {
4
- /**
5
- * Loads one custom property of nodes or edges to the computing engine for query acceleration.
6
- */
7
- lte(dbType: DBType, propertyName: string, schemaName?: string, config?: RequestConfig): Promise<import("../../types/types").JobResponse>;
8
- /**
9
- * Unloads one custom property of nodes or edges from the computing engine to save the memory.
10
- */
11
- ufe(dbType: DBType, propertyName: string, schemaName?: string, config?: RequestConfig): Promise<Response>;
12
- /**
13
- * Retrieves custom properties of nodes or edges from the current graphset.if have dbType param,return List<property>.if not,return AllProperties
14
- */
15
- showProperty(dbType?: DBType, schemaName?: string, config?: RequestConfig): Promise<AllProperties>;
16
- /**
17
- * Retrieves custom properties of nodes from the current graphset.
18
- */
19
- showNodeProperty(schemaName?: string, config?: RequestConfig): Promise<Property[]>;
20
- /**
21
- * Retrieves custom properties of edges from the current graphset.
22
- */
23
- showEdgeProperty(schemaName?: string, config?: RequestConfig): Promise<Property[]>;
24
- /**
25
- * Retrieves a custom property of nodes or edges from the current graphset.
26
- * @param dbType: DBType
27
- * @param schemaName: String
28
- * @param propertyName: String
29
- * @param config: RequestConfig
30
- */
31
- getProperty(dbType: DBType, schemaName: string, propertyName: string, config?: RequestConfig): Promise<Property>;
32
- /**
33
- * Retrieves a custom property of nodes from the current graphset.
34
- */
35
- getNodeProperty(schemaName: string, propertyName: string, config?: RequestConfig): Promise<Property>;
36
- /**
37
- * Retrieves a custom property of edges from the current graphset.
38
- */
39
- getEdgeProperty(schemaName: string, propertyName: string, config?: RequestConfig): Promise<Property>;
40
- /**
41
- * Checks if a specified node or edge has a certain property
42
- * @param dbType
43
- * @param schemaName
44
- * @param propertyName
45
- * @param config
46
- * @returns
47
- * @private
48
- */
49
- private hasProperty;
50
- /**
51
- * Creates a new property for a node or edge schema in the current graphset.
52
- */
53
- createProperty(dbType: DBType, property: Property, config?: RequestConfig): Promise<Response>;
54
- /**
55
- * Creates a new property for a node or edge schema in the current graphset, handling cases where the given property name already exists by ignoring the error.
56
- */
57
- createPropertyIfNotExist(dbType: DBType, property: Property, config?: RequestConfig): Promise<ResponseWithExistCheck>;
58
- /**
59
- * Drops one custom property from the current graphset by its name and the associated schema.
60
- */
61
- dropProperty(dbType: DBType, property: Property, config?: RequestConfig): Promise<Response>;
62
- /**
63
- * Alters the name and description of one existing custom property in the current graphset by its name.
64
- */
65
- alterProperty(dbType: DBType, originProp: Property, newProp: Property, config?: RequestConfig): Promise<Response>;
66
- }
@@ -1,190 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PropertyExtra = void 0;
4
- const connection_base_1 = require("./connection.base");
5
- const types_1 = require("../../types/types");
6
- const utils_1 = require("../../utils");
7
- const { CommandList, SchemaStringWithDefault } = utils_1.UQLMAKER;
8
- class PropertyExtra extends connection_base_1.ConnectionBase {
9
- /**
10
- * Loads one custom property of nodes or edges to the computing engine for query acceleration.
11
- */
12
- async lte(dbType, propertyName, schemaName, config) {
13
- let command = dbType === types_1.DBType.DBNODE ? CommandList.lteNode : CommandList.lteEdge;
14
- let commandParams = SchemaStringWithDefault(schemaName, propertyName);
15
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
16
- return this.uqlJobResponse(uqlMaker, config);
17
- }
18
- /**
19
- * Unloads one custom property of nodes or edges from the computing engine to save the memory.
20
- */
21
- async ufe(dbType, propertyName, schemaName, config) {
22
- let command = dbType === types_1.DBType.DBNODE ? CommandList.ufeNode : CommandList.ufeEdge;
23
- let commandParams = SchemaStringWithDefault(schemaName, propertyName);
24
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
25
- return this.uql(uqlMaker.toString(), config);
26
- }
27
- /**
28
- * Retrieves custom properties of nodes or edges from the current graphset.if have dbType param,return List<property>.if not,return AllProperties
29
- */
30
- async showProperty(dbType, schemaName, config) {
31
- let command = CommandList.showProperty;
32
- let commandP = null;
33
- if (dbType !== undefined) {
34
- command = dbType === types_1.DBType.DBNODE
35
- ? CommandList.showNodeProperty
36
- : CommandList.showEdgeProperty;
37
- if (schemaName) {
38
- commandP = SchemaStringWithDefault(schemaName);
39
- }
40
- }
41
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandP);
42
- let res = await this.uql(uqlMaker.toString(), config);
43
- let nodeProperty = res.aliases.find(a => a.name === "_nodeProperty") ? res.items["_nodeProperty"].asProperties() : [];
44
- let edgeProperty = res.aliases.find(a => a.name === "_edgeProperty") ? res.items["_edgeProperty"].asProperties() : [];
45
- return {
46
- nodeProperties: nodeProperty || [],
47
- edgeProperties: edgeProperty || [],
48
- };
49
- }
50
- /**
51
- * Retrieves custom properties of nodes from the current graphset.
52
- */
53
- async showNodeProperty(schemaName, config) {
54
- let command = CommandList.showNodeProperty;
55
- let commandP = SchemaStringWithDefault(schemaName);
56
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandP);
57
- let res = await this.uql(uqlMaker.toString(), config);
58
- return res.items["_nodeProperty"].asProperties();
59
- }
60
- /**
61
- * Retrieves custom properties of edges from the current graphset.
62
- */
63
- async showEdgeProperty(schemaName, config) {
64
- let command = CommandList.showEdgeProperty;
65
- let commandP = SchemaStringWithDefault(schemaName);
66
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandP);
67
- let res = await this.uql(uqlMaker.toString(), config);
68
- return res.items["_edgeProperty"].asProperties();
69
- }
70
- /**
71
- * Retrieves a custom property of nodes or edges from the current graphset.
72
- * @param dbType: DBType
73
- * @param schemaName: String
74
- * @param propertyName: String
75
- * @param config: RequestConfig
76
- */
77
- async getProperty(dbType, schemaName, propertyName, config) {
78
- let listProperty = await this.showProperty(dbType, schemaName, config);
79
- let properties = dbType === types_1.DBType.DBNODE
80
- ? listProperty.nodeProperties
81
- : listProperty.edgeProperties;
82
- let propertyItem = properties.find((property) => property.name === propertyName);
83
- // if (propertyItem == undefined) {
84
- // throw new Error(`Property ${propertyName} not found in ${DBType[dbType]} ${schemaName}`)
85
- // }
86
- return propertyItem;
87
- }
88
- /**
89
- * Retrieves a custom property of nodes from the current graphset.
90
- */
91
- async getNodeProperty(schemaName, propertyName, config) {
92
- return this.getProperty(types_1.DBType.DBNODE, schemaName, propertyName, config);
93
- }
94
- /**
95
- * Retrieves a custom property of edges from the current graphset.
96
- */
97
- async getEdgeProperty(schemaName, propertyName, config) {
98
- return this.getProperty(types_1.DBType.DBEDGE, schemaName, propertyName, config);
99
- }
100
- /**
101
- * Checks if a specified node or edge has a certain property
102
- * @param dbType
103
- * @param schemaName
104
- * @param propertyName
105
- * @param config
106
- * @returns
107
- * @private
108
- */
109
- async hasProperty(dbType, schemaName, propertyName, config) {
110
- let res;
111
- dbType === types_1.DBType.DBNODE
112
- ? res = await this.getNodeProperty(schemaName, propertyName, config)
113
- : res = await this.getEdgeProperty(schemaName, propertyName, config);
114
- return res != null;
115
- }
116
- /**
117
- * Creates a new property for a node or edge schema in the current graphset.
118
- */
119
- async createProperty(dbType, property, config) {
120
- try {
121
- let command = dbType === types_1.DBType.DBNODE
122
- ? CommandList.createNodeProperty
123
- : CommandList.createEdgeProperty;
124
- let p_type = property.type ? property.type : types_1.UltipaPropertyType.STRING;
125
- let commandParams = [
126
- SchemaStringWithDefault(property?.schema),
127
- utils_1.UQLMAKER.ForceString(property.name),
128
- utils_1.PropertyUtils.GetPropertyTypeDesc(p_type, property.subType, property.decimalExtra).toLowerCase(),
129
- property.description || "",
130
- ];
131
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
132
- return this.uql(uqlMaker.toString(), config);
133
- }
134
- catch (error) {
135
- return utils_1.FormatResponse.catchUltipaUqlError(error);
136
- }
137
- }
138
- /**
139
- * Creates a new property for a node or edge schema in the current graphset, handling cases where the given property name already exists by ignoring the error.
140
- */
141
- async createPropertyIfNotExist(dbType, property, config) {
142
- let isPropertyExist = await this.hasProperty(dbType, property.schema, property.name, config);
143
- if (isPropertyExist) {
144
- return {
145
- exist: true,
146
- response: {
147
- status: utils_1.FormatResponse.successStatus(),
148
- statistics: utils_1.FormatResponse.statisticsSum(),
149
- }
150
- };
151
- }
152
- let res = await this.createProperty(dbType, property, config);
153
- return {
154
- exist: false,
155
- response: res
156
- };
157
- }
158
- /**
159
- * Drops one custom property from the current graphset by its name and the associated schema.
160
- */
161
- async dropProperty(dbType, property, config) {
162
- let command = dbType === types_1.DBType.DBNODE
163
- ? CommandList.dropNodeProperty
164
- : CommandList.dropEdgeProperty;
165
- let commandParams = SchemaStringWithDefault(property.schema, property.name);
166
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
167
- return this.uql(uqlMaker.toString(), config);
168
- }
169
- /**
170
- * Alters the name and description of one existing custom property in the current graphset by its name.
171
- */
172
- async alterProperty(dbType, originProp, newProp, config) {
173
- let command = dbType === types_1.DBType.DBNODE
174
- ? CommandList.updateNodeProperty
175
- : CommandList.updateEdgeProperty;
176
- let commandParams = SchemaStringWithDefault(originProp.schema, originProp.name);
177
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
178
- let set = {};
179
- if (newProp.name) {
180
- set.name = newProp.name;
181
- }
182
- if ((0, utils_1.isNotNullString)(newProp.description)) {
183
- set.description = newProp.description;
184
- }
185
- uqlMaker.addParam("set", set);
186
- return this.uql(uqlMaker.toString(), config);
187
- }
188
- }
189
- exports.PropertyExtra = PropertyExtra;
190
- //# sourceMappingURL=property.extra.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"property.extra.js","sourceRoot":"","sources":["../../../src/connection/extra/property.extra.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,6CAAyI;AACzI,uCAAuF;AAGvF,MAAM,EAAE,WAAW,EAAE,uBAAuB,EAAE,GAAG,gBAAQ,CAAC;AAC1D,MAAa,aAAc,SAAQ,gCAAc;IAC7C;;OAEG;IACH,KAAK,CAAC,GAAG,CACL,MAAc,EACd,YAAoB,EACpB,UAAmB,EACnB,MAAsB;QAEtB,IAAI,OAAO,GAAG,MAAM,KAAK,cAAM,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;QACnF,IAAI,aAAa,GAAG,uBAAuB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QACtE,IAAI,QAAQ,GAAG,IAAI,gBAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACL,MAAc,EACd,YAAo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C,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAC5D,IAAI,GAAG,GAAQ,EAAE,CAAC;QAClB,IAAI,OAAO,CAAC,IAAI,EAAE;YACd,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;SAC3B;QACD,IAAI,IAAA,uBAAe,EAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YACtC,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;SACzC;QACD,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;CAMJ;AApPD,sCAoPC"}
@@ -1,108 +0,0 @@
1
- import { DBType, RequestConfig, Schema, ResponseWithExistCheck } from "../../types/types";
2
- import { PropertyExtra } from "./property.extra";
3
- export declare class SchemaExra extends PropertyExtra {
4
- private showSchemaBase;
5
- /**
6
- * Retrieves all nodes and edge schemas from the current graphset.
7
- * @param config
8
- */
9
- showSchema(config?: RequestConfig): Promise<Schema[]>;
10
- /**
11
- * Get one schema info
12
- * @param isNode
13
- * @param name
14
- * @param config
15
- * @returns
16
- */
17
- private getSchemaBase;
18
- /**
19
- * Retrieves a node or edge schema from the current graphset.
20
- * @param name
21
- * @param dbType
22
- * @param config
23
- */
24
- getSchema(schemaName: string, dbType: DBType, config?: RequestConfig): Promise<Schema>;
25
- /**
26
- *Retrieves a node schema from the current graphset.
27
- * @param schemaName
28
- * @param config
29
- * @returns Response<Schema>
30
- */
31
- getNodeSchema(schemaName: string, config?: RequestConfig): Promise<Schema>;
32
- /**
33
- * Retrieves all node schemas from the current graphset.
34
- * @param config
35
- * @returns Response<Schema[]>
36
- */
37
- showNodeSchema(config?: RequestConfig): Promise<Schema[]>;
38
- /**
39
- * Retrieves an edge schema from the current graphset.
40
- * @param config
41
- * @returns
42
- */
43
- getEdgeSchema(schemaName: string, config?: RequestConfig): Promise<Schema>;
44
- /**
45
- * Retrieves all node schemas from the current graphset.
46
- * @param config
47
- * @returns Response<Schema[]>
48
- */
49
- showEdgeSchema(config?: RequestConfig): Promise<Schema[]>;
50
- private createSchemaBase;
51
- /**
52
- * Creates a new schema in the current graphset.
53
- * @param schema
54
- * @param isCreateProperties
55
- * @param config
56
- * @returns
57
- */
58
- createSchema(schema: Schema, isCreateProperties?: boolean, config?: RequestConfig): Promise<import("../../types/types").Response>;
59
- private hasSchema;
60
- /**
61
- * Creates a new schema in the current graphset, handling cases where the given schema name already exists by ignoring the error.
62
- * @param schema
63
- * @param config
64
- */
65
- createSchemaIfNotExist(schema: Schema, isCreateProperties?: boolean, config?: RequestConfig): Promise<ResponseWithExistCheck>;
66
- /**
67
- * Drops one schema from the current graphset by its name.
68
- */
69
- dropSchema(schema: Schema, config?: RequestConfig): Promise<import("../../types/types").Response>;
70
- /**
71
- * Creates a new node schema in the current graphset.
72
- * @param req
73
- * @param config
74
- * @returns
75
- */
76
- createNodeSchema(req: Schema, config?: RequestConfig): Promise<import("../../types/types").Response>;
77
- /**
78
- * Creates a new edge schema in the current graphset.
79
- * @param req
80
- * @param config
81
- * @returns
82
- */
83
- createEdgeSchema(req: Schema, config?: RequestConfig): Promise<import("../../types/types").Response>;
84
- /**
85
- * Alters the name and description of one existing schema in the current graphset by its name.
86
- * @param schema
87
- * @param newSchema
88
- * @param config
89
- * @returns
90
- */
91
- alterSchema(originalSchema: Schema, newSchema: Schema, config?: RequestConfig): Promise<import("../../types/types").Response>;
92
- /**
93
- * Alters the name and description of one existing node schema in the current graphset by its name.
94
- * @param schema
95
- * @param newSchema
96
- * @param config
97
- * @returns
98
- */
99
- alterNodeSchema(originalSchema: Schema, newSchema: Schema, config?: RequestConfig): Promise<import("../../types/types").Response>;
100
- /**
101
- * Alters the name and description of one existing edge schema in the current graphset by its name.
102
- * @param schema
103
- * @param newSchema
104
- * @param config
105
- * @returns
106
- */
107
- alterEdgeSchema(originalSchema: Schema, newSchema: Schema, config?: RequestConfig): Promise<import("../../types/types").Response>;
108
- }
@@ -1,253 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchemaExra = void 0;
4
- const types_extra_1 = require("../../types/types.extra");
5
- const types_1 = require("../../types/types");
6
- const utils_1 = require("../../utils");
7
- const property_extra_1 = require("./property.extra");
8
- const { CommandList, SchemaStringWithDefault } = utils_1.UQLMAKER;
9
- const JSON_KEYS = ["properties"];
10
- const SCHEMA_PROPERTY_DATA_FORMAT = (schema, dbType) => { };
11
- const FORMAT_SCHEMAS = (schemas, dbType, graphCount) => {
12
- let lastSchemas = [];
13
- schemas.forEach((schema) => {
14
- let count = graphCount.filter(i => i.schema === schema.name);
15
- let resSchema = new types_1.Schema();
16
- resSchema.dbType = dbType;
17
- resSchema.id = schema?.id;
18
- resSchema.name = schema.name;
19
- resSchema.description = schema.description || "";
20
- resSchema.total = count.reduce((acc, cur) => acc + parseInt(cur.count), 0) + "";
21
- let stats = count.map(i => {
22
- let stats = new types_1.SchemaStat();
23
- stats.dbType = dbType;
24
- stats.schema = i.schema;
25
- stats.fromSchema = i.from_schema;
26
- stats.toSchema = i.to_schema;
27
- stats.count = i.count;
28
- return stats;
29
- });
30
- resSchema.stats = stats;
31
- resSchema.properties = schema.properties;
32
- lastSchemas.push(resSchema);
33
- });
34
- return lastSchemas;
35
- };
36
- class SchemaExra extends property_extra_1.PropertyExtra {
37
- async showSchemaBase(dbType, schemaName, config) {
38
- let command = CommandList.listSchema;
39
- if (dbType === types_1.DBType.DBNODE) {
40
- command = CommandList.listNodeSchema;
41
- }
42
- if (dbType === types_1.DBType.DBEDGE) {
43
- command = CommandList.listEdgeSchema;
44
- }
45
- let uqlMaker = new utils_1.UQLMAKER(command, config, schemaName?.trim()?.length > 0 ? utils_1.UQLMAKER.SchemaStringWithDefault(schemaName) : undefined);
46
- let res = await this.uql(uqlMaker.toString(), config);
47
- let result = [];
48
- let graphCount = res.items[types_extra_1.ResponseTableName.GRAPH_COUNT]?.asTable().toKV();
49
- if (dbType === types_1.DBType.DBNODE || dbType === undefined) {
50
- let nodeSchema = res.items[types_extra_1.ResponseTableName.NODE_SCHEMA]?.asSchemas() || [];
51
- result.push(...FORMAT_SCHEMAS(nodeSchema, types_1.DBType.DBNODE, graphCount));
52
- }
53
- if (dbType === types_1.DBType.DBEDGE || dbType === undefined) {
54
- let edgeSchema = res.items[types_extra_1.ResponseTableName.EDGE_SCHEMA]?.asSchemas() || [];
55
- result.push(...FORMAT_SCHEMAS(edgeSchema, types_1.DBType.DBEDGE, graphCount));
56
- }
57
- return result;
58
- }
59
- /**
60
- * Retrieves all nodes and edge schemas from the current graphset.
61
- * @param config
62
- */
63
- async showSchema(config) {
64
- return this.showSchemaBase(undefined, undefined, config);
65
- }
66
- /**
67
- * Get one schema info
68
- * @param isNode
69
- * @param name
70
- * @param config
71
- * @returns
72
- */
73
- async getSchemaBase(dbType, schemaName, config) {
74
- let res = await this.showSchemaBase(dbType, schemaName, config);
75
- return res.find(s => s.name === schemaName && s.dbType === dbType);
76
- }
77
- /**
78
- * Retrieves a node or edge schema from the current graphset.
79
- * @param name
80
- * @param dbType
81
- * @param config
82
- */
83
- async getSchema(schemaName, dbType, config) {
84
- return this.getSchemaBase(dbType, schemaName, config);
85
- }
86
- /**
87
- *Retrieves a node schema from the current graphset.
88
- * @param schemaName
89
- * @param config
90
- * @returns Response<Schema>
91
- */
92
- async getNodeSchema(schemaName, config) {
93
- return this.getSchemaBase(types_1.DBType.DBNODE, schemaName, config);
94
- }
95
- /**
96
- * Retrieves all node schemas from the current graphset.
97
- * @param config
98
- * @returns Response<Schema[]>
99
- */
100
- async showNodeSchema(config) {
101
- let res = await this.showSchemaBase(types_1.DBType.DBNODE, undefined, config);
102
- return res.filter(s => s.dbType === types_1.DBType.DBNODE);
103
- }
104
- /**
105
- * Retrieves an edge schema from the current graphset.
106
- * @param config
107
- * @returns
108
- */
109
- async getEdgeSchema(schemaName, config) {
110
- return this.getSchemaBase(types_1.DBType.DBEDGE, schemaName, config);
111
- }
112
- /**
113
- * Retrieves all node schemas from the current graphset.
114
- * @param config
115
- * @returns Response<Schema[]>
116
- */
117
- async showEdgeSchema(config) {
118
- let res = await this.showSchemaBase(types_1.DBType.DBEDGE, undefined, config);
119
- return res.filter(s => s.dbType === types_1.DBType.DBEDGE);
120
- }
121
- async createSchemaBase(req, config) {
122
- let command = req.dbType === types_1.DBType.DBNODE
123
- ? CommandList.createNodeSchema
124
- : CommandList.createEdgeSchema;
125
- let commandParams = [utils_1.UQLMAKER.ForceString(req.name), req.description || ""];
126
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
127
- return this.uql(uqlMaker.toString(), config);
128
- }
129
- /**
130
- * Creates a new schema in the current graphset.
131
- * @param schema
132
- * @param isCreateProperties
133
- * @param config
134
- * @returns
135
- */
136
- async createSchema(schema, isCreateProperties = false, config) {
137
- let command = schema.dbType === types_1.DBType.DBNODE
138
- ? CommandList.createNodeSchema
139
- : CommandList.createEdgeSchema;
140
- let commandParams = [utils_1.UQLMAKER.ForceString(schema.name), schema.description || ""];
141
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
142
- let response = await this.uql(uqlMaker.toString(), config);
143
- if (isCreateProperties) {
144
- let dbType = schema.dbType;
145
- schema.properties?.forEach(async (prop) => {
146
- prop.schema = schema.name;
147
- let res = await this.createProperty(dbType, prop, config);
148
- response.statistics = utils_1.FormatResponse.statisticsSum(response.statistics, res.statistics);
149
- });
150
- }
151
- return response;
152
- }
153
- async hasSchema(req, config) {
154
- let res = await this.getSchema(req.name, req.dbType, config);
155
- return res ? true : false;
156
- }
157
- /**
158
- * Creates a new schema in the current graphset, handling cases where the given schema name already exists by ignoring the error.
159
- * @param schema
160
- * @param config
161
- */
162
- async createSchemaIfNotExist(schema, isCreateProperties = false, config) {
163
- let isSchemaExist = await this.hasSchema(schema, config);
164
- if (isSchemaExist) {
165
- return {
166
- exist: true,
167
- response: {
168
- status: utils_1.FormatResponse.successStatus(),
169
- statistics: utils_1.FormatResponse.statisticsSum()
170
- },
171
- };
172
- }
173
- let res = await this.createSchema(schema, isCreateProperties, config);
174
- return {
175
- exist: false,
176
- response: res
177
- };
178
- }
179
- /**
180
- * Drops one schema from the current graphset by its name.
181
- */
182
- async dropSchema(schema, config) {
183
- let command = (schema.dbType === types_1.DBType.DBNODE)
184
- ? CommandList.dropNodeSchema
185
- : CommandList.dropEdgeSchema;
186
- let commandParams = [SchemaStringWithDefault(schema.name)];
187
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
188
- return this.uql(uqlMaker.toString(), config);
189
- }
190
- /**
191
- * Creates a new node schema in the current graphset.
192
- * @param req
193
- * @param config
194
- * @returns
195
- */
196
- async createNodeSchema(req, config) {
197
- return this.createSchemaBase({ ...req, dbType: types_1.DBType.DBNODE }, config);
198
- }
199
- /**
200
- * Creates a new edge schema in the current graphset.
201
- * @param req
202
- * @param config
203
- * @returns
204
- */
205
- async createEdgeSchema(req, config) {
206
- return this.createSchemaBase({ ...req, dbType: types_1.DBType.DBEDGE }, config);
207
- }
208
- /**
209
- * Alters the name and description of one existing schema in the current graphset by its name.
210
- * @param schema
211
- * @param newSchema
212
- * @param config
213
- * @returns
214
- */
215
- async alterSchema(originalSchema, newSchema, config) {
216
- let command = originalSchema.dbType === types_1.DBType.DBNODE
217
- ? CommandList.updateNodeSchema
218
- : CommandList.updateEdgeSchema;
219
- let commandParams = [SchemaStringWithDefault(originalSchema.name)];
220
- let uqlMaker = new utils_1.UQLMAKER(command, config, commandParams);
221
- let set = {};
222
- if (newSchema.name) {
223
- set.name = newSchema.name;
224
- }
225
- if ((0, utils_1.isNotNullString)(newSchema.description)) {
226
- set.description = newSchema.description;
227
- }
228
- uqlMaker.addParam("set", set);
229
- return this.uql(uqlMaker.toString(), config);
230
- }
231
- /**
232
- * Alters the name and description of one existing node schema in the current graphset by its name.
233
- * @param schema
234
- * @param newSchema
235
- * @param config
236
- * @returns
237
- */
238
- async alterNodeSchema(originalSchema, newSchema, config) {
239
- return this.alterSchema(originalSchema, newSchema, config);
240
- }
241
- /**
242
- * Alters the name and description of one existing edge schema in the current graphset by its name.
243
- * @param schema
244
- * @param newSchema
245
- * @param config
246
- * @returns
247
- */
248
- async alterEdgeSchema(originalSchema, newSchema, config) {
249
- return this.alterSchema(originalSchema, newSchema, config);
250
- }
251
- }
252
- exports.SchemaExra = SchemaExra;
253
- //# sourceMappingURL=schema.extra.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.extra.js","sourceRoot":"","sources":["../../../src/connection/extra/schema.extra.ts"],"names":[],"mappings":";;;AAAA,yDAA4D;AAC5D,6CAAsI;AACtI,uCAAmG;AACnG,qDAAiD;AAGjD,MAAM,EAAE,WAAW,EAAE,uBAAuB,EAAE,GAAG,gBAAQ,CAAC;AAE1D,MAAM,SAAS,GAAG,CAAC,YAAY,CAAC,CAAC;AACjC,MAAM,2BAA2B,GAAG,CAAC,MAAW,EAAE,MAAc,EAAE,EAAE,GAAG,CAAC,CAAA;AACxE,MAAM,cAAc,GAAG,CAAC,OAAY,EAAE,MAAc,EAAE,UAMnD,EAAY,EAAE;IACb,IAAI,WAAW,GAAa,EAAE,CAAC;IAC/B,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;QAC5B,IAAI,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,SAAS,GAAG,IAAI,cAAM,EAAE,CAAC;QAC7B,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,SAAS,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QAC7B,SAAS,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;QACjD,SA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