weave-typescript 0.27.0 → 0.28.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 +134 -0
- package/dist/weaveapi/consolidation/v1/consolidation.pb.js +1620 -0
- package/dist/weaveapi/consolidation/v1/service.pb.d.ts +93 -0
- package/dist/weaveapi/consolidation/v1/service.pb.js +427 -0
- package/dist/weaveapi/ingestion/v1/ingestion.pb.d.ts +433 -0
- package/dist/weaveapi/ingestion/v1/ingestion.pb.js +5626 -0
- package/dist/weaveapi/ingestion/v1/service.pb.d.ts +181 -0
- package/dist/weaveapi/ingestion/v1/service.pb.js +917 -0
- package/dist/weaveapi/model/v1/model.pb.d.ts +10 -0
- package/dist/weaveapi/model/v1/model.pb.js +181 -1
- package/dist/weaveapi/model/v1/service.pb.d.ts +50 -1
- package/dist/weaveapi/model/v1/service.pb.js +464 -1
- package/dist/weaveapi/retrieval/v1/retrieval.pb.d.ts +161 -0
- package/dist/weaveapi/retrieval/v1/retrieval.pb.js +1885 -0
- package/dist/weaveapi/retrieval/v1/service.pb.d.ts +51 -0
- package/dist/weaveapi/retrieval/v1/service.pb.js +164 -0
- package/dist/weavesql/weavedb/consolidation_sql.d.ts +212 -0
- package/dist/weavesql/weavedb/consolidation_sql.js +470 -0
- package/dist/weavesql/weavedb/document_security_sql.d.ts +128 -0
- package/dist/weavesql/weavedb/document_security_sql.js +284 -0
- package/dist/weavesql/weavedb/ingestion_sql.d.ts +1108 -0
- package/dist/weavesql/weavedb/ingestion_sql.js +2503 -0
- package/dist/weavesql/weavedb/retrieval_sql.d.ts +284 -0
- package/dist/weavesql/weavedb/retrieval_sql.js +769 -0
- package/package.json +2 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ExplainRetrievalRequest, ExplainRetrievalResponse, RetrieveRequest, RetrieveResponse } from "./retrieval.pb";
|
|
2
|
+
export declare const protobufPackage = "weaveapi.retrieval.v1";
|
|
3
|
+
export interface RetrievalService {
|
|
4
|
+
Retrieve(request: RetrieveRequest): Promise<RetrieveResponse>;
|
|
5
|
+
ExplainRetrieval(request: ExplainRetrievalRequest): Promise<ExplainRetrievalResponse>;
|
|
6
|
+
}
|
|
7
|
+
export declare const RetrievalServiceServiceName = "weaveapi.retrieval.v1.RetrievalService";
|
|
8
|
+
export declare class RetrievalServiceClientImpl implements RetrievalService {
|
|
9
|
+
private readonly rpc;
|
|
10
|
+
private readonly service;
|
|
11
|
+
constructor(rpc: Rpc, opts?: {
|
|
12
|
+
service?: string;
|
|
13
|
+
});
|
|
14
|
+
Retrieve(request: RetrieveRequest): Promise<RetrieveResponse>;
|
|
15
|
+
ExplainRetrieval(request: ExplainRetrievalRequest): Promise<ExplainRetrievalResponse>;
|
|
16
|
+
}
|
|
17
|
+
export type RetrievalServiceDefinition = typeof RetrievalServiceDefinition;
|
|
18
|
+
export declare const RetrievalServiceDefinition: {
|
|
19
|
+
readonly name: "RetrievalService";
|
|
20
|
+
readonly fullName: "weaveapi.retrieval.v1.RetrievalService";
|
|
21
|
+
readonly methods: {
|
|
22
|
+
readonly retrieve: {
|
|
23
|
+
readonly name: "Retrieve";
|
|
24
|
+
readonly requestType: typeof RetrieveRequest;
|
|
25
|
+
readonly requestStream: false;
|
|
26
|
+
readonly responseType: typeof RetrieveResponse;
|
|
27
|
+
readonly responseStream: false;
|
|
28
|
+
readonly options: {
|
|
29
|
+
readonly _unknownFields: {
|
|
30
|
+
readonly 578365826: readonly [Uint8Array];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly explainRetrieval: {
|
|
35
|
+
readonly name: "ExplainRetrieval";
|
|
36
|
+
readonly requestType: typeof ExplainRetrievalRequest;
|
|
37
|
+
readonly requestStream: false;
|
|
38
|
+
readonly responseType: typeof ExplainRetrievalResponse;
|
|
39
|
+
readonly responseStream: false;
|
|
40
|
+
readonly options: {
|
|
41
|
+
readonly _unknownFields: {
|
|
42
|
+
readonly 578365826: readonly [Uint8Array];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
interface Rpc {
|
|
49
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.6
|
|
5
|
+
// protoc unknown
|
|
6
|
+
// source: weaveapi/retrieval/v1/service.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.RetrievalServiceDefinition = exports.RetrievalServiceClientImpl = exports.RetrievalServiceServiceName = exports.protobufPackage = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const retrieval_pb_1 = require("./retrieval.pb");
|
|
12
|
+
exports.protobufPackage = "weaveapi.retrieval.v1";
|
|
13
|
+
exports.RetrievalServiceServiceName = "weaveapi.retrieval.v1.RetrievalService";
|
|
14
|
+
class RetrievalServiceClientImpl {
|
|
15
|
+
constructor(rpc, opts) {
|
|
16
|
+
this.service = (opts === null || opts === void 0 ? void 0 : opts.service) || exports.RetrievalServiceServiceName;
|
|
17
|
+
this.rpc = rpc;
|
|
18
|
+
this.Retrieve = this.Retrieve.bind(this);
|
|
19
|
+
this.ExplainRetrieval = this.ExplainRetrieval.bind(this);
|
|
20
|
+
}
|
|
21
|
+
Retrieve(request) {
|
|
22
|
+
const data = retrieval_pb_1.RetrieveRequest.encode(request).finish();
|
|
23
|
+
const promise = this.rpc.request(this.service, "Retrieve", data);
|
|
24
|
+
return promise.then((data) => retrieval_pb_1.RetrieveResponse.decode(new wire_1.BinaryReader(data)));
|
|
25
|
+
}
|
|
26
|
+
ExplainRetrieval(request) {
|
|
27
|
+
const data = retrieval_pb_1.ExplainRetrievalRequest.encode(request).finish();
|
|
28
|
+
const promise = this.rpc.request(this.service, "ExplainRetrieval", data);
|
|
29
|
+
return promise.then((data) => retrieval_pb_1.ExplainRetrievalResponse.decode(new wire_1.BinaryReader(data)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.RetrievalServiceClientImpl = RetrievalServiceClientImpl;
|
|
33
|
+
exports.RetrievalServiceDefinition = {
|
|
34
|
+
name: "RetrievalService",
|
|
35
|
+
fullName: "weaveapi.retrieval.v1.RetrievalService",
|
|
36
|
+
methods: {
|
|
37
|
+
retrieve: {
|
|
38
|
+
name: "Retrieve",
|
|
39
|
+
requestType: retrieval_pb_1.RetrieveRequest,
|
|
40
|
+
requestStream: false,
|
|
41
|
+
responseType: retrieval_pb_1.RetrieveResponse,
|
|
42
|
+
responseStream: false,
|
|
43
|
+
options: {
|
|
44
|
+
_unknownFields: {
|
|
45
|
+
578365826: [
|
|
46
|
+
new Uint8Array([
|
|
47
|
+
46,
|
|
48
|
+
58,
|
|
49
|
+
1,
|
|
50
|
+
42,
|
|
51
|
+
34,
|
|
52
|
+
41,
|
|
53
|
+
47,
|
|
54
|
+
118,
|
|
55
|
+
49,
|
|
56
|
+
47,
|
|
57
|
+
111,
|
|
58
|
+
114,
|
|
59
|
+
103,
|
|
60
|
+
47,
|
|
61
|
+
123,
|
|
62
|
+
111,
|
|
63
|
+
114,
|
|
64
|
+
103,
|
|
65
|
+
97,
|
|
66
|
+
110,
|
|
67
|
+
105,
|
|
68
|
+
122,
|
|
69
|
+
97,
|
|
70
|
+
116,
|
|
71
|
+
105,
|
|
72
|
+
111,
|
|
73
|
+
110,
|
|
74
|
+
95,
|
|
75
|
+
105,
|
|
76
|
+
100,
|
|
77
|
+
125,
|
|
78
|
+
47,
|
|
79
|
+
114,
|
|
80
|
+
101,
|
|
81
|
+
116,
|
|
82
|
+
114,
|
|
83
|
+
105,
|
|
84
|
+
101,
|
|
85
|
+
118,
|
|
86
|
+
97,
|
|
87
|
+
108,
|
|
88
|
+
47,
|
|
89
|
+
113,
|
|
90
|
+
117,
|
|
91
|
+
101,
|
|
92
|
+
114,
|
|
93
|
+
121,
|
|
94
|
+
]),
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
explainRetrieval: {
|
|
100
|
+
name: "ExplainRetrieval",
|
|
101
|
+
requestType: retrieval_pb_1.ExplainRetrievalRequest,
|
|
102
|
+
requestStream: false,
|
|
103
|
+
responseType: retrieval_pb_1.ExplainRetrievalResponse,
|
|
104
|
+
responseStream: false,
|
|
105
|
+
options: {
|
|
106
|
+
_unknownFields: {
|
|
107
|
+
578365826: [
|
|
108
|
+
new Uint8Array([
|
|
109
|
+
48,
|
|
110
|
+
58,
|
|
111
|
+
1,
|
|
112
|
+
42,
|
|
113
|
+
34,
|
|
114
|
+
43,
|
|
115
|
+
47,
|
|
116
|
+
118,
|
|
117
|
+
49,
|
|
118
|
+
47,
|
|
119
|
+
111,
|
|
120
|
+
114,
|
|
121
|
+
103,
|
|
122
|
+
47,
|
|
123
|
+
123,
|
|
124
|
+
111,
|
|
125
|
+
114,
|
|
126
|
+
103,
|
|
127
|
+
97,
|
|
128
|
+
110,
|
|
129
|
+
105,
|
|
130
|
+
122,
|
|
131
|
+
97,
|
|
132
|
+
116,
|
|
133
|
+
105,
|
|
134
|
+
111,
|
|
135
|
+
110,
|
|
136
|
+
95,
|
|
137
|
+
105,
|
|
138
|
+
100,
|
|
139
|
+
125,
|
|
140
|
+
47,
|
|
141
|
+
114,
|
|
142
|
+
101,
|
|
143
|
+
116,
|
|
144
|
+
114,
|
|
145
|
+
105,
|
|
146
|
+
101,
|
|
147
|
+
118,
|
|
148
|
+
97,
|
|
149
|
+
108,
|
|
150
|
+
47,
|
|
151
|
+
101,
|
|
152
|
+
120,
|
|
153
|
+
112,
|
|
154
|
+
108,
|
|
155
|
+
97,
|
|
156
|
+
105,
|
|
157
|
+
110,
|
|
158
|
+
]),
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createConsolidationRunQuery = "-- name: CreateConsolidationRun :one\nINSERT INTO weave.consolidation_runs (\n id,\n organization_id,\n status\n) VALUES (\n $1,\n $2,\n $3\n)\nRETURNING\n id,\n organization_id,\n status,\n thread_count,\n cluster_count,\n hierarchy_depth,\n error,\n started_at,\n completed_at";
|
|
6
|
+
export interface CreateConsolidationRunArgs {
|
|
7
|
+
id: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
status: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateConsolidationRunRow {
|
|
12
|
+
id: string;
|
|
13
|
+
organizationId: string;
|
|
14
|
+
status: string;
|
|
15
|
+
threadCount: number;
|
|
16
|
+
clusterCount: number;
|
|
17
|
+
hierarchyDepth: number;
|
|
18
|
+
error: string;
|
|
19
|
+
startedAt: Date;
|
|
20
|
+
completedAt: Date | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function createConsolidationRun(client: Client, args: CreateConsolidationRunArgs): Promise<CreateConsolidationRunRow | null>;
|
|
23
|
+
export declare const getConsolidationRunByOrganizationAndIDQuery = "-- name: GetConsolidationRunByOrganizationAndID :one\nSELECT\n id,\n organization_id,\n status,\n thread_count,\n cluster_count,\n hierarchy_depth,\n error,\n started_at,\n completed_at\nFROM weave.consolidation_runs\nWHERE organization_id = $1\n AND id = $2";
|
|
24
|
+
export interface GetConsolidationRunByOrganizationAndIDArgs {
|
|
25
|
+
organizationId: string;
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetConsolidationRunByOrganizationAndIDRow {
|
|
29
|
+
id: string;
|
|
30
|
+
organizationId: string;
|
|
31
|
+
status: string;
|
|
32
|
+
threadCount: number;
|
|
33
|
+
clusterCount: number;
|
|
34
|
+
hierarchyDepth: number;
|
|
35
|
+
error: string;
|
|
36
|
+
startedAt: Date;
|
|
37
|
+
completedAt: Date | null;
|
|
38
|
+
}
|
|
39
|
+
export declare function getConsolidationRunByOrganizationAndID(client: Client, args: GetConsolidationRunByOrganizationAndIDArgs): Promise<GetConsolidationRunByOrganizationAndIDRow | null>;
|
|
40
|
+
export declare const updateConsolidationRunStateQuery = "-- name: UpdateConsolidationRunState :one\nUPDATE weave.consolidation_runs\nSET\n status = $1,\n thread_count = $2,\n cluster_count = $3,\n hierarchy_depth = $4,\n error = $5,\n completed_at = $6\nWHERE id = $7\n AND organization_id = $8\nRETURNING\n id,\n organization_id,\n status,\n thread_count,\n cluster_count,\n hierarchy_depth,\n error,\n started_at,\n completed_at";
|
|
41
|
+
export interface UpdateConsolidationRunStateArgs {
|
|
42
|
+
status: string;
|
|
43
|
+
threadCount: number;
|
|
44
|
+
clusterCount: number;
|
|
45
|
+
hierarchyDepth: number;
|
|
46
|
+
error: string;
|
|
47
|
+
completedAt: Date | null;
|
|
48
|
+
id: string;
|
|
49
|
+
organizationId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface UpdateConsolidationRunStateRow {
|
|
52
|
+
id: string;
|
|
53
|
+
organizationId: string;
|
|
54
|
+
status: string;
|
|
55
|
+
threadCount: number;
|
|
56
|
+
clusterCount: number;
|
|
57
|
+
hierarchyDepth: number;
|
|
58
|
+
error: string;
|
|
59
|
+
startedAt: Date;
|
|
60
|
+
completedAt: Date | null;
|
|
61
|
+
}
|
|
62
|
+
export declare function updateConsolidationRunState(client: Client, args: UpdateConsolidationRunStateArgs): Promise<UpdateConsolidationRunStateRow | null>;
|
|
63
|
+
export declare const listConsolidationRunsByOrganizationQuery = "-- name: ListConsolidationRunsByOrganization :many\nSELECT\n id,\n organization_id,\n status,\n thread_count,\n cluster_count,\n hierarchy_depth,\n error,\n started_at,\n completed_at\nFROM weave.consolidation_runs\nWHERE organization_id = $1\nORDER BY started_at DESC\nLIMIT $3 OFFSET $2";
|
|
64
|
+
export interface ListConsolidationRunsByOrganizationArgs {
|
|
65
|
+
organizationId: string;
|
|
66
|
+
pageOffset: string;
|
|
67
|
+
pageSize: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ListConsolidationRunsByOrganizationRow {
|
|
70
|
+
id: string;
|
|
71
|
+
organizationId: string;
|
|
72
|
+
status: string;
|
|
73
|
+
threadCount: number;
|
|
74
|
+
clusterCount: number;
|
|
75
|
+
hierarchyDepth: number;
|
|
76
|
+
error: string;
|
|
77
|
+
startedAt: Date;
|
|
78
|
+
completedAt: Date | null;
|
|
79
|
+
}
|
|
80
|
+
export declare function listConsolidationRunsByOrganization(client: Client, args: ListConsolidationRunsByOrganizationArgs): Promise<ListConsolidationRunsByOrganizationRow[]>;
|
|
81
|
+
export declare const upsertConceptClusterQuery = "-- name: UpsertConceptCluster :one\nINSERT INTO weave.concept_clusters (\n id,\n organization_id,\n realm_kind,\n realm_key,\n name,\n description,\n knowledge_type,\n level,\n parent_id,\n embedding,\n centroid,\n thread_count,\n consolidation_run_id\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10::vector,\n $11::vector,\n $12,\n $13\n)\nON CONFLICT (id) DO UPDATE\nSET\n name = EXCLUDED.name,\n description = EXCLUDED.description,\n realm_kind = EXCLUDED.realm_kind,\n realm_key = EXCLUDED.realm_key,\n knowledge_type = EXCLUDED.knowledge_type,\n level = EXCLUDED.level,\n parent_id = EXCLUDED.parent_id,\n embedding = EXCLUDED.embedding,\n centroid = EXCLUDED.centroid,\n thread_count = EXCLUDED.thread_count,\n consolidation_run_id = EXCLUDED.consolidation_run_id,\n updated_at = now()\nRETURNING\n id,\n organization_id,\n realm_kind,\n realm_key,\n name,\n description,\n knowledge_type,\n level,\n parent_id,\n thread_count,\n consolidation_run_id,\n created_at,\n updated_at";
|
|
82
|
+
export interface UpsertConceptClusterArgs {
|
|
83
|
+
id: string;
|
|
84
|
+
organizationId: string;
|
|
85
|
+
realmKind: string;
|
|
86
|
+
realmKey: string;
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
knowledgeType: string;
|
|
90
|
+
level: number;
|
|
91
|
+
parentId: string | null;
|
|
92
|
+
embedding: string;
|
|
93
|
+
centroid: string;
|
|
94
|
+
threadCount: number;
|
|
95
|
+
consolidationRunId: string;
|
|
96
|
+
}
|
|
97
|
+
export interface UpsertConceptClusterRow {
|
|
98
|
+
id: string;
|
|
99
|
+
organizationId: string;
|
|
100
|
+
realmKind: string;
|
|
101
|
+
realmKey: string;
|
|
102
|
+
name: string;
|
|
103
|
+
description: string;
|
|
104
|
+
knowledgeType: string;
|
|
105
|
+
level: number;
|
|
106
|
+
parentId: string | null;
|
|
107
|
+
threadCount: number;
|
|
108
|
+
consolidationRunId: string;
|
|
109
|
+
createdAt: Date;
|
|
110
|
+
updatedAt: Date;
|
|
111
|
+
}
|
|
112
|
+
export declare function upsertConceptCluster(client: Client, args: UpsertConceptClusterArgs): Promise<UpsertConceptClusterRow | null>;
|
|
113
|
+
export declare const getConceptClusterByOrganizationRealmAndIDQuery = "-- name: GetConceptClusterByOrganizationRealmAndID :one\nSELECT\n id,\n organization_id,\n realm_kind,\n realm_key,\n name,\n description,\n knowledge_type,\n level,\n parent_id,\n thread_count,\n consolidation_run_id,\n created_at,\n updated_at\nFROM weave.concept_clusters\nWHERE organization_id = $1\n AND realm_kind = $2\n AND realm_key = $3\n AND id = $4";
|
|
114
|
+
export interface GetConceptClusterByOrganizationRealmAndIDArgs {
|
|
115
|
+
organizationId: string;
|
|
116
|
+
realmKind: string;
|
|
117
|
+
realmKey: string;
|
|
118
|
+
id: string;
|
|
119
|
+
}
|
|
120
|
+
export interface GetConceptClusterByOrganizationRealmAndIDRow {
|
|
121
|
+
id: string;
|
|
122
|
+
organizationId: string;
|
|
123
|
+
realmKind: string;
|
|
124
|
+
realmKey: string;
|
|
125
|
+
name: string;
|
|
126
|
+
description: string;
|
|
127
|
+
knowledgeType: string;
|
|
128
|
+
level: number;
|
|
129
|
+
parentId: string | null;
|
|
130
|
+
threadCount: number;
|
|
131
|
+
consolidationRunId: string;
|
|
132
|
+
createdAt: Date;
|
|
133
|
+
updatedAt: Date;
|
|
134
|
+
}
|
|
135
|
+
export declare function getConceptClusterByOrganizationRealmAndID(client: Client, args: GetConceptClusterByOrganizationRealmAndIDArgs): Promise<GetConceptClusterByOrganizationRealmAndIDRow | null>;
|
|
136
|
+
export declare const listConceptClustersByRealmQuery = "-- name: ListConceptClustersByRealm :many\nSELECT\n id,\n organization_id,\n realm_kind,\n realm_key,\n name,\n description,\n knowledge_type,\n level,\n parent_id,\n thread_count,\n consolidation_run_id,\n created_at,\n updated_at\nFROM weave.concept_clusters\nWHERE organization_id = $1\n AND realm_kind = $2\n AND realm_key = $3\n AND ($4 = '' OR knowledge_type = $4)\n AND ($5 <= 0 OR level <= $5)\nORDER BY level ASC, updated_at DESC, id ASC";
|
|
137
|
+
export interface ListConceptClustersByRealmArgs {
|
|
138
|
+
organizationId: string;
|
|
139
|
+
realmKind: string;
|
|
140
|
+
realmKey: string;
|
|
141
|
+
knowledgeType: string | null;
|
|
142
|
+
maxDepth: string | null;
|
|
143
|
+
}
|
|
144
|
+
export interface ListConceptClustersByRealmRow {
|
|
145
|
+
id: string;
|
|
146
|
+
organizationId: string;
|
|
147
|
+
realmKind: string;
|
|
148
|
+
realmKey: string;
|
|
149
|
+
name: string;
|
|
150
|
+
description: string;
|
|
151
|
+
knowledgeType: string;
|
|
152
|
+
level: number;
|
|
153
|
+
parentId: string | null;
|
|
154
|
+
threadCount: number;
|
|
155
|
+
consolidationRunId: string;
|
|
156
|
+
createdAt: Date;
|
|
157
|
+
updatedAt: Date;
|
|
158
|
+
}
|
|
159
|
+
export declare function listConceptClustersByRealm(client: Client, args: ListConceptClustersByRealmArgs): Promise<ListConceptClustersByRealmRow[]>;
|
|
160
|
+
export declare const listConceptClustersByParentAndRealmQuery = "-- name: ListConceptClustersByParentAndRealm :many\nSELECT\n id,\n organization_id,\n realm_kind,\n realm_key,\n name,\n description,\n knowledge_type,\n level,\n parent_id,\n thread_count,\n consolidation_run_id,\n created_at,\n updated_at\nFROM weave.concept_clusters\nWHERE organization_id = $1\n AND realm_kind = $2\n AND realm_key = $3\n AND parent_id = $4\nORDER BY updated_at DESC, id ASC";
|
|
161
|
+
export interface ListConceptClustersByParentAndRealmArgs {
|
|
162
|
+
organizationId: string;
|
|
163
|
+
realmKind: string;
|
|
164
|
+
realmKey: string;
|
|
165
|
+
parentId: string | null;
|
|
166
|
+
}
|
|
167
|
+
export interface ListConceptClustersByParentAndRealmRow {
|
|
168
|
+
id: string;
|
|
169
|
+
organizationId: string;
|
|
170
|
+
realmKind: string;
|
|
171
|
+
realmKey: string;
|
|
172
|
+
name: string;
|
|
173
|
+
description: string;
|
|
174
|
+
knowledgeType: string;
|
|
175
|
+
level: number;
|
|
176
|
+
parentId: string | null;
|
|
177
|
+
threadCount: number;
|
|
178
|
+
consolidationRunId: string;
|
|
179
|
+
createdAt: Date;
|
|
180
|
+
updatedAt: Date;
|
|
181
|
+
}
|
|
182
|
+
export declare function listConceptClustersByParentAndRealm(client: Client, args: ListConceptClustersByParentAndRealmArgs): Promise<ListConceptClustersByParentAndRealmRow[]>;
|
|
183
|
+
export declare const listApprovedThreadsForConsolidationQuery = "-- name: ListApprovedThreadsForConsolidation :many\nSELECT\n t.id,\n t.organization_id,\n t.document_id,\n t.ingestion_run_id,\n t.text,\n t.knowledge_type,\n t.embedding::text AS embedding_text,\n t.approved_at,\n CASE\n WHEN d.scope = 'DOCUMENT_SCOPE_ORG'\n THEN 'KNOWLEDGE_REALM_KIND_ORG'::text\n WHEN d.scope = 'DOCUMENT_SCOPE_RESTRICTED'\n THEN 'KNOWLEDGE_REALM_KIND_TAG'::text\n WHEN d.scope = 'DOCUMENT_SCOPE_PRIVATE'\n THEN 'KNOWLEDGE_REALM_KIND_USER'::text\n END AS realm_kind,\n CASE\n WHEN d.scope = 'DOCUMENT_SCOPE_ORG'\n THEN ''::text\n WHEN d.scope = 'DOCUMENT_SCOPE_RESTRICTED'\n THEN COALESCE(d.sensitivity_tags[1], ''::text)\n WHEN d.scope = 'DOCUMENT_SCOPE_PRIVATE'\n THEN d.uploaded_by_user_id::text\n END AS realm_key\nFROM weave.threads t\nJOIN weave.documents d ON d.id = t.document_id\nWHERE t.organization_id = $1\n AND t.retrieval_status = 'THREAD_RETRIEVAL_STATUS_APPROVED'\n AND t.embedding IS NOT NULL\nORDER BY t.approved_at DESC, t.id ASC\nLIMIT $3 OFFSET $2";
|
|
184
|
+
export interface ListApprovedThreadsForConsolidationArgs {
|
|
185
|
+
organizationId: string;
|
|
186
|
+
pageOffset: string;
|
|
187
|
+
pageSize: string;
|
|
188
|
+
}
|
|
189
|
+
export interface ListApprovedThreadsForConsolidationRow {
|
|
190
|
+
id: string;
|
|
191
|
+
organizationId: string;
|
|
192
|
+
documentId: string;
|
|
193
|
+
ingestionRunId: string;
|
|
194
|
+
text: string;
|
|
195
|
+
knowledgeType: string;
|
|
196
|
+
embeddingText: string;
|
|
197
|
+
approvedAt: Date | null;
|
|
198
|
+
realmKind: string | null;
|
|
199
|
+
realmKey: string | null;
|
|
200
|
+
}
|
|
201
|
+
export declare function listApprovedThreadsForConsolidation(client: Client, args: ListApprovedThreadsForConsolidationArgs): Promise<ListApprovedThreadsForConsolidationRow[]>;
|
|
202
|
+
export declare const assignThreadsToClusterQuery = "-- name: AssignThreadsToCluster :execrows\nUPDATE weave.threads AS t\nSET cluster_id = cc.id\nFROM weave.concept_clusters cc,\n weave.documents d\nWHERE t.organization_id = $1\n AND t.id = ANY($2::uuid[])\n AND cc.organization_id = t.organization_id\n AND cc.id = $3\n AND d.id = t.document_id\n AND (\n (cc.realm_kind = 'KNOWLEDGE_REALM_KIND_ORG'\n AND cc.realm_key = ''\n AND d.scope = 'DOCUMENT_SCOPE_ORG')\n OR (cc.realm_kind = 'KNOWLEDGE_REALM_KIND_TAG'\n AND d.scope = 'DOCUMENT_SCOPE_RESTRICTED'\n AND cardinality(d.sensitivity_tags) = 1\n AND cc.realm_key = d.sensitivity_tags[1])\n OR (cc.realm_kind = 'KNOWLEDGE_REALM_KIND_USER'\n AND d.scope = 'DOCUMENT_SCOPE_PRIVATE'\n AND cc.realm_key = d.uploaded_by_user_id::text)\n )";
|
|
203
|
+
export interface AssignThreadsToClusterArgs {
|
|
204
|
+
organizationId: string;
|
|
205
|
+
threadIds: string[];
|
|
206
|
+
clusterId: string;
|
|
207
|
+
}
|
|
208
|
+
export declare const clearThreadClusterAssignmentsByOrganizationQuery = "-- name: ClearThreadClusterAssignmentsByOrganization :execrows\nUPDATE weave.threads\nSET cluster_id = NULL\nWHERE organization_id = $1\n AND cluster_id IS NOT NULL";
|
|
209
|
+
export interface ClearThreadClusterAssignmentsByOrganizationArgs {
|
|
210
|
+
organizationId: string;
|
|
211
|
+
}
|
|
212
|
+
export {};
|