@squidcloud/client 1.0.123 → 1.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +167 -42
- package/dist/common/src/ai-assistant.types.d.ts +5 -2
- package/dist/common/src/integrations/ai_assistant.types.d.ts +2 -2
- package/dist/common/src/integrations/database.types.d.ts +17 -0
- package/dist/common/src/integrations/index.d.ts +5 -2
- package/dist/common/src/query/pagination.d.ts +20 -2
- package/dist/common/src/query/query-context.d.ts +1 -1
- package/dist/typescript-client/src/ai-assistant-client.d.ts +8 -7
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -26388,7 +26388,7 @@ const AiAssistantMutateRequestSchema = {
|
|
|
26388
26388
|
properties: {
|
|
26389
26389
|
modelName: {
|
|
26390
26390
|
type: 'string',
|
|
26391
|
-
enum: ['gpt-3.5-turbo', 'gpt-4'],
|
|
26391
|
+
enum: ['gpt-3.5-turbo', 'gpt-4', 'claude-2'],
|
|
26392
26392
|
},
|
|
26393
26393
|
strictContext: {
|
|
26394
26394
|
type: 'boolean',
|
|
@@ -26442,7 +26442,7 @@ const AiAssistantMutateRequestSchema = {
|
|
|
26442
26442
|
properties: {
|
|
26443
26443
|
modelName: {
|
|
26444
26444
|
type: 'string',
|
|
26445
|
-
enum: ['gpt-3.5-turbo', 'gpt-4'],
|
|
26445
|
+
enum: ['gpt-3.5-turbo', 'gpt-4', 'claude-2'],
|
|
26446
26446
|
},
|
|
26447
26447
|
strictContext: {
|
|
26448
26448
|
type: 'boolean',
|
|
@@ -26531,13 +26531,16 @@ const AiAssistantMutateRequestSchema = {
|
|
|
26531
26531
|
|
|
26532
26532
|
;// CONCATENATED MODULE: ../common/src/ai-assistant.types.ts
|
|
26533
26533
|
/** @internal */
|
|
26534
|
-
const
|
|
26534
|
+
const AiModelData = {
|
|
26535
26535
|
'gpt-4': {
|
|
26536
26536
|
tokens: 8192,
|
|
26537
26537
|
},
|
|
26538
26538
|
'gpt-3.5-turbo': {
|
|
26539
26539
|
tokens: 4096,
|
|
26540
26540
|
},
|
|
26541
|
+
'claude-2': {
|
|
26542
|
+
tokens: 100000,
|
|
26543
|
+
},
|
|
26541
26544
|
};
|
|
26542
26545
|
|
|
26543
26546
|
;// CONCATENATED MODULE: ../common/src/integrations/observability.types.ts
|
|
@@ -26613,6 +26616,7 @@ var IntegrationType;
|
|
|
26613
26616
|
IntegrationType["db2"] = "db2";
|
|
26614
26617
|
IntegrationType["mariadb"] = "mariadb";
|
|
26615
26618
|
IntegrationType["oracledb"] = "oracledb";
|
|
26619
|
+
IntegrationType["pinot"] = "pinot";
|
|
26616
26620
|
IntegrationType["redis"] = "redis";
|
|
26617
26621
|
IntegrationType["xata"] = "xata";
|
|
26618
26622
|
IntegrationType["azure_sql"] = "azure_sql";
|
|
@@ -26634,6 +26638,7 @@ const DatabaseIntegrationTypes = [
|
|
|
26634
26638
|
IntegrationType.cockroach,
|
|
26635
26639
|
IntegrationType.snowflake,
|
|
26636
26640
|
IntegrationType.oracledb,
|
|
26641
|
+
IntegrationType.pinot,
|
|
26637
26642
|
];
|
|
26638
26643
|
const ApiIntegrationTypes = [IntegrationType.api, IntegrationType.graphql];
|
|
26639
26644
|
const ObservabilityIntegrationTypes = [IntegrationType.datadog, IntegrationType.newrelic];
|
|
@@ -26713,6 +26718,25 @@ const OracleConnectionOptionsSchema = {
|
|
|
26713
26718
|
connectionLimit: { type: 'number', nullable: false },
|
|
26714
26719
|
},
|
|
26715
26720
|
};
|
|
26721
|
+
const PinotConnectionOptionsSchema = {
|
|
26722
|
+
type: 'object',
|
|
26723
|
+
nullable: false,
|
|
26724
|
+
required: ['brokerUrl', 'controllerUrl'],
|
|
26725
|
+
properties: {
|
|
26726
|
+
brokerUrl: { type: 'string', nullable: false },
|
|
26727
|
+
controllerUrl: { type: 'string', nullable: false },
|
|
26728
|
+
user: { type: 'string', nullable: false },
|
|
26729
|
+
secrets: {
|
|
26730
|
+
type: 'object',
|
|
26731
|
+
required: ['password'],
|
|
26732
|
+
nullable: false,
|
|
26733
|
+
properties: {
|
|
26734
|
+
password: { type: 'string', nullable: false, isSecret: {} },
|
|
26735
|
+
},
|
|
26736
|
+
},
|
|
26737
|
+
connectionLimit: { type: 'number', nullable: false },
|
|
26738
|
+
},
|
|
26739
|
+
};
|
|
26716
26740
|
const MssqlConnectionOptionsSchema = {
|
|
26717
26741
|
type: 'object',
|
|
26718
26742
|
nullable: false,
|
|
@@ -26940,6 +26964,27 @@ const UpsertIntegrationRequestSchema = {
|
|
|
26940
26964
|
},
|
|
26941
26965
|
},
|
|
26942
26966
|
},
|
|
26967
|
+
{
|
|
26968
|
+
type: 'object',
|
|
26969
|
+
properties: {
|
|
26970
|
+
type: { const: IntegrationType.pinot },
|
|
26971
|
+
config: {
|
|
26972
|
+
type: 'object',
|
|
26973
|
+
required: ['configuration'],
|
|
26974
|
+
properties: {
|
|
26975
|
+
supportsExternalChanges: { type: 'boolean', nullable: true },
|
|
26976
|
+
configuration: {
|
|
26977
|
+
type: 'object',
|
|
26978
|
+
nullable: false,
|
|
26979
|
+
required: ['connectionOptions'],
|
|
26980
|
+
properties: {
|
|
26981
|
+
connectionOptions: PinotConnectionOptionsSchema,
|
|
26982
|
+
},
|
|
26983
|
+
},
|
|
26984
|
+
},
|
|
26985
|
+
},
|
|
26986
|
+
},
|
|
26987
|
+
},
|
|
26943
26988
|
{
|
|
26944
26989
|
type: 'object',
|
|
26945
26990
|
properties: {
|
|
@@ -27327,6 +27372,20 @@ const TestDataConnectionRequestSchema = {
|
|
|
27327
27372
|
},
|
|
27328
27373
|
},
|
|
27329
27374
|
},
|
|
27375
|
+
{
|
|
27376
|
+
type: 'object',
|
|
27377
|
+
required: ['configuration'],
|
|
27378
|
+
properties: {
|
|
27379
|
+
type: { const: IntegrationType.pinot },
|
|
27380
|
+
configuration: {
|
|
27381
|
+
type: 'object',
|
|
27382
|
+
required: ['connectionOptions'],
|
|
27383
|
+
properties: {
|
|
27384
|
+
connectionOptions: PinotConnectionOptionsSchema,
|
|
27385
|
+
},
|
|
27386
|
+
},
|
|
27387
|
+
},
|
|
27388
|
+
},
|
|
27330
27389
|
{
|
|
27331
27390
|
type: 'object',
|
|
27332
27391
|
required: ['configuration'],
|
|
@@ -27434,6 +27493,14 @@ const DiscoverDataConnectionSchemaRequestSchema = {
|
|
|
27434
27493
|
connectionOptions: OracleConnectionOptionsSchema,
|
|
27435
27494
|
},
|
|
27436
27495
|
},
|
|
27496
|
+
{
|
|
27497
|
+
type: 'object',
|
|
27498
|
+
required: ['connectionOptions'],
|
|
27499
|
+
properties: {
|
|
27500
|
+
integrationType: { const: IntegrationType.pinot },
|
|
27501
|
+
connectionOptions: PinotConnectionOptionsSchema,
|
|
27502
|
+
},
|
|
27503
|
+
},
|
|
27437
27504
|
{
|
|
27438
27505
|
type: 'object',
|
|
27439
27506
|
required: ['connectionOptions'],
|
|
@@ -27907,6 +27974,7 @@ function isStringMatch(str, pattern, caseSensitive) {
|
|
|
27907
27974
|
str = str.toLowerCase();
|
|
27908
27975
|
pattern = pattern.toLowerCase();
|
|
27909
27976
|
}
|
|
27977
|
+
str = str.replace(/\n/g, ' ');
|
|
27910
27978
|
// Escape special regex characters in the pattern
|
|
27911
27979
|
const escapedPattern = pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
27912
27980
|
// Replace '%' wildcard with regex equivalent
|
|
@@ -28705,10 +28773,16 @@ class Pagination {
|
|
|
28705
28773
|
*/
|
|
28706
28774
|
this.internalStateObserver = new external_rxjs_namespaceObject.BehaviorSubject(null);
|
|
28707
28775
|
this.firstElement = null;
|
|
28708
|
-
this.lastElement = null;
|
|
28709
28776
|
this.isDestroyed = new external_rxjs_namespaceObject.BehaviorSubject(false);
|
|
28710
28777
|
this.snapshotSubject = new external_rxjs_namespaceObject.Subject();
|
|
28711
28778
|
this.onFirstPage = true;
|
|
28779
|
+
/* Used during reverse navigation:
|
|
28780
|
+
- When navigating to the last page, we set navigatingToLastPage to true and run a reverse query starting at the end of the query.
|
|
28781
|
+
- When navigating to a previous page, we set lastElement to the last element that should be on that page.
|
|
28782
|
+
In both situations, the variables are reset during the next call to dataReceived.
|
|
28783
|
+
*/
|
|
28784
|
+
this.navigatingToLastPage = false;
|
|
28785
|
+
this.lastElement = null;
|
|
28712
28786
|
this.snapshotSubject.pipe((0,external_rxjs_namespaceObject.switchAll)()).subscribe((data) => this.dataReceived(data));
|
|
28713
28787
|
this.templateSnapshotEmitter = snapshotEmitter.clone();
|
|
28714
28788
|
this.options = Object.assign({ pageSize: 100, subscribe: true }, options);
|
|
@@ -28751,8 +28825,8 @@ class Pagination {
|
|
|
28751
28825
|
return 0;
|
|
28752
28826
|
}
|
|
28753
28827
|
async dataReceived(data) {
|
|
28754
|
-
// Because documents might be deleted by the time we need them (if we are not subscribed), we save the extracted
|
|
28755
|
-
// This is the only place we're allowed to call extractData.
|
|
28828
|
+
// Because documents might be deleted by the time we need them (if we are not subscribed), we save the extracted
|
|
28829
|
+
// data here. This is the only place we're allowed to call extractData.
|
|
28756
28830
|
const extractedData = data.map((s) => this.templateSnapshotEmitter.extractData(s));
|
|
28757
28831
|
if (data.length === 0) {
|
|
28758
28832
|
if (this.onFirstPage) {
|
|
@@ -28763,12 +28837,19 @@ class Pagination {
|
|
|
28763
28837
|
}
|
|
28764
28838
|
return;
|
|
28765
28839
|
}
|
|
28766
|
-
if (this.firstElement === null
|
|
28767
|
-
|
|
28768
|
-
|
|
28769
|
-
|
|
28770
|
-
|
|
28771
|
-
|
|
28840
|
+
if (this.firstElement === null) {
|
|
28841
|
+
if (this.lastElement !== null) {
|
|
28842
|
+
// We just executed a `prev` and we know what the last element is on the page but not the first.
|
|
28843
|
+
// We need to find the first element on the page instead, because that's our anchor.
|
|
28844
|
+
const numAfter = extractedData.filter((s) => this.compare(s, this.lastElement) === 1).length;
|
|
28845
|
+
this.firstElement = extractedData[data.length - numAfter - this.options.pageSize];
|
|
28846
|
+
this.lastElement = null;
|
|
28847
|
+
}
|
|
28848
|
+
else if (this.navigatingToLastPage) {
|
|
28849
|
+
// We just executed a `last`.
|
|
28850
|
+
this.firstElement = extractedData[data.length - this.options.pageSize];
|
|
28851
|
+
this.navigatingToLastPage = false;
|
|
28852
|
+
}
|
|
28772
28853
|
}
|
|
28773
28854
|
const numBefore = extractedData.filter((s) => this.compare(s, this.firstElement) === -1).length;
|
|
28774
28855
|
const numAfter = Math.max(0, data.length - numBefore - this.options.pageSize);
|
|
@@ -28785,27 +28866,29 @@ class Pagination {
|
|
|
28785
28866
|
const newSnapshotEmitter = this.templateSnapshotEmitter
|
|
28786
28867
|
.clone()
|
|
28787
28868
|
.limit(this.options.pageSize * 3)
|
|
28788
|
-
.flipSortOrder()
|
|
28789
|
-
|
|
28790
|
-
|
|
28791
|
-
|
|
28792
|
-
|
|
28793
|
-
|
|
28794
|
-
|
|
28795
|
-
|
|
28869
|
+
.flipSortOrder();
|
|
28870
|
+
if (startingDoc) {
|
|
28871
|
+
newSnapshotEmitter.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((sortOrder) => {
|
|
28872
|
+
return {
|
|
28873
|
+
fieldName: sortOrder.fieldName,
|
|
28874
|
+
operator: sortOrder.asc ? '<=' : '>=',
|
|
28875
|
+
value: getInPath(startingDoc, sortOrder.fieldName),
|
|
28876
|
+
};
|
|
28877
|
+
}));
|
|
28878
|
+
}
|
|
28796
28879
|
this.snapshotSubject.next(newSnapshotEmitter.snapshots(this.options.subscribe).pipe((0,external_rxjs_namespaceObject.map)((s) => s.reverse())));
|
|
28797
28880
|
}
|
|
28798
28881
|
else {
|
|
28799
|
-
const newSnapshotEmitter = this.templateSnapshotEmitter
|
|
28800
|
-
|
|
28801
|
-
.
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
|
|
28807
|
-
};
|
|
28808
|
-
}
|
|
28882
|
+
const newSnapshotEmitter = this.templateSnapshotEmitter.clone().limit(this.options.pageSize * 3);
|
|
28883
|
+
if (startingDoc) {
|
|
28884
|
+
newSnapshotEmitter.addCompositeCondition(this.templateSnapshotEmitter.getSortOrders().map((sortOrder) => {
|
|
28885
|
+
return {
|
|
28886
|
+
fieldName: sortOrder.fieldName,
|
|
28887
|
+
operator: sortOrder.asc ? '>=' : '<=',
|
|
28888
|
+
value: getInPath(startingDoc, sortOrder.fieldName),
|
|
28889
|
+
};
|
|
28890
|
+
}));
|
|
28891
|
+
}
|
|
28809
28892
|
this.snapshotSubject.next(newSnapshotEmitter.snapshots(this.options.subscribe));
|
|
28810
28893
|
}
|
|
28811
28894
|
}
|
|
@@ -28815,9 +28898,9 @@ class Pagination {
|
|
|
28815
28898
|
return internalState;
|
|
28816
28899
|
}
|
|
28817
28900
|
return await (0,external_rxjs_namespaceObject.firstValueFrom)((0,external_rxjs_namespaceObject.race)(
|
|
28818
|
-
// It is possible that we get here and unsubscribe() was called. In that case we might not get any new state,
|
|
28819
|
-
// stalling we return an empty page in that situation. (We can't return the last page we saw
|
|
28820
|
-
// been deleted, and also because it's possible that we've never seen any data.)
|
|
28901
|
+
// It is possible that we get here and unsubscribe() was called. In that case we might not get any new state,
|
|
28902
|
+
// so to avoid stalling we return an empty page in that situation. (We can't return the last page we saw
|
|
28903
|
+
// because that has already been deleted, and also because it's possible that we've never seen any data.)
|
|
28821
28904
|
this.isDestroyed.pipe((0,external_rxjs_namespaceObject.filter)(Boolean), (0,external_rxjs_namespaceObject.map)((_) => ({
|
|
28822
28905
|
data: [],
|
|
28823
28906
|
extractedData: [],
|
|
@@ -28835,6 +28918,7 @@ class Pagination {
|
|
|
28835
28918
|
hasPrev: numBefore > 0,
|
|
28836
28919
|
};
|
|
28837
28920
|
}
|
|
28921
|
+
/** Unsubscribes from the pagination. */
|
|
28838
28922
|
unsubscribe() {
|
|
28839
28923
|
this.isDestroyed.next(true);
|
|
28840
28924
|
this.isDestroyed.complete();
|
|
@@ -28848,10 +28932,12 @@ class Pagination {
|
|
|
28848
28932
|
this.internalStateObserver.next(null);
|
|
28849
28933
|
this.doNewQuery(extractedData[extractedData.length - numAfter - 1], true);
|
|
28850
28934
|
}
|
|
28935
|
+
/** Returns a promise that resolves when the previous page of data is available. */
|
|
28851
28936
|
async prev() {
|
|
28852
28937
|
this.prevInternal(await this.waitForInternalState());
|
|
28853
28938
|
return await this.waitForData();
|
|
28854
28939
|
}
|
|
28940
|
+
/** Returns a promise that resolves when the next page of data is available. */
|
|
28855
28941
|
async next() {
|
|
28856
28942
|
const { numBefore, extractedData } = await this.waitForInternalState();
|
|
28857
28943
|
this.firstElement = extractedData[numBefore + this.options.pageSize];
|
|
@@ -28859,14 +28945,51 @@ class Pagination {
|
|
|
28859
28945
|
this.doNewQuery(extractedData[numBefore], false);
|
|
28860
28946
|
return await this.waitForData();
|
|
28861
28947
|
}
|
|
28948
|
+
/** Returns a promise that resolves when the page data is available. */
|
|
28862
28949
|
async waitForData() {
|
|
28863
28950
|
return this.internalStateToState(await this.waitForInternalState());
|
|
28864
28951
|
}
|
|
28952
|
+
/** Returns an observable that emits the current state of the pagination. */
|
|
28865
28953
|
observeState() {
|
|
28866
28954
|
return this.internalStateObserver.pipe((0,external_rxjs_namespaceObject.filter)((state) => state !== null), (0,external_rxjs_namespaceObject.map)((state) => {
|
|
28867
28955
|
return this.internalStateToState(state);
|
|
28868
28956
|
}));
|
|
28869
28957
|
}
|
|
28958
|
+
/** Jumps to the first page of the pagination. */
|
|
28959
|
+
async first() {
|
|
28960
|
+
await this.waitForInternalState();
|
|
28961
|
+
this.internalStateObserver.next(null);
|
|
28962
|
+
this.firstElement = null;
|
|
28963
|
+
this.lastElement = null;
|
|
28964
|
+
this.goToFirstPage();
|
|
28965
|
+
return await this.waitForData();
|
|
28966
|
+
}
|
|
28967
|
+
/** Refreshes the current page of the pagination. */
|
|
28968
|
+
async refreshPage() {
|
|
28969
|
+
const { extractedData } = await this.waitForInternalState();
|
|
28970
|
+
this.internalStateObserver.next(null);
|
|
28971
|
+
this.doNewQuery(extractedData[0], false);
|
|
28972
|
+
return await this.waitForData();
|
|
28973
|
+
}
|
|
28974
|
+
/**
|
|
28975
|
+
* Jumps to the last page of the pagination. This page will always have the last <pageSize> elements of the
|
|
28976
|
+
* underlying query, regardless of whether the total document count is evenly divisible by the page size.
|
|
28977
|
+
*/
|
|
28978
|
+
async last() {
|
|
28979
|
+
await this.waitForInternalState();
|
|
28980
|
+
this.internalStateObserver.next(null);
|
|
28981
|
+
this.firstElement = null;
|
|
28982
|
+
this.lastElement = null;
|
|
28983
|
+
this.navigatingToLastPage = true;
|
|
28984
|
+
const lastPageSnapshot = this.templateSnapshotEmitter
|
|
28985
|
+
.clone()
|
|
28986
|
+
.limit(this.options.pageSize * 3)
|
|
28987
|
+
.flipSortOrder()
|
|
28988
|
+
.snapshots(this.options.subscribe)
|
|
28989
|
+
.pipe((0,external_rxjs_namespaceObject.map)((s) => s.reverse()));
|
|
28990
|
+
this.snapshotSubject.next(lastPageSnapshot);
|
|
28991
|
+
return await this.waitForData();
|
|
28992
|
+
}
|
|
28870
28993
|
}
|
|
28871
28994
|
|
|
28872
28995
|
;// CONCATENATED MODULE: ../common/src/query/index.ts
|
|
@@ -32226,13 +32349,12 @@ class AiAssistantClient {
|
|
|
32226
32349
|
this.rpcManager = rpcManager;
|
|
32227
32350
|
this.socketManager = socketManager;
|
|
32228
32351
|
this.integrationId = integrationId;
|
|
32229
|
-
this.ongoingChatRequests = {};
|
|
32230
32352
|
this.ongoingChatSequences = {};
|
|
32231
32353
|
this.socketManager
|
|
32232
32354
|
.observeNotifications()
|
|
32233
32355
|
.pipe((0,external_rxjs_namespaceObject.filter)((notification) => notification.type === 'aiAssistant'), map_map((n) => n))
|
|
32234
32356
|
.subscribe((notification) => {
|
|
32235
|
-
this.handleChatResponse(notification);
|
|
32357
|
+
this.handleChatResponse(notification).then();
|
|
32236
32358
|
});
|
|
32237
32359
|
}
|
|
32238
32360
|
/**
|
|
@@ -32255,14 +32377,15 @@ class AiAssistantClient {
|
|
|
32255
32377
|
*
|
|
32256
32378
|
* @param profileId - The profile id.
|
|
32257
32379
|
* @param prompt - The prompt.
|
|
32380
|
+
* @param options - The options to send to the chat model.
|
|
32258
32381
|
* @returns An observable that emits when a new response token is received. The emitted value is the entire response
|
|
32259
32382
|
* that has been received so far.
|
|
32260
32383
|
*/
|
|
32261
|
-
chat(profileId, prompt) {
|
|
32384
|
+
chat(profileId, prompt, options) {
|
|
32262
32385
|
const clientRequestId = generateId();
|
|
32263
|
-
|
|
32386
|
+
let accumulatedValue = '';
|
|
32387
|
+
const subject = new external_rxjs_namespaceObject.Subject();
|
|
32264
32388
|
const tokenSequence = new external_rxjs_namespaceObject.Subject();
|
|
32265
|
-
this.ongoingChatRequests[clientRequestId] = subject;
|
|
32266
32389
|
this.ongoingChatSequences[clientRequestId] = tokenSequence;
|
|
32267
32390
|
tokenSequence
|
|
32268
32391
|
.pipe((0,external_rxjs_namespaceObject.concatMap)(({ value, complete }) => {
|
|
@@ -32273,7 +32396,8 @@ class AiAssistantClient {
|
|
|
32273
32396
|
}), (0,external_rxjs_namespaceObject.takeWhile)(({ complete }) => !complete, true))
|
|
32274
32397
|
.subscribe({
|
|
32275
32398
|
next: ({ value }) => {
|
|
32276
|
-
|
|
32399
|
+
accumulatedValue += value;
|
|
32400
|
+
subject.next(accumulatedValue);
|
|
32277
32401
|
},
|
|
32278
32402
|
error: (e) => {
|
|
32279
32403
|
console.error(e);
|
|
@@ -32285,6 +32409,7 @@ class AiAssistantClient {
|
|
|
32285
32409
|
const request = {
|
|
32286
32410
|
profileId,
|
|
32287
32411
|
prompt,
|
|
32412
|
+
options,
|
|
32288
32413
|
integrationId: this.integrationId,
|
|
32289
32414
|
clientRequestId,
|
|
32290
32415
|
};
|
|
@@ -32293,7 +32418,6 @@ class AiAssistantClient {
|
|
|
32293
32418
|
subject.complete();
|
|
32294
32419
|
});
|
|
32295
32420
|
return subject.pipe((0,external_rxjs_namespaceObject.finalize)(() => {
|
|
32296
|
-
delete this.ongoingChatRequests[clientRequestId];
|
|
32297
32421
|
delete this.ongoingChatSequences[clientRequestId];
|
|
32298
32422
|
}), (0,external_rxjs_namespaceObject.share)());
|
|
32299
32423
|
}
|
|
@@ -32355,7 +32479,7 @@ class AiAssistantProfileReference {
|
|
|
32355
32479
|
* Adds a new profile to the assistant. This will result in an error if a profile already exists with the same id.
|
|
32356
32480
|
*
|
|
32357
32481
|
* @param data An object containing options for creating the profile.
|
|
32358
|
-
* @param data.modelName - The name of the OpenAI model (`gpt-3.5
|
|
32482
|
+
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
|
|
32359
32483
|
* @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
|
|
32360
32484
|
* @returns A promise that resolves when the profile is successfully created.
|
|
32361
32485
|
*/
|
|
@@ -32380,7 +32504,7 @@ class AiAssistantProfileReference {
|
|
|
32380
32504
|
* current profile id.
|
|
32381
32505
|
*
|
|
32382
32506
|
* @param data An object containing options for updating the profile.
|
|
32383
|
-
* @param data.modelName - The name of the OpenAI model (`gpt-3.5
|
|
32507
|
+
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
|
|
32384
32508
|
* @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
|
|
32385
32509
|
* @returns A promise that resolves when the profile is successfully updated.
|
|
32386
32510
|
*/
|
|
@@ -32430,6 +32554,7 @@ class AiAssistantContextReference {
|
|
|
32430
32554
|
* @param data An object containing options for creating the entry.
|
|
32431
32555
|
* @param data.title - The title of the entry.
|
|
32432
32556
|
* @param data.context - The context data.
|
|
32557
|
+
* @param file - The file to insert.
|
|
32433
32558
|
* @returns A promise that resolves when the context is successfully created.
|
|
32434
32559
|
*/
|
|
32435
32560
|
insert(data, file) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** The supported
|
|
2
|
-
export type
|
|
1
|
+
/** The supported AI model names. */
|
|
2
|
+
export type AiModelName = 'gpt-3.5-turbo' | 'gpt-4' | 'claude-2';
|
|
3
3
|
export type AiAssistantContextType = 'text' | 'url' | 'file';
|
|
4
4
|
export interface AiAssistantTextContext {
|
|
5
5
|
type: 'text';
|
|
@@ -14,3 +14,6 @@ export interface AiAssistantFileContext {
|
|
|
14
14
|
data: string;
|
|
15
15
|
}
|
|
16
16
|
export type AiAssistantContext = AiAssistantTextContext | AiAssistantUrlContext | AiAssistantFileContext;
|
|
17
|
+
export interface AiAssistantChatOptions {
|
|
18
|
+
maxTokens?: number;
|
|
19
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AiModelName } from '../ai-assistant.types';
|
|
2
2
|
import { IntegrationId } from '../communication.types';
|
|
3
3
|
import { BaseIntegrationConfig, IntegrationType } from './index';
|
|
4
4
|
export interface AiAssistantIntegrationConfig extends BaseIntegrationConfig {
|
|
@@ -9,7 +9,7 @@ export type AiAssistantConfiguration = {
|
|
|
9
9
|
apiKey?: string;
|
|
10
10
|
};
|
|
11
11
|
export type AiAssistantProfileMetadata = {
|
|
12
|
-
modelName:
|
|
12
|
+
modelName: AiModelName;
|
|
13
13
|
isPublic: boolean;
|
|
14
14
|
strictContext: boolean;
|
|
15
15
|
instructions: Record<string, string>;
|
|
@@ -26,6 +26,9 @@ export interface MySqlConnectionSecretOptions {
|
|
|
26
26
|
export interface OracleConnectionSecretOptions {
|
|
27
27
|
password: string;
|
|
28
28
|
}
|
|
29
|
+
export interface PinotConnectionSecretOptions {
|
|
30
|
+
password?: string;
|
|
31
|
+
}
|
|
29
32
|
export interface MssqlConnectionSecretOptions {
|
|
30
33
|
password: string;
|
|
31
34
|
}
|
|
@@ -48,6 +51,13 @@ export interface OracleConnectionOptions {
|
|
|
48
51
|
database: string;
|
|
49
52
|
connectionLimit?: number;
|
|
50
53
|
}
|
|
54
|
+
export interface PinotConnectionOptions {
|
|
55
|
+
secrets: PinotConnectionSecretOptions;
|
|
56
|
+
brokerUrl: string;
|
|
57
|
+
controllerUrl: string;
|
|
58
|
+
user?: string;
|
|
59
|
+
connectionLimit?: number;
|
|
60
|
+
}
|
|
51
61
|
export interface MssqlConnectionOptions {
|
|
52
62
|
secrets: MssqlConnectionSecretOptions;
|
|
53
63
|
host: string;
|
|
@@ -92,6 +102,9 @@ export interface MySqlIntegrationConfiguration {
|
|
|
92
102
|
export interface OracleIntegrationConfiguration {
|
|
93
103
|
connectionOptions: OracleConnectionOptions;
|
|
94
104
|
}
|
|
105
|
+
export interface PinotIntegrationConfiguration {
|
|
106
|
+
connectionOptions: PinotConnectionOptions;
|
|
107
|
+
}
|
|
95
108
|
export interface MssqlIntegrationConfiguration {
|
|
96
109
|
connectionOptions: MssqlConnectionOptions;
|
|
97
110
|
}
|
|
@@ -112,6 +125,10 @@ export interface OracleIntegrationConfig extends BaseDatabaseIntegrationConfig {
|
|
|
112
125
|
type: IntegrationType.oracledb;
|
|
113
126
|
configuration: OracleIntegrationConfiguration;
|
|
114
127
|
}
|
|
128
|
+
export interface PinotIntegrationConfig extends BaseDatabaseIntegrationConfig {
|
|
129
|
+
type: IntegrationType.pinot;
|
|
130
|
+
configuration: PinotIntegrationConfiguration;
|
|
131
|
+
}
|
|
115
132
|
export interface MssqlIntegrationConfig extends BaseDatabaseIntegrationConfig {
|
|
116
133
|
type: IntegrationType.mssql;
|
|
117
134
|
configuration: MssqlIntegrationConfiguration;
|
|
@@ -7,7 +7,7 @@ import { IntegrationId } from '../communication.types';
|
|
|
7
7
|
import { AiAssistantIntegrationConfig } from './ai_assistant.types';
|
|
8
8
|
import { GraphQLIntegrationConfig, HttpApiIntegrationConfig, IntegrationApiSchema, IntegrationGraphQLSchema, TestGraphQLDataConnectionRequest } from './api.types';
|
|
9
9
|
import { Auth0IntegrationConfig, CognitoIntegrationConfig, JwtHmacIntegrationConfig, JwtRsaIntegrationConfig, OktaIntegrationConfig } from './auth.types';
|
|
10
|
-
import { BaseDatabaseIntegrationConfig, CockroachIntegrationConfig, IntegrationDataSchema, InternalIntegrationConfig, MongoIntegrationConfig, MssqlIntegrationConfig, MySqlIntegrationConfig, OracleIntegrationConfig, PostgresIntegrationConfig, SnowflakeIntegrationConfig, TestDataConnectionRequest } from './database.types';
|
|
10
|
+
import { BaseDatabaseIntegrationConfig, CockroachIntegrationConfig, IntegrationDataSchema, InternalIntegrationConfig, MongoIntegrationConfig, MssqlIntegrationConfig, MySqlIntegrationConfig, OracleIntegrationConfig, PinotIntegrationConfig, PostgresIntegrationConfig, SnowflakeIntegrationConfig, TestDataConnectionRequest } from './database.types';
|
|
11
11
|
import { DatadogIntegrationConfig, NewRelicIntegrationConfig } from './observability.types';
|
|
12
12
|
export declare enum IntegrationCategory {
|
|
13
13
|
'database' = "database",
|
|
@@ -51,6 +51,7 @@ export declare enum IntegrationType {
|
|
|
51
51
|
'db2' = "db2",
|
|
52
52
|
'mariadb' = "mariadb",
|
|
53
53
|
'oracledb' = "oracledb",
|
|
54
|
+
'pinot' = "pinot",
|
|
54
55
|
'redis' = "redis",
|
|
55
56
|
'xata' = "xata",
|
|
56
57
|
'azure_sql' = "azure_sql",
|
|
@@ -67,6 +68,7 @@ export interface IntegrationConfigTypes {
|
|
|
67
68
|
[IntegrationType.mongo]: MongoIntegrationConfig;
|
|
68
69
|
[IntegrationType.mysql]: MySqlIntegrationConfig;
|
|
69
70
|
[IntegrationType.oracledb]: OracleIntegrationConfig;
|
|
71
|
+
[IntegrationType.pinot]: PinotIntegrationConfig;
|
|
70
72
|
[IntegrationType.mssql]: MssqlIntegrationConfig;
|
|
71
73
|
[IntegrationType.postgres]: PostgresIntegrationConfig;
|
|
72
74
|
[IntegrationType.cockroach]: CockroachIntegrationConfig;
|
|
@@ -87,6 +89,7 @@ export interface IntegrationSchemaTypes {
|
|
|
87
89
|
[IntegrationType.mongo]: IntegrationDataSchema;
|
|
88
90
|
[IntegrationType.mysql]: IntegrationDataSchema;
|
|
89
91
|
[IntegrationType.oracledb]: IntegrationDataSchema;
|
|
92
|
+
[IntegrationType.pinot]: IntegrationDataSchema;
|
|
90
93
|
[IntegrationType.mssql]: IntegrationDataSchema;
|
|
91
94
|
[IntegrationType.postgres]: IntegrationDataSchema;
|
|
92
95
|
[IntegrationType.cockroach]: IntegrationDataSchema;
|
|
@@ -98,7 +101,7 @@ export type IntegrationTypeWithConfig = keyof IntegrationConfigTypes;
|
|
|
98
101
|
export type IntegrationSchemaKeys = keyof IntegrationSchemaTypes;
|
|
99
102
|
export type IntegrationConfig = IntegrationConfigTypes[IntegrationTypeWithConfig];
|
|
100
103
|
export type IntegrationSchema = IntegrationSchemaTypes[IntegrationSchemaKeys];
|
|
101
|
-
export declare const DatabaseIntegrationTypes: readonly [IntegrationType.built_in_db, IntegrationType.mongo, IntegrationType.mysql, IntegrationType.mssql, IntegrationType.postgres, IntegrationType.cockroach, IntegrationType.snowflake, IntegrationType.oracledb];
|
|
104
|
+
export declare const DatabaseIntegrationTypes: readonly [IntegrationType.built_in_db, IntegrationType.mongo, IntegrationType.mysql, IntegrationType.mssql, IntegrationType.postgres, IntegrationType.cockroach, IntegrationType.snowflake, IntegrationType.oracledb, IntegrationType.pinot];
|
|
102
105
|
export type DatabaseIntegrationType = (typeof DatabaseIntegrationTypes)[number];
|
|
103
106
|
export type DatabaseIntegrationConfig = IntegrationConfigTypes[DatabaseIntegrationType];
|
|
104
107
|
export declare const ApiIntegrationTypes: readonly [IntegrationType.api, IntegrationType.graphql];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
/** The state of a pagination. */
|
|
3
3
|
export interface PaginationState<ReturnType> {
|
|
4
|
+
/** The page data. */
|
|
4
5
|
data: Array<ReturnType>;
|
|
6
|
+
/** Whether there is a next page. */
|
|
5
7
|
hasNext: boolean;
|
|
8
|
+
/** Whether there is a previous page. */
|
|
6
9
|
hasPrev: boolean;
|
|
7
10
|
}
|
|
8
11
|
/** Pagination options */
|
|
@@ -22,23 +25,38 @@ export declare class Pagination<ReturnType> {
|
|
|
22
25
|
private readonly options;
|
|
23
26
|
private internalStateObserver;
|
|
24
27
|
private firstElement;
|
|
25
|
-
private lastElement;
|
|
26
28
|
private readonly isDestroyed;
|
|
27
29
|
private templateSnapshotEmitter;
|
|
28
30
|
private snapshotSubject;
|
|
29
31
|
private onFirstPage;
|
|
32
|
+
private navigatingToLastPage;
|
|
33
|
+
private lastElement;
|
|
30
34
|
private goToFirstPage;
|
|
31
35
|
private static compareValues;
|
|
32
36
|
private compare;
|
|
33
|
-
dataReceived
|
|
37
|
+
private dataReceived;
|
|
34
38
|
private doNewQuery;
|
|
35
39
|
private waitForInternalState;
|
|
36
40
|
private internalStateToState;
|
|
41
|
+
/** Unsubscribes from the pagination. */
|
|
37
42
|
unsubscribe(): void;
|
|
38
43
|
prevInternal(internalState: InternalState<ReturnType>): void;
|
|
44
|
+
/** Returns a promise that resolves when the previous page of data is available. */
|
|
39
45
|
prev(): Promise<PaginationState<ReturnType>>;
|
|
46
|
+
/** Returns a promise that resolves when the next page of data is available. */
|
|
40
47
|
next(): Promise<PaginationState<ReturnType>>;
|
|
48
|
+
/** Returns a promise that resolves when the page data is available. */
|
|
41
49
|
waitForData(): Promise<PaginationState<ReturnType>>;
|
|
50
|
+
/** Returns an observable that emits the current state of the pagination. */
|
|
42
51
|
observeState(): Observable<PaginationState<ReturnType>>;
|
|
52
|
+
/** Jumps to the first page of the pagination. */
|
|
53
|
+
first(): Promise<PaginationState<ReturnType>>;
|
|
54
|
+
/** Refreshes the current page of the pagination. */
|
|
55
|
+
refreshPage(): Promise<PaginationState<ReturnType>>;
|
|
56
|
+
/**
|
|
57
|
+
* Jumps to the last page of the pagination. This page will always have the last <pageSize> elements of the
|
|
58
|
+
* underlying query, regardless of whether the total document count is evenly divisible by the page size.
|
|
59
|
+
*/
|
|
60
|
+
last(): Promise<PaginationState<ReturnType>>;
|
|
43
61
|
}
|
|
44
62
|
export {};
|
|
@@ -108,7 +108,7 @@ export declare class QueryContext<T extends DocumentData = any> {
|
|
|
108
108
|
private parseConditions;
|
|
109
109
|
}
|
|
110
110
|
/** A list of context conditions */
|
|
111
|
-
type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
|
|
111
|
+
export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
|
|
112
112
|
/** A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. */
|
|
113
113
|
type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
114
114
|
interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiAssistantContext, IntegrationId,
|
|
1
|
+
import { AiAssistantContext, IntegrationId, AiModelName, AiAssistantChatOptions } from '@squidcloud/common';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RpcManager } from './rpc.manager';
|
|
4
4
|
import { SocketManager } from './socket.manager';
|
|
@@ -6,7 +6,6 @@ export declare class AiAssistantClient {
|
|
|
6
6
|
private readonly rpcManager;
|
|
7
7
|
private readonly socketManager;
|
|
8
8
|
private readonly integrationId;
|
|
9
|
-
private readonly ongoingChatRequests;
|
|
10
9
|
private readonly ongoingChatSequences;
|
|
11
10
|
constructor(rpcManager: RpcManager, socketManager: SocketManager, integrationId: IntegrationId);
|
|
12
11
|
/**
|
|
@@ -23,10 +22,11 @@ export declare class AiAssistantClient {
|
|
|
23
22
|
*
|
|
24
23
|
* @param profileId - The profile id.
|
|
25
24
|
* @param prompt - The prompt.
|
|
25
|
+
* @param options - The options to send to the chat model.
|
|
26
26
|
* @returns An observable that emits when a new response token is received. The emitted value is the entire response
|
|
27
27
|
* that has been received so far.
|
|
28
28
|
*/
|
|
29
|
-
chat(profileId: string, prompt: string): Observable<string>;
|
|
29
|
+
chat(profileId: string, prompt: string, options?: AiAssistantChatOptions): Observable<string>;
|
|
30
30
|
private handleChatResponse;
|
|
31
31
|
}
|
|
32
32
|
declare class AiAssistantProfileReference {
|
|
@@ -64,12 +64,12 @@ declare class AiAssistantProfileReference {
|
|
|
64
64
|
* Adds a new profile to the assistant. This will result in an error if a profile already exists with the same id.
|
|
65
65
|
*
|
|
66
66
|
* @param data An object containing options for creating the profile.
|
|
67
|
-
* @param data.modelName - The name of the OpenAI model (`gpt-3.5
|
|
67
|
+
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
|
|
68
68
|
* @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
|
|
69
69
|
* @returns A promise that resolves when the profile is successfully created.
|
|
70
70
|
*/
|
|
71
71
|
insert(data: {
|
|
72
|
-
modelName:
|
|
72
|
+
modelName: AiModelName;
|
|
73
73
|
isPublic: boolean;
|
|
74
74
|
}): Promise<void>;
|
|
75
75
|
/**
|
|
@@ -77,12 +77,12 @@ declare class AiAssistantProfileReference {
|
|
|
77
77
|
* current profile id.
|
|
78
78
|
*
|
|
79
79
|
* @param data An object containing options for updating the profile.
|
|
80
|
-
* @param data.modelName - The name of the OpenAI model (`gpt-3.5
|
|
80
|
+
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-2`).
|
|
81
81
|
* @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
|
|
82
82
|
* @returns A promise that resolves when the profile is successfully updated.
|
|
83
83
|
*/
|
|
84
84
|
update(data: {
|
|
85
|
-
modelName?:
|
|
85
|
+
modelName?: AiModelName;
|
|
86
86
|
isPublic?: boolean;
|
|
87
87
|
}): Promise<void>;
|
|
88
88
|
/**
|
|
@@ -106,6 +106,7 @@ declare class AiAssistantContextReference {
|
|
|
106
106
|
* @param data An object containing options for creating the entry.
|
|
107
107
|
* @param data.title - The title of the entry.
|
|
108
108
|
* @param data.context - The context data.
|
|
109
|
+
* @param file - The file to insert.
|
|
109
110
|
* @returns A promise that resolves when the context is successfully created.
|
|
110
111
|
*/
|
|
111
112
|
insert(data: {
|