weave-typescript 0.49.0 → 0.51.0
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/weaveapi/consolidation/v1/consolidation.pb.d.ts +13 -14
- package/dist/weaveapi/consolidation/v1/consolidation.pb.js +62 -74
- package/dist/weaveapi/ingestion/v1/ingestion.pb.d.ts +82 -50
- package/dist/weaveapi/ingestion/v1/ingestion.pb.js +708 -216
- package/dist/weaveapi/ingestion/v1/service.pb.d.ts +50 -7
- package/dist/weaveapi/ingestion/v1/service.pb.js +279 -16
- package/dist/weaveapi/ingestion/v1/table.pb.d.ts +121 -0
- package/dist/weaveapi/ingestion/v1/table.pb.js +1478 -0
- package/dist/weaveapi/model/v1/model.pb.d.ts +3 -3
- package/dist/weaveapi/model/v1/model.pb.js +33 -33
- package/dist/weaveapi/model/v1/service.pb.d.ts +3 -3
- package/dist/weaveapi/model/v1/service.pb.js +33 -33
- package/dist/weaveapi/retrieval/v1/retrieval.pb.d.ts +123 -0
- package/dist/weaveapi/retrieval/v1/retrieval.pb.js +2096 -113
- package/dist/weaveapi/retrieval/v1/service.pb.d.ts +29 -1
- package/dist/weaveapi/retrieval/v1/service.pb.js +142 -0
- package/dist/weavesql/weavedb/agent_sql.d.ts +27 -0
- package/dist/weavesql/weavedb/agent_sql.js +43 -1
- package/dist/weavesql/weavedb/consolidation_sql.d.ts +33 -33
- package/dist/weavesql/weavedb/consolidation_sql.js +56 -56
- package/dist/weavesql/weavedb/document_table_sql.d.ts +533 -0
- package/dist/weavesql/weavedb/document_table_sql.js +1352 -0
- package/dist/weavesql/weavedb/ingestion_sql.d.ts +67 -34
- package/dist/weavesql/weavedb/ingestion_sql.js +169 -73
- package/dist/weavesql/weavedb/retrieval_sql.d.ts +11 -11
- package/dist/weavesql/weavedb/retrieval_sql.js +13 -13
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearThreadClusterAssignmentsByDocumentQuery = exports.clearThreadClusterAssignmentsByOrganizationQuery = exports.assignThreadsToClusterQuery = exports.listApprovedThreadsForConsolidationQuery = exports.
|
|
3
|
+
exports.clearThreadClusterAssignmentsByDocumentQuery = exports.clearThreadClusterAssignmentsByOrganizationQuery = exports.assignThreadsToClusterQuery = exports.listApprovedThreadsForConsolidationQuery = exports.listConceptClustersByParentAndScopeQuery = exports.listConceptClustersByScopeQuery = exports.getConceptClusterByOrganizationScopeAndIDQuery = exports.upsertConceptClusterQuery = exports.listConsolidationRunsByOrganizationQuery = exports.updateConsolidationRunStateQuery = exports.getConsolidationRunByOrganizationAndIDQuery = exports.createConsolidationRunQuery = void 0;
|
|
4
4
|
exports.createConsolidationRun = createConsolidationRun;
|
|
5
5
|
exports.getConsolidationRunByOrganizationAndID = getConsolidationRunByOrganizationAndID;
|
|
6
6
|
exports.updateConsolidationRunState = updateConsolidationRunState;
|
|
7
7
|
exports.listConsolidationRunsByOrganization = listConsolidationRunsByOrganization;
|
|
8
8
|
exports.upsertConceptCluster = upsertConceptCluster;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
9
|
+
exports.getConceptClusterByOrganizationScopeAndID = getConceptClusterByOrganizationScopeAndID;
|
|
10
|
+
exports.listConceptClustersByScope = listConceptClustersByScope;
|
|
11
|
+
exports.listConceptClustersByParentAndScope = listConceptClustersByParentAndScope;
|
|
12
12
|
exports.listApprovedThreadsForConsolidation = listApprovedThreadsForConsolidation;
|
|
13
13
|
exports.createConsolidationRunQuery = `-- name: CreateConsolidationRun :one
|
|
14
14
|
INSERT INTO weave.consolidation_runs (
|
|
@@ -170,8 +170,8 @@ exports.upsertConceptClusterQuery = `-- name: UpsertConceptCluster :one
|
|
|
170
170
|
INSERT INTO weave.concept_clusters (
|
|
171
171
|
id,
|
|
172
172
|
organization_id,
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
scope_kind,
|
|
174
|
+
scope_key,
|
|
175
175
|
name,
|
|
176
176
|
description,
|
|
177
177
|
knowledge_type,
|
|
@@ -200,8 +200,8 @@ ON CONFLICT (id) DO UPDATE
|
|
|
200
200
|
SET
|
|
201
201
|
name = EXCLUDED.name,
|
|
202
202
|
description = EXCLUDED.description,
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
scope_kind = EXCLUDED.scope_kind,
|
|
204
|
+
scope_key = EXCLUDED.scope_key,
|
|
205
205
|
knowledge_type = EXCLUDED.knowledge_type,
|
|
206
206
|
level = EXCLUDED.level,
|
|
207
207
|
parent_id = EXCLUDED.parent_id,
|
|
@@ -213,8 +213,8 @@ SET
|
|
|
213
213
|
RETURNING
|
|
214
214
|
id,
|
|
215
215
|
organization_id,
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
scope_kind,
|
|
217
|
+
scope_key,
|
|
218
218
|
name,
|
|
219
219
|
description,
|
|
220
220
|
knowledge_type,
|
|
@@ -227,7 +227,7 @@ RETURNING
|
|
|
227
227
|
async function upsertConceptCluster(client, args) {
|
|
228
228
|
const result = await client.query({
|
|
229
229
|
text: exports.upsertConceptClusterQuery,
|
|
230
|
-
values: [args.id, args.organizationId, args.
|
|
230
|
+
values: [args.id, args.organizationId, args.scopeKind, args.scopeKey, args.name, args.description, args.knowledgeType, args.level, args.parentId, args.embedding, args.centroid, args.threadCount, args.consolidationRunId],
|
|
231
231
|
rowMode: "array"
|
|
232
232
|
});
|
|
233
233
|
if (result.rows.length !== 1) {
|
|
@@ -237,8 +237,8 @@ async function upsertConceptCluster(client, args) {
|
|
|
237
237
|
return {
|
|
238
238
|
id: row[0],
|
|
239
239
|
organizationId: row[1],
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
scopeKind: row[2],
|
|
241
|
+
scopeKey: row[3],
|
|
242
242
|
name: row[4],
|
|
243
243
|
description: row[5],
|
|
244
244
|
knowledgeType: row[6],
|
|
@@ -250,12 +250,12 @@ async function upsertConceptCluster(client, args) {
|
|
|
250
250
|
updatedAt: row[12]
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
-
exports.
|
|
253
|
+
exports.getConceptClusterByOrganizationScopeAndIDQuery = `-- name: GetConceptClusterByOrganizationScopeAndID :one
|
|
254
254
|
SELECT
|
|
255
255
|
id,
|
|
256
256
|
organization_id,
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
scope_kind,
|
|
258
|
+
scope_key,
|
|
259
259
|
name,
|
|
260
260
|
description,
|
|
261
261
|
knowledge_type,
|
|
@@ -267,13 +267,13 @@ SELECT
|
|
|
267
267
|
updated_at
|
|
268
268
|
FROM weave.concept_clusters
|
|
269
269
|
WHERE organization_id = $1
|
|
270
|
-
AND
|
|
271
|
-
AND
|
|
270
|
+
AND scope_kind = $2
|
|
271
|
+
AND scope_key = $3
|
|
272
272
|
AND id = $4`;
|
|
273
|
-
async function
|
|
273
|
+
async function getConceptClusterByOrganizationScopeAndID(client, args) {
|
|
274
274
|
const result = await client.query({
|
|
275
|
-
text: exports.
|
|
276
|
-
values: [args.organizationId, args.
|
|
275
|
+
text: exports.getConceptClusterByOrganizationScopeAndIDQuery,
|
|
276
|
+
values: [args.organizationId, args.scopeKind, args.scopeKey, args.id],
|
|
277
277
|
rowMode: "array"
|
|
278
278
|
});
|
|
279
279
|
if (result.rows.length !== 1) {
|
|
@@ -283,8 +283,8 @@ async function getConceptClusterByOrganizationRealmAndID(client, args) {
|
|
|
283
283
|
return {
|
|
284
284
|
id: row[0],
|
|
285
285
|
organizationId: row[1],
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
scopeKind: row[2],
|
|
287
|
+
scopeKey: row[3],
|
|
288
288
|
name: row[4],
|
|
289
289
|
description: row[5],
|
|
290
290
|
knowledgeType: row[6],
|
|
@@ -296,12 +296,12 @@ async function getConceptClusterByOrganizationRealmAndID(client, args) {
|
|
|
296
296
|
updatedAt: row[12]
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
exports.
|
|
299
|
+
exports.listConceptClustersByScopeQuery = `-- name: ListConceptClustersByScope :many
|
|
300
300
|
SELECT
|
|
301
301
|
id,
|
|
302
302
|
organization_id,
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
scope_kind,
|
|
304
|
+
scope_key,
|
|
305
305
|
name,
|
|
306
306
|
description,
|
|
307
307
|
knowledge_type,
|
|
@@ -313,23 +313,23 @@ SELECT
|
|
|
313
313
|
updated_at
|
|
314
314
|
FROM weave.concept_clusters
|
|
315
315
|
WHERE organization_id = $1
|
|
316
|
-
AND
|
|
317
|
-
AND
|
|
316
|
+
AND scope_kind = $2
|
|
317
|
+
AND scope_key = $3
|
|
318
318
|
AND ($4 = '' OR knowledge_type = $4)
|
|
319
319
|
AND ($5 <= 0 OR level <= $5)
|
|
320
320
|
ORDER BY level ASC, updated_at DESC, id ASC`;
|
|
321
|
-
async function
|
|
321
|
+
async function listConceptClustersByScope(client, args) {
|
|
322
322
|
const result = await client.query({
|
|
323
|
-
text: exports.
|
|
324
|
-
values: [args.organizationId, args.
|
|
323
|
+
text: exports.listConceptClustersByScopeQuery,
|
|
324
|
+
values: [args.organizationId, args.scopeKind, args.scopeKey, args.knowledgeType, args.maxDepth],
|
|
325
325
|
rowMode: "array"
|
|
326
326
|
});
|
|
327
327
|
return result.rows.map(row => {
|
|
328
328
|
return {
|
|
329
329
|
id: row[0],
|
|
330
330
|
organizationId: row[1],
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
scopeKind: row[2],
|
|
332
|
+
scopeKey: row[3],
|
|
333
333
|
name: row[4],
|
|
334
334
|
description: row[5],
|
|
335
335
|
knowledgeType: row[6],
|
|
@@ -342,12 +342,12 @@ async function listConceptClustersByRealm(client, args) {
|
|
|
342
342
|
};
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
exports.
|
|
345
|
+
exports.listConceptClustersByParentAndScopeQuery = `-- name: ListConceptClustersByParentAndScope :many
|
|
346
346
|
SELECT
|
|
347
347
|
id,
|
|
348
348
|
organization_id,
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
scope_kind,
|
|
350
|
+
scope_key,
|
|
351
351
|
name,
|
|
352
352
|
description,
|
|
353
353
|
knowledge_type,
|
|
@@ -359,22 +359,22 @@ SELECT
|
|
|
359
359
|
updated_at
|
|
360
360
|
FROM weave.concept_clusters
|
|
361
361
|
WHERE organization_id = $1
|
|
362
|
-
AND
|
|
363
|
-
AND
|
|
362
|
+
AND scope_kind = $2
|
|
363
|
+
AND scope_key = $3
|
|
364
364
|
AND parent_id = $4
|
|
365
365
|
ORDER BY updated_at DESC, id ASC`;
|
|
366
|
-
async function
|
|
366
|
+
async function listConceptClustersByParentAndScope(client, args) {
|
|
367
367
|
const result = await client.query({
|
|
368
|
-
text: exports.
|
|
369
|
-
values: [args.organizationId, args.
|
|
368
|
+
text: exports.listConceptClustersByParentAndScopeQuery,
|
|
369
|
+
values: [args.organizationId, args.scopeKind, args.scopeKey, args.parentId],
|
|
370
370
|
rowMode: "array"
|
|
371
371
|
});
|
|
372
372
|
return result.rows.map(row => {
|
|
373
373
|
return {
|
|
374
374
|
id: row[0],
|
|
375
375
|
organizationId: row[1],
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
scopeKind: row[2],
|
|
377
|
+
scopeKey: row[3],
|
|
378
378
|
name: row[4],
|
|
379
379
|
description: row[5],
|
|
380
380
|
knowledgeType: row[6],
|
|
@@ -399,12 +399,12 @@ SELECT
|
|
|
399
399
|
t.approved_at,
|
|
400
400
|
CASE
|
|
401
401
|
WHEN d.scope = 'DOCUMENT_SCOPE_ORG'
|
|
402
|
-
THEN '
|
|
402
|
+
THEN 'SCOPE_KIND_ORG'::text
|
|
403
403
|
WHEN d.scope = 'DOCUMENT_SCOPE_RESTRICTED'
|
|
404
|
-
THEN '
|
|
404
|
+
THEN 'SCOPE_KIND_RESTRICTED_GROUP'::text
|
|
405
405
|
WHEN d.scope = 'DOCUMENT_SCOPE_PRIVATE'
|
|
406
|
-
THEN '
|
|
407
|
-
END AS
|
|
406
|
+
THEN 'SCOPE_KIND_USER'::text
|
|
407
|
+
END AS scope_kind,
|
|
408
408
|
CASE
|
|
409
409
|
WHEN d.scope = 'DOCUMENT_SCOPE_ORG'
|
|
410
410
|
THEN ''::text
|
|
@@ -412,7 +412,7 @@ SELECT
|
|
|
412
412
|
THEN drg.restricted_group_id::text
|
|
413
413
|
WHEN d.scope = 'DOCUMENT_SCOPE_PRIVATE'
|
|
414
414
|
THEN d.uploaded_by_user_id::text
|
|
415
|
-
END AS
|
|
415
|
+
END AS scope_key
|
|
416
416
|
FROM weave.threads t
|
|
417
417
|
JOIN weave.documents d ON d.id = t.document_id
|
|
418
418
|
LEFT JOIN weave.document_restricted_groups drg
|
|
@@ -441,8 +441,8 @@ async function listApprovedThreadsForConsolidation(client, args) {
|
|
|
441
441
|
knowledgeType: row[5],
|
|
442
442
|
embeddingText: row[6],
|
|
443
443
|
approvedAt: row[7],
|
|
444
|
-
|
|
445
|
-
|
|
444
|
+
scopeKind: row[8],
|
|
445
|
+
scopeKey: row[9]
|
|
446
446
|
};
|
|
447
447
|
});
|
|
448
448
|
}
|
|
@@ -457,21 +457,21 @@ WHERE t.organization_id = $1
|
|
|
457
457
|
AND cc.id = $3
|
|
458
458
|
AND d.id = t.document_id
|
|
459
459
|
AND (
|
|
460
|
-
(cc.
|
|
461
|
-
AND cc.
|
|
460
|
+
(cc.scope_kind = 'SCOPE_KIND_ORG'
|
|
461
|
+
AND cc.scope_key = ''
|
|
462
462
|
AND d.scope = 'DOCUMENT_SCOPE_ORG')
|
|
463
|
-
OR (cc.
|
|
463
|
+
OR (cc.scope_kind = 'SCOPE_KIND_RESTRICTED_GROUP'
|
|
464
464
|
AND d.scope = 'DOCUMENT_SCOPE_RESTRICTED'
|
|
465
465
|
AND EXISTS (
|
|
466
466
|
SELECT 1
|
|
467
467
|
FROM weave.document_restricted_groups drg
|
|
468
468
|
WHERE drg.organization_id = d.organization_id
|
|
469
469
|
AND drg.document_id = d.id
|
|
470
|
-
AND drg.restricted_group_id::text = cc.
|
|
470
|
+
AND drg.restricted_group_id::text = cc.scope_key
|
|
471
471
|
))
|
|
472
|
-
OR (cc.
|
|
472
|
+
OR (cc.scope_kind = 'SCOPE_KIND_USER'
|
|
473
473
|
AND d.scope = 'DOCUMENT_SCOPE_PRIVATE'
|
|
474
|
-
AND cc.
|
|
474
|
+
AND cc.scope_key = d.uploaded_by_user_id::text)
|
|
475
475
|
)`;
|
|
476
476
|
exports.clearThreadClusterAssignmentsByOrganizationQuery = `-- name: ClearThreadClusterAssignmentsByOrganization :execrows
|
|
477
477
|
UPDATE weave.threads
|