@stackfactor/client-api 1.1.252 → 1.1.254
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.
- package/dist/cjs/lib/constants.d.ts +61 -0
- package/dist/cjs/lib/constants.d.ts.map +1 -1
- package/dist/cjs/lib/constants.js +69 -1
- package/dist/cjs/lib/constants.js.map +1 -1
- package/dist/cjs/lib/index.d.ts +1 -0
- package/dist/cjs/lib/index.d.ts.map +1 -1
- package/dist/cjs/lib/index.js +3 -2
- package/dist/cjs/lib/index.js.map +1 -1
- package/dist/cjs/lib/knowledgeBase.d.ts +400 -0
- package/dist/cjs/lib/knowledgeBase.d.ts.map +1 -0
- package/dist/cjs/lib/knowledgeBase.js +898 -0
- package/dist/cjs/lib/knowledgeBase.js.map +1 -0
- package/dist/esm/lib/constants.d.ts +61 -0
- package/dist/esm/lib/constants.d.ts.map +1 -1
- package/dist/esm/lib/constants.js +68 -0
- package/dist/esm/lib/constants.js.map +1 -1
- package/dist/esm/lib/index.d.ts +1 -0
- package/dist/esm/lib/index.d.ts.map +1 -1
- package/dist/esm/lib/index.js +1 -0
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/knowledgeBase.d.ts +400 -0
- package/dist/esm/lib/knowledgeBase.d.ts.map +1 -0
- package/dist/esm/lib/knowledgeBase.js +855 -0
- package/dist/esm/lib/knowledgeBase.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveSourceMappings = exports.updateSourceMapping = 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.releaseQuarantine = exports.listQuarantine = exports.getReviewOverview = exports.rightToBeForgotten = exports.updateComplianceProfile = exports.getComplianceProfile = exports.updateRedactionPolicy = exports.getRedactionPolicy = exports.revokeAccess = exports.grantAccess = exports.listAccess = exports.deleteDocument = exports.listDocuments = exports.testSource = exports.syncSource = exports.deleteSource = exports.updateSource = exports.addSource = exports.listSourceConnectors = exports.deleteKnowledgeBase = exports.updateKnowledgeBase = exports.getKnowledgeBase = exports.createKnowledgeBase = exports.listKnowledgeBases = void 0;
|
|
4
|
+
const axiosClient_js_1 = require("./axiosClient.js");
|
|
5
|
+
// ── Knowledge Base CRUD ───────────────────────────────────────────────────────
|
|
6
|
+
/**
|
|
7
|
+
* List the knowledge bases the caller can see.
|
|
8
|
+
* GET /api/v1/knowledge-base
|
|
9
|
+
* @param {String} authToken Authentication token
|
|
10
|
+
* @returns {Promise<object>}
|
|
11
|
+
*/
|
|
12
|
+
const listKnowledgeBases = (authToken) => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base`, {
|
|
15
|
+
headers: { authorization: authToken },
|
|
16
|
+
});
|
|
17
|
+
request
|
|
18
|
+
.then((response) => {
|
|
19
|
+
resolve(response.data);
|
|
20
|
+
})
|
|
21
|
+
.catch((error) => {
|
|
22
|
+
reject(error);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.listKnowledgeBases = listKnowledgeBases;
|
|
27
|
+
/**
|
|
28
|
+
* Create a knowledge base (the creator becomes owner automatically). Requires the
|
|
29
|
+
* global CREATE_KNOWLEDGE_BASE capability.
|
|
30
|
+
* POST /api/v1/knowledge-base
|
|
31
|
+
* @param {KnowledgeBaseInput} data KB metadata (at minimum `name`)
|
|
32
|
+
* @param {String} authToken Authentication token
|
|
33
|
+
* @returns {Promise<object>}
|
|
34
|
+
*/
|
|
35
|
+
const createKnowledgeBase = (data, authToken) => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base`, data, {
|
|
38
|
+
headers: { authorization: authToken },
|
|
39
|
+
});
|
|
40
|
+
request
|
|
41
|
+
.then((response) => {
|
|
42
|
+
resolve(response.data);
|
|
43
|
+
})
|
|
44
|
+
.catch((error) => {
|
|
45
|
+
reject(error);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.createKnowledgeBase = createKnowledgeBase;
|
|
50
|
+
/**
|
|
51
|
+
* Get a single knowledge base (plus stats).
|
|
52
|
+
* GET /api/v1/knowledge-base/:id
|
|
53
|
+
* @param {String} id The knowledge base id
|
|
54
|
+
* @param {String} authToken Authentication token
|
|
55
|
+
* @returns {Promise<object>}
|
|
56
|
+
*/
|
|
57
|
+
const getKnowledgeBase = (id, authToken) => {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}`, {
|
|
60
|
+
headers: { authorization: authToken },
|
|
61
|
+
});
|
|
62
|
+
request
|
|
63
|
+
.then((response) => {
|
|
64
|
+
resolve(response.data);
|
|
65
|
+
})
|
|
66
|
+
.catch((error) => {
|
|
67
|
+
reject(error);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
exports.getKnowledgeBase = getKnowledgeBase;
|
|
72
|
+
/**
|
|
73
|
+
* Update a knowledge base's metadata. Owner or editor only. Does not touch
|
|
74
|
+
* `access[]`, `sources`, or `createdBy` — those have their own gated flows.
|
|
75
|
+
* PUT /api/v1/knowledge-base/:id
|
|
76
|
+
* @param {String} id The knowledge base id
|
|
77
|
+
* @param {KnowledgeBaseInput} data The fields to update
|
|
78
|
+
* @param {String} authToken Authentication token
|
|
79
|
+
* @returns {Promise<object>}
|
|
80
|
+
*/
|
|
81
|
+
const updateKnowledgeBase = (id, data, authToken) => {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const request = axiosClient_js_1.client.put(`/api/v1/knowledge-base/${id}`, data, {
|
|
84
|
+
headers: { authorization: authToken },
|
|
85
|
+
});
|
|
86
|
+
request
|
|
87
|
+
.then((response) => {
|
|
88
|
+
resolve(response.data);
|
|
89
|
+
})
|
|
90
|
+
.catch((error) => {
|
|
91
|
+
reject(error);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
exports.updateKnowledgeBase = updateKnowledgeBase;
|
|
96
|
+
/**
|
|
97
|
+
* Delete a knowledge base (cascades to its chunks). Owner only.
|
|
98
|
+
* DELETE /api/v1/knowledge-base/:id
|
|
99
|
+
* @param {String} id The knowledge base id
|
|
100
|
+
* @param {String} authToken Authentication token
|
|
101
|
+
* @returns {Promise<object>}
|
|
102
|
+
*/
|
|
103
|
+
const deleteKnowledgeBase = (id, authToken) => {
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
const request = axiosClient_js_1.client.delete(`/api/v1/knowledge-base/${id}`, {
|
|
106
|
+
headers: { authorization: authToken },
|
|
107
|
+
});
|
|
108
|
+
request
|
|
109
|
+
.then((response) => {
|
|
110
|
+
resolve(response.data);
|
|
111
|
+
})
|
|
112
|
+
.catch((error) => {
|
|
113
|
+
reject(error);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
exports.deleteKnowledgeBase = deleteKnowledgeBase;
|
|
118
|
+
// ── Source Management ─────────────────────────────────────────────────────────
|
|
119
|
+
/**
|
|
120
|
+
* List the available KB_SOURCE_CONNECTOR integrations (enabled integrations +
|
|
121
|
+
* capability manifests for the source-creation form).
|
|
122
|
+
* GET /api/v1/knowledge-base/source-connectors
|
|
123
|
+
* @param {String} authToken Authentication token
|
|
124
|
+
* @returns {Promise<object>}
|
|
125
|
+
*/
|
|
126
|
+
const listSourceConnectors = (authToken) => {
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
128
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/source-connectors`, {
|
|
129
|
+
headers: { authorization: authToken },
|
|
130
|
+
});
|
|
131
|
+
request
|
|
132
|
+
.then((response) => {
|
|
133
|
+
resolve(response.data);
|
|
134
|
+
})
|
|
135
|
+
.catch((error) => {
|
|
136
|
+
reject(error);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
exports.listSourceConnectors = listSourceConnectors;
|
|
141
|
+
/**
|
|
142
|
+
* Add a source to a knowledge base (`integrationId` + credentials +
|
|
143
|
+
* `syncFrequencyDays`, default 7). Publishes a kb-source-event (changeType="add").
|
|
144
|
+
* POST /api/v1/knowledge-base/:id/sources
|
|
145
|
+
* @param {String} id The knowledge base id
|
|
146
|
+
* @param {object} source The source configuration
|
|
147
|
+
* @param {String} authToken Authentication token
|
|
148
|
+
* @returns {Promise<object>}
|
|
149
|
+
*/
|
|
150
|
+
const addSource = (id, source, authToken) => {
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/sources`, source, { headers: { authorization: authToken } });
|
|
153
|
+
request
|
|
154
|
+
.then((response) => {
|
|
155
|
+
resolve(response.data);
|
|
156
|
+
})
|
|
157
|
+
.catch((error) => {
|
|
158
|
+
reject(error);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
exports.addSource = addSource;
|
|
163
|
+
/**
|
|
164
|
+
* Update a knowledge base source. Publishes a kb-source-event per changed source.
|
|
165
|
+
* PUT /api/v1/knowledge-base/:id/sources/:sourceId
|
|
166
|
+
* @param {String} id The knowledge base id
|
|
167
|
+
* @param {String} sourceId The source id
|
|
168
|
+
* @param {object} source The updated source configuration
|
|
169
|
+
* @param {String} authToken Authentication token
|
|
170
|
+
* @returns {Promise<object>}
|
|
171
|
+
*/
|
|
172
|
+
const updateSource = (id, sourceId, source, authToken) => {
|
|
173
|
+
return new Promise((resolve, reject) => {
|
|
174
|
+
const request = axiosClient_js_1.client.put(`/api/v1/knowledge-base/${id}/sources/${sourceId}`, source, { headers: { authorization: authToken } });
|
|
175
|
+
request
|
|
176
|
+
.then((response) => {
|
|
177
|
+
resolve(response.data);
|
|
178
|
+
})
|
|
179
|
+
.catch((error) => {
|
|
180
|
+
reject(error);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
exports.updateSource = updateSource;
|
|
185
|
+
/**
|
|
186
|
+
* Remove a source from a knowledge base. Publishes a kb-source-event
|
|
187
|
+
* (changeType="delete").
|
|
188
|
+
* DELETE /api/v1/knowledge-base/:id/sources/:sourceId
|
|
189
|
+
* @param {String} id The knowledge base id
|
|
190
|
+
* @param {String} sourceId The source id
|
|
191
|
+
* @param {String} authToken Authentication token
|
|
192
|
+
* @returns {Promise<object>}
|
|
193
|
+
*/
|
|
194
|
+
const deleteSource = (id, sourceId, authToken) => {
|
|
195
|
+
return new Promise((resolve, reject) => {
|
|
196
|
+
const request = axiosClient_js_1.client.delete(`/api/v1/knowledge-base/${id}/sources/${sourceId}`, { headers: { authorization: authToken } });
|
|
197
|
+
request
|
|
198
|
+
.then((response) => {
|
|
199
|
+
resolve(response.data);
|
|
200
|
+
})
|
|
201
|
+
.catch((error) => {
|
|
202
|
+
reject(error);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
exports.deleteSource = deleteSource;
|
|
207
|
+
/**
|
|
208
|
+
* Trigger a manual re-sync of a source. Publishes a kb-source-event
|
|
209
|
+
* (changeType="update", trigger="manual_sync").
|
|
210
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/sync
|
|
211
|
+
* @param {String} id The knowledge base id
|
|
212
|
+
* @param {String} sourceId The source id
|
|
213
|
+
* @param {String} authToken Authentication token
|
|
214
|
+
* @returns {Promise<object>}
|
|
215
|
+
*/
|
|
216
|
+
const syncSource = (id, sourceId, authToken) => {
|
|
217
|
+
return new Promise((resolve, reject) => {
|
|
218
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/sources/${sourceId}/sync`, {}, { headers: { authorization: authToken } });
|
|
219
|
+
request
|
|
220
|
+
.then((response) => {
|
|
221
|
+
resolve(response.data);
|
|
222
|
+
})
|
|
223
|
+
.catch((error) => {
|
|
224
|
+
reject(error);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
exports.syncSource = syncSource;
|
|
229
|
+
/**
|
|
230
|
+
* Test a source's connector credentials (dispatches TEST_CONNECTION).
|
|
231
|
+
* POST /api/v1/knowledge-base/:id/sources/:sourceId/test
|
|
232
|
+
* @param {String} id The knowledge base id
|
|
233
|
+
* @param {String} sourceId The source id
|
|
234
|
+
* @param {String} authToken Authentication token
|
|
235
|
+
* @returns {Promise<object>}
|
|
236
|
+
*/
|
|
237
|
+
const testSource = (id, sourceId, authToken) => {
|
|
238
|
+
return new Promise((resolve, reject) => {
|
|
239
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/sources/${sourceId}/test`, {}, { headers: { authorization: authToken } });
|
|
240
|
+
request
|
|
241
|
+
.then((response) => {
|
|
242
|
+
resolve(response.data);
|
|
243
|
+
})
|
|
244
|
+
.catch((error) => {
|
|
245
|
+
reject(error);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
exports.testSource = testSource;
|
|
250
|
+
// ── Document Management ───────────────────────────────────────────────────────
|
|
251
|
+
/**
|
|
252
|
+
* List a knowledge base's documents (paginated, with status + lastSync). There is
|
|
253
|
+
* no upload endpoint — documents are only ingested via configured sources.
|
|
254
|
+
* GET /api/v1/knowledge-base/:id/documents
|
|
255
|
+
* @param {String} id The knowledge base id
|
|
256
|
+
* @param {DocumentListParams} params Optional pagination / status filters
|
|
257
|
+
* @param {String} authToken Authentication token
|
|
258
|
+
* @returns {Promise<object>}
|
|
259
|
+
*/
|
|
260
|
+
const listDocuments = (id, params, authToken) => {
|
|
261
|
+
return new Promise((resolve, reject) => {
|
|
262
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/documents`, {
|
|
263
|
+
headers: { authorization: authToken },
|
|
264
|
+
params: params,
|
|
265
|
+
});
|
|
266
|
+
request
|
|
267
|
+
.then((response) => {
|
|
268
|
+
resolve(response.data);
|
|
269
|
+
})
|
|
270
|
+
.catch((error) => {
|
|
271
|
+
reject(error);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
exports.listDocuments = listDocuments;
|
|
276
|
+
/**
|
|
277
|
+
* Delete a single document (cascades to chunks + S3 images + dependent entity
|
|
278
|
+
* flags).
|
|
279
|
+
* DELETE /api/v1/knowledge-base/:id/documents/:docId
|
|
280
|
+
* @param {String} id The knowledge base id
|
|
281
|
+
* @param {String} docId The document id
|
|
282
|
+
* @param {String} authToken Authentication token
|
|
283
|
+
* @returns {Promise<object>}
|
|
284
|
+
*/
|
|
285
|
+
const deleteDocument = (id, docId, authToken) => {
|
|
286
|
+
return new Promise((resolve, reject) => {
|
|
287
|
+
const request = axiosClient_js_1.client.delete(`/api/v1/knowledge-base/${id}/documents/${docId}`, { headers: { authorization: authToken } });
|
|
288
|
+
request
|
|
289
|
+
.then((response) => {
|
|
290
|
+
resolve(response.data);
|
|
291
|
+
})
|
|
292
|
+
.catch((error) => {
|
|
293
|
+
reject(error);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
exports.deleteDocument = deleteDocument;
|
|
298
|
+
// ── KB Access Management (owner only) ─────────────────────────────────────────
|
|
299
|
+
/**
|
|
300
|
+
* List a knowledge base's access entries.
|
|
301
|
+
* GET /api/v1/knowledge-base/:id/access
|
|
302
|
+
* @param {String} id The knowledge base id
|
|
303
|
+
* @param {String} authToken Authentication token
|
|
304
|
+
* @returns {Promise<object>}
|
|
305
|
+
*/
|
|
306
|
+
const listAccess = (id, authToken) => {
|
|
307
|
+
return new Promise((resolve, reject) => {
|
|
308
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/access`, {
|
|
309
|
+
headers: { authorization: authToken },
|
|
310
|
+
});
|
|
311
|
+
request
|
|
312
|
+
.then((response) => {
|
|
313
|
+
resolve(response.data);
|
|
314
|
+
})
|
|
315
|
+
.catch((error) => {
|
|
316
|
+
reject(error);
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
exports.listAccess = listAccess;
|
|
321
|
+
/**
|
|
322
|
+
* Grant (upsert) an access entry. Owner only. Access is keyed by
|
|
323
|
+
* `(subjectType, subjectId)`, so re-granting a subject that already has an entry
|
|
324
|
+
* updates its role — there is no separate "update role" endpoint.
|
|
325
|
+
* POST /api/v1/knowledge-base/:id/access
|
|
326
|
+
* @param {String} id The knowledge base id
|
|
327
|
+
* @param {AccessEntryInput} entry The `{ subjectType, subjectId, role }` grant
|
|
328
|
+
* @param {String} authToken Authentication token
|
|
329
|
+
* @returns {Promise<object>}
|
|
330
|
+
*/
|
|
331
|
+
const grantAccess = (id, entry, authToken) => {
|
|
332
|
+
return new Promise((resolve, reject) => {
|
|
333
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/access`, entry, {
|
|
334
|
+
headers: { authorization: authToken },
|
|
335
|
+
});
|
|
336
|
+
request
|
|
337
|
+
.then((response) => {
|
|
338
|
+
resolve(response.data);
|
|
339
|
+
})
|
|
340
|
+
.catch((error) => {
|
|
341
|
+
reject(error);
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
exports.grantAccess = grantAccess;
|
|
346
|
+
/**
|
|
347
|
+
* Revoke a subject's access. Owner only. Keyed by `(subjectType, subjectId)` — the
|
|
348
|
+
* same composite key `grantAccess` upserts on. The backend refuses to remove the
|
|
349
|
+
* last owner.
|
|
350
|
+
* DELETE /api/v1/knowledge-base/:id/access
|
|
351
|
+
* @param {String} id The knowledge base id
|
|
352
|
+
* @param {String} subjectType One of `KNOWLEDGE_BASE.SUBJECT_TYPE`
|
|
353
|
+
* @param {String} subjectId The subject whose access is revoked
|
|
354
|
+
* @param {String} authToken Authentication token
|
|
355
|
+
* @returns {Promise<object>}
|
|
356
|
+
*/
|
|
357
|
+
const revokeAccess = (id, subjectType, subjectId, authToken) => {
|
|
358
|
+
return new Promise((resolve, reject) => {
|
|
359
|
+
const request = axiosClient_js_1.client.delete(`/api/v1/knowledge-base/${id}/access`, {
|
|
360
|
+
headers: { authorization: authToken },
|
|
361
|
+
data: { subjectType: subjectType, subjectId: subjectId },
|
|
362
|
+
});
|
|
363
|
+
request
|
|
364
|
+
.then((response) => {
|
|
365
|
+
resolve(response.data);
|
|
366
|
+
})
|
|
367
|
+
.catch((error) => {
|
|
368
|
+
reject(error);
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
exports.revokeAccess = revokeAccess;
|
|
373
|
+
// ── Compliance + Redaction Configuration ──────────────────────────────────────
|
|
374
|
+
/**
|
|
375
|
+
* Read a knowledge base's redaction policy.
|
|
376
|
+
* GET /api/v1/knowledge-base/:id/redaction-policy
|
|
377
|
+
* @param {String} id The knowledge base id
|
|
378
|
+
* @param {String} authToken Authentication token
|
|
379
|
+
* @returns {Promise<object>}
|
|
380
|
+
*/
|
|
381
|
+
const getRedactionPolicy = (id, authToken) => {
|
|
382
|
+
return new Promise((resolve, reject) => {
|
|
383
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/redaction-policy`, { headers: { authorization: authToken } });
|
|
384
|
+
request
|
|
385
|
+
.then((response) => {
|
|
386
|
+
resolve(response.data);
|
|
387
|
+
})
|
|
388
|
+
.catch((error) => {
|
|
389
|
+
reject(error);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
exports.getRedactionPolicy = getRedactionPolicy;
|
|
394
|
+
/**
|
|
395
|
+
* Set a knowledge base's per-KB redaction behavior + DLP provider.
|
|
396
|
+
* PUT /api/v1/knowledge-base/:id/redaction-policy
|
|
397
|
+
* @param {String} id The knowledge base id
|
|
398
|
+
* @param {object} policy The redaction policy
|
|
399
|
+
* @param {String} authToken Authentication token
|
|
400
|
+
* @returns {Promise<object>}
|
|
401
|
+
*/
|
|
402
|
+
const updateRedactionPolicy = (id, policy, authToken) => {
|
|
403
|
+
return new Promise((resolve, reject) => {
|
|
404
|
+
const request = axiosClient_js_1.client.put(`/api/v1/knowledge-base/${id}/redaction-policy`, policy, { headers: { authorization: authToken } });
|
|
405
|
+
request
|
|
406
|
+
.then((response) => {
|
|
407
|
+
resolve(response.data);
|
|
408
|
+
})
|
|
409
|
+
.catch((error) => {
|
|
410
|
+
reject(error);
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
exports.updateRedactionPolicy = updateRedactionPolicy;
|
|
415
|
+
/**
|
|
416
|
+
* Read the tenant's compliance profile (admin only). Governs which RAG processors
|
|
417
|
+
* a KB may route to (e.g. HIPAA tenants → BAA-eligible processors only).
|
|
418
|
+
* GET /api/v1/tenants/compliance-profile
|
|
419
|
+
* @param {String} authToken Authentication token
|
|
420
|
+
* @returns {Promise<object>}
|
|
421
|
+
*/
|
|
422
|
+
const getComplianceProfile = (authToken) => {
|
|
423
|
+
return new Promise((resolve, reject) => {
|
|
424
|
+
const request = axiosClient_js_1.client.get(`/api/v1/tenants/compliance-profile`, {
|
|
425
|
+
headers: { authorization: authToken },
|
|
426
|
+
});
|
|
427
|
+
request
|
|
428
|
+
.then((response) => {
|
|
429
|
+
resolve(response.data);
|
|
430
|
+
})
|
|
431
|
+
.catch((error) => {
|
|
432
|
+
reject(error);
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
exports.getComplianceProfile = getComplianceProfile;
|
|
437
|
+
/**
|
|
438
|
+
* Update the tenant's compliance profile (admin only; not exposed via the KB UI).
|
|
439
|
+
* PUT /api/v1/tenants/compliance-profile
|
|
440
|
+
* @param {object} profile The compliance profile
|
|
441
|
+
* @param {String} authToken Authentication token
|
|
442
|
+
* @returns {Promise<object>}
|
|
443
|
+
*/
|
|
444
|
+
const updateComplianceProfile = (profile, authToken) => {
|
|
445
|
+
return new Promise((resolve, reject) => {
|
|
446
|
+
const request = axiosClient_js_1.client.put(`/api/v1/tenants/compliance-profile`, profile, { headers: { authorization: authToken } });
|
|
447
|
+
request
|
|
448
|
+
.then((response) => {
|
|
449
|
+
resolve(response.data);
|
|
450
|
+
})
|
|
451
|
+
.catch((error) => {
|
|
452
|
+
reject(error);
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
exports.updateComplianceProfile = updateComplianceProfile;
|
|
457
|
+
/**
|
|
458
|
+
* Trigger a GDPR subject-purge ("right to be forgotten"; admin only).
|
|
459
|
+
* POST /api/v1/compliance/right-to-be-forgotten
|
|
460
|
+
* @param {object} data The subject-purge request
|
|
461
|
+
* @param {String} authToken Authentication token
|
|
462
|
+
* @returns {Promise<object>}
|
|
463
|
+
*/
|
|
464
|
+
const rightToBeForgotten = (data, authToken) => {
|
|
465
|
+
return new Promise((resolve, reject) => {
|
|
466
|
+
const request = axiosClient_js_1.client.post(`/api/v1/compliance/right-to-be-forgotten`, data, { headers: { authorization: authToken } });
|
|
467
|
+
request
|
|
468
|
+
.then((response) => {
|
|
469
|
+
resolve(response.data);
|
|
470
|
+
})
|
|
471
|
+
.catch((error) => {
|
|
472
|
+
reject(error);
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
};
|
|
476
|
+
exports.rightToBeForgotten = rightToBeForgotten;
|
|
477
|
+
// ── Review Center — overview ──────────────────────────────────────────────────
|
|
478
|
+
/**
|
|
479
|
+
* Overview of all Review Center streams + counts for a knowledge base.
|
|
480
|
+
* GET /api/v1/knowledge-base/:id/review
|
|
481
|
+
* @param {String} id The knowledge base id
|
|
482
|
+
* @param {String} authToken Authentication token
|
|
483
|
+
* @returns {Promise<object>}
|
|
484
|
+
*/
|
|
485
|
+
const getReviewOverview = (id, authToken) => {
|
|
486
|
+
return new Promise((resolve, reject) => {
|
|
487
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/review`, {
|
|
488
|
+
headers: { authorization: authToken },
|
|
489
|
+
});
|
|
490
|
+
request
|
|
491
|
+
.then((response) => {
|
|
492
|
+
resolve(response.data);
|
|
493
|
+
})
|
|
494
|
+
.catch((error) => {
|
|
495
|
+
reject(error);
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
exports.getReviewOverview = getReviewOverview;
|
|
500
|
+
// ── Review Center — Stream 1: Quarantine release ──────────────────────────────
|
|
501
|
+
/**
|
|
502
|
+
* List QUARANTINED documents (Review Center stream 1).
|
|
503
|
+
* GET /api/v1/knowledge-base/:id/review/quarantine
|
|
504
|
+
* @param {String} id The knowledge base id
|
|
505
|
+
* @param {String} authToken Authentication token
|
|
506
|
+
* @returns {Promise<object>}
|
|
507
|
+
*/
|
|
508
|
+
const listQuarantine = (id, authToken) => {
|
|
509
|
+
return new Promise((resolve, reject) => {
|
|
510
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/review/quarantine`, { headers: { authorization: authToken } });
|
|
511
|
+
request
|
|
512
|
+
.then((response) => {
|
|
513
|
+
resolve(response.data);
|
|
514
|
+
})
|
|
515
|
+
.catch((error) => {
|
|
516
|
+
reject(error);
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
};
|
|
520
|
+
exports.listQuarantine = listQuarantine;
|
|
521
|
+
/**
|
|
522
|
+
* Release a quarantined document. Requires RELEASE_QUARANTINE + owner|editor.
|
|
523
|
+
* POST /api/v1/knowledge-base/:id/review/quarantine/:docId/release
|
|
524
|
+
* @param {String} id The knowledge base id
|
|
525
|
+
* @param {String} docId The document id
|
|
526
|
+
* @param {String} authToken Authentication token
|
|
527
|
+
* @returns {Promise<object>}
|
|
528
|
+
*/
|
|
529
|
+
const releaseQuarantine = (id, docId, authToken) => {
|
|
530
|
+
return new Promise((resolve, reject) => {
|
|
531
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/quarantine/${docId}/release`, {}, { headers: { authorization: authToken } });
|
|
532
|
+
request
|
|
533
|
+
.then((response) => {
|
|
534
|
+
resolve(response.data);
|
|
535
|
+
})
|
|
536
|
+
.catch((error) => {
|
|
537
|
+
reject(error);
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
exports.releaseQuarantine = releaseQuarantine;
|
|
542
|
+
/**
|
|
543
|
+
* Re-ingest a quarantined document (optionally with an updated redaction policy).
|
|
544
|
+
* Publishes a kb-source-event (trigger="quarantine_re_ingest"). Requires
|
|
545
|
+
* RELEASE_QUARANTINE + owner.
|
|
546
|
+
* POST /api/v1/knowledge-base/:id/review/quarantine/:docId/re-ingest
|
|
547
|
+
* @param {String} id The knowledge base id
|
|
548
|
+
* @param {String} docId The document id
|
|
549
|
+
* @param {object} data Optional body, e.g. `{ updatedRedactionPolicy }`
|
|
550
|
+
* @param {String} authToken Authentication token
|
|
551
|
+
* @returns {Promise<object>}
|
|
552
|
+
*/
|
|
553
|
+
const reingestQuarantine = (id, docId, data, authToken) => {
|
|
554
|
+
return new Promise((resolve, reject) => {
|
|
555
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/quarantine/${docId}/re-ingest`, data, { headers: { authorization: authToken } });
|
|
556
|
+
request
|
|
557
|
+
.then((response) => {
|
|
558
|
+
resolve(response.data);
|
|
559
|
+
})
|
|
560
|
+
.catch((error) => {
|
|
561
|
+
reject(error);
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
exports.reingestQuarantine = reingestQuarantine;
|
|
566
|
+
/**
|
|
567
|
+
* Delete a quarantined document. Requires RELEASE_QUARANTINE + owner.
|
|
568
|
+
* POST /api/v1/knowledge-base/:id/review/quarantine/:docId/delete
|
|
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 deleteQuarantine = (id, docId, authToken) => {
|
|
575
|
+
return new Promise((resolve, reject) => {
|
|
576
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/quarantine/${docId}/delete`, {}, { headers: { authorization: authToken } });
|
|
577
|
+
request
|
|
578
|
+
.then((response) => {
|
|
579
|
+
resolve(response.data);
|
|
580
|
+
})
|
|
581
|
+
.catch((error) => {
|
|
582
|
+
reject(error);
|
|
583
|
+
});
|
|
584
|
+
});
|
|
585
|
+
};
|
|
586
|
+
exports.deleteQuarantine = deleteQuarantine;
|
|
587
|
+
// ── Review Center — Stream 2: Generated content review ────────────────────────
|
|
588
|
+
/**
|
|
589
|
+
* List generated artifacts awaiting review (needsReview=true).
|
|
590
|
+
* Requires GENERATE_FROM_KB + owner|editor.
|
|
591
|
+
* GET /api/v1/knowledge-base/:id/review/generated
|
|
592
|
+
* @param {String} id The knowledge base id
|
|
593
|
+
* @param {String} authToken Authentication token
|
|
594
|
+
* @returns {Promise<object>}
|
|
595
|
+
*/
|
|
596
|
+
const listGeneratedReview = (id, authToken) => {
|
|
597
|
+
return new Promise((resolve, reject) => {
|
|
598
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/review/generated`, { headers: { authorization: authToken } });
|
|
599
|
+
request
|
|
600
|
+
.then((response) => {
|
|
601
|
+
resolve(response.data);
|
|
602
|
+
})
|
|
603
|
+
.catch((error) => {
|
|
604
|
+
reject(error);
|
|
605
|
+
});
|
|
606
|
+
});
|
|
607
|
+
};
|
|
608
|
+
exports.listGeneratedReview = listGeneratedReview;
|
|
609
|
+
/**
|
|
610
|
+
* Approve a generated artifact. Requires GENERATE_FROM_KB + owner|editor.
|
|
611
|
+
* POST /api/v1/knowledge-base/:id/review/generated/:entityId/approve
|
|
612
|
+
* @param {String} id The knowledge base id
|
|
613
|
+
* @param {String} entityId The artifact/entity id
|
|
614
|
+
* @param {object} data Body `{ entityType, notes? }`
|
|
615
|
+
* @param {String} authToken Authentication token
|
|
616
|
+
* @returns {Promise<object>}
|
|
617
|
+
*/
|
|
618
|
+
const approveGenerated = (id, entityId, data, authToken) => {
|
|
619
|
+
return new Promise((resolve, reject) => {
|
|
620
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/approve`, data, { headers: { authorization: authToken } });
|
|
621
|
+
request
|
|
622
|
+
.then((response) => {
|
|
623
|
+
resolve(response.data);
|
|
624
|
+
})
|
|
625
|
+
.catch((error) => {
|
|
626
|
+
reject(error);
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
exports.approveGenerated = approveGenerated;
|
|
631
|
+
/**
|
|
632
|
+
* Approve a generated artifact with edits.
|
|
633
|
+
* Requires GENERATE_FROM_KB + owner|editor.
|
|
634
|
+
* POST /api/v1/knowledge-base/:id/review/generated/:entityId/edit-approve
|
|
635
|
+
* @param {String} id The knowledge base id
|
|
636
|
+
* @param {String} entityId The artifact/entity id
|
|
637
|
+
* @param {object} data Body `{ entityType, edits, notes? }`
|
|
638
|
+
* @param {String} authToken Authentication token
|
|
639
|
+
* @returns {Promise<object>}
|
|
640
|
+
*/
|
|
641
|
+
const editApproveGenerated = (id, entityId, data, authToken) => {
|
|
642
|
+
return new Promise((resolve, reject) => {
|
|
643
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/edit-approve`, data, { headers: { authorization: authToken } });
|
|
644
|
+
request
|
|
645
|
+
.then((response) => {
|
|
646
|
+
resolve(response.data);
|
|
647
|
+
})
|
|
648
|
+
.catch((error) => {
|
|
649
|
+
reject(error);
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
};
|
|
653
|
+
exports.editApproveGenerated = editApproveGenerated;
|
|
654
|
+
/**
|
|
655
|
+
* Reject a generated artifact. Requires GENERATE_FROM_KB + owner|editor.
|
|
656
|
+
* POST /api/v1/knowledge-base/:id/review/generated/:entityId/reject
|
|
657
|
+
* @param {String} id The knowledge base id
|
|
658
|
+
* @param {String} entityId The artifact/entity id
|
|
659
|
+
* @param {object} data Body `{ entityType, reason }`
|
|
660
|
+
* @param {String} authToken Authentication token
|
|
661
|
+
* @returns {Promise<object>}
|
|
662
|
+
*/
|
|
663
|
+
const rejectGenerated = (id, entityId, data, authToken) => {
|
|
664
|
+
return new Promise((resolve, reject) => {
|
|
665
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/reject`, data, { headers: { authorization: authToken } });
|
|
666
|
+
request
|
|
667
|
+
.then((response) => {
|
|
668
|
+
resolve(response.data);
|
|
669
|
+
})
|
|
670
|
+
.catch((error) => {
|
|
671
|
+
reject(error);
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
};
|
|
675
|
+
exports.rejectGenerated = rejectGenerated;
|
|
676
|
+
/**
|
|
677
|
+
* Regenerate a generated artifact using current chunks.
|
|
678
|
+
* Requires GENERATE_FROM_KB + owner|editor.
|
|
679
|
+
* POST /api/v1/knowledge-base/:id/review/generated/:entityId/regenerate
|
|
680
|
+
* @param {String} id The knowledge base id
|
|
681
|
+
* @param {String} entityId The artifact/entity id
|
|
682
|
+
* @param {object} data Body `{ entityType, regenerationHints? }`
|
|
683
|
+
* @param {String} authToken Authentication token
|
|
684
|
+
* @returns {Promise<object>}
|
|
685
|
+
*/
|
|
686
|
+
const regenerateGenerated = (id, entityId, data, authToken) => {
|
|
687
|
+
return new Promise((resolve, reject) => {
|
|
688
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/generated/${entityId}/regenerate`, data, { headers: { authorization: authToken } });
|
|
689
|
+
request
|
|
690
|
+
.then((response) => {
|
|
691
|
+
resolve(response.data);
|
|
692
|
+
})
|
|
693
|
+
.catch((error) => {
|
|
694
|
+
reject(error);
|
|
695
|
+
});
|
|
696
|
+
});
|
|
697
|
+
};
|
|
698
|
+
exports.regenerateGenerated = regenerateGenerated;
|
|
699
|
+
// ── Review Center — Stream 3: Contradiction flags ─────────────────────────────
|
|
700
|
+
/**
|
|
701
|
+
* List chunks with non-empty contradictionFlags[].
|
|
702
|
+
* Requires GENERATE_FROM_KB + owner|editor.
|
|
703
|
+
* GET /api/v1/knowledge-base/:id/review/contradictions
|
|
704
|
+
* @param {String} id The knowledge base id
|
|
705
|
+
* @param {String} authToken Authentication token
|
|
706
|
+
* @returns {Promise<object>}
|
|
707
|
+
*/
|
|
708
|
+
const listContradictions = (id, authToken) => {
|
|
709
|
+
return new Promise((resolve, reject) => {
|
|
710
|
+
const request = axiosClient_js_1.client.get(`/api/v1/knowledge-base/${id}/review/contradictions`, { headers: { authorization: authToken } });
|
|
711
|
+
request
|
|
712
|
+
.then((response) => {
|
|
713
|
+
resolve(response.data);
|
|
714
|
+
})
|
|
715
|
+
.catch((error) => {
|
|
716
|
+
reject(error);
|
|
717
|
+
});
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
exports.listContradictions = listContradictions;
|
|
721
|
+
/**
|
|
722
|
+
* Decide a contradiction between two chunks.
|
|
723
|
+
* Requires GENERATE_FROM_KB + owner|editor.
|
|
724
|
+
* POST /api/v1/knowledge-base/:id/review/contradictions/:chunkId/decide
|
|
725
|
+
* @param {String} id The knowledge base id
|
|
726
|
+
* @param {String} chunkId The chunk id carrying the contradiction flag
|
|
727
|
+
* @param {object} data Body `{ decision, otherChunkId, notes }` — `decision` is one
|
|
728
|
+
* of `KNOWLEDGE_BASE.CONTRADICTION_DECISION`
|
|
729
|
+
* @param {String} authToken Authentication token
|
|
730
|
+
* @returns {Promise<object>}
|
|
731
|
+
*/
|
|
732
|
+
const decideContradiction = (id, chunkId, data, authToken) => {
|
|
733
|
+
return new Promise((resolve, reject) => {
|
|
734
|
+
const request = axiosClient_js_1.client.post(`/api/v1/knowledge-base/${id}/review/contradictions/${chunkId}/decide`, data, { headers: { authorization: authToken } });
|
|
735
|
+
request
|
|
736
|
+
.then((response) => {
|
|
737
|
+
resolve(response.data);
|
|
738
|
+
})
|
|
739
|
+
.catch((error) => {
|
|
740
|
+
reject(error);
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
exports.decideContradiction = decideContradiction;
|
|
745
|
+
// ── Out-of-Sync Notification Actions ──────────────────────────────────────────
|
|
746
|
+
// (design §14 / §14A — surfaced as notifications, acted on per-artifact.
|
|
747
|
+
// Requires GENERATE_FROM_KB + owner|editor on the KB.)
|
|
748
|
+
/**
|
|
749
|
+
* Regenerate a stale artifact from a notification using current chunks.
|
|
750
|
+
* POST /api/v1/notifications/:notificationId/artifacts/:artifactId/regenerate
|
|
751
|
+
* @param {String} notificationId The notification id
|
|
752
|
+
* @param {String} artifactId The artifact id
|
|
753
|
+
* @param {object} data Body `{ entityType }`
|
|
754
|
+
* @param {String} authToken Authentication token
|
|
755
|
+
* @returns {Promise<object>}
|
|
756
|
+
*/
|
|
757
|
+
const regenerateArtifact = (notificationId, artifactId, data, authToken) => {
|
|
758
|
+
return new Promise((resolve, reject) => {
|
|
759
|
+
const request = axiosClient_js_1.client.post(`/api/v1/notifications/${notificationId}/artifacts/${artifactId}/regenerate`, data, { headers: { authorization: authToken } });
|
|
760
|
+
request
|
|
761
|
+
.then((response) => {
|
|
762
|
+
resolve(response.data);
|
|
763
|
+
})
|
|
764
|
+
.catch((error) => {
|
|
765
|
+
reject(error);
|
|
766
|
+
});
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
exports.regenerateArtifact = regenerateArtifact;
|
|
770
|
+
/**
|
|
771
|
+
* Retire (soft-delete) a stale artifact from a notification.
|
|
772
|
+
* POST /api/v1/notifications/:notificationId/artifacts/:artifactId/retire
|
|
773
|
+
* @param {String} notificationId The notification id
|
|
774
|
+
* @param {String} artifactId The artifact id
|
|
775
|
+
* @param {object} data Body `{ entityType }`
|
|
776
|
+
* @param {String} authToken Authentication token
|
|
777
|
+
* @returns {Promise<object>}
|
|
778
|
+
*/
|
|
779
|
+
const retireArtifact = (notificationId, artifactId, data, authToken) => {
|
|
780
|
+
return new Promise((resolve, reject) => {
|
|
781
|
+
const request = axiosClient_js_1.client.post(`/api/v1/notifications/${notificationId}/artifacts/${artifactId}/retire`, data, { headers: { authorization: authToken } });
|
|
782
|
+
request
|
|
783
|
+
.then((response) => {
|
|
784
|
+
resolve(response.data);
|
|
785
|
+
})
|
|
786
|
+
.catch((error) => {
|
|
787
|
+
reject(error);
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
};
|
|
791
|
+
exports.retireArtifact = retireArtifact;
|
|
792
|
+
/**
|
|
793
|
+
* Dismiss a stale-artifact flag (mark the staleness acceptable).
|
|
794
|
+
* POST /api/v1/notifications/:notificationId/artifacts/:artifactId/dismiss
|
|
795
|
+
* @param {String} notificationId The notification id
|
|
796
|
+
* @param {String} artifactId The artifact id
|
|
797
|
+
* @param {object} data Body `{ entityType, reason? }`
|
|
798
|
+
* @param {String} authToken Authentication token
|
|
799
|
+
* @returns {Promise<object>}
|
|
800
|
+
*/
|
|
801
|
+
const dismissArtifact = (notificationId, artifactId, data, authToken) => {
|
|
802
|
+
return new Promise((resolve, reject) => {
|
|
803
|
+
const request = axiosClient_js_1.client.post(`/api/v1/notifications/${notificationId}/artifacts/${artifactId}/dismiss`, data, { headers: { authorization: authToken } });
|
|
804
|
+
request
|
|
805
|
+
.then((response) => {
|
|
806
|
+
resolve(response.data);
|
|
807
|
+
})
|
|
808
|
+
.catch((error) => {
|
|
809
|
+
reject(error);
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
};
|
|
813
|
+
exports.dismissArtifact = dismissArtifact;
|
|
814
|
+
/**
|
|
815
|
+
* Dismiss an entire out-of-sync notification (all artifacts).
|
|
816
|
+
* POST /api/v1/notifications/:notificationId/dismiss-all
|
|
817
|
+
* @param {String} notificationId The notification id
|
|
818
|
+
* @param {String} authToken Authentication token
|
|
819
|
+
* @returns {Promise<object>}
|
|
820
|
+
*/
|
|
821
|
+
const dismissAllArtifacts = (notificationId, authToken) => {
|
|
822
|
+
return new Promise((resolve, reject) => {
|
|
823
|
+
const request = axiosClient_js_1.client.post(`/api/v1/notifications/${notificationId}/dismiss-all`, {}, { headers: { authorization: authToken } });
|
|
824
|
+
request
|
|
825
|
+
.then((response) => {
|
|
826
|
+
resolve(response.data);
|
|
827
|
+
})
|
|
828
|
+
.catch((error) => {
|
|
829
|
+
reject(error);
|
|
830
|
+
});
|
|
831
|
+
});
|
|
832
|
+
};
|
|
833
|
+
exports.dismissAllArtifacts = dismissAllArtifacts;
|
|
834
|
+
// ── Identity Mapping ──────────────────────────────────────────────────────────
|
|
835
|
+
// (design §14 — maps source-side principals to tenant users for KB source ACLs.)
|
|
836
|
+
/**
|
|
837
|
+
* List the current user's source-side identities.
|
|
838
|
+
* GET /api/v1/identity/source-mappings
|
|
839
|
+
* @param {String} authToken Authentication token
|
|
840
|
+
* @returns {Promise<object>}
|
|
841
|
+
*/
|
|
842
|
+
const listSourceMappings = (authToken) => {
|
|
843
|
+
return new Promise((resolve, reject) => {
|
|
844
|
+
const request = axiosClient_js_1.client.get(`/api/v1/identity/source-mappings`, {
|
|
845
|
+
headers: { authorization: authToken },
|
|
846
|
+
});
|
|
847
|
+
request
|
|
848
|
+
.then((response) => {
|
|
849
|
+
resolve(response.data);
|
|
850
|
+
})
|
|
851
|
+
.catch((error) => {
|
|
852
|
+
reject(error);
|
|
853
|
+
});
|
|
854
|
+
});
|
|
855
|
+
};
|
|
856
|
+
exports.listSourceMappings = listSourceMappings;
|
|
857
|
+
/**
|
|
858
|
+
* Tenant-admin override for a user's source identity mapping.
|
|
859
|
+
* PUT /api/v1/identity/source-mappings/:sourceType
|
|
860
|
+
* @param {String} sourceType The source type key
|
|
861
|
+
* @param {object} data The mapping override
|
|
862
|
+
* @param {String} authToken Authentication token
|
|
863
|
+
* @returns {Promise<object>}
|
|
864
|
+
*/
|
|
865
|
+
const updateSourceMapping = (sourceType, data, authToken) => {
|
|
866
|
+
return new Promise((resolve, reject) => {
|
|
867
|
+
const request = axiosClient_js_1.client.put(`/api/v1/identity/source-mappings/${sourceType}`, data, { headers: { authorization: authToken } });
|
|
868
|
+
request
|
|
869
|
+
.then((response) => {
|
|
870
|
+
resolve(response.data);
|
|
871
|
+
})
|
|
872
|
+
.catch((error) => {
|
|
873
|
+
reject(error);
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
};
|
|
877
|
+
exports.updateSourceMapping = updateSourceMapping;
|
|
878
|
+
/**
|
|
879
|
+
* Bulk-resolve source principal IDs → tenant users (internal / service-to-service).
|
|
880
|
+
* POST /api/v1/identity/source-mappings/resolve
|
|
881
|
+
* @param {object} data Body carrying the principal IDs to resolve
|
|
882
|
+
* @param {String} authToken Authentication token
|
|
883
|
+
* @returns {Promise<object>}
|
|
884
|
+
*/
|
|
885
|
+
const resolveSourceMappings = (data, authToken) => {
|
|
886
|
+
return new Promise((resolve, reject) => {
|
|
887
|
+
const request = axiosClient_js_1.client.post(`/api/v1/identity/source-mappings/resolve`, data, { headers: { authorization: authToken } });
|
|
888
|
+
request
|
|
889
|
+
.then((response) => {
|
|
890
|
+
resolve(response.data);
|
|
891
|
+
})
|
|
892
|
+
.catch((error) => {
|
|
893
|
+
reject(error);
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
};
|
|
897
|
+
exports.resolveSourceMappings = resolveSourceMappings;
|
|
898
|
+
//# sourceMappingURL=knowledgeBase.js.map
|