@elqnt/kg 2.1.1 → 3.0.1

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 (47) hide show
  1. package/README.md +357 -39
  2. package/dist/api/index.d.mts +248 -1
  3. package/dist/api/index.d.ts +248 -1
  4. package/dist/api/index.js +2 -2
  5. package/dist/api/index.mjs +1 -1
  6. package/dist/api/server.d.mts +219 -0
  7. package/dist/api/server.d.ts +219 -0
  8. package/dist/api/server.js +442 -0
  9. package/dist/api/server.js.map +1 -0
  10. package/dist/api/server.mjs +442 -0
  11. package/dist/api/server.mjs.map +1 -0
  12. package/dist/{chunk-4XIW5GLO.js → chunk-2TJCYLTP.js} +63 -68
  13. package/dist/chunk-2TJCYLTP.js.map +1 -0
  14. package/dist/chunk-7RW5MHP5.js +497 -0
  15. package/dist/chunk-7RW5MHP5.js.map +1 -0
  16. package/dist/chunk-ADIKUMMI.js +238 -0
  17. package/dist/chunk-ADIKUMMI.js.map +1 -0
  18. package/dist/chunk-CAXPQTKI.mjs +238 -0
  19. package/dist/chunk-CAXPQTKI.mjs.map +1 -0
  20. package/dist/{chunk-3AS6C7FW.mjs → chunk-HCDFJCQL.mjs} +62 -67
  21. package/dist/chunk-HCDFJCQL.mjs.map +1 -0
  22. package/dist/chunk-JZ7UXVRW.mjs +497 -0
  23. package/dist/chunk-JZ7UXVRW.mjs.map +1 -0
  24. package/dist/hooks/index.d.mts +109 -4
  25. package/dist/hooks/index.d.ts +109 -4
  26. package/dist/hooks/index.js +9 -3
  27. package/dist/hooks/index.js.map +1 -1
  28. package/dist/hooks/index.mjs +10 -4
  29. package/dist/index.d.mts +2 -1
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.js +21 -3
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +22 -4
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/utils/index.d.mts +277 -0
  36. package/dist/utils/index.d.ts +277 -0
  37. package/dist/utils/index.js +44 -0
  38. package/dist/utils/index.js.map +1 -0
  39. package/dist/utils/index.mjs +44 -0
  40. package/dist/utils/index.mjs.map +1 -0
  41. package/package.json +15 -5
  42. package/dist/chunk-3AS6C7FW.mjs.map +0 -1
  43. package/dist/chunk-4XIW5GLO.js.map +0 -1
  44. package/dist/chunk-7HNJUCVW.js +0 -577
  45. package/dist/chunk-7HNJUCVW.js.map +0 -1
  46. package/dist/chunk-EW3NQGUZ.mjs +0 -577
  47. package/dist/chunk-EW3NQGUZ.mjs.map +0 -1
@@ -0,0 +1,442 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
+
3
+ // api/server.ts
4
+ var _server = require('@elqnt/api-client/server');
5
+ function buildQueryString(params) {
6
+ const searchParams = new URLSearchParams();
7
+ for (const [key, value] of Object.entries(params)) {
8
+ if (value !== void 0) {
9
+ searchParams.set(key, value);
10
+ }
11
+ }
12
+ const queryString = searchParams.toString();
13
+ return queryString ? `?${queryString}` : "";
14
+ }
15
+ function buildHeaders(graphId) {
16
+ return graphId ? { "X-Graph-ID": graphId } : void 0;
17
+ }
18
+ async function listGraphsServer(options) {
19
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/graphs", {
20
+ method: "GET",
21
+ gatewayUrl: options.gatewayUrl,
22
+ jwtSecret: options.jwtSecret,
23
+ orgId: options.orgId,
24
+ userId: options.userId,
25
+ userEmail: options.userEmail,
26
+ timeout: options.timeout,
27
+ cache: options.cache
28
+ });
29
+ }
30
+ async function getGraphServer(graphId, options) {
31
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/graphs/${graphId}`, {
32
+ method: "GET",
33
+ gatewayUrl: options.gatewayUrl,
34
+ jwtSecret: options.jwtSecret,
35
+ orgId: options.orgId,
36
+ userId: options.userId,
37
+ userEmail: options.userEmail,
38
+ timeout: options.timeout,
39
+ cache: options.cache
40
+ });
41
+ }
42
+ async function createGraphServer(graph, options) {
43
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/graphs", {
44
+ method: "POST",
45
+ body: graph,
46
+ gatewayUrl: options.gatewayUrl,
47
+ jwtSecret: options.jwtSecret,
48
+ orgId: options.orgId,
49
+ userId: options.userId,
50
+ userEmail: options.userEmail,
51
+ timeout: options.timeout,
52
+ cache: options.cache
53
+ });
54
+ }
55
+ async function updateGraphServer(graphId, updates, options) {
56
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/graphs/${graphId}`, {
57
+ method: "PUT",
58
+ body: updates,
59
+ gatewayUrl: options.gatewayUrl,
60
+ jwtSecret: options.jwtSecret,
61
+ orgId: options.orgId,
62
+ userId: options.userId,
63
+ userEmail: options.userEmail,
64
+ timeout: options.timeout,
65
+ cache: options.cache
66
+ });
67
+ }
68
+ async function deleteGraphServer(graphId, options) {
69
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/graphs/${graphId}`, {
70
+ method: "DELETE",
71
+ gatewayUrl: options.gatewayUrl,
72
+ jwtSecret: options.jwtSecret,
73
+ orgId: options.orgId,
74
+ userId: options.userId,
75
+ userEmail: options.userEmail,
76
+ timeout: options.timeout,
77
+ cache: options.cache
78
+ });
79
+ }
80
+ async function queryGraphServer(query, options) {
81
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/query", {
82
+ method: "POST",
83
+ body: query,
84
+ gatewayUrl: options.gatewayUrl,
85
+ jwtSecret: options.jwtSecret,
86
+ orgId: options.orgId,
87
+ userId: options.userId,
88
+ userEmail: options.userEmail,
89
+ headers: buildHeaders(options.graphId),
90
+ timeout: _nullishCoalesce(options.timeout, () => ( 3e4)),
91
+ cache: options.cache
92
+ });
93
+ }
94
+ async function getGraphLabelsServer(options) {
95
+ const queryString = buildQueryString({ graphId: options.graphId });
96
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/labels${queryString}`, {
97
+ method: "GET",
98
+ gatewayUrl: options.gatewayUrl,
99
+ jwtSecret: options.jwtSecret,
100
+ orgId: options.orgId,
101
+ userId: options.userId,
102
+ userEmail: options.userEmail,
103
+ timeout: options.timeout,
104
+ cache: options.cache
105
+ });
106
+ }
107
+ async function getKGNodeServer(nodeId, options) {
108
+ const queryString = buildQueryString({ graphId: options.graphId });
109
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/nodes/${nodeId}${queryString}`, {
110
+ method: "GET",
111
+ gatewayUrl: options.gatewayUrl,
112
+ jwtSecret: options.jwtSecret,
113
+ orgId: options.orgId,
114
+ userId: options.userId,
115
+ userEmail: options.userEmail,
116
+ timeout: options.timeout,
117
+ cache: options.cache
118
+ });
119
+ }
120
+ async function ingestKGNodeServer(node, options) {
121
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/nodes", {
122
+ method: "POST",
123
+ body: node,
124
+ gatewayUrl: options.gatewayUrl,
125
+ jwtSecret: options.jwtSecret,
126
+ orgId: options.orgId,
127
+ userId: options.userId,
128
+ userEmail: options.userEmail,
129
+ headers: buildHeaders(options.graphId),
130
+ timeout: options.timeout,
131
+ cache: options.cache
132
+ });
133
+ }
134
+ async function updateKGNodeServer(nodeId, updates, options) {
135
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/nodes/${nodeId}`, {
136
+ method: "PUT",
137
+ body: updates,
138
+ gatewayUrl: options.gatewayUrl,
139
+ jwtSecret: options.jwtSecret,
140
+ orgId: options.orgId,
141
+ userId: options.userId,
142
+ userEmail: options.userEmail,
143
+ headers: buildHeaders(options.graphId),
144
+ timeout: options.timeout,
145
+ cache: options.cache
146
+ });
147
+ }
148
+ async function getNodeConnectionStatsServer(nodeId, edgeLabel, options) {
149
+ const queryString = buildQueryString({
150
+ edgeLabel,
151
+ graphId: options.graphId
152
+ });
153
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/nodes/${nodeId}/connections${queryString}`, {
154
+ method: "GET",
155
+ gatewayUrl: options.gatewayUrl,
156
+ jwtSecret: options.jwtSecret,
157
+ orgId: options.orgId,
158
+ userId: options.userId,
159
+ userEmail: options.userEmail,
160
+ timeout: options.timeout,
161
+ cache: options.cache
162
+ });
163
+ }
164
+ async function ingestDocumentServer(document, options) {
165
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/ingest", {
166
+ method: "POST",
167
+ body: document,
168
+ gatewayUrl: options.gatewayUrl,
169
+ jwtSecret: options.jwtSecret,
170
+ orgId: options.orgId,
171
+ userId: options.userId,
172
+ userEmail: options.userEmail,
173
+ headers: buildHeaders(options.graphId),
174
+ timeout: _nullishCoalesce(options.timeout, () => ( 12e4)),
175
+ cache: options.cache
176
+ });
177
+ }
178
+ async function deleteKGDocumentServer(documentId, options) {
179
+ const queryString = buildQueryString({ graphId: options.graphId });
180
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/documents/${documentId}${queryString}`, {
181
+ method: "DELETE",
182
+ gatewayUrl: options.gatewayUrl,
183
+ jwtSecret: options.jwtSecret,
184
+ orgId: options.orgId,
185
+ userId: options.userId,
186
+ userEmail: options.userEmail,
187
+ timeout: options.timeout,
188
+ cache: options.cache
189
+ });
190
+ }
191
+ async function optimizeGraphServer(options) {
192
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/graph/optimize", {
193
+ method: "POST",
194
+ body: {},
195
+ gatewayUrl: options.gatewayUrl,
196
+ jwtSecret: options.jwtSecret,
197
+ orgId: options.orgId,
198
+ userId: options.userId,
199
+ userEmail: options.userEmail,
200
+ headers: buildHeaders(options.graphId),
201
+ timeout: options.timeout,
202
+ cache: options.cache
203
+ });
204
+ }
205
+ async function listDesignerNodesServer(options) {
206
+ const queryString = buildQueryString({ graphId: options.graphId });
207
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/nodes${queryString}`, {
208
+ method: "GET",
209
+ gatewayUrl: options.gatewayUrl,
210
+ jwtSecret: options.jwtSecret,
211
+ orgId: options.orgId,
212
+ userId: options.userId,
213
+ userEmail: options.userEmail,
214
+ timeout: options.timeout,
215
+ cache: options.cache
216
+ });
217
+ }
218
+ async function getDesignerNodeServer(label, options) {
219
+ const queryString = buildQueryString({ graphId: options.graphId });
220
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/nodes/${label}${queryString}`, {
221
+ method: "GET",
222
+ gatewayUrl: options.gatewayUrl,
223
+ jwtSecret: options.jwtSecret,
224
+ orgId: options.orgId,
225
+ userId: options.userId,
226
+ userEmail: options.userEmail,
227
+ timeout: options.timeout,
228
+ cache: options.cache
229
+ });
230
+ }
231
+ async function createDesignerNodeServer(node, options) {
232
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/designer/nodes", {
233
+ method: "POST",
234
+ body: { node },
235
+ gatewayUrl: options.gatewayUrl,
236
+ jwtSecret: options.jwtSecret,
237
+ orgId: options.orgId,
238
+ userId: options.userId,
239
+ userEmail: options.userEmail,
240
+ headers: buildHeaders(options.graphId),
241
+ timeout: options.timeout,
242
+ cache: options.cache
243
+ });
244
+ }
245
+ async function updateDesignerNodeServer(label, node, options) {
246
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/nodes/${label}`, {
247
+ method: "PUT",
248
+ body: { node },
249
+ gatewayUrl: options.gatewayUrl,
250
+ jwtSecret: options.jwtSecret,
251
+ orgId: options.orgId,
252
+ userId: options.userId,
253
+ userEmail: options.userEmail,
254
+ headers: buildHeaders(options.graphId),
255
+ timeout: options.timeout,
256
+ cache: options.cache
257
+ });
258
+ }
259
+ async function deleteDesignerNodeServer(label, options) {
260
+ const queryString = buildQueryString({ graphId: options.graphId });
261
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/nodes/${label}${queryString}`, {
262
+ method: "DELETE",
263
+ gatewayUrl: options.gatewayUrl,
264
+ jwtSecret: options.jwtSecret,
265
+ orgId: options.orgId,
266
+ userId: options.userId,
267
+ userEmail: options.userEmail,
268
+ timeout: options.timeout,
269
+ cache: options.cache
270
+ });
271
+ }
272
+ async function listDesignerEdgesServer(options) {
273
+ const queryString = buildQueryString({ graphId: options.graphId });
274
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/edges${queryString}`, {
275
+ method: "GET",
276
+ gatewayUrl: options.gatewayUrl,
277
+ jwtSecret: options.jwtSecret,
278
+ orgId: options.orgId,
279
+ userId: options.userId,
280
+ userEmail: options.userEmail,
281
+ timeout: options.timeout,
282
+ cache: options.cache
283
+ });
284
+ }
285
+ async function getDesignerEdgeServer(label, options) {
286
+ const queryString = buildQueryString({ graphId: options.graphId });
287
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/edges/${label}${queryString}`, {
288
+ method: "GET",
289
+ gatewayUrl: options.gatewayUrl,
290
+ jwtSecret: options.jwtSecret,
291
+ orgId: options.orgId,
292
+ userId: options.userId,
293
+ userEmail: options.userEmail,
294
+ timeout: options.timeout,
295
+ cache: options.cache
296
+ });
297
+ }
298
+ async function createDesignerEdgeServer(edge, options) {
299
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/designer/edges", {
300
+ method: "POST",
301
+ body: { edge },
302
+ gatewayUrl: options.gatewayUrl,
303
+ jwtSecret: options.jwtSecret,
304
+ orgId: options.orgId,
305
+ userId: options.userId,
306
+ userEmail: options.userEmail,
307
+ headers: buildHeaders(options.graphId),
308
+ timeout: options.timeout,
309
+ cache: options.cache
310
+ });
311
+ }
312
+ async function updateDesignerEdgeServer(label, edge, options) {
313
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/edges/${label}`, {
314
+ method: "PUT",
315
+ body: { edge },
316
+ gatewayUrl: options.gatewayUrl,
317
+ jwtSecret: options.jwtSecret,
318
+ orgId: options.orgId,
319
+ userId: options.userId,
320
+ userEmail: options.userEmail,
321
+ headers: buildHeaders(options.graphId),
322
+ timeout: options.timeout,
323
+ cache: options.cache
324
+ });
325
+ }
326
+ async function deleteDesignerEdgeServer(label, options) {
327
+ const queryString = buildQueryString({ graphId: options.graphId });
328
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/designer/edges/${label}${queryString}`, {
329
+ method: "DELETE",
330
+ gatewayUrl: options.gatewayUrl,
331
+ jwtSecret: options.jwtSecret,
332
+ orgId: options.orgId,
333
+ userId: options.userId,
334
+ userEmail: options.userEmail,
335
+ timeout: options.timeout,
336
+ cache: options.cache
337
+ });
338
+ }
339
+ async function listCrawlJobsServer(options) {
340
+ const queryString = buildQueryString({
341
+ graphId: options.graphId,
342
+ limit: _optionalChain([options, 'access', _ => _.limit, 'optionalAccess', _2 => _2.toString, 'call', _3 => _3()]),
343
+ offset: _optionalChain([options, 'access', _4 => _4.offset, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()]),
344
+ status: options.status
345
+ });
346
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/crawl/jobs${queryString}`, {
347
+ method: "GET",
348
+ gatewayUrl: options.gatewayUrl,
349
+ jwtSecret: options.jwtSecret,
350
+ orgId: options.orgId,
351
+ userId: options.userId,
352
+ userEmail: options.userEmail,
353
+ timeout: options.timeout,
354
+ cache: options.cache
355
+ });
356
+ }
357
+ async function startCrawlJobServer(params, options) {
358
+ return _server.serverApiRequest.call(void 0, "/api/v1/kg/crawl/jobs", {
359
+ method: "POST",
360
+ body: params,
361
+ gatewayUrl: options.gatewayUrl,
362
+ jwtSecret: options.jwtSecret,
363
+ orgId: options.orgId,
364
+ userId: options.userId,
365
+ userEmail: options.userEmail,
366
+ headers: buildHeaders(options.graphId),
367
+ timeout: options.timeout,
368
+ cache: options.cache
369
+ });
370
+ }
371
+ async function getCrawlJobStatusServer(jobId, options) {
372
+ const queryString = buildQueryString({ graphId: options.graphId });
373
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/crawl/jobs/${jobId}${queryString}`, {
374
+ method: "GET",
375
+ gatewayUrl: options.gatewayUrl,
376
+ jwtSecret: options.jwtSecret,
377
+ orgId: options.orgId,
378
+ userId: options.userId,
379
+ userEmail: options.userEmail,
380
+ timeout: options.timeout,
381
+ cache: options.cache
382
+ });
383
+ }
384
+ async function cancelCrawlJobServer(jobId, options) {
385
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/crawl/jobs/${jobId}/cancel`, {
386
+ method: "POST",
387
+ body: {},
388
+ gatewayUrl: options.gatewayUrl,
389
+ jwtSecret: options.jwtSecret,
390
+ orgId: options.orgId,
391
+ userId: options.userId,
392
+ userEmail: options.userEmail,
393
+ headers: buildHeaders(options.graphId),
394
+ timeout: options.timeout,
395
+ cache: options.cache
396
+ });
397
+ }
398
+ async function getCrawledPagesServer(jobId, options) {
399
+ const queryString = buildQueryString({ graphId: options.graphId });
400
+ return _server.serverApiRequest.call(void 0, `/api/v1/kg/crawl/jobs/${jobId}/pages${queryString}`, {
401
+ method: "GET",
402
+ gatewayUrl: options.gatewayUrl,
403
+ jwtSecret: options.jwtSecret,
404
+ orgId: options.orgId,
405
+ userId: options.userId,
406
+ userEmail: options.userEmail,
407
+ timeout: options.timeout,
408
+ cache: options.cache
409
+ });
410
+ }
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+ exports.cancelCrawlJobServer = cancelCrawlJobServer; exports.createDesignerEdgeServer = createDesignerEdgeServer; exports.createDesignerNodeServer = createDesignerNodeServer; exports.createGraphServer = createGraphServer; exports.deleteDesignerEdgeServer = deleteDesignerEdgeServer; exports.deleteDesignerNodeServer = deleteDesignerNodeServer; exports.deleteGraphServer = deleteGraphServer; exports.deleteKGDocumentServer = deleteKGDocumentServer; exports.getCrawlJobStatusServer = getCrawlJobStatusServer; exports.getCrawledPagesServer = getCrawledPagesServer; exports.getDesignerEdgeServer = getDesignerEdgeServer; exports.getDesignerNodeServer = getDesignerNodeServer; exports.getGraphLabelsServer = getGraphLabelsServer; exports.getGraphServer = getGraphServer; exports.getKGNodeServer = getKGNodeServer; exports.getNodeConnectionStatsServer = getNodeConnectionStatsServer; exports.ingestDocumentServer = ingestDocumentServer; exports.ingestKGNodeServer = ingestKGNodeServer; exports.listCrawlJobsServer = listCrawlJobsServer; exports.listDesignerEdgesServer = listDesignerEdgesServer; exports.listDesignerNodesServer = listDesignerNodesServer; exports.listGraphsServer = listGraphsServer; exports.optimizeGraphServer = optimizeGraphServer; exports.queryGraphServer = queryGraphServer; exports.startCrawlJobServer = startCrawlJobServer; exports.updateDesignerEdgeServer = updateDesignerEdgeServer; exports.updateDesignerNodeServer = updateDesignerNodeServer; exports.updateGraphServer = updateGraphServer; exports.updateKGNodeServer = updateKGNodeServer;
442
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages/@elqnt/kg/dist/api/server.js","../../api/server.ts"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACA;ACmBA,kDAAiC;AA4DjC,SAAS,gBAAA,CAAiB,MAAA,EAAoD;AAC5E,EAAA,MAAM,aAAA,EAAe,IAAI,eAAA,CAAgB,CAAA;AACzC,EAAA,IAAA,CAAA,MAAW,CAAC,GAAA,EAAK,KAAK,EAAA,GAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AACjD,IAAA,GAAA,CAAI,MAAA,IAAU,KAAA,CAAA,EAAW;AACvB,MAAA,YAAA,CAAa,GAAA,CAAI,GAAA,EAAK,KAAK,CAAA;AAAA,IAC7B;AAAA,EACF;AACA,EAAA,MAAM,YAAA,EAAc,YAAA,CAAa,QAAA,CAAS,CAAA;AAC1C,EAAA,OAAO,YAAA,EAAc,CAAA,CAAA,EAAI,WAAW,CAAA,EAAA;AACtC;AAK4E;AACzC,EAAA;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AAA;AACd,IAAA;AACY,IAAA;AACD,IAAA;AACJ,IAAA;AACC,IAAA;AACG,IAAA;AACF,IAAA;AACF,IAAA;AAChB,EAAA;AACH;AAME;AAGwB,EAAA;AACd,IAAA;AACD,IAAA;AACa,IAAA;AACD,IAAA;AACJ,IAAA;AACC,IAAA;AACG,IAAA;AACW,IAAA;AACb,IAAA;AACF,IAAA;AAChB,EAAA;AACH;AAME;AAGqC,EAAA;AACb,EAAA;AACd,IAAA;AACY,IAAA;AACD,IAAA;AACJ,IAAA;AACC,IAAA;AACG,IAAA;AACF,IAAA;AACF,IAAA;AAChB,EAAA;AACH;AD1UuC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/eloquent/eloquent/packages/@elqnt/kg/dist/api/server.js","sourcesContent":[null,"/**\n * Knowledge Graph Server API\n *\n * Server-side API client for KG operations in server actions and SSR.\n * Uses @elqnt/api-client/server for HTTP requests with JWT token generation.\n *\n * @example\n * ```ts\n * // In a server action\n * import { listGraphsServer } from \"@elqnt/kg/api/server\";\n *\n * const graphs = await listGraphsServer({\n * gatewayUrl: process.env.API_GATEWAY_URL!,\n * jwtSecret: process.env.JWT_SECRET!,\n * orgId: orgId,\n * });\n * ```\n *\n * @packageDocumentation\n */\n\nimport { serverApiRequest } from \"@elqnt/api-client/server\";\nimport type { ApiResponse } from \"@elqnt/api-client\";\nimport type { ResponseMetadata } from \"@elqnt/types\";\nimport type {\n Graph,\n ListGraphsResult,\n GetGraphResult,\n CreateGraphResult,\n CreateGraphRequest,\n UpdateGraphResult,\n DeleteGraphResult,\n KGNode,\n KGQuery,\n KGQueryResult,\n KGLabelInfo,\n KGNodeIngestRequest,\n KGSyncIngestResponse,\n DeleteDocumentResponse,\n GraphNodeDefinition,\n GraphNodeResponse,\n GraphEdgeDefinition,\n GraphEdgeResponse,\n} from \"../models\";\nimport type {\n CrawlJob,\n CrawlJobsListResponse,\n CrawlJobStatusResponse,\n CrawlJobStartResponse,\n CrawledPagesResponse,\n} from \"./index\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/**\n * Options for server-side KG API calls\n */\nexport interface ServerApiOptions {\n /** API Gateway URL */\n gatewayUrl: string;\n /** JWT secret for token generation */\n jwtSecret: string;\n /** Organization ID */\n orgId: string;\n /** Optional user ID (defaults to \"system\") */\n userId?: string;\n /** Optional user email */\n userEmail?: string;\n /** Optional graph ID for graph-scoped operations */\n graphId?: string;\n /** Request timeout in ms */\n timeout?: number;\n /** Request cache mode */\n cache?: RequestCache;\n}\n\n/**\n * Build query string from parameters, filtering out undefined values\n */\nfunction buildQueryString(params: Record<string, string | undefined>): string {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n searchParams.set(key, value);\n }\n }\n const queryString = searchParams.toString();\n return queryString ? `?${queryString}` : \"\";\n}\n\n/**\n * Build headers including X-Graph-ID if provided\n */\nfunction buildHeaders(graphId?: string): Record<string, string> | undefined {\n return graphId ? { \"X-Graph-ID\": graphId } : undefined;\n}\n\n// =============================================================================\n// GRAPHS\n// =============================================================================\n\n/**\n * List all knowledge graphs for the organization\n *\n * @example\n * ```ts\n * const response = await listGraphsServer({\n * gatewayUrl: \"http://api-gateway:80\",\n * jwtSecret: process.env.JWT_SECRET!,\n * orgId: \"org-123\",\n * });\n * if (response.data?.graphs) {\n * console.log(\"Graphs:\", response.data.graphs);\n * }\n * ```\n */\nexport async function listGraphsServer(\n options: ServerApiOptions\n): Promise<ApiResponse<ListGraphsResult>> {\n return serverApiRequest(\"/api/v1/kg/graphs\", {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Get a specific knowledge graph by ID\n */\nexport async function getGraphServer(\n graphId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<GetGraphResult>> {\n return serverApiRequest(`/api/v1/kg/graphs/${graphId}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Create a new knowledge graph\n */\nexport async function createGraphServer(\n graph: CreateGraphRequest,\n options: ServerApiOptions\n): Promise<ApiResponse<CreateGraphResult>> {\n return serverApiRequest(\"/api/v1/kg/graphs\", {\n method: \"POST\",\n body: graph,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Update an existing knowledge graph\n */\nexport async function updateGraphServer(\n graphId: string,\n updates: Partial<Graph>,\n options: ServerApiOptions\n): Promise<ApiResponse<UpdateGraphResult>> {\n return serverApiRequest(`/api/v1/kg/graphs/${graphId}`, {\n method: \"PUT\",\n body: updates,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Delete a knowledge graph\n */\nexport async function deleteGraphServer(\n graphId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<DeleteGraphResult>> {\n return serverApiRequest(`/api/v1/kg/graphs/${graphId}`, {\n method: \"DELETE\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n// =============================================================================\n// QUERY & LABELS\n// =============================================================================\n\n/**\n * Query knowledge graph nodes\n *\n * @example\n * ```ts\n * const response = await queryGraphServer(\n * { label: \"Person\", fields: [], limit: 10, depth: 1, sortBy: \"\", sortOrder: \"\" },\n * { gatewayUrl, jwtSecret, orgId, graphId }\n * );\n * ```\n */\nexport async function queryGraphServer(\n query: KGQuery,\n options: ServerApiOptions\n): Promise<ApiResponse<KGQueryResult>> {\n return serverApiRequest(\"/api/v1/kg/query\", {\n method: \"POST\",\n body: query,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout ?? 30000,\n cache: options.cache,\n });\n}\n\n/**\n * Get all node labels in the knowledge graph\n */\nexport async function getGraphLabelsServer(\n options: ServerApiOptions\n): Promise<ApiResponse<{ labels: KGLabelInfo[] }>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/labels${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n// =============================================================================\n// NODES\n// =============================================================================\n\n/**\n * Get a specific KG node by ID\n */\nexport async function getKGNodeServer(\n nodeId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<{ node: KGNode }>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/nodes/${nodeId}${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Ingest a new node into the knowledge graph\n */\nexport async function ingestKGNodeServer(\n node: KGNodeIngestRequest,\n options: ServerApiOptions\n): Promise<ApiResponse<KGSyncIngestResponse>> {\n return serverApiRequest(\"/api/v1/kg/nodes\", {\n method: \"POST\",\n body: node,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Update an existing KG node\n */\nexport async function updateKGNodeServer(\n nodeId: string,\n updates: Partial<KGNode>,\n options: ServerApiOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return serverApiRequest(`/api/v1/kg/nodes/${nodeId}`, {\n method: \"PUT\",\n body: updates,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Get connection statistics for a node\n */\nexport async function getNodeConnectionStatsServer(\n nodeId: string,\n edgeLabel: string,\n options: ServerApiOptions\n): Promise<ApiResponse<Record<string, number>>> {\n const queryString = buildQueryString({\n edgeLabel,\n graphId: options.graphId,\n });\n return serverApiRequest(`/api/v1/kg/nodes/${nodeId}/connections${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n// =============================================================================\n// DOCUMENTS\n// =============================================================================\n\n/**\n * Ingest a document into the knowledge graph\n */\nexport async function ingestDocumentServer(\n document: { id: string; title: string; content: string; docUrl?: string; lang?: string },\n options: ServerApiOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return serverApiRequest(\"/api/v1/kg/ingest\", {\n method: \"POST\",\n body: document,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout ?? 120000,\n cache: options.cache,\n });\n}\n\n/**\n * Delete a document from the knowledge graph\n */\nexport async function deleteKGDocumentServer(\n documentId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<DeleteDocumentResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/documents/${documentId}${queryString}`, {\n method: \"DELETE\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Optimize the knowledge graph\n */\nexport async function optimizeGraphServer(\n options: ServerApiOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return serverApiRequest(\"/api/v1/kg/graph/optimize\", {\n method: \"POST\",\n body: {},\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n// =============================================================================\n// DESIGNER - NODES\n// =============================================================================\n\n/**\n * List all node definitions in the graph designer\n */\nexport async function listDesignerNodesServer(\n options: ServerApiOptions\n): Promise<ApiResponse<GraphNodeResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/designer/nodes${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Get a specific node definition by label\n */\nexport async function getDesignerNodeServer(\n label: string,\n options: ServerApiOptions\n): Promise<ApiResponse<GraphNodeResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/designer/nodes/${label}${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Create a new node definition\n */\nexport async function createDesignerNodeServer(\n node: Omit<GraphNodeDefinition, \"createdAt\" | \"updatedAt\">,\n options: ServerApiOptions\n): Promise<ApiResponse<GraphNodeResponse>> {\n return serverApiRequest(\"/api/v1/kg/designer/nodes\", {\n method: \"POST\",\n body: { node },\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Update an existing node definition\n */\nexport async function updateDesignerNodeServer(\n label: string,\n node: Partial<GraphNodeDefinition>,\n options: ServerApiOptions\n): Promise<ApiResponse<GraphNodeResponse>> {\n return serverApiRequest(`/api/v1/kg/designer/nodes/${label}`, {\n method: \"PUT\",\n body: { node },\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Delete a node definition\n */\nexport async function deleteDesignerNodeServer(\n label: string,\n options: ServerApiOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/designer/nodes/${label}${queryString}`, {\n method: \"DELETE\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n// =============================================================================\n// DESIGNER - EDGES\n// =============================================================================\n\n/**\n * List all edge definitions in the graph designer\n */\nexport async function listDesignerEdgesServer(\n options: ServerApiOptions\n): Promise<ApiResponse<GraphEdgeResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/designer/edges${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Get a specific edge definition by label\n */\nexport async function getDesignerEdgeServer(\n label: string,\n options: ServerApiOptions\n): Promise<ApiResponse<GraphEdgeResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/designer/edges/${label}${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Create a new edge definition\n */\nexport async function createDesignerEdgeServer(\n edge: Omit<GraphEdgeDefinition, \"createdAt\" | \"updatedAt\">,\n options: ServerApiOptions\n): Promise<ApiResponse<GraphEdgeResponse>> {\n return serverApiRequest(\"/api/v1/kg/designer/edges\", {\n method: \"POST\",\n body: { edge },\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Update an existing edge definition\n */\nexport async function updateDesignerEdgeServer(\n label: string,\n edge: Partial<GraphEdgeDefinition>,\n options: ServerApiOptions\n): Promise<ApiResponse<GraphEdgeResponse>> {\n return serverApiRequest(`/api/v1/kg/designer/edges/${label}`, {\n method: \"PUT\",\n body: { edge },\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Delete an edge definition\n */\nexport async function deleteDesignerEdgeServer(\n label: string,\n options: ServerApiOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/designer/edges/${label}${queryString}`, {\n method: \"DELETE\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n// =============================================================================\n// CRAWL JOBS\n// =============================================================================\n\n/**\n * List crawl jobs\n */\nexport async function listCrawlJobsServer(\n options: ServerApiOptions & { limit?: number; offset?: number; status?: string }\n): Promise<ApiResponse<CrawlJobsListResponse>> {\n const queryString = buildQueryString({\n graphId: options.graphId,\n limit: options.limit?.toString(),\n offset: options.offset?.toString(),\n status: options.status,\n });\n return serverApiRequest(`/api/v1/kg/crawl/jobs${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Start a new crawl job\n */\nexport async function startCrawlJobServer(\n params: { baseUrl: string; depth: number; maxPages: number },\n options: ServerApiOptions\n): Promise<ApiResponse<CrawlJobStartResponse>> {\n return serverApiRequest(\"/api/v1/kg/crawl/jobs\", {\n method: \"POST\",\n body: params,\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Get crawl job status\n */\nexport async function getCrawlJobStatusServer(\n jobId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<CrawlJobStatusResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/crawl/jobs/${jobId}${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Cancel a crawl job\n */\nexport async function cancelCrawlJobServer(\n jobId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<CrawlJobStatusResponse>> {\n return serverApiRequest(`/api/v1/kg/crawl/jobs/${jobId}/cancel`, {\n method: \"POST\",\n body: {},\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n headers: buildHeaders(options.graphId),\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n\n/**\n * Get pages crawled by a job\n */\nexport async function getCrawledPagesServer(\n jobId: string,\n options: ServerApiOptions\n): Promise<ApiResponse<CrawledPagesResponse>> {\n const queryString = buildQueryString({ graphId: options.graphId });\n return serverApiRequest(`/api/v1/kg/crawl/jobs/${jobId}/pages${queryString}`, {\n method: \"GET\",\n gatewayUrl: options.gatewayUrl,\n jwtSecret: options.jwtSecret,\n orgId: options.orgId,\n userId: options.userId,\n userEmail: options.userEmail,\n timeout: options.timeout,\n cache: options.cache,\n });\n}\n"]}