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.
Files changed (27) hide show
  1. package/dist/weaveapi/consolidation/v1/consolidation.pb.d.ts +13 -14
  2. package/dist/weaveapi/consolidation/v1/consolidation.pb.js +62 -74
  3. package/dist/weaveapi/ingestion/v1/ingestion.pb.d.ts +82 -50
  4. package/dist/weaveapi/ingestion/v1/ingestion.pb.js +708 -216
  5. package/dist/weaveapi/ingestion/v1/service.pb.d.ts +50 -7
  6. package/dist/weaveapi/ingestion/v1/service.pb.js +279 -16
  7. package/dist/weaveapi/ingestion/v1/table.pb.d.ts +121 -0
  8. package/dist/weaveapi/ingestion/v1/table.pb.js +1478 -0
  9. package/dist/weaveapi/model/v1/model.pb.d.ts +3 -3
  10. package/dist/weaveapi/model/v1/model.pb.js +33 -33
  11. package/dist/weaveapi/model/v1/service.pb.d.ts +3 -3
  12. package/dist/weaveapi/model/v1/service.pb.js +33 -33
  13. package/dist/weaveapi/retrieval/v1/retrieval.pb.d.ts +123 -0
  14. package/dist/weaveapi/retrieval/v1/retrieval.pb.js +2096 -113
  15. package/dist/weaveapi/retrieval/v1/service.pb.d.ts +29 -1
  16. package/dist/weaveapi/retrieval/v1/service.pb.js +142 -0
  17. package/dist/weavesql/weavedb/agent_sql.d.ts +27 -0
  18. package/dist/weavesql/weavedb/agent_sql.js +43 -1
  19. package/dist/weavesql/weavedb/consolidation_sql.d.ts +33 -33
  20. package/dist/weavesql/weavedb/consolidation_sql.js +56 -56
  21. package/dist/weavesql/weavedb/document_table_sql.d.ts +533 -0
  22. package/dist/weavesql/weavedb/document_table_sql.js +1352 -0
  23. package/dist/weavesql/weavedb/ingestion_sql.d.ts +67 -34
  24. package/dist/weavesql/weavedb/ingestion_sql.js +169 -73
  25. package/dist/weavesql/weavedb/retrieval_sql.d.ts +11 -11
  26. package/dist/weavesql/weavedb/retrieval_sql.js +13 -13
  27. package/package.json +1 -1
@@ -5,18 +5,21 @@
5
5
  // protoc unknown
6
6
  // source: weaveapi/retrieval/v1/retrieval.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ExplainRetrievalResponse = exports.SubQueryResult = exports.ExplainRetrievalRequest = exports.SearchDocumentsResponse = exports.SearchDocumentsRequest = exports.RetrieveResponse = exports.RetrieveRequest = exports.RetrievedDocument = exports.DocumentSearchSnippet = exports.DocumentSearchFilters = exports.RetrievedThread = exports.Citation = exports.RetrievalPlan = exports.RerankerConfig = exports.SubQuery = exports.RetrievalConstraints = exports.IntentSignal = exports.KnowledgeTypeBias = exports.SubQueryStrategy = exports.RetrievalTimeScope = exports.IntentType = exports.protobufPackage = void 0;
8
+ exports.ExplainRetrievalResponse = exports.SubQueryResult = exports.ExplainRetrievalRequest = exports.SearchDocumentsResponse = exports.SearchDocumentsRequest = exports.RetrieveResponse = exports.RetrieveRequest = exports.RetrievedDocument = exports.DocumentSearchSnippet = exports.DocumentSearchFilters = exports.RetrieveDataResponse = exports.RetrieveDataRequest = exports.RetrieveTabularDataResponse = exports.RetrieveTabularDataRequest = exports.TabularQueryTrace = exports.TabularQueryResult = exports.TabularCitation = exports.TabularResultRow = exports.TabularCell = exports.TabularResultColumn = exports.CandidateTable = exports.TabularRetrievalConstraints = exports.RetrievedThread = exports.Citation = exports.RetrievalPlan = exports.RerankerConfig = exports.SubQuery = exports.RetrievalConstraints = exports.IntentSignal = exports.KnowledgeTypeBias = exports.RetrieveDataOperation = exports.SubQueryStrategy = exports.RetrievalTimeScope = exports.IntentType = exports.protobufPackage = void 0;
9
9
  exports.intentTypeFromJSON = intentTypeFromJSON;
10
10
  exports.intentTypeToJSON = intentTypeToJSON;
11
11
  exports.retrievalTimeScopeFromJSON = retrievalTimeScopeFromJSON;
12
12
  exports.retrievalTimeScopeToJSON = retrievalTimeScopeToJSON;
13
13
  exports.subQueryStrategyFromJSON = subQueryStrategyFromJSON;
14
14
  exports.subQueryStrategyToJSON = subQueryStrategyToJSON;
15
+ exports.retrieveDataOperationFromJSON = retrieveDataOperationFromJSON;
16
+ exports.retrieveDataOperationToJSON = retrieveDataOperationToJSON;
15
17
  /* eslint-disable */
16
18
  const wire_1 = require("@bufbuild/protobuf/wire");
17
19
  const struct_pb_1 = require("../../../google/protobuf/struct.pb");
18
20
  const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
19
21
  const ingestion_pb_1 = require("../../ingestion/v1/ingestion.pb");
22
+ const table_pb_1 = require("../../ingestion/v1/table.pb");
20
23
  exports.protobufPackage = "weaveapi.retrieval.v1";
21
24
  var IntentType;
22
25
  (function (IntentType) {
@@ -189,6 +192,43 @@ function subQueryStrategyToJSON(object) {
189
192
  return "UNRECOGNIZED";
190
193
  }
191
194
  }
195
+ var RetrieveDataOperation;
196
+ (function (RetrieveDataOperation) {
197
+ RetrieveDataOperation[RetrieveDataOperation["RETRIEVE_DATA_OPERATION_UNSPECIFIED"] = 0] = "RETRIEVE_DATA_OPERATION_UNSPECIFIED";
198
+ RetrieveDataOperation[RetrieveDataOperation["RETRIEVE_DATA_OPERATION_SEARCH"] = 1] = "RETRIEVE_DATA_OPERATION_SEARCH";
199
+ RetrieveDataOperation[RetrieveDataOperation["RETRIEVE_DATA_OPERATION_QUERY_TABLE"] = 2] = "RETRIEVE_DATA_OPERATION_QUERY_TABLE";
200
+ RetrieveDataOperation[RetrieveDataOperation["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
201
+ })(RetrieveDataOperation || (exports.RetrieveDataOperation = RetrieveDataOperation = {}));
202
+ function retrieveDataOperationFromJSON(object) {
203
+ switch (object) {
204
+ case 0:
205
+ case "RETRIEVE_DATA_OPERATION_UNSPECIFIED":
206
+ return RetrieveDataOperation.RETRIEVE_DATA_OPERATION_UNSPECIFIED;
207
+ case 1:
208
+ case "RETRIEVE_DATA_OPERATION_SEARCH":
209
+ return RetrieveDataOperation.RETRIEVE_DATA_OPERATION_SEARCH;
210
+ case 2:
211
+ case "RETRIEVE_DATA_OPERATION_QUERY_TABLE":
212
+ return RetrieveDataOperation.RETRIEVE_DATA_OPERATION_QUERY_TABLE;
213
+ case -1:
214
+ case "UNRECOGNIZED":
215
+ default:
216
+ return RetrieveDataOperation.UNRECOGNIZED;
217
+ }
218
+ }
219
+ function retrieveDataOperationToJSON(object) {
220
+ switch (object) {
221
+ case RetrieveDataOperation.RETRIEVE_DATA_OPERATION_UNSPECIFIED:
222
+ return "RETRIEVE_DATA_OPERATION_UNSPECIFIED";
223
+ case RetrieveDataOperation.RETRIEVE_DATA_OPERATION_SEARCH:
224
+ return "RETRIEVE_DATA_OPERATION_SEARCH";
225
+ case RetrieveDataOperation.RETRIEVE_DATA_OPERATION_QUERY_TABLE:
226
+ return "RETRIEVE_DATA_OPERATION_QUERY_TABLE";
227
+ case RetrieveDataOperation.UNRECOGNIZED:
228
+ default:
229
+ return "UNRECOGNIZED";
230
+ }
231
+ }
192
232
  function createBaseKnowledgeTypeBias() {
193
233
  return { knowledgeType: "", weight: 0 };
194
234
  }
@@ -1156,6 +1196,7 @@ function createBaseRetrievedThread() {
1156
1196
  entities: [],
1157
1197
  reinforcementCount: 0,
1158
1198
  sessionTurn: 0,
1199
+ linkedTables: [],
1159
1200
  };
1160
1201
  }
1161
1202
  exports.RetrievedThread = {
@@ -1163,42 +1204,1812 @@ exports.RetrievedThread = {
1163
1204
  if (message.threadId !== "") {
1164
1205
  writer.uint32(10).string(message.threadId);
1165
1206
  }
1166
- if (message.text !== "") {
1167
- writer.uint32(18).string(message.text);
1207
+ if (message.text !== "") {
1208
+ writer.uint32(18).string(message.text);
1209
+ }
1210
+ if (message.knowledgeType !== "") {
1211
+ writer.uint32(26).string(message.knowledgeType);
1212
+ }
1213
+ if (message.facetFields !== undefined) {
1214
+ struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.facetFields), writer.uint32(34).fork()).join();
1215
+ }
1216
+ if (message.score !== 0) {
1217
+ writer.uint32(45).float(message.score);
1218
+ }
1219
+ if (message.classification !== 0) {
1220
+ writer.uint32(48).int32(message.classification);
1221
+ }
1222
+ if (message.citation !== undefined) {
1223
+ exports.Citation.encode(message.citation, writer.uint32(58).fork()).join();
1224
+ }
1225
+ if (message.temporalValidity !== undefined) {
1226
+ ingestion_pb_1.TemporalValidity.encode(message.temporalValidity, writer.uint32(66).fork()).join();
1227
+ }
1228
+ for (const v of message.entities) {
1229
+ writer.uint32(74).string(v);
1230
+ }
1231
+ if (message.reinforcementCount !== 0) {
1232
+ writer.uint32(80).int32(message.reinforcementCount);
1233
+ }
1234
+ if (message.sessionTurn !== 0) {
1235
+ writer.uint32(88).int32(message.sessionTurn);
1236
+ }
1237
+ for (const v of message.linkedTables) {
1238
+ exports.CandidateTable.encode(v, writer.uint32(98).fork()).join();
1239
+ }
1240
+ return writer;
1241
+ },
1242
+ decode(input, length) {
1243
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1244
+ const end = length === undefined ? reader.len : reader.pos + length;
1245
+ const message = createBaseRetrievedThread();
1246
+ while (reader.pos < end) {
1247
+ const tag = reader.uint32();
1248
+ switch (tag >>> 3) {
1249
+ case 1: {
1250
+ if (tag !== 10) {
1251
+ break;
1252
+ }
1253
+ message.threadId = reader.string();
1254
+ continue;
1255
+ }
1256
+ case 2: {
1257
+ if (tag !== 18) {
1258
+ break;
1259
+ }
1260
+ message.text = reader.string();
1261
+ continue;
1262
+ }
1263
+ case 3: {
1264
+ if (tag !== 26) {
1265
+ break;
1266
+ }
1267
+ message.knowledgeType = reader.string();
1268
+ continue;
1269
+ }
1270
+ case 4: {
1271
+ if (tag !== 34) {
1272
+ break;
1273
+ }
1274
+ message.facetFields = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
1275
+ continue;
1276
+ }
1277
+ case 5: {
1278
+ if (tag !== 45) {
1279
+ break;
1280
+ }
1281
+ message.score = reader.float();
1282
+ continue;
1283
+ }
1284
+ case 6: {
1285
+ if (tag !== 48) {
1286
+ break;
1287
+ }
1288
+ message.classification = reader.int32();
1289
+ continue;
1290
+ }
1291
+ case 7: {
1292
+ if (tag !== 58) {
1293
+ break;
1294
+ }
1295
+ message.citation = exports.Citation.decode(reader, reader.uint32());
1296
+ continue;
1297
+ }
1298
+ case 8: {
1299
+ if (tag !== 66) {
1300
+ break;
1301
+ }
1302
+ message.temporalValidity = ingestion_pb_1.TemporalValidity.decode(reader, reader.uint32());
1303
+ continue;
1304
+ }
1305
+ case 9: {
1306
+ if (tag !== 74) {
1307
+ break;
1308
+ }
1309
+ message.entities.push(reader.string());
1310
+ continue;
1311
+ }
1312
+ case 10: {
1313
+ if (tag !== 80) {
1314
+ break;
1315
+ }
1316
+ message.reinforcementCount = reader.int32();
1317
+ continue;
1318
+ }
1319
+ case 11: {
1320
+ if (tag !== 88) {
1321
+ break;
1322
+ }
1323
+ message.sessionTurn = reader.int32();
1324
+ continue;
1325
+ }
1326
+ case 12: {
1327
+ if (tag !== 98) {
1328
+ break;
1329
+ }
1330
+ message.linkedTables.push(exports.CandidateTable.decode(reader, reader.uint32()));
1331
+ continue;
1332
+ }
1333
+ }
1334
+ if ((tag & 7) === 4 || tag === 0) {
1335
+ break;
1336
+ }
1337
+ reader.skip(tag & 7);
1338
+ }
1339
+ return message;
1340
+ },
1341
+ fromJSON(object) {
1342
+ return {
1343
+ threadId: isSet(object.threadId)
1344
+ ? globalThis.String(object.threadId)
1345
+ : isSet(object.thread_id)
1346
+ ? globalThis.String(object.thread_id)
1347
+ : "",
1348
+ text: isSet(object.text) ? globalThis.String(object.text) : "",
1349
+ knowledgeType: isSet(object.knowledgeType)
1350
+ ? globalThis.String(object.knowledgeType)
1351
+ : isSet(object.knowledge_type)
1352
+ ? globalThis.String(object.knowledge_type)
1353
+ : "",
1354
+ facetFields: isObject(object.facetFields)
1355
+ ? object.facetFields
1356
+ : isObject(object.facet_fields)
1357
+ ? object.facet_fields
1358
+ : undefined,
1359
+ score: isSet(object.score) ? globalThis.Number(object.score) : 0,
1360
+ classification: isSet(object.classification) ? (0, ingestion_pb_1.threadClassificationFromJSON)(object.classification) : 0,
1361
+ citation: isSet(object.citation) ? exports.Citation.fromJSON(object.citation) : undefined,
1362
+ temporalValidity: isSet(object.temporalValidity)
1363
+ ? ingestion_pb_1.TemporalValidity.fromJSON(object.temporalValidity)
1364
+ : isSet(object.temporal_validity)
1365
+ ? ingestion_pb_1.TemporalValidity.fromJSON(object.temporal_validity)
1366
+ : undefined,
1367
+ entities: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.entities)
1368
+ ? object.entities.map((e) => globalThis.String(e))
1369
+ : [],
1370
+ reinforcementCount: isSet(object.reinforcementCount)
1371
+ ? globalThis.Number(object.reinforcementCount)
1372
+ : isSet(object.reinforcement_count)
1373
+ ? globalThis.Number(object.reinforcement_count)
1374
+ : 0,
1375
+ sessionTurn: isSet(object.sessionTurn)
1376
+ ? globalThis.Number(object.sessionTurn)
1377
+ : isSet(object.session_turn)
1378
+ ? globalThis.Number(object.session_turn)
1379
+ : 0,
1380
+ linkedTables: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.linkedTables)
1381
+ ? object.linkedTables.map((e) => exports.CandidateTable.fromJSON(e))
1382
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.linked_tables)
1383
+ ? object.linked_tables.map((e) => exports.CandidateTable.fromJSON(e))
1384
+ : [],
1385
+ };
1386
+ },
1387
+ toJSON(message) {
1388
+ var _a, _b;
1389
+ const obj = {};
1390
+ if (message.threadId !== "") {
1391
+ obj.threadId = message.threadId;
1392
+ }
1393
+ if (message.text !== "") {
1394
+ obj.text = message.text;
1395
+ }
1396
+ if (message.knowledgeType !== "") {
1397
+ obj.knowledgeType = message.knowledgeType;
1398
+ }
1399
+ if (message.facetFields !== undefined) {
1400
+ obj.facetFields = message.facetFields;
1401
+ }
1402
+ if (message.score !== 0) {
1403
+ obj.score = message.score;
1404
+ }
1405
+ if (message.classification !== 0) {
1406
+ obj.classification = (0, ingestion_pb_1.threadClassificationToJSON)(message.classification);
1407
+ }
1408
+ if (message.citation !== undefined) {
1409
+ obj.citation = exports.Citation.toJSON(message.citation);
1410
+ }
1411
+ if (message.temporalValidity !== undefined) {
1412
+ obj.temporalValidity = ingestion_pb_1.TemporalValidity.toJSON(message.temporalValidity);
1413
+ }
1414
+ if ((_a = message.entities) === null || _a === void 0 ? void 0 : _a.length) {
1415
+ obj.entities = message.entities;
1416
+ }
1417
+ if (message.reinforcementCount !== 0) {
1418
+ obj.reinforcementCount = Math.round(message.reinforcementCount);
1419
+ }
1420
+ if (message.sessionTurn !== 0) {
1421
+ obj.sessionTurn = Math.round(message.sessionTurn);
1422
+ }
1423
+ if ((_b = message.linkedTables) === null || _b === void 0 ? void 0 : _b.length) {
1424
+ obj.linkedTables = message.linkedTables.map((e) => exports.CandidateTable.toJSON(e));
1425
+ }
1426
+ return obj;
1427
+ },
1428
+ create(base) {
1429
+ return exports.RetrievedThread.fromPartial(base !== null && base !== void 0 ? base : {});
1430
+ },
1431
+ fromPartial(object) {
1432
+ var _a, _b;
1433
+ var _c, _d, _e, _f, _g, _h, _j, _k;
1434
+ const message = createBaseRetrievedThread();
1435
+ message.threadId = (_c = object.threadId) !== null && _c !== void 0 ? _c : "";
1436
+ message.text = (_d = object.text) !== null && _d !== void 0 ? _d : "";
1437
+ message.knowledgeType = (_e = object.knowledgeType) !== null && _e !== void 0 ? _e : "";
1438
+ message.facetFields = (_f = object.facetFields) !== null && _f !== void 0 ? _f : undefined;
1439
+ message.score = (_g = object.score) !== null && _g !== void 0 ? _g : 0;
1440
+ message.classification = (_h = object.classification) !== null && _h !== void 0 ? _h : 0;
1441
+ message.citation = (object.citation !== undefined && object.citation !== null)
1442
+ ? exports.Citation.fromPartial(object.citation)
1443
+ : undefined;
1444
+ message.temporalValidity = (object.temporalValidity !== undefined && object.temporalValidity !== null)
1445
+ ? ingestion_pb_1.TemporalValidity.fromPartial(object.temporalValidity)
1446
+ : undefined;
1447
+ message.entities = ((_a = object.entities) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
1448
+ message.reinforcementCount = (_j = object.reinforcementCount) !== null && _j !== void 0 ? _j : 0;
1449
+ message.sessionTurn = (_k = object.sessionTurn) !== null && _k !== void 0 ? _k : 0;
1450
+ message.linkedTables = ((_b = object.linkedTables) === null || _b === void 0 ? void 0 : _b.map((e) => exports.CandidateTable.fromPartial(e))) || [];
1451
+ return message;
1452
+ },
1453
+ };
1454
+ function createBaseTabularRetrievalConstraints() {
1455
+ return { actingUserId: "", threadIds: [], documentIds: [], tableIds: [], maxTables: 0, maxRows: 0, maxBytes: 0 };
1456
+ }
1457
+ exports.TabularRetrievalConstraints = {
1458
+ encode(message, writer = new wire_1.BinaryWriter()) {
1459
+ if (message.actingUserId !== "") {
1460
+ writer.uint32(10).string(message.actingUserId);
1461
+ }
1462
+ for (const v of message.threadIds) {
1463
+ writer.uint32(18).string(v);
1464
+ }
1465
+ for (const v of message.documentIds) {
1466
+ writer.uint32(26).string(v);
1467
+ }
1468
+ for (const v of message.tableIds) {
1469
+ writer.uint32(34).string(v);
1470
+ }
1471
+ if (message.maxTables !== 0) {
1472
+ writer.uint32(40).int32(message.maxTables);
1473
+ }
1474
+ if (message.maxRows !== 0) {
1475
+ writer.uint32(48).int32(message.maxRows);
1476
+ }
1477
+ if (message.maxBytes !== 0) {
1478
+ writer.uint32(56).int64(message.maxBytes);
1479
+ }
1480
+ return writer;
1481
+ },
1482
+ decode(input, length) {
1483
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1484
+ const end = length === undefined ? reader.len : reader.pos + length;
1485
+ const message = createBaseTabularRetrievalConstraints();
1486
+ while (reader.pos < end) {
1487
+ const tag = reader.uint32();
1488
+ switch (tag >>> 3) {
1489
+ case 1: {
1490
+ if (tag !== 10) {
1491
+ break;
1492
+ }
1493
+ message.actingUserId = reader.string();
1494
+ continue;
1495
+ }
1496
+ case 2: {
1497
+ if (tag !== 18) {
1498
+ break;
1499
+ }
1500
+ message.threadIds.push(reader.string());
1501
+ continue;
1502
+ }
1503
+ case 3: {
1504
+ if (tag !== 26) {
1505
+ break;
1506
+ }
1507
+ message.documentIds.push(reader.string());
1508
+ continue;
1509
+ }
1510
+ case 4: {
1511
+ if (tag !== 34) {
1512
+ break;
1513
+ }
1514
+ message.tableIds.push(reader.string());
1515
+ continue;
1516
+ }
1517
+ case 5: {
1518
+ if (tag !== 40) {
1519
+ break;
1520
+ }
1521
+ message.maxTables = reader.int32();
1522
+ continue;
1523
+ }
1524
+ case 6: {
1525
+ if (tag !== 48) {
1526
+ break;
1527
+ }
1528
+ message.maxRows = reader.int32();
1529
+ continue;
1530
+ }
1531
+ case 7: {
1532
+ if (tag !== 56) {
1533
+ break;
1534
+ }
1535
+ message.maxBytes = longToNumber(reader.int64());
1536
+ continue;
1537
+ }
1538
+ }
1539
+ if ((tag & 7) === 4 || tag === 0) {
1540
+ break;
1541
+ }
1542
+ reader.skip(tag & 7);
1543
+ }
1544
+ return message;
1545
+ },
1546
+ fromJSON(object) {
1547
+ return {
1548
+ actingUserId: isSet(object.actingUserId)
1549
+ ? globalThis.String(object.actingUserId)
1550
+ : isSet(object.acting_user_id)
1551
+ ? globalThis.String(object.acting_user_id)
1552
+ : "",
1553
+ threadIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.threadIds)
1554
+ ? object.threadIds.map((e) => globalThis.String(e))
1555
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.thread_ids)
1556
+ ? object.thread_ids.map((e) => globalThis.String(e))
1557
+ : [],
1558
+ documentIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.documentIds)
1559
+ ? object.documentIds.map((e) => globalThis.String(e))
1560
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.document_ids)
1561
+ ? object.document_ids.map((e) => globalThis.String(e))
1562
+ : [],
1563
+ tableIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tableIds)
1564
+ ? object.tableIds.map((e) => globalThis.String(e))
1565
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.table_ids)
1566
+ ? object.table_ids.map((e) => globalThis.String(e))
1567
+ : [],
1568
+ maxTables: isSet(object.maxTables)
1569
+ ? globalThis.Number(object.maxTables)
1570
+ : isSet(object.max_tables)
1571
+ ? globalThis.Number(object.max_tables)
1572
+ : 0,
1573
+ maxRows: isSet(object.maxRows)
1574
+ ? globalThis.Number(object.maxRows)
1575
+ : isSet(object.max_rows)
1576
+ ? globalThis.Number(object.max_rows)
1577
+ : 0,
1578
+ maxBytes: isSet(object.maxBytes)
1579
+ ? globalThis.Number(object.maxBytes)
1580
+ : isSet(object.max_bytes)
1581
+ ? globalThis.Number(object.max_bytes)
1582
+ : 0,
1583
+ };
1584
+ },
1585
+ toJSON(message) {
1586
+ var _a, _b, _c;
1587
+ const obj = {};
1588
+ if (message.actingUserId !== "") {
1589
+ obj.actingUserId = message.actingUserId;
1590
+ }
1591
+ if ((_a = message.threadIds) === null || _a === void 0 ? void 0 : _a.length) {
1592
+ obj.threadIds = message.threadIds;
1593
+ }
1594
+ if ((_b = message.documentIds) === null || _b === void 0 ? void 0 : _b.length) {
1595
+ obj.documentIds = message.documentIds;
1596
+ }
1597
+ if ((_c = message.tableIds) === null || _c === void 0 ? void 0 : _c.length) {
1598
+ obj.tableIds = message.tableIds;
1599
+ }
1600
+ if (message.maxTables !== 0) {
1601
+ obj.maxTables = Math.round(message.maxTables);
1602
+ }
1603
+ if (message.maxRows !== 0) {
1604
+ obj.maxRows = Math.round(message.maxRows);
1605
+ }
1606
+ if (message.maxBytes !== 0) {
1607
+ obj.maxBytes = Math.round(message.maxBytes);
1608
+ }
1609
+ return obj;
1610
+ },
1611
+ create(base) {
1612
+ return exports.TabularRetrievalConstraints.fromPartial(base !== null && base !== void 0 ? base : {});
1613
+ },
1614
+ fromPartial(object) {
1615
+ var _a, _b, _c;
1616
+ var _d, _e, _f, _g;
1617
+ const message = createBaseTabularRetrievalConstraints();
1618
+ message.actingUserId = (_d = object.actingUserId) !== null && _d !== void 0 ? _d : "";
1619
+ message.threadIds = ((_a = object.threadIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
1620
+ message.documentIds = ((_b = object.documentIds) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
1621
+ message.tableIds = ((_c = object.tableIds) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
1622
+ message.maxTables = (_e = object.maxTables) !== null && _e !== void 0 ? _e : 0;
1623
+ message.maxRows = (_f = object.maxRows) !== null && _f !== void 0 ? _f : 0;
1624
+ message.maxBytes = (_g = object.maxBytes) !== null && _g !== void 0 ? _g : 0;
1625
+ return message;
1626
+ },
1627
+ };
1628
+ function createBaseCandidateTable() {
1629
+ return {
1630
+ tableId: "",
1631
+ documentId: "",
1632
+ documentName: "",
1633
+ tableName: "",
1634
+ summary: "",
1635
+ safeTableAlias: "",
1636
+ artifactId: "",
1637
+ artifactVersion: 0,
1638
+ sourceFormat: 0,
1639
+ parserName: "",
1640
+ rowCount: 0,
1641
+ columnCount: 0,
1642
+ columns: [],
1643
+ sourceLocation: undefined,
1644
+ score: 0,
1645
+ };
1646
+ }
1647
+ exports.CandidateTable = {
1648
+ encode(message, writer = new wire_1.BinaryWriter()) {
1649
+ if (message.tableId !== "") {
1650
+ writer.uint32(10).string(message.tableId);
1651
+ }
1652
+ if (message.documentId !== "") {
1653
+ writer.uint32(18).string(message.documentId);
1654
+ }
1655
+ if (message.documentName !== "") {
1656
+ writer.uint32(26).string(message.documentName);
1657
+ }
1658
+ if (message.tableName !== "") {
1659
+ writer.uint32(34).string(message.tableName);
1660
+ }
1661
+ if (message.summary !== "") {
1662
+ writer.uint32(42).string(message.summary);
1663
+ }
1664
+ if (message.safeTableAlias !== "") {
1665
+ writer.uint32(50).string(message.safeTableAlias);
1666
+ }
1667
+ if (message.artifactId !== "") {
1668
+ writer.uint32(58).string(message.artifactId);
1669
+ }
1670
+ if (message.artifactVersion !== 0) {
1671
+ writer.uint32(64).int32(message.artifactVersion);
1672
+ }
1673
+ if (message.sourceFormat !== 0) {
1674
+ writer.uint32(72).int32(message.sourceFormat);
1675
+ }
1676
+ if (message.parserName !== "") {
1677
+ writer.uint32(82).string(message.parserName);
1678
+ }
1679
+ if (message.rowCount !== 0) {
1680
+ writer.uint32(88).int64(message.rowCount);
1681
+ }
1682
+ if (message.columnCount !== 0) {
1683
+ writer.uint32(96).int32(message.columnCount);
1684
+ }
1685
+ for (const v of message.columns) {
1686
+ table_pb_1.DocumentTableColumn.encode(v, writer.uint32(106).fork()).join();
1687
+ }
1688
+ if (message.sourceLocation !== undefined) {
1689
+ ingestion_pb_1.SourceLocation.encode(message.sourceLocation, writer.uint32(114).fork()).join();
1690
+ }
1691
+ if (message.score !== 0) {
1692
+ writer.uint32(125).float(message.score);
1693
+ }
1694
+ return writer;
1695
+ },
1696
+ decode(input, length) {
1697
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1698
+ const end = length === undefined ? reader.len : reader.pos + length;
1699
+ const message = createBaseCandidateTable();
1700
+ while (reader.pos < end) {
1701
+ const tag = reader.uint32();
1702
+ switch (tag >>> 3) {
1703
+ case 1: {
1704
+ if (tag !== 10) {
1705
+ break;
1706
+ }
1707
+ message.tableId = reader.string();
1708
+ continue;
1709
+ }
1710
+ case 2: {
1711
+ if (tag !== 18) {
1712
+ break;
1713
+ }
1714
+ message.documentId = reader.string();
1715
+ continue;
1716
+ }
1717
+ case 3: {
1718
+ if (tag !== 26) {
1719
+ break;
1720
+ }
1721
+ message.documentName = reader.string();
1722
+ continue;
1723
+ }
1724
+ case 4: {
1725
+ if (tag !== 34) {
1726
+ break;
1727
+ }
1728
+ message.tableName = reader.string();
1729
+ continue;
1730
+ }
1731
+ case 5: {
1732
+ if (tag !== 42) {
1733
+ break;
1734
+ }
1735
+ message.summary = reader.string();
1736
+ continue;
1737
+ }
1738
+ case 6: {
1739
+ if (tag !== 50) {
1740
+ break;
1741
+ }
1742
+ message.safeTableAlias = reader.string();
1743
+ continue;
1744
+ }
1745
+ case 7: {
1746
+ if (tag !== 58) {
1747
+ break;
1748
+ }
1749
+ message.artifactId = reader.string();
1750
+ continue;
1751
+ }
1752
+ case 8: {
1753
+ if (tag !== 64) {
1754
+ break;
1755
+ }
1756
+ message.artifactVersion = reader.int32();
1757
+ continue;
1758
+ }
1759
+ case 9: {
1760
+ if (tag !== 72) {
1761
+ break;
1762
+ }
1763
+ message.sourceFormat = reader.int32();
1764
+ continue;
1765
+ }
1766
+ case 10: {
1767
+ if (tag !== 82) {
1768
+ break;
1769
+ }
1770
+ message.parserName = reader.string();
1771
+ continue;
1772
+ }
1773
+ case 11: {
1774
+ if (tag !== 88) {
1775
+ break;
1776
+ }
1777
+ message.rowCount = longToNumber(reader.int64());
1778
+ continue;
1779
+ }
1780
+ case 12: {
1781
+ if (tag !== 96) {
1782
+ break;
1783
+ }
1784
+ message.columnCount = reader.int32();
1785
+ continue;
1786
+ }
1787
+ case 13: {
1788
+ if (tag !== 106) {
1789
+ break;
1790
+ }
1791
+ message.columns.push(table_pb_1.DocumentTableColumn.decode(reader, reader.uint32()));
1792
+ continue;
1793
+ }
1794
+ case 14: {
1795
+ if (tag !== 114) {
1796
+ break;
1797
+ }
1798
+ message.sourceLocation = ingestion_pb_1.SourceLocation.decode(reader, reader.uint32());
1799
+ continue;
1800
+ }
1801
+ case 15: {
1802
+ if (tag !== 125) {
1803
+ break;
1804
+ }
1805
+ message.score = reader.float();
1806
+ continue;
1807
+ }
1808
+ }
1809
+ if ((tag & 7) === 4 || tag === 0) {
1810
+ break;
1811
+ }
1812
+ reader.skip(tag & 7);
1813
+ }
1814
+ return message;
1815
+ },
1816
+ fromJSON(object) {
1817
+ return {
1818
+ tableId: isSet(object.tableId)
1819
+ ? globalThis.String(object.tableId)
1820
+ : isSet(object.table_id)
1821
+ ? globalThis.String(object.table_id)
1822
+ : "",
1823
+ documentId: isSet(object.documentId)
1824
+ ? globalThis.String(object.documentId)
1825
+ : isSet(object.document_id)
1826
+ ? globalThis.String(object.document_id)
1827
+ : "",
1828
+ documentName: isSet(object.documentName)
1829
+ ? globalThis.String(object.documentName)
1830
+ : isSet(object.document_name)
1831
+ ? globalThis.String(object.document_name)
1832
+ : "",
1833
+ tableName: isSet(object.tableName)
1834
+ ? globalThis.String(object.tableName)
1835
+ : isSet(object.table_name)
1836
+ ? globalThis.String(object.table_name)
1837
+ : "",
1838
+ summary: isSet(object.summary) ? globalThis.String(object.summary) : "",
1839
+ safeTableAlias: isSet(object.safeTableAlias)
1840
+ ? globalThis.String(object.safeTableAlias)
1841
+ : isSet(object.safe_table_alias)
1842
+ ? globalThis.String(object.safe_table_alias)
1843
+ : "",
1844
+ artifactId: isSet(object.artifactId)
1845
+ ? globalThis.String(object.artifactId)
1846
+ : isSet(object.artifact_id)
1847
+ ? globalThis.String(object.artifact_id)
1848
+ : "",
1849
+ artifactVersion: isSet(object.artifactVersion)
1850
+ ? globalThis.Number(object.artifactVersion)
1851
+ : isSet(object.artifact_version)
1852
+ ? globalThis.Number(object.artifact_version)
1853
+ : 0,
1854
+ sourceFormat: isSet(object.sourceFormat)
1855
+ ? (0, table_pb_1.tableSourceFormatFromJSON)(object.sourceFormat)
1856
+ : isSet(object.source_format)
1857
+ ? (0, table_pb_1.tableSourceFormatFromJSON)(object.source_format)
1858
+ : 0,
1859
+ parserName: isSet(object.parserName)
1860
+ ? globalThis.String(object.parserName)
1861
+ : isSet(object.parser_name)
1862
+ ? globalThis.String(object.parser_name)
1863
+ : "",
1864
+ rowCount: isSet(object.rowCount)
1865
+ ? globalThis.Number(object.rowCount)
1866
+ : isSet(object.row_count)
1867
+ ? globalThis.Number(object.row_count)
1868
+ : 0,
1869
+ columnCount: isSet(object.columnCount)
1870
+ ? globalThis.Number(object.columnCount)
1871
+ : isSet(object.column_count)
1872
+ ? globalThis.Number(object.column_count)
1873
+ : 0,
1874
+ columns: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.columns)
1875
+ ? object.columns.map((e) => table_pb_1.DocumentTableColumn.fromJSON(e))
1876
+ : [],
1877
+ sourceLocation: isSet(object.sourceLocation)
1878
+ ? ingestion_pb_1.SourceLocation.fromJSON(object.sourceLocation)
1879
+ : isSet(object.source_location)
1880
+ ? ingestion_pb_1.SourceLocation.fromJSON(object.source_location)
1881
+ : undefined,
1882
+ score: isSet(object.score) ? globalThis.Number(object.score) : 0,
1883
+ };
1884
+ },
1885
+ toJSON(message) {
1886
+ var _a;
1887
+ const obj = {};
1888
+ if (message.tableId !== "") {
1889
+ obj.tableId = message.tableId;
1890
+ }
1891
+ if (message.documentId !== "") {
1892
+ obj.documentId = message.documentId;
1893
+ }
1894
+ if (message.documentName !== "") {
1895
+ obj.documentName = message.documentName;
1896
+ }
1897
+ if (message.tableName !== "") {
1898
+ obj.tableName = message.tableName;
1899
+ }
1900
+ if (message.summary !== "") {
1901
+ obj.summary = message.summary;
1902
+ }
1903
+ if (message.safeTableAlias !== "") {
1904
+ obj.safeTableAlias = message.safeTableAlias;
1905
+ }
1906
+ if (message.artifactId !== "") {
1907
+ obj.artifactId = message.artifactId;
1908
+ }
1909
+ if (message.artifactVersion !== 0) {
1910
+ obj.artifactVersion = Math.round(message.artifactVersion);
1911
+ }
1912
+ if (message.sourceFormat !== 0) {
1913
+ obj.sourceFormat = (0, table_pb_1.tableSourceFormatToJSON)(message.sourceFormat);
1914
+ }
1915
+ if (message.parserName !== "") {
1916
+ obj.parserName = message.parserName;
1917
+ }
1918
+ if (message.rowCount !== 0) {
1919
+ obj.rowCount = Math.round(message.rowCount);
1920
+ }
1921
+ if (message.columnCount !== 0) {
1922
+ obj.columnCount = Math.round(message.columnCount);
1923
+ }
1924
+ if ((_a = message.columns) === null || _a === void 0 ? void 0 : _a.length) {
1925
+ obj.columns = message.columns.map((e) => table_pb_1.DocumentTableColumn.toJSON(e));
1926
+ }
1927
+ if (message.sourceLocation !== undefined) {
1928
+ obj.sourceLocation = ingestion_pb_1.SourceLocation.toJSON(message.sourceLocation);
1929
+ }
1930
+ if (message.score !== 0) {
1931
+ obj.score = message.score;
1932
+ }
1933
+ return obj;
1934
+ },
1935
+ create(base) {
1936
+ return exports.CandidateTable.fromPartial(base !== null && base !== void 0 ? base : {});
1937
+ },
1938
+ fromPartial(object) {
1939
+ var _a;
1940
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1941
+ const message = createBaseCandidateTable();
1942
+ message.tableId = (_b = object.tableId) !== null && _b !== void 0 ? _b : "";
1943
+ message.documentId = (_c = object.documentId) !== null && _c !== void 0 ? _c : "";
1944
+ message.documentName = (_d = object.documentName) !== null && _d !== void 0 ? _d : "";
1945
+ message.tableName = (_e = object.tableName) !== null && _e !== void 0 ? _e : "";
1946
+ message.summary = (_f = object.summary) !== null && _f !== void 0 ? _f : "";
1947
+ message.safeTableAlias = (_g = object.safeTableAlias) !== null && _g !== void 0 ? _g : "";
1948
+ message.artifactId = (_h = object.artifactId) !== null && _h !== void 0 ? _h : "";
1949
+ message.artifactVersion = (_j = object.artifactVersion) !== null && _j !== void 0 ? _j : 0;
1950
+ message.sourceFormat = (_k = object.sourceFormat) !== null && _k !== void 0 ? _k : 0;
1951
+ message.parserName = (_l = object.parserName) !== null && _l !== void 0 ? _l : "";
1952
+ message.rowCount = (_m = object.rowCount) !== null && _m !== void 0 ? _m : 0;
1953
+ message.columnCount = (_o = object.columnCount) !== null && _o !== void 0 ? _o : 0;
1954
+ message.columns = ((_a = object.columns) === null || _a === void 0 ? void 0 : _a.map((e) => table_pb_1.DocumentTableColumn.fromPartial(e))) || [];
1955
+ message.sourceLocation = (object.sourceLocation !== undefined && object.sourceLocation !== null)
1956
+ ? ingestion_pb_1.SourceLocation.fromPartial(object.sourceLocation)
1957
+ : undefined;
1958
+ message.score = (_p = object.score) !== null && _p !== void 0 ? _p : 0;
1959
+ return message;
1960
+ },
1961
+ };
1962
+ function createBaseTabularResultColumn() {
1963
+ return { name: "", dataType: "", sourceName: "" };
1964
+ }
1965
+ exports.TabularResultColumn = {
1966
+ encode(message, writer = new wire_1.BinaryWriter()) {
1967
+ if (message.name !== "") {
1968
+ writer.uint32(10).string(message.name);
1969
+ }
1970
+ if (message.dataType !== "") {
1971
+ writer.uint32(18).string(message.dataType);
1972
+ }
1973
+ if (message.sourceName !== "") {
1974
+ writer.uint32(26).string(message.sourceName);
1975
+ }
1976
+ return writer;
1977
+ },
1978
+ decode(input, length) {
1979
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1980
+ const end = length === undefined ? reader.len : reader.pos + length;
1981
+ const message = createBaseTabularResultColumn();
1982
+ while (reader.pos < end) {
1983
+ const tag = reader.uint32();
1984
+ switch (tag >>> 3) {
1985
+ case 1: {
1986
+ if (tag !== 10) {
1987
+ break;
1988
+ }
1989
+ message.name = reader.string();
1990
+ continue;
1991
+ }
1992
+ case 2: {
1993
+ if (tag !== 18) {
1994
+ break;
1995
+ }
1996
+ message.dataType = reader.string();
1997
+ continue;
1998
+ }
1999
+ case 3: {
2000
+ if (tag !== 26) {
2001
+ break;
2002
+ }
2003
+ message.sourceName = reader.string();
2004
+ continue;
2005
+ }
2006
+ }
2007
+ if ((tag & 7) === 4 || tag === 0) {
2008
+ break;
2009
+ }
2010
+ reader.skip(tag & 7);
2011
+ }
2012
+ return message;
2013
+ },
2014
+ fromJSON(object) {
2015
+ return {
2016
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
2017
+ dataType: isSet(object.dataType)
2018
+ ? globalThis.String(object.dataType)
2019
+ : isSet(object.data_type)
2020
+ ? globalThis.String(object.data_type)
2021
+ : "",
2022
+ sourceName: isSet(object.sourceName)
2023
+ ? globalThis.String(object.sourceName)
2024
+ : isSet(object.source_name)
2025
+ ? globalThis.String(object.source_name)
2026
+ : "",
2027
+ };
2028
+ },
2029
+ toJSON(message) {
2030
+ const obj = {};
2031
+ if (message.name !== "") {
2032
+ obj.name = message.name;
2033
+ }
2034
+ if (message.dataType !== "") {
2035
+ obj.dataType = message.dataType;
2036
+ }
2037
+ if (message.sourceName !== "") {
2038
+ obj.sourceName = message.sourceName;
2039
+ }
2040
+ return obj;
2041
+ },
2042
+ create(base) {
2043
+ return exports.TabularResultColumn.fromPartial(base !== null && base !== void 0 ? base : {});
2044
+ },
2045
+ fromPartial(object) {
2046
+ var _a, _b, _c;
2047
+ const message = createBaseTabularResultColumn();
2048
+ message.name = (_a = object.name) !== null && _a !== void 0 ? _a : "";
2049
+ message.dataType = (_b = object.dataType) !== null && _b !== void 0 ? _b : "";
2050
+ message.sourceName = (_c = object.sourceName) !== null && _c !== void 0 ? _c : "";
2051
+ return message;
2052
+ },
2053
+ };
2054
+ function createBaseTabularCell() {
2055
+ return { value: undefined, displayValue: "" };
2056
+ }
2057
+ exports.TabularCell = {
2058
+ encode(message, writer = new wire_1.BinaryWriter()) {
2059
+ if (message.value !== undefined) {
2060
+ struct_pb_1.Value.encode(struct_pb_1.Value.wrap(message.value), writer.uint32(10).fork()).join();
2061
+ }
2062
+ if (message.displayValue !== "") {
2063
+ writer.uint32(18).string(message.displayValue);
2064
+ }
2065
+ return writer;
2066
+ },
2067
+ decode(input, length) {
2068
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2069
+ const end = length === undefined ? reader.len : reader.pos + length;
2070
+ const message = createBaseTabularCell();
2071
+ while (reader.pos < end) {
2072
+ const tag = reader.uint32();
2073
+ switch (tag >>> 3) {
2074
+ case 1: {
2075
+ if (tag !== 10) {
2076
+ break;
2077
+ }
2078
+ message.value = struct_pb_1.Value.unwrap(struct_pb_1.Value.decode(reader, reader.uint32()));
2079
+ continue;
2080
+ }
2081
+ case 2: {
2082
+ if (tag !== 18) {
2083
+ break;
2084
+ }
2085
+ message.displayValue = reader.string();
2086
+ continue;
2087
+ }
2088
+ }
2089
+ if ((tag & 7) === 4 || tag === 0) {
2090
+ break;
2091
+ }
2092
+ reader.skip(tag & 7);
2093
+ }
2094
+ return message;
2095
+ },
2096
+ fromJSON(object) {
2097
+ return {
2098
+ value: isSet(object === null || object === void 0 ? void 0 : object.value) ? object.value : undefined,
2099
+ displayValue: isSet(object.displayValue)
2100
+ ? globalThis.String(object.displayValue)
2101
+ : isSet(object.display_value)
2102
+ ? globalThis.String(object.display_value)
2103
+ : "",
2104
+ };
2105
+ },
2106
+ toJSON(message) {
2107
+ const obj = {};
2108
+ if (message.value !== undefined) {
2109
+ obj.value = message.value;
2110
+ }
2111
+ if (message.displayValue !== "") {
2112
+ obj.displayValue = message.displayValue;
2113
+ }
2114
+ return obj;
2115
+ },
2116
+ create(base) {
2117
+ return exports.TabularCell.fromPartial(base !== null && base !== void 0 ? base : {});
2118
+ },
2119
+ fromPartial(object) {
2120
+ var _a, _b;
2121
+ const message = createBaseTabularCell();
2122
+ message.value = (_a = object.value) !== null && _a !== void 0 ? _a : undefined;
2123
+ message.displayValue = (_b = object.displayValue) !== null && _b !== void 0 ? _b : "";
2124
+ return message;
2125
+ },
2126
+ };
2127
+ function createBaseTabularResultRow() {
2128
+ return { cells: [], rowIndex: 0 };
2129
+ }
2130
+ exports.TabularResultRow = {
2131
+ encode(message, writer = new wire_1.BinaryWriter()) {
2132
+ for (const v of message.cells) {
2133
+ exports.TabularCell.encode(v, writer.uint32(10).fork()).join();
2134
+ }
2135
+ if (message.rowIndex !== 0) {
2136
+ writer.uint32(16).int64(message.rowIndex);
2137
+ }
2138
+ return writer;
2139
+ },
2140
+ decode(input, length) {
2141
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2142
+ const end = length === undefined ? reader.len : reader.pos + length;
2143
+ const message = createBaseTabularResultRow();
2144
+ while (reader.pos < end) {
2145
+ const tag = reader.uint32();
2146
+ switch (tag >>> 3) {
2147
+ case 1: {
2148
+ if (tag !== 10) {
2149
+ break;
2150
+ }
2151
+ message.cells.push(exports.TabularCell.decode(reader, reader.uint32()));
2152
+ continue;
2153
+ }
2154
+ case 2: {
2155
+ if (tag !== 16) {
2156
+ break;
2157
+ }
2158
+ message.rowIndex = longToNumber(reader.int64());
2159
+ continue;
2160
+ }
2161
+ }
2162
+ if ((tag & 7) === 4 || tag === 0) {
2163
+ break;
2164
+ }
2165
+ reader.skip(tag & 7);
2166
+ }
2167
+ return message;
2168
+ },
2169
+ fromJSON(object) {
2170
+ return {
2171
+ cells: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.cells) ? object.cells.map((e) => exports.TabularCell.fromJSON(e)) : [],
2172
+ rowIndex: isSet(object.rowIndex)
2173
+ ? globalThis.Number(object.rowIndex)
2174
+ : isSet(object.row_index)
2175
+ ? globalThis.Number(object.row_index)
2176
+ : 0,
2177
+ };
2178
+ },
2179
+ toJSON(message) {
2180
+ var _a;
2181
+ const obj = {};
2182
+ if ((_a = message.cells) === null || _a === void 0 ? void 0 : _a.length) {
2183
+ obj.cells = message.cells.map((e) => exports.TabularCell.toJSON(e));
2184
+ }
2185
+ if (message.rowIndex !== 0) {
2186
+ obj.rowIndex = Math.round(message.rowIndex);
2187
+ }
2188
+ return obj;
2189
+ },
2190
+ create(base) {
2191
+ return exports.TabularResultRow.fromPartial(base !== null && base !== void 0 ? base : {});
2192
+ },
2193
+ fromPartial(object) {
2194
+ var _a;
2195
+ var _b;
2196
+ const message = createBaseTabularResultRow();
2197
+ message.cells = ((_a = object.cells) === null || _a === void 0 ? void 0 : _a.map((e) => exports.TabularCell.fromPartial(e))) || [];
2198
+ message.rowIndex = (_b = object.rowIndex) !== null && _b !== void 0 ? _b : 0;
2199
+ return message;
2200
+ },
2201
+ };
2202
+ function createBaseTabularCitation() {
2203
+ return {
2204
+ documentId: "",
2205
+ documentName: "",
2206
+ tableId: "",
2207
+ tableName: "",
2208
+ sourceLocation: undefined,
2209
+ rowIndex: 0,
2210
+ columnName: "",
2211
+ };
2212
+ }
2213
+ exports.TabularCitation = {
2214
+ encode(message, writer = new wire_1.BinaryWriter()) {
2215
+ if (message.documentId !== "") {
2216
+ writer.uint32(10).string(message.documentId);
2217
+ }
2218
+ if (message.documentName !== "") {
2219
+ writer.uint32(18).string(message.documentName);
2220
+ }
2221
+ if (message.tableId !== "") {
2222
+ writer.uint32(26).string(message.tableId);
2223
+ }
2224
+ if (message.tableName !== "") {
2225
+ writer.uint32(34).string(message.tableName);
2226
+ }
2227
+ if (message.sourceLocation !== undefined) {
2228
+ ingestion_pb_1.SourceLocation.encode(message.sourceLocation, writer.uint32(42).fork()).join();
2229
+ }
2230
+ if (message.rowIndex !== 0) {
2231
+ writer.uint32(48).int64(message.rowIndex);
2232
+ }
2233
+ if (message.columnName !== "") {
2234
+ writer.uint32(58).string(message.columnName);
2235
+ }
2236
+ return writer;
2237
+ },
2238
+ decode(input, length) {
2239
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2240
+ const end = length === undefined ? reader.len : reader.pos + length;
2241
+ const message = createBaseTabularCitation();
2242
+ while (reader.pos < end) {
2243
+ const tag = reader.uint32();
2244
+ switch (tag >>> 3) {
2245
+ case 1: {
2246
+ if (tag !== 10) {
2247
+ break;
2248
+ }
2249
+ message.documentId = reader.string();
2250
+ continue;
2251
+ }
2252
+ case 2: {
2253
+ if (tag !== 18) {
2254
+ break;
2255
+ }
2256
+ message.documentName = reader.string();
2257
+ continue;
2258
+ }
2259
+ case 3: {
2260
+ if (tag !== 26) {
2261
+ break;
2262
+ }
2263
+ message.tableId = reader.string();
2264
+ continue;
2265
+ }
2266
+ case 4: {
2267
+ if (tag !== 34) {
2268
+ break;
2269
+ }
2270
+ message.tableName = reader.string();
2271
+ continue;
2272
+ }
2273
+ case 5: {
2274
+ if (tag !== 42) {
2275
+ break;
2276
+ }
2277
+ message.sourceLocation = ingestion_pb_1.SourceLocation.decode(reader, reader.uint32());
2278
+ continue;
2279
+ }
2280
+ case 6: {
2281
+ if (tag !== 48) {
2282
+ break;
2283
+ }
2284
+ message.rowIndex = longToNumber(reader.int64());
2285
+ continue;
2286
+ }
2287
+ case 7: {
2288
+ if (tag !== 58) {
2289
+ break;
2290
+ }
2291
+ message.columnName = reader.string();
2292
+ continue;
2293
+ }
2294
+ }
2295
+ if ((tag & 7) === 4 || tag === 0) {
2296
+ break;
2297
+ }
2298
+ reader.skip(tag & 7);
2299
+ }
2300
+ return message;
2301
+ },
2302
+ fromJSON(object) {
2303
+ return {
2304
+ documentId: isSet(object.documentId)
2305
+ ? globalThis.String(object.documentId)
2306
+ : isSet(object.document_id)
2307
+ ? globalThis.String(object.document_id)
2308
+ : "",
2309
+ documentName: isSet(object.documentName)
2310
+ ? globalThis.String(object.documentName)
2311
+ : isSet(object.document_name)
2312
+ ? globalThis.String(object.document_name)
2313
+ : "",
2314
+ tableId: isSet(object.tableId)
2315
+ ? globalThis.String(object.tableId)
2316
+ : isSet(object.table_id)
2317
+ ? globalThis.String(object.table_id)
2318
+ : "",
2319
+ tableName: isSet(object.tableName)
2320
+ ? globalThis.String(object.tableName)
2321
+ : isSet(object.table_name)
2322
+ ? globalThis.String(object.table_name)
2323
+ : "",
2324
+ sourceLocation: isSet(object.sourceLocation)
2325
+ ? ingestion_pb_1.SourceLocation.fromJSON(object.sourceLocation)
2326
+ : isSet(object.source_location)
2327
+ ? ingestion_pb_1.SourceLocation.fromJSON(object.source_location)
2328
+ : undefined,
2329
+ rowIndex: isSet(object.rowIndex)
2330
+ ? globalThis.Number(object.rowIndex)
2331
+ : isSet(object.row_index)
2332
+ ? globalThis.Number(object.row_index)
2333
+ : 0,
2334
+ columnName: isSet(object.columnName)
2335
+ ? globalThis.String(object.columnName)
2336
+ : isSet(object.column_name)
2337
+ ? globalThis.String(object.column_name)
2338
+ : "",
2339
+ };
2340
+ },
2341
+ toJSON(message) {
2342
+ const obj = {};
2343
+ if (message.documentId !== "") {
2344
+ obj.documentId = message.documentId;
2345
+ }
2346
+ if (message.documentName !== "") {
2347
+ obj.documentName = message.documentName;
2348
+ }
2349
+ if (message.tableId !== "") {
2350
+ obj.tableId = message.tableId;
2351
+ }
2352
+ if (message.tableName !== "") {
2353
+ obj.tableName = message.tableName;
2354
+ }
2355
+ if (message.sourceLocation !== undefined) {
2356
+ obj.sourceLocation = ingestion_pb_1.SourceLocation.toJSON(message.sourceLocation);
2357
+ }
2358
+ if (message.rowIndex !== 0) {
2359
+ obj.rowIndex = Math.round(message.rowIndex);
2360
+ }
2361
+ if (message.columnName !== "") {
2362
+ obj.columnName = message.columnName;
2363
+ }
2364
+ return obj;
2365
+ },
2366
+ create(base) {
2367
+ return exports.TabularCitation.fromPartial(base !== null && base !== void 0 ? base : {});
2368
+ },
2369
+ fromPartial(object) {
2370
+ var _a, _b, _c, _d, _e, _f;
2371
+ const message = createBaseTabularCitation();
2372
+ message.documentId = (_a = object.documentId) !== null && _a !== void 0 ? _a : "";
2373
+ message.documentName = (_b = object.documentName) !== null && _b !== void 0 ? _b : "";
2374
+ message.tableId = (_c = object.tableId) !== null && _c !== void 0 ? _c : "";
2375
+ message.tableName = (_d = object.tableName) !== null && _d !== void 0 ? _d : "";
2376
+ message.sourceLocation = (object.sourceLocation !== undefined && object.sourceLocation !== null)
2377
+ ? ingestion_pb_1.SourceLocation.fromPartial(object.sourceLocation)
2378
+ : undefined;
2379
+ message.rowIndex = (_e = object.rowIndex) !== null && _e !== void 0 ? _e : 0;
2380
+ message.columnName = (_f = object.columnName) !== null && _f !== void 0 ? _f : "";
2381
+ return message;
2382
+ },
2383
+ };
2384
+ function createBaseTabularQueryResult() {
2385
+ return {
2386
+ tableId: "",
2387
+ safeTableAlias: "",
2388
+ sql: "",
2389
+ columns: [],
2390
+ rows: [],
2391
+ citations: [],
2392
+ totalRowCount: 0,
2393
+ truncated: false,
2394
+ };
2395
+ }
2396
+ exports.TabularQueryResult = {
2397
+ encode(message, writer = new wire_1.BinaryWriter()) {
2398
+ if (message.tableId !== "") {
2399
+ writer.uint32(10).string(message.tableId);
2400
+ }
2401
+ if (message.safeTableAlias !== "") {
2402
+ writer.uint32(18).string(message.safeTableAlias);
2403
+ }
2404
+ if (message.sql !== "") {
2405
+ writer.uint32(26).string(message.sql);
2406
+ }
2407
+ for (const v of message.columns) {
2408
+ exports.TabularResultColumn.encode(v, writer.uint32(34).fork()).join();
2409
+ }
2410
+ for (const v of message.rows) {
2411
+ exports.TabularResultRow.encode(v, writer.uint32(42).fork()).join();
2412
+ }
2413
+ for (const v of message.citations) {
2414
+ exports.TabularCitation.encode(v, writer.uint32(50).fork()).join();
2415
+ }
2416
+ if (message.totalRowCount !== 0) {
2417
+ writer.uint32(56).int64(message.totalRowCount);
2418
+ }
2419
+ if (message.truncated !== false) {
2420
+ writer.uint32(64).bool(message.truncated);
2421
+ }
2422
+ return writer;
2423
+ },
2424
+ decode(input, length) {
2425
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2426
+ const end = length === undefined ? reader.len : reader.pos + length;
2427
+ const message = createBaseTabularQueryResult();
2428
+ while (reader.pos < end) {
2429
+ const tag = reader.uint32();
2430
+ switch (tag >>> 3) {
2431
+ case 1: {
2432
+ if (tag !== 10) {
2433
+ break;
2434
+ }
2435
+ message.tableId = reader.string();
2436
+ continue;
2437
+ }
2438
+ case 2: {
2439
+ if (tag !== 18) {
2440
+ break;
2441
+ }
2442
+ message.safeTableAlias = reader.string();
2443
+ continue;
2444
+ }
2445
+ case 3: {
2446
+ if (tag !== 26) {
2447
+ break;
2448
+ }
2449
+ message.sql = reader.string();
2450
+ continue;
2451
+ }
2452
+ case 4: {
2453
+ if (tag !== 34) {
2454
+ break;
2455
+ }
2456
+ message.columns.push(exports.TabularResultColumn.decode(reader, reader.uint32()));
2457
+ continue;
2458
+ }
2459
+ case 5: {
2460
+ if (tag !== 42) {
2461
+ break;
2462
+ }
2463
+ message.rows.push(exports.TabularResultRow.decode(reader, reader.uint32()));
2464
+ continue;
2465
+ }
2466
+ case 6: {
2467
+ if (tag !== 50) {
2468
+ break;
2469
+ }
2470
+ message.citations.push(exports.TabularCitation.decode(reader, reader.uint32()));
2471
+ continue;
2472
+ }
2473
+ case 7: {
2474
+ if (tag !== 56) {
2475
+ break;
2476
+ }
2477
+ message.totalRowCount = longToNumber(reader.int64());
2478
+ continue;
2479
+ }
2480
+ case 8: {
2481
+ if (tag !== 64) {
2482
+ break;
2483
+ }
2484
+ message.truncated = reader.bool();
2485
+ continue;
2486
+ }
2487
+ }
2488
+ if ((tag & 7) === 4 || tag === 0) {
2489
+ break;
2490
+ }
2491
+ reader.skip(tag & 7);
2492
+ }
2493
+ return message;
2494
+ },
2495
+ fromJSON(object) {
2496
+ return {
2497
+ tableId: isSet(object.tableId)
2498
+ ? globalThis.String(object.tableId)
2499
+ : isSet(object.table_id)
2500
+ ? globalThis.String(object.table_id)
2501
+ : "",
2502
+ safeTableAlias: isSet(object.safeTableAlias)
2503
+ ? globalThis.String(object.safeTableAlias)
2504
+ : isSet(object.safe_table_alias)
2505
+ ? globalThis.String(object.safe_table_alias)
2506
+ : "",
2507
+ sql: isSet(object.sql) ? globalThis.String(object.sql) : "",
2508
+ columns: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.columns)
2509
+ ? object.columns.map((e) => exports.TabularResultColumn.fromJSON(e))
2510
+ : [],
2511
+ rows: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.rows) ? object.rows.map((e) => exports.TabularResultRow.fromJSON(e)) : [],
2512
+ citations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.citations)
2513
+ ? object.citations.map((e) => exports.TabularCitation.fromJSON(e))
2514
+ : [],
2515
+ totalRowCount: isSet(object.totalRowCount)
2516
+ ? globalThis.Number(object.totalRowCount)
2517
+ : isSet(object.total_row_count)
2518
+ ? globalThis.Number(object.total_row_count)
2519
+ : 0,
2520
+ truncated: isSet(object.truncated) ? globalThis.Boolean(object.truncated) : false,
2521
+ };
2522
+ },
2523
+ toJSON(message) {
2524
+ var _a, _b, _c;
2525
+ const obj = {};
2526
+ if (message.tableId !== "") {
2527
+ obj.tableId = message.tableId;
2528
+ }
2529
+ if (message.safeTableAlias !== "") {
2530
+ obj.safeTableAlias = message.safeTableAlias;
2531
+ }
2532
+ if (message.sql !== "") {
2533
+ obj.sql = message.sql;
2534
+ }
2535
+ if ((_a = message.columns) === null || _a === void 0 ? void 0 : _a.length) {
2536
+ obj.columns = message.columns.map((e) => exports.TabularResultColumn.toJSON(e));
2537
+ }
2538
+ if ((_b = message.rows) === null || _b === void 0 ? void 0 : _b.length) {
2539
+ obj.rows = message.rows.map((e) => exports.TabularResultRow.toJSON(e));
2540
+ }
2541
+ if ((_c = message.citations) === null || _c === void 0 ? void 0 : _c.length) {
2542
+ obj.citations = message.citations.map((e) => exports.TabularCitation.toJSON(e));
2543
+ }
2544
+ if (message.totalRowCount !== 0) {
2545
+ obj.totalRowCount = Math.round(message.totalRowCount);
2546
+ }
2547
+ if (message.truncated !== false) {
2548
+ obj.truncated = message.truncated;
2549
+ }
2550
+ return obj;
2551
+ },
2552
+ create(base) {
2553
+ return exports.TabularQueryResult.fromPartial(base !== null && base !== void 0 ? base : {});
2554
+ },
2555
+ fromPartial(object) {
2556
+ var _a, _b, _c;
2557
+ var _d, _e, _f, _g, _h;
2558
+ const message = createBaseTabularQueryResult();
2559
+ message.tableId = (_d = object.tableId) !== null && _d !== void 0 ? _d : "";
2560
+ message.safeTableAlias = (_e = object.safeTableAlias) !== null && _e !== void 0 ? _e : "";
2561
+ message.sql = (_f = object.sql) !== null && _f !== void 0 ? _f : "";
2562
+ message.columns = ((_a = object.columns) === null || _a === void 0 ? void 0 : _a.map((e) => exports.TabularResultColumn.fromPartial(e))) || [];
2563
+ message.rows = ((_b = object.rows) === null || _b === void 0 ? void 0 : _b.map((e) => exports.TabularResultRow.fromPartial(e))) || [];
2564
+ message.citations = ((_c = object.citations) === null || _c === void 0 ? void 0 : _c.map((e) => exports.TabularCitation.fromPartial(e))) || [];
2565
+ message.totalRowCount = (_g = object.totalRowCount) !== null && _g !== void 0 ? _g : 0;
2566
+ message.truncated = (_h = object.truncated) !== null && _h !== void 0 ? _h : false;
2567
+ return message;
2568
+ },
2569
+ };
2570
+ function createBaseTabularQueryTrace() {
2571
+ return { selectedTableIds: [], sql: "", generatedSql: false, maxRows: 0, scannedBytes: 0, durationMs: 0 };
2572
+ }
2573
+ exports.TabularQueryTrace = {
2574
+ encode(message, writer = new wire_1.BinaryWriter()) {
2575
+ for (const v of message.selectedTableIds) {
2576
+ writer.uint32(10).string(v);
2577
+ }
2578
+ if (message.sql !== "") {
2579
+ writer.uint32(18).string(message.sql);
2580
+ }
2581
+ if (message.generatedSql !== false) {
2582
+ writer.uint32(24).bool(message.generatedSql);
2583
+ }
2584
+ if (message.maxRows !== 0) {
2585
+ writer.uint32(32).int32(message.maxRows);
2586
+ }
2587
+ if (message.scannedBytes !== 0) {
2588
+ writer.uint32(40).int64(message.scannedBytes);
2589
+ }
2590
+ if (message.durationMs !== 0) {
2591
+ writer.uint32(48).int64(message.durationMs);
2592
+ }
2593
+ return writer;
2594
+ },
2595
+ decode(input, length) {
2596
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2597
+ const end = length === undefined ? reader.len : reader.pos + length;
2598
+ const message = createBaseTabularQueryTrace();
2599
+ while (reader.pos < end) {
2600
+ const tag = reader.uint32();
2601
+ switch (tag >>> 3) {
2602
+ case 1: {
2603
+ if (tag !== 10) {
2604
+ break;
2605
+ }
2606
+ message.selectedTableIds.push(reader.string());
2607
+ continue;
2608
+ }
2609
+ case 2: {
2610
+ if (tag !== 18) {
2611
+ break;
2612
+ }
2613
+ message.sql = reader.string();
2614
+ continue;
2615
+ }
2616
+ case 3: {
2617
+ if (tag !== 24) {
2618
+ break;
2619
+ }
2620
+ message.generatedSql = reader.bool();
2621
+ continue;
2622
+ }
2623
+ case 4: {
2624
+ if (tag !== 32) {
2625
+ break;
2626
+ }
2627
+ message.maxRows = reader.int32();
2628
+ continue;
2629
+ }
2630
+ case 5: {
2631
+ if (tag !== 40) {
2632
+ break;
2633
+ }
2634
+ message.scannedBytes = longToNumber(reader.int64());
2635
+ continue;
2636
+ }
2637
+ case 6: {
2638
+ if (tag !== 48) {
2639
+ break;
2640
+ }
2641
+ message.durationMs = longToNumber(reader.int64());
2642
+ continue;
2643
+ }
2644
+ }
2645
+ if ((tag & 7) === 4 || tag === 0) {
2646
+ break;
2647
+ }
2648
+ reader.skip(tag & 7);
2649
+ }
2650
+ return message;
2651
+ },
2652
+ fromJSON(object) {
2653
+ return {
2654
+ selectedTableIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.selectedTableIds)
2655
+ ? object.selectedTableIds.map((e) => globalThis.String(e))
2656
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.selected_table_ids)
2657
+ ? object.selected_table_ids.map((e) => globalThis.String(e))
2658
+ : [],
2659
+ sql: isSet(object.sql) ? globalThis.String(object.sql) : "",
2660
+ generatedSql: isSet(object.generatedSql)
2661
+ ? globalThis.Boolean(object.generatedSql)
2662
+ : isSet(object.generated_sql)
2663
+ ? globalThis.Boolean(object.generated_sql)
2664
+ : false,
2665
+ maxRows: isSet(object.maxRows)
2666
+ ? globalThis.Number(object.maxRows)
2667
+ : isSet(object.max_rows)
2668
+ ? globalThis.Number(object.max_rows)
2669
+ : 0,
2670
+ scannedBytes: isSet(object.scannedBytes)
2671
+ ? globalThis.Number(object.scannedBytes)
2672
+ : isSet(object.scanned_bytes)
2673
+ ? globalThis.Number(object.scanned_bytes)
2674
+ : 0,
2675
+ durationMs: isSet(object.durationMs)
2676
+ ? globalThis.Number(object.durationMs)
2677
+ : isSet(object.duration_ms)
2678
+ ? globalThis.Number(object.duration_ms)
2679
+ : 0,
2680
+ };
2681
+ },
2682
+ toJSON(message) {
2683
+ var _a;
2684
+ const obj = {};
2685
+ if ((_a = message.selectedTableIds) === null || _a === void 0 ? void 0 : _a.length) {
2686
+ obj.selectedTableIds = message.selectedTableIds;
2687
+ }
2688
+ if (message.sql !== "") {
2689
+ obj.sql = message.sql;
2690
+ }
2691
+ if (message.generatedSql !== false) {
2692
+ obj.generatedSql = message.generatedSql;
2693
+ }
2694
+ if (message.maxRows !== 0) {
2695
+ obj.maxRows = Math.round(message.maxRows);
2696
+ }
2697
+ if (message.scannedBytes !== 0) {
2698
+ obj.scannedBytes = Math.round(message.scannedBytes);
2699
+ }
2700
+ if (message.durationMs !== 0) {
2701
+ obj.durationMs = Math.round(message.durationMs);
2702
+ }
2703
+ return obj;
2704
+ },
2705
+ create(base) {
2706
+ return exports.TabularQueryTrace.fromPartial(base !== null && base !== void 0 ? base : {});
2707
+ },
2708
+ fromPartial(object) {
2709
+ var _a;
2710
+ var _b, _c, _d, _e, _f;
2711
+ const message = createBaseTabularQueryTrace();
2712
+ message.selectedTableIds = ((_a = object.selectedTableIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
2713
+ message.sql = (_b = object.sql) !== null && _b !== void 0 ? _b : "";
2714
+ message.generatedSql = (_c = object.generatedSql) !== null && _c !== void 0 ? _c : false;
2715
+ message.maxRows = (_d = object.maxRows) !== null && _d !== void 0 ? _d : 0;
2716
+ message.scannedBytes = (_e = object.scannedBytes) !== null && _e !== void 0 ? _e : 0;
2717
+ message.durationMs = (_f = object.durationMs) !== null && _f !== void 0 ? _f : 0;
2718
+ return message;
2719
+ },
2720
+ };
2721
+ function createBaseRetrieveTabularDataRequest() {
2722
+ return { organizationId: "", query: "", sql: "", sessionId: "", constraints: undefined };
2723
+ }
2724
+ exports.RetrieveTabularDataRequest = {
2725
+ encode(message, writer = new wire_1.BinaryWriter()) {
2726
+ if (message.organizationId !== "") {
2727
+ writer.uint32(10).string(message.organizationId);
2728
+ }
2729
+ if (message.query !== "") {
2730
+ writer.uint32(18).string(message.query);
2731
+ }
2732
+ if (message.sql !== "") {
2733
+ writer.uint32(26).string(message.sql);
2734
+ }
2735
+ if (message.sessionId !== "") {
2736
+ writer.uint32(34).string(message.sessionId);
2737
+ }
2738
+ if (message.constraints !== undefined) {
2739
+ exports.TabularRetrievalConstraints.encode(message.constraints, writer.uint32(42).fork()).join();
2740
+ }
2741
+ return writer;
2742
+ },
2743
+ decode(input, length) {
2744
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2745
+ const end = length === undefined ? reader.len : reader.pos + length;
2746
+ const message = createBaseRetrieveTabularDataRequest();
2747
+ while (reader.pos < end) {
2748
+ const tag = reader.uint32();
2749
+ switch (tag >>> 3) {
2750
+ case 1: {
2751
+ if (tag !== 10) {
2752
+ break;
2753
+ }
2754
+ message.organizationId = reader.string();
2755
+ continue;
2756
+ }
2757
+ case 2: {
2758
+ if (tag !== 18) {
2759
+ break;
2760
+ }
2761
+ message.query = reader.string();
2762
+ continue;
2763
+ }
2764
+ case 3: {
2765
+ if (tag !== 26) {
2766
+ break;
2767
+ }
2768
+ message.sql = reader.string();
2769
+ continue;
2770
+ }
2771
+ case 4: {
2772
+ if (tag !== 34) {
2773
+ break;
2774
+ }
2775
+ message.sessionId = reader.string();
2776
+ continue;
2777
+ }
2778
+ case 5: {
2779
+ if (tag !== 42) {
2780
+ break;
2781
+ }
2782
+ message.constraints = exports.TabularRetrievalConstraints.decode(reader, reader.uint32());
2783
+ continue;
2784
+ }
2785
+ }
2786
+ if ((tag & 7) === 4 || tag === 0) {
2787
+ break;
2788
+ }
2789
+ reader.skip(tag & 7);
2790
+ }
2791
+ return message;
2792
+ },
2793
+ fromJSON(object) {
2794
+ return {
2795
+ organizationId: isSet(object.organizationId)
2796
+ ? globalThis.String(object.organizationId)
2797
+ : isSet(object.organization_id)
2798
+ ? globalThis.String(object.organization_id)
2799
+ : "",
2800
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
2801
+ sql: isSet(object.sql) ? globalThis.String(object.sql) : "",
2802
+ sessionId: isSet(object.sessionId)
2803
+ ? globalThis.String(object.sessionId)
2804
+ : isSet(object.session_id)
2805
+ ? globalThis.String(object.session_id)
2806
+ : "",
2807
+ constraints: isSet(object.constraints) ? exports.TabularRetrievalConstraints.fromJSON(object.constraints) : undefined,
2808
+ };
2809
+ },
2810
+ toJSON(message) {
2811
+ const obj = {};
2812
+ if (message.organizationId !== "") {
2813
+ obj.organizationId = message.organizationId;
2814
+ }
2815
+ if (message.query !== "") {
2816
+ obj.query = message.query;
2817
+ }
2818
+ if (message.sql !== "") {
2819
+ obj.sql = message.sql;
2820
+ }
2821
+ if (message.sessionId !== "") {
2822
+ obj.sessionId = message.sessionId;
2823
+ }
2824
+ if (message.constraints !== undefined) {
2825
+ obj.constraints = exports.TabularRetrievalConstraints.toJSON(message.constraints);
2826
+ }
2827
+ return obj;
2828
+ },
2829
+ create(base) {
2830
+ return exports.RetrieveTabularDataRequest.fromPartial(base !== null && base !== void 0 ? base : {});
2831
+ },
2832
+ fromPartial(object) {
2833
+ var _a, _b, _c, _d;
2834
+ const message = createBaseRetrieveTabularDataRequest();
2835
+ message.organizationId = (_a = object.organizationId) !== null && _a !== void 0 ? _a : "";
2836
+ message.query = (_b = object.query) !== null && _b !== void 0 ? _b : "";
2837
+ message.sql = (_c = object.sql) !== null && _c !== void 0 ? _c : "";
2838
+ message.sessionId = (_d = object.sessionId) !== null && _d !== void 0 ? _d : "";
2839
+ message.constraints = (object.constraints !== undefined && object.constraints !== null)
2840
+ ? exports.TabularRetrievalConstraints.fromPartial(object.constraints)
2841
+ : undefined;
2842
+ return message;
2843
+ },
2844
+ };
2845
+ function createBaseRetrieveTabularDataResponse() {
2846
+ return { candidateTables: [], results: [], trace: undefined, warnings: [] };
2847
+ }
2848
+ exports.RetrieveTabularDataResponse = {
2849
+ encode(message, writer = new wire_1.BinaryWriter()) {
2850
+ for (const v of message.candidateTables) {
2851
+ exports.CandidateTable.encode(v, writer.uint32(10).fork()).join();
2852
+ }
2853
+ for (const v of message.results) {
2854
+ exports.TabularQueryResult.encode(v, writer.uint32(18).fork()).join();
2855
+ }
2856
+ if (message.trace !== undefined) {
2857
+ exports.TabularQueryTrace.encode(message.trace, writer.uint32(26).fork()).join();
2858
+ }
2859
+ for (const v of message.warnings) {
2860
+ writer.uint32(34).string(v);
2861
+ }
2862
+ return writer;
2863
+ },
2864
+ decode(input, length) {
2865
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2866
+ const end = length === undefined ? reader.len : reader.pos + length;
2867
+ const message = createBaseRetrieveTabularDataResponse();
2868
+ while (reader.pos < end) {
2869
+ const tag = reader.uint32();
2870
+ switch (tag >>> 3) {
2871
+ case 1: {
2872
+ if (tag !== 10) {
2873
+ break;
2874
+ }
2875
+ message.candidateTables.push(exports.CandidateTable.decode(reader, reader.uint32()));
2876
+ continue;
2877
+ }
2878
+ case 2: {
2879
+ if (tag !== 18) {
2880
+ break;
2881
+ }
2882
+ message.results.push(exports.TabularQueryResult.decode(reader, reader.uint32()));
2883
+ continue;
2884
+ }
2885
+ case 3: {
2886
+ if (tag !== 26) {
2887
+ break;
2888
+ }
2889
+ message.trace = exports.TabularQueryTrace.decode(reader, reader.uint32());
2890
+ continue;
2891
+ }
2892
+ case 4: {
2893
+ if (tag !== 34) {
2894
+ break;
2895
+ }
2896
+ message.warnings.push(reader.string());
2897
+ continue;
2898
+ }
2899
+ }
2900
+ if ((tag & 7) === 4 || tag === 0) {
2901
+ break;
2902
+ }
2903
+ reader.skip(tag & 7);
2904
+ }
2905
+ return message;
2906
+ },
2907
+ fromJSON(object) {
2908
+ return {
2909
+ candidateTables: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.candidateTables)
2910
+ ? object.candidateTables.map((e) => exports.CandidateTable.fromJSON(e))
2911
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.candidate_tables)
2912
+ ? object.candidate_tables.map((e) => exports.CandidateTable.fromJSON(e))
2913
+ : [],
2914
+ results: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.results)
2915
+ ? object.results.map((e) => exports.TabularQueryResult.fromJSON(e))
2916
+ : [],
2917
+ trace: isSet(object.trace) ? exports.TabularQueryTrace.fromJSON(object.trace) : undefined,
2918
+ warnings: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.warnings) ? object.warnings.map((e) => globalThis.String(e)) : [],
2919
+ };
2920
+ },
2921
+ toJSON(message) {
2922
+ var _a, _b, _c;
2923
+ const obj = {};
2924
+ if ((_a = message.candidateTables) === null || _a === void 0 ? void 0 : _a.length) {
2925
+ obj.candidateTables = message.candidateTables.map((e) => exports.CandidateTable.toJSON(e));
2926
+ }
2927
+ if ((_b = message.results) === null || _b === void 0 ? void 0 : _b.length) {
2928
+ obj.results = message.results.map((e) => exports.TabularQueryResult.toJSON(e));
2929
+ }
2930
+ if (message.trace !== undefined) {
2931
+ obj.trace = exports.TabularQueryTrace.toJSON(message.trace);
2932
+ }
2933
+ if ((_c = message.warnings) === null || _c === void 0 ? void 0 : _c.length) {
2934
+ obj.warnings = message.warnings;
2935
+ }
2936
+ return obj;
2937
+ },
2938
+ create(base) {
2939
+ return exports.RetrieveTabularDataResponse.fromPartial(base !== null && base !== void 0 ? base : {});
2940
+ },
2941
+ fromPartial(object) {
2942
+ var _a, _b, _c;
2943
+ const message = createBaseRetrieveTabularDataResponse();
2944
+ message.candidateTables = ((_a = object.candidateTables) === null || _a === void 0 ? void 0 : _a.map((e) => exports.CandidateTable.fromPartial(e))) || [];
2945
+ message.results = ((_b = object.results) === null || _b === void 0 ? void 0 : _b.map((e) => exports.TabularQueryResult.fromPartial(e))) || [];
2946
+ message.trace = (object.trace !== undefined && object.trace !== null)
2947
+ ? exports.TabularQueryTrace.fromPartial(object.trace)
2948
+ : undefined;
2949
+ message.warnings = ((_c = object.warnings) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
2950
+ return message;
2951
+ },
2952
+ };
2953
+ function createBaseRetrieveDataRequest() {
2954
+ return {
2955
+ organizationId: "",
2956
+ operation: 0,
2957
+ query: "",
2958
+ threadIds: [],
2959
+ documentIds: [],
2960
+ tableIds: [],
2961
+ sql: "",
2962
+ maxRows: 0,
2963
+ limit: 0,
2964
+ sessionId: "",
2965
+ retrievalConstraints: undefined,
2966
+ tabularConstraints: undefined,
2967
+ };
2968
+ }
2969
+ exports.RetrieveDataRequest = {
2970
+ encode(message, writer = new wire_1.BinaryWriter()) {
2971
+ if (message.organizationId !== "") {
2972
+ writer.uint32(10).string(message.organizationId);
2973
+ }
2974
+ if (message.operation !== 0) {
2975
+ writer.uint32(16).int32(message.operation);
1168
2976
  }
1169
- if (message.knowledgeType !== "") {
1170
- writer.uint32(26).string(message.knowledgeType);
2977
+ if (message.query !== "") {
2978
+ writer.uint32(26).string(message.query);
1171
2979
  }
1172
- if (message.facetFields !== undefined) {
1173
- struct_pb_1.Struct.encode(struct_pb_1.Struct.wrap(message.facetFields), writer.uint32(34).fork()).join();
2980
+ for (const v of message.threadIds) {
2981
+ writer.uint32(34).string(v);
1174
2982
  }
1175
- if (message.score !== 0) {
1176
- writer.uint32(45).float(message.score);
2983
+ for (const v of message.documentIds) {
2984
+ writer.uint32(42).string(v);
1177
2985
  }
1178
- if (message.classification !== 0) {
1179
- writer.uint32(48).int32(message.classification);
2986
+ for (const v of message.tableIds) {
2987
+ writer.uint32(50).string(v);
1180
2988
  }
1181
- if (message.citation !== undefined) {
1182
- exports.Citation.encode(message.citation, writer.uint32(58).fork()).join();
2989
+ if (message.sql !== "") {
2990
+ writer.uint32(58).string(message.sql);
1183
2991
  }
1184
- if (message.temporalValidity !== undefined) {
1185
- ingestion_pb_1.TemporalValidity.encode(message.temporalValidity, writer.uint32(66).fork()).join();
2992
+ if (message.maxRows !== 0) {
2993
+ writer.uint32(64).int32(message.maxRows);
1186
2994
  }
1187
- for (const v of message.entities) {
1188
- writer.uint32(74).string(v);
2995
+ if (message.limit !== 0) {
2996
+ writer.uint32(72).int32(message.limit);
1189
2997
  }
1190
- if (message.reinforcementCount !== 0) {
1191
- writer.uint32(80).int32(message.reinforcementCount);
2998
+ if (message.sessionId !== "") {
2999
+ writer.uint32(82).string(message.sessionId);
1192
3000
  }
1193
- if (message.sessionTurn !== 0) {
1194
- writer.uint32(88).int32(message.sessionTurn);
3001
+ if (message.retrievalConstraints !== undefined) {
3002
+ exports.RetrievalConstraints.encode(message.retrievalConstraints, writer.uint32(90).fork()).join();
3003
+ }
3004
+ if (message.tabularConstraints !== undefined) {
3005
+ exports.TabularRetrievalConstraints.encode(message.tabularConstraints, writer.uint32(98).fork()).join();
1195
3006
  }
1196
3007
  return writer;
1197
3008
  },
1198
3009
  decode(input, length) {
1199
3010
  const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1200
3011
  const end = length === undefined ? reader.len : reader.pos + length;
1201
- const message = createBaseRetrievedThread();
3012
+ const message = createBaseRetrieveDataRequest();
1202
3013
  while (reader.pos < end) {
1203
3014
  const tag = reader.uint32();
1204
3015
  switch (tag >>> 3) {
@@ -1206,77 +3017,84 @@ exports.RetrievedThread = {
1206
3017
  if (tag !== 10) {
1207
3018
  break;
1208
3019
  }
1209
- message.threadId = reader.string();
3020
+ message.organizationId = reader.string();
1210
3021
  continue;
1211
3022
  }
1212
3023
  case 2: {
1213
- if (tag !== 18) {
3024
+ if (tag !== 16) {
1214
3025
  break;
1215
3026
  }
1216
- message.text = reader.string();
3027
+ message.operation = reader.int32();
1217
3028
  continue;
1218
3029
  }
1219
3030
  case 3: {
1220
3031
  if (tag !== 26) {
1221
3032
  break;
1222
3033
  }
1223
- message.knowledgeType = reader.string();
3034
+ message.query = reader.string();
1224
3035
  continue;
1225
3036
  }
1226
3037
  case 4: {
1227
3038
  if (tag !== 34) {
1228
3039
  break;
1229
3040
  }
1230
- message.facetFields = struct_pb_1.Struct.unwrap(struct_pb_1.Struct.decode(reader, reader.uint32()));
3041
+ message.threadIds.push(reader.string());
1231
3042
  continue;
1232
3043
  }
1233
3044
  case 5: {
1234
- if (tag !== 45) {
3045
+ if (tag !== 42) {
1235
3046
  break;
1236
3047
  }
1237
- message.score = reader.float();
3048
+ message.documentIds.push(reader.string());
1238
3049
  continue;
1239
3050
  }
1240
3051
  case 6: {
1241
- if (tag !== 48) {
3052
+ if (tag !== 50) {
1242
3053
  break;
1243
3054
  }
1244
- message.classification = reader.int32();
3055
+ message.tableIds.push(reader.string());
1245
3056
  continue;
1246
3057
  }
1247
3058
  case 7: {
1248
3059
  if (tag !== 58) {
1249
3060
  break;
1250
3061
  }
1251
- message.citation = exports.Citation.decode(reader, reader.uint32());
3062
+ message.sql = reader.string();
1252
3063
  continue;
1253
3064
  }
1254
3065
  case 8: {
1255
- if (tag !== 66) {
3066
+ if (tag !== 64) {
1256
3067
  break;
1257
3068
  }
1258
- message.temporalValidity = ingestion_pb_1.TemporalValidity.decode(reader, reader.uint32());
3069
+ message.maxRows = reader.int32();
1259
3070
  continue;
1260
3071
  }
1261
3072
  case 9: {
1262
- if (tag !== 74) {
3073
+ if (tag !== 72) {
1263
3074
  break;
1264
3075
  }
1265
- message.entities.push(reader.string());
3076
+ message.limit = reader.int32();
1266
3077
  continue;
1267
3078
  }
1268
3079
  case 10: {
1269
- if (tag !== 80) {
3080
+ if (tag !== 82) {
1270
3081
  break;
1271
3082
  }
1272
- message.reinforcementCount = reader.int32();
3083
+ message.sessionId = reader.string();
1273
3084
  continue;
1274
3085
  }
1275
3086
  case 11: {
1276
- if (tag !== 88) {
3087
+ if (tag !== 90) {
1277
3088
  break;
1278
3089
  }
1279
- message.sessionTurn = reader.int32();
3090
+ message.retrievalConstraints = exports.RetrievalConstraints.decode(reader, reader.uint32());
3091
+ continue;
3092
+ }
3093
+ case 12: {
3094
+ if (tag !== 98) {
3095
+ break;
3096
+ }
3097
+ message.tabularConstraints = exports.TabularRetrievalConstraints.decode(reader, reader.uint32());
1280
3098
  continue;
1281
3099
  }
1282
3100
  }
@@ -1289,105 +3107,260 @@ exports.RetrievedThread = {
1289
3107
  },
1290
3108
  fromJSON(object) {
1291
3109
  return {
1292
- threadId: isSet(object.threadId)
1293
- ? globalThis.String(object.threadId)
1294
- : isSet(object.thread_id)
1295
- ? globalThis.String(object.thread_id)
3110
+ organizationId: isSet(object.organizationId)
3111
+ ? globalThis.String(object.organizationId)
3112
+ : isSet(object.organization_id)
3113
+ ? globalThis.String(object.organization_id)
1296
3114
  : "",
1297
- text: isSet(object.text) ? globalThis.String(object.text) : "",
1298
- knowledgeType: isSet(object.knowledgeType)
1299
- ? globalThis.String(object.knowledgeType)
1300
- : isSet(object.knowledge_type)
1301
- ? globalThis.String(object.knowledge_type)
3115
+ operation: isSet(object.operation) ? retrieveDataOperationFromJSON(object.operation) : 0,
3116
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
3117
+ threadIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.threadIds)
3118
+ ? object.threadIds.map((e) => globalThis.String(e))
3119
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.thread_ids)
3120
+ ? object.thread_ids.map((e) => globalThis.String(e))
3121
+ : [],
3122
+ documentIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.documentIds)
3123
+ ? object.documentIds.map((e) => globalThis.String(e))
3124
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.document_ids)
3125
+ ? object.document_ids.map((e) => globalThis.String(e))
3126
+ : [],
3127
+ tableIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tableIds)
3128
+ ? object.tableIds.map((e) => globalThis.String(e))
3129
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.table_ids)
3130
+ ? object.table_ids.map((e) => globalThis.String(e))
3131
+ : [],
3132
+ sql: isSet(object.sql) ? globalThis.String(object.sql) : "",
3133
+ maxRows: isSet(object.maxRows)
3134
+ ? globalThis.Number(object.maxRows)
3135
+ : isSet(object.max_rows)
3136
+ ? globalThis.Number(object.max_rows)
3137
+ : 0,
3138
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
3139
+ sessionId: isSet(object.sessionId)
3140
+ ? globalThis.String(object.sessionId)
3141
+ : isSet(object.session_id)
3142
+ ? globalThis.String(object.session_id)
1302
3143
  : "",
1303
- facetFields: isObject(object.facetFields)
1304
- ? object.facetFields
1305
- : isObject(object.facet_fields)
1306
- ? object.facet_fields
3144
+ retrievalConstraints: isSet(object.retrievalConstraints)
3145
+ ? exports.RetrievalConstraints.fromJSON(object.retrievalConstraints)
3146
+ : isSet(object.retrieval_constraints)
3147
+ ? exports.RetrievalConstraints.fromJSON(object.retrieval_constraints)
1307
3148
  : undefined,
1308
- score: isSet(object.score) ? globalThis.Number(object.score) : 0,
1309
- classification: isSet(object.classification) ? (0, ingestion_pb_1.threadClassificationFromJSON)(object.classification) : 0,
1310
- citation: isSet(object.citation) ? exports.Citation.fromJSON(object.citation) : undefined,
1311
- temporalValidity: isSet(object.temporalValidity)
1312
- ? ingestion_pb_1.TemporalValidity.fromJSON(object.temporalValidity)
1313
- : isSet(object.temporal_validity)
1314
- ? ingestion_pb_1.TemporalValidity.fromJSON(object.temporal_validity)
3149
+ tabularConstraints: isSet(object.tabularConstraints)
3150
+ ? exports.TabularRetrievalConstraints.fromJSON(object.tabularConstraints)
3151
+ : isSet(object.tabular_constraints)
3152
+ ? exports.TabularRetrievalConstraints.fromJSON(object.tabular_constraints)
1315
3153
  : undefined,
1316
- entities: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.entities)
1317
- ? object.entities.map((e) => globalThis.String(e))
1318
- : [],
1319
- reinforcementCount: isSet(object.reinforcementCount)
1320
- ? globalThis.Number(object.reinforcementCount)
1321
- : isSet(object.reinforcement_count)
1322
- ? globalThis.Number(object.reinforcement_count)
1323
- : 0,
1324
- sessionTurn: isSet(object.sessionTurn)
1325
- ? globalThis.Number(object.sessionTurn)
1326
- : isSet(object.session_turn)
1327
- ? globalThis.Number(object.session_turn)
1328
- : 0,
1329
3154
  };
1330
3155
  },
1331
3156
  toJSON(message) {
1332
- var _a;
3157
+ var _a, _b, _c;
1333
3158
  const obj = {};
1334
- if (message.threadId !== "") {
1335
- obj.threadId = message.threadId;
3159
+ if (message.organizationId !== "") {
3160
+ obj.organizationId = message.organizationId;
1336
3161
  }
1337
- if (message.text !== "") {
1338
- obj.text = message.text;
3162
+ if (message.operation !== 0) {
3163
+ obj.operation = retrieveDataOperationToJSON(message.operation);
1339
3164
  }
1340
- if (message.knowledgeType !== "") {
1341
- obj.knowledgeType = message.knowledgeType;
3165
+ if (message.query !== "") {
3166
+ obj.query = message.query;
1342
3167
  }
1343
- if (message.facetFields !== undefined) {
1344
- obj.facetFields = message.facetFields;
3168
+ if ((_a = message.threadIds) === null || _a === void 0 ? void 0 : _a.length) {
3169
+ obj.threadIds = message.threadIds;
1345
3170
  }
1346
- if (message.score !== 0) {
1347
- obj.score = message.score;
3171
+ if ((_b = message.documentIds) === null || _b === void 0 ? void 0 : _b.length) {
3172
+ obj.documentIds = message.documentIds;
1348
3173
  }
1349
- if (message.classification !== 0) {
1350
- obj.classification = (0, ingestion_pb_1.threadClassificationToJSON)(message.classification);
3174
+ if ((_c = message.tableIds) === null || _c === void 0 ? void 0 : _c.length) {
3175
+ obj.tableIds = message.tableIds;
1351
3176
  }
1352
- if (message.citation !== undefined) {
1353
- obj.citation = exports.Citation.toJSON(message.citation);
3177
+ if (message.sql !== "") {
3178
+ obj.sql = message.sql;
1354
3179
  }
1355
- if (message.temporalValidity !== undefined) {
1356
- obj.temporalValidity = ingestion_pb_1.TemporalValidity.toJSON(message.temporalValidity);
3180
+ if (message.maxRows !== 0) {
3181
+ obj.maxRows = Math.round(message.maxRows);
1357
3182
  }
1358
- if ((_a = message.entities) === null || _a === void 0 ? void 0 : _a.length) {
1359
- obj.entities = message.entities;
3183
+ if (message.limit !== 0) {
3184
+ obj.limit = Math.round(message.limit);
1360
3185
  }
1361
- if (message.reinforcementCount !== 0) {
1362
- obj.reinforcementCount = Math.round(message.reinforcementCount);
3186
+ if (message.sessionId !== "") {
3187
+ obj.sessionId = message.sessionId;
1363
3188
  }
1364
- if (message.sessionTurn !== 0) {
1365
- obj.sessionTurn = Math.round(message.sessionTurn);
3189
+ if (message.retrievalConstraints !== undefined) {
3190
+ obj.retrievalConstraints = exports.RetrievalConstraints.toJSON(message.retrievalConstraints);
3191
+ }
3192
+ if (message.tabularConstraints !== undefined) {
3193
+ obj.tabularConstraints = exports.TabularRetrievalConstraints.toJSON(message.tabularConstraints);
1366
3194
  }
1367
3195
  return obj;
1368
3196
  },
1369
3197
  create(base) {
1370
- return exports.RetrievedThread.fromPartial(base !== null && base !== void 0 ? base : {});
3198
+ return exports.RetrieveDataRequest.fromPartial(base !== null && base !== void 0 ? base : {});
1371
3199
  },
1372
3200
  fromPartial(object) {
1373
- var _a;
1374
- var _b, _c, _d, _e, _f, _g, _h, _j;
1375
- const message = createBaseRetrievedThread();
1376
- message.threadId = (_b = object.threadId) !== null && _b !== void 0 ? _b : "";
1377
- message.text = (_c = object.text) !== null && _c !== void 0 ? _c : "";
1378
- message.knowledgeType = (_d = object.knowledgeType) !== null && _d !== void 0 ? _d : "";
1379
- message.facetFields = (_e = object.facetFields) !== null && _e !== void 0 ? _e : undefined;
1380
- message.score = (_f = object.score) !== null && _f !== void 0 ? _f : 0;
1381
- message.classification = (_g = object.classification) !== null && _g !== void 0 ? _g : 0;
1382
- message.citation = (object.citation !== undefined && object.citation !== null)
1383
- ? exports.Citation.fromPartial(object.citation)
3201
+ var _a, _b, _c;
3202
+ var _d, _e, _f, _g, _h, _j, _k;
3203
+ const message = createBaseRetrieveDataRequest();
3204
+ message.organizationId = (_d = object.organizationId) !== null && _d !== void 0 ? _d : "";
3205
+ message.operation = (_e = object.operation) !== null && _e !== void 0 ? _e : 0;
3206
+ message.query = (_f = object.query) !== null && _f !== void 0 ? _f : "";
3207
+ message.threadIds = ((_a = object.threadIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
3208
+ message.documentIds = ((_b = object.documentIds) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
3209
+ message.tableIds = ((_c = object.tableIds) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
3210
+ message.sql = (_g = object.sql) !== null && _g !== void 0 ? _g : "";
3211
+ message.maxRows = (_h = object.maxRows) !== null && _h !== void 0 ? _h : 0;
3212
+ message.limit = (_j = object.limit) !== null && _j !== void 0 ? _j : 0;
3213
+ message.sessionId = (_k = object.sessionId) !== null && _k !== void 0 ? _k : "";
3214
+ message.retrievalConstraints = (object.retrievalConstraints !== undefined && object.retrievalConstraints !== null)
3215
+ ? exports.RetrievalConstraints.fromPartial(object.retrievalConstraints)
1384
3216
  : undefined;
1385
- message.temporalValidity = (object.temporalValidity !== undefined && object.temporalValidity !== null)
1386
- ? ingestion_pb_1.TemporalValidity.fromPartial(object.temporalValidity)
3217
+ message.tabularConstraints = (object.tabularConstraints !== undefined && object.tabularConstraints !== null)
3218
+ ? exports.TabularRetrievalConstraints.fromPartial(object.tabularConstraints)
1387
3219
  : undefined;
1388
- message.entities = ((_a = object.entities) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
1389
- message.reinforcementCount = (_h = object.reinforcementCount) !== null && _h !== void 0 ? _h : 0;
1390
- message.sessionTurn = (_j = object.sessionTurn) !== null && _j !== void 0 ? _j : 0;
3220
+ return message;
3221
+ },
3222
+ };
3223
+ function createBaseRetrieveDataResponse() {
3224
+ return { threads: [], plan: undefined, candidateTables: [], tabularResults: [], trace: undefined, warnings: [] };
3225
+ }
3226
+ exports.RetrieveDataResponse = {
3227
+ encode(message, writer = new wire_1.BinaryWriter()) {
3228
+ for (const v of message.threads) {
3229
+ exports.RetrievedThread.encode(v, writer.uint32(10).fork()).join();
3230
+ }
3231
+ if (message.plan !== undefined) {
3232
+ exports.RetrievalPlan.encode(message.plan, writer.uint32(18).fork()).join();
3233
+ }
3234
+ for (const v of message.candidateTables) {
3235
+ exports.CandidateTable.encode(v, writer.uint32(26).fork()).join();
3236
+ }
3237
+ for (const v of message.tabularResults) {
3238
+ exports.TabularQueryResult.encode(v, writer.uint32(34).fork()).join();
3239
+ }
3240
+ if (message.trace !== undefined) {
3241
+ exports.TabularQueryTrace.encode(message.trace, writer.uint32(42).fork()).join();
3242
+ }
3243
+ for (const v of message.warnings) {
3244
+ writer.uint32(50).string(v);
3245
+ }
3246
+ return writer;
3247
+ },
3248
+ decode(input, length) {
3249
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
3250
+ const end = length === undefined ? reader.len : reader.pos + length;
3251
+ const message = createBaseRetrieveDataResponse();
3252
+ while (reader.pos < end) {
3253
+ const tag = reader.uint32();
3254
+ switch (tag >>> 3) {
3255
+ case 1: {
3256
+ if (tag !== 10) {
3257
+ break;
3258
+ }
3259
+ message.threads.push(exports.RetrievedThread.decode(reader, reader.uint32()));
3260
+ continue;
3261
+ }
3262
+ case 2: {
3263
+ if (tag !== 18) {
3264
+ break;
3265
+ }
3266
+ message.plan = exports.RetrievalPlan.decode(reader, reader.uint32());
3267
+ continue;
3268
+ }
3269
+ case 3: {
3270
+ if (tag !== 26) {
3271
+ break;
3272
+ }
3273
+ message.candidateTables.push(exports.CandidateTable.decode(reader, reader.uint32()));
3274
+ continue;
3275
+ }
3276
+ case 4: {
3277
+ if (tag !== 34) {
3278
+ break;
3279
+ }
3280
+ message.tabularResults.push(exports.TabularQueryResult.decode(reader, reader.uint32()));
3281
+ continue;
3282
+ }
3283
+ case 5: {
3284
+ if (tag !== 42) {
3285
+ break;
3286
+ }
3287
+ message.trace = exports.TabularQueryTrace.decode(reader, reader.uint32());
3288
+ continue;
3289
+ }
3290
+ case 6: {
3291
+ if (tag !== 50) {
3292
+ break;
3293
+ }
3294
+ message.warnings.push(reader.string());
3295
+ continue;
3296
+ }
3297
+ }
3298
+ if ((tag & 7) === 4 || tag === 0) {
3299
+ break;
3300
+ }
3301
+ reader.skip(tag & 7);
3302
+ }
3303
+ return message;
3304
+ },
3305
+ fromJSON(object) {
3306
+ return {
3307
+ threads: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.threads)
3308
+ ? object.threads.map((e) => exports.RetrievedThread.fromJSON(e))
3309
+ : [],
3310
+ plan: isSet(object.plan) ? exports.RetrievalPlan.fromJSON(object.plan) : undefined,
3311
+ candidateTables: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.candidateTables)
3312
+ ? object.candidateTables.map((e) => exports.CandidateTable.fromJSON(e))
3313
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.candidate_tables)
3314
+ ? object.candidate_tables.map((e) => exports.CandidateTable.fromJSON(e))
3315
+ : [],
3316
+ tabularResults: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tabularResults)
3317
+ ? object.tabularResults.map((e) => exports.TabularQueryResult.fromJSON(e))
3318
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tabular_results)
3319
+ ? object.tabular_results.map((e) => exports.TabularQueryResult.fromJSON(e))
3320
+ : [],
3321
+ trace: isSet(object.trace) ? exports.TabularQueryTrace.fromJSON(object.trace) : undefined,
3322
+ warnings: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.warnings) ? object.warnings.map((e) => globalThis.String(e)) : [],
3323
+ };
3324
+ },
3325
+ toJSON(message) {
3326
+ var _a, _b, _c, _d;
3327
+ const obj = {};
3328
+ if ((_a = message.threads) === null || _a === void 0 ? void 0 : _a.length) {
3329
+ obj.threads = message.threads.map((e) => exports.RetrievedThread.toJSON(e));
3330
+ }
3331
+ if (message.plan !== undefined) {
3332
+ obj.plan = exports.RetrievalPlan.toJSON(message.plan);
3333
+ }
3334
+ if ((_b = message.candidateTables) === null || _b === void 0 ? void 0 : _b.length) {
3335
+ obj.candidateTables = message.candidateTables.map((e) => exports.CandidateTable.toJSON(e));
3336
+ }
3337
+ if ((_c = message.tabularResults) === null || _c === void 0 ? void 0 : _c.length) {
3338
+ obj.tabularResults = message.tabularResults.map((e) => exports.TabularQueryResult.toJSON(e));
3339
+ }
3340
+ if (message.trace !== undefined) {
3341
+ obj.trace = exports.TabularQueryTrace.toJSON(message.trace);
3342
+ }
3343
+ if ((_d = message.warnings) === null || _d === void 0 ? void 0 : _d.length) {
3344
+ obj.warnings = message.warnings;
3345
+ }
3346
+ return obj;
3347
+ },
3348
+ create(base) {
3349
+ return exports.RetrieveDataResponse.fromPartial(base !== null && base !== void 0 ? base : {});
3350
+ },
3351
+ fromPartial(object) {
3352
+ var _a, _b, _c, _d;
3353
+ const message = createBaseRetrieveDataResponse();
3354
+ message.threads = ((_a = object.threads) === null || _a === void 0 ? void 0 : _a.map((e) => exports.RetrievedThread.fromPartial(e))) || [];
3355
+ message.plan = (object.plan !== undefined && object.plan !== null)
3356
+ ? exports.RetrievalPlan.fromPartial(object.plan)
3357
+ : undefined;
3358
+ message.candidateTables = ((_b = object.candidateTables) === null || _b === void 0 ? void 0 : _b.map((e) => exports.CandidateTable.fromPartial(e))) || [];
3359
+ message.tabularResults = ((_c = object.tabularResults) === null || _c === void 0 ? void 0 : _c.map((e) => exports.TabularQueryResult.fromPartial(e))) || [];
3360
+ message.trace = (object.trace !== undefined && object.trace !== null)
3361
+ ? exports.TabularQueryTrace.fromPartial(object.trace)
3362
+ : undefined;
3363
+ message.warnings = ((_d = object.warnings) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
1391
3364
  return message;
1392
3365
  },
1393
3366
  };
@@ -2631,6 +4604,16 @@ function fromJsonTimestamp(o) {
2631
4604
  return fromTimestamp(timestamp_pb_1.Timestamp.fromJSON(o));
2632
4605
  }
2633
4606
  }
4607
+ function longToNumber(int64) {
4608
+ const num = globalThis.Number(int64.toString());
4609
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
4610
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
4611
+ }
4612
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
4613
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
4614
+ }
4615
+ return num;
4616
+ }
2634
4617
  function isObject(value) {
2635
4618
  return typeof value === "object" && value !== null;
2636
4619
  }