@ultipa-graph/ultipa-driver 5.0.0-s5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.DS_Store +0 -0
- package/dist/connection/connection.final.d.ts +45 -0
- package/dist/connection/connection.final.js +600 -0
- package/dist/connection/connection.final.js.map +1 -0
- package/dist/connection/connection.pool.d.ts +26 -0
- package/dist/connection/connection.pool.js +121 -0
- package/dist/connection/connection.pool.js.map +1 -0
- package/dist/connection/extra/algos/algo.extra.d.ts +34 -0
- package/dist/connection/extra/algos/algo.extra.js +81 -0
- package/dist/connection/extra/algos/algo.extra.js.map +1 -0
- package/dist/connection/extra/algos/algo.utils.d.ts +3 -0
- package/dist/connection/extra/algos/algo.utils.js +71 -0
- package/dist/connection/extra/algos/algo.utils.js.map +1 -0
- package/dist/connection/extra/algos/community.d.ts +27 -0
- package/dist/connection/extra/algos/community.js +129 -0
- package/dist/connection/extra/algos/community.js.map +1 -0
- package/dist/connection/extra/algos/degrees.d.ts +10 -0
- package/dist/connection/extra/algos/degrees.js +43 -0
- package/dist/connection/extra/algos/degrees.js.map +1 -0
- package/dist/connection/extra/algos/embedding.d.ts +13 -0
- package/dist/connection/extra/algos/embedding.js +58 -0
- package/dist/connection/extra/algos/embedding.js.map +1 -0
- package/dist/connection/extra/algos/index.d.ts +5 -0
- package/dist/connection/extra/algos/index.js +14 -0
- package/dist/connection/extra/algos/index.js.map +1 -0
- package/dist/connection/extra/base.extra.d.ts +71 -0
- package/dist/connection/extra/base.extra.js +183 -0
- package/dist/connection/extra/base.extra.js.map +1 -0
- package/dist/connection/extra/connection.base.d.ts +82 -0
- package/dist/connection/extra/connection.base.js +623 -0
- package/dist/connection/extra/connection.base.js.map +1 -0
- package/dist/connection/extra/connection.d.ts +16 -0
- package/dist/connection/extra/connection.js +46 -0
- package/dist/connection/extra/connection.js.map +1 -0
- package/dist/connection/extra/graph.extra.d.ts +85 -0
- package/dist/connection/extra/graph.extra.js +241 -0
- package/dist/connection/extra/graph.extra.js.map +1 -0
- package/dist/connection/extra/index.extra.d.ts +70 -0
- package/dist/connection/extra/index.extra.js +201 -0
- package/dist/connection/extra/index.extra.js.map +1 -0
- package/dist/connection/extra/job.extra.d.ts +32 -0
- package/dist/connection/extra/job.extra.js +145 -0
- package/dist/connection/extra/job.extra.js.map +1 -0
- package/dist/connection/extra/meta.extra.d.ts +91 -0
- package/dist/connection/extra/meta.extra.js +441 -0
- package/dist/connection/extra/meta.extra.js.map +1 -0
- package/dist/connection/extra/property.extra.d.ts +81 -0
- package/dist/connection/extra/property.extra.js +268 -0
- package/dist/connection/extra/property.extra.js.map +1 -0
- package/dist/connection/extra/schema.extra.d.ts +50 -0
- package/dist/connection/extra/schema.extra.js +248 -0
- package/dist/connection/extra/schema.extra.js.map +1 -0
- package/dist/connection/extra/search.extra.d.ts +12 -0
- package/dist/connection/extra/search.extra.js +126 -0
- package/dist/connection/extra/search.extra.js.map +1 -0
- package/dist/connection/extra/task.extra.d.ts +24 -0
- package/dist/connection/extra/task.extra.js +126 -0
- package/dist/connection/extra/task.extra.js.map +1 -0
- package/dist/connection/extra/user.privilege.extra.d.ts +64 -0
- package/dist/connection/extra/user.privilege.extra.js +348 -0
- package/dist/connection/extra/user.privilege.extra.js.map +1 -0
- package/dist/connection/index.d.ts +4 -0
- package/dist/connection/index.js +10 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/connection/network.manager.d.ts +27 -0
- package/dist/connection/network.manager.js +178 -0
- package/dist/connection/network.manager.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/printers/alias.d.ts +2 -0
- package/dist/printers/alias.js +15 -0
- package/dist/printers/alias.js.map +1 -0
- package/dist/printers/any.d.ts +2 -0
- package/dist/printers/any.js +40 -0
- package/dist/printers/any.js.map +1 -0
- package/dist/printers/array.aio.d.ts +44 -0
- package/dist/printers/array.aio.js +240 -0
- package/dist/printers/array.aio.js.map +1 -0
- package/dist/printers/common.d.ts +0 -0
- package/dist/printers/common.js +1 -0
- package/dist/printers/common.js.map +1 -0
- package/dist/printers/edge.d.ts +5 -0
- package/dist/printers/edge.js +49 -0
- package/dist/printers/edge.js.map +1 -0
- package/dist/printers/explain.plan.d.ts +2 -0
- package/dist/printers/explain.plan.js +24 -0
- package/dist/printers/explain.plan.js.map +1 -0
- package/dist/printers/graph.d.ts +2 -0
- package/dist/printers/graph.js +34 -0
- package/dist/printers/graph.js.map +1 -0
- package/dist/printers/index.d.ts +25 -0
- package/dist/printers/index.js +44 -0
- package/dist/printers/index.js.map +1 -0
- package/dist/printers/node.d.ts +5 -0
- package/dist/printers/node.js +49 -0
- package/dist/printers/node.js.map +1 -0
- package/dist/printers/path.d.ts +3 -0
- package/dist/printers/path.js +42 -0
- package/dist/printers/path.js.map +1 -0
- package/dist/printers/status.d.ts +3 -0
- package/dist/printers/status.js +45 -0
- package/dist/printers/status.js.map +1 -0
- package/dist/printers/table.d.ts +2 -0
- package/dist/printers/table.js +31 -0
- package/dist/printers/table.js.map +1 -0
- package/dist/proto/tmp.js +366 -0
- package/dist/proto/ultipa_grpc_pb.d.ts +257 -0
- package/dist/proto/ultipa_grpc_pb.js +366 -0
- package/dist/proto/ultipa_grpc_pb.js.map +1 -0
- package/dist/proto/ultipa_pb.d.ts +1 -0
- package/dist/proto/ultipa_pb.js +11002 -0
- package/dist/proto/ultipa_pb.js.map +1 -0
- package/dist/transaction/UltipaSession.d.ts +28 -0
- package/dist/transaction/UltipaSession.js +148 -0
- package/dist/transaction/UltipaSession.js.map +1 -0
- package/dist/transaction/UltipaTransaction.Recorder.d.ts +20 -0
- package/dist/transaction/UltipaTransaction.Recorder.js +23 -0
- package/dist/transaction/UltipaTransaction.Recorder.js.map +1 -0
- package/dist/transaction/UltipaTransaction.d.ts +35 -0
- package/dist/transaction/UltipaTransaction.js +203 -0
- package/dist/transaction/UltipaTransaction.js.map +1 -0
- package/dist/transaction/UltipaTransactionSession.d.ts +15 -0
- package/dist/transaction/UltipaTransactionSession.js +46 -0
- package/dist/transaction/UltipaTransactionSession.js.map +1 -0
- package/dist/transaction/operations/Transaction.Deletes.d.ts +4 -0
- package/dist/transaction/operations/Transaction.Deletes.js +52 -0
- package/dist/transaction/operations/Transaction.Deletes.js.map +1 -0
- package/dist/transaction/operations/Transaction.Inserts.d.ts +4 -0
- package/dist/transaction/operations/Transaction.Inserts.js +78 -0
- package/dist/transaction/operations/Transaction.Inserts.js.map +1 -0
- package/dist/transaction/operations/Transaction.Update.d.ts +4 -0
- package/dist/transaction/operations/Transaction.Update.js +43 -0
- package/dist/transaction/operations/Transaction.Update.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/types.algos.params.d.ts +545 -0
- package/dist/types/types.algos.params.js +16 -0
- package/dist/types/types.algos.params.js.map +1 -0
- package/dist/types/types.d.ts +496 -0
- package/dist/types/types.extra.d.ts +788 -0
- package/dist/types/types.extra.js +49 -0
- package/dist/types/types.extra.js.map +1 -0
- package/dist/types/types.js +706 -0
- package/dist/types/types.js.map +1 -0
- package/dist/types/util.d.ts +15 -0
- package/dist/types/util.js +163 -0
- package/dist/types/util.js.map +1 -0
- package/dist/utils/common.d.ts +3 -0
- package/dist/utils/common.js +31 -0
- package/dist/utils/common.js.map +1 -0
- package/dist/utils/config.d.ts +3 -0
- package/dist/utils/config.js +7 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/format.d.ts +49 -0
- package/dist/utils/format.js +990 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +34 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/params.validate.d.ts +4 -0
- package/dist/utils/params.validate.js +14 -0
- package/dist/utils/params.validate.js.map +1 -0
- package/dist/utils/property.d.ts +15 -0
- package/dist/utils/property.js +117 -0
- package/dist/utils/property.js.map +1 -0
- package/dist/utils/raft.retry.d.ts +0 -0
- package/dist/utils/raft.retry.js +1 -0
- package/dist/utils/raft.retry.js.map +1 -0
- package/dist/utils/serialize/commont.d.ts +12 -0
- package/dist/utils/serialize/commont.js +46 -0
- package/dist/utils/serialize/commont.js.map +1 -0
- package/dist/utils/serialize/deserialize.d.ts +9 -0
- package/dist/utils/serialize/deserialize.js +164 -0
- package/dist/utils/serialize/deserialize.js.map +1 -0
- package/dist/utils/serialize/null.d.ts +24 -0
- package/dist/utils/serialize/null.js +133 -0
- package/dist/utils/serialize/null.js.map +1 -0
- package/dist/utils/serialize/serialize.d.ts +10 -0
- package/dist/utils/serialize/serialize.js +135 -0
- package/dist/utils/serialize/serialize.js.map +1 -0
- package/dist/utils/stream.helper.d.ts +9 -0
- package/dist/utils/stream.helper.js +97 -0
- package/dist/utils/stream.helper.js.map +1 -0
- package/dist/utils/time.record.d.ts +15 -0
- package/dist/utils/time.record.js +50 -0
- package/dist/utils/time.record.js.map +1 -0
- package/dist/utils/timezone.d.ts +7 -0
- package/dist/utils/timezone.js +21 -0
- package/dist/utils/timezone.js.map +1 -0
- package/dist/utils/ultipa.datetime.d.ts +8 -0
- package/dist/utils/ultipa.datetime.js +120 -0
- package/dist/utils/ultipa.datetime.js.map +1 -0
- package/dist/utils/uql-maker.d.ts +164 -0
- package/dist/utils/uql-maker.js +400 -0
- package/dist/utils/uql-maker.js.map +1 -0
- package/dist/utils/uql.parse.d.ts +27 -0
- package/dist/utils/uql.parse.js +206 -0
- package/dist/utils/uql.parse.js.map +1 -0
- package/package.json +62 -0
- package/readme.md +63 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConnectionBase } from "./connection.base";
|
|
2
|
+
import { BaseExtra } from "./base.extra";
|
|
3
|
+
import { GraphExra } from "./graph.extra";
|
|
4
|
+
import { SchemaExra } from "./schema.extra";
|
|
5
|
+
import { UserExtra, PrivilegeExtra } from "./user.privilege.extra";
|
|
6
|
+
import { PropertyExtra } from "./property.extra";
|
|
7
|
+
import { IndexExtra } from "./index.extra";
|
|
8
|
+
import { MetaExra } from "./meta.extra";
|
|
9
|
+
import { JobExra } from "./job.extra";
|
|
10
|
+
import { SearchExra } from "./search.extra";
|
|
11
|
+
import { AlgoExtra, AlgorithmsCommunity, AlgorithmsDegrees, AlgorithmsEmbedding } from "./algos";
|
|
12
|
+
interface Connection extends ConnectionBase, BaseExtra, GraphExra, SchemaExra, UserExtra, PrivilegeExtra, PropertyExtra, IndexExtra, MetaExra, JobExra, SearchExra, AlgoExtra, AlgorithmsCommunity, AlgorithmsDegrees, AlgorithmsEmbedding {
|
|
13
|
+
}
|
|
14
|
+
declare class Connection extends ConnectionBase {
|
|
15
|
+
}
|
|
16
|
+
export { Connection };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Connection = void 0;
|
|
4
|
+
const connection_base_1 = require("./connection.base");
|
|
5
|
+
const base_extra_1 = require("./base.extra");
|
|
6
|
+
const graph_extra_1 = require("./graph.extra");
|
|
7
|
+
const schema_extra_1 = require("./schema.extra");
|
|
8
|
+
const user_privilege_extra_1 = require("./user.privilege.extra");
|
|
9
|
+
const property_extra_1 = require("./property.extra");
|
|
10
|
+
const index_extra_1 = require("./index.extra");
|
|
11
|
+
const meta_extra_1 = require("./meta.extra");
|
|
12
|
+
const job_extra_1 = require("./job.extra");
|
|
13
|
+
const search_extra_1 = require("./search.extra");
|
|
14
|
+
const algos_1 = require("./algos");
|
|
15
|
+
let mixins = [
|
|
16
|
+
connection_base_1.ConnectionBase,
|
|
17
|
+
base_extra_1.BaseExtra,
|
|
18
|
+
graph_extra_1.GraphExra,
|
|
19
|
+
schema_extra_1.SchemaExra,
|
|
20
|
+
user_privilege_extra_1.UserExtra,
|
|
21
|
+
user_privilege_extra_1.PrivilegeExtra,
|
|
22
|
+
property_extra_1.PropertyExtra,
|
|
23
|
+
index_extra_1.IndexExtra,
|
|
24
|
+
meta_extra_1.MetaExra,
|
|
25
|
+
job_extra_1.JobExra,
|
|
26
|
+
search_extra_1.SearchExra,
|
|
27
|
+
algos_1.AlgoExtra,
|
|
28
|
+
algos_1.AlgorithmsCommunity,
|
|
29
|
+
algos_1.AlgorithmsDegrees,
|
|
30
|
+
algos_1.AlgorithmsEmbedding
|
|
31
|
+
];
|
|
32
|
+
class Connection extends connection_base_1.ConnectionBase {
|
|
33
|
+
}
|
|
34
|
+
exports.Connection = Connection;
|
|
35
|
+
/**
|
|
36
|
+
* @ignore
|
|
37
|
+
*/
|
|
38
|
+
function applyMixins(derivedCtor, baseCtors) {
|
|
39
|
+
baseCtors.forEach((baseCtor) => {
|
|
40
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
41
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
applyMixins(Connection, mixins);
|
|
46
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/connection/extra/connection.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAClD,6CAAsC;AACtC,+CAAuC;AACvC,iDAAyC;AACzC,iEAAgE;AAChE,qDAA8C;AAC9C,+CAAwC;AACxC,6CAAqC;AACrC,2CAAmC;AACnC,iDAAyC;AACzC,mCAA2F;AAG3F,IAAI,MAAM,GAAG;IACT,gCAAc;IACd,sBAAS;IACT,uBAAS;IACT,yBAAU;IACV,gCAAS;IACT,qCAAc;IACd,8BAAa;IACb,wBAAU;IACV,qBAAQ;IACR,mBAAO;IACP,yBAAU;IACV,iBAAS;IACT,2BAAmB;IACnB,yBAAiB;IACjB,2BAAmB;CACtB,CAAA;AAsBD,MAAM,UAAW,SAAQ,gCAAc;CAEtC;AAmBG,gCAAU;AAlBd;;GAEG;AACH,SAAS,WAAW,CAAC,WAAgB,EAAE,SAAgB;IACnD,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC3B,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5D,MAAM,CAAC,cAAc,CACjB,WAAW,CAAC,SAAS,EACrB,IAAI,EACJ,MAAM,CAAC,wBAAwB,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAC5D,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AACD,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ConnectionBase } from "./connection.base";
|
|
2
|
+
import { RequestType, ULTIPA, ResponseType, RequestParamType } from "../../types";
|
|
3
|
+
export declare class GraphExra extends ConnectionBase {
|
|
4
|
+
/**
|
|
5
|
+
* 查看图集列表
|
|
6
|
+
* @deprecated Use `showGraph`
|
|
7
|
+
*/
|
|
8
|
+
listGraph(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.GraphSet[]>>;
|
|
9
|
+
/**
|
|
10
|
+
* 查看图集列表
|
|
11
|
+
* @example client.showGraph(requestConfig)
|
|
12
|
+
*/
|
|
13
|
+
showGraph(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.GraphSet[]>>;
|
|
14
|
+
/**
|
|
15
|
+
* 查看图集列表
|
|
16
|
+
*/
|
|
17
|
+
showGraphMore(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.GraphSet[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* 获取图集信息
|
|
20
|
+
*/
|
|
21
|
+
getGraph(graphName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.GraphSet>>;
|
|
22
|
+
/**
|
|
23
|
+
* 图集是否存在
|
|
24
|
+
*/
|
|
25
|
+
hasGraph(graphName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<Boolean>>;
|
|
26
|
+
/**
|
|
27
|
+
* 创建图集
|
|
28
|
+
*/
|
|
29
|
+
createGraph(graph: ULTIPA.GraphSet, shards: string[], partitionByHash?: RequestType.CityHash64, config?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
30
|
+
/**
|
|
31
|
+
* 图集不存在时创建图集
|
|
32
|
+
* @param graph
|
|
33
|
+
* @param shards
|
|
34
|
+
* @param partitionByHash
|
|
35
|
+
* @param config
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
createGraphIfNotExit(graph: ULTIPA.GraphSet, shards: string[], partitionByHash: RequestType.CityHash64, config?: RequestType.RequestConfig): Promise<ULTIPA.Response<Boolean>>;
|
|
39
|
+
/**
|
|
40
|
+
* 删除图集
|
|
41
|
+
*/
|
|
42
|
+
dropGraph(graphName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
43
|
+
/**
|
|
44
|
+
* 更新图集,目前只支持图集名称修改
|
|
45
|
+
*/
|
|
46
|
+
alterGraph(oldGraph: ULTIPA.GraphSet, newGraph: ULTIPA.GraphSet, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
47
|
+
/**
|
|
48
|
+
* 碎片整理
|
|
49
|
+
*/
|
|
50
|
+
compact(graphName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
51
|
+
/**
|
|
52
|
+
* 创建HDCGraph
|
|
53
|
+
* @param graphName
|
|
54
|
+
* @param nodeSchemas
|
|
55
|
+
* @param edgeSchemas
|
|
56
|
+
* @param hdcName
|
|
57
|
+
* @param update
|
|
58
|
+
* @param requestConfig
|
|
59
|
+
*/
|
|
60
|
+
createHDCGraphBySchema(graphName: string, nodeSchemas: {
|
|
61
|
+
[x: string]: string[];
|
|
62
|
+
}, edgeSchemas: {
|
|
63
|
+
[x: string]: string[];
|
|
64
|
+
}, hdcName: string, update: RequestParamType.UPDATE, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
65
|
+
/**
|
|
66
|
+
* 获取HDCGraph信息
|
|
67
|
+
* @param requestConfig
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
showHDCGraph(graphName?: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.HDCGraph[]>>;
|
|
71
|
+
/**
|
|
72
|
+
* 删除HDCGraph
|
|
73
|
+
* @param graphName
|
|
74
|
+
* @param requestConfig
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
dropHDCGraph(graphName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
78
|
+
/**
|
|
79
|
+
* 迁移图集
|
|
80
|
+
* @param name
|
|
81
|
+
* @param shards
|
|
82
|
+
* @param requestConfig
|
|
83
|
+
*/
|
|
84
|
+
rebalanceGraph(name: string, shards: string[], requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
85
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphExra = void 0;
|
|
16
|
+
const connection_base_1 = require("./connection.base");
|
|
17
|
+
const utils_1 = require("../../utils");
|
|
18
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
19
|
+
const CommandList = utils_1.UQLMAKER.CommandList;
|
|
20
|
+
const KEY_REPLACE = {
|
|
21
|
+
"graph": "name"
|
|
22
|
+
};
|
|
23
|
+
class GraphExra extends connection_base_1.ConnectionBase {
|
|
24
|
+
/**
|
|
25
|
+
* 查看图集列表
|
|
26
|
+
* @deprecated Use `showGraph`
|
|
27
|
+
*/
|
|
28
|
+
listGraph(requestConfig) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return this.showGraph(requestConfig);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 查看图集列表
|
|
35
|
+
* @example client.showGraph(requestConfig)
|
|
36
|
+
*/
|
|
37
|
+
showGraph(requestConfig) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
let command = CommandList.showGraph;
|
|
40
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig);
|
|
41
|
+
return connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker, {
|
|
42
|
+
keyReplace: KEY_REPLACE
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 查看图集列表
|
|
48
|
+
*/
|
|
49
|
+
showGraphMore(requestConfig) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
let command = CommandList.showGraph;
|
|
52
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig);
|
|
53
|
+
uqlMaker.addEmptyParam("more", true);
|
|
54
|
+
return connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker, {
|
|
55
|
+
keyReplace: KEY_REPLACE
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 获取图集信息
|
|
61
|
+
*/
|
|
62
|
+
getGraph(graphName, requestConfig) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
let command = CommandList.getGraph;
|
|
65
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, graphName);
|
|
66
|
+
return connection_base_1.ConnectionBase.UqlGetSimple(this, uqlMaker, {
|
|
67
|
+
keyReplace: KEY_REPLACE
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 图集是否存在
|
|
73
|
+
*/
|
|
74
|
+
hasGraph(graphName, requestConfig) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
let res = yield this.getGraph(graphName, requestConfig);
|
|
77
|
+
return Object.assign(Object.assign({}, res), { data: !lodash_1.default.isEmpty(res.data) });
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 创建图集
|
|
82
|
+
*/
|
|
83
|
+
// async createGraph(req: RequestType.GraphCreate, config?: RequestType.RequestConfig) {
|
|
84
|
+
createGraph(graph, shards, partitionByHash, config) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
let req = {
|
|
87
|
+
name: graph.name,
|
|
88
|
+
desc: graph === null || graph === void 0 ? void 0 : graph.description,
|
|
89
|
+
shards: shards.map(i => parseInt(i)),
|
|
90
|
+
partitionByHash: partitionByHash
|
|
91
|
+
};
|
|
92
|
+
let command = CommandList.createGraph;
|
|
93
|
+
let uqlMaker = new utils_1.UQLMAKER(command, config, [req.name, req.desc || ""]);
|
|
94
|
+
if (!req.partitionByHash) {
|
|
95
|
+
req.partitionByHash = {};
|
|
96
|
+
}
|
|
97
|
+
if (!req.partitionByHash.name) {
|
|
98
|
+
req.partitionByHash.name = "CityHash64";
|
|
99
|
+
}
|
|
100
|
+
if (!req.partitionByHash.by) {
|
|
101
|
+
req.partitionByHash.by = "_id";
|
|
102
|
+
}
|
|
103
|
+
uqlMaker.addParam("shards", req.shards);
|
|
104
|
+
uqlMaker.addParam("partitionByHash", utils_1.UQLMAKER.VariableString(`${JSON.stringify(req.partitionByHash.name)}, ${req.partitionByHash.by}`));
|
|
105
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 图集不存在时创建图集
|
|
110
|
+
* @param graph
|
|
111
|
+
* @param shards
|
|
112
|
+
* @param partitionByHash
|
|
113
|
+
* @param config
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
createGraphIfNotExit(graph, shards, partitionByHash, config) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
let isGraphExit = yield this.hasGraph(graph.name, config);
|
|
119
|
+
if (isGraphExit.data) {
|
|
120
|
+
return {
|
|
121
|
+
status: utils_1.FormatResponse.successStatus(),
|
|
122
|
+
statistics: utils_1.FormatResponse.statisticsSum(),
|
|
123
|
+
data: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
let res = yield this.createGraph(graph, shards, partitionByHash, config);
|
|
127
|
+
return Object.assign(Object.assign({}, res), { data: false });
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 删除图集
|
|
132
|
+
*/
|
|
133
|
+
dropGraph(graphName, requestConfig) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
let command = CommandList.dropGraph;
|
|
136
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, graphName);
|
|
137
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 更新图集,目前只支持图集名称修改
|
|
142
|
+
*/
|
|
143
|
+
alterGraph(oldGraph, newGraph, requestConfig) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
let req = {
|
|
146
|
+
oldGraphSetName: oldGraph.name,
|
|
147
|
+
newGraphSetName: newGraph.name,
|
|
148
|
+
newDesc: newGraph.description
|
|
149
|
+
};
|
|
150
|
+
let command = CommandList.updateGraph;
|
|
151
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, req.oldGraphSetName);
|
|
152
|
+
let set = {};
|
|
153
|
+
if (req.newGraphSetName) {
|
|
154
|
+
set.name = req.newGraphSetName;
|
|
155
|
+
}
|
|
156
|
+
if ((0, utils_1.isNotNullString)(req.newDesc)) {
|
|
157
|
+
set.description = req.newDesc;
|
|
158
|
+
}
|
|
159
|
+
uqlMaker.addParam("set", set);
|
|
160
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 碎片整理
|
|
165
|
+
*/
|
|
166
|
+
compact(graphName, requestConfig) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
let command = CommandList.compact;
|
|
169
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, graphName);
|
|
170
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* 创建HDCGraph
|
|
175
|
+
* @param graphName
|
|
176
|
+
* @param nodeSchemas
|
|
177
|
+
* @param edgeSchemas
|
|
178
|
+
* @param hdcName
|
|
179
|
+
* @param update
|
|
180
|
+
* @param requestConfig
|
|
181
|
+
*/
|
|
182
|
+
createHDCGraphBySchema(graphName, nodeSchemas, edgeSchemas, hdcName, update, requestConfig) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
let command = CommandList.createHDCGraph;
|
|
185
|
+
let req = {
|
|
186
|
+
nodes: nodeSchemas,
|
|
187
|
+
edges: edgeSchemas,
|
|
188
|
+
query: "query",
|
|
189
|
+
type: "Graph",
|
|
190
|
+
update: update,
|
|
191
|
+
default: true
|
|
192
|
+
};
|
|
193
|
+
let commandP = [graphName, req];
|
|
194
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, commandP);
|
|
195
|
+
uqlMaker.addParam("to", hdcName);
|
|
196
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 获取HDCGraph信息
|
|
201
|
+
* @param requestConfig
|
|
202
|
+
* @returns
|
|
203
|
+
*/
|
|
204
|
+
showHDCGraph(graphName, requestConfig) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
let command = CommandList.showHDCGraph;
|
|
207
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, graphName);
|
|
208
|
+
return connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* 删除HDCGraph
|
|
213
|
+
* @param graphName
|
|
214
|
+
* @param requestConfig
|
|
215
|
+
* @returns
|
|
216
|
+
*/
|
|
217
|
+
dropHDCGraph(graphName, requestConfig) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
let command = CommandList.dropHDCGraph;
|
|
220
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, graphName);
|
|
221
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
//alter().graph('test2').shards([1,2])
|
|
225
|
+
/**
|
|
226
|
+
* 迁移图集
|
|
227
|
+
* @param name
|
|
228
|
+
* @param shards
|
|
229
|
+
* @param requestConfig
|
|
230
|
+
*/
|
|
231
|
+
rebalanceGraph(name, shards, requestConfig) {
|
|
232
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
let command = CommandList.rebalanceGraph;
|
|
234
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, name);
|
|
235
|
+
uqlMaker.addParam('shards', shards);
|
|
236
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
exports.GraphExra = GraphExra;
|
|
241
|
+
//# sourceMappingURL=graph.extra.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.extra.js","sourceRoot":"","sources":["../../../src/connection/extra/graph.extra.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAAgD;AAEhD,uCAAoF;AAEpF,oDAAsB;AAEtB,MAAM,WAAW,GAAG,gBAAQ,CAAC,WAAW,CAAA;AAExC,MAAM,WAAW,GAAG;IAChB,OAAO,EAAE,MAAM;CAClB,CAAA;AAED,MAAa,SAAU,SAAQ,gCAAc;IACzC;;;OAGG;IACG,SAAS,CAAC,aAAyC;;YACrD,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;QACxC,CAAC;KAAA;IACD;;;OAGG;IACG,SAAS,CAAC,aAAyC;;YACrD,IAAI,OAAO,GAAG,WAAW,CAAC,SAAS,CAAA;YACnC,IAAI,QAAQ,GAAG,IAAI,gBAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;YACnD,OAAO,gCAAc,CAAC,aAAa,CAAwB,IAAI,EAAE,QAAQ,EAAE;gBACvE,UAAU,EAAE,WAAW;aAC1B,CAAC,CAAA;QACN,CAAC;KAAA;IAED;;OAEG;IACG,aAAa,CAAC,aAAyC;;YACzD,IAAI,OAAO,GAAG,WAAW,CAAC,SAAS,CAAA;YACnC,IAAI,QAAQ,GAAG,IAAI,gBAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;YACnD,QAAQ,CAAC,aAAa,CAAE,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AAS,CAAC,CAAA;YAC9D,OAAO,gCAAc,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACzD,CAAC;KAAA;IAGD,sCAAsC;IACtC;;;;;OAKG;IACG,cAAc,CAAC,IAAY,EAAE,MAAgB,EAAE,aAAyC;;YAC1F,IAAI,OAAO,GAAG,WAAW,CAAC,cAAc,CAAA;YACxC,IAAI,QAAQ,GAAG,IAAI,gBAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;YACzD,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YACnC,OAAO,gCAAc,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;QACzD,CAAC;KAAA;CACJ;AA7MD,8BA6MC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ConnectionBase } from "./connection.base";
|
|
2
|
+
import { RequestType, ULTIPA, ResponseType } from "../../types";
|
|
3
|
+
export declare class IndexExtra extends ConnectionBase {
|
|
4
|
+
/**
|
|
5
|
+
* 查看索引列表
|
|
6
|
+
*/
|
|
7
|
+
showAllIndex(commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
8
|
+
/**
|
|
9
|
+
* 查看点或者边的索引列表
|
|
10
|
+
*/
|
|
11
|
+
private showNodeOrEdgeIndex;
|
|
12
|
+
/**
|
|
13
|
+
* 查看点的索引列表
|
|
14
|
+
*/
|
|
15
|
+
showNodeIndex(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
16
|
+
/**
|
|
17
|
+
* 查看边的索引列表
|
|
18
|
+
*/
|
|
19
|
+
showEdgeIndex(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
20
|
+
/**
|
|
21
|
+
* 删除点或者边的索引
|
|
22
|
+
*/
|
|
23
|
+
dropIndex(dbType: ULTIPA.DBType, schemaName?: string, propertyName?: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
24
|
+
/**
|
|
25
|
+
* 创建点或者边的索引
|
|
26
|
+
*/
|
|
27
|
+
createIndex(dbType: ULTIPA.DBType, schemaName?: string, propertyName?: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
28
|
+
/**
|
|
29
|
+
* 创建点属性索引
|
|
30
|
+
* @param source
|
|
31
|
+
* @param indexName
|
|
32
|
+
* @param requestConfig
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
createNodeIndex(source: string, indexName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<unknown>>;
|
|
36
|
+
/**
|
|
37
|
+
* 创建边属性索引
|
|
38
|
+
* @param source
|
|
39
|
+
* @param indexName
|
|
40
|
+
* @param requestConfig
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
createEdgeIndex(source: string, indexName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<unknown>>;
|
|
44
|
+
/**
|
|
45
|
+
* 查看全文索引
|
|
46
|
+
*/
|
|
47
|
+
private showFulltextBase;
|
|
48
|
+
/**
|
|
49
|
+
* 查看全文索引列表
|
|
50
|
+
*/
|
|
51
|
+
showFulltext(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
52
|
+
/**
|
|
53
|
+
* 查看点全文索引列表
|
|
54
|
+
* @param commonReq
|
|
55
|
+
*/
|
|
56
|
+
showNodeFulltext(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
57
|
+
/**
|
|
58
|
+
* 查看边全文索引列表
|
|
59
|
+
* @param commonReq
|
|
60
|
+
*/
|
|
61
|
+
showEdgeFulltext(requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.Index[]>>;
|
|
62
|
+
/**
|
|
63
|
+
* 创建全文索引
|
|
64
|
+
*/
|
|
65
|
+
createFulltext(dbType: ULTIPA.DBType, schemaName: string, propertyName: string, fulltextName: string, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
66
|
+
/**
|
|
67
|
+
* 删除全文索引
|
|
68
|
+
*/
|
|
69
|
+
dropFulltext(fulltextName: string, dbType: ULTIPA.DBType, requestConfig?: RequestType.RequestConfig): Promise<ULTIPA.Response<null>>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.IndexExtra = void 0;
|
|
13
|
+
const connection_base_1 = require("./connection.base");
|
|
14
|
+
const types_1 = require("../../types");
|
|
15
|
+
const utils_1 = require("../../utils");
|
|
16
|
+
const { CommandList, SchemaStringWithDefault } = utils_1.UQLMAKER;
|
|
17
|
+
class IndexExtra extends connection_base_1.ConnectionBase {
|
|
18
|
+
/**
|
|
19
|
+
* 查看索引列表
|
|
20
|
+
*/
|
|
21
|
+
showAllIndex(commonReq) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
let command = CommandList.showIndex;
|
|
24
|
+
let uqlMaker = new utils_1.UQLMAKER(command, commonReq);
|
|
25
|
+
let res = yield this.uqlSingle(uqlMaker);
|
|
26
|
+
let data = {};
|
|
27
|
+
res.QueryReply.datas.forEach((v) => {
|
|
28
|
+
if (!v) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let t = v.asTable();
|
|
32
|
+
data[t.name] = t.toKV();
|
|
33
|
+
});
|
|
34
|
+
return Object.assign(Object.assign({}, res.responseWithoutData), { data: data });
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 查看点或者边的索引列表
|
|
39
|
+
*/
|
|
40
|
+
showNodeOrEdgeIndex(dbType, commonReq) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
let command = dbType === types_1.ULTIPA.DBType.DBNODE
|
|
43
|
+
? CommandList.showNodeIndex
|
|
44
|
+
: CommandList.showEdgeIndex;
|
|
45
|
+
let uqlMaker = new utils_1.UQLMAKER(command, commonReq);
|
|
46
|
+
let res = connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker);
|
|
47
|
+
return res;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 查看点的索引列表
|
|
52
|
+
*/
|
|
53
|
+
showNodeIndex(requestConfig) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
return this.showNodeOrEdgeIndex(types_1.ULTIPA.DBType.DBNODE, requestConfig);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 查看边的索引列表
|
|
60
|
+
*/
|
|
61
|
+
showEdgeIndex(requestConfig) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return this.showNodeOrEdgeIndex(types_1.ULTIPA.DBType.DBEDGE, requestConfig);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 删除点或者边的索引
|
|
68
|
+
*/
|
|
69
|
+
dropIndex(dbType, schemaName, propertyName, requestConfig) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
let command = dbType === types_1.ULTIPA.DBType.DBNODE
|
|
72
|
+
? CommandList.dropNodeIndex
|
|
73
|
+
: CommandList.dropEdgeIndex;
|
|
74
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, SchemaStringWithDefault(schemaName, propertyName));
|
|
75
|
+
let res = connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker);
|
|
76
|
+
return res;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 创建点或者边的索引
|
|
81
|
+
*/
|
|
82
|
+
createIndex(
|
|
83
|
+
// req: RequestType.CreateIndex,
|
|
84
|
+
dbType, schemaName, propertyName, requestConfig) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
let command = dbType === types_1.ULTIPA.DBType.DBNODE
|
|
87
|
+
? CommandList.createNodeIndex
|
|
88
|
+
: CommandList.createEdgeIndex;
|
|
89
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, SchemaStringWithDefault(schemaName, propertyName));
|
|
90
|
+
let res = connection_base_1.ConnectionBase.UqlListSimple(this, uqlMaker);
|
|
91
|
+
return res;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 创建点属性索引
|
|
96
|
+
* @param source
|
|
97
|
+
* @param indexName
|
|
98
|
+
* @param requestConfig
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
createNodeIndex(source, indexName, requestConfig) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
let command = CommandList.createNodeIndex;
|
|
104
|
+
let commandParams = [source, indexName];
|
|
105
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, commandParams);
|
|
106
|
+
return connection_base_1.ConnectionBase.UqlGetSimple(this, uqlMaker);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 创建边属性索引
|
|
111
|
+
* @param source
|
|
112
|
+
* @param indexName
|
|
113
|
+
* @param requestConfig
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
|
+
createEdgeIndex(source, indexName, requestConfig) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
let command = CommandList.createEdgeIndex;
|
|
119
|
+
let commandParams = [source, indexName];
|
|
120
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, commandParams);
|
|
121
|
+
return connection_base_1.ConnectionBase.UqlGetSimple(this, uqlMaker);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 查看全文索引
|
|
126
|
+
*/
|
|
127
|
+
showFulltextBase(dbType, requestConfig) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
let command = CommandList.showFulltext;
|
|
130
|
+
if (dbType === types_1.ULTIPA.DBType.DBNODE) {
|
|
131
|
+
command = CommandList.showNodeFulltext;
|
|
132
|
+
}
|
|
133
|
+
else if (dbType === types_1.ULTIPA.DBType.DBEDGE) {
|
|
134
|
+
command = CommandList.showEdgeFulltext;
|
|
135
|
+
}
|
|
136
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig);
|
|
137
|
+
let res = yield this.uqlSingle(uqlMaker);
|
|
138
|
+
let data = {};
|
|
139
|
+
res.QueryReply.datas.forEach((v) => {
|
|
140
|
+
if (!v) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
let t = v.asTable();
|
|
144
|
+
data[t.name] = t.toKV();
|
|
145
|
+
});
|
|
146
|
+
return Object.assign(Object.assign({}, res.responseWithoutData), { data: data });
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 查看全文索引列表
|
|
151
|
+
*/
|
|
152
|
+
showFulltext(requestConfig) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
return this.showFulltextBase(null, requestConfig);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 查看点全文索引列表
|
|
159
|
+
* @param commonReq
|
|
160
|
+
*/
|
|
161
|
+
showNodeFulltext(requestConfig) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
return this.showFulltextBase(types_1.ULTIPA.DBType.DBNODE, requestConfig);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* 查看边全文索引列表
|
|
168
|
+
* @param commonReq
|
|
169
|
+
*/
|
|
170
|
+
showEdgeFulltext(requestConfig) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
return this.showFulltextBase(types_1.ULTIPA.DBType.DBEDGE, requestConfig);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 创建全文索引
|
|
177
|
+
*/
|
|
178
|
+
createFulltext(dbType, schemaName, propertyName, fulltextName, requestConfig) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
let command = dbType === types_1.ULTIPA.DBType.DBNODE
|
|
181
|
+
? CommandList.createNodeFulltext
|
|
182
|
+
: CommandList.createEdgeFulltext;
|
|
183
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, [SchemaStringWithDefault(schemaName, propertyName), fulltextName,]);
|
|
184
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 删除全文索引
|
|
189
|
+
*/
|
|
190
|
+
dropFulltext(fulltextName, dbType, requestConfig) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
let command = dbType === types_1.ULTIPA.DBType.DBNODE
|
|
193
|
+
? CommandList.dropNodeFulltext
|
|
194
|
+
: CommandList.dropEdgeFulltext;
|
|
195
|
+
let uqlMaker = new utils_1.UQLMAKER(command, requestConfig, fulltextName);
|
|
196
|
+
return connection_base_1.ConnectionBase.UqlUpdateSimple(this, uqlMaker);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.IndexExtra = IndexExtra;
|
|
201
|
+
//# sourceMappingURL=index.extra.js.map
|