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