terminusdb 12.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/Contributing.md +36 -0
  2. package/LICENSE +201 -0
  3. package/README.md +175 -0
  4. package/RELEASE_NOTES.md +462 -0
  5. package/dist/index.html +22 -0
  6. package/dist/terminusdb-client.min.js +3 -0
  7. package/dist/terminusdb-client.min.js.LICENSE.txt +188 -0
  8. package/dist/terminusdb-client.min.js.map +1 -0
  9. package/dist/typescript/index.d.ts +14 -0
  10. package/dist/typescript/lib/accessControl.d.ts +554 -0
  11. package/dist/typescript/lib/axiosInstance.d.ts +2 -0
  12. package/dist/typescript/lib/connectionConfig.d.ts +381 -0
  13. package/dist/typescript/lib/const.d.ts +54 -0
  14. package/dist/typescript/lib/dispatchRequest.d.ts +17 -0
  15. package/dist/typescript/lib/errorMessage.d.ts +25 -0
  16. package/dist/typescript/lib/query/woqlBuilder.d.ts +75 -0
  17. package/dist/typescript/lib/query/woqlCore.d.ts +341 -0
  18. package/dist/typescript/lib/query/woqlDoc.d.ts +63 -0
  19. package/dist/typescript/lib/query/woqlLibrary.d.ts +718 -0
  20. package/dist/typescript/lib/query/woqlPrinter.d.ts +71 -0
  21. package/dist/typescript/lib/query/woqlQuery.d.ts +833 -0
  22. package/dist/typescript/lib/typedef.d.ts +624 -0
  23. package/dist/typescript/lib/utils.d.ts +199 -0
  24. package/dist/typescript/lib/valueHash.d.ts +146 -0
  25. package/dist/typescript/lib/viewer/chartConfig.d.ts +62 -0
  26. package/dist/typescript/lib/viewer/chooserConfig.d.ts +38 -0
  27. package/dist/typescript/lib/viewer/documentFrame.d.ts +44 -0
  28. package/dist/typescript/lib/viewer/frameConfig.d.ts +74 -0
  29. package/dist/typescript/lib/viewer/frameRule.d.ts +145 -0
  30. package/dist/typescript/lib/viewer/graphConfig.d.ts +73 -0
  31. package/dist/typescript/lib/viewer/objectFrame.d.ts +212 -0
  32. package/dist/typescript/lib/viewer/streamConfig.d.ts +23 -0
  33. package/dist/typescript/lib/viewer/tableConfig.d.ts +66 -0
  34. package/dist/typescript/lib/viewer/terminusRule.d.ts +75 -0
  35. package/dist/typescript/lib/viewer/viewConfig.d.ts +47 -0
  36. package/dist/typescript/lib/viewer/woqlChart.d.ts +1 -0
  37. package/dist/typescript/lib/viewer/woqlChooser.d.ts +56 -0
  38. package/dist/typescript/lib/viewer/woqlGraph.d.ts +26 -0
  39. package/dist/typescript/lib/viewer/woqlPaging.d.ts +1 -0
  40. package/dist/typescript/lib/viewer/woqlResult.d.ts +128 -0
  41. package/dist/typescript/lib/viewer/woqlRule.d.ts +96 -0
  42. package/dist/typescript/lib/viewer/woqlStream.d.ts +31 -0
  43. package/dist/typescript/lib/viewer/woqlTable.d.ts +102 -0
  44. package/dist/typescript/lib/viewer/woqlView.d.ts +49 -0
  45. package/dist/typescript/lib/woql.d.ts +1267 -0
  46. package/dist/typescript/lib/woqlClient.d.ts +1216 -0
  47. package/index.js +28 -0
  48. package/lib/.eslintrc +1 -0
  49. package/lib/accessControl.js +988 -0
  50. package/lib/axiosInstance.js +5 -0
  51. package/lib/connectionConfig.js +765 -0
  52. package/lib/const.js +59 -0
  53. package/lib/dispatchRequest.js +236 -0
  54. package/lib/errorMessage.js +110 -0
  55. package/lib/query/woqlBuilder.js +234 -0
  56. package/lib/query/woqlCore.js +934 -0
  57. package/lib/query/woqlDoc.js +177 -0
  58. package/lib/query/woqlLibrary.js +1015 -0
  59. package/lib/query/woqlPrinter.js +476 -0
  60. package/lib/query/woqlQuery.js +1865 -0
  61. package/lib/typedef.js +248 -0
  62. package/lib/utils.js +817 -0
  63. package/lib/valueHash.js_old +581 -0
  64. package/lib/viewer/chartConfig.js +411 -0
  65. package/lib/viewer/chooserConfig.js +234 -0
  66. package/lib/viewer/documentFrame.js +206 -0
  67. package/lib/viewer/frameConfig.js +469 -0
  68. package/lib/viewer/frameRule.js +519 -0
  69. package/lib/viewer/graphConfig.js +345 -0
  70. package/lib/viewer/objectFrame.js +1550 -0
  71. package/lib/viewer/streamConfig.js +82 -0
  72. package/lib/viewer/tableConfig.js +310 -0
  73. package/lib/viewer/terminusRule.js +196 -0
  74. package/lib/viewer/viewConfig.js +219 -0
  75. package/lib/viewer/woqlChart.js +17 -0
  76. package/lib/viewer/woqlChooser.js +171 -0
  77. package/lib/viewer/woqlGraph.js +295 -0
  78. package/lib/viewer/woqlPaging.js +148 -0
  79. package/lib/viewer/woqlResult.js +258 -0
  80. package/lib/viewer/woqlRule.js +312 -0
  81. package/lib/viewer/woqlStream.js +27 -0
  82. package/lib/viewer/woqlTable.js +332 -0
  83. package/lib/viewer/woqlView.js +107 -0
  84. package/lib/woql.js +1693 -0
  85. package/lib/woqlClient.js +2091 -0
  86. package/package.json +110 -0
@@ -0,0 +1,345 @@
1
+ /* eslint-disable block-scoped-var */
2
+ /* eslint-disable no-var */
3
+ /* eslint-disable vars-on-top */
4
+ /* eslint-disable no-plusplus */
5
+ /* eslint-disable no-use-before-define */
6
+ /* eslint-disable import/extensions */
7
+ const Config = require('./viewConfig.js');
8
+ const WOQLGraph = require('./woqlGraph.js');
9
+ const UTILS = require('../utils.js');
10
+
11
+ function WOQLGraphConfig() {
12
+ Config.ViewConfig.call(this);
13
+ this.type = 'graph';
14
+ }
15
+
16
+ Object.setPrototypeOf(WOQLGraphConfig.prototype, Config.ViewConfig.prototype);
17
+
18
+ WOQLGraphConfig.prototype.create = function (client) {
19
+ const wqt = new WOQLGraph(client, this);
20
+ return wqt;
21
+ };
22
+
23
+ WOQLGraphConfig.prototype.literals = function (v) {
24
+ if (typeof v !== 'undefined') {
25
+ this.show_literals = v;
26
+ return this;
27
+ }
28
+ return this.show_literals;
29
+ };
30
+
31
+ WOQLGraphConfig.prototype.source = function (v) {
32
+ if (v) {
33
+ // if(v.substring(0, 2) != "v:") v = "v:" + v;
34
+ this.source_variable = UTILS.removeNamespaceFromVariable(v);
35
+ return this;
36
+ }
37
+ return this.source_variable;
38
+ };
39
+
40
+ WOQLGraphConfig.prototype.fontfamily = function (v) {
41
+ if (typeof v !== 'undefined') {
42
+ this.fontfam = v;
43
+ return this;
44
+ }
45
+ // return 'Font Awesome 5 Free';
46
+ return this.fontfam;
47
+ };
48
+
49
+ WOQLGraphConfig.prototype.show_force = function (v) {
50
+ if (typeof v !== 'undefined') {
51
+ this.force = v;
52
+ return this;
53
+ }
54
+ return this.force;
55
+ };
56
+
57
+ WOQLGraphConfig.prototype.fix_nodes = function (v) {
58
+ if (typeof v !== 'undefined') {
59
+ this.fixed = v;
60
+ return this;
61
+ }
62
+ return this.fixed;
63
+ };
64
+
65
+ WOQLGraphConfig.prototype.explode_out = function (v) {
66
+ if (typeof v !== 'undefined') {
67
+ this.explode = v;
68
+ return this;
69
+ }
70
+ return this.explode;
71
+ };
72
+
73
+ WOQLGraphConfig.prototype.selected_grows = function (v) {
74
+ if (typeof v !== 'undefined') {
75
+ this.bigsel = v;
76
+ return this;
77
+ }
78
+ return this.bigsel;
79
+ };
80
+
81
+ /**
82
+ * no parameter get the graph width or
83
+ * set the graph width and return the WOQLGraphConfig
84
+ * @param {size} Number
85
+ */
86
+
87
+ WOQLGraphConfig.prototype.width = function (size) {
88
+ if (typeof size !== 'undefined') {
89
+ this.gwidth = size;
90
+ return this;
91
+ }
92
+ return this.gwidth;
93
+ };
94
+
95
+ /**
96
+ * no parameter get the graph height or
97
+ * set the graph height and return the WOQLGraphConfig
98
+ * @param {size} Number
99
+ */
100
+
101
+ WOQLGraphConfig.prototype.height = function (size) {
102
+ if (typeof size !== 'undefined') {
103
+ this.gheight = size;
104
+ return this;
105
+ }
106
+ return this.gheight;
107
+ };
108
+
109
+ /**
110
+ *
111
+ * @param {...any} edges
112
+ * @returns {any[][]}
113
+ */
114
+ WOQLGraphConfig.prototype.edges = function (...edges) {
115
+ if (edges && edges.length) {
116
+ const nedges = [];
117
+ for (let i = 0; i < edges.length; i++) {
118
+ nedges.push(UTILS.removeNamespacesFromVariables(edges[i]));
119
+ }
120
+ this.show_edges = nedges;
121
+ return this;
122
+ }
123
+ return this.show_edges;
124
+ };
125
+
126
+ WOQLGraphConfig.prototype.edge = function (source, target) {
127
+ const nr = new WOQLGraphRule().edge(source, target);
128
+ this.rules.push(nr);
129
+ return nr;
130
+ };
131
+
132
+ WOQLGraphConfig.prototype.node = function (...cols) {
133
+ const nr = new WOQLGraphRule();
134
+ if (cols && cols.length) {
135
+ nr.scope('node').setVariables(cols);
136
+ } else {
137
+ nr.scope('row');
138
+ }
139
+ this.rules.push(nr);
140
+ return nr;
141
+ };
142
+
143
+ WOQLGraphConfig.prototype.loadJSON = function (config, rules) {
144
+ const jr = [];
145
+ for (let i = 0; i < rules.length; i++) {
146
+ const nr = new WOQLGraphRule();
147
+ nr.json(rules[i]);
148
+ jr.push(nr);
149
+ }
150
+ this.rules = jr;
151
+ if (typeof config.literals !== 'undefined') {
152
+ this.literals(config.literals);
153
+ }
154
+ if (typeof config.source !== 'undefined') {
155
+ this.source(config.source);
156
+ }
157
+ if (typeof config.fontfamily !== 'undefined') {
158
+ this.fontfamily(config.fontfamily);
159
+ }
160
+ if (typeof config.show_force !== 'undefined') {
161
+ this.show_force(config.show_force);
162
+ }
163
+ if (typeof config.fix_nodes !== 'undefined') {
164
+ this.fix_nodes(config.fix_nodes);
165
+ }
166
+ if (typeof config.explode_out !== 'undefined') {
167
+ this.explode_out(config.explode_out);
168
+ }
169
+ if (typeof config.selected_grows !== 'undefined') {
170
+ this.selected_grows(config.selected_grows);
171
+ }
172
+ if (typeof config.width !== 'undefined') {
173
+ this.width(config.width);
174
+ }
175
+ if (typeof config.height !== 'undefined') {
176
+ this.height(config.height);
177
+ }
178
+ if (typeof config.edges !== 'undefined') {
179
+ this.edges(...config.edges);
180
+ }
181
+ };
182
+
183
+ WOQLGraphConfig.prototype.prettyPrint = function () {
184
+ let str = 'view = View.graph();\n';
185
+ if (typeof this.literals() !== 'undefined') {
186
+ str += `view.literals('${this.literals()}')\n`;
187
+ }
188
+ if (typeof this.source() !== 'undefined') {
189
+ str += `view.source('${UTILS.removeNamespaceFromVariable(this.source())}')\n`;
190
+ }
191
+ if (typeof this.fontfamily() !== 'undefined') {
192
+ str += `view.fontfamily('${this.fontfamily()}')\n`;
193
+ }
194
+ if (typeof this.show_force() !== 'undefined') {
195
+ str += `view.show_force('${this.show_force()}')\n`;
196
+ }
197
+ if (typeof this.fix_nodes() !== 'undefined') {
198
+ str += `view.fix_nodes('${this.fix_nodes()}')\n`;
199
+ }
200
+ if (typeof this.explode_out() !== 'undefined') {
201
+ str += `view.explode_out('${this.explode_out()}')\n`;
202
+ }
203
+ if (typeof this.selected_grows() !== 'undefined') {
204
+ str += `view.selected_grows('${this.selected_grows()}')\n`;
205
+ }
206
+ if (typeof this.width() !== 'undefined') {
207
+ str += `view.width('${this.width()}')\n`;
208
+ }
209
+ if (typeof this.height() !== 'undefined') {
210
+ str += `view.height('${this.height()}')\n`;
211
+ }
212
+ if (typeof this.edges() !== 'undefined') {
213
+ const nedges = this.edges();
214
+ const estrs = [];
215
+ for (var i = 0; i < nedges.length; i++) {
216
+ estrs.push(`['${nedges[i][0]}, ${nedges[i][1]}']`);
217
+ }
218
+ str += `view.edges('${estrs.join(', ')}')\n`;
219
+ }
220
+ // eslint-disable-next-line no-redeclare
221
+ for (var i = 0; i < this.rules.length; i++) {
222
+ const x = this.rules[i].prettyPrint();
223
+ if (x) str += `view.${x}\n`;
224
+ }
225
+ return str;
226
+ };
227
+
228
+ WOQLGraphConfig.prototype.json = function () {
229
+ const jr = [];
230
+ for (let i = 0; i < this.rules.length; i++) {
231
+ jr.push(this.rules[i].json());
232
+ }
233
+ const json = {};
234
+ if (typeof this.literals() !== 'undefined') {
235
+ json.literals = this.literals();
236
+ }
237
+ if (typeof this.source() !== 'undefined') {
238
+ json.source = this.source();
239
+ }
240
+ if (typeof this.fontfamily() !== 'undefined') {
241
+ json.fontfamily = this.fontfamily();
242
+ }
243
+ if (typeof this.show_force() !== 'undefined') {
244
+ json.show_force = this.show_force();
245
+ }
246
+ if (typeof this.fix_nodes() !== 'undefined') {
247
+ json.fix_nodes = this.fix_nodes();
248
+ }
249
+ if (typeof this.explode_out() !== 'undefined') {
250
+ json.explode_out = this.explode_out();
251
+ }
252
+ if (typeof this.selected_grows() !== 'undefined') {
253
+ json.selected_grows = this.selected_grows();
254
+ }
255
+ if (typeof this.width() !== 'undefined') {
256
+ json.width = this.width();
257
+ }
258
+ if (typeof this.height() !== 'undefined') {
259
+ json.height = this.height();
260
+ }
261
+ if (typeof this.edges() !== 'undefined') {
262
+ json.edges = this.edges();
263
+ }
264
+ const mj = { graph: json, rules: jr };
265
+ return mj;
266
+ };
267
+
268
+ function WOQLGraphRule(scope) {
269
+ Config.WOQLViewRule.call(this, scope);
270
+ }
271
+
272
+ Object.setPrototypeOf(WOQLGraphRule.prototype, Config.WOQLViewRule.prototype);
273
+
274
+ WOQLGraphRule.prototype.charge = function (v) {
275
+ if (typeof v === 'undefined') {
276
+ return this.rule.charge;
277
+ }
278
+ this.rule.charge = v;
279
+ return this;
280
+ };
281
+
282
+ WOQLGraphRule.prototype.collisionRadius = function (v) {
283
+ if (typeof v === 'undefined') {
284
+ return this.rule.collisionRadius;
285
+ }
286
+ this.rule.collisionRadius = v;
287
+ return this;
288
+ };
289
+
290
+ WOQLGraphRule.prototype.arrow = function (json) {
291
+ if (json) {
292
+ this.rule.arrow = json;
293
+ return this;
294
+ }
295
+ return this.rule.arrow;
296
+ };
297
+
298
+ WOQLGraphRule.prototype.distance = function (d) {
299
+ if (typeof d !== 'undefined') {
300
+ this.rule.distance = d;
301
+ return this;
302
+ }
303
+ return this.rule.distance;
304
+ };
305
+
306
+ WOQLGraphRule.prototype.symmetric = function (d) {
307
+ if (typeof d !== 'undefined') {
308
+ this.rule.symmetric = d;
309
+ return this;
310
+ }
311
+ return this.rule.symmetric;
312
+ };
313
+
314
+ WOQLGraphRule.prototype.weight = function (w) {
315
+ if (typeof w !== 'undefined') {
316
+ this.rule.weight = w;
317
+ return this;
318
+ }
319
+ return this.rule.weight;
320
+ };
321
+
322
+ WOQLGraphRule.prototype.prettyPrint = function () {
323
+ let str = Config.WOQLViewRule.prototype.prettyPrint.apply(this);
324
+ if (typeof this.charge() !== 'undefined') {
325
+ str += `.charge('${this.charge()}')`;
326
+ }
327
+ if (typeof this.distance() !== 'undefined') {
328
+ str += `.distance('${this.distance()}')`;
329
+ }
330
+ if (typeof this.weight() !== 'undefined') {
331
+ str += `.weight('${this.weight()}')`;
332
+ }
333
+ if (typeof this.symmetric() !== 'undefined') {
334
+ str += `.symmetric(${this.symmetric()})`;
335
+ }
336
+ if (typeof this.collisionRadius() !== 'undefined') {
337
+ str += `.collisionRadius(${this.collisionRadius()})`;
338
+ }
339
+ if (typeof this.arrow() !== 'undefined') {
340
+ str += `.arrow(${JSON.stringify(this.arrow())})`;
341
+ }
342
+ return str;
343
+ };
344
+
345
+ module.exports = WOQLGraphConfig;