@stackfactor/client-api 1.19.3 → 1.20.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 (87) hide show
  1. package/dist/cjs/lib/constants.d.ts +2 -1
  2. package/dist/cjs/lib/constants.d.ts.map +1 -1
  3. package/dist/cjs/lib/constants.js +3 -1
  4. package/dist/cjs/lib/constants.js.map +1 -1
  5. package/dist/cjs/lib/knowledgeAssessmentAttempts.d.ts +22 -0
  6. package/dist/cjs/lib/knowledgeAssessmentAttempts.d.ts.map +1 -1
  7. package/dist/cjs/lib/knowledgeAssessmentAttempts.js +44 -1
  8. package/dist/cjs/lib/knowledgeAssessmentAttempts.js.map +1 -1
  9. package/dist/cjs/lib/knowledgeBase/documents.d.ts +127 -0
  10. package/dist/cjs/lib/knowledgeBase/documents.d.ts.map +1 -0
  11. package/dist/cjs/lib/knowledgeBase/documents.js +114 -0
  12. package/dist/cjs/lib/knowledgeBase/documents.js.map +1 -0
  13. package/dist/cjs/lib/knowledgeBase/knowledgeBases.d.ts +118 -0
  14. package/dist/cjs/lib/knowledgeBase/knowledgeBases.d.ts.map +1 -0
  15. package/dist/cjs/lib/knowledgeBase/knowledgeBases.js +256 -0
  16. package/dist/cjs/lib/knowledgeBase/knowledgeBases.js.map +1 -0
  17. package/dist/cjs/lib/knowledgeBase/review.d.ts +184 -0
  18. package/dist/cjs/lib/knowledgeBase/review.d.ts.map +1 -0
  19. package/dist/cjs/lib/knowledgeBase/review.js +413 -0
  20. package/dist/cjs/lib/knowledgeBase/review.js.map +1 -0
  21. package/dist/cjs/lib/knowledgeBase/skills.d.ts +247 -0
  22. package/dist/cjs/lib/knowledgeBase/skills.d.ts.map +1 -0
  23. package/dist/cjs/lib/knowledgeBase/skills.js +199 -0
  24. package/dist/cjs/lib/knowledgeBase/skills.js.map +1 -0
  25. package/dist/cjs/lib/knowledgeBase/sources.d.ts +136 -0
  26. package/dist/cjs/lib/knowledgeBase/sources.d.ts.map +1 -0
  27. package/dist/cjs/lib/knowledgeBase/sources.js +234 -0
  28. package/dist/cjs/lib/knowledgeBase/sources.js.map +1 -0
  29. package/dist/cjs/lib/knowledgeBase.d.ts +5 -785
  30. package/dist/cjs/lib/knowledgeBase.d.ts.map +1 -1
  31. package/dist/cjs/lib/knowledgeBase.js +32 -1229
  32. package/dist/cjs/lib/knowledgeBase.js.map +1 -1
  33. package/dist/cjs/lib/knowledgeBaseAgent.d.ts +33 -1
  34. package/dist/cjs/lib/knowledgeBaseAgent.d.ts.map +1 -1
  35. package/dist/cjs/lib/knowledgeBaseAgent.js +18 -3
  36. package/dist/cjs/lib/knowledgeBaseAgent.js.map +1 -1
  37. package/dist/cjs/lib/learningContent.d.ts.map +1 -1
  38. package/dist/cjs/lib/learningContent.js +12 -2
  39. package/dist/cjs/lib/learningContent.js.map +1 -1
  40. package/dist/cjs/lib/learningContentCohorts.d.ts +80 -0
  41. package/dist/cjs/lib/learningContentCohorts.d.ts.map +1 -1
  42. package/dist/cjs/lib/learningContentCohorts.js +80 -1
  43. package/dist/cjs/lib/learningContentCohorts.js.map +1 -1
  44. package/dist/esm/lib/constants.d.ts +2 -1
  45. package/dist/esm/lib/constants.d.ts.map +1 -1
  46. package/dist/esm/lib/constants.js +3 -1
  47. package/dist/esm/lib/constants.js.map +1 -1
  48. package/dist/esm/lib/knowledgeAssessmentAttempts.d.ts +22 -0
  49. package/dist/esm/lib/knowledgeAssessmentAttempts.d.ts.map +1 -1
  50. package/dist/esm/lib/knowledgeAssessmentAttempts.js +40 -0
  51. package/dist/esm/lib/knowledgeAssessmentAttempts.js.map +1 -1
  52. package/dist/esm/lib/knowledgeBase/documents.d.ts +127 -0
  53. package/dist/esm/lib/knowledgeBase/documents.d.ts.map +1 -0
  54. package/dist/esm/lib/knowledgeBase/documents.js +107 -0
  55. package/dist/esm/lib/knowledgeBase/documents.js.map +1 -0
  56. package/dist/esm/lib/knowledgeBase/knowledgeBases.d.ts +118 -0
  57. package/dist/esm/lib/knowledgeBase/knowledgeBases.d.ts.map +1 -0
  58. package/dist/esm/lib/knowledgeBase/knowledgeBases.js +242 -0
  59. package/dist/esm/lib/knowledgeBase/knowledgeBases.js.map +1 -0
  60. package/dist/esm/lib/knowledgeBase/review.d.ts +184 -0
  61. package/dist/esm/lib/knowledgeBase/review.d.ts.map +1 -0
  62. package/dist/esm/lib/knowledgeBase/review.js +392 -0
  63. package/dist/esm/lib/knowledgeBase/review.js.map +1 -0
  64. package/dist/esm/lib/knowledgeBase/skills.d.ts +247 -0
  65. package/dist/esm/lib/knowledgeBase/skills.d.ts.map +1 -0
  66. package/dist/esm/lib/knowledgeBase/skills.js +189 -0
  67. package/dist/esm/lib/knowledgeBase/skills.js.map +1 -0
  68. package/dist/esm/lib/knowledgeBase/sources.d.ts +136 -0
  69. package/dist/esm/lib/knowledgeBase/sources.d.ts.map +1 -0
  70. package/dist/esm/lib/knowledgeBase/sources.js +221 -0
  71. package/dist/esm/lib/knowledgeBase/sources.js.map +1 -0
  72. package/dist/esm/lib/knowledgeBase.d.ts +5 -785
  73. package/dist/esm/lib/knowledgeBase.d.ts.map +1 -1
  74. package/dist/esm/lib/knowledgeBase.js +18 -1175
  75. package/dist/esm/lib/knowledgeBase.js.map +1 -1
  76. package/dist/esm/lib/knowledgeBaseAgent.d.ts +33 -1
  77. package/dist/esm/lib/knowledgeBaseAgent.d.ts.map +1 -1
  78. package/dist/esm/lib/knowledgeBaseAgent.js +16 -2
  79. package/dist/esm/lib/knowledgeBaseAgent.js.map +1 -1
  80. package/dist/esm/lib/learningContent.d.ts.map +1 -1
  81. package/dist/esm/lib/learningContent.js +12 -2
  82. package/dist/esm/lib/learningContent.js.map +1 -1
  83. package/dist/esm/lib/learningContentCohorts.d.ts +80 -0
  84. package/dist/esm/lib/learningContentCohorts.d.ts.map +1 -1
  85. package/dist/esm/lib/learningContentCohorts.js +66 -0
  86. package/dist/esm/lib/learningContentCohorts.js.map +1 -1
  87. package/package.json +1 -3
@@ -1,1178 +1,21 @@
1
- import { client } from "./axiosClient.js";
2
- // ── Knowledge Base CRUD ───────────────────────────────────────────────────────
3
- /**
4
- * List the knowledge bases the caller can see.
5
- * GET /api/v1/knowledge-base
6
- * @param {String} authToken Authentication token
7
- * @returns {Promise<object>}
8
- */
9
- export const listKnowledgeBases = (authToken) => {
10
- return new Promise((resolve, reject) => {
11
- const request = client.get(`/api/v1/knowledge-base`, {
12
- headers: { authorization: authToken },
13
- });
14
- request
15
- .then((response) => {
16
- resolve(response.data);
17
- })
18
- .catch((error) => {
19
- reject(error);
20
- });
21
- });
22
- };
23
- /**
24
- * Create a knowledge base (the creator becomes owner automatically). Requires the
25
- * global CREATE_KNOWLEDGE_BASE capability.
26
- * POST /api/v1/knowledge-base
27
- * @param {KnowledgeBaseInput} data KB metadata (at minimum `name`)
28
- * @param {String} authToken Authentication token
29
- * @returns {Promise<object>}
30
- */
31
- export const createKnowledgeBase = (data, authToken) => {
32
- return new Promise((resolve, reject) => {
33
- const request = client.post(`/api/v1/knowledge-base`, data, {
34
- headers: { authorization: authToken },
35
- });
36
- request
37
- .then((response) => {
38
- resolve(response.data);
39
- })
40
- .catch((error) => {
41
- reject(error);
42
- });
43
- });
44
- };
45
- /**
46
- * Get a single knowledge base (plus stats).
47
- * GET /api/v1/knowledge-base/:id
48
- * @param {String} id The knowledge base id
49
- * @param {String} authToken Authentication token
50
- * @returns {Promise<object>}
51
- */
52
- export const getKnowledgeBase = (id, authToken) => {
53
- return new Promise((resolve, reject) => {
54
- const request = client.get(`/api/v1/knowledge-base/${id}`, {
55
- headers: { authorization: authToken },
56
- });
57
- request
58
- .then((response) => {
59
- resolve(response.data);
60
- })
61
- .catch((error) => {
62
- reject(error);
63
- });
64
- });
65
- };
66
- /**
67
- * Update a knowledge base's metadata. Owner or editor only. Does not touch
68
- * `access[]`, `sources`, or `createdBy` — those have their own gated flows.
69
- * PUT /api/v1/knowledge-base/:id
70
- * @param {String} id The knowledge base id
71
- * @param {KnowledgeBaseInput} data The fields to update
72
- * @param {String} authToken Authentication token
73
- * @returns {Promise<object>}
74
- */
75
- export const updateKnowledgeBase = (id, data, authToken) => {
76
- return new Promise((resolve, reject) => {
77
- const request = client.put(`/api/v1/knowledge-base/${id}`, data, {
78
- headers: { authorization: authToken },
79
- });
80
- request
81
- .then((response) => {
82
- resolve(response.data);
83
- })
84
- .catch((error) => {
85
- reject(error);
86
- });
87
- });
88
- };
89
- /**
90
- * Delete a knowledge base (cascades to its chunks). Owner only.
91
- * DELETE /api/v1/knowledge-base/:id
92
- * @param {String} id The knowledge base id
93
- * @param {String} authToken Authentication token
94
- * @returns {Promise<object>}
95
- */
96
- export const deleteKnowledgeBase = (id, authToken) => {
97
- return new Promise((resolve, reject) => {
98
- const request = client.delete(`/api/v1/knowledge-base/${id}`, {
99
- headers: { authorization: authToken },
100
- });
101
- request
102
- .then((response) => {
103
- resolve(response.data);
104
- })
105
- .catch((error) => {
106
- reject(error);
107
- });
108
- });
109
- };
110
- // ── Source Management ─────────────────────────────────────────────────────────
111
- /**
112
- * List the available KB_SOURCE_CONNECTOR integrations (enabled integrations +
113
- * capability manifests for the source-creation form).
114
- * GET /api/v1/knowledge-base/source-connectors
115
- * @param {String} authToken Authentication token
116
- * @returns {Promise<object>}
117
- */
118
- export const listSourceConnectors = (authToken) => {
119
- return new Promise((resolve, reject) => {
120
- const request = client.get(`/api/v1/knowledge-base/source-connectors`, {
121
- headers: { authorization: authToken },
122
- });
123
- request
124
- .then((response) => {
125
- resolve(response.data);
126
- })
127
- .catch((error) => {
128
- reject(error);
129
- });
130
- });
131
- };
132
1
  //
133
- // Between `listSourceConnectors` and `addSource` sit three calls that act on the
134
- // CONNECTOR itself rather than on a knowledge base — asking it what it accepts,
135
- // how the user signs in, and how much data is behind the resulting credentials.
136
- // Those live in the `knowledgeBaseSourceConnectors` module (they take a
137
- // connection id, not a KB id, and are mounted under
138
- // /api/v1/exceed/knowledgebasesourceconnectors).
2
+ // Knowledge Base management operations.
139
3
  //
140
- /**
141
- * Add a source to a knowledge base (`integrationId` + credentials +
142
- * `syncFrequencyDays`, default 7). Publishes a kb-source-event (changeType="add").
143
- * POST /api/v1/knowledge-base/:id/sources
144
- * @param {String} id The knowledge base id
145
- * @param {object} source The source configuration
146
- * @param {String} authToken Authentication token
147
- * @returns {Promise<object>}
148
- */
149
- export const addSource = (id, source, authToken) => {
150
- return new Promise((resolve, reject) => {
151
- const request = client.post(`/api/v1/knowledge-base/${id}/sources`, source, { headers: { authorization: authToken } });
152
- request
153
- .then((response) => {
154
- resolve(response.data);
155
- })
156
- .catch((error) => {
157
- reject(error);
158
- });
159
- });
160
- };
161
- /**
162
- * Update a knowledge base source. Publishes a kb-source-event per changed source.
163
- * PUT /api/v1/knowledge-base/:id/sources/:sourceId
164
- * @param {String} id The knowledge base id
165
- * @param {String} sourceId The source id
166
- * @param {object} source The updated source configuration
167
- * @param {String} authToken Authentication token
168
- * @returns {Promise<object>}
169
- */
170
- export const updateSource = (id, sourceId, source, authToken) => {
171
- return new Promise((resolve, reject) => {
172
- const request = client.put(`/api/v1/knowledge-base/${id}/sources/${sourceId}`, source, { headers: { authorization: authToken } });
173
- request
174
- .then((response) => {
175
- resolve(response.data);
176
- })
177
- .catch((error) => {
178
- reject(error);
179
- });
180
- });
181
- };
182
- /**
183
- * Remove a source from a knowledge base. Publishes a kb-source-event
184
- * (changeType="delete").
185
- * DELETE /api/v1/knowledge-base/:id/sources/:sourceId
186
- * @param {String} id The knowledge base id
187
- * @param {String} sourceId The source id
188
- * @param {String} authToken Authentication token
189
- * @returns {Promise<object>}
190
- */
191
- export const deleteSource = (id, sourceId, authToken) => {
192
- return new Promise((resolve, reject) => {
193
- const request = client.delete(`/api/v1/knowledge-base/${id}/sources/${sourceId}`, { headers: { authorization: authToken } });
194
- request
195
- .then((response) => {
196
- resolve(response.data);
197
- })
198
- .catch((error) => {
199
- reject(error);
200
- });
201
- });
202
- };
203
- /**
204
- * Trigger a manual re-sync of a source. Publishes a kb-source-event
205
- * (changeType="update", trigger="manual_sync").
206
- * POST /api/v1/knowledge-base/:id/sources/:sourceId/sync
207
- * @param {String} id The knowledge base id
208
- * @param {String} sourceId The source id
209
- * @param {String} authToken Authentication token
210
- * @returns {Promise<object>}
211
- */
212
- export const syncSource = (id, sourceId, authToken) => {
213
- return new Promise((resolve, reject) => {
214
- const request = client.post(`/api/v1/knowledge-base/${id}/sources/${sourceId}/sync`, {}, { headers: { authorization: authToken } });
215
- request
216
- .then((response) => {
217
- resolve(response.data);
218
- })
219
- .catch((error) => {
220
- reject(error);
221
- });
222
- });
223
- };
224
- /**
225
- * Process every processed document of a source again — classification, labels,
226
- * chunks and embeddings redone — on a run of the source. Quarantined and blocked
227
- * documents are left as they are. A run starts now, or a follow-up run is owed
228
- * while one is outstanding (trigger="reprocess").
229
- * POST /api/v1/knowledge-base/:id/sources/:sourceId/reprocess
230
- * @param {String} id The knowledge base id
231
- * @param {String} sourceId The source id
232
- * @param {String} authToken Authentication token
233
- * @returns {Promise<object>} { ok, documents, correlationId, started }: how many
234
- * documents were marked, the run, and whether it started now
235
- */
236
- export const reprocessSource = (id, sourceId, authToken) => {
237
- return new Promise((resolve, reject) => {
238
- const request = client.post(`/api/v1/knowledge-base/${id}/sources/${sourceId}/reprocess`, {}, { headers: { authorization: authToken } });
239
- request
240
- .then((response) => {
241
- resolve(response.data);
242
- })
243
- .catch((error) => {
244
- reject(error);
245
- });
246
- });
247
- };
248
- /**
249
- * Test a source's connector credentials (dispatches TEST_CONNECTION).
250
- * POST /api/v1/knowledge-base/:id/sources/:sourceId/test
251
- * @param {String} id The knowledge base id
252
- * @param {String} sourceId The source id
253
- * @param {String} authToken Authentication token
254
- * @returns {Promise<object>}
255
- */
256
- export const testSource = (id, sourceId, authToken) => {
257
- return new Promise((resolve, reject) => {
258
- const request = client.post(`/api/v1/knowledge-base/${id}/sources/${sourceId}/test`, {}, { headers: { authorization: authToken } });
259
- request
260
- .then((response) => {
261
- resolve(response.data);
262
- })
263
- .catch((error) => {
264
- reject(error);
265
- });
266
- });
267
- };
268
- // ── Document Management ───────────────────────────────────────────────────────
269
- /**
270
- * List a knowledge base's documents (paginated, with status + lastSync). There is
271
- * no upload endpoint — documents are only ingested via configured sources.
272
- * GET /api/v1/knowledge-base/:id/documents
273
- * @param {String} id The knowledge base id
274
- * @param {DocumentListParams} params Optional pagination / status filters
275
- * @param {String} authToken Authentication token
276
- * @returns {Promise<object>}
277
- */
278
- export const listDocuments = (id, params, authToken) => {
279
- return new Promise((resolve, reject) => {
280
- const request = client.get(`/api/v1/knowledge-base/${id}/documents`, {
281
- headers: { authorization: authToken },
282
- params: params,
283
- });
284
- request
285
- .then((response) => {
286
- resolve(response.data);
287
- })
288
- .catch((error) => {
289
- reject(error);
290
- });
291
- });
292
- };
293
- /**
294
- * Get one knowledge base document and what the RAG holds for it: its chunks,
295
- * after redaction, in order (the first 1000; `truncated` says when there are
296
- * more). No chunks while the document is not processed, or is held for review
297
- * or blocked. Needs the knowledge base access search needs, and the
298
- * document's own source permissions (403); 404 when either is missing.
299
- * GET /api/v1/knowledge-base/:id/documents/:docId
300
- * @param {String} id The knowledge base id
301
- * @param {String} docId The document id
302
- * @param {String} authToken Authentication token
303
- * @returns {Promise<KnowledgeBaseDocumentContent>}
304
- */
305
- export const getDocument = (id, docId, authToken) => {
306
- return new Promise((resolve, reject) => {
307
- const request = client.get(`/api/v1/knowledge-base/${id}/documents/${docId}`, { headers: { authorization: authToken } });
308
- request
309
- .then((response) => {
310
- resolve(response.data);
311
- })
312
- .catch((error) => {
313
- reject(error);
314
- });
315
- });
316
- };
317
- /**
318
- * Get the picture of one image passage (chunk) of a knowledge base document,
319
- * for the document's page: a chunk `getDocument` answered with `hasImage`.
320
- * Its preview unless `size` is "full", which is the stored original (often
321
- * several MB: ask for it only to show the picture full size). The same access
322
- * as `getDocument` applies (403), and only while its chunks are shown; 404
323
- * when the passage has no picture to show. Answered `private, no-cache`, so
324
- * the platform judges access each time it is asked.
325
- * GET /api/v1/knowledge-base/:id/documents/:docId/chunks/:chunkId/image[?size=full]
326
- * @param {String} id The knowledge base id
327
- * @param {String} docId The document id
328
- * @param {String} chunkId The image chunk id
329
- * @param {String} authToken Authentication token
330
- * @param {DocumentImageSize} size Optional: "full" for the stored original;
331
- * the preview otherwise
332
- * @returns {Promise<Blob>} The picture, typed by what it is: the preview is
333
- * WebP, or the original's own type when no preview could be made; the full
334
- * picture is the original's type
335
- */
336
- export const getDocumentImage = (id, docId, chunkId, authToken, size) => {
337
- return new Promise((resolve, reject) => {
338
- const request = client.get(`/api/v1/knowledge-base/${id}/documents/${docId}/chunks/${chunkId}/image`, {
339
- headers: { authorization: authToken },
340
- responseType: "blob",
341
- ...(size ? { params: { size } } : {}),
342
- });
343
- request
344
- .then((response) => {
345
- resolve(response.data);
346
- })
347
- .catch((error) => {
348
- reject(error);
349
- });
350
- });
351
- };
352
- /**
353
- * List the skills a knowledge base's content was labelled with, across its
354
- * processed documents, most named first: `{ items, total, limit }`, each item
355
- * `{ name, nameNormalized, scope, proficiencyLevels, documentCount }`, where
356
- * `scope` is "organization", "general" or null (labelled before skills had one).
357
- * GET /api/v1/knowledge-base/:id/skills
358
- * @param {String} id The knowledge base id
359
- * @param {SkillListParams} params Optional limit
360
- * @param {String} authToken Authentication token
361
- * @returns {Promise<object>}
362
- */
363
- export const listSkills = (id, params, authToken) => {
364
- return new Promise((resolve, reject) => {
365
- const request = client.get(`/api/v1/knowledge-base/${id}/skills`, {
366
- headers: { authorization: authToken },
367
- params: params,
368
- });
369
- request
370
- .then((response) => {
371
- resolve(response.data);
372
- })
373
- .catch((error) => {
374
- reject(error);
375
- });
376
- });
377
- };
378
- /**
379
- * Set how a knowledge base's skills are named, and rename them on every
380
- * document and chunk already labelled; every document labelled later takes
381
- * them too. The mappings replace the ones before; an empty list gives back
382
- * every skill as labelling named it. Owner or editor only; refused while a sync
383
- * of one of its sources is under way (409) and for mappings that do not hold —
384
- * a skill mapped twice, or mappings that lead a skill back to itself (400).
385
- * PUT /api/v1/knowledge-base/:id/skill-mappings
386
- * @param {String} id The knowledge base id
387
- * @param {SkillMapping[]} skillMappings The mappings, `[{ from, to }]`
388
- * @param {String} authToken Authentication token
389
- * @returns {Promise<object>} { knowledgeBase, documents, chunks }: the knowledge
390
- * base with the mappings as stored, and how many documents and chunks were
391
- * rewritten
392
- */
393
- export const setSkillMappings = (id, skillMappings, authToken) => {
394
- return new Promise((resolve, reject) => {
395
- const request = client.put(`/api/v1/knowledge-base/${id}/skill-mappings`, { skillMappings }, { headers: { authorization: authToken } });
396
- request
397
- .then((response) => {
398
- resolve(response.data);
399
- })
400
- .catch((error) => {
401
- reject(error);
402
- });
403
- });
404
- };
405
- /**
406
- * What the knowledge bases the caller can open hold about one skill: how many
407
- * of their documents name it (any spelling, under the names set with Edit
408
- * skill names), in which knowledge bases, and the microskills their passages
409
- * cover. The skill and skill template Additional Information dialogs ask it
410
- * before they offer StackFactor as a data source. Only what the caller may
411
- * open counts: their role on each knowledge base and each document's source
412
- * permissions decide. Requires VIEW_KNOWLEDGE_BASE; the name must be 1 to 200
413
- * characters (400 otherwise).
414
- * GET /api/v1/knowledge-base/skill-coverage
415
- * @param {String} skill The skill's or skill template's name
416
- * @param {String} authToken Authentication token
417
- * @returns {Promise<SkillCoverage>}
418
- */
419
- export const getSkillCoverage = (skill, authToken) => {
420
- return new Promise((resolve, reject) => {
421
- const request = client.get(`/api/v1/knowledge-base/skill-coverage`, {
422
- headers: { authorization: authToken },
423
- params: { skill },
424
- });
425
- request
426
- .then((response) => {
427
- resolve(response.data);
428
- })
429
- .catch((error) => {
430
- reject(error);
431
- });
432
- });
433
- };
434
- /**
435
- * The skill names the knowledge bases the caller can open suggest while a
436
- * skill's or skill template's name is typed: the skills their documents were
437
- * classified with whose name has a word starting with what was typed, in any
438
- * spelling ("gov" suggests "AI Governance"), one per skill, most documents
439
- * first. Only what the caller may open counts, as for `getSkillCoverage`.
440
- * Fewer than 2 characters to match answer no suggestions. Requires
441
- * VIEW_KNOWLEDGE_BASE; `q` is at most 200 characters (400 otherwise).
442
- * GET /api/v1/knowledge-base/skill-suggestions
443
- * @param {String} q What was typed
444
- * @param {SkillSuggestionParams} params Optional limit, catalog and the id of
445
- * the skill or skill template being edited
446
- * @param {String} authToken Authentication token
447
- * @returns {Promise<SkillSuggestion[]>}
448
- */
449
- export const getSkillSuggestions = (q, params, authToken) => {
450
- return new Promise((resolve, reject) => {
451
- const request = client.get(`/api/v1/knowledge-base/skill-suggestions`, {
452
- headers: { authorization: authToken },
453
- params: { ...params, q },
454
- });
455
- request
456
- .then((response) => {
457
- resolve(response.data);
458
- })
459
- .catch((error) => {
460
- reject(error);
461
- });
462
- });
463
- };
464
- /**
465
- * One of a knowledge base's skills, opened on its page: its microskills, as
466
- * grouped, each with how many passages teach it, most first, and where the
467
- * knowledge base's grouping stands (`grouping`). Any spelling of the skill
468
- * matches. Requires VIEW_KNOWLEDGE_BASE and a role on the knowledge base; the
469
- * name must be 1 to 200 characters (400 otherwise).
470
- * GET /api/v1/knowledge-base/:id/skills/micro-skills
471
- * @param {String} id The knowledge base id
472
- * @param {String} skill The skill's name
473
- * @param {String} authToken Authentication token
474
- * @returns {Promise<KnowledgeBaseMicroSkills>}
475
- */
476
- export const listMicroSkills = (id, skill, authToken) => {
477
- return new Promise((resolve, reject) => {
478
- const request = client.get(`/api/v1/knowledge-base/${id}/skills/micro-skills`, {
479
- headers: { authorization: authToken },
480
- params: { skill },
481
- });
482
- request
483
- .then((response) => {
484
- resolve(response.data);
485
- })
486
- .catch((error) => {
487
- reject(error);
488
- });
489
- });
490
- };
491
- /**
492
- * Where a knowledge base's microskill grouping stands: queued, running or
493
- * idle, and when the last one ended. What a page polls while a grouping is
494
- * under way, rather than `listMicroSkills`: the platform reads the knowledge
495
- * base and nothing else. Requires VIEW_KNOWLEDGE_BASE and a role on the
496
- * knowledge base.
497
- * GET /api/v1/knowledge-base/:id/skills/micro-skills/grouping
498
- * @param {String} id The knowledge base id
499
- * @param {String} authToken Authentication token
500
- * @returns {Promise<KnowledgeBaseMicroSkillGrouping>}
501
- */
502
- export const getMicroSkillGrouping = (id, authToken) => {
503
- return new Promise((resolve, reject) => {
504
- const request = client.get(`/api/v1/knowledge-base/${id}/skills/micro-skills/grouping`, { headers: { authorization: authToken } });
505
- request
506
- .then((response) => {
507
- resolve(response.data);
508
- })
509
- .catch((error) => {
510
- reject(error);
511
- });
512
- });
513
- };
514
- /**
515
- * Group now: groups the knowledge base's skills' passage tags into their
516
- * microskills, in the background. Owner or editor only, as setting how its
517
- * skills are named (403 otherwise; 404 for no such knowledge base). Asked
518
- * while a grouping runs, nothing more is asked: the answer is that it is
519
- * running. `getMicroSkillGrouping` says when it is done (no longer queued or
520
- * running). The skills whose grouping failed are sent again now.
521
- * POST /api/v1/knowledge-base/:id/skills/micro-skills/group
522
- * @param {String} id The knowledge base id
523
- * @param {String} authToken Authentication token
524
- * @returns {Promise<KnowledgeBaseMicroSkillGrouping>} Where the grouping
525
- * stands: queued or running, and when the last one ended
526
- */
527
- export const groupMicroSkills = (id, authToken) => {
528
- return new Promise((resolve, reject) => {
529
- const request = client.post(`/api/v1/knowledge-base/${id}/skills/micro-skills/group`, {}, { headers: { authorization: authToken } });
530
- request
531
- .then((response) => {
532
- resolve(response.data);
533
- })
534
- .catch((error) => {
535
- reject(error);
536
- });
537
- });
538
- };
539
- /**
540
- * Delete a single document (cascades to chunks + S3 images + dependent entity
541
- * flags).
542
- * DELETE /api/v1/knowledge-base/:id/documents/:docId
543
- * @param {String} id The knowledge base id
544
- * @param {String} docId The document id
545
- * @param {String} authToken Authentication token
546
- * @returns {Promise<object>}
547
- */
548
- export const deleteDocument = (id, docId, authToken) => {
549
- return new Promise((resolve, reject) => {
550
- const request = client.delete(`/api/v1/knowledge-base/${id}/documents/${docId}`, { headers: { authorization: authToken } });
551
- request
552
- .then((response) => {
553
- resolve(response.data);
554
- })
555
- .catch((error) => {
556
- reject(error);
557
- });
558
- });
559
- };
560
- // ── KB Access Management (owner only) ─────────────────────────────────────────
561
- /**
562
- * List a knowledge base's access entries.
563
- * GET /api/v1/knowledge-base/:id/access
564
- * @param {String} id The knowledge base id
565
- * @param {String} authToken Authentication token
566
- * @returns {Promise<object>}
567
- */
568
- export const listAccess = (id, authToken) => {
569
- return new Promise((resolve, reject) => {
570
- const request = client.get(`/api/v1/knowledge-base/${id}/access`, {
571
- headers: { authorization: authToken },
572
- });
573
- request
574
- .then((response) => {
575
- resolve(response.data);
576
- })
577
- .catch((error) => {
578
- reject(error);
579
- });
580
- });
581
- };
582
- /**
583
- * Grant (upsert) an access entry. Owner only. Access is keyed by
584
- * `(subjectType, subjectId)`, so re-granting a subject that already has an entry
585
- * updates its role — there is no separate "update role" endpoint.
586
- * POST /api/v1/knowledge-base/:id/access
587
- * @param {String} id The knowledge base id
588
- * @param {AccessEntryInput} entry The `{ subjectType, subjectId, role }` grant
589
- * @param {String} authToken Authentication token
590
- * @returns {Promise<object>}
591
- */
592
- export const grantAccess = (id, entry, authToken) => {
593
- return new Promise((resolve, reject) => {
594
- const request = client.post(`/api/v1/knowledge-base/${id}/access`, entry, {
595
- headers: { authorization: authToken },
596
- });
597
- request
598
- .then((response) => {
599
- resolve(response.data);
600
- })
601
- .catch((error) => {
602
- reject(error);
603
- });
604
- });
605
- };
606
- /**
607
- * Revoke a subject's access. Owner only. Keyed by `(subjectType, subjectId)` — the
608
- * same composite key `grantAccess` upserts on. The backend refuses to remove the
609
- * last owner.
610
- * DELETE /api/v1/knowledge-base/:id/access
611
- * @param {String} id The knowledge base id
612
- * @param {String} subjectType One of `KNOWLEDGE_BASE.SUBJECT_TYPE`
613
- * @param {String} subjectId The subject whose access is revoked
614
- * @param {String} authToken Authentication token
615
- * @returns {Promise<object>}
616
- */
617
- export const revokeAccess = (id, subjectType, subjectId, authToken) => {
618
- return new Promise((resolve, reject) => {
619
- const request = client.delete(`/api/v1/knowledge-base/${id}/access`, {
620
- headers: { authorization: authToken },
621
- data: { subjectType: subjectType, subjectId: subjectId },
622
- });
623
- request
624
- .then((response) => {
625
- resolve(response.data);
626
- })
627
- .catch((error) => {
628
- reject(error);
629
- });
630
- });
631
- };
632
- // ── Compliance + Redaction Configuration ──────────────────────────────────────
633
- /**
634
- * Read a knowledge base's redaction policy.
635
- * GET /api/v1/knowledge-base/:id/redaction-policy
636
- * @param {String} id The knowledge base id
637
- * @param {String} authToken Authentication token
638
- * @returns {Promise<object>}
639
- */
640
- export const getRedactionPolicy = (id, authToken) => {
641
- return new Promise((resolve, reject) => {
642
- const request = client.get(`/api/v1/knowledge-base/${id}/redaction-policy`, { headers: { authorization: authToken } });
643
- request
644
- .then((response) => {
645
- resolve(response.data);
646
- })
647
- .catch((error) => {
648
- reject(error);
649
- });
650
- });
651
- };
652
- /**
653
- * Set a knowledge base's per-KB redaction behavior + DLP provider.
654
- * PUT /api/v1/knowledge-base/:id/redaction-policy
655
- * @param {String} id The knowledge base id
656
- * @param {object} policy The redaction policy
657
- * @param {String} authToken Authentication token
658
- * @returns {Promise<object>}
659
- */
660
- export const updateRedactionPolicy = (id, policy, authToken) => {
661
- return new Promise((resolve, reject) => {
662
- const request = client.put(`/api/v1/knowledge-base/${id}/redaction-policy`, policy, { headers: { authorization: authToken } });
663
- request
664
- .then((response) => {
665
- resolve(response.data);
666
- })
667
- .catch((error) => {
668
- reject(error);
669
- });
670
- });
671
- };
672
- /**
673
- * Read the tenant's compliance profile (admin only). Governs which RAG processors
674
- * a KB may route to (e.g. HIPAA tenants → BAA-eligible processors only).
675
- * GET /api/v1/tenants/compliance-profile
676
- * @param {String} authToken Authentication token
677
- * @returns {Promise<object>}
678
- */
679
- export const getComplianceProfile = (authToken) => {
680
- return new Promise((resolve, reject) => {
681
- const request = client.get(`/api/v1/tenants/compliance-profile`, {
682
- headers: { authorization: authToken },
683
- });
684
- request
685
- .then((response) => {
686
- resolve(response.data);
687
- })
688
- .catch((error) => {
689
- reject(error);
690
- });
691
- });
692
- };
693
- /**
694
- * Update the tenant's compliance profile (admin only; not exposed via the KB UI).
695
- * PUT /api/v1/tenants/compliance-profile
696
- * @param {object} profile The compliance profile
697
- * @param {String} authToken Authentication token
698
- * @returns {Promise<object>}
699
- */
700
- export const updateComplianceProfile = (profile, authToken) => {
701
- return new Promise((resolve, reject) => {
702
- const request = client.put(`/api/v1/tenants/compliance-profile`, profile, { headers: { authorization: authToken } });
703
- request
704
- .then((response) => {
705
- resolve(response.data);
706
- })
707
- .catch((error) => {
708
- reject(error);
709
- });
710
- });
711
- };
712
- /**
713
- * Trigger a GDPR subject-purge ("right to be forgotten"; admin only).
714
- * POST /api/v1/compliance/right-to-be-forgotten
715
- * @param {object} data The subject-purge request
716
- * @param {String} authToken Authentication token
717
- * @returns {Promise<object>}
718
- */
719
- export const rightToBeForgotten = (data, authToken) => {
720
- return new Promise((resolve, reject) => {
721
- const request = client.post(`/api/v1/compliance/right-to-be-forgotten`, data, { headers: { authorization: authToken } });
722
- request
723
- .then((response) => {
724
- resolve(response.data);
725
- })
726
- .catch((error) => {
727
- reject(error);
728
- });
729
- });
730
- };
731
- // ── Review Center — overview ──────────────────────────────────────────────────
732
- /**
733
- * Overview of all Review Center streams + counts for a knowledge base.
734
- * GET /api/v1/knowledge-base/:id/review
735
- * @param {String} id The knowledge base id
736
- * @param {String} authToken Authentication token
737
- * @returns {Promise<object>}
738
- */
739
- export const getReviewOverview = (id, authToken) => {
740
- return new Promise((resolve, reject) => {
741
- const request = client.get(`/api/v1/knowledge-base/${id}/review`, {
742
- headers: { authorization: authToken },
743
- });
744
- request
745
- .then((response) => {
746
- resolve(response.data);
747
- })
748
- .catch((error) => {
749
- reject(error);
750
- });
751
- });
752
- };
753
- // ── Review Center — Stream 1: Quarantine release ──────────────────────────────
754
- /**
755
- * List QUARANTINED documents (Review Center stream 1).
756
- * GET /api/v1/knowledge-base/:id/review/quarantine
757
- * @param {String} id The knowledge base id
758
- * @param {String} authToken Authentication token
759
- * @returns {Promise<object>}
760
- */
761
- export const listQuarantine = (id, authToken) => {
762
- return new Promise((resolve, reject) => {
763
- const request = client.get(`/api/v1/knowledge-base/${id}/review/quarantine`, { headers: { authorization: authToken } });
764
- request
765
- .then((response) => {
766
- resolve(response.data);
767
- })
768
- .catch((error) => {
769
- reject(error);
770
- });
771
- });
772
- };
773
- /**
774
- * List the documents released from review (Review Center stream 1): every one
775
- * released and not held again since, the newest release first, each with
776
- * `quarantineReleasedAt` and `quarantineReleasedByName` (who released it, or
777
- * null). Requires RELEASE_QUARANTINE + owner|editor, as the held list does.
778
- * GET /api/v1/knowledge-base/:id/review/quarantine?state=released
779
- * @param {String} id The knowledge base id
780
- * @param {String} authToken Authentication token
781
- * @returns {Promise<object>}
782
- */
783
- export const listReleased = (id, authToken) => {
784
- return new Promise((resolve, reject) => {
785
- const request = client.get(`/api/v1/knowledge-base/${id}/review/quarantine`, { headers: { authorization: authToken }, params: { state: "released" } });
786
- request
787
- .then((response) => {
788
- resolve(response.data);
789
- })
790
- .catch((error) => {
791
- reject(error);
792
- });
793
- });
794
- };
795
- /**
796
- * Release a quarantined document. Requires RELEASE_QUARANTINE + owner|editor.
797
- * POST /api/v1/knowledge-base/:id/review/quarantine/:docId/release
798
- * @param {String} id The knowledge base id
799
- * @param {String} docId The document id
800
- * @param {String} authToken Authentication token
801
- * @returns {Promise<object>}
802
- */
803
- export const releaseQuarantine = (id, docId, authToken) => {
804
- return new Promise((resolve, reject) => {
805
- const request = client.post(`/api/v1/knowledge-base/${id}/review/quarantine/${docId}/release`, {}, { headers: { authorization: authToken } });
806
- request
807
- .then((response) => {
808
- resolve(response.data);
809
- })
810
- .catch((error) => {
811
- reject(error);
812
- });
813
- });
814
- };
815
- /**
816
- * Apply a reviewer's decisions to many held documents at once: release each
817
- * named document back through ingestion, keep it in quarantine as reviewed, or
818
- * block it from the knowledge base. One run per source released into is asked
819
- * for, never one per document. Requires RELEASE_QUARANTINE + owner|editor.
820
- * POST /api/v1/knowledge-base/:id/review/quarantine/decisions
821
- * @param {String} id The knowledge base id
822
- * @param {Array<{documentId: string, decision: "release"|"quarantine"|"block", reason?: string}>} decisions One decision per document, at most 500
823
- * @param {String} authToken Authentication token
824
- * @returns {Promise<object>} `{ results: [{ documentId, decision, outcome }], runs: [{ sourceId, correlationId, started }] }`
825
- */
826
- export const decideQuarantine = (id, decisions, authToken) => {
827
- return new Promise((resolve, reject) => {
828
- const request = client.post(`/api/v1/knowledge-base/${id}/review/quarantine/decisions`, { decisions }, { headers: { authorization: authToken } });
829
- request
830
- .then((response) => {
831
- resolve(response.data);
832
- })
833
- .catch((error) => {
834
- reject(error);
835
- });
836
- });
837
- };
838
- /**
839
- * Re-ingest a quarantined document (optionally with an updated redaction policy).
840
- * Publishes a kb-source-event (trigger="quarantine_re_ingest"). Requires
841
- * RELEASE_QUARANTINE + owner.
842
- * POST /api/v1/knowledge-base/:id/review/quarantine/:docId/re-ingest
843
- * @param {String} id The knowledge base id
844
- * @param {String} docId The document id
845
- * @param {object} data Optional body, e.g. `{ updatedRedactionPolicy }`
846
- * @param {String} authToken Authentication token
847
- * @returns {Promise<object>}
848
- */
849
- export const reingestQuarantine = (id, docId, data, authToken) => {
850
- return new Promise((resolve, reject) => {
851
- const request = client.post(`/api/v1/knowledge-base/${id}/review/quarantine/${docId}/re-ingest`, data, { headers: { authorization: authToken } });
852
- request
853
- .then((response) => {
854
- resolve(response.data);
855
- })
856
- .catch((error) => {
857
- reject(error);
858
- });
859
- });
860
- };
861
- /**
862
- * Delete a quarantined document. Requires RELEASE_QUARANTINE + owner.
863
- * POST /api/v1/knowledge-base/:id/review/quarantine/:docId/delete
864
- * @param {String} id The knowledge base id
865
- * @param {String} docId The document id
866
- * @param {String} authToken Authentication token
867
- * @returns {Promise<object>}
868
- */
869
- export const deleteQuarantine = (id, docId, authToken) => {
870
- return new Promise((resolve, reject) => {
871
- const request = client.post(`/api/v1/knowledge-base/${id}/review/quarantine/${docId}/delete`, {}, { headers: { authorization: authToken } });
872
- request
873
- .then((response) => {
874
- resolve(response.data);
875
- })
876
- .catch((error) => {
877
- reject(error);
878
- });
879
- });
880
- };
881
- // ── Review Center — Stream 2: Generated content review ────────────────────────
882
- /**
883
- * List generated artifacts awaiting review (needsReview=true).
884
- * Requires GENERATE_FROM_KB + owner|editor.
885
- * GET /api/v1/knowledge-base/:id/review/generated
886
- * @param {String} id The knowledge base id
887
- * @param {String} authToken Authentication token
888
- * @returns {Promise<object>}
889
- */
890
- export const listGeneratedReview = (id, authToken) => {
891
- return new Promise((resolve, reject) => {
892
- const request = client.get(`/api/v1/knowledge-base/${id}/review/generated`, { headers: { authorization: authToken } });
893
- request
894
- .then((response) => {
895
- resolve(response.data);
896
- })
897
- .catch((error) => {
898
- reject(error);
899
- });
900
- });
901
- };
902
- /**
903
- * Approve a generated artifact. Requires GENERATE_FROM_KB + owner|editor.
904
- * POST /api/v1/knowledge-base/:id/review/generated/:entityId/approve
905
- * @param {String} id The knowledge base id
906
- * @param {String} entityId The artifact/entity id
907
- * @param {object} data Body `{ entityType, notes? }`
908
- * @param {String} authToken Authentication token
909
- * @returns {Promise<object>}
910
- */
911
- export const approveGenerated = (id, entityId, data, authToken) => {
912
- return new Promise((resolve, reject) => {
913
- const request = client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/approve`, data, { headers: { authorization: authToken } });
914
- request
915
- .then((response) => {
916
- resolve(response.data);
917
- })
918
- .catch((error) => {
919
- reject(error);
920
- });
921
- });
922
- };
923
- /**
924
- * Approve a generated artifact with edits.
925
- * Requires GENERATE_FROM_KB + owner|editor.
926
- * POST /api/v1/knowledge-base/:id/review/generated/:entityId/edit-approve
927
- * @param {String} id The knowledge base id
928
- * @param {String} entityId The artifact/entity id
929
- * @param {object} data Body `{ entityType, edits, notes? }`
930
- * @param {String} authToken Authentication token
931
- * @returns {Promise<object>}
932
- */
933
- export const editApproveGenerated = (id, entityId, data, authToken) => {
934
- return new Promise((resolve, reject) => {
935
- const request = client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/edit-approve`, data, { headers: { authorization: authToken } });
936
- request
937
- .then((response) => {
938
- resolve(response.data);
939
- })
940
- .catch((error) => {
941
- reject(error);
942
- });
943
- });
944
- };
945
- /**
946
- * Reject a generated artifact. Requires GENERATE_FROM_KB + owner|editor.
947
- * POST /api/v1/knowledge-base/:id/review/generated/:entityId/reject
948
- * @param {String} id The knowledge base id
949
- * @param {String} entityId The artifact/entity id
950
- * @param {object} data Body `{ entityType, reason }`
951
- * @param {String} authToken Authentication token
952
- * @returns {Promise<object>}
953
- */
954
- export const rejectGenerated = (id, entityId, data, authToken) => {
955
- return new Promise((resolve, reject) => {
956
- const request = client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/reject`, data, { headers: { authorization: authToken } });
957
- request
958
- .then((response) => {
959
- resolve(response.data);
960
- })
961
- .catch((error) => {
962
- reject(error);
963
- });
964
- });
965
- };
966
- /**
967
- * Regenerate a generated artifact using current chunks.
968
- * Requires GENERATE_FROM_KB + owner|editor.
969
- * POST /api/v1/knowledge-base/:id/review/generated/:entityId/regenerate
970
- * @param {String} id The knowledge base id
971
- * @param {String} entityId The artifact/entity id
972
- * @param {object} data Body `{ entityType, regenerationHints? }`
973
- * @param {String} authToken Authentication token
974
- * @returns {Promise<object>}
975
- */
976
- export const regenerateGenerated = (id, entityId, data, authToken) => {
977
- return new Promise((resolve, reject) => {
978
- const request = client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/regenerate`, data, { headers: { authorization: authToken } });
979
- request
980
- .then((response) => {
981
- resolve(response.data);
982
- })
983
- .catch((error) => {
984
- reject(error);
985
- });
986
- });
987
- };
988
- // ── Review Center — Stream 3: Contradiction flags ─────────────────────────────
989
- /**
990
- * List chunks with non-empty contradictionFlags[].
991
- * Requires GENERATE_FROM_KB + owner|editor.
992
- * GET /api/v1/knowledge-base/:id/review/contradictions
993
- * @param {String} id The knowledge base id
994
- * @param {String} authToken Authentication token
995
- * @returns {Promise<object>}
996
- */
997
- export const listContradictions = (id, authToken) => {
998
- return new Promise((resolve, reject) => {
999
- const request = client.get(`/api/v1/knowledge-base/${id}/review/contradictions`, { headers: { authorization: authToken } });
1000
- request
1001
- .then((response) => {
1002
- resolve(response.data);
1003
- })
1004
- .catch((error) => {
1005
- reject(error);
1006
- });
1007
- });
1008
- };
1009
- /**
1010
- * Decide a contradiction between two chunks.
1011
- * Requires GENERATE_FROM_KB + owner|editor.
1012
- * POST /api/v1/knowledge-base/:id/review/contradictions/:chunkId/decide
1013
- * @param {String} id The knowledge base id
1014
- * @param {String} chunkId The chunk id carrying the contradiction flag
1015
- * @param {object} data Body `{ decision, otherChunkId, notes }` — `decision` is one
1016
- * of `KNOWLEDGE_BASE.CONTRADICTION_DECISION`
1017
- * @param {String} authToken Authentication token
1018
- * @returns {Promise<object>}
1019
- */
1020
- export const decideContradiction = (id, chunkId, data, authToken) => {
1021
- return new Promise((resolve, reject) => {
1022
- const request = client.post(`/api/v1/knowledge-base/${id}/review/contradictions/${chunkId}/decide`, data, { headers: { authorization: authToken } });
1023
- request
1024
- .then((response) => {
1025
- resolve(response.data);
1026
- })
1027
- .catch((error) => {
1028
- reject(error);
1029
- });
1030
- });
1031
- };
1032
- // ── Out-of-Sync Notification Actions ──────────────────────────────────────────
1033
- // (design §14 / §14A — surfaced as notifications, acted on per-artifact.
1034
- // Requires GENERATE_FROM_KB + owner|editor on the KB.)
1035
- /**
1036
- * Regenerate a stale artifact from a notification using current chunks.
1037
- * POST /api/v1/notifications/:notificationId/artifacts/:artifactId/regenerate
1038
- * @param {String} notificationId The notification id
1039
- * @param {String} artifactId The artifact id
1040
- * @param {object} data Body `{ entityType }`
1041
- * @param {String} authToken Authentication token
1042
- * @returns {Promise<object>}
1043
- */
1044
- export const regenerateArtifact = (notificationId, artifactId, data, authToken) => {
1045
- return new Promise((resolve, reject) => {
1046
- const request = client.post(`/api/v1/notifications/${notificationId}/artifacts/${artifactId}/regenerate`, data, { headers: { authorization: authToken } });
1047
- request
1048
- .then((response) => {
1049
- resolve(response.data);
1050
- })
1051
- .catch((error) => {
1052
- reject(error);
1053
- });
1054
- });
1055
- };
1056
- /**
1057
- * Retire (soft-delete) a stale artifact from a notification.
1058
- * POST /api/v1/notifications/:notificationId/artifacts/:artifactId/retire
1059
- * @param {String} notificationId The notification id
1060
- * @param {String} artifactId The artifact id
1061
- * @param {object} data Body `{ entityType }`
1062
- * @param {String} authToken Authentication token
1063
- * @returns {Promise<object>}
1064
- */
1065
- export const retireArtifact = (notificationId, artifactId, data, authToken) => {
1066
- return new Promise((resolve, reject) => {
1067
- const request = client.post(`/api/v1/notifications/${notificationId}/artifacts/${artifactId}/retire`, data, { headers: { authorization: authToken } });
1068
- request
1069
- .then((response) => {
1070
- resolve(response.data);
1071
- })
1072
- .catch((error) => {
1073
- reject(error);
1074
- });
1075
- });
1076
- };
1077
- /**
1078
- * Dismiss a stale-artifact flag (mark the staleness acceptable).
1079
- * POST /api/v1/notifications/:notificationId/artifacts/:artifactId/dismiss
1080
- * @param {String} notificationId The notification id
1081
- * @param {String} artifactId The artifact id
1082
- * @param {object} data Body `{ entityType, reason? }`
1083
- * @param {String} authToken Authentication token
1084
- * @returns {Promise<object>}
1085
- */
1086
- export const dismissArtifact = (notificationId, artifactId, data, authToken) => {
1087
- return new Promise((resolve, reject) => {
1088
- const request = client.post(`/api/v1/notifications/${notificationId}/artifacts/${artifactId}/dismiss`, data, { headers: { authorization: authToken } });
1089
- request
1090
- .then((response) => {
1091
- resolve(response.data);
1092
- })
1093
- .catch((error) => {
1094
- reject(error);
1095
- });
1096
- });
1097
- };
1098
- /**
1099
- * Dismiss an entire out-of-sync notification (all artifacts).
1100
- * POST /api/v1/notifications/:notificationId/dismiss-all
1101
- * @param {String} notificationId The notification id
1102
- * @param {String} authToken Authentication token
1103
- * @returns {Promise<object>}
1104
- */
1105
- export const dismissAllArtifacts = (notificationId, authToken) => {
1106
- return new Promise((resolve, reject) => {
1107
- const request = client.post(`/api/v1/notifications/${notificationId}/dismiss-all`, {}, { headers: { authorization: authToken } });
1108
- request
1109
- .then((response) => {
1110
- resolve(response.data);
1111
- })
1112
- .catch((error) => {
1113
- reject(error);
1114
- });
1115
- });
1116
- };
1117
- // ── Identity Mapping ──────────────────────────────────────────────────────────
1118
- // (design §14 — maps source-side principals to tenant users for KB source ACLs.)
1119
- /**
1120
- * List the current user's source-side identities.
1121
- * GET /api/v1/identity/source-mappings
1122
- * @param {String} authToken Authentication token
1123
- * @returns {Promise<object>}
1124
- */
1125
- export const listSourceMappings = (authToken) => {
1126
- return new Promise((resolve, reject) => {
1127
- const request = client.get(`/api/v1/identity/source-mappings`, {
1128
- headers: { authorization: authToken },
1129
- });
1130
- request
1131
- .then((response) => {
1132
- resolve(response.data);
1133
- })
1134
- .catch((error) => {
1135
- reject(error);
1136
- });
1137
- });
1138
- };
1139
- /**
1140
- * Tenant-admin override for a user's source identity mapping.
1141
- * PUT /api/v1/identity/source-mappings/:sourceType
1142
- * @param {String} sourceType The source type key
1143
- * @param {object} data The mapping override
1144
- * @param {String} authToken Authentication token
1145
- * @returns {Promise<object>}
1146
- */
1147
- export const updateSourceMapping = (sourceType, data, authToken) => {
1148
- return new Promise((resolve, reject) => {
1149
- const request = client.put(`/api/v1/identity/source-mappings/${sourceType}`, data, { headers: { authorization: authToken } });
1150
- request
1151
- .then((response) => {
1152
- resolve(response.data);
1153
- })
1154
- .catch((error) => {
1155
- reject(error);
1156
- });
1157
- });
1158
- };
1159
- /**
1160
- * Bulk-resolve source principal IDs → tenant users (internal / service-to-service).
1161
- * POST /api/v1/identity/source-mappings/resolve
1162
- * @param {object} data Body carrying the principal IDs to resolve
1163
- * @param {String} authToken Authentication token
1164
- * @returns {Promise<object>}
1165
- */
1166
- export const resolveSourceMappings = (data, authToken) => {
1167
- return new Promise((resolve, reject) => {
1168
- const request = client.post(`/api/v1/identity/source-mappings/resolve`, data, { headers: { authorization: authToken } });
1169
- request
1170
- .then((response) => {
1171
- resolve(response.data);
1172
- })
1173
- .catch((error) => {
1174
- reject(error);
1175
- });
1176
- });
1177
- };
4
+ // Thin client wrappers over the user-facing KB *management* endpoints
5
+ // (design §14 — "KB management endpoints ... remain user-facing; they configure
6
+ // the KB, they don't perform RAG"). RAG retrieval / Q&A / generation are
7
+ // internal-only and intentionally NOT exposed here.
8
+ //
9
+ // Sections mirror design §14: CRUD · Sources · Documents · Access · Compliance &
10
+ // Redaction · Review Center (3 streams) · Out-of-Sync Notification Actions ·
11
+ // Identity Mapping.
12
+ //
13
+ // The operations live in `./knowledgeBase/`, one module per area; this file
14
+ // re-exports all of them so every import path and name stays as it was.
15
+ //
16
+ export * from "./knowledgeBase/knowledgeBases.js";
17
+ export * from "./knowledgeBase/sources.js";
18
+ export * from "./knowledgeBase/documents.js";
19
+ export * from "./knowledgeBase/skills.js";
20
+ export * from "./knowledgeBase/review.js";
1178
21
  //# sourceMappingURL=knowledgeBase.js.map