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,26 @@
1
+ export = WOQLGraph;
2
+ declare function WOQLGraph(client: any, config: any): void;
3
+ declare class WOQLGraph {
4
+ constructor(client: any, config: any);
5
+ client: any;
6
+ config: any;
7
+ nodes: any[];
8
+ edges: any[];
9
+ options(config: any): this;
10
+ setResult(result: any): void;
11
+ result: any;
12
+ calculateVariableTypes(): void;
13
+ extractFromBinding(row: any, rownum: any): void;
14
+ addAdornedEdge(source: any, target: any, ks: any, kt: any, row: any): void;
15
+ addAdornedNode(nid: any, k: any, row: any): void;
16
+ getLiteralOwner(nodes: any, v: any, row: any): any;
17
+ createEdgesFromIDs(nodes: any, row: any): void;
18
+ getEdges(): any[];
19
+ combineNodes(nodes: any): any[];
20
+ combineEdges(edges: any): any[];
21
+ nodes_referenced_by_edges: any[];
22
+ getNodes(): any[];
23
+ includeNode(v: any, row: any): boolean;
24
+ includeLiteralNode(variableName: any, row: any): boolean;
25
+ includeRow(row: any, num: any): boolean;
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,128 @@
1
+ export = WOQLResult;
2
+ /**
3
+ * @typedef {Object} WOQLQuery
4
+ */
5
+ /**
6
+ * @module WOQLResult
7
+ * @license Apache Version 2
8
+ * Object representing the result of a WOQL Query
9
+ * @param {object} results result JSON object as returned by WOQL query
10
+ * @param {WOQLQuery} query the query object that generated the result
11
+ * @param {object} [config] optional result configuration options object
12
+ * [config.no_compress] by default all URLs are compressed where possible (v:X rather than http://.../variable/x) set to true to return non-compressed values
13
+ * [config.context] specify the JSON-LD context to use for compressing results - by default
14
+ * the query context will be used
15
+ */
16
+ declare function WOQLResult(results: object, query: WOQLQuery, config?: object): void;
17
+ declare class WOQLResult {
18
+ /**
19
+ * @typedef {Object} WOQLQuery
20
+ */
21
+ /**
22
+ * @module WOQLResult
23
+ * @license Apache Version 2
24
+ * Object representing the result of a WOQL Query
25
+ * @param {object} results result JSON object as returned by WOQL query
26
+ * @param {WOQLQuery} query the query object that generated the result
27
+ * @param {object} [config] optional result configuration options object
28
+ * [config.no_compress] by default all URLs are compressed where possible (v:X rather than http://.../variable/x) set to true to return non-compressed values
29
+ * [config.context] specify the JSON-LD context to use for compressing results - by default
30
+ * the query context will be used
31
+ */
32
+ constructor(results: object, query: WOQLQuery, config?: object);
33
+ bindings: any;
34
+ insert_count: any;
35
+ delete_count: any;
36
+ transaction_retry_count: any;
37
+ /**
38
+ * @type {array | boolean}
39
+ */
40
+ variable_names: any[] | boolean;
41
+ query: any;
42
+ cursor: number;
43
+ formatter(context: any): any[];
44
+ /**
45
+ * @param {object} [context] optional context to use for compression -
46
+ * if ommitted query context is used
47
+ * @returns {WOQLResult}
48
+ */
49
+ compress(context?: object): WOQLResult;
50
+ /**
51
+ * Returns true if there are any results
52
+ * @returns {boolean}
53
+ */
54
+ hasBindings(): boolean;
55
+ /**
56
+ * Returns true if there are any results
57
+ * @returns {boolean}
58
+ */
59
+ hasUpdates(): boolean;
60
+ /**
61
+ * Returns original array of bindings returned by API
62
+ * @returns {array} the data result
63
+ */
64
+ getBindings(): any[];
65
+ /**
66
+ * Returns original array of bindings returned by API
67
+ * @returns {array} the data result
68
+ */
69
+ rows(): any[];
70
+ /**
71
+ * Returns list of variables returned in bindings from API
72
+ * @returns {array|boolean}
73
+ */
74
+ getVariableList(): any[] | boolean;
75
+ /**
76
+ * Number of rows in bound results
77
+ * @returns {number}
78
+ */
79
+ count(): number;
80
+ /**
81
+ * Number of reported inserts
82
+ * @returns {number}
83
+ */
84
+ inserts(): number;
85
+ /**
86
+ * Number of reported inserts
87
+ * @returns {number}
88
+ */
89
+ deletes(): number;
90
+ /**
91
+ * Get the first object record from the result set
92
+ * @returns {object}
93
+ */
94
+ first(): object;
95
+ /**
96
+ * Get the last object record from the result set
97
+ * @returns {object}
98
+ */
99
+ last(): object;
100
+ /**
101
+ * @returns {object}
102
+ */
103
+ next(): object;
104
+ /**
105
+ * @returns {object}
106
+ */
107
+ prev(): object;
108
+ /**
109
+ * Normally sorting of results is the job of the query - this is just in case you
110
+ * want to resort results according to some key (variable)
111
+ * @param {string} key
112
+ * @param {string} asc_or_desc
113
+ * @returns {WOQLResult}
114
+ */
115
+ sort(key: string, asc_or_desc: string): WOQLResult;
116
+ /**
117
+ * Compares results a, b according to "asc" or "desc" order
118
+ * @param {object} a
119
+ * @param {object} b
120
+ * @param {string} [asc_or_desc]
121
+ * @returns {number}
122
+ */
123
+ compareValues(a: object, b: object, asc_or_desc?: string): number;
124
+ }
125
+ declare namespace WOQLResult {
126
+ export { WOQLQuery };
127
+ }
128
+ type WOQLQuery = any;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @file WOQL Rules
3
+ * @license Apache Version 2
4
+ * WOQL Rules support pattern matching on results of WOQL Queries
5
+ */
6
+ export function WOQLRule(): void;
7
+ export class WOQLRule {
8
+ pattern: WOQLPattern;
9
+ /**
10
+ * Specifies that the rule only applies to specific variables returned by the WOQL query
11
+ * @param {Array<string>} vars - array of strings, each a variable name, variable prefixes
12
+ * ("v:") are added automatically if absent
13
+ */
14
+ setVariables(vars: Array<string>): this;
15
+ current_variable: any;
16
+ /**
17
+ * Shorthand to the above using spread operator
18
+ */
19
+ vars(...varlist: any[]): this;
20
+ /**
21
+ * Specifies that the rule applies to a specific variable, variable prefix ("v:")
22
+ * is added automatically if absent
23
+ */
24
+ v(v: any): any;
25
+ /**
26
+ * Specifies that the rule applies to a specific edge, a source -> target pair of variables
27
+ */
28
+ edge(source: any, target: any): this;
29
+ /**
30
+ * Specifies that the rule applies to a specific edge, a source -> target pair of variables
31
+ */
32
+ rownum(rownum: any): any;
33
+ /**
34
+ * Specifies that the value of a variable must be one of the values contained in the list
35
+ * @param {...(string|number)} list - parameters are any atomic value (string | number) -
36
+ * the rule will match only cells that have one of these values
37
+ */
38
+ in(...list: (string | number)[]): this;
39
+ /**
40
+ * Specifies a filter function to apply to each element - only those values that
41
+ * return true when this filter is invoked will be matched
42
+ * @param {function} tester - test function that will be used to filter values
43
+ */
44
+ filter(tester: Function): this;
45
+ matchRow(rules: any, row: any, rownum: any, action: any): any[];
46
+ matchCell(rules: any, row: any, key: any, rownum: any, action: any): any[];
47
+ /**
48
+ *
49
+ * @param {array} rules
50
+ * @param {string} key - column name
51
+ * @param {string} ruleName - the rule name like header, width etc...
52
+ * @returns {array}
53
+ */
54
+ matchColumn(rules: any[], key: string, ruleName: string): any[];
55
+ matchNode(rules: any, row: any, key: any, nid: any, action: any): any[];
56
+ matchPair(rules: any, row: any, keya: any, keyb: any, action: any): any[];
57
+ matchEdge: any;
58
+ }
59
+ /**
60
+ * Object to encapsulate the matching of woql result patterns - inherits from TerminusRule
61
+ * @param {Object} pattern
62
+ */
63
+ export function WOQLPattern(pattern: any): void;
64
+ export class WOQLPattern {
65
+ /**
66
+ * Object to encapsulate the matching of woql result patterns - inherits from TerminusRule
67
+ * @param {Object} pattern
68
+ */
69
+ constructor(pattern: any);
70
+ prettyPrint(): string;
71
+ /**
72
+ * @param {String|Object} data
73
+ * @param {string|Array<string>} [key] - a variable or an array of two variables
74
+ * (in the case of edge scope) which constitutes the key being tested
75
+ * @param {String} [scope] - the scope in which the test is being carried out (row, column, cell)
76
+ */
77
+ matchRow(row: any, rownum: any): boolean;
78
+ matchCell(row: any, key: any, rownum: any): boolean;
79
+ matchNode(row: any, key: any): boolean;
80
+ matchColumn(key: any): boolean;
81
+ matchPair(row: any, keya: any, keyb: any): boolean;
82
+ testVariableConstraints(row: any): boolean;
83
+ testVariableConstraint(name: any, val: any): boolean;
84
+ setPattern(pattern: any): void;
85
+ json(): {
86
+ scope: any;
87
+ value: any;
88
+ rownum: any;
89
+ variables: any;
90
+ literal: any;
91
+ type: any;
92
+ constraints: any;
93
+ source: any;
94
+ target: any;
95
+ };
96
+ }
@@ -0,0 +1,31 @@
1
+ export = WOQLStream;
2
+ /**
3
+ * @typedef {Object} WOQLClient
4
+ */
5
+ /**
6
+ * @param {WOQLClient} client
7
+ * @param {WOQLStreamConfig} config
8
+ * @returns {WOQLStream}
9
+ */
10
+ declare function WOQLStream(client: WOQLClient, config: WOQLStreamConfig): WOQLStream;
11
+ declare class WOQLStream {
12
+ /**
13
+ * @typedef {Object} WOQLClient
14
+ */
15
+ /**
16
+ * @param {WOQLClient} client
17
+ * @param {WOQLStreamConfig} config
18
+ * @returns {WOQLStream}
19
+ */
20
+ constructor(client: WOQLClient, config: WOQLStreamConfig);
21
+ client: any;
22
+ config: WOQLStreamConfig;
23
+ options(config: any): this;
24
+ setResult(wqrs: any): void;
25
+ result: any;
26
+ }
27
+ declare namespace WOQLStream {
28
+ export { WOQLClient };
29
+ }
30
+ import WOQLStreamConfig = require("./streamConfig");
31
+ type WOQLClient = any;
@@ -0,0 +1,102 @@
1
+ export = WOQLTable;
2
+ /**
3
+ * @module WOQLTable
4
+ * @license Apache Version 2
5
+ * @param {WOQLClient} [client] we need an client if we do a server side pagination,sorting etc...
6
+ * @param {WOQLTableConfig} [config]
7
+ * @returns {WOQLTable}
8
+ */
9
+ declare function WOQLTable(client?: WOQLClient, config?: WOQLTableConfig): WOQLTable;
10
+ declare class WOQLTable {
11
+ /**
12
+ * @module WOQLTable
13
+ * @license Apache Version 2
14
+ * @param {WOQLClient} [client] we need an client if we do a server side pagination,sorting etc...
15
+ * @param {WOQLTableConfig} [config]
16
+ * @returns {WOQLTable}
17
+ */
18
+ constructor(client?: WOQLClient, config?: WOQLTableConfig);
19
+ client: WOQLClient;
20
+ config: WOQLTableConfig;
21
+ /**
22
+ * set the WOQLTableConfig for this table
23
+ * @param {WOQLTableConfig} config
24
+ * @returns {WOQLTable}
25
+ */
26
+ options(config: WOQLTableConfig): WOQLTable;
27
+ /**
28
+ * Set the query result using the WOQLResult object
29
+ * @param {WOQLResult} result - the WOQLResult object
30
+ * @returns {WOQLTable}
31
+ */
32
+ setResult(result: WOQLResult): WOQLTable;
33
+ result: WOQLResult;
34
+ /**
35
+ * @returns {number} the total result
36
+ */
37
+ count(): number;
38
+ /**
39
+ * Get the first object record from the result set
40
+ * @returns {object}
41
+ */
42
+ first(): object;
43
+ /**
44
+ * Get the preview object record from the result set
45
+ * @returns {object}
46
+ */
47
+ prev(): object;
48
+ /**
49
+ * Get the next object record from the result set
50
+ * @returns {object}
51
+ */
52
+ next(): object;
53
+ /**
54
+ * @returns {boolean}
55
+ */
56
+ canAdvancePage(): boolean;
57
+ canChangePage(): boolean;
58
+ canRetreatPage(): boolean;
59
+ getPageSize(): any;
60
+ setPage(l: any): any;
61
+ getPage(): any;
62
+ setPageSize(l: any): any;
63
+ nextPage(): any;
64
+ firstPage(): any;
65
+ previousPage(): any;
66
+ getColumnsToRender(): any;
67
+ getColumnHeaderContents(colid: any): any;
68
+ hidden(col: any): any;
69
+ /**
70
+ * Called when you want to change the query associated with the table.
71
+ */
72
+ update(nquery: any): any;
73
+ hasDefinedEvent(row: any, key: any, scope: any, action: any, rownum: any): boolean;
74
+ getDefinedEvent(row: any, key: any, scope: any, action: any, rownum: any): any;
75
+ getRowClick(row: any): any;
76
+ uncompressed(row: any, col: any): any;
77
+ getCellClick(row: any, col: any): any;
78
+ getRowHover(row: any): any;
79
+ getCellHover(row: any, key: any): any;
80
+ getColumnOrder(): any;
81
+ bindings(): any;
82
+ getColumnFilter(colid: any): any;
83
+ getColumnDimensions(key: any): {
84
+ width: any;
85
+ maxWidth: any;
86
+ minWidth: any;
87
+ };
88
+ hasColumnOrder: any;
89
+ hasCellClick: any;
90
+ hasRowClick: any;
91
+ hasCellHover: any;
92
+ hasRowHover: any;
93
+ getRenderer(key: any, row: any, rownum: any): any;
94
+ isSortableColumn(key: any): boolean;
95
+ isFilterableColumn(key: any): boolean;
96
+ renderValue(renderer: any, val: any, key: any, row: any): any;
97
+ getRendererForDatatype(val: any): any;
98
+ getSpecificRender(key: any, row: any): any;
99
+ }
100
+ import WOQLClient = require("../woqlClient");
101
+ import WOQLTableConfig = require("./tableConfig");
102
+ import WOQLResult = require("./woqlResult");
@@ -0,0 +1,49 @@
1
+ import WOQLTableConfig = require("./tableConfig");
2
+ import WOQLChartConfig = require("./chartConfig");
3
+ import WOQLGraphConfig = require("./graphConfig");
4
+ import WOQLChooserConfig = require("./chooserConfig");
5
+ import WOQLStreamConfig = require("./streamConfig");
6
+ import FrameConfig = require("./frameConfig");
7
+ import { WOQLRule } from "./woqlRule";
8
+ import { FrameRule } from "./frameRule";
9
+ export function table(): WOQLTableConfig;
10
+ export function chart(): WOQLChartConfig;
11
+ export function graph(): WOQLGraphConfig;
12
+ export function chooser(): WOQLChooserConfig;
13
+ export function stream(): WOQLStreamConfig;
14
+ export function document(): FrameConfig;
15
+ export function loadConfig(config: any): WOQLChartConfig | WOQLChooserConfig | FrameConfig | WOQLGraphConfig | WOQLStreamConfig | WOQLTableConfig;
16
+ /**
17
+ * Shorthand functions for accessing the pattern matching capabilities
18
+ */
19
+ export function rule(type: any): WOQLRule | FrameRule;
20
+ export function pattern(type: any): import("./woqlRule").WOQLPattern | import("./frameRule").FramePattern;
21
+ /**
22
+ * Called to match an entire row of results is matched by a set of rules
23
+ * returns array of rules that matched
24
+ */
25
+ export function matchRow(rules: any, row: any, rownum: any, action: any): any[];
26
+ /**
27
+ * Called to test whether an entire column of results is matched by a set of rules
28
+ * returns array of rules that matched
29
+ */
30
+ export function matchColumn(rules: any, key: any, action: any): any[];
31
+ /**
32
+ * Called to test whether a specific cell is matched by a set of rules
33
+ * returns array of rules that matched
34
+ */
35
+ export function matchCell(rules: any, row: any, key: any, rownum: any, action: any): any[];
36
+ /**
37
+ * Called to test whether a specific node is matched by a set of rules
38
+ * returns array of rules that matched
39
+ */
40
+ export function matchNode(rules: any, row: any, key: any, nid: any, action: any): any[];
41
+ /**
42
+ * Called to test whether a specific edge (source -> target) is matched by a set of rules
43
+ * returns array of rules that matched
44
+ */
45
+ export function matchEdge(rules: any, row: any, keya: any, keyb: any, action: any): any[];
46
+ /**
47
+ * Called to test whether a specific frame is matched by a set of rules
48
+ */
49
+ export function matchFrame(rules: any, frame: any, onmatch: any): FrameRule[];