weave-typescript 0.29.0 → 0.31.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/auth/v1/auth.pb.d.ts +260 -0
- package/dist/weaveapi/auth/v1/auth.pb.js +3175 -0
- package/dist/weaveapi/auth/v1/service.pb.d.ts +761 -0
- package/dist/weaveapi/auth/v1/service.pb.js +6196 -0
- package/dist/weaveapi/chat/v1/chat.pb.d.ts +11 -0
- package/dist/weaveapi/chat/v1/chat.pb.js +181 -9
- package/dist/weavesql/weavedb/auth_identity_sql.d.ts +295 -0
- package/dist/weavesql/weavedb/auth_identity_sql.js +690 -0
- package/dist/weavesql/weavedb/chat_sql.d.ts +25 -3
- package/dist/weavesql/weavedb/chat_sql.js +36 -7
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { SourceLocation } from "../../ingestion/v1/ingestion.pb";
|
|
2
3
|
export declare const protobufPackage = "weaveapi.chat.v1";
|
|
3
4
|
export declare enum ChatMessageRole {
|
|
4
5
|
CHAT_MESSAGE_ROLE_UNSPECIFIED = 0,
|
|
@@ -37,6 +38,7 @@ export declare enum ChatArtifactKind {
|
|
|
37
38
|
CHAT_ARTIFACT_KIND_HTML = 2,
|
|
38
39
|
CHAT_ARTIFACT_KIND_PLAINTEXT = 3,
|
|
39
40
|
CHAT_ARTIFACT_KIND_CODE = 4,
|
|
41
|
+
CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE = 5,
|
|
40
42
|
UNRECOGNIZED = -1
|
|
41
43
|
}
|
|
42
44
|
export declare function chatArtifactKindFromJSON(object: any): ChatArtifactKind;
|
|
@@ -88,6 +90,14 @@ export interface ChatArtifactVersion {
|
|
|
88
90
|
content: string;
|
|
89
91
|
createdByMessageId: string;
|
|
90
92
|
createdAt: Date | undefined;
|
|
93
|
+
documentReferences: ChatDocumentReference[];
|
|
94
|
+
}
|
|
95
|
+
export interface ChatDocumentReference {
|
|
96
|
+
documentId: string;
|
|
97
|
+
documentName: string;
|
|
98
|
+
mimeType: string;
|
|
99
|
+
threadIds: string[];
|
|
100
|
+
sourceLocations: SourceLocation[];
|
|
91
101
|
}
|
|
92
102
|
export interface ChatEphemeralAttachment {
|
|
93
103
|
mimeType: string;
|
|
@@ -168,6 +178,7 @@ export declare const ChatSession: MessageFns<ChatSession>;
|
|
|
168
178
|
export declare const ChatMessage: MessageFns<ChatMessage>;
|
|
169
179
|
export declare const ChatArtifact: MessageFns<ChatArtifact>;
|
|
170
180
|
export declare const ChatArtifactVersion: MessageFns<ChatArtifactVersion>;
|
|
181
|
+
export declare const ChatDocumentReference: MessageFns<ChatDocumentReference>;
|
|
171
182
|
export declare const ChatEphemeralAttachment: MessageFns<ChatEphemeralAttachment>;
|
|
172
183
|
export declare const ChatStreamFrame: MessageFns<ChatStreamFrame>;
|
|
173
184
|
export declare const ChatStreamFrame_MessageStarted: MessageFns<ChatStreamFrame_MessageStarted>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: weaveapi/chat/v1/chat.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ChatStreamFrame_MessageError = exports.ChatStreamFrame_MessageComplete = exports.ChatStreamFrame_ArtifactUpdated = exports.ChatStreamFrame_ArtifactCreated = exports.ChatStreamFrame_ToolCallRejected = exports.ChatStreamFrame_ToolCallResult = exports.ChatStreamFrame_ToolCallExecuting = exports.ChatStreamFrame_ToolCallProposed = exports.ChatStreamFrame_MessageDelta = exports.ChatStreamFrame_MessageStarted = exports.ChatStreamFrame = exports.ChatEphemeralAttachment = exports.ChatArtifactVersion = exports.ChatArtifact = exports.ChatMessage = exports.ChatSession = exports.ChatArtifactKind = exports.ChatStreamState = exports.ChatToolCallState = exports.ChatMessageRole = exports.protobufPackage = void 0;
|
|
8
|
+
exports.ChatStreamFrame_MessageError = exports.ChatStreamFrame_MessageComplete = exports.ChatStreamFrame_ArtifactUpdated = exports.ChatStreamFrame_ArtifactCreated = exports.ChatStreamFrame_ToolCallRejected = exports.ChatStreamFrame_ToolCallResult = exports.ChatStreamFrame_ToolCallExecuting = exports.ChatStreamFrame_ToolCallProposed = exports.ChatStreamFrame_MessageDelta = exports.ChatStreamFrame_MessageStarted = exports.ChatStreamFrame = exports.ChatEphemeralAttachment = exports.ChatDocumentReference = exports.ChatArtifactVersion = exports.ChatArtifact = exports.ChatMessage = exports.ChatSession = exports.ChatArtifactKind = exports.ChatStreamState = exports.ChatToolCallState = exports.ChatMessageRole = exports.protobufPackage = void 0;
|
|
9
9
|
exports.chatMessageRoleFromJSON = chatMessageRoleFromJSON;
|
|
10
10
|
exports.chatMessageRoleToJSON = chatMessageRoleToJSON;
|
|
11
11
|
exports.chatToolCallStateFromJSON = chatToolCallStateFromJSON;
|
|
@@ -18,6 +18,7 @@ exports.chatArtifactKindToJSON = chatArtifactKindToJSON;
|
|
|
18
18
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
19
19
|
const struct_pb_1 = require("../../../google/protobuf/struct.pb");
|
|
20
20
|
const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
|
|
21
|
+
const ingestion_pb_1 = require("../../ingestion/v1/ingestion.pb");
|
|
21
22
|
exports.protobufPackage = "weaveapi.chat.v1";
|
|
22
23
|
var ChatMessageRole;
|
|
23
24
|
(function (ChatMessageRole) {
|
|
@@ -179,6 +180,7 @@ var ChatArtifactKind;
|
|
|
179
180
|
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_HTML"] = 2] = "CHAT_ARTIFACT_KIND_HTML";
|
|
180
181
|
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_PLAINTEXT"] = 3] = "CHAT_ARTIFACT_KIND_PLAINTEXT";
|
|
181
182
|
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_CODE"] = 4] = "CHAT_ARTIFACT_KIND_CODE";
|
|
183
|
+
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE"] = 5] = "CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE";
|
|
182
184
|
ChatArtifactKind[ChatArtifactKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
183
185
|
})(ChatArtifactKind || (exports.ChatArtifactKind = ChatArtifactKind = {}));
|
|
184
186
|
function chatArtifactKindFromJSON(object) {
|
|
@@ -198,6 +200,9 @@ function chatArtifactKindFromJSON(object) {
|
|
|
198
200
|
case 4:
|
|
199
201
|
case "CHAT_ARTIFACT_KIND_CODE":
|
|
200
202
|
return ChatArtifactKind.CHAT_ARTIFACT_KIND_CODE;
|
|
203
|
+
case 5:
|
|
204
|
+
case "CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE":
|
|
205
|
+
return ChatArtifactKind.CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE;
|
|
201
206
|
case -1:
|
|
202
207
|
case "UNRECOGNIZED":
|
|
203
208
|
default:
|
|
@@ -216,6 +221,8 @@ function chatArtifactKindToJSON(object) {
|
|
|
216
221
|
return "CHAT_ARTIFACT_KIND_PLAINTEXT";
|
|
217
222
|
case ChatArtifactKind.CHAT_ARTIFACT_KIND_CODE:
|
|
218
223
|
return "CHAT_ARTIFACT_KIND_CODE";
|
|
224
|
+
case ChatArtifactKind.CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE:
|
|
225
|
+
return "CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE";
|
|
219
226
|
case ChatArtifactKind.UNRECOGNIZED:
|
|
220
227
|
default:
|
|
221
228
|
return "UNRECOGNIZED";
|
|
@@ -950,7 +957,15 @@ exports.ChatArtifact = {
|
|
|
950
957
|
},
|
|
951
958
|
};
|
|
952
959
|
function createBaseChatArtifactVersion() {
|
|
953
|
-
return {
|
|
960
|
+
return {
|
|
961
|
+
id: "",
|
|
962
|
+
artifactId: "",
|
|
963
|
+
version: 0,
|
|
964
|
+
content: "",
|
|
965
|
+
createdByMessageId: "",
|
|
966
|
+
createdAt: undefined,
|
|
967
|
+
documentReferences: [],
|
|
968
|
+
};
|
|
954
969
|
}
|
|
955
970
|
exports.ChatArtifactVersion = {
|
|
956
971
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -972,6 +987,9 @@ exports.ChatArtifactVersion = {
|
|
|
972
987
|
if (message.createdAt !== undefined) {
|
|
973
988
|
timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join();
|
|
974
989
|
}
|
|
990
|
+
for (const v of message.documentReferences) {
|
|
991
|
+
exports.ChatDocumentReference.encode(v, writer.uint32(58).fork()).join();
|
|
992
|
+
}
|
|
975
993
|
return writer;
|
|
976
994
|
},
|
|
977
995
|
decode(input, length) {
|
|
@@ -1023,6 +1041,13 @@ exports.ChatArtifactVersion = {
|
|
|
1023
1041
|
message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
1024
1042
|
continue;
|
|
1025
1043
|
}
|
|
1044
|
+
case 7: {
|
|
1045
|
+
if (tag !== 58) {
|
|
1046
|
+
break;
|
|
1047
|
+
}
|
|
1048
|
+
message.documentReferences.push(exports.ChatDocumentReference.decode(reader, reader.uint32()));
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1026
1051
|
}
|
|
1027
1052
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1028
1053
|
break;
|
|
@@ -1051,9 +1076,15 @@ exports.ChatArtifactVersion = {
|
|
|
1051
1076
|
: isSet(object.created_at)
|
|
1052
1077
|
? fromJsonTimestamp(object.created_at)
|
|
1053
1078
|
: undefined,
|
|
1079
|
+
documentReferences: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.documentReferences)
|
|
1080
|
+
? object.documentReferences.map((e) => exports.ChatDocumentReference.fromJSON(e))
|
|
1081
|
+
: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.document_references)
|
|
1082
|
+
? object.document_references.map((e) => exports.ChatDocumentReference.fromJSON(e))
|
|
1083
|
+
: [],
|
|
1054
1084
|
};
|
|
1055
1085
|
},
|
|
1056
1086
|
toJSON(message) {
|
|
1087
|
+
var _a;
|
|
1057
1088
|
const obj = {};
|
|
1058
1089
|
if (message.id !== "") {
|
|
1059
1090
|
obj.id = message.id;
|
|
@@ -1073,20 +1104,161 @@ exports.ChatArtifactVersion = {
|
|
|
1073
1104
|
if (message.createdAt !== undefined) {
|
|
1074
1105
|
obj.createdAt = message.createdAt.toISOString();
|
|
1075
1106
|
}
|
|
1107
|
+
if ((_a = message.documentReferences) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1108
|
+
obj.documentReferences = message.documentReferences.map((e) => exports.ChatDocumentReference.toJSON(e));
|
|
1109
|
+
}
|
|
1076
1110
|
return obj;
|
|
1077
1111
|
},
|
|
1078
1112
|
create(base) {
|
|
1079
1113
|
return exports.ChatArtifactVersion.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1080
1114
|
},
|
|
1081
1115
|
fromPartial(object) {
|
|
1082
|
-
var _a
|
|
1116
|
+
var _a;
|
|
1117
|
+
var _b, _c, _d, _e, _f, _g;
|
|
1083
1118
|
const message = createBaseChatArtifactVersion();
|
|
1084
|
-
message.id = (
|
|
1085
|
-
message.artifactId = (
|
|
1086
|
-
message.version = (
|
|
1087
|
-
message.content = (
|
|
1088
|
-
message.createdByMessageId = (
|
|
1089
|
-
message.createdAt = (
|
|
1119
|
+
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "";
|
|
1120
|
+
message.artifactId = (_c = object.artifactId) !== null && _c !== void 0 ? _c : "";
|
|
1121
|
+
message.version = (_d = object.version) !== null && _d !== void 0 ? _d : 0;
|
|
1122
|
+
message.content = (_e = object.content) !== null && _e !== void 0 ? _e : "";
|
|
1123
|
+
message.createdByMessageId = (_f = object.createdByMessageId) !== null && _f !== void 0 ? _f : "";
|
|
1124
|
+
message.createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1125
|
+
message.documentReferences = ((_a = object.documentReferences) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ChatDocumentReference.fromPartial(e))) || [];
|
|
1126
|
+
return message;
|
|
1127
|
+
},
|
|
1128
|
+
};
|
|
1129
|
+
function createBaseChatDocumentReference() {
|
|
1130
|
+
return { documentId: "", documentName: "", mimeType: "", threadIds: [], sourceLocations: [] };
|
|
1131
|
+
}
|
|
1132
|
+
exports.ChatDocumentReference = {
|
|
1133
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1134
|
+
if (message.documentId !== "") {
|
|
1135
|
+
writer.uint32(10).string(message.documentId);
|
|
1136
|
+
}
|
|
1137
|
+
if (message.documentName !== "") {
|
|
1138
|
+
writer.uint32(18).string(message.documentName);
|
|
1139
|
+
}
|
|
1140
|
+
if (message.mimeType !== "") {
|
|
1141
|
+
writer.uint32(26).string(message.mimeType);
|
|
1142
|
+
}
|
|
1143
|
+
for (const v of message.threadIds) {
|
|
1144
|
+
writer.uint32(34).string(v);
|
|
1145
|
+
}
|
|
1146
|
+
for (const v of message.sourceLocations) {
|
|
1147
|
+
ingestion_pb_1.SourceLocation.encode(v, writer.uint32(42).fork()).join();
|
|
1148
|
+
}
|
|
1149
|
+
return writer;
|
|
1150
|
+
},
|
|
1151
|
+
decode(input, length) {
|
|
1152
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1153
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1154
|
+
const message = createBaseChatDocumentReference();
|
|
1155
|
+
while (reader.pos < end) {
|
|
1156
|
+
const tag = reader.uint32();
|
|
1157
|
+
switch (tag >>> 3) {
|
|
1158
|
+
case 1: {
|
|
1159
|
+
if (tag !== 10) {
|
|
1160
|
+
break;
|
|
1161
|
+
}
|
|
1162
|
+
message.documentId = reader.string();
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
case 2: {
|
|
1166
|
+
if (tag !== 18) {
|
|
1167
|
+
break;
|
|
1168
|
+
}
|
|
1169
|
+
message.documentName = reader.string();
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
case 3: {
|
|
1173
|
+
if (tag !== 26) {
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
message.mimeType = reader.string();
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
case 4: {
|
|
1180
|
+
if (tag !== 34) {
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
message.threadIds.push(reader.string());
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1186
|
+
case 5: {
|
|
1187
|
+
if (tag !== 42) {
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
message.sourceLocations.push(ingestion_pb_1.SourceLocation.decode(reader, reader.uint32()));
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
reader.skip(tag & 7);
|
|
1198
|
+
}
|
|
1199
|
+
return message;
|
|
1200
|
+
},
|
|
1201
|
+
fromJSON(object) {
|
|
1202
|
+
return {
|
|
1203
|
+
documentId: isSet(object.documentId)
|
|
1204
|
+
? globalThis.String(object.documentId)
|
|
1205
|
+
: isSet(object.document_id)
|
|
1206
|
+
? globalThis.String(object.document_id)
|
|
1207
|
+
: "",
|
|
1208
|
+
documentName: isSet(object.documentName)
|
|
1209
|
+
? globalThis.String(object.documentName)
|
|
1210
|
+
: isSet(object.document_name)
|
|
1211
|
+
? globalThis.String(object.document_name)
|
|
1212
|
+
: "",
|
|
1213
|
+
mimeType: isSet(object.mimeType)
|
|
1214
|
+
? globalThis.String(object.mimeType)
|
|
1215
|
+
: isSet(object.mime_type)
|
|
1216
|
+
? globalThis.String(object.mime_type)
|
|
1217
|
+
: "",
|
|
1218
|
+
threadIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.threadIds)
|
|
1219
|
+
? object.threadIds.map((e) => globalThis.String(e))
|
|
1220
|
+
: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.thread_ids)
|
|
1221
|
+
? object.thread_ids.map((e) => globalThis.String(e))
|
|
1222
|
+
: [],
|
|
1223
|
+
sourceLocations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sourceLocations)
|
|
1224
|
+
? object.sourceLocations.map((e) => ingestion_pb_1.SourceLocation.fromJSON(e))
|
|
1225
|
+
: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.source_locations)
|
|
1226
|
+
? object.source_locations.map((e) => ingestion_pb_1.SourceLocation.fromJSON(e))
|
|
1227
|
+
: [],
|
|
1228
|
+
};
|
|
1229
|
+
},
|
|
1230
|
+
toJSON(message) {
|
|
1231
|
+
var _a, _b;
|
|
1232
|
+
const obj = {};
|
|
1233
|
+
if (message.documentId !== "") {
|
|
1234
|
+
obj.documentId = message.documentId;
|
|
1235
|
+
}
|
|
1236
|
+
if (message.documentName !== "") {
|
|
1237
|
+
obj.documentName = message.documentName;
|
|
1238
|
+
}
|
|
1239
|
+
if (message.mimeType !== "") {
|
|
1240
|
+
obj.mimeType = message.mimeType;
|
|
1241
|
+
}
|
|
1242
|
+
if ((_a = message.threadIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1243
|
+
obj.threadIds = message.threadIds;
|
|
1244
|
+
}
|
|
1245
|
+
if ((_b = message.sourceLocations) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1246
|
+
obj.sourceLocations = message.sourceLocations.map((e) => ingestion_pb_1.SourceLocation.toJSON(e));
|
|
1247
|
+
}
|
|
1248
|
+
return obj;
|
|
1249
|
+
},
|
|
1250
|
+
create(base) {
|
|
1251
|
+
return exports.ChatDocumentReference.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1252
|
+
},
|
|
1253
|
+
fromPartial(object) {
|
|
1254
|
+
var _a, _b;
|
|
1255
|
+
var _c, _d, _e;
|
|
1256
|
+
const message = createBaseChatDocumentReference();
|
|
1257
|
+
message.documentId = (_c = object.documentId) !== null && _c !== void 0 ? _c : "";
|
|
1258
|
+
message.documentName = (_d = object.documentName) !== null && _d !== void 0 ? _d : "";
|
|
1259
|
+
message.mimeType = (_e = object.mimeType) !== null && _e !== void 0 ? _e : "";
|
|
1260
|
+
message.threadIds = ((_a = object.threadIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
|
|
1261
|
+
message.sourceLocations = ((_b = object.sourceLocations) === null || _b === void 0 ? void 0 : _b.map((e) => ingestion_pb_1.SourceLocation.fromPartial(e))) || [];
|
|
1090
1262
|
return message;
|
|
1091
1263
|
},
|
|
1092
1264
|
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createUserQuery = "-- name: CreateUser :one\nINSERT INTO weave.users (status)\nVALUES ($1)\nRETURNING id, status, created_at, updated_at";
|
|
6
|
+
export interface CreateUserArgs {
|
|
7
|
+
status: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateUserRow {
|
|
10
|
+
id: string;
|
|
11
|
+
status: string;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
}
|
|
15
|
+
export declare function createUser(client: Client, args: CreateUserArgs): Promise<CreateUserRow | null>;
|
|
16
|
+
export declare const getUserByIDQuery = "-- name: GetUserByID :one\nSELECT id, status, created_at, updated_at\nFROM weave.users\nWHERE id = $1";
|
|
17
|
+
export interface GetUserByIDArgs {
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
export interface GetUserByIDRow {
|
|
21
|
+
id: string;
|
|
22
|
+
status: string;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
}
|
|
26
|
+
export declare function getUserByID(client: Client, args: GetUserByIDArgs): Promise<GetUserByIDRow | null>;
|
|
27
|
+
export declare const upsertUserProfileQuery = "-- name: UpsertUserProfile :one\nINSERT INTO weave.user_profiles (\n user_id,\n display_name,\n job_title,\n email,\n avatar_url,\n theme\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nON CONFLICT (user_id) DO UPDATE\nSET\n display_name = EXCLUDED.display_name,\n job_title = EXCLUDED.job_title,\n email = EXCLUDED.email,\n avatar_url = EXCLUDED.avatar_url,\n theme = EXCLUDED.theme,\n updated_at = now()\nRETURNING\n user_id,\n display_name,\n job_title,\n email,\n avatar_url,\n theme,\n created_at,\n updated_at";
|
|
28
|
+
export interface UpsertUserProfileArgs {
|
|
29
|
+
userId: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
jobTitle: string;
|
|
32
|
+
email: string;
|
|
33
|
+
avatarUrl: string;
|
|
34
|
+
theme: string;
|
|
35
|
+
}
|
|
36
|
+
export interface UpsertUserProfileRow {
|
|
37
|
+
userId: string;
|
|
38
|
+
displayName: string;
|
|
39
|
+
jobTitle: string;
|
|
40
|
+
email: string;
|
|
41
|
+
avatarUrl: string;
|
|
42
|
+
theme: string;
|
|
43
|
+
createdAt: Date;
|
|
44
|
+
updatedAt: Date;
|
|
45
|
+
}
|
|
46
|
+
export declare function upsertUserProfile(client: Client, args: UpsertUserProfileArgs): Promise<UpsertUserProfileRow | null>;
|
|
47
|
+
export declare const getUserProfileQuery = "-- name: GetUserProfile :one\nSELECT\n user_id,\n display_name,\n job_title,\n email,\n avatar_url,\n theme,\n created_at,\n updated_at\nFROM weave.user_profiles\nWHERE user_id = $1";
|
|
48
|
+
export interface GetUserProfileArgs {
|
|
49
|
+
userId: string;
|
|
50
|
+
}
|
|
51
|
+
export interface GetUserProfileRow {
|
|
52
|
+
userId: string;
|
|
53
|
+
displayName: string;
|
|
54
|
+
jobTitle: string;
|
|
55
|
+
email: string;
|
|
56
|
+
avatarUrl: string;
|
|
57
|
+
theme: string;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
updatedAt: Date;
|
|
60
|
+
}
|
|
61
|
+
export declare function getUserProfile(client: Client, args: GetUserProfileArgs): Promise<GetUserProfileRow | null>;
|
|
62
|
+
export declare const getIdentityLinkByStytchMemberQuery = "-- name: GetIdentityLinkByStytchMember :one\nSELECT\n id,\n user_id,\n organization_id,\n provider,\n stytch_organization_id,\n stytch_member_id,\n stytch_member_email,\n last_seen_at,\n created_at,\n updated_at\nFROM weave.identity_links\nWHERE provider = 'stytch_b2b'\n AND stytch_organization_id = $1\n AND stytch_member_id = $2";
|
|
63
|
+
export interface GetIdentityLinkByStytchMemberArgs {
|
|
64
|
+
stytchOrganizationId: string;
|
|
65
|
+
stytchMemberId: string;
|
|
66
|
+
}
|
|
67
|
+
export interface GetIdentityLinkByStytchMemberRow {
|
|
68
|
+
id: string;
|
|
69
|
+
userId: string;
|
|
70
|
+
organizationId: string;
|
|
71
|
+
provider: string;
|
|
72
|
+
stytchOrganizationId: string;
|
|
73
|
+
stytchMemberId: string;
|
|
74
|
+
stytchMemberEmail: string;
|
|
75
|
+
lastSeenAt: Date | null;
|
|
76
|
+
createdAt: Date;
|
|
77
|
+
updatedAt: Date;
|
|
78
|
+
}
|
|
79
|
+
export declare function getIdentityLinkByStytchMember(client: Client, args: GetIdentityLinkByStytchMemberArgs): Promise<GetIdentityLinkByStytchMemberRow | null>;
|
|
80
|
+
export declare const upsertIdentityLinkQuery = "-- name: UpsertIdentityLink :one\nINSERT INTO weave.identity_links (\n user_id,\n organization_id,\n provider,\n stytch_organization_id,\n stytch_member_id,\n stytch_member_email,\n last_seen_at\n) VALUES (\n $1,\n $2,\n 'stytch_b2b',\n $3,\n $4,\n $5,\n now()\n)\nON CONFLICT (provider, stytch_organization_id, stytch_member_id) DO UPDATE\nSET\n user_id = EXCLUDED.user_id,\n organization_id = EXCLUDED.organization_id,\n stytch_member_email = EXCLUDED.stytch_member_email,\n last_seen_at = now(),\n updated_at = now()\nRETURNING\n id,\n user_id,\n organization_id,\n provider,\n stytch_organization_id,\n stytch_member_id,\n stytch_member_email,\n last_seen_at,\n created_at,\n updated_at";
|
|
81
|
+
export interface UpsertIdentityLinkArgs {
|
|
82
|
+
userId: string;
|
|
83
|
+
organizationId: string;
|
|
84
|
+
stytchOrganizationId: string;
|
|
85
|
+
stytchMemberId: string;
|
|
86
|
+
stytchMemberEmail: string;
|
|
87
|
+
}
|
|
88
|
+
export interface UpsertIdentityLinkRow {
|
|
89
|
+
id: string;
|
|
90
|
+
userId: string;
|
|
91
|
+
organizationId: string;
|
|
92
|
+
provider: string;
|
|
93
|
+
stytchOrganizationId: string;
|
|
94
|
+
stytchMemberId: string;
|
|
95
|
+
stytchMemberEmail: string;
|
|
96
|
+
lastSeenAt: Date | null;
|
|
97
|
+
createdAt: Date;
|
|
98
|
+
updatedAt: Date;
|
|
99
|
+
}
|
|
100
|
+
export declare function upsertIdentityLink(client: Client, args: UpsertIdentityLinkArgs): Promise<UpsertIdentityLinkRow | null>;
|
|
101
|
+
export declare const getOrganizationAuthLinkByStytchIDQuery = "-- name: GetOrganizationAuthLinkByStytchID :one\nSELECT\n organization_id,\n stytch_organization_id,\n stytch_organization_slug,\n stytch_organization_kind,\n allowed_domains,\n auth_policy_summary,\n created_at,\n updated_at\nFROM weave.organization_auth_links\nWHERE stytch_organization_id = $1";
|
|
102
|
+
export interface GetOrganizationAuthLinkByStytchIDArgs {
|
|
103
|
+
stytchOrganizationId: string;
|
|
104
|
+
}
|
|
105
|
+
export interface GetOrganizationAuthLinkByStytchIDRow {
|
|
106
|
+
organizationId: string;
|
|
107
|
+
stytchOrganizationId: string;
|
|
108
|
+
stytchOrganizationSlug: string;
|
|
109
|
+
stytchOrganizationKind: string;
|
|
110
|
+
allowedDomains: string[];
|
|
111
|
+
authPolicySummary: any;
|
|
112
|
+
createdAt: Date;
|
|
113
|
+
updatedAt: Date;
|
|
114
|
+
}
|
|
115
|
+
export declare function getOrganizationAuthLinkByStytchID(client: Client, args: GetOrganizationAuthLinkByStytchIDArgs): Promise<GetOrganizationAuthLinkByStytchIDRow | null>;
|
|
116
|
+
export declare const getOrganizationAuthLinkByOrganizationIDQuery = "-- name: GetOrganizationAuthLinkByOrganizationID :one\nSELECT\n organization_id,\n stytch_organization_id,\n stytch_organization_slug,\n stytch_organization_kind,\n allowed_domains,\n auth_policy_summary,\n created_at,\n updated_at\nFROM weave.organization_auth_links\nWHERE organization_id = $1";
|
|
117
|
+
export interface GetOrganizationAuthLinkByOrganizationIDArgs {
|
|
118
|
+
organizationId: string;
|
|
119
|
+
}
|
|
120
|
+
export interface GetOrganizationAuthLinkByOrganizationIDRow {
|
|
121
|
+
organizationId: string;
|
|
122
|
+
stytchOrganizationId: string;
|
|
123
|
+
stytchOrganizationSlug: string;
|
|
124
|
+
stytchOrganizationKind: string;
|
|
125
|
+
allowedDomains: string[];
|
|
126
|
+
authPolicySummary: any;
|
|
127
|
+
createdAt: Date;
|
|
128
|
+
updatedAt: Date;
|
|
129
|
+
}
|
|
130
|
+
export declare function getOrganizationAuthLinkByOrganizationID(client: Client, args: GetOrganizationAuthLinkByOrganizationIDArgs): Promise<GetOrganizationAuthLinkByOrganizationIDRow | null>;
|
|
131
|
+
export declare const upsertOrganizationAuthLinkQuery = "-- name: UpsertOrganizationAuthLink :one\nINSERT INTO weave.organization_auth_links (\n organization_id,\n stytch_organization_id,\n stytch_organization_slug,\n stytch_organization_kind,\n allowed_domains,\n auth_policy_summary\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nON CONFLICT (organization_id) DO UPDATE\nSET\n stytch_organization_id = EXCLUDED.stytch_organization_id,\n stytch_organization_slug = EXCLUDED.stytch_organization_slug,\n stytch_organization_kind = EXCLUDED.stytch_organization_kind,\n allowed_domains = EXCLUDED.allowed_domains,\n auth_policy_summary = EXCLUDED.auth_policy_summary,\n updated_at = now()\nRETURNING\n organization_id,\n stytch_organization_id,\n stytch_organization_slug,\n stytch_organization_kind,\n allowed_domains,\n auth_policy_summary,\n created_at,\n updated_at";
|
|
132
|
+
export interface UpsertOrganizationAuthLinkArgs {
|
|
133
|
+
organizationId: string;
|
|
134
|
+
stytchOrganizationId: string;
|
|
135
|
+
stytchOrganizationSlug: string;
|
|
136
|
+
stytchOrganizationKind: string;
|
|
137
|
+
allowedDomains: string[];
|
|
138
|
+
authPolicySummary: any;
|
|
139
|
+
}
|
|
140
|
+
export interface UpsertOrganizationAuthLinkRow {
|
|
141
|
+
organizationId: string;
|
|
142
|
+
stytchOrganizationId: string;
|
|
143
|
+
stytchOrganizationSlug: string;
|
|
144
|
+
stytchOrganizationKind: string;
|
|
145
|
+
allowedDomains: string[];
|
|
146
|
+
authPolicySummary: any;
|
|
147
|
+
createdAt: Date;
|
|
148
|
+
updatedAt: Date;
|
|
149
|
+
}
|
|
150
|
+
export declare function upsertOrganizationAuthLink(client: Client, args: UpsertOrganizationAuthLinkArgs): Promise<UpsertOrganizationAuthLinkRow | null>;
|
|
151
|
+
export declare const upsertOrganizationMembershipQuery = "-- name: UpsertOrganizationMembership :one\nINSERT INTO weave.organization_memberships (\n user_id,\n organization_id,\n identity_link_id,\n status,\n role_ids\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nON CONFLICT (user_id, organization_id) DO UPDATE\nSET\n identity_link_id = EXCLUDED.identity_link_id,\n status = EXCLUDED.status,\n role_ids = EXCLUDED.role_ids,\n updated_at = now()\nRETURNING\n id,\n user_id,\n organization_id,\n identity_link_id,\n status,\n role_ids,\n created_at,\n updated_at";
|
|
152
|
+
export interface UpsertOrganizationMembershipArgs {
|
|
153
|
+
userId: string;
|
|
154
|
+
organizationId: string;
|
|
155
|
+
identityLinkId: string | null;
|
|
156
|
+
status: string;
|
|
157
|
+
roleIds: string[];
|
|
158
|
+
}
|
|
159
|
+
export interface UpsertOrganizationMembershipRow {
|
|
160
|
+
id: string;
|
|
161
|
+
userId: string;
|
|
162
|
+
organizationId: string;
|
|
163
|
+
identityLinkId: string | null;
|
|
164
|
+
status: string;
|
|
165
|
+
roleIds: string[];
|
|
166
|
+
createdAt: Date;
|
|
167
|
+
updatedAt: Date;
|
|
168
|
+
}
|
|
169
|
+
export declare function upsertOrganizationMembership(client: Client, args: UpsertOrganizationMembershipArgs): Promise<UpsertOrganizationMembershipRow | null>;
|
|
170
|
+
export declare const getOrganizationMembershipQuery = "-- name: GetOrganizationMembership :one\nSELECT\n id,\n user_id,\n organization_id,\n identity_link_id,\n status,\n role_ids,\n created_at,\n updated_at\nFROM weave.organization_memberships\nWHERE user_id = $1\n AND organization_id = $2";
|
|
171
|
+
export interface GetOrganizationMembershipArgs {
|
|
172
|
+
userId: string;
|
|
173
|
+
organizationId: string;
|
|
174
|
+
}
|
|
175
|
+
export interface GetOrganizationMembershipRow {
|
|
176
|
+
id: string;
|
|
177
|
+
userId: string;
|
|
178
|
+
organizationId: string;
|
|
179
|
+
identityLinkId: string | null;
|
|
180
|
+
status: string;
|
|
181
|
+
roleIds: string[];
|
|
182
|
+
createdAt: Date;
|
|
183
|
+
updatedAt: Date;
|
|
184
|
+
}
|
|
185
|
+
export declare function getOrganizationMembership(client: Client, args: GetOrganizationMembershipArgs): Promise<GetOrganizationMembershipRow | null>;
|
|
186
|
+
export declare const listOrganizationMembershipsForUserQuery = "-- name: ListOrganizationMembershipsForUser :many\nSELECT\n id,\n user_id,\n organization_id,\n identity_link_id,\n status,\n role_ids,\n created_at,\n updated_at\nFROM weave.organization_memberships\nWHERE user_id = $1\nORDER BY created_at ASC";
|
|
187
|
+
export interface ListOrganizationMembershipsForUserArgs {
|
|
188
|
+
userId: string;
|
|
189
|
+
}
|
|
190
|
+
export interface ListOrganizationMembershipsForUserRow {
|
|
191
|
+
id: string;
|
|
192
|
+
userId: string;
|
|
193
|
+
organizationId: string;
|
|
194
|
+
identityLinkId: string | null;
|
|
195
|
+
status: string;
|
|
196
|
+
roleIds: string[];
|
|
197
|
+
createdAt: Date;
|
|
198
|
+
updatedAt: Date;
|
|
199
|
+
}
|
|
200
|
+
export declare function listOrganizationMembershipsForUser(client: Client, args: ListOrganizationMembershipsForUserArgs): Promise<ListOrganizationMembershipsForUserRow[]>;
|
|
201
|
+
export declare const listOrganizationMembersQuery = "-- name: ListOrganizationMembers :many\nSELECT\n m.id,\n m.user_id,\n m.organization_id,\n m.identity_link_id,\n m.status,\n m.role_ids,\n p.display_name,\n p.email,\n p.avatar_url,\n m.created_at,\n m.updated_at\nFROM weave.organization_memberships AS m\nJOIN weave.user_profiles AS p\n ON p.user_id = m.user_id\nWHERE m.organization_id = $1\nORDER BY p.display_name ASC, p.email ASC";
|
|
202
|
+
export interface ListOrganizationMembersArgs {
|
|
203
|
+
organizationId: string;
|
|
204
|
+
}
|
|
205
|
+
export interface ListOrganizationMembersRow {
|
|
206
|
+
id: string;
|
|
207
|
+
userId: string;
|
|
208
|
+
organizationId: string;
|
|
209
|
+
identityLinkId: string | null;
|
|
210
|
+
status: string;
|
|
211
|
+
roleIds: string[];
|
|
212
|
+
displayName: string;
|
|
213
|
+
email: string;
|
|
214
|
+
avatarUrl: string;
|
|
215
|
+
createdAt: Date;
|
|
216
|
+
updatedAt: Date;
|
|
217
|
+
}
|
|
218
|
+
export declare function listOrganizationMembers(client: Client, args: ListOrganizationMembersArgs): Promise<ListOrganizationMembersRow[]>;
|
|
219
|
+
export declare const listActivePlatformAdminGrantsForUserQuery = "-- name: ListActivePlatformAdminGrantsForUser :many\nSELECT\n id,\n user_id,\n platform_role,\n organization_id,\n all_organizations,\n allowed_actions,\n expires_at,\n status,\n created_at,\n updated_at\nFROM weave.platform_admin_grants\nWHERE user_id = $1\n AND status = 'active'\n AND (expires_at IS NULL OR expires_at > now())";
|
|
220
|
+
export interface ListActivePlatformAdminGrantsForUserArgs {
|
|
221
|
+
userId: string;
|
|
222
|
+
}
|
|
223
|
+
export interface ListActivePlatformAdminGrantsForUserRow {
|
|
224
|
+
id: string;
|
|
225
|
+
userId: string;
|
|
226
|
+
platformRole: string;
|
|
227
|
+
organizationId: string | null;
|
|
228
|
+
allOrganizations: boolean;
|
|
229
|
+
allowedActions: string[];
|
|
230
|
+
expiresAt: Date | null;
|
|
231
|
+
status: string;
|
|
232
|
+
createdAt: Date;
|
|
233
|
+
updatedAt: Date;
|
|
234
|
+
}
|
|
235
|
+
export declare function listActivePlatformAdminGrantsForUser(client: Client, args: ListActivePlatformAdminGrantsForUserArgs): Promise<ListActivePlatformAdminGrantsForUserRow[]>;
|
|
236
|
+
export declare const createPlatformAdminGrantQuery = "-- name: CreatePlatformAdminGrant :one\nINSERT INTO weave.platform_admin_grants (\n user_id,\n platform_role,\n organization_id,\n all_organizations,\n allowed_actions,\n expires_at,\n status\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7\n)\nRETURNING\n id,\n user_id,\n platform_role,\n organization_id,\n all_organizations,\n allowed_actions,\n expires_at,\n status,\n created_at,\n updated_at";
|
|
237
|
+
export interface CreatePlatformAdminGrantArgs {
|
|
238
|
+
userId: string;
|
|
239
|
+
platformRole: string;
|
|
240
|
+
organizationId: string | null;
|
|
241
|
+
allOrganizations: boolean;
|
|
242
|
+
allowedActions: string[];
|
|
243
|
+
expiresAt: Date | null;
|
|
244
|
+
status: string;
|
|
245
|
+
}
|
|
246
|
+
export interface CreatePlatformAdminGrantRow {
|
|
247
|
+
id: string;
|
|
248
|
+
userId: string;
|
|
249
|
+
platformRole: string;
|
|
250
|
+
organizationId: string | null;
|
|
251
|
+
allOrganizations: boolean;
|
|
252
|
+
allowedActions: string[];
|
|
253
|
+
expiresAt: Date | null;
|
|
254
|
+
status: string;
|
|
255
|
+
createdAt: Date;
|
|
256
|
+
updatedAt: Date;
|
|
257
|
+
}
|
|
258
|
+
export declare function createPlatformAdminGrant(client: Client, args: CreatePlatformAdminGrantArgs): Promise<CreatePlatformAdminGrantRow | null>;
|
|
259
|
+
export declare const createSupportAccessSessionQuery = "-- name: CreateSupportAccessSession :one\nINSERT INTO weave.support_access_sessions (\n acting_user_id,\n target_organization_id,\n reason,\n allowed_actions\n) VALUES (\n $1,\n $2,\n $3,\n $4\n)\nRETURNING\n id,\n acting_user_id,\n target_organization_id,\n reason,\n allowed_actions,\n started_at,\n ended_at,\n created_at";
|
|
260
|
+
export interface CreateSupportAccessSessionArgs {
|
|
261
|
+
actingUserId: string;
|
|
262
|
+
targetOrganizationId: string;
|
|
263
|
+
reason: string;
|
|
264
|
+
allowedActions: string[];
|
|
265
|
+
}
|
|
266
|
+
export interface CreateSupportAccessSessionRow {
|
|
267
|
+
id: string;
|
|
268
|
+
actingUserId: string;
|
|
269
|
+
targetOrganizationId: string;
|
|
270
|
+
reason: string;
|
|
271
|
+
allowedActions: string[];
|
|
272
|
+
startedAt: Date;
|
|
273
|
+
endedAt: Date | null;
|
|
274
|
+
createdAt: Date;
|
|
275
|
+
}
|
|
276
|
+
export declare function createSupportAccessSession(client: Client, args: CreateSupportAccessSessionArgs): Promise<CreateSupportAccessSessionRow | null>;
|
|
277
|
+
export declare const endSupportAccessSessionQuery = "-- name: EndSupportAccessSession :execrows\nUPDATE weave.support_access_sessions\nSET ended_at = now()\nWHERE id = $1\n AND ended_at IS NULL";
|
|
278
|
+
export interface EndSupportAccessSessionArgs {
|
|
279
|
+
id: string;
|
|
280
|
+
}
|
|
281
|
+
export declare const insertAuthAuditEventQuery = "-- name: InsertAuthAuditEvent :exec\nINSERT INTO weave.auth_audit_events (\n organization_id,\n acting_user_id,\n target_user_id,\n event_type,\n auth_method,\n stytch_request_id,\n stytch_organization_id,\n stytch_member_id,\n support_access_session_id,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)";
|
|
282
|
+
export interface InsertAuthAuditEventArgs {
|
|
283
|
+
organizationId: string | null;
|
|
284
|
+
actingUserId: string | null;
|
|
285
|
+
targetUserId: string | null;
|
|
286
|
+
eventType: string;
|
|
287
|
+
authMethod: string;
|
|
288
|
+
stytchRequestId: string;
|
|
289
|
+
stytchOrganizationId: string;
|
|
290
|
+
stytchMemberId: string;
|
|
291
|
+
supportAccessSessionId: string | null;
|
|
292
|
+
metadata: any;
|
|
293
|
+
}
|
|
294
|
+
export declare function insertAuthAuditEvent(client: Client, args: InsertAuthAuditEventArgs): Promise<void>;
|
|
295
|
+
export {};
|