@nuclia/core
Advanced tools
Comparing version 1.11.2 to 1.11.3
@@ -0,1 +1,11 @@ | ||
# 1.11.3 (2024-02-01) | ||
### Improvements | ||
- Support Knowledge Box notification endpoint | ||
- Add support for new `/processing-status` endpoint in `kb.ts`, add `@deprecated` mark to `getProcessingStatus` method from `db.ts`. | ||
- Support endpoints for retrieving and deleting existing invitations to a kb | ||
- Support security fields in `Resource` | ||
- Support RAG strategies options in `/chat` endpoint | ||
# 1.11.2 (2024-01-25) | ||
@@ -2,0 +12,0 @@ |
import { Observable } from 'rxjs'; | ||
import type { AccountUsersPayload, FullAccountUser, IDb, INuclia, InviteAccountUserPayload } from '../models'; | ||
import { AccountModification, KbIndex, LearningConfigurations, PredictedToken } from './db.models'; | ||
import { Account, AccountCreation, AccountStatus, NUAClient, NUAClientPayload, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, ProcessingStatusResponse, StatsPeriod, StatsRange, StatsType, Welcome } from './db.models'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, KbIndex, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, ProcessingStatusResponse, StatsPeriod, StatsRange, StatsType, Welcome } from './db.models'; | ||
import type { EventList, IKnowledgeBoxItem, KnowledgeBoxCreation } from './kb'; | ||
@@ -130,2 +129,6 @@ import { IStandaloneKb, WritableKnowledgeBox } from './kb'; | ||
pull(): Observable<ProcessingPullResponse>; | ||
/** | ||
* @deprecated replaced by processingStatus method of kb | ||
* @param accountId | ||
*/ | ||
getProcessingStatus(accountId?: string): Observable<ProcessingStatusResponse>; | ||
@@ -132,0 +135,0 @@ getProcessingStats(range?: StatsRange, accountId?: string): Observable<ProcessingStat[]>; |
@@ -223,3 +223,4 @@ export type AccountTypes = 'stash-trial' | 'v3starter' | 'v3fly' | 'v3growth' | 'v3enterprise' | 'stash-basic' | 'stash-team' | 'stash-startup' | 'stash-starter' | 'stash-growth' | 'stash-enterprise' | 'stash-developer' | 'stash-business'; | ||
ERRORS = "errors", | ||
EXTRA = "extra" | ||
EXTRA = "extra", | ||
SECURITY = "security" | ||
} | ||
@@ -226,0 +227,0 @@ export interface KbIndex { |
import { Observable } from 'rxjs'; | ||
import type { ActivityDownloadList, Counters, Entities, EntitiesGroup, EventList, EventType, IKnowledgeBox, IKnowledgeBoxCreation, InviteKbData, IWritableKnowledgeBox, KbUserPayload, LabelSet, LabelSets, ResourceList, SentenceToken, ServiceAccount, ServiceAccountCreation, Synonyms, UpdateEntitiesGroupPayload } from './kb.models'; | ||
import { FullKbUser } from './kb.models'; | ||
import { ActivityDownloadList, Counters, Entities, EntitiesGroup, EventList, EventType, FullKbUser, IKnowledgeBox, IKnowledgeBoxCreation, InviteKbData, IWritableKnowledgeBox, KbInvite, KbUserPayload, LabelSet, LabelSets, ProcessingStatus, ResourceList, SentenceToken, ServiceAccount, ServiceAccountCreation, Synonyms, UpdateEntitiesGroupPayload } from './kb.models'; | ||
import type { IErrorResponse, INuclia } from '../../models'; | ||
import type { ICreateResource, IResource, LinkField, Origin, UserMetadata } from '../resource'; | ||
import { ExtractedDataTypes, Resource } from '../resource'; | ||
import { ExtractedDataTypes, ICreateResource, IResource, LinkField, Origin, Resource, UserMetadata } from '../resource'; | ||
import type { UploadResponse } from '../upload'; | ||
import { FileMetadata, FileWithMetadata, UploadStatus } from '../upload'; | ||
import type { Chat, ChatOptions } from '../search'; | ||
import { Search, SearchOptions } from '../search'; | ||
import { Chat, ChatOptions, Search, SearchOptions } from '../search'; | ||
import { Training } from '../training'; | ||
import { ResourceProperties } from '../db.models'; | ||
import { NotificationMessage } from '../notifications'; | ||
export interface KnowledgeBox extends IKnowledgeBox { | ||
@@ -24,2 +22,5 @@ } | ||
private tempToken?; | ||
private notifications?; | ||
private notificationsController?; | ||
private resourceStatus; | ||
/** | ||
@@ -239,2 +240,22 @@ * The Knowledge Box path on the regional API. | ||
getUsers(accountSlug: string): Observable<FullKbUser[]>; | ||
getInvites(): Observable<KbInvite[]>; | ||
/** | ||
* Start listening to all the notifications sent by the Knowledge Box. | ||
*/ | ||
listenToAllNotifications(): Observable<NotificationMessage[]>; | ||
/** | ||
* Stop listening the notifications sent by the Knowledge Box. | ||
*/ | ||
stopListeningToNotifications(): void; | ||
/** | ||
* Start listening to the Knowledge Box notifications, and returns the list of resource’s id which processed finished. | ||
*/ | ||
listenToProcessingNotifications(): Observable<{ | ||
resourceId: string; | ||
success: boolean; | ||
}[]>; | ||
processingStatus(cursor?: string, scheduled?: boolean, limit?: number): Observable<{ | ||
cursor: string; | ||
results: ProcessingStatus[]; | ||
}>; | ||
} | ||
@@ -383,2 +404,3 @@ /** Extends `KnowledgeBox` with all the write operations. */ | ||
inviteToKb(data: InviteKbData): Observable<void>; | ||
deleteInvite(email: string): Observable<void>; | ||
} |
@@ -7,2 +7,3 @@ import type { Observable } from 'rxjs'; | ||
import type { ResourceProperties } from '../db.models'; | ||
import { NotificationMessage } from '../notifications'; | ||
export type KBStates = 'PUBLISHED' | 'PRIVATE'; | ||
@@ -61,2 +62,7 @@ export type KBRoles = 'SOWNER' | 'SCONTRIBUTOR' | 'SMEMBER'; | ||
} | ||
export interface KbInvite { | ||
email: string; | ||
role: KBRoles; | ||
expires: string; | ||
} | ||
export interface IKnowledgeBox extends IKnowledgeBoxCreation { | ||
@@ -96,2 +102,12 @@ get path(): string; | ||
getUsers(accountSlug: string): Observable<FullKbUser[]>; | ||
listenToAllNotifications(): Observable<NotificationMessage[]>; | ||
listenToProcessingNotifications(): Observable<{ | ||
resourceId: string; | ||
success: boolean; | ||
}[]>; | ||
stopListeningToNotifications(): void; | ||
processingStatus(cursor?: string, scheduled?: boolean, limit?: number): Observable<{ | ||
cursor: string; | ||
results: ProcessingStatus[]; | ||
}>; | ||
} | ||
@@ -211,2 +227,7 @@ export interface IWritableKnowledgeBox extends IKnowledgeBox { | ||
} | ||
export type RAGStrategyName = 'field_extension' | 'full_resource'; | ||
export type RAGStrategy = { | ||
name: RAGStrategyName; | ||
fields?: string[]; | ||
}; | ||
export interface Counters { | ||
@@ -265,1 +286,16 @@ resources: number; | ||
} | ||
export interface ProcessingStatus { | ||
completed: boolean; | ||
completed_at?: string | null; | ||
failed: boolean; | ||
kbid: string; | ||
processing_id: string; | ||
resource_id: string; | ||
retries: number; | ||
schedule_eta: number; | ||
schedule_order: number; | ||
scheduled: boolean; | ||
scheduled_at: string; | ||
timestamp: string; | ||
title: string; | ||
} |
@@ -13,2 +13,3 @@ export interface IResource { | ||
origin?: Origin; | ||
security?: Security; | ||
created?: string; | ||
@@ -75,3 +76,4 @@ modified?: string; | ||
PROCESSED = "PROCESSED", | ||
ERROR = "ERROR" | ||
ERROR = "ERROR", | ||
DELETED = "DELETED" | ||
} | ||
@@ -118,2 +120,5 @@ export interface Metadata { | ||
} | ||
export interface Security { | ||
access_groups: string[]; | ||
} | ||
export interface IError { | ||
@@ -120,0 +125,0 @@ body: string; |
import type { ExtractedDataTypes, FIELD_TYPE, FieldId, IFieldData, IResource, RelationEntityType, RelationType } from '../resource'; | ||
import type { ResourceProperties } from '../db.models'; | ||
import { RAGStrategy } from '../kb'; | ||
export type ResourceStatus = 'PENDING' | 'PROCESSED' | 'ERROR'; | ||
@@ -38,2 +39,3 @@ export type SortOrder = 'asc' | 'desc'; | ||
citations?: boolean; | ||
rag_strategies?: RAGStrategy[]; | ||
} | ||
@@ -40,0 +42,0 @@ export interface SearchOptions extends BaseSearchOptions { |
@@ -65,3 +65,3 @@ import type { Observable } from 'rxjs'; | ||
getObjectURL(path: string): Observable<string>; | ||
getStream(path: string, body: any): Observable<{ | ||
getStreamedResponse(path: string, body: any): Observable<{ | ||
data: Uint8Array; | ||
@@ -71,2 +71,6 @@ incomplete: boolean; | ||
}>; | ||
getStreamMessages(path: string, controller: AbortController): Observable<{ | ||
data: Uint8Array; | ||
headers: Headers; | ||
}>; | ||
} | ||
@@ -73,0 +77,0 @@ export interface IDb { |
@@ -60,3 +60,9 @@ import { Observable } from 'rxjs'; | ||
getObjectURL(path: string): Observable<string>; | ||
getStream(path: string, body: unknown): Observable<{ | ||
/** | ||
* Call an endpoint streaming its response by batch of data, | ||
* concatenate the data with the batch received previously until the response is marked as completed and then close the connection. | ||
* @param path | ||
* @param body body to be passed as parameter to the POST request made | ||
*/ | ||
getStreamedResponse(path: string, body: unknown): Observable<{ | ||
data: Uint8Array; | ||
@@ -66,3 +72,16 @@ incomplete: boolean; | ||
}>; | ||
/** | ||
* Call a long polling HTTP endpoint streaming its response until the connection times out. | ||
* This method is keeping the connection alive by calling the endpoint again when it times out until the provided controller receives an abort signal | ||
* (or if the endpoint returns an error unrelated to the timeout). | ||
* | ||
* @param path | ||
* @param controller | ||
*/ | ||
getStreamMessages(path: string, controller: AbortController): Observable<{ | ||
data: Uint8Array; | ||
headers: Headers; | ||
}>; | ||
private fetchStream; | ||
private concat; | ||
} |
{ | ||
"name": "@nuclia/core", | ||
"version": "1.11.2", | ||
"version": "1.11.3", | ||
"description": "SDK allowing to integrate Nuclia services in your frontend application", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
import { Observable } from 'rxjs'; | ||
import type { AccountUsersPayload, FullAccountUser, IDb, INuclia, InviteAccountUserPayload } from '../models'; | ||
import { AccountModification, KbIndex, LearningConfigurations, PredictedToken } from './db.models'; | ||
import { Account, AccountCreation, AccountStatus, NUAClient, NUAClientPayload, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, ProcessingStatusResponse, StatsPeriod, StatsRange, StatsType, Welcome } from './db.models'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, KbIndex, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, ProcessingStatusResponse, StatsPeriod, StatsRange, StatsType, Welcome } from './db.models'; | ||
import type { EventList, IKnowledgeBoxItem, KnowledgeBoxCreation } from './kb'; | ||
@@ -130,2 +129,6 @@ import { IStandaloneKb, WritableKnowledgeBox } from './kb'; | ||
pull(): Observable<ProcessingPullResponse>; | ||
/** | ||
* @deprecated replaced by processingStatus method of kb | ||
* @param accountId | ||
*/ | ||
getProcessingStatus(accountId?: string): Observable<ProcessingStatusResponse>; | ||
@@ -132,0 +135,0 @@ getProcessingStats(range?: StatsRange, accountId?: string): Observable<ProcessingStat[]>; |
@@ -223,3 +223,4 @@ export type AccountTypes = 'stash-trial' | 'v3starter' | 'v3fly' | 'v3growth' | 'v3enterprise' | 'stash-basic' | 'stash-team' | 'stash-startup' | 'stash-starter' | 'stash-growth' | 'stash-enterprise' | 'stash-developer' | 'stash-business'; | ||
ERRORS = "errors", | ||
EXTRA = "extra" | ||
EXTRA = "extra", | ||
SECURITY = "security" | ||
} | ||
@@ -226,0 +227,0 @@ export interface KbIndex { |
import { Observable } from 'rxjs'; | ||
import type { ActivityDownloadList, Counters, Entities, EntitiesGroup, EventList, EventType, IKnowledgeBox, IKnowledgeBoxCreation, InviteKbData, IWritableKnowledgeBox, KbUserPayload, LabelSet, LabelSets, ResourceList, SentenceToken, ServiceAccount, ServiceAccountCreation, Synonyms, UpdateEntitiesGroupPayload } from './kb.models'; | ||
import { FullKbUser } from './kb.models'; | ||
import { ActivityDownloadList, Counters, Entities, EntitiesGroup, EventList, EventType, FullKbUser, IKnowledgeBox, IKnowledgeBoxCreation, InviteKbData, IWritableKnowledgeBox, KbInvite, KbUserPayload, LabelSet, LabelSets, ProcessingStatus, ResourceList, SentenceToken, ServiceAccount, ServiceAccountCreation, Synonyms, UpdateEntitiesGroupPayload } from './kb.models'; | ||
import type { IErrorResponse, INuclia } from '../../models'; | ||
import type { ICreateResource, IResource, LinkField, Origin, UserMetadata } from '../resource'; | ||
import { ExtractedDataTypes, Resource } from '../resource'; | ||
import { ExtractedDataTypes, ICreateResource, IResource, LinkField, Origin, Resource, UserMetadata } from '../resource'; | ||
import type { UploadResponse } from '../upload'; | ||
import { FileMetadata, FileWithMetadata, UploadStatus } from '../upload'; | ||
import type { Chat, ChatOptions } from '../search'; | ||
import { Search, SearchOptions } from '../search'; | ||
import { Chat, ChatOptions, Search, SearchOptions } from '../search'; | ||
import { Training } from '../training'; | ||
import { ResourceProperties } from '../db.models'; | ||
import { NotificationMessage } from '../notifications'; | ||
export interface KnowledgeBox extends IKnowledgeBox { | ||
@@ -24,2 +22,5 @@ } | ||
private tempToken?; | ||
private notifications?; | ||
private notificationsController?; | ||
private resourceStatus; | ||
/** | ||
@@ -239,2 +240,22 @@ * The Knowledge Box path on the regional API. | ||
getUsers(accountSlug: string): Observable<FullKbUser[]>; | ||
getInvites(): Observable<KbInvite[]>; | ||
/** | ||
* Start listening to all the notifications sent by the Knowledge Box. | ||
*/ | ||
listenToAllNotifications(): Observable<NotificationMessage[]>; | ||
/** | ||
* Stop listening the notifications sent by the Knowledge Box. | ||
*/ | ||
stopListeningToNotifications(): void; | ||
/** | ||
* Start listening to the Knowledge Box notifications, and returns the list of resource’s id which processed finished. | ||
*/ | ||
listenToProcessingNotifications(): Observable<{ | ||
resourceId: string; | ||
success: boolean; | ||
}[]>; | ||
processingStatus(cursor?: string, scheduled?: boolean, limit?: number): Observable<{ | ||
cursor: string; | ||
results: ProcessingStatus[]; | ||
}>; | ||
} | ||
@@ -383,2 +404,3 @@ /** Extends `KnowledgeBox` with all the write operations. */ | ||
inviteToKb(data: InviteKbData): Observable<void>; | ||
deleteInvite(email: string): Observable<void>; | ||
} |
@@ -7,2 +7,3 @@ import type { Observable } from 'rxjs'; | ||
import type { ResourceProperties } from '../db.models'; | ||
import { NotificationMessage } from '../notifications'; | ||
export type KBStates = 'PUBLISHED' | 'PRIVATE'; | ||
@@ -61,2 +62,7 @@ export type KBRoles = 'SOWNER' | 'SCONTRIBUTOR' | 'SMEMBER'; | ||
} | ||
export interface KbInvite { | ||
email: string; | ||
role: KBRoles; | ||
expires: string; | ||
} | ||
export interface IKnowledgeBox extends IKnowledgeBoxCreation { | ||
@@ -96,2 +102,12 @@ get path(): string; | ||
getUsers(accountSlug: string): Observable<FullKbUser[]>; | ||
listenToAllNotifications(): Observable<NotificationMessage[]>; | ||
listenToProcessingNotifications(): Observable<{ | ||
resourceId: string; | ||
success: boolean; | ||
}[]>; | ||
stopListeningToNotifications(): void; | ||
processingStatus(cursor?: string, scheduled?: boolean, limit?: number): Observable<{ | ||
cursor: string; | ||
results: ProcessingStatus[]; | ||
}>; | ||
} | ||
@@ -211,2 +227,7 @@ export interface IWritableKnowledgeBox extends IKnowledgeBox { | ||
} | ||
export type RAGStrategyName = 'field_extension' | 'full_resource'; | ||
export type RAGStrategy = { | ||
name: RAGStrategyName; | ||
fields?: string[]; | ||
}; | ||
export interface Counters { | ||
@@ -265,1 +286,16 @@ resources: number; | ||
} | ||
export interface ProcessingStatus { | ||
completed: boolean; | ||
completed_at?: string | null; | ||
failed: boolean; | ||
kbid: string; | ||
processing_id: string; | ||
resource_id: string; | ||
retries: number; | ||
schedule_eta: number; | ||
schedule_order: number; | ||
scheduled: boolean; | ||
scheduled_at: string; | ||
timestamp: string; | ||
title: string; | ||
} |
@@ -13,2 +13,3 @@ export interface IResource { | ||
origin?: Origin; | ||
security?: Security; | ||
created?: string; | ||
@@ -75,3 +76,4 @@ modified?: string; | ||
PROCESSED = "PROCESSED", | ||
ERROR = "ERROR" | ||
ERROR = "ERROR", | ||
DELETED = "DELETED" | ||
} | ||
@@ -118,2 +120,5 @@ export interface Metadata { | ||
} | ||
export interface Security { | ||
access_groups: string[]; | ||
} | ||
export interface IError { | ||
@@ -120,0 +125,0 @@ body: string; |
import type { ExtractedDataTypes, FIELD_TYPE, FieldId, IFieldData, IResource, RelationEntityType, RelationType } from '../resource'; | ||
import type { ResourceProperties } from '../db.models'; | ||
import { RAGStrategy } from '../kb'; | ||
export type ResourceStatus = 'PENDING' | 'PROCESSED' | 'ERROR'; | ||
@@ -38,2 +39,3 @@ export type SortOrder = 'asc' | 'desc'; | ||
citations?: boolean; | ||
rag_strategies?: RAGStrategy[]; | ||
} | ||
@@ -40,0 +42,0 @@ export interface SearchOptions extends BaseSearchOptions { |
@@ -65,3 +65,3 @@ import type { Observable } from 'rxjs'; | ||
getObjectURL(path: string): Observable<string>; | ||
getStream(path: string, body: any): Observable<{ | ||
getStreamedResponse(path: string, body: any): Observable<{ | ||
data: Uint8Array; | ||
@@ -71,2 +71,6 @@ incomplete: boolean; | ||
}>; | ||
getStreamMessages(path: string, controller: AbortController): Observable<{ | ||
data: Uint8Array; | ||
headers: Headers; | ||
}>; | ||
} | ||
@@ -73,0 +77,0 @@ export interface IDb { |
@@ -60,3 +60,9 @@ import { Observable } from 'rxjs'; | ||
getObjectURL(path: string): Observable<string>; | ||
getStream(path: string, body: unknown): Observable<{ | ||
/** | ||
* Call an endpoint streaming its response by batch of data, | ||
* concatenate the data with the batch received previously until the response is marked as completed and then close the connection. | ||
* @param path | ||
* @param body body to be passed as parameter to the POST request made | ||
*/ | ||
getStreamedResponse(path: string, body: unknown): Observable<{ | ||
data: Uint8Array; | ||
@@ -66,3 +72,16 @@ incomplete: boolean; | ||
}>; | ||
/** | ||
* Call a long polling HTTP endpoint streaming its response until the connection times out. | ||
* This method is keeping the connection alive by calling the endpoint again when it times out until the provided controller receives an abort signal | ||
* (or if the endpoint returns an error unrelated to the timeout). | ||
* | ||
* @param path | ||
* @param controller | ||
*/ | ||
getStreamMessages(path: string, controller: AbortController): Observable<{ | ||
data: Uint8Array; | ||
headers: Headers; | ||
}>; | ||
private fetchStream; | ||
private concat; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
434163
75
8640
8