@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,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EasyUqlParse = exports.EasyUqlItem = void 0;
|
|
4
|
+
const uql_maker_1 = require("./uql-maker");
|
|
5
|
+
let { CommandList } = uql_maker_1.UQLMAKER;
|
|
6
|
+
const WriteCommands = [
|
|
7
|
+
"alter",
|
|
8
|
+
"create",
|
|
9
|
+
"drop",
|
|
10
|
+
"grant",
|
|
11
|
+
"revoke",
|
|
12
|
+
"LTE",
|
|
13
|
+
"UFE",
|
|
14
|
+
"truncate",
|
|
15
|
+
"compact",
|
|
16
|
+
"insert",
|
|
17
|
+
"upsert",
|
|
18
|
+
"update",
|
|
19
|
+
"delete",
|
|
20
|
+
"clear",
|
|
21
|
+
"stop",
|
|
22
|
+
"pause",
|
|
23
|
+
"resume",
|
|
24
|
+
"top",
|
|
25
|
+
"kill",
|
|
26
|
+
CommandList.unmount,
|
|
27
|
+
CommandList.mount,
|
|
28
|
+
];
|
|
29
|
+
const GLOBALCommands = [
|
|
30
|
+
CommandList.showUser,
|
|
31
|
+
CommandList.getUser,
|
|
32
|
+
CommandList.createUser,
|
|
33
|
+
CommandList.alterUser,
|
|
34
|
+
CommandList.dropUser,
|
|
35
|
+
CommandList.grantUser,
|
|
36
|
+
CommandList.revokeUser,
|
|
37
|
+
CommandList.showPolicy,
|
|
38
|
+
CommandList.getPolicy,
|
|
39
|
+
CommandList.createPolicy,
|
|
40
|
+
CommandList.alterPolicy,
|
|
41
|
+
CommandList.dropPolicy,
|
|
42
|
+
CommandList.showPrivilege,
|
|
43
|
+
CommandList.stats,
|
|
44
|
+
CommandList.showGraph,
|
|
45
|
+
CommandList.getGraph,
|
|
46
|
+
CommandList.createGraph,
|
|
47
|
+
CommandList.dropGraph,
|
|
48
|
+
CommandList.updateGraph,
|
|
49
|
+
CommandList.top,
|
|
50
|
+
CommandList.kill,
|
|
51
|
+
// CommandList.unmount,
|
|
52
|
+
// CommandList.mount,
|
|
53
|
+
];
|
|
54
|
+
const ExtraCommands = [
|
|
55
|
+
CommandList.top,
|
|
56
|
+
CommandList.kill,
|
|
57
|
+
CommandList.showTask,
|
|
58
|
+
CommandList.stopTask,
|
|
59
|
+
CommandList.clearTask,
|
|
60
|
+
CommandList.stats,
|
|
61
|
+
CommandList.showGraph,
|
|
62
|
+
CommandList.listAlgo,
|
|
63
|
+
CommandList.getGraph,
|
|
64
|
+
CommandList.createPolicy,
|
|
65
|
+
CommandList.alterPolicy,
|
|
66
|
+
CommandList.showPolicy,
|
|
67
|
+
CommandList.getPolicy,
|
|
68
|
+
CommandList.grantUser,
|
|
69
|
+
CommandList.revokeUser,
|
|
70
|
+
CommandList.showPrivilege,
|
|
71
|
+
CommandList.getUser,
|
|
72
|
+
CommandList.getSelfInfo,
|
|
73
|
+
CommandList.createUser,
|
|
74
|
+
CommandList.alterUser,
|
|
75
|
+
CommandList.dropUser,
|
|
76
|
+
CommandList.showIndex,
|
|
77
|
+
];
|
|
78
|
+
class EasyUqlItem {
|
|
79
|
+
constructor(name, params) {
|
|
80
|
+
this.name = name;
|
|
81
|
+
this.params = params;
|
|
82
|
+
}
|
|
83
|
+
getListParams() {
|
|
84
|
+
let ps = [];
|
|
85
|
+
let str = this.params.trim();
|
|
86
|
+
if (str === "") {
|
|
87
|
+
return ps;
|
|
88
|
+
}
|
|
89
|
+
if (!str.startsWith("}")) {
|
|
90
|
+
let ss = str.split(",");
|
|
91
|
+
ss.forEach((p) => {
|
|
92
|
+
ps.push(p.replace(/^[ |"|']+/g, "").replace(/[ |"|']+$/g, ""));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
ps.push(str);
|
|
97
|
+
}
|
|
98
|
+
return ps;
|
|
99
|
+
}
|
|
100
|
+
safelyGetFirstParams() {
|
|
101
|
+
let ps = this.getListParams();
|
|
102
|
+
if (ps.length > 0) {
|
|
103
|
+
return ps[0];
|
|
104
|
+
}
|
|
105
|
+
return "";
|
|
106
|
+
}
|
|
107
|
+
isEmptyParams() {
|
|
108
|
+
return this.params.trim() === "";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.EasyUqlItem = EasyUqlItem;
|
|
112
|
+
class EasyUqlParse {
|
|
113
|
+
constructor(uql) {
|
|
114
|
+
this.uql = uql;
|
|
115
|
+
this.commands = [];
|
|
116
|
+
this.parse(this.uql);
|
|
117
|
+
}
|
|
118
|
+
parse(uqlStr) {
|
|
119
|
+
var _a;
|
|
120
|
+
if (!uqlStr) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
let commandReg = /([a-z_A-Z]*)\(([^\(|^\)]*)\)/g;
|
|
124
|
+
let matchAll = uqlStr.matchAll(commandReg);
|
|
125
|
+
for (const m of matchAll) {
|
|
126
|
+
// console.log(m)
|
|
127
|
+
let name = m[1];
|
|
128
|
+
let value = m[2] || "";
|
|
129
|
+
value = value.trim();
|
|
130
|
+
this.commands.push(new EasyUqlItem(name, value));
|
|
131
|
+
}
|
|
132
|
+
let limits = uqlStr.split("limit ");
|
|
133
|
+
this.limit = (_a = limits === null || limits === void 0 ? void 0 : limits[1]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
134
|
+
}
|
|
135
|
+
commandsEqual(commands) {
|
|
136
|
+
var parseCommands = [];
|
|
137
|
+
commands.forEach((_, i) => {
|
|
138
|
+
let name = "";
|
|
139
|
+
let c = this.getCommand(i);
|
|
140
|
+
if (c) {
|
|
141
|
+
name = c.name;
|
|
142
|
+
}
|
|
143
|
+
parseCommands.push(name);
|
|
144
|
+
});
|
|
145
|
+
return commands.join("|") == parseCommands.join("|");
|
|
146
|
+
}
|
|
147
|
+
getCommand(index) {
|
|
148
|
+
if (this.commands.length > index) {
|
|
149
|
+
return this.commands[index];
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
getLimit() {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
let limit = this.limit || ((_b = (_a = this.getCommandFirstOneWithName("limit")) === null || _a === void 0 ? void 0 : _a.getListParams()) === null || _b === void 0 ? void 0 : _b[0]);
|
|
156
|
+
return limit;
|
|
157
|
+
}
|
|
158
|
+
getCommandFirstOneWithName(name) {
|
|
159
|
+
for (let index = 0; index < this.commands.length; index++) {
|
|
160
|
+
const element = this.commands[index];
|
|
161
|
+
if (element.name == name) {
|
|
162
|
+
return element;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
firstCommandName() {
|
|
168
|
+
var _a;
|
|
169
|
+
return (_a = this.getCommand(0)) === null || _a === void 0 ? void 0 : _a.name;
|
|
170
|
+
}
|
|
171
|
+
secondCommandName() {
|
|
172
|
+
var _a;
|
|
173
|
+
return (_a = this.getCommand(1)) === null || _a === void 0 ? void 0 : _a.name;
|
|
174
|
+
}
|
|
175
|
+
hasWith() {
|
|
176
|
+
var _a;
|
|
177
|
+
return ((_a = this.uql) === null || _a === void 0 ? void 0 : _a.toLowerCase().split("with").length) > 1;
|
|
178
|
+
}
|
|
179
|
+
hasWrite() {
|
|
180
|
+
for (const c of this.commands) {
|
|
181
|
+
if (WriteCommands.includes(c.name)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
hasAlgo() {
|
|
188
|
+
return this.firstCommandName() == "algo";
|
|
189
|
+
}
|
|
190
|
+
hasExecTask() {
|
|
191
|
+
var _a;
|
|
192
|
+
return (_a = this.uql) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes("exec task");
|
|
193
|
+
}
|
|
194
|
+
isGlobal() {
|
|
195
|
+
let c1 = this.firstCommandName();
|
|
196
|
+
let c2 = `${this.firstCommandName()}().${this.secondCommandName()}`;
|
|
197
|
+
return GLOBALCommands.includes(c1) || GLOBALCommands.includes(c2);
|
|
198
|
+
}
|
|
199
|
+
isExtra() {
|
|
200
|
+
let c1 = this.firstCommandName();
|
|
201
|
+
let c2 = `${this.firstCommandName()}().${this.secondCommandName()}`;
|
|
202
|
+
return ExtraCommands.includes(c1) || ExtraCommands.includes(c2);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.EasyUqlParse = EasyUqlParse;
|
|
206
|
+
//# sourceMappingURL=uql.parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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5.0",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ultipa",
|
|
7
|
+
"graph database",
|
|
8
|
+
"UQL",
|
|
9
|
+
"GQL",
|
|
10
|
+
"SDK",
|
|
11
|
+
"driver"
|
|
12
|
+
],
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"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"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git@repo.ultipa.com:SDKS/ultipa-node-sdk.git"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/**/*"
|
|
31
|
+
],
|
|
32
|
+
"author": "jiansong ZHANG",
|
|
33
|
+
"license": "ISC",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@grpc/grpc-js": "1.10.1",
|
|
36
|
+
"bluebird": "^3.7.2",
|
|
37
|
+
"chalk": "^3.0.0",
|
|
38
|
+
"fs-extra": "^9.1.0",
|
|
39
|
+
"grpc-tools": "1.11.3",
|
|
40
|
+
"lodash": "^4.17.15",
|
|
41
|
+
"md5": "^2.3.0",
|
|
42
|
+
"moment-timezone": "^0.5.33",
|
|
43
|
+
"print-tree": "^0.1.5",
|
|
44
|
+
"ts-protoc-gen": "^0.15.0",
|
|
45
|
+
"typescript": "^4.8.4"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/bluebird": "^3.5.30",
|
|
49
|
+
"@types/chai": "^4.2.9",
|
|
50
|
+
"@types/fs-extra": "^9.0.13",
|
|
51
|
+
"@types/lodash": "^4.14.150",
|
|
52
|
+
"@types/mocha": "^10.0.7",
|
|
53
|
+
"@types/moment-timezone": "^0.5.30",
|
|
54
|
+
"@types/node": "^13.13.2",
|
|
55
|
+
"chai": "^4.2.0",
|
|
56
|
+
"grpc_tools_node_protoc_ts": "^5.3.2",
|
|
57
|
+
"mocha": "^7.2.0",
|
|
58
|
+
"mochawesome": "^6.1.1",
|
|
59
|
+
"nyc": "^15.0.0",
|
|
60
|
+
"ts-node": "^8.6.2"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Ultipa NodeJS SDK
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
This Nodejs SDK is a part of Ultipa Drivers, a set of specifications for developing software and applications using Java, Python, Go and NodeJs. This SDK provides instructions on introducing query and management operations of Ultipa Graph Database into Nodejs programs, both by calling command through interfaces and sending assembled UQLs to an Ultipa server. A basic understanding of UQL query commands and the returned data structures is needed to guarantee a proper usage of the SDK.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ultipa-graph/ultipa-driver
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Document
|
|
14
|
+
|
|
15
|
+
Please refer to https://www.ultipa.com/document/ultipa-drivers/nodejs-installation/v5.0 for details.
|
|
16
|
+
|
|
17
|
+
If you have any questions please contact: [Ultipa Support](mailto:support@ultipa.com)
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### ConnectionPool
|
|
22
|
+
|
|
23
|
+
`ConnectionPool` defines the information of connection pool needed when connecting to an Ultipa graph database.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { ConnectionPool } from "@ultipa-graph/ultipa-driver";
|
|
27
|
+
|
|
28
|
+
let sdkUsage = async () => {
|
|
29
|
+
|
|
30
|
+
let hosts = [
|
|
31
|
+
"192.168.1.1:60061",
|
|
32
|
+
"192.168.1.2:60061",
|
|
33
|
+
"192.168.1.3:60061"
|
|
34
|
+
];
|
|
35
|
+
let username = "***";
|
|
36
|
+
let password = "***";
|
|
37
|
+
|
|
38
|
+
let connPool = new ConnectionPool(hosts, username, password);
|
|
39
|
+
|
|
40
|
+
let conn = await connPool.getActive();
|
|
41
|
+
let isSuccess = await conn.test();
|
|
42
|
+
console.log(isSuccess);
|
|
43
|
+
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
sdkUsage().then(console.log).catch(console.log);
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
### Send UQL
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { ConnectionPool } from "@ultipa-graph/ultipa-driver";
|
|
53
|
+
|
|
54
|
+
let sdkUsage = async () => {
|
|
55
|
+
|
|
56
|
+
// omit code of establishing server connection 'conn'
|
|
57
|
+
|
|
58
|
+
let resp = await conn.uql("show().graph()");
|
|
59
|
+
console.log(resp);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
sdkUsage();
|
|
63
|
+
```
|