@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
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Numeric type wrappers for explicit type specification.
3
+ */
4
+ /** Wrapper for explicit 32-bit signed integer */
5
+ export declare class Int32 {
6
+ readonly value: number;
7
+ constructor(value: number);
8
+ }
9
+ /** Wrapper for explicit 32-bit unsigned integer */
10
+ export declare class UInt32 {
11
+ readonly value: number;
12
+ constructor(value: number);
13
+ }
14
+ /** Wrapper for explicit 32-bit float */
15
+ export declare class Float32 {
16
+ readonly value: number;
17
+ constructor(value: number);
18
+ }
19
+ /** Wrapper for explicit 64-bit unsigned integer */
20
+ export declare class UInt64 {
21
+ readonly value: bigint;
22
+ constructor(value: bigint);
23
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Numeric type wrappers for explicit type specification.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UInt64 = exports.Float32 = exports.UInt32 = exports.Int32 = void 0;
7
+ /** Wrapper for explicit 32-bit signed integer */
8
+ class Int32 {
9
+ value;
10
+ constructor(value) {
11
+ this.value = value;
12
+ }
13
+ }
14
+ exports.Int32 = Int32;
15
+ /** Wrapper for explicit 32-bit unsigned integer */
16
+ class UInt32 {
17
+ value;
18
+ constructor(value) {
19
+ this.value = value;
20
+ }
21
+ }
22
+ exports.UInt32 = UInt32;
23
+ /** Wrapper for explicit 32-bit float */
24
+ class Float32 {
25
+ value;
26
+ constructor(value) {
27
+ this.value = value;
28
+ }
29
+ }
30
+ exports.Float32 = Float32;
31
+ /** Wrapper for explicit 64-bit unsigned integer */
32
+ class UInt64 {
33
+ value;
34
+ constructor(value) {
35
+ this.value = value;
36
+ }
37
+ }
38
+ exports.UInt64 = UInt64;
39
+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cHBlciBmb3IgZXhwbGljaXQgMzItYml0IHVuc2lnbmVkIGludGVnZXIgKi9cclxuZXhwb3J0IGNsYXNzIFVJbnQzMiB7XHJcbiAgY29uc3RydWN0b3IocHVibGljIHJlYWRvbmx5IHZhbHVlOiBudW1iZXIpIHt9XHJcbn1cclxuXHJcbi8qKiBXcmFwcGVyIGZvciBleHBsaWNpdCAzMi1iaXQgZmxvYXQgKi9cclxuZXhwb3J0IGNsYXNzIEZsb2F0MzIge1xyXG4gIGNvbnN0cnVjdG9yKHB1YmxpYyByZWFkb25seSB2YWx1ZTogbnVtYmVyKSB7fVxyXG59XHJcblxyXG4vKiogV3JhcHBlciBmb3IgZXhwbGljaXQgNjQtYml0IHVuc2lnbmVkIGludGVnZXIgKi9cclxuZXhwb3J0IGNsYXNzIFVJbnQ2NCB7XHJcbiAgY29uc3RydWN0b3IocHVibGljIHJlYWRvbmx5IHZhbHVlOiBiaWdpbnQpIHt9XHJcbn1cclxuIl19
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Type definitions for GQLDB Node.js driver.
3
+ *
4
+ * This file re-exports all types from the types/ subdirectory for backward compatibility.
5
+ * @deprecated Import directly from types/ subdirectory for better tree-shaking.
6
+ */
7
+ export * from './types/index';
package/dist/types.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for GQLDB Node.js driver.
4
+ *
5
+ * This file re-exports all types from the types/ subdirectory for backward compatibility.
6
+ * @deprecated Import directly from types/ subdirectory for better tree-shaking.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ __exportStar(require("./types/index"), exports);
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7OztHQUtHOzs7Ozs7Ozs7Ozs7Ozs7O0FBRUgsZ0RBQThCIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXHJcbiAqIFR5cGUgZGVmaW5pdGlvbnMgZm9yIEdRTERCIE5vZGUuanMgZHJpdmVyLlxyXG4gKlxyXG4gKiBUaGlzIGZpbGUgcmUtZXhwb3J0cyBhbGwgdHlwZXMgZnJvbSB0aGUgdHlwZXMvIHN1YmRpcmVjdG9yeSBmb3IgYmFja3dhcmQgY29tcGF0aWJpbGl0eS5cclxuICogQGRlcHJlY2F0ZWQgSW1wb3J0IGRpcmVjdGx5IGZyb20gdHlwZXMvIHN1YmRpcmVjdG9yeSBmb3IgYmV0dGVyIHRyZWUtc2hha2luZy5cclxuICovXHJcblxyXG5leHBvcnQgKiBmcm9tICcuL3R5cGVzL2luZGV4JztcclxuIl19
package/package.json CHANGED
@@ -1,63 +1,50 @@
1
1
  {
2
2
  "name": "@ultipa-graph/ultipa-driver",
3
- "version": "5.1.4-s5.1",
4
- "description": "NodeJS SDK for ultipa-server 5.1",
5
- "keywords": [
6
- "ultipa",
7
- "graph database",
8
- "UQL",
9
- "GQL",
10
- "SDK",
11
- "driver"
12
- ],
3
+ "version": "6.0.0",
4
+ "description": "NodeJS SDK for Ultipa GQL",
13
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
14
7
  "scripts": {
15
- "build": "sh bin/tsc.sh",
16
- "build_doc": "typedoc",
17
- "node_version": "bash bin/node_version.sh",
18
- "publish_online": "bash bin/publish.sh",
19
- "test": "mocha -r ts-node/register -t 10000000 --exit",
20
- "test_autotest": "mocha -r ts-node/register --t 600000 'test/autotest/**/*.@(js|ts)'",
21
- "test_autotest_with_report": "npm test -- --reporter mochawesome; open ./mochawesome-report/mochawesome.html",
22
- "proto": "sh src/proto/build.sh",
23
- "proto_windows": "sh src/proto/build_windows.sh"
8
+ "build": "tsc -p tsconfig.build.json && npm run copy-proto",
9
+ "copy-proto": "node -e \"require('fs').mkdirSync('dist/proto', {recursive: true}); require('fs').copyFileSync('src/proto/gqldb.proto', 'dist/proto/gqldb.proto');\"",
10
+ "sync-proto": "node -e \"require('fs').copyFileSync('../proto/gqldb.proto', 'src/proto/gqldb.proto');\"",
11
+ "generate": "./generate.sh",
12
+ "test": "jest",
13
+ "test:unit": "jest tests/unit",
14
+ "test:integration": "jest tests/integration",
15
+ "test:coverage": "jest --coverage",
16
+ "lint": "eslint src/**/*.ts",
17
+ "prepublishOnly": "npm run build"
24
18
  },
25
- "repository": {
26
- "type": "git",
27
- "url": "git@repo.ultipa.com:SDKS/ultipa-node-sdk.git"
28
- },
29
- "files": [
30
- "dist/**/*",
31
- "src/proto/**/*"
32
- ],
33
- "author": "jiansong ZHANG",
34
- "license": "ISC",
35
19
  "dependencies": {
36
- "@grpc/grpc-js": "1.10.1",
37
- "bluebird": "^3.7.2",
38
- "chalk": "^3.0.0",
39
- "fs-extra": "^9.1.0",
40
- "grpc-tools": "1.11.3",
41
- "lodash": "^4.17.15",
42
- "md5": "^2.3.0",
43
- "moment-timezone": "^0.5.33",
44
- "print-tree": "^0.1.5",
45
- "ts-protoc-gen": "^0.15.0",
46
- "typescript": "^4.8.4"
20
+ "@grpc/grpc-js": "^1.9.0",
21
+ "@grpc/proto-loader": "^0.8.0",
22
+ "cli-table3": "^0.6.5",
23
+ "google-protobuf": "^3.21.0"
47
24
  },
48
25
  "devDependencies": {
49
- "@types/bluebird": "^3.5.30",
50
- "@types/chai": "^4.2.9",
51
- "@types/fs-extra": "^9.0.13",
52
- "@types/lodash": "^4.14.150",
53
- "@types/mocha": "^10.0.7",
54
- "@types/moment-timezone": "^0.5.30",
55
- "@types/node": "^13.13.2",
56
- "chai": "^4.2.0",
57
- "grpc_tools_node_protoc_ts": "^5.3.2",
58
- "mocha": "^7.2.0",
59
- "mochawesome": "^6.1.1",
60
- "nyc": "^15.0.0",
61
- "ts-node": "^8.6.2"
26
+ "@types/google-protobuf": "^3.15.0",
27
+ "@types/jest": "^29.5.0",
28
+ "@types/node": "^20.10.0",
29
+ "grpc_tools_node_protoc_ts": "^5.3.0",
30
+ "grpc-tools": "^1.12.0",
31
+ "jest": "^29.7.0",
32
+ "jest-junit": "^16.0.0",
33
+ "ts-jest": "^29.1.0",
34
+ "typescript": "^5.3.0"
35
+ },
36
+ "files": [
37
+ "dist/**/*"
38
+ ],
39
+ "keywords": [
40
+ "gqldb",
41
+ "graph",
42
+ "database",
43
+ "grpc",
44
+ "driver"
45
+ ],
46
+ "license": "MIT",
47
+ "engines": {
48
+ "node": ">=18.0.0"
62
49
  }
63
50
  }
@@ -1,14 +0,0 @@
1
- import { Connection } from "./extra/connection";
2
- import { UltipaConfig } from "../types/types";
3
- /**
4
- * Extra api
5
- */
6
- export declare class ConnectionFinal extends Connection {
7
- testConnectResult: boolean;
8
- setGraph(graphName: string): void;
9
- }
10
- export declare class UltipaDriver extends ConnectionFinal {
11
- private connectionPool;
12
- constructor(config: UltipaConfig);
13
- setGraph(graphName: string): void;
14
- }
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UltipaDriver = exports.ConnectionFinal = void 0;
7
- const connection_1 = require("./extra/connection");
8
- const connection_pool_1 = require("./connection.pool");
9
- const fs_1 = __importDefault(require("fs"));
10
- /**
11
- * Extra api
12
- */
13
- class ConnectionFinal extends connection_1.Connection {
14
- testConnectResult;
15
- setGraph(graphName) {
16
- this.defaultConfig.defaultGraph = graphName;
17
- }
18
- }
19
- exports.ConnectionFinal = ConnectionFinal;
20
- class UltipaDriver extends ConnectionFinal {
21
- // private hosts: string[]
22
- // private connections: Map<string, ConnectionFinal> = new Map();
23
- connectionPool;
24
- constructor(config) {
25
- let crt;
26
- if (config.crt && config.crt.length !== 0) {
27
- crt = fs_1.default.readFileSync(config.crt);
28
- }
29
- super(config.hosts[0], config.username, config.password, crt, config);
30
- this.connectionPool = new connection_pool_1.ConnectionPool(config.hosts, config.username, config.password, crt, config);
31
- }
32
- setGraph(graphName) {
33
- this.defaultConfig.defaultGraph = graphName;
34
- this.connectionPool.setGraph(graphName);
35
- }
36
- }
37
- exports.UltipaDriver = UltipaDriver;
38
- // export class UltipaDriver extends ConnectionFinal {
39
- // private _instance: ConnectionFinal = null;
40
- // private _initPromise: Promise<ConnectionFinal> = null;
41
- // constructor(config: UltipaConfig) {
42
- // let crt: Buffer;
43
- // if (config.crt && config.crt.length !== 0) {
44
- // crt = fs.readFileSync(config.crt)
45
- // }
46
- // super(config.hosts[0], config.username, config.password,
47
- // crt,
48
- // config);
49
- // function withTimeout(promise: Promise<ConnectionFinal>, ms: number): Promise<ConnectionFinal> {
50
- // const timeoutPromise = new Promise<ConnectionFinal>((_, reject) => {
51
- // const timeoutId = setTimeout(() => {
52
- // clearTimeout(timeoutId);
53
- // reject(new Error('Connection timeout'));
54
- // }, ms);
55
- // });
56
- // return Promise.race([promise, timeoutPromise]);
57
- // }
58
- // return new Proxy(this, {
59
- // get: (target: UltipaDriver, prop: string) => {
60
- // if (typeof target[prop] === 'function') {
61
- // return target[prop].bind(target);
62
- // }
63
- // if (prop in target) {
64
- // return target[prop];
65
- // }
66
- // return async (...args: any[]) => {
67
- // if (!target._initPromise) {
68
- // target._initPromise = (async () => {
69
- // const pool = new ConnectionPool(
70
- // config.hosts,
71
- // config.username,
72
- // config.password,
73
- // crt,
74
- // config
75
- // );
76
- // target._instance = await withTimeout(
77
- // pool.getActive(),
78
- // config?.timeout * 1000 || Number.MAX_SAFE_INTEGER
79
- // );
80
- // return target._instance;
81
- // })();
82
- // }
83
- // try {
84
- // await target._initPromise;
85
- // return target._instance[prop](...args);
86
- // } catch (error) {
87
- // target._initPromise = null;
88
- // target._instance = null;
89
- // throw error;
90
- // }
91
- // };
92
- // }
93
- // });
94
- // }
95
- // }
96
- //# sourceMappingURL=connection.final.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.final.js","sourceRoot":"","sources":["../../src/connection/connection.final.ts"],"names":[],"mappings":";;;;;;AACA,mDAA+C;AAE/C,uDAAkD;AAElD,4CAAmB;AAEnB;;GAEG;AACH,MAAa,eAAgB,SAAQ,uBAAU;IAC3C,iBAAiB,CAAS;IAC1B,QAAQ,CAAC,SAAiB;QACtB,IAAI,CAAC,aAAa,CAAC,YAAY,GAAG,SAAS,CAAA;IAC/C,CAAC;CACJ;AALD,0CAKC;AAED,MAAa,YAAa,SAAQ,eAAe;IAC7C,0BAA0B;IAC1B,iEAAiE;IACzD,cAAc,CAAiB;IACvC,YAAY,MAAoB;QAC5B,IAAI,GAAW,CAAC;QAChB,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,GAAG,GAAG,YAAE,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACpC;QACD,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACnD,GAAG,EACH,MAAM,CAAC,CAAC;QACZ,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,CACpC,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,QAAQ,EACf,MAAM,CAAC,QAAQ,EACf,GAAG,EACH,MAAM,CACT,CAAC;IACN,CAAC;IACD,QAAQ,CAAC,SAAiB;QACtB,IAAI,CAAC,aAAa,CAAC,YAAY,GAAG,SAAS,CAAA;QAC3C,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CAEJ;AAzBD,oCAyBC;AAGD,sDAAsD;AACtD,iDAAiD;AACjD,6DAA6D;AAE7D,0CAA0C;AAC1C,2BAA2B;AAC3B,uDAAuD;AACvD,gDAAgD;AAChD,YAAY;AAEZ,mEAAmE;AACnE,mBAAmB;AACnB,uBAAuB;AAEvB,0GAA0G;AAC1G,mFAAmF;AACnF,uDAAuD;AACvD,+CAA+C;AAC/C,+DAA+D;AAC/D,0BAA0B;AAC1B,kBAAkB;AAClB,8DAA8D;AAC9D,YAAY;AAEZ,mCAAmC;AACnC,6DAA6D;AAC7D,4DAA4D;AAC5D,wDAAwD;AACxD,oBAAoB;AACpB,wCAAwC;AACxC,2CAA2C;AAC3C,oBAAoB;AACpB,qDAAqD;AACrD,kDAAkD;AAClD,+DAA+D;AAC/D,+DAA+D;AAC/D,gDAAgD;AAChD,mDAAmD;AACnD,mDAAmD;AACnD,uCAAuC;AACvC,yCAAyC;AACzC,iCAAiC;AACjC,oEAAoE;AACpE,oDAAoD;AACpD,oFAAoF;AACpF,iCAAiC;AACjC,uDAAuD;AACvD,gCAAgC;AAChC,wBAAwB;AACxB,4BAA4B;AAC5B,qDAAqD;AACrD,kEAAkE;AAClE,wCAAwC;AACxC,sDAAsD;AACtD,mDAAmD;AACnD,uCAAuC;AACvC,wBAAwB;AACxB,qBAAqB;AACrB,gBAAgB;AAChB,cAAc;AACd,QAAQ;AACR,IAAI"}
@@ -1,21 +0,0 @@
1
- /// <reference types="node" />
2
- import { UltipaConfig } from "../types/types";
3
- import { ConnectionFinal } from "./connection.final";
4
- /** Ultipa connection pool */
5
- export declare class ConnectionPool {
6
- hosts: string[];
7
- username: string;
8
- password: string;
9
- crt?: Buffer;
10
- defaultConfig: UltipaConfig;
11
- currentIndex: number;
12
- private connectionCache;
13
- constructor(hosts: string[], username: string, password: string, crt?: Buffer, defaultConfig?: UltipaConfig);
14
- private getOrCreateConnection;
15
- /** Get active client */
16
- getActive(hosts?: string[]): Promise<ConnectionFinal>;
17
- private _getActive;
18
- _testActiveMaybeSlow(noBalanced?: boolean): Promise<ConnectionFinal>;
19
- test(): Promise<boolean>;
20
- setGraph(graphName: string): void;
21
- }
@@ -1,103 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ConnectionPool = void 0;
7
- const connection_final_1 = require("./connection.final");
8
- const bluebird_1 = __importDefault(require("bluebird"));
9
- /** Ultipa connection pool */
10
- class ConnectionPool {
11
- hosts;
12
- username;
13
- password;
14
- crt;
15
- defaultConfig;
16
- currentIndex;
17
- connectionCache = new Map();
18
- constructor(hosts, username, password, crt, defaultConfig) {
19
- this.hosts = hosts;
20
- this.username = username;
21
- this.password = password;
22
- this.crt = crt;
23
- this.defaultConfig = defaultConfig;
24
- this.currentIndex = 0;
25
- }
26
- getOrCreateConnection(host, crt) {
27
- const cacheKey = `${host}-${crt ? 'https' : 'http'}`;
28
- if (!this.connectionCache.has(cacheKey)) {
29
- const client = new connection_final_1.ConnectionFinal(host, this.username, this.password, crt || this.crt, this.defaultConfig);
30
- this.connectionCache.set(cacheKey, client);
31
- }
32
- return this.connectionCache.get(cacheKey);
33
- }
34
- /** Get active client */
35
- async getActive(hosts) {
36
- hosts = hosts || this.hosts;
37
- let client = await this._getActive(hosts);
38
- if (!client.testConnectResult && !this.crt) {
39
- try {
40
- // https
41
- let client_https = await this._getActive(hosts, this.crt);
42
- console.log("try https:", hosts);
43
- if (client_https.testConnectResult) {
44
- return client_https;
45
- }
46
- }
47
- catch (error) {
48
- console.log(error);
49
- }
50
- }
51
- return client;
52
- }
53
- async _getActive(hosts, crt) {
54
- const availableClients = [];
55
- await bluebird_1.default.map(hosts, async (host) => {
56
- const client = this.getOrCreateConnection(host, crt);
57
- const test = await client.test();
58
- client.testConnectResult = test;
59
- if (test) {
60
- availableClients.push(client);
61
- }
62
- });
63
- if (availableClients.length === 0) {
64
- return this.getOrCreateConnection(hosts[hosts.length - 1], crt);
65
- }
66
- const randomIndex = Math.floor(Math.random() * availableClients.length);
67
- return availableClients[randomIndex];
68
- }
69
- async _testActiveMaybeSlow(noBalanced = false) {
70
- let m = noBalanced ? 0 : 1;
71
- let client = null;
72
- for (let index = 0; index < this.hosts.length; index++) {
73
- let i = (index + this.currentIndex + m) % this.hosts.length;
74
- let host = this.hosts[i];
75
- client = this.getOrCreateConnection(host);
76
- let test = await client.test();
77
- if (test) {
78
- this.currentIndex = i;
79
- return client;
80
- }
81
- }
82
- return client;
83
- }
84
- async test() {
85
- let v = false;
86
- await bluebird_1.default.map(this.hosts, async (host) => {
87
- let client = await this.getActive([host]);
88
- let test = await client.test_has_message({
89
- host: host,
90
- });
91
- v = test.connect;
92
- });
93
- return v;
94
- }
95
- setGraph(graphName) {
96
- this.defaultConfig.defaultGraph = graphName;
97
- this.connectionCache.forEach((client) => {
98
- client.setGraph(graphName);
99
- });
100
- }
101
- }
102
- exports.ConnectionPool = ConnectionPool;
103
- //# sourceMappingURL=connection.pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection.pool.js","sourceRoot":"","sources":["../../src/connection/connection.pool.ts"],"names":[],"mappings":";;;;;;AAEA,yDAAqD;AACrD,wDAAgC;AAEhC,6BAA6B;AAC7B,MAAa,cAAc;IACvB,KAAK,CAAU;IACf,QAAQ,CAAQ;IAChB,QAAQ,CAAQ;IAChB,GAAG,CAAS;IACZ,aAAa,CAAc;IAC3B,YAAY,CAAQ;IACZ,eAAe,GAAiC,IAAI,GAAG,EAAE,CAAA;IAEjE,YAAY,KAAe,EACvB,QAAgB,EAChB,QAAgB,EAChB,GAAY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 +0,0 @@
1
- import { ConnectionBase } from "./connection.base";
2
- import { RequestType } from "../../types";
3
- import { ExportRequest } from "../../proto/ultipa_pb";
4
- import { RequestConfig, Response } from "../../types/types";
5
- export declare class BaseExtra extends ConnectionBase {
6
- /**
7
- * Checking database server statistics.
8
- */
9
- stats(config?: RequestConfig): Promise<Response>;
10
- /**
11
- * Download file from server.
12
- */
13
- download(fileName: string, config: RequestType.CommonStreamRequire): Promise<import("@grpc/grpc-js").ClientReadableStream<import("../../proto/ultipa_pb").DownloadFileReply>>;
14
- /**
15
- * Exports nodes and edges from the current graph.
16
- */
17
- export(exportRequest: ExportRequest, listener: RequestType.ExportListener): Promise<void>;
18
- }
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseExtra = void 0;
4
- const connection_base_1 = require("./connection.base");
5
- const utils_1 = require("../../utils");
6
- const ultipa_pb_1 = require("../../proto/ultipa_pb");
7
- const types_1 = require("../../types/types");
8
- const { CommandList } = utils_1.UQLMAKER;
9
- class BaseExtra extends connection_base_1.ConnectionBase {
10
- /**
11
- * Checking database server statistics.
12
- */
13
- async stats(config) {
14
- // let command = CommandList.stats
15
- let command = CommandList.licenseDump;
16
- let uqlMaker = new utils_1.UQLMAKER(command, config);
17
- return await this.uql(uqlMaker.toString(), config);
18
- }
19
- /**
20
- * Download file from server.
21
- */
22
- async download(fileName, config) {
23
- let req = new ultipa_pb_1.DownloadFileRequest();
24
- req.setFileName(fileName);
25
- let clientInfo = await this.getClientInfo({
26
- graphSetName: config?.graph,
27
- timezone: config?.timezone,
28
- timezoneOffset: config?.timezoneOffset,
29
- });
30
- let stream = clientInfo.client.controlsClient.downloadFile(req, clientInfo.metadata);
31
- utils_1.streamHelper.commonDeal(stream, config?.stream, (chunkData) => {
32
- let status = utils_1.FormatType.status(chunkData.getStatus());
33
- if (status.code != types_1.ErrorCode.SUCCESS) {
34
- let err = new Error(status.message);
35
- err.code = status.code;
36
- throw err;
37
- }
38
- let data = Buffer.from(chunkData.getChunk());
39
- return data;
40
- });
41
- return stream;
42
- }
43
- /**
44
- * Exports nodes and edges from the current graph.
45
- */
46
- async export(exportRequest, listener) {
47
- let clientInfo = await this.getClientInfo({
48
- graphSetName: exportRequest.getGraph() || listener?.graph,
49
- timezone: listener?.timezone,
50
- timezoneOffset: listener?.timezoneOffset,
51
- });
52
- await new Promise((resolve, reject) => {
53
- const originalCb = listener?.stream;
54
- const wrappedCb = {
55
- onData: async (data) => {
56
- try {
57
- await originalCb.onData(data);
58
- }
59
- catch (error) {
60
- reject(error);
61
- }
62
- },
63
- onEnd: () => {
64
- originalCb.onEnd();
65
- resolve();
66
- },
67
- onClose: () => {
68
- resolve();
69
- originalCb.onClose?.();
70
- },
71
- onError: (err) => {
72
- reject(err);
73
- originalCb.onError?.(err);
74
- },
75
- onPause: () => {
76
- originalCb.onPause?.();
77
- },
78
- onReadable: () => {
79
- originalCb.onReadable?.();
80
- },
81
- onResume: () => {
82
- originalCb.onResume?.();
83
- },
84
- onStart: () => {
85
- originalCb.onStart?.();
86
- },
87
- };
88
- // config.stream = wrappedCb;
89
- let stream = clientInfo.client.controlsClient.export(exportRequest, clientInfo.metadata);
90
- utils_1.streamHelper.commonDeal(stream, wrappedCb, (chunkData) => {
91
- let status = utils_1.FormatType.status(chunkData.getStatus());
92
- if (status.code != types_1.ErrorCode.SUCCESS) {
93
- let err = new Error(status.message);
94
- err.code = status.code;
95
- throw err;
96
- }
97
- if (exportRequest.getDbType() == ultipa_pb_1.DBType.DBNODE) {
98
- let nodes = chunkData.getNodeTable();
99
- return utils_1.FormatType.nodeTable(nodes, { timezone: listener.timezone });
100
- }
101
- else {
102
- let edges = chunkData.getEdgeTable();
103
- return utils_1.FormatType.edgeTable(edges, { timezone: listener.timezone });
104
- }
105
- });
106
- });
107
- // let req = new ExportRequest()
108
- }
109
- }
110
- exports.BaseExtra = BaseExtra;
111
- //# sourceMappingURL=base.extra.js.map
@@ -1 +0,0 @@
1
-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C,YAAY,EAAE,CAAA;oBACpC,OAAO,kBAAU,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;iBACvE;YACL,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;QACF,gCAAgC;IAEpC,CAAC;CACJ;AApGD,8BAoGC"}
@@ -1,58 +0,0 @@
1
- import { EntityTable } from "../../proto/ultipa_pb";
2
- import { InsertRequestConfig, InsertResponse, Edge, Response, Schema, Node } from "../../types/types";
3
- import { SchemaExra } from "./schema.extra";
4
- export declare class BatchInsertExtra extends SchemaExra {
5
- /**
6
- * Inserts new nodes of a schema into the current graph through gRPC. The properties within the node values must be consistent with those declared in the schema structure.
7
- * @param table
8
- * @param config
9
- * @returns
10
- */
11
- insertNodesBatch(table: EntityTable, config?: InsertRequestConfig): Promise<InsertResponse>;
12
- /**
13
- * Inserts new nodes of a schema into the current graph through gRPC. The properties within the node values must be consistent with those declared in the schema structure.
14
- * @param schema
15
- * @param nodes
16
- * @param config
17
- * @returns InsertResponse
18
- */
19
- insertNodesBatchBySchema(schema: Schema, nodes: Node[], config: InsertRequestConfig): Promise<InsertResponse>;
20
- /**
21
- * Insert node list to shcem by schemaName
22
- */
23
- insertNodes(schemaName: string, nodes: Node[], config?: InsertRequestConfig): Promise<Response>;
24
- /**
25
- * Insert edge list to shcem by schemaName
26
- */
27
- insertEdges(schemaName: string, edges: Edge[], config?: InsertRequestConfig): Promise<Response>;
28
- /**
29
- * Inserts new nodes of one or multiple schemas to the current graph through gRPC. The properties within node values must be consistent with those defined in the corresponding schema structure.
30
- * @param nodes
31
- * @param config
32
- * @returns
33
- */
34
- insertNodesBatchAuto(nodes: Node[], config: InsertRequestConfig): Promise<Map<string, InsertResponse>>;
35
- /**
36
- * Inserts new edges of a schema into the current graph through gRPC. The properties within the edge values must be consistent with those declared in the schema structure.
37
- * @param table
38
- * @param config
39
- * @returns
40
- */
41
- insertEdgesBatch(table: EntityTable, config?: InsertRequestConfig): Promise<InsertResponse>;
42
- /**
43
- * Inserts new edges of a schema into the current graph through gRPC. The properties within the edge values must be consistent with those declared in the schema structure.
44
- */
45
- insertEdgesBatchBySchema(schema: Schema, edges: Edge[], config: InsertRequestConfig): Promise<InsertResponse>;
46
- validEdgeRows(rows: Edge[]): {
47
- ok: boolean;
48
- msg?: string;
49
- failedIndex?: number;
50
- };
51
- /**
52
- * Inserts new edges of one or multiple schemas to the current graph through gRPC. The properties within edge values must be consistent with those defined in the corresponding schema structure.
53
- * @param edges
54
- * @param config
55
- * @returns
56
- */
57
- insertEdgesBatchAuto(edges: Edge[], config: InsertRequestConfig): Promise<Map<string, InsertResponse>>;
58
- }