@ultipa-graph/ultipa-driver 5.1.5-s5.2 → 6.0.4
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.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/client.d.ts +196 -0
- package/dist/client.js +394 -0
- package/dist/config.d.ts +65 -0
- package/dist/config.js +135 -0
- package/dist/connection.d.ts +30 -0
- package/dist/connection.js +190 -0
- package/dist/errors.d.ts +99 -0
- package/dist/errors.js +237 -0
- package/dist/index.d.ts +14 -5
- package/dist/index.js +88 -39
- package/dist/printers.d.ts +33 -0
- package/dist/printers.js +312 -0
- package/dist/proto/gqldb.proto +689 -0
- package/dist/response.d.ts +256 -0
- package/dist/response.js +723 -0
- package/dist/services/admin-service.d.ts +44 -0
- package/dist/services/admin-service.js +168 -0
- package/dist/services/bulk-import-service.d.ts +35 -0
- package/dist/services/bulk-import-service.js +105 -0
- package/dist/services/converters.d.ts +57 -0
- package/dist/services/converters.js +254 -0
- package/dist/services/data-service.d.ts +44 -0
- package/dist/services/data-service.js +206 -0
- package/dist/services/graph-service.d.ts +32 -0
- package/dist/services/graph-service.js +127 -0
- package/dist/services/health-service.d.ts +50 -0
- package/dist/services/health-service.js +78 -0
- package/dist/services/index.d.ts +13 -0
- package/dist/services/index.js +30 -0
- package/dist/services/query-service.d.ts +39 -0
- package/dist/services/query-service.js +112 -0
- package/dist/services/service-context.d.ts +39 -0
- package/dist/services/service-context.js +73 -0
- package/dist/services/session-service.d.ts +24 -0
- package/dist/services/session-service.js +66 -0
- package/dist/services/transaction-service.d.ts +33 -0
- package/dist/services/transaction-service.js +100 -0
- package/dist/services.d.ts +28 -0
- package/dist/services.js +122 -0
- package/dist/session.d.ts +45 -0
- package/dist/session.js +75 -0
- package/dist/transaction.d.ts +42 -0
- package/dist/transaction.js +89 -0
- package/dist/types/bulk_import.d.ts +53 -0
- package/dist/types/bulk_import.js +6 -0
- package/dist/types/data_types.d.ts +116 -0
- package/dist/types/data_types.js +122 -0
- package/dist/types/enums.d.ts +59 -0
- package/dist/types/enums.js +67 -0
- package/dist/types/graph_models.d.ts +54 -0
- package/dist/types/graph_models.js +6 -0
- package/dist/types/index.d.ts +11 -5
- package/dist/types/index.js +36 -37
- package/dist/types/metadata.d.ts +107 -0
- package/dist/types/metadata.js +6 -0
- package/dist/types/schema.d.ts +31 -0
- package/dist/types/schema.js +6 -0
- package/dist/types/typed_value.d.ts +25 -0
- package/dist/types/typed_value.js +1176 -0
- package/dist/types/wrappers.d.ts +23 -0
- package/dist/types/wrappers.js +39 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +24 -0
- package/package.json +50 -63
- package/dist/connection/connection.final.d.ts +0 -14
- package/dist/connection/connection.final.js +0 -94
- package/dist/connection/connection.final.js.map +0 -1
- package/dist/connection/connection.pool.d.ts +0 -21
- package/dist/connection/connection.pool.js +0 -103
- package/dist/connection/connection.pool.js.map +0 -1
- package/dist/connection/extra/algos/algo.extra.d.ts +0 -34
- package/dist/connection/extra/algos/algo.extra.js +0 -69
- package/dist/connection/extra/algos/algo.extra.js.map +0 -1
- package/dist/connection/extra/algos/algo.utils.d.ts +0 -3
- package/dist/connection/extra/algos/algo.utils.js +0 -54
- package/dist/connection/extra/algos/algo.utils.js.map +0 -1
- package/dist/connection/extra/algos/community.d.ts +0 -27
- package/dist/connection/extra/algos/community.js +0 -76
- package/dist/connection/extra/algos/community.js.map +0 -1
- package/dist/connection/extra/algos/degrees.d.ts +0 -10
- package/dist/connection/extra/algos/degrees.js +0 -24
- package/dist/connection/extra/algos/degrees.js.map +0 -1
- package/dist/connection/extra/algos/embedding.d.ts +0 -13
- package/dist/connection/extra/algos/embedding.js +0 -33
- package/dist/connection/extra/algos/embedding.js.map +0 -1
- package/dist/connection/extra/algos/index.d.ts +0 -5
- package/dist/connection/extra/algos/index.js +0 -14
- package/dist/connection/extra/algos/index.js.map +0 -1
- package/dist/connection/extra/base.extra.d.ts +0 -18
- package/dist/connection/extra/base.extra.js +0 -111
- package/dist/connection/extra/base.extra.js.map +0 -1
- package/dist/connection/extra/batch.insert.extra.d.ts +0 -58
- package/dist/connection/extra/batch.insert.extra.js +0 -354
- package/dist/connection/extra/batch.insert.extra.js.map +0 -1
- package/dist/connection/extra/connection.base.d.ts +0 -112
- package/dist/connection/extra/connection.base.js +0 -530
- package/dist/connection/extra/connection.base.js.map +0 -1
- package/dist/connection/extra/connection.d.ts +0 -17
- package/dist/connection/extra/connection.js +0 -44
- package/dist/connection/extra/connection.js.map +0 -1
- package/dist/connection/extra/graph.extra.d.ts +0 -54
- package/dist/connection/extra/graph.extra.js +0 -151
- package/dist/connection/extra/graph.extra.js.map +0 -1
- package/dist/connection/extra/hdc.extra.d.ts +0 -89
- package/dist/connection/extra/hdc.extra.js +0 -322
- package/dist/connection/extra/hdc.extra.js.map +0 -1
- package/dist/connection/extra/index.extra.d.ts +0 -102
- package/dist/connection/extra/index.extra.js +0 -210
- package/dist/connection/extra/index.extra.js.map +0 -1
- package/dist/connection/extra/job.extra.d.ts +0 -32
- package/dist/connection/extra/job.extra.js +0 -122
- package/dist/connection/extra/job.extra.js.map +0 -1
- package/dist/connection/extra/meta.extra.d.ts +0 -36
- package/dist/connection/extra/meta.extra.js +0 -123
- package/dist/connection/extra/meta.extra.js.map +0 -1
- package/dist/connection/extra/policy.extra.d.ts +0 -32
- package/dist/connection/extra/policy.extra.js +0 -114
- package/dist/connection/extra/policy.extra.js.map +0 -1
- package/dist/connection/extra/privilege.extra.d.ts +0 -8
- package/dist/connection/extra/privilege.extra.js +0 -20
- package/dist/connection/extra/privilege.extra.js.map +0 -1
- package/dist/connection/extra/property.extra.d.ts +0 -66
- package/dist/connection/extra/property.extra.js +0 -190
- package/dist/connection/extra/property.extra.js.map +0 -1
- package/dist/connection/extra/schema.extra.d.ts +0 -108
- package/dist/connection/extra/schema.extra.js +0 -253
- package/dist/connection/extra/schema.extra.js.map +0 -1
- package/dist/connection/extra/search.extra.d.ts +0 -12
- package/dist/connection/extra/search.extra.js +0 -117
- package/dist/connection/extra/search.extra.js.map +0 -1
- package/dist/connection/extra/task.extra.d.ts +0 -24
- package/dist/connection/extra/task.extra.js +0 -107
- package/dist/connection/extra/task.extra.js.map +0 -1
- package/dist/connection/extra/user.extra.d.ts +0 -28
- package/dist/connection/extra/user.extra.js +0 -91
- package/dist/connection/extra/user.extra.js.map +0 -1
- package/dist/connection/extra/user.privilege.extra.d.ts +0 -64
- package/dist/connection/extra/user.privilege.extra.js +0 -273
- package/dist/connection/extra/user.privilege.extra.js.map +0 -1
- package/dist/connection/index.d.ts +0 -5
- package/dist/connection/index.js +0 -13
- package/dist/connection/index.js.map +0 -1
- package/dist/connection/network.manager.d.ts +0 -28
- package/dist/connection/network.manager.js +0 -179
- package/dist/connection/network.manager.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/printers/alias.d.ts +0 -2
- package/dist/printers/alias.js +0 -39
- package/dist/printers/alias.js.map +0 -1
- package/dist/printers/any.d.ts +0 -2
- package/dist/printers/any.js +0 -63
- package/dist/printers/any.js.map +0 -1
- package/dist/printers/array.aio.d.ts +0 -3
- package/dist/printers/array.aio.js +0 -259
- package/dist/printers/array.aio.js.map +0 -1
- package/dist/printers/common.d.ts +0 -0
- package/dist/printers/common.js +0 -1
- package/dist/printers/common.js.map +0 -1
- package/dist/printers/edge.d.ts +0 -5
- package/dist/printers/edge.js +0 -78
- package/dist/printers/edge.js.map +0 -1
- package/dist/printers/explain.plan.d.ts +0 -2
- package/dist/printers/explain.plan.js +0 -46
- package/dist/printers/explain.plan.js.map +0 -1
- package/dist/printers/index.d.ts +0 -24
- package/dist/printers/index.js +0 -43
- package/dist/printers/index.js.map +0 -1
- package/dist/printers/node.d.ts +0 -5
- package/dist/printers/node.js +0 -77
- package/dist/printers/node.js.map +0 -1
- package/dist/printers/path.d.ts +0 -3
- package/dist/printers/path.js +0 -62
- package/dist/printers/path.js.map +0 -1
- package/dist/printers/status.d.ts +0 -3
- package/dist/printers/status.js +0 -68
- package/dist/printers/status.js.map +0 -1
- package/dist/printers/table.d.ts +0 -2
- package/dist/printers/table.js +0 -56
- package/dist/printers/table.js.map +0 -1
- package/dist/proto/tmp.js +0 -366
- package/dist/proto/ultipa_grpc_pb.d.ts +0 -258
- package/dist/proto/ultipa_grpc_pb.js +0 -366
- package/dist/proto/ultipa_grpc_pb.js.map +0 -1
- package/dist/proto/ultipa_pb.d.ts +0 -1
- package/dist/proto/ultipa_pb.js +0 -12119
- package/dist/proto/ultipa_pb.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/types.algos.params.d.ts +0 -545
- package/dist/types/types.algos.params.js +0 -16
- package/dist/types/types.algos.params.js.map +0 -1
- package/dist/types/types.d.ts +0 -1214
- package/dist/types/types.extra.d.ts +0 -146
- package/dist/types/types.extra.js +0 -27
- package/dist/types/types.extra.js.map +0 -1
- package/dist/types/types.js +0 -1606
- package/dist/types/types.js.map +0 -1
- package/dist/types/util.d.ts +0 -15
- package/dist/types/util.js +0 -136
- package/dist/types/util.js.map +0 -1
- package/dist/utils/common.d.ts +0 -3
- package/dist/utils/common.js +0 -22
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/config.d.ts +0 -3
- package/dist/utils/config.js +0 -7
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/format.d.ts +0 -45
- package/dist/utils/format.js +0 -879
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.js +0 -30
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/params.validate.d.ts +0 -4
- package/dist/utils/params.validate.js +0 -14
- package/dist/utils/params.validate.js.map +0 -1
- package/dist/utils/property.d.ts +0 -24
- package/dist/utils/property.js +0 -203
- package/dist/utils/property.js.map +0 -1
- package/dist/utils/raft.retry.d.ts +0 -0
- package/dist/utils/raft.retry.js +0 -1
- package/dist/utils/raft.retry.js.map +0 -1
- package/dist/utils/serialize/commont.d.ts +0 -12
- package/dist/utils/serialize/commont.js +0 -46
- package/dist/utils/serialize/commont.js.map +0 -1
- package/dist/utils/serialize/deserialize.d.ts +0 -10
- package/dist/utils/serialize/deserialize.js +0 -288
- package/dist/utils/serialize/deserialize.js.map +0 -1
- package/dist/utils/serialize/null.d.ts +0 -32
- package/dist/utils/serialize/null.js +0 -178
- package/dist/utils/serialize/null.js.map +0 -1
- package/dist/utils/serialize/serialize.d.ts +0 -10
- package/dist/utils/serialize/serialize.js +0 -146
- package/dist/utils/serialize/serialize.js.map +0 -1
- package/dist/utils/stream.helper.d.ts +0 -10
- package/dist/utils/stream.helper.js +0 -71
- package/dist/utils/stream.helper.js.map +0 -1
- package/dist/utils/time.record.d.ts +0 -15
- package/dist/utils/time.record.js +0 -52
- package/dist/utils/time.record.js.map +0 -1
- package/dist/utils/timezone.d.ts +0 -7
- package/dist/utils/timezone.js +0 -21
- package/dist/utils/timezone.js.map +0 -1
- package/dist/utils/ultipa.datetime.d.ts +0 -14
- package/dist/utils/ultipa.datetime.js +0 -160
- package/dist/utils/ultipa.datetime.js.map +0 -1
- package/dist/utils/uql-maker.d.ts +0 -165
- package/dist/utils/uql-maker.js +0 -402
- package/dist/utils/uql-maker.js.map +0 -1
- package/dist/utils/uql.parse.d.ts +0 -27
- package/dist/utils/uql.parse.js +0 -205
- package/dist/utils/uql.parse.js.map +0 -1
- package/readme.md +0 -65
- package/src/proto/build.sh +0 -41
- package/src/proto/build_windows.sh +0 -40
- package/src/proto/ultipa.proto +0 -531
- package/src/proto/ultipa_grpc_pb.d.ts +0 -92
- package/src/proto/ultipa_grpc_pb.js +0 -414
- package/src/proto/ultipa_pb.d.ts +0 -1983
- package/src/proto/ultipa_pb.js +0 -14852
|
@@ -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 =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25seSB2YWx1ZTogbnVtYmVyKSB7fVxufVxuXG4vKiogV3JhcHBlciBmb3IgZXhwbGljaXQgMzItYml0IHVuc2lnbmVkIGludGVnZXIgKi9cbmV4cG9ydCBjbGFzcyBVSW50MzIge1xuICBjb25zdHJ1Y3RvcihwdWJsaWMgcmVhZG9ubHkgdmFsdWU6IG51bWJlcikge31cbn1cblxuLyoqIFdyYXBwZXIgZm9yIGV4cGxpY2l0IDMyLWJpdCBmbG9hdCAqL1xuZXhwb3J0IGNsYXNzIEZsb2F0MzIge1xuICBjb25zdHJ1Y3RvcihwdWJsaWMgcmVhZG9ubHkgdmFsdWU6IG51bWJlcikge31cbn1cblxuLyoqIFdyYXBwZXIgZm9yIGV4cGxpY2l0IDY0LWJpdCB1bnNpZ25lZCBpbnRlZ2VyICovXG5leHBvcnQgY2xhc3MgVUludDY0IHtcbiAgY29uc3RydWN0b3IocHVibGljIHJlYWRvbmx5IHZhbHVlOiBiaWdpbnQpIHt9XG59XG4iXX0=
|
package/dist/types.d.ts
ADDED
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7OztHQUtHOzs7Ozs7Ozs7Ozs7Ozs7O0FBRUgsZ0RBQThCIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBUeXBlIGRlZmluaXRpb25zIGZvciBHUUxEQiBOb2RlLmpzIGRyaXZlci5cbiAqXG4gKiBUaGlzIGZpbGUgcmUtZXhwb3J0cyBhbGwgdHlwZXMgZnJvbSB0aGUgdHlwZXMvIHN1YmRpcmVjdG9yeSBmb3IgYmFja3dhcmQgY29tcGF0aWJpbGl0eS5cbiAqIEBkZXByZWNhdGVkIEltcG9ydCBkaXJlY3RseSBmcm9tIHR5cGVzLyBzdWJkaXJlY3RvcnkgZm9yIGJldHRlciB0cmVlLXNoYWtpbmcuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi90eXBlcy9pbmRleCc7XG4iXX0=
|
package/package.json
CHANGED
|
@@ -1,63 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
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"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@ultipa-graph/ultipa-driver",
|
|
3
|
+
"version": "6.0.4",
|
|
4
|
+
"description": "NodeJS SDK for Ultipa GQL",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
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"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
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"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
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"
|
|
49
|
+
}
|
|
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,94 +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
|
-
connectionPool;
|
|
22
|
-
constructor(config) {
|
|
23
|
-
let crt;
|
|
24
|
-
if (config.crt && config.crt.length !== 0) {
|
|
25
|
-
crt = fs_1.default.readFileSync(config.crt);
|
|
26
|
-
}
|
|
27
|
-
super(config.hosts[0], config.username, config.password, crt, config);
|
|
28
|
-
this.connectionPool = new connection_pool_1.ConnectionPool(config.hosts, config.username, config.password, crt, config);
|
|
29
|
-
}
|
|
30
|
-
setGraph(graphName) {
|
|
31
|
-
this.defaultConfig.defaultGraph = graphName;
|
|
32
|
-
this.connectionPool.setGraph(graphName);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.UltipaDriver = UltipaDriver;
|
|
36
|
-
// export class UltipaDriver extends ConnectionFinal {
|
|
37
|
-
// private _instance: ConnectionFinal = null;
|
|
38
|
-
// private _initPromise: Promise<ConnectionFinal> = null;
|
|
39
|
-
// constructor(config: UltipaConfig) {
|
|
40
|
-
// let crt: Buffer;
|
|
41
|
-
// if (config.crt && config.crt.length !== 0) {
|
|
42
|
-
// crt = fs.readFileSync(config.crt)
|
|
43
|
-
// }
|
|
44
|
-
// super(config.hosts[0], config.username, config.password,
|
|
45
|
-
// crt,
|
|
46
|
-
// config);
|
|
47
|
-
// function withTimeout(promise: Promise<ConnectionFinal>, ms: number): Promise<ConnectionFinal> {
|
|
48
|
-
// const timeoutPromise = new Promise<ConnectionFinal>((_, reject) => {
|
|
49
|
-
// const timeoutId = setTimeout(() => {
|
|
50
|
-
// clearTimeout(timeoutId);
|
|
51
|
-
// reject(new Error('Connection timeout'));
|
|
52
|
-
// }, ms);
|
|
53
|
-
// });
|
|
54
|
-
// return Promise.race([promise, timeoutPromise]);
|
|
55
|
-
// }
|
|
56
|
-
// return new Proxy(this, {
|
|
57
|
-
// get: (target: UltipaDriver, prop: string) => {
|
|
58
|
-
// if (typeof target[prop] === 'function') {
|
|
59
|
-
// return target[prop].bind(target);
|
|
60
|
-
// }
|
|
61
|
-
// if (prop in target) {
|
|
62
|
-
// return target[prop];
|
|
63
|
-
// }
|
|
64
|
-
// return async (...args: any[]) => {
|
|
65
|
-
// if (!target._initPromise) {
|
|
66
|
-
// target._initPromise = (async () => {
|
|
67
|
-
// const pool = new ConnectionPool(
|
|
68
|
-
// config.hosts,
|
|
69
|
-
// config.username,
|
|
70
|
-
// config.password,
|
|
71
|
-
// crt,
|
|
72
|
-
// config
|
|
73
|
-
// );
|
|
74
|
-
// target._instance = await withTimeout(
|
|
75
|
-
// pool.getActive(),
|
|
76
|
-
// config?.timeout * 1000 || Number.MAX_SAFE_INTEGER
|
|
77
|
-
// );
|
|
78
|
-
// return target._instance;
|
|
79
|
-
// })();
|
|
80
|
-
// }
|
|
81
|
-
// try {
|
|
82
|
-
// await target._initPromise;
|
|
83
|
-
// return target._instance[prop](...args);
|
|
84
|
-
// } catch (error) {
|
|
85
|
-
// target._initPromise = null;
|
|
86
|
-
// target._instance = null;
|
|
87
|
-
// throw error;
|
|
88
|
-
// }
|
|
89
|
-
// };
|
|
90
|
-
// }
|
|
91
|
-
// });
|
|
92
|
-
// }
|
|
93
|
-
// }
|
|
94
|
-
//# 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;IAErC,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;AAxBD,oCAwBC;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,EACZ,aAA4B;QAE5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAA;IACzB,CAAC;IAEO,qBAAqB,CAAC,I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qB,CAAC,IAAI,CAAC,CAAA;YACzC,IAAI,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;YAC9B,IAAI,IAAI,EAAE;gBACN,IAAI,CAAC,YAAY,GAAG,CAAC,CAAA;gBACrB,OAAO,MAAM,CAAA;aAChB;SACJ;QACD,OAAO,MAAM,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,IAAI;QACN,IAAI,CAAC,GAAY,KAAK,CAAC;QACvB,MAAM,kBAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC1C,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;YACzC,IAAI,IAAI,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;gBACrC,IAAI,EAAE,IAAI;aACb,CAAC,CAAA;YACF,CAAC,GAAG,IAAI,CAAC,OAAO,CAAA;QACpB,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,CAAA;IACZ,CAAC;IAED,QAAQ,CAAC,SAAiB;QACtB,IAAI,CAAC,aAAa,CAAC,YAAY,GAAG,SAAS,CAAC;QAC5C,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACpC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAtGD,wCAsGC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ConnectionBase } from "../connection.base";
|
|
2
|
-
import { RequestType, ULTIPA, ResponseType, AlgoParams } from "../../../types";
|
|
3
|
-
export declare class AlgoExtra extends ConnectionBase {
|
|
4
|
-
/**
|
|
5
|
-
* 获取算法列表
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```js
|
|
9
|
-
* let conn = ...
|
|
10
|
-
* let res = await conn.listAlgo()
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
listAlgo(commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Algo[]>>;
|
|
14
|
-
/**
|
|
15
|
-
* 获取算法列表
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```js
|
|
19
|
-
* let conn = ...
|
|
20
|
-
* let res = await conn.listExta()
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
listExta(commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Exta[]>>;
|
|
24
|
-
/**
|
|
25
|
-
* 算法可视化
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```js
|
|
29
|
-
* let conn = ...
|
|
30
|
-
* let res = await conn.algo_dv({algo_name: "louvain", id: "1", top: 1, total: 5})
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
algo_dv(req: AlgoParams.dv, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
|
|
34
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AlgoExtra = void 0;
|
|
4
|
-
const connection_base_1 = require("../connection.base");
|
|
5
|
-
const types_1 = require("../../../types");
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const { CommandList } = utils_1.UQLMAKER;
|
|
8
|
-
class AlgoExtra extends connection_base_1.ConnectionBase {
|
|
9
|
-
/**
|
|
10
|
-
* 获取算法列表
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```js
|
|
14
|
-
* let conn = ...
|
|
15
|
-
* let res = await conn.listAlgo()
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
async listAlgo(commonReq) {
|
|
19
|
-
let command = CommandList.listAlgo;
|
|
20
|
-
let uqlMaker = new utils_1.UQLMAKER(command, commonReq);
|
|
21
|
-
let res = connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker, {
|
|
22
|
-
jsonKeys: ["param"],
|
|
23
|
-
dataFormat: (data) => {
|
|
24
|
-
return types_1.type_util.algoFormat(data);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return res;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 获取算法列表
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```js
|
|
34
|
-
* let conn = ...
|
|
35
|
-
* let res = await conn.listExta()
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
async listExta(commonReq) {
|
|
39
|
-
let command = CommandList.listExta;
|
|
40
|
-
let uqlMaker = new utils_1.UQLMAKER(command, commonReq);
|
|
41
|
-
let res = connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker);
|
|
42
|
-
return res;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* 算法可视化
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```js
|
|
49
|
-
* let conn = ...
|
|
50
|
-
* let res = await conn.algo_dv({algo_name: "louvain", id: "1", top: 1, total: 5})
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
async algo_dv(req, commonReq) {
|
|
54
|
-
let commond = utils_1.UQLMAKER.CommandList.algo_dv;
|
|
55
|
-
let uqlMaker = new utils_1.UQLMAKER(commond, commonReq, req.algo_name);
|
|
56
|
-
uqlMaker.addParam("id", req.id);
|
|
57
|
-
uqlMaker.addParam("params", {
|
|
58
|
-
top: req.top,
|
|
59
|
-
total: req.total
|
|
60
|
-
});
|
|
61
|
-
let res = await this.uqlSingle(uqlMaker);
|
|
62
|
-
return {
|
|
63
|
-
...res.responseWithoutData,
|
|
64
|
-
data: res.QueryReply
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.AlgoExtra = AlgoExtra;
|
|
69
|
-
//# sourceMappingURL=algo.extra.js.map
|
|
@@ -1 +0,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AAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;QAC/B,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACxB,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,KAAK,EAAE,GAAG,CAAC,KAAK;SACnB,CAAC,CAAA;QACF,IAAI,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QACxC,OAA2C;YACvC,GAAG,GAAG,CAAC,mBAAmB;YAC1B,IAAI,EAAE,GAAG,CAAC,UAAU;SACvB,CAAA;IACL,CAAC;CACJ;AA3DD,8BA2DC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { AlgoParams, RequestType, ULTIPA } from "../../../types";
|
|
2
|
-
import { ConnectionBase } from "../connection.base";
|
|
3
|
-
export declare const algoCommonSend: (conn: ConnectionBase, req: AlgoParams.base, name: string, commonReq?: RequestType.RequestConfig) => Promise<ULTIPA.Response<ULTIPA.QueryReply>>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.algoCommonSend = void 0;
|
|
4
|
-
const uql_maker_1 = require("../../../utils/uql-maker");
|
|
5
|
-
const algoCommonSend = async (conn, req, name, commonReq) => {
|
|
6
|
-
// 因为有些values里会有值,有些tables会有值,也有可能2者都有值
|
|
7
|
-
// 如果write_back,可能就values有值,其它没值
|
|
8
|
-
// 有些算法不支持write_back,用户填上也没有用,可能还是其它里的值
|
|
9
|
-
// 大部分values里都有值,所以不能取其中一个返回给用户
|
|
10
|
-
// 所以把结果统一透传出去
|
|
11
|
-
let command = uql_maker_1.UQLMAKER.CommandList.algo;
|
|
12
|
-
if (req.exec_task) {
|
|
13
|
-
command = "exec task " + command;
|
|
14
|
-
}
|
|
15
|
-
let uqlMaker = new uql_maker_1.UQLMAKER(command, commonReq, name.replace(/^algo_/, ""));
|
|
16
|
-
let { write_back, visualization, exec_task, force, write_file, write_db, stats, stream, ...params } = req || {};
|
|
17
|
-
if (Object.keys(params).length > 0) {
|
|
18
|
-
uqlMaker.addParam("params", params);
|
|
19
|
-
}
|
|
20
|
-
if (write_back) {
|
|
21
|
-
uqlMaker.addParam("write_back", "", false);
|
|
22
|
-
}
|
|
23
|
-
if (force) {
|
|
24
|
-
uqlMaker.addParam("force", "", false);
|
|
25
|
-
}
|
|
26
|
-
if (stats) {
|
|
27
|
-
uqlMaker.addParam("stats", "", false);
|
|
28
|
-
}
|
|
29
|
-
if (write_file || write_db) {
|
|
30
|
-
let ws = {};
|
|
31
|
-
if (write_file) {
|
|
32
|
-
ws.file = write_file;
|
|
33
|
-
}
|
|
34
|
-
if (write_db) {
|
|
35
|
-
ws.db = write_db;
|
|
36
|
-
}
|
|
37
|
-
uqlMaker.addParam("write", ws);
|
|
38
|
-
}
|
|
39
|
-
if (stream) {
|
|
40
|
-
if (stream === true) {
|
|
41
|
-
uqlMaker.addParam("stream", stream, false);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
uqlMaker.addParam("stream", stream);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
let res = await conn.uqlSingle(uqlMaker);
|
|
48
|
-
return {
|
|
49
|
-
...res.responseWithoutData,
|
|
50
|
-
data: res.QueryReply.toJSON()
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
exports.algoCommonSend = algoCommonSend;
|
|
54
|
-
//# sourceMappingURL=algo.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"algo.utils.js","sourceRoot":"","sources":["../../../../src/connection/extra/algos/algo.utils.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AAI7C,MAAM,cAAc,GAAG,KAAK,EAAE,IAAoB,EAAE,GAAoB,EAAE,IAAY,EAAE,SAAqC,EAAE,EAAE;IACpI,uCAAuC;IACvC,gCAAgC;IAChC,uCAAuC;IACvC,+BAA+B;IAC/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