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
package/lib/typedef.js ADDED
@@ -0,0 +1,248 @@
1
+ /**
2
+ * @module TypeDef
3
+ * @description Type definitions
4
+ * */
5
+ /* eslint-disable no-unused-vars */
6
+ const Utils = require('./utils');
7
+
8
+ const { ACTIONS } = Utils.ACTIONS;
9
+
10
+ /**
11
+ *@typedef {Object} DocParamsGet - the GET document interface query parameters
12
+ *@property {object} [query] - object that descrive the document query
13
+ *@property {GraphType} [graph_type] - instance|schema, default value is instance.
14
+ *Used to switch between getting documents from the instance or the schema graph.
15
+ *@property {string} [type] - only documents of the given type are returned.
16
+ *@property {string} [id] - only the document with the given ID is returned.
17
+ *@property {boolean} [prefixed] - default is true, return IRIs using a prefixed notation wherever
18
+ *possible. If false, full IRIs are used.
19
+ *@property {boolean} [minimized] - default is false, return the documents with very
20
+ little whitespace. Each json document will be on its own line.
21
+ *@property {boolean} [unfold] - default is false, any subdocuments contained in the returned
22
+ document are returned too. If false, these are referred to by their ID instead.
23
+ *@property {number} [skip] - default is 0, How many results to skip
24
+ *@property {number} [count] count - How many results to return. If this option is absent, all
25
+ results are returned.
26
+ *@property {boolean} [as_list] default is false, If true, don't return a stream of json objects,
27
+ but a json list.
28
+ *@property {string} [graph_type] - instance|schema default value is instance
29
+ */
30
+
31
+ /**
32
+ *@typedef {Object} DocParamsPost - the POST document interface query parameters
33
+ *@property {boolean} [raw_json] - default is false, If true, the input documents
34
+ are treated as raw JSON, inserted as type sys:JSONDocument and are not subject
35
+ to schema restrictions.
36
+ *@property {GraphType} [graph_type] - default is instance instance|schema Used to switch between
37
+ getting documents from the instance or the schema graph.
38
+ *@property {boolean} [full_replace] - default is false, If true, all existing documents are deleted
39
+ before inserting the posted documents. This allows the full replacement of the contents of a
40
+ database. This is especially useful for replacing the schema.
41
+ */
42
+
43
+ /**
44
+ *@typedef {Object} DocParamsPut - the PUT document interface query parameters
45
+ *@property {boolean} [raw_json] - default is false, If true, the input documents
46
+ are treated as raw JSON, inserted as type sys:JSONDocument and are not subject
47
+ to schema restrictions.
48
+ *@property {boolean} [create] - If true, the function will create
49
+ a new document if it doesn't exist.
50
+ *@property {GraphType} [graph_type] - default is instance, instance|schema Used to switch between
51
+ getting documents from the instance or the schema graph.
52
+ */
53
+
54
+ /**
55
+ *@typedef {Object} DocParamsDelete - the DELETE document interface query parameters
56
+ *@property {GraphType} [graph_type] - default is instance, instance|schema Used to switch between
57
+ getting documents from the instance or the schema graph.
58
+ *@property {string|array} id - a single id or a list of ids to delete.
59
+ *@property {boolean} [nuke] - default is false, If true, delete everything at this resource
60
+ location (dangerous!).
61
+ */
62
+
63
+ /**
64
+ * @typedef {"schema/main" | "instance/main" | string} GraphRef
65
+ */
66
+ /**
67
+ * @typedef {Object} DataFormatObj (export/import)
68
+ * @property {"csv"|"turtle"} [type] the format type
69
+ * @property {string} [format_header] header format type
70
+ */
71
+
72
+ /**
73
+ * @typedef {"add_quad" | "delete_quad" | "add_triple" | "delete_triple" | "quad" |
74
+ * "triple"} FuntionType
75
+ */
76
+
77
+ /**
78
+ * @typedef {"commits"|"meta"|"branch"|"ref"|"repo"|"db"} ResourceType
79
+ */
80
+
81
+ /**
82
+ *@typedef {"instance" | "schema" } GraphType
83
+ */
84
+
85
+ /**
86
+ * @typedef {Object} CredentialObj
87
+ * @property {'basic'|'jwt'|'apikey'} type - the authorization type of an TerminusDB connection
88
+ * @property {string | boolean} [user] - the user id | I don't need the user with the jwt token
89
+ * @property {string} key - the connection key
90
+ */
91
+
92
+ /**
93
+ * @typedef {'graph'|'db'|'clone'|'triples'|'woql'|'fetch'|'pull'|'rebase'|'branch'|'reset'|
94
+ * 'push'|'squash'} ActionType
95
+ */
96
+
97
+ /**
98
+ * @typedef {Object} ParamsObj
99
+ * @property {string} [key] - api key for basic auth
100
+ * @property {string} [jwt] - jwt token to connect with terminusX server
101
+ * @property {string} [user] - the user id, we use this for basic authentication and for
102
+ * identify the commits author
103
+ * @property {string} [organization] - set organization to this id
104
+ * @property {string} [db] - set cursor to this db
105
+ * @property {RepoType | string} [repo] - set cursor to this repo
106
+ * @property {string} [branch] - set branch to this id
107
+ * @property {string} [ref] - set commit ref
108
+ * @property {string} [default_branch_id] - set the default branch id
109
+ * @property {string} [token] - Api token to connect with TerminusX
110
+ */
111
+
112
+ /**
113
+ * @typedef {Object} RolesObj
114
+ * @property {string} agent_name - the Authorization connection's type
115
+ * @property {string} [database_name] - the user id | I don't need the user with the jwt token
116
+ * @property {string} [organization_name] - the connection key
117
+ * @property {array} [actions] - list of roles
118
+ * @property {string} [invitation] -
119
+ */
120
+
121
+ /**
122
+ * @typedef {"database"|"organization"} ScopeType
123
+ */
124
+
125
+ /**
126
+ * @typedef {"local"|"remote"} RepoType
127
+ */
128
+ // sharing is a boolean
129
+ /**
130
+ * @typedef {Object} DbDetails
131
+ * @property {string} label - "Textual DB Name"
132
+ * @property {string} [comment] - "Text description of DB"
133
+ * @property {boolean} [public] -
134
+ * @property {boolean} [schema] - if set to true, a schema graph will be created
135
+ */
136
+
137
+ /**
138
+ * @typedef {Object} DbDoc
139
+ * @property {string} id - "Database ID"
140
+ * @property {string} [label] - "Textual DB Name"
141
+ * @property {string} [comment] - "Text description of DB"
142
+ * @property {string} [organization] - "Organization to which the db belongs"
143
+ * @property {boolean} [public] -
144
+ * @property {boolean} [schema] - if set to true, a schema graph will be created
145
+ */
146
+
147
+ /**
148
+ *@typedef {Object} RemoteRepoDetails - {remote: "origin", "remote_branch": "main", "author":
149
+ "admin","message": "message"}
150
+ *@property {string} [remote] - remote server url
151
+ *@property {string} remote_branch - remote branch name
152
+ *@property {string} [author] - if it is undefined it get the current author
153
+ *@property {string} [message] - the update commit message
154
+ *
155
+ */
156
+
157
+ /**
158
+ * @typedef {Object} CloneSourceDetails
159
+ * @property {string} remote_url - the remote db source url
160
+ * @property {string} [label]
161
+ * @property {string} [comment]
162
+ */
163
+
164
+ /**
165
+ * @typedef {"grant" | "revoke"} CapabilityCommand - the manage capability command type
166
+ */
167
+
168
+ /**
169
+ * @typedef {ACTIONS[]} RolesActions - [ACTIONS.CREATE_DATABASE | ACTIONS.DELETE_DATABASE]
170
+ */
171
+
172
+ /**
173
+ * @typedef {Object} DocHistoryParams
174
+ * @property {number} [start] - Index to start from, 0 is the default
175
+ * @property {number} [count] - Amount of commits to show, 10 is the default
176
+ * @property {boolean} [updated] - Last updated time (excludes history) false is the default
177
+ * @property {boolean} [created] - Created date of object (excludes history) false is the default
178
+ */
179
+
180
+ /**
181
+ * @typedef {Object} DiffObject
182
+ * @property {Object} [keep] - Index to start from, 0 is the default
183
+ * @property {number} [count] - Last updated time (excludes history) false is the default
184
+ * @property {number} [start] - Amount of commits to show, 10 is the default
185
+ */
186
+
187
+ /**
188
+ * @typedef {Object} NamedResourceData - { filename: "data.csv", data: "col1;col2\nval1;val2" }
189
+ * @property {string} filename - Filename referenced in the WOQL query
190
+ * @property {string|Blob|Buffer} data - Attached data, such as CSV contents
191
+ */
192
+
193
+ /**
194
+ * @typedef {Object} Frame - Represents a document frame, object frame, or property frame
195
+ * in the viewer system. Frames are used to describe the structure and properties of data
196
+ * being displayed or validated.
197
+ * @property {string} [subject] - Subject identifier
198
+ * @property {string} [property] - Property name
199
+ * @property {string} [type] - Type information (e.g., xsd:string, schema:Person)
200
+ * @property {*} [value] - Frame value
201
+ * @property {number} [depth] - Depth in frame hierarchy
202
+ * @property {string} [range] - Property range/type
203
+ * @property {string} [label] - Display label
204
+ * @property {Object} [parent] - Parent frame reference
205
+ * @property {Array} [children] - Child frames
206
+ * @property {string} [status] - Frame status: 'updated' | 'error' | 'new' | 'ok'
207
+ * @property {boolean} [literal] - Whether this represents a literal value
208
+ * @property {number} [index] - Index in parent collection
209
+ * @property {Object} [frame] - Nested frame data
210
+ * @property {string} [subjectClass] - Class of the subject
211
+ */
212
+
213
+ /**
214
+ * @typedef {Object} WOQLJson - JSON-LD representation of a WOQL query
215
+ * @property {string} @type - The WOQL operation type (e.g., 'Triple', 'And', 'Select', 'Or')
216
+ * @property {*} [subject] - Subject for triple patterns
217
+ * @property {*} [predicate] - Predicate for triple patterns
218
+ * @property {*} [object] - Object for triple patterns
219
+ * @property {WOQLJson[]} [and] - Array of queries for 'And' operations
220
+ * @property {WOQLJson[]} [or] - Array of queries for 'Or' operations
221
+ * @property {WOQLJson} [query] - Nested query for operations like 'Select', 'Using'
222
+ * @property {string[]} [variables] - Variable list for 'Select' operations
223
+ * @property {string} [graph] - Graph identifier for graph operations
224
+ * @property {*} [consequent] - Consequent for path queries
225
+ * @property {string} [path_pattern] - Pattern for path queries
226
+ * Additional properties depend on the specific WOQL operation type
227
+ */
228
+
229
+ /**
230
+ * @typedef {Object} WOQLQuery - WOQL Query Builder class
231
+ */
232
+
233
+ /**
234
+ * Result from WOQL.localize() function - a two-element array [localizedFn, vars]
235
+ * @typedef {Object} LocalizeResult
236
+ * @property {function(WOQLQuery=): WOQLQuery} 0 - Localized function that wraps queries
237
+ * @property {Object.<string, Var>} 1 - Variables object with unique names
238
+ */
239
+
240
+ // eslint-disable-next-line no-unused-vars
241
+ const WOQLJson = {};
242
+ // eslint-disable-next-line no-unused-vars
243
+ const WOQLQuery = {};
244
+
245
+ module.exports = {
246
+ WOQLJson,
247
+ WOQLQuery,
248
+ };