@memori.ai/memori-api-client 6.6.0 → 6.6.1
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/CHANGELOG.md +67 -1
- package/dist/backend/asset.d.ts +3 -0
- package/dist/backend/asset.js +11 -0
- package/dist/backend/asset.js.map +1 -1
- package/dist/backend/trustedApplication.d.ts +17 -0
- package/dist/backend/trustedApplication.js +26 -0
- package/dist/backend/trustedApplication.js.map +1 -0
- package/dist/backend/trustedApplication.test.d.ts +1 -0
- package/dist/backend/trustedApplication.test.js +14 -0
- package/dist/backend/trustedApplication.test.js.map +1 -0
- package/dist/backend/userPwl.d.ts +36 -0
- package/dist/backend/userPwl.js +53 -0
- package/dist/backend/userPwl.js.map +1 -0
- package/dist/backend.d.ts +100 -0
- package/dist/backend.js +6 -0
- package/dist/backend.js.map +1 -1
- package/dist/engine/chatLogs.d.ts +3 -0
- package/dist/engine/chatLogs.js +4 -0
- package/dist/engine/chatLogs.js.map +1 -1
- package/dist/engine.d.ts +6 -0
- package/dist/index.d.ts +106 -0
- package/dist/types.d.ts +17 -1
- package/esm/backend/asset.d.ts +3 -0
- package/esm/backend/asset.js +11 -0
- package/esm/backend/asset.js.map +1 -1
- package/esm/backend/trustedApplication.d.ts +17 -0
- package/esm/backend/trustedApplication.js +24 -0
- package/esm/backend/trustedApplication.js.map +1 -0
- package/esm/backend/trustedApplication.test.d.ts +1 -0
- package/esm/backend/trustedApplication.test.js +11 -0
- package/esm/backend/trustedApplication.test.js.map +1 -0
- package/esm/backend/userPwl.d.ts +36 -0
- package/esm/backend/userPwl.js +51 -0
- package/esm/backend/userPwl.js.map +1 -0
- package/esm/backend.d.ts +100 -0
- package/esm/backend.js +6 -0
- package/esm/backend.js.map +1 -1
- package/esm/engine/chatLogs.d.ts +3 -0
- package/esm/engine/chatLogs.js +4 -0
- package/esm/engine/chatLogs.js.map +1 -1
- package/esm/engine.d.ts +6 -0
- package/esm/index.d.ts +106 -0
- package/esm/types.d.ts +17 -1
- package/package.json +1 -1
- package/src/backend/asset.ts +34 -0
- package/src/backend/trustedApplication.test.ts +21 -0
- package/src/backend/trustedApplication.ts +64 -0
- package/src/backend/userPwl.ts +155 -0
- package/src/backend.ts +6 -0
- package/src/engine/chatLogs.ts +27 -0
- package/src/types.ts +18 -1
package/esm/engine.d.ts
CHANGED
|
@@ -192,6 +192,9 @@ declare const _default: (apiUrl: string) => {
|
|
|
192
192
|
getChatLogs: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
193
193
|
chatLogs: import("./types").ChatLog[];
|
|
194
194
|
}>;
|
|
195
|
+
getChatLogsPaged: (sessionId: string, dateFrom: string, dateTo: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
196
|
+
chatLogs: import("./types").ChatLog[];
|
|
197
|
+
}>;
|
|
195
198
|
getChatLogsByUser: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
196
199
|
chatLogs: import("./types").ChatLog[];
|
|
197
200
|
}>;
|
|
@@ -207,6 +210,9 @@ declare const _default: (apiUrl: string) => {
|
|
|
207
210
|
getChatLogs: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
208
211
|
chatLogs: import("./types").ChatLog[];
|
|
209
212
|
}>;
|
|
213
|
+
getChatLogsPaged: (sessionId: string, dateFrom: string, dateTo: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
214
|
+
chatLogs: import("./types").ChatLog[];
|
|
215
|
+
}>;
|
|
210
216
|
getChatLogsByUser: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
211
217
|
chatLogs: import("./types").ChatLog[];
|
|
212
218
|
}>;
|
package/esm/index.d.ts
CHANGED
|
@@ -201,6 +201,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
201
201
|
getChatLogs: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
202
202
|
chatLogs: import("./types").ChatLog[];
|
|
203
203
|
}>;
|
|
204
|
+
getChatLogsPaged: (sessionId: string, dateFrom: string, dateTo: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
205
|
+
chatLogs: import("./types").ChatLog[];
|
|
206
|
+
}>;
|
|
204
207
|
getChatLogsByUser: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
205
208
|
chatLogs: import("./types").ChatLog[];
|
|
206
209
|
}>;
|
|
@@ -216,6 +219,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
216
219
|
getChatLogs: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
217
220
|
chatLogs: import("./types").ChatLog[];
|
|
218
221
|
}>;
|
|
222
|
+
getChatLogsPaged: (sessionId: string, dateFrom: string, dateTo: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
223
|
+
chatLogs: import("./types").ChatLog[];
|
|
224
|
+
}>;
|
|
219
225
|
getChatLogsByUser: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
220
226
|
chatLogs: import("./types").ChatLog[];
|
|
221
227
|
}>;
|
|
@@ -745,6 +751,19 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
745
751
|
deleteCorrelationPair: (sessionId: string, pairId: string) => Promise<import("./types").ResponseSpec>;
|
|
746
752
|
};
|
|
747
753
|
backend: {
|
|
754
|
+
createTrustedApplication: (authToken: string, trustedApplication: import("./types").TrustedApplication) => Promise<import("./types").ResponseSpec & {
|
|
755
|
+
trustedApplication: import("./types").TrustedApplication;
|
|
756
|
+
}>;
|
|
757
|
+
getTrustedApplication: (authToken: string, trustedApplicationID: string) => Promise<import("./types").ResponseSpec & {
|
|
758
|
+
trustedApplication: import("./types").TrustedApplication;
|
|
759
|
+
}>;
|
|
760
|
+
updateTrustedApplication: (authToken: string, trustedApplicationID: string, trustedApplication: import("./types").TrustedApplication) => Promise<import("./types").ResponseSpec & {
|
|
761
|
+
trustedApplication: import("./types").TrustedApplication;
|
|
762
|
+
}>;
|
|
763
|
+
deleteTrustedApplication: (authToken: string, trustedApplicationID: string) => Promise<import("./types").ResponseSpec>;
|
|
764
|
+
getTrustedApplicationsList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
765
|
+
trustedApplications: import("./types").TrustedApplication[];
|
|
766
|
+
}>;
|
|
748
767
|
healthCheck: () => Promise<import("./types").ResponseSpec>;
|
|
749
768
|
getTenantConfig: (tenantName: string) => Promise<import("./types").ResponseSpec & {
|
|
750
769
|
tenant: import("./types").Tenant;
|
|
@@ -892,6 +911,38 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
892
911
|
updateIntegration: (authToken: string, integrationID: string, integration: import("./types").Integration) => Promise<import("./types").ResponseSpec & {
|
|
893
912
|
integration: import("./types").Integration;
|
|
894
913
|
}>;
|
|
914
|
+
pwlUserLogin: (user: import("./types").User) => Promise<import("./types").ResponseSpec & {
|
|
915
|
+
user: import("./types").User;
|
|
916
|
+
token?: string | undefined;
|
|
917
|
+
flowID?: string | undefined;
|
|
918
|
+
}>;
|
|
919
|
+
pwlUserLogout: (authToken: string) => Promise<import("./types").ResponseSpec>;
|
|
920
|
+
pwlGetCurrentUser: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
921
|
+
user: import("./types").User;
|
|
922
|
+
}>;
|
|
923
|
+
pwlGetUser: (authToken: string, userID: string) => Promise<import("./types").ResponseSpec & {
|
|
924
|
+
user: import("./types").User;
|
|
925
|
+
}>;
|
|
926
|
+
pwlGetUsersList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
927
|
+
users: import("./types").User[];
|
|
928
|
+
}>;
|
|
929
|
+
pwlGetUsersListPaginated: (authToken: string, filters: import("./types").UserFilters) => Promise<import("./types").ResponseSpec & {
|
|
930
|
+
users: import("./types").User[];
|
|
931
|
+
count: number;
|
|
932
|
+
}>;
|
|
933
|
+
pwlDeleteUser: (authToken: string, userID: string) => Promise<import("./types").ResponseSpec>;
|
|
934
|
+
pwlUpdateUser: (authToken: string, userID: string, user: import("./types").User) => Promise<import("./types").ResponseSpec & {
|
|
935
|
+
user: import("./types").User;
|
|
936
|
+
}>;
|
|
937
|
+
pwlRecoverUsername: (user: import("./types").User) => Promise<import("./types").ResponseSpec>;
|
|
938
|
+
pwlCreateUser: (authToken: string, user: Partial<import("./types").User>) => Promise<import("./types").ResponseSpec & {
|
|
939
|
+
user: import("./types").User;
|
|
940
|
+
}>;
|
|
941
|
+
pwlLoginWithJWT: (jwt: string) => Promise<import("./types").ResponseSpec & {
|
|
942
|
+
user: import("./types").User;
|
|
943
|
+
token?: string | undefined;
|
|
944
|
+
flowID?: string | undefined;
|
|
945
|
+
}>;
|
|
895
946
|
userSignUp: (user: import("./types").User) => Promise<import("./types").ResponseSpec & {
|
|
896
947
|
user: import("./types").User;
|
|
897
948
|
}>;
|
|
@@ -995,6 +1046,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
995
1046
|
uploadAsset: (fileName: string, fileUrl: string, authToken: string, memoriID?: string | undefined, memoryID?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
996
1047
|
asset: import("./types").Asset;
|
|
997
1048
|
}>;
|
|
1049
|
+
uploadAssetUnlogged: (fileName: string, fileUrl: string, memoriID: string, sessionID: string) => Promise<import("./types").ResponseSpec & {
|
|
1050
|
+
asset: import("./types").Asset;
|
|
1051
|
+
}>;
|
|
998
1052
|
getAsset: (fileName: string, sessionID: string) => Promise<any>;
|
|
999
1053
|
getAssetList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
1000
1054
|
assets: import("./types").Asset[];
|
|
@@ -1008,6 +1062,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
1008
1062
|
uploadAsset: (fileName: string, fileUrl: string, authToken: string, memoriID?: string | undefined, memoryID?: string | undefined) => Promise<import("./types").ResponseSpec & {
|
|
1009
1063
|
asset: import("./types").Asset;
|
|
1010
1064
|
}>;
|
|
1065
|
+
uploadAssetUnlogged: (fileName: string, fileUrl: string, memoriID: string, sessionID: string) => Promise<import("./types").ResponseSpec & {
|
|
1066
|
+
asset: import("./types").Asset;
|
|
1067
|
+
}>;
|
|
1011
1068
|
getAsset: (fileName: string, sessionID: string) => Promise<any>;
|
|
1012
1069
|
getAssetList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
1013
1070
|
assets: import("./types").Asset[];
|
|
@@ -1120,6 +1177,40 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
1120
1177
|
user: import("./types").User;
|
|
1121
1178
|
}>;
|
|
1122
1179
|
};
|
|
1180
|
+
userPwl: {
|
|
1181
|
+
pwlUserLogin: (user: import("./types").User) => Promise<import("./types").ResponseSpec & {
|
|
1182
|
+
user: import("./types").User;
|
|
1183
|
+
token?: string | undefined;
|
|
1184
|
+
flowID?: string | undefined;
|
|
1185
|
+
}>;
|
|
1186
|
+
pwlUserLogout: (authToken: string) => Promise<import("./types").ResponseSpec>;
|
|
1187
|
+
pwlGetCurrentUser: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
1188
|
+
user: import("./types").User;
|
|
1189
|
+
}>;
|
|
1190
|
+
pwlGetUser: (authToken: string, userID: string) => Promise<import("./types").ResponseSpec & {
|
|
1191
|
+
user: import("./types").User;
|
|
1192
|
+
}>;
|
|
1193
|
+
pwlGetUsersList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
1194
|
+
users: import("./types").User[];
|
|
1195
|
+
}>;
|
|
1196
|
+
pwlGetUsersListPaginated: (authToken: string, filters: import("./types").UserFilters) => Promise<import("./types").ResponseSpec & {
|
|
1197
|
+
users: import("./types").User[];
|
|
1198
|
+
count: number;
|
|
1199
|
+
}>;
|
|
1200
|
+
pwlDeleteUser: (authToken: string, userID: string) => Promise<import("./types").ResponseSpec>;
|
|
1201
|
+
pwlUpdateUser: (authToken: string, userID: string, user: import("./types").User) => Promise<import("./types").ResponseSpec & {
|
|
1202
|
+
user: import("./types").User;
|
|
1203
|
+
}>;
|
|
1204
|
+
pwlRecoverUsername: (user: import("./types").User) => Promise<import("./types").ResponseSpec>;
|
|
1205
|
+
pwlCreateUser: (authToken: string, user: Partial<import("./types").User>) => Promise<import("./types").ResponseSpec & {
|
|
1206
|
+
user: import("./types").User;
|
|
1207
|
+
}>;
|
|
1208
|
+
pwlLoginWithJWT: (jwt: string) => Promise<import("./types").ResponseSpec & {
|
|
1209
|
+
user: import("./types").User;
|
|
1210
|
+
token?: string | undefined;
|
|
1211
|
+
flowID?: string | undefined;
|
|
1212
|
+
}>;
|
|
1213
|
+
};
|
|
1123
1214
|
integration: {
|
|
1124
1215
|
getMemoriIntegrationsList: (authToken: string, memoriID: string) => Promise<import("./types").ResponseSpec & {
|
|
1125
1216
|
integrations: import("./types").Integration[];
|
|
@@ -1287,6 +1378,21 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
1287
1378
|
tenant: import("./types").Tenant;
|
|
1288
1379
|
}>;
|
|
1289
1380
|
};
|
|
1381
|
+
trustedApplication: {
|
|
1382
|
+
createTrustedApplication: (authToken: string, trustedApplication: import("./types").TrustedApplication) => Promise<import("./types").ResponseSpec & {
|
|
1383
|
+
trustedApplication: import("./types").TrustedApplication;
|
|
1384
|
+
}>;
|
|
1385
|
+
getTrustedApplication: (authToken: string, trustedApplicationID: string) => Promise<import("./types").ResponseSpec & {
|
|
1386
|
+
trustedApplication: import("./types").TrustedApplication;
|
|
1387
|
+
}>;
|
|
1388
|
+
updateTrustedApplication: (authToken: string, trustedApplicationID: string, trustedApplication: import("./types").TrustedApplication) => Promise<import("./types").ResponseSpec & {
|
|
1389
|
+
trustedApplication: import("./types").TrustedApplication;
|
|
1390
|
+
}>;
|
|
1391
|
+
deleteTrustedApplication: (authToken: string, trustedApplicationID: string) => Promise<import("./types").ResponseSpec>;
|
|
1392
|
+
getTrustedApplicationsList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
1393
|
+
trustedApplications: import("./types").TrustedApplication[];
|
|
1394
|
+
}>;
|
|
1395
|
+
};
|
|
1290
1396
|
};
|
|
1291
1397
|
};
|
|
1292
1398
|
export default api;
|
package/esm/types.d.ts
CHANGED
|
@@ -329,6 +329,7 @@ export declare type Tenant = {
|
|
|
329
329
|
billingDelegation?: boolean;
|
|
330
330
|
creationTimestamp?: string;
|
|
331
331
|
lastChangeTimestamp?: string;
|
|
332
|
+
perplexityAPIKey?: string;
|
|
332
333
|
};
|
|
333
334
|
export declare type LocalizationKeyContent = {
|
|
334
335
|
key: string;
|
|
@@ -389,11 +390,12 @@ export declare type ConsumptionLog = {
|
|
|
389
390
|
export declare type Notification = {
|
|
390
391
|
notificationID: string;
|
|
391
392
|
timestamp: string;
|
|
392
|
-
severity: 'INFO' | 'WARN' | 'ALERT' | 'AWARD' | '
|
|
393
|
+
severity: 'INFO' | 'WARN' | 'ALERT' | 'AWARD' | 'CHANGELOG';
|
|
393
394
|
type: 'BROADCAST' | 'TENANT' | 'USER';
|
|
394
395
|
tenantID?: string;
|
|
395
396
|
userID?: string;
|
|
396
397
|
validFrom?: string;
|
|
398
|
+
userName?: string;
|
|
397
399
|
validTo?: string;
|
|
398
400
|
texts: {
|
|
399
401
|
'it-IT': string;
|
|
@@ -510,6 +512,7 @@ export declare type OpenSession = {
|
|
|
510
512
|
recoveryTokens?: string[];
|
|
511
513
|
tag?: string;
|
|
512
514
|
pin?: string;
|
|
515
|
+
continueFromChatLogID?: string;
|
|
513
516
|
initialContextVars?: {
|
|
514
517
|
[key: string]: string;
|
|
515
518
|
};
|
|
@@ -983,3 +986,16 @@ export declare type MacroFunction = {
|
|
|
983
986
|
obfuscated?: boolean;
|
|
984
987
|
}[];
|
|
985
988
|
};
|
|
989
|
+
export declare type TrustedApplication = {
|
|
990
|
+
trustedApplicationID: string;
|
|
991
|
+
tenantID: string;
|
|
992
|
+
name: string;
|
|
993
|
+
description: string;
|
|
994
|
+
baseUrl: string;
|
|
995
|
+
authorizationToken: string;
|
|
996
|
+
isEnabled: boolean;
|
|
997
|
+
createdByUserID: string;
|
|
998
|
+
lastModifiedByUserID: string;
|
|
999
|
+
creationTimestamp: string;
|
|
1000
|
+
lastChangeTimestamp: string;
|
|
1001
|
+
};
|
package/package.json
CHANGED
package/src/backend/asset.ts
CHANGED
|
@@ -54,6 +54,40 @@ export default (apiUrl: string) => ({
|
|
|
54
54
|
>;
|
|
55
55
|
},
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Uploads a file and creates a new Asset object for unlogged users.
|
|
59
|
+
* @param {string} fileName - The file name
|
|
60
|
+
* @param {string} fileUrl - The URL of the file to upload
|
|
61
|
+
* @param {string} memoriID - The memori ID
|
|
62
|
+
* @param {string} sessionID - The session ID
|
|
63
|
+
* @returns Response of an Upload Asset request.
|
|
64
|
+
*/
|
|
65
|
+
uploadAssetUnlogged: async (
|
|
66
|
+
fileName: string,
|
|
67
|
+
fileUrl: string,
|
|
68
|
+
memoriID: string,
|
|
69
|
+
sessionID: string
|
|
70
|
+
) => {
|
|
71
|
+
const data = new FormData();
|
|
72
|
+
const file = await fetch(fileUrl);
|
|
73
|
+
const fileBlob = await file.blob();
|
|
74
|
+
|
|
75
|
+
data.append(fileName, fileBlob, fileName);
|
|
76
|
+
|
|
77
|
+
const upload = await fetch(
|
|
78
|
+
`${apiUrl}/Asset/unlogged/${memoriID}/${sessionID}`,
|
|
79
|
+
{
|
|
80
|
+
method: 'POST',
|
|
81
|
+
body: data,
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
return (await upload.json()) as Promise<
|
|
85
|
+
ResponseSpec & {
|
|
86
|
+
asset: Asset;
|
|
87
|
+
}
|
|
88
|
+
>;
|
|
89
|
+
},
|
|
90
|
+
|
|
57
91
|
/**
|
|
58
92
|
* Downloads a file from an Asset object
|
|
59
93
|
* @param {string} fileName - The file name
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import memori from '../index';
|
|
2
|
+
|
|
3
|
+
const client = memori('https://backend.memori.ai');
|
|
4
|
+
|
|
5
|
+
describe('backend/trustedApplication api', () => {
|
|
6
|
+
it('works on trustedApplication apis', async () => {
|
|
7
|
+
expect(
|
|
8
|
+
await client.backend.trustedApplication.getTrustedApplicationsList(
|
|
9
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe'
|
|
10
|
+
)
|
|
11
|
+
).not.toBeNull();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('works on trustedApplication apis with shorthand version', async () => {
|
|
15
|
+
expect(
|
|
16
|
+
await client.backend.getTrustedApplicationsList(
|
|
17
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe'
|
|
18
|
+
)
|
|
19
|
+
).not.toBeNull();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ResponseSpec, TrustedApplication } from '../types';
|
|
2
|
+
import { apiFetcher } from '../apiFetcher';
|
|
3
|
+
|
|
4
|
+
export default (apiUrl: string) => ({
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new TrustedApplication.
|
|
7
|
+
* Only administrators can create TrustedApplications.
|
|
8
|
+
* @param authToken - The login token
|
|
9
|
+
* @param trustedApplication - The TrustedApplication specifications
|
|
10
|
+
* @returns The created TrustedApplication object
|
|
11
|
+
*/
|
|
12
|
+
createTrustedApplication: (authToken: string, trustedApplication: TrustedApplication) =>
|
|
13
|
+
apiFetcher(`/TrustedApplication/${authToken}`, {
|
|
14
|
+
apiUrl,
|
|
15
|
+
body: trustedApplication,
|
|
16
|
+
method: 'POST',
|
|
17
|
+
}) as Promise<ResponseSpec & { trustedApplication: TrustedApplication }>,
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Gets a TrustedApplication by ID.
|
|
21
|
+
* @param authToken - The login token
|
|
22
|
+
* @param trustedApplicationID - The TrustedApplication ID
|
|
23
|
+
* @returns The TrustedApplication object
|
|
24
|
+
*/
|
|
25
|
+
getTrustedApplication: (authToken: string, trustedApplicationID: string) =>
|
|
26
|
+
apiFetcher(`/TrustedApplication/${authToken}/${trustedApplicationID}`, {
|
|
27
|
+
apiUrl,
|
|
28
|
+
}) as Promise<ResponseSpec & { trustedApplication: TrustedApplication }>,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Updates an existing TrustedApplication.
|
|
32
|
+
* @param authToken - The login token
|
|
33
|
+
* @param trustedApplicationID - The TrustedApplication ID
|
|
34
|
+
* @param trustedApplication - The TrustedApplication specifications
|
|
35
|
+
* @returns The updated TrustedApplication object
|
|
36
|
+
*/
|
|
37
|
+
updateTrustedApplication: (authToken: string, trustedApplicationID: string, trustedApplication: TrustedApplication) =>
|
|
38
|
+
apiFetcher(`/TrustedApplication/${authToken}/${trustedApplicationID}`, {
|
|
39
|
+
apiUrl,
|
|
40
|
+
method: 'PUT',
|
|
41
|
+
body: trustedApplication,
|
|
42
|
+
}) as Promise<ResponseSpec & { trustedApplication: TrustedApplication }>,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Deletes a TrustedApplication.
|
|
46
|
+
* @param authToken - The login token
|
|
47
|
+
* @param trustedApplicationID - The TrustedApplication ID
|
|
48
|
+
*/
|
|
49
|
+
deleteTrustedApplication: (authToken: string, trustedApplicationID: string) =>
|
|
50
|
+
apiFetcher(`/TrustedApplication/${authToken}/${trustedApplicationID}`, {
|
|
51
|
+
apiUrl,
|
|
52
|
+
method: 'DELETE',
|
|
53
|
+
}) as Promise<ResponseSpec>,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Lists all TrustedApplications for the current tenant.
|
|
57
|
+
* @param authToken - The login token
|
|
58
|
+
* @returns A list of TrustedApplication objects
|
|
59
|
+
*/
|
|
60
|
+
getTrustedApplicationsList: (authToken: string) =>
|
|
61
|
+
apiFetcher(`/TrustedApplications/${authToken}`, {
|
|
62
|
+
apiUrl,
|
|
63
|
+
}) as Promise<ResponseSpec & { trustedApplications: TrustedApplication[] }>,
|
|
64
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ResponseSpec, User, UserFilters } from '../types';
|
|
2
|
+
import { apiFetcher } from '../apiFetcher';
|
|
3
|
+
|
|
4
|
+
export default (apiUrl: string) => ({
|
|
5
|
+
/**
|
|
6
|
+
* Tries a login with the specified credentials and returns a login token if successful.
|
|
7
|
+
* @param user - The user object
|
|
8
|
+
* @returns The logged in user object
|
|
9
|
+
*/
|
|
10
|
+
pwlUserLogin: (user: User) =>
|
|
11
|
+
apiFetcher('/PwlLogin', {
|
|
12
|
+
apiUrl,
|
|
13
|
+
body: user,
|
|
14
|
+
method: 'POST',
|
|
15
|
+
}) as Promise<
|
|
16
|
+
ResponseSpec & { user: User; token?: string; flowID?: string }
|
|
17
|
+
>,
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Logs out the user.
|
|
21
|
+
* @param authToken - The login token
|
|
22
|
+
*/
|
|
23
|
+
pwlUserLogout: (authToken: string) =>
|
|
24
|
+
apiFetcher(`/PwlLogout/${authToken}`, {
|
|
25
|
+
apiUrl,
|
|
26
|
+
method: 'POST',
|
|
27
|
+
}) as Promise<ResponseSpec>,
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets the details of the currently logged in User object.
|
|
31
|
+
* @param authToken - The login token
|
|
32
|
+
* @returns The user object
|
|
33
|
+
*/
|
|
34
|
+
pwlGetCurrentUser: (authToken: string) =>
|
|
35
|
+
apiFetcher(`/PwlUser/${authToken}`, {
|
|
36
|
+
apiUrl,
|
|
37
|
+
}) as Promise<
|
|
38
|
+
ResponseSpec & {
|
|
39
|
+
user: User;
|
|
40
|
+
}
|
|
41
|
+
>,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Gets the details of a User object.
|
|
45
|
+
* @param authToken - The login token
|
|
46
|
+
* @param userID - The user ID
|
|
47
|
+
* @returns The user object
|
|
48
|
+
*/
|
|
49
|
+
pwlGetUser: (authToken: string, userID: string) =>
|
|
50
|
+
apiFetcher(`/PwlUser/${authToken}/${userID}`, {
|
|
51
|
+
apiUrl,
|
|
52
|
+
}) as Promise<
|
|
53
|
+
ResponseSpec & {
|
|
54
|
+
user: User;
|
|
55
|
+
}
|
|
56
|
+
>,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Gets a list of all the existing User objects.
|
|
60
|
+
* @param authToken - The login token
|
|
61
|
+
* @returns A list of User objects
|
|
62
|
+
*/
|
|
63
|
+
pwlGetUsersList: (authToken: string) =>
|
|
64
|
+
apiFetcher(`/PwlUsers/${authToken}`, {
|
|
65
|
+
apiUrl,
|
|
66
|
+
}) as Promise<
|
|
67
|
+
ResponseSpec & {
|
|
68
|
+
users: User[];
|
|
69
|
+
}
|
|
70
|
+
>,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets a list of all the existing User objects paginated.
|
|
74
|
+
* @param authToken - The login token
|
|
75
|
+
* @param from - The 0-based index of the first User object to list
|
|
76
|
+
* @param howMany - The number of User objects to list
|
|
77
|
+
* @returns A list of User objects
|
|
78
|
+
*/
|
|
79
|
+
pwlGetUsersListPaginated: (authToken: string, filters: UserFilters) =>
|
|
80
|
+
apiFetcher(`/FilterPwlUsers/${authToken}`, {
|
|
81
|
+
apiUrl,
|
|
82
|
+
body: filters,
|
|
83
|
+
method: 'POST',
|
|
84
|
+
}) as Promise<
|
|
85
|
+
ResponseSpec & {
|
|
86
|
+
users: User[];
|
|
87
|
+
count: number;
|
|
88
|
+
}
|
|
89
|
+
>,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Deletes the currently logged in User.
|
|
93
|
+
* @param {string} authToken - The login token
|
|
94
|
+
* @param {string} userID: The User ID
|
|
95
|
+
*/
|
|
96
|
+
pwlDeleteUser: (authToken: string, userID: string) =>
|
|
97
|
+
apiFetcher(`/PwlUser/${authToken}/${userID}`, {
|
|
98
|
+
apiUrl,
|
|
99
|
+
method: 'DELETE',
|
|
100
|
+
}) as Promise<ResponseSpec>,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Updates the details of a User object.
|
|
104
|
+
* @param authToken - The login token
|
|
105
|
+
* @param userID - The user ID
|
|
106
|
+
* @returns The user object
|
|
107
|
+
*/
|
|
108
|
+
pwlUpdateUser: (authToken: string, userID: string, user: User) =>
|
|
109
|
+
apiFetcher(`/PwlUser/${authToken}/${userID}`, {
|
|
110
|
+
apiUrl,
|
|
111
|
+
method: 'PATCH',
|
|
112
|
+
body: user,
|
|
113
|
+
}) as Promise<
|
|
114
|
+
ResponseSpec & {
|
|
115
|
+
user: User;
|
|
116
|
+
}
|
|
117
|
+
>,
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Recovers a User's name and sends it to their configured e-mail.
|
|
121
|
+
* @param {User} user - The user object
|
|
122
|
+
*/
|
|
123
|
+
pwlRecoverUsername: (user: User) =>
|
|
124
|
+
apiFetcher(`/RecoverPwlUserName`, {
|
|
125
|
+
apiUrl,
|
|
126
|
+
body: user,
|
|
127
|
+
method: 'POST',
|
|
128
|
+
}) as Promise<ResponseSpec>,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Registers a new user.
|
|
132
|
+
* @param {User} user - The user object
|
|
133
|
+
*/
|
|
134
|
+
pwlCreateUser: (authToken: string, user: Partial<User>) =>
|
|
135
|
+
apiFetcher(`/PwlUser/${authToken}`, {
|
|
136
|
+
apiUrl,
|
|
137
|
+
body: user,
|
|
138
|
+
method: 'POST',
|
|
139
|
+
}) as Promise<ResponseSpec & { user: User }>,
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Tries a login with the specified JWT and returns a login token if successful.
|
|
143
|
+
* @param {object} payload - The payload object
|
|
144
|
+
* @param {string} payload.jwt - The JWT
|
|
145
|
+
* @returns The logged in user object
|
|
146
|
+
*/
|
|
147
|
+
pwlLoginWithJWT: (jwt: string) =>
|
|
148
|
+
apiFetcher('/LoginWithJWT', {
|
|
149
|
+
apiUrl,
|
|
150
|
+
body: { jwt },
|
|
151
|
+
method: 'POST',
|
|
152
|
+
}) as Promise<
|
|
153
|
+
ResponseSpec & { user: User; token?: string; flowID?: string }
|
|
154
|
+
>,
|
|
155
|
+
});
|
package/src/backend.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import memori from './backend/memori';
|
|
2
2
|
import user from './backend/user';
|
|
3
|
+
import userPwl from './backend/userPwl';
|
|
3
4
|
import integration from './backend/integration';
|
|
4
5
|
import asset from './backend/asset';
|
|
5
6
|
import invitation from './backend/invitation';
|
|
@@ -11,11 +12,13 @@ import analysis from './backend/analysis';
|
|
|
11
12
|
import completionConfig from './backend/completionConfig';
|
|
12
13
|
import badge from './backend/badge';
|
|
13
14
|
import tenant from './backend/tenant';
|
|
15
|
+
import trustedApplication from './backend/trustedApplication';
|
|
14
16
|
|
|
15
17
|
const backendAPI = (apiUrl: string) => ({
|
|
16
18
|
asset: asset(apiUrl),
|
|
17
19
|
memori: memori(apiUrl),
|
|
18
20
|
user: user(apiUrl),
|
|
21
|
+
userPwl: userPwl(apiUrl),
|
|
19
22
|
integration: integration(apiUrl),
|
|
20
23
|
invitation: invitation(apiUrl),
|
|
21
24
|
consumptionLogs: consumptionLogs(apiUrl),
|
|
@@ -26,9 +29,11 @@ const backendAPI = (apiUrl: string) => ({
|
|
|
26
29
|
completionConfig: completionConfig(apiUrl),
|
|
27
30
|
badge: badge(apiUrl),
|
|
28
31
|
tenant: tenant(apiUrl),
|
|
32
|
+
trustedApplication: trustedApplication(apiUrl),
|
|
29
33
|
...asset(apiUrl),
|
|
30
34
|
...memori(apiUrl),
|
|
31
35
|
...user(apiUrl),
|
|
36
|
+
...userPwl(apiUrl),
|
|
32
37
|
...integration(apiUrl),
|
|
33
38
|
...invitation(apiUrl),
|
|
34
39
|
...consumptionLogs(apiUrl),
|
|
@@ -39,6 +44,7 @@ const backendAPI = (apiUrl: string) => ({
|
|
|
39
44
|
...completionConfig(apiUrl),
|
|
40
45
|
...badge(apiUrl),
|
|
41
46
|
...tenant(apiUrl),
|
|
47
|
+
...trustedApplication(apiUrl),
|
|
42
48
|
});
|
|
43
49
|
|
|
44
50
|
export default backendAPI;
|
package/src/engine/chatLogs.ts
CHANGED
|
@@ -29,6 +29,33 @@ export default (apiUrl: string) => ({
|
|
|
29
29
|
}
|
|
30
30
|
>,
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Gets paginated Chat Log objects for the Memori of the current session in a specific date interval.
|
|
34
|
+
* @param {string} sessionId The session ID
|
|
35
|
+
* @param {string} dateFrom The begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
|
|
36
|
+
* @param {string} dateTo The end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
|
|
37
|
+
* @param {number} from The starting index for pagination
|
|
38
|
+
* @param {number} howMany The number of items to retrieve
|
|
39
|
+
*/
|
|
40
|
+
getChatLogsPaged: async (
|
|
41
|
+
sessionId: string,
|
|
42
|
+
dateFrom: string,
|
|
43
|
+
dateTo: string,
|
|
44
|
+
from: number,
|
|
45
|
+
howMany: number
|
|
46
|
+
) =>
|
|
47
|
+
apiFetcher(
|
|
48
|
+
`/ChatLogsPaged/${sessionId}/${dateFrom}/${dateTo}/${from}/${howMany}`,
|
|
49
|
+
{
|
|
50
|
+
method: 'GET',
|
|
51
|
+
apiUrl,
|
|
52
|
+
}
|
|
53
|
+
) as Promise<
|
|
54
|
+
ResponseSpec & {
|
|
55
|
+
chatLogs: ChatLog[];
|
|
56
|
+
}
|
|
57
|
+
>,
|
|
58
|
+
|
|
32
59
|
/**
|
|
33
60
|
* Gets the Chat Log objects for the Memori of the current session created by the current User.
|
|
34
61
|
* @param {string} sessionId The session ID
|
package/src/types.ts
CHANGED
|
@@ -558,6 +558,7 @@ export declare type Tenant = {
|
|
|
558
558
|
billingDelegation?: boolean;
|
|
559
559
|
creationTimestamp?: string;
|
|
560
560
|
lastChangeTimestamp?: string;
|
|
561
|
+
perplexityAPIKey?: string;
|
|
561
562
|
};
|
|
562
563
|
|
|
563
564
|
export declare type LocalizationKeyContent = {
|
|
@@ -630,11 +631,12 @@ export declare type ConsumptionLog = {
|
|
|
630
631
|
export declare type Notification = {
|
|
631
632
|
notificationID: string;
|
|
632
633
|
timestamp: string;
|
|
633
|
-
severity: 'INFO' | 'WARN' | 'ALERT' | 'AWARD' | '
|
|
634
|
+
severity: 'INFO' | 'WARN' | 'ALERT' | 'AWARD' | 'CHANGELOG';
|
|
634
635
|
type: 'BROADCAST' | 'TENANT' | 'USER';
|
|
635
636
|
tenantID?: string;
|
|
636
637
|
userID?: string;
|
|
637
638
|
validFrom?: string;
|
|
639
|
+
userName?: string;
|
|
638
640
|
validTo?: string;
|
|
639
641
|
texts: {
|
|
640
642
|
'it-IT': string;
|
|
@@ -882,6 +884,7 @@ export declare type OpenSession = {
|
|
|
882
884
|
recoveryTokens?: string[];
|
|
883
885
|
tag?: string;
|
|
884
886
|
pin?: string;
|
|
887
|
+
continueFromChatLogID?: string;
|
|
885
888
|
initialContextVars?: { [key: string]: string };
|
|
886
889
|
initialQuestion?: string;
|
|
887
890
|
forceCloseSessions?: boolean;
|
|
@@ -1932,3 +1935,17 @@ export declare type MacroFunction = {
|
|
|
1932
1935
|
obfuscated?: boolean;
|
|
1933
1936
|
}[];
|
|
1934
1937
|
};
|
|
1938
|
+
|
|
1939
|
+
export declare type TrustedApplication = {
|
|
1940
|
+
trustedApplicationID: string;
|
|
1941
|
+
tenantID: string;
|
|
1942
|
+
name: string;
|
|
1943
|
+
description: string;
|
|
1944
|
+
baseUrl: string;
|
|
1945
|
+
authorizationToken: string;
|
|
1946
|
+
isEnabled: boolean;
|
|
1947
|
+
createdByUserID: string;
|
|
1948
|
+
lastModifiedByUserID: string;
|
|
1949
|
+
creationTimestamp: string;
|
|
1950
|
+
lastChangeTimestamp: string;
|
|
1951
|
+
};
|