@memori.ai/memori-api-client
Advanced tools
Comparing version 3.0.1 to 4.0.0
## [4.0.0](https://github.com/memori-ai/memori-api-client/compare/v3.0.1...v4.0.0) (2024-03-19) | ||
### ⚠ BREAKING CHANGES | ||
* add new processes and analysis api, moving import status, refactor api code | ||
### Features | ||
* add new processes and analysis api, moving import status, refactor api code ([2cc81c0](https://github.com/memori-ai/memori-api-client/commit/2cc81c0512bbf7445d8e71cfacc41961fbbf0251)) | ||
### Maintenance | ||
* add new tenant attribute ([5829c53](https://github.com/memori-ai/memori-api-client/commit/5829c5337dd3aeb1fc3de462065b3f1dc6e2b8f9)) | ||
## [3.0.1](https://github.com/memori-ai/memori-api-client/compare/v3.0.0...v3.0.1) (2024-02-16) | ||
@@ -4,0 +20,0 @@ |
declare const backendAPI: (apiUrl: string) => { | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
@@ -369,20 +379,34 @@ exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
}; | ||
process: { | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
}; | ||
analysis: { | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
}; | ||
}; | ||
export default backendAPI; |
@@ -12,2 +12,4 @@ "use strict"; | ||
const importExport_1 = tslib_1.__importDefault(require("./backend/importExport")); | ||
const process_1 = tslib_1.__importDefault(require("./backend/process")); | ||
const analysis_1 = tslib_1.__importDefault(require("./backend/analysis")); | ||
const backendAPI = (apiUrl) => ({ | ||
@@ -22,2 +24,4 @@ asset: (0, asset_1.default)(apiUrl), | ||
importExport: (0, importExport_1.default)(apiUrl), | ||
process: (0, process_1.default)(apiUrl), | ||
analysis: (0, analysis_1.default)(apiUrl), | ||
...(0, asset_1.default)(apiUrl), | ||
@@ -31,4 +35,6 @@ ...(0, memori_1.default)(apiUrl), | ||
...(0, importExport_1.default)(apiUrl), | ||
...(0, process_1.default)(apiUrl), | ||
...(0, analysis_1.default)(apiUrl), | ||
}); | ||
exports.default = backendAPI; | ||
//# sourceMappingURL=backend.js.map |
@@ -1,18 +0,9 @@ | ||
import type { ResponseSpec, ImportParams, ImportResponse, CsvSpecs, JSONLSpecs } from '../types'; | ||
import type { ResponseSpec, ImportParams, ImportStatus, CsvSpecs, JSONLSpecs } from '../types'; | ||
declare const _default: (apiUrl: string) => { | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<ImportParams, 'txtSpecs'>) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
status: ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<ImportParams, 'csvSpecs'>) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
status: ImportStatus; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<ResponseSpec & { | ||
importProcesses: ImportResponse[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: CsvSpecs, password?: string) => Promise<string>; | ||
@@ -19,0 +10,0 @@ exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: JSONLSpecs, password?: string) => Promise<string>; |
@@ -21,14 +21,2 @@ "use strict"; | ||
}), | ||
importProcesses: async (authToken) => (0, apiFetcher_1.apiFetcher)(`/ImportExport/ImportProcesses/${authToken}`, { | ||
apiUrl, | ||
method: 'GET', | ||
}), | ||
importStatus: async (authToken, importID) => (0, apiFetcher_1.apiFetcher)(`/ImportExport/ImportStatus/${authToken}/${importID}`, { | ||
apiUrl, | ||
method: 'GET', | ||
}), | ||
stopImport: async (authToken, importID) => (0, apiFetcher_1.apiFetcher)(`/ImportExport/StopImport/${authToken}/${importID}`, { | ||
apiUrl, | ||
method: 'POST', | ||
}), | ||
exportCSV: async (authToken, memoriID, csvSpecs, password) => (0, apiFetcher_1.apiFetcher)(`/ImportExport/ExportCSV/${authToken}/${memoriID}`, { | ||
@@ -35,0 +23,0 @@ apiUrl, |
@@ -8,8 +8,16 @@ "use strict"; | ||
it('works on importexport apis', async () => { | ||
expect(await client.backend.importExport.importStatus('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b')).not.toBeNull(); | ||
expect(await client.backend.importExport.exportCSV('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b', { | ||
newLine: '\n', | ||
questionColumnName: 'Question', | ||
answerColumnName: 'Answer', | ||
})).not.toBeNull(); | ||
}); | ||
it('works on importexport apis with shorthand version', async () => { | ||
expect(await client.backend.importStatus('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b')).not.toBeNull(); | ||
expect(await client.backend.exportCSV('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b', { | ||
newLine: '\n', | ||
questionColumnName: 'Question', | ||
answerColumnName: 'Answer', | ||
})).not.toBeNull(); | ||
}); | ||
}); | ||
//# sourceMappingURL=importExport.test.js.map |
@@ -609,17 +609,27 @@ declare const api: (hostname?: string) => { | ||
backend: { | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
@@ -977,21 +987,35 @@ exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
}; | ||
process: { | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
}; | ||
analysis: { | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
}; | ||
}; | ||
}; | ||
export default api; |
@@ -205,2 +205,3 @@ export declare type Error = { | ||
logoURL?: string; | ||
adminEmail?: string; | ||
aliases?: string[]; | ||
@@ -668,14 +669,32 @@ adminCount?: number; | ||
} | ||
export interface ImportResponse { | ||
importID: string; | ||
export interface AnalysisParams { | ||
query: string; | ||
} | ||
export interface AnalysisWarning { | ||
warningType: 'Error' | string; | ||
text?: string; | ||
} | ||
export interface AnalysisWarning { | ||
warningType: 'Error' | string; | ||
text?: string; | ||
} | ||
export interface ProcessStatus { | ||
processID: string; | ||
memoriID: string; | ||
processUserName: string; | ||
processType: 'Import' | 'Analysis'; | ||
status: 'Pending' | 'Starting' | 'Running' | 'Stopped' | 'Completed' | 'Failed'; | ||
error?: string; | ||
progress: number; | ||
processSpecsJSON?: string; | ||
begin?: string; | ||
end?: string; | ||
eta?: number; | ||
creationTimestamp?: string; | ||
lastChangeTimestamp?: string; | ||
} | ||
export interface ImportStatus extends ProcessStatus { | ||
importType: 'CSV' | 'TXT'; | ||
importSize: number; | ||
importName?: string; | ||
importSpecsJSON?: string; | ||
begin?: string; | ||
end?: string; | ||
eta?: number; | ||
importedMemories?: number; | ||
@@ -685,2 +704,18 @@ importWarningsCount?: number; | ||
} | ||
export interface AnalysisStatus extends ProcessStatus { | ||
analysisType: 'UserQuery'; | ||
query?: string; | ||
analysisWarningsCount?: number; | ||
analysisWarnings?: AnalysisWarning[]; | ||
} | ||
export interface UserQueryMatch { | ||
userQueryMatchID: string; | ||
analysisID: string; | ||
memoriID: string; | ||
engineUserID: string; | ||
userName: string; | ||
userTenantName: string; | ||
userEmail: string; | ||
match: number; | ||
} | ||
export interface Badge { | ||
@@ -687,0 +722,0 @@ badgeID?: string; |
declare const backendAPI: (apiUrl: string) => { | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
@@ -369,20 +379,34 @@ exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
}; | ||
process: { | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
}; | ||
analysis: { | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
}; | ||
}; | ||
export default backendAPI; |
@@ -9,2 +9,4 @@ import memori from './backend/memori'; | ||
import importExport from './backend/importExport'; | ||
import process from './backend/process'; | ||
import analysis from './backend/analysis'; | ||
const backendAPI = (apiUrl) => ({ | ||
@@ -19,2 +21,4 @@ asset: asset(apiUrl), | ||
importExport: importExport(apiUrl), | ||
process: process(apiUrl), | ||
analysis: analysis(apiUrl), | ||
...asset(apiUrl), | ||
@@ -28,4 +32,6 @@ ...memori(apiUrl), | ||
...importExport(apiUrl), | ||
...process(apiUrl), | ||
...analysis(apiUrl), | ||
}); | ||
export default backendAPI; | ||
//# sourceMappingURL=backend.js.map |
@@ -1,18 +0,9 @@ | ||
import type { ResponseSpec, ImportParams, ImportResponse, CsvSpecs, JSONLSpecs } from '../types'; | ||
import type { ResponseSpec, ImportParams, ImportStatus, CsvSpecs, JSONLSpecs } from '../types'; | ||
declare const _default: (apiUrl: string) => { | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<ImportParams, 'txtSpecs'>) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
status: ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<ImportParams, 'csvSpecs'>) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
status: ImportStatus; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<ResponseSpec & { | ||
importProcesses: ImportResponse[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<ResponseSpec & { | ||
status: ImportResponse; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: CsvSpecs, password?: string) => Promise<string>; | ||
@@ -19,0 +10,0 @@ exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: JSONLSpecs, password?: string) => Promise<string>; |
@@ -19,14 +19,2 @@ import { apiFetcher } from '../apiFetcher'; | ||
}), | ||
importProcesses: async (authToken) => apiFetcher(`/ImportExport/ImportProcesses/${authToken}`, { | ||
apiUrl, | ||
method: 'GET', | ||
}), | ||
importStatus: async (authToken, importID) => apiFetcher(`/ImportExport/ImportStatus/${authToken}/${importID}`, { | ||
apiUrl, | ||
method: 'GET', | ||
}), | ||
stopImport: async (authToken, importID) => apiFetcher(`/ImportExport/StopImport/${authToken}/${importID}`, { | ||
apiUrl, | ||
method: 'POST', | ||
}), | ||
exportCSV: async (authToken, memoriID, csvSpecs, password) => apiFetcher(`/ImportExport/ExportCSV/${authToken}/${memoriID}`, { | ||
@@ -33,0 +21,0 @@ apiUrl, |
@@ -5,8 +5,16 @@ import memori from '../index'; | ||
it('works on importexport apis', async () => { | ||
expect(await client.backend.importExport.importStatus('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b')).not.toBeNull(); | ||
expect(await client.backend.importExport.exportCSV('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b', { | ||
newLine: '\n', | ||
questionColumnName: 'Question', | ||
answerColumnName: 'Answer', | ||
})).not.toBeNull(); | ||
}); | ||
it('works on importexport apis with shorthand version', async () => { | ||
expect(await client.backend.importStatus('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b')).not.toBeNull(); | ||
expect(await client.backend.exportCSV('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b', { | ||
newLine: '\n', | ||
questionColumnName: 'Question', | ||
answerColumnName: 'Answer', | ||
})).not.toBeNull(); | ||
}); | ||
}); | ||
//# sourceMappingURL=importExport.test.js.map |
@@ -609,17 +609,27 @@ declare const api: (hostname?: string) => { | ||
backend: { | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportStatus; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
@@ -977,21 +987,35 @@ exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
importCSV: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "txtSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importTXT: (authToken: string, memoriID: string, rows: string[], params: Omit<import("./types").ImportParams, "csvSpecs">) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
status: import("./types").ImportStatus; | ||
}>; | ||
importProcesses: (authToken: string) => Promise<import("./types").ResponseSpec & { | ||
importProcesses: import("./types").ImportResponse[]; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
}; | ||
process: { | ||
getProcesses: <T = import("./types").ProcessStatus>(authToken: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T[]; | ||
}>; | ||
importStatus: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getMemoriProcesses: <T_1 = import("./types").ProcessStatus>(authToken: string, memoriID: string, processType?: "Import" | "Analysis" | undefined) => Promise<import("./types").ResponseSpec & { | ||
processes: T_1[]; | ||
}>; | ||
stopImport: (authToken: string, importID: string) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").ImportResponse; | ||
getProcessStatus: <T_2 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_2; | ||
}>; | ||
exportCSV: (authToken: string, memoriID: string, csvSpecs: import("./types").CsvSpecs, password?: string | undefined) => Promise<string>; | ||
exportJSONL: (authToken: string, memoriID: string, jsonlSpecs: import("./types").JSONLSpecs, password?: string | undefined) => Promise<string>; | ||
stopProcess: <T_3 = import("./types").ProcessStatus>(authToken: string, processID: string) => Promise<import("./types").ResponseSpec & { | ||
status: T_3; | ||
}>; | ||
}; | ||
analysis: { | ||
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & { | ||
status: import("./types").AnalysisStatus; | ||
}>; | ||
getUserQueryMatches: (authToken: string, analysisID: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & { | ||
count: number; | ||
matches: import("./types").UserQueryMatch[]; | ||
}>; | ||
}; | ||
}; | ||
}; | ||
export default api; |
@@ -205,2 +205,3 @@ export declare type Error = { | ||
logoURL?: string; | ||
adminEmail?: string; | ||
aliases?: string[]; | ||
@@ -668,14 +669,32 @@ adminCount?: number; | ||
} | ||
export interface ImportResponse { | ||
importID: string; | ||
export interface AnalysisParams { | ||
query: string; | ||
} | ||
export interface AnalysisWarning { | ||
warningType: 'Error' | string; | ||
text?: string; | ||
} | ||
export interface AnalysisWarning { | ||
warningType: 'Error' | string; | ||
text?: string; | ||
} | ||
export interface ProcessStatus { | ||
processID: string; | ||
memoriID: string; | ||
processUserName: string; | ||
processType: 'Import' | 'Analysis'; | ||
status: 'Pending' | 'Starting' | 'Running' | 'Stopped' | 'Completed' | 'Failed'; | ||
error?: string; | ||
progress: number; | ||
processSpecsJSON?: string; | ||
begin?: string; | ||
end?: string; | ||
eta?: number; | ||
creationTimestamp?: string; | ||
lastChangeTimestamp?: string; | ||
} | ||
export interface ImportStatus extends ProcessStatus { | ||
importType: 'CSV' | 'TXT'; | ||
importSize: number; | ||
importName?: string; | ||
importSpecsJSON?: string; | ||
begin?: string; | ||
end?: string; | ||
eta?: number; | ||
importedMemories?: number; | ||
@@ -685,2 +704,18 @@ importWarningsCount?: number; | ||
} | ||
export interface AnalysisStatus extends ProcessStatus { | ||
analysisType: 'UserQuery'; | ||
query?: string; | ||
analysisWarningsCount?: number; | ||
analysisWarnings?: AnalysisWarning[]; | ||
} | ||
export interface UserQueryMatch { | ||
userQueryMatchID: string; | ||
analysisID: string; | ||
memoriID: string; | ||
engineUserID: string; | ||
userName: string; | ||
userTenantName: string; | ||
userEmail: string; | ||
match: number; | ||
} | ||
export interface Badge { | ||
@@ -687,0 +722,0 @@ badgeID?: string; |
{ | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"name": "@memori.ai/memori-api-client", | ||
@@ -4,0 +4,0 @@ "description": "React library to integrate a Memori in your app or website", |
@@ -9,2 +9,4 @@ import memori from './backend/memori'; | ||
import importExport from './backend/importExport'; | ||
import process from './backend/process'; | ||
import analysis from './backend/analysis'; | ||
@@ -20,2 +22,4 @@ const backendAPI = (apiUrl: string) => ({ | ||
importExport: importExport(apiUrl), | ||
process: process(apiUrl), | ||
analysis: analysis(apiUrl), | ||
...asset(apiUrl), | ||
@@ -29,4 +33,6 @@ ...memori(apiUrl), | ||
...importExport(apiUrl), | ||
...process(apiUrl), | ||
...analysis(apiUrl), | ||
}); | ||
export default backendAPI; |
@@ -8,5 +8,10 @@ import memori from '../index'; | ||
expect( | ||
await client.backend.importExport.importStatus( | ||
await client.backend.importExport.exportCSV( | ||
'768b9654-e781-4c3c-81fa-ae1529d1bfbe', | ||
'be2e4a44-890b-483b-a26a-f6e122f36e2b' | ||
'be2e4a44-890b-483b-a26a-f6e122f36e2b', | ||
{ | ||
newLine: '\n', | ||
questionColumnName: 'Question', | ||
answerColumnName: 'Answer', | ||
} | ||
) | ||
@@ -18,5 +23,10 @@ ).not.toBeNull(); | ||
expect( | ||
await client.backend.importStatus( | ||
await client.backend.exportCSV( | ||
'768b9654-e781-4c3c-81fa-ae1529d1bfbe', | ||
'be2e4a44-890b-483b-a26a-f6e122f36e2b' | ||
'be2e4a44-890b-483b-a26a-f6e122f36e2b', | ||
{ | ||
newLine: '\n', | ||
questionColumnName: 'Question', | ||
answerColumnName: 'Answer', | ||
} | ||
) | ||
@@ -23,0 +33,0 @@ ).not.toBeNull(); |
import type { | ||
ResponseSpec, | ||
ImportParams, | ||
ImportResponse, | ||
ImportStatus, | ||
CsvSpecs, | ||
@@ -39,3 +39,3 @@ JSONLSpecs, | ||
ResponseSpec & { | ||
status: ImportResponse; | ||
status: ImportStatus; | ||
} | ||
@@ -66,3 +66,3 @@ >, | ||
ResponseSpec & { | ||
status: ImportResponse; | ||
status: ImportStatus; | ||
} | ||
@@ -72,46 +72,2 @@ >, | ||
/** | ||
* Gets a list of Import processes started by the currently logged in User. | ||
* @param {string} authToken - The login token. | ||
*/ | ||
importProcesses: async (authToken: string) => | ||
apiFetcher(`/ImportExport/ImportProcesses/${authToken}`, { | ||
apiUrl, | ||
method: 'GET', | ||
}) as Promise< | ||
ResponseSpec & { | ||
importProcesses: ImportResponse[]; | ||
} | ||
>, | ||
/** | ||
* Gets the status of an Import process. | ||
* @param {string} authToken - The login token. | ||
* @param {string} importID The import process ID | ||
*/ | ||
importStatus: async (authToken: string, importID: string) => | ||
apiFetcher(`/ImportExport/ImportStatus/${authToken}/${importID}`, { | ||
apiUrl, | ||
method: 'GET', | ||
}) as Promise< | ||
ResponseSpec & { | ||
status: ImportResponse; | ||
} | ||
>, | ||
/** | ||
* Interrupts an ongoing Import process. | ||
* @param {string} authToken - The login token. | ||
* @param {string} importID The import process ID | ||
*/ | ||
stopImport: async (authToken: string, importID: string) => | ||
apiFetcher(`/ImportExport/StopImport/${authToken}/${importID}`, { | ||
apiUrl, | ||
method: 'POST', | ||
}) as Promise< | ||
ResponseSpec & { | ||
status: ImportResponse; | ||
} | ||
>, | ||
/** | ||
* Exports contents of a Memori object to a CSV file. | ||
@@ -118,0 +74,0 @@ * @param {string} authToken - The login token. |
166
src/types.ts
@@ -292,2 +292,3 @@ export declare type Error = { | ||
logoURL?: string; | ||
adminEmail?: string; | ||
/** | ||
@@ -1036,10 +1037,63 @@ * Additional Tenant names. | ||
export interface ImportResponse { | ||
export interface AnalysisParams { | ||
query: string; | ||
} | ||
export interface AnalysisWarning { | ||
/** | ||
* @type {string} | ||
* Import process ID. | ||
* Type of warning. | ||
* Currently supported types are: | ||
* - Error: an error occurred while performing analysis | ||
*/ | ||
importID: string; | ||
warningType: 'Error' | string; | ||
/** | ||
* @type {string=} | ||
* When WarningType is Error reports the text of the error. | ||
*/ | ||
text?: string; | ||
} | ||
export interface AnalysisWarning { | ||
/** | ||
* @type {string} | ||
* Type of warning. | ||
* Currently supported types are: | ||
* - Error: an error occurred while performing analysis | ||
*/ | ||
warningType: 'Error' | string; | ||
/** | ||
* @type {string=} | ||
* When WarningType is Error reports the text of the error. | ||
*/ | ||
text?: string; | ||
} | ||
export interface ProcessStatus { | ||
/** | ||
* @type {string} | ||
* Process ID. | ||
*/ | ||
processID: string; | ||
/** | ||
* @type {string} | ||
* ID of the Memori object this process refers to. | ||
*/ | ||
memoriID: string; | ||
/** | ||
* @type {string} | ||
* Name of the user that started the process. | ||
*/ | ||
processUserName: string; | ||
/** | ||
* @type {string} | ||
* Process type. | ||
* Can be one of the following: | ||
* | ||
* - Import: for file import processes | ||
* - Analysis: for Deep Thought user/query analysis processes | ||
*/ | ||
processType: 'Import' | 'Analysis'; | ||
/** | ||
* @type {string} | ||
* minLength: 1 | ||
@@ -1072,23 +1126,6 @@ * Current status of the Import process (starting, running etc.). | ||
/** | ||
* @type {string} | ||
* Import type. Can be one of the following: | ||
* - CSV: for tabular documents | ||
* - TXT: for text documents | ||
*/ | ||
importType: 'CSV' | 'TXT'; | ||
/** | ||
* @type {number} | ||
* Size of the imported document in characters. | ||
*/ | ||
importSize: number; | ||
/** | ||
* @type {string?} | ||
* Name of this import, if set when the Import process was requested. | ||
*/ | ||
importName?: string; | ||
/** | ||
* @type {string?} | ||
* Original parameters of the Import process request, as a JSON structure, excluding the document rows. | ||
*/ | ||
importSpecsJSON?: string; | ||
processSpecsJSON?: string; | ||
/** | ||
@@ -1109,4 +1146,25 @@ * @type {string=} | ||
eta?: number; | ||
creationTimestamp?: string; | ||
lastChangeTimestamp?: string; | ||
} | ||
export interface ImportStatus extends ProcessStatus { | ||
/** | ||
* @type {string} | ||
* Import type. Can be one of the following: | ||
* - CSV: for tabular documents | ||
* - TXT: for text documents | ||
*/ | ||
importType: 'CSV' | 'TXT'; | ||
/** | ||
* @type {number} | ||
* Size of the imported document in characters. | ||
*/ | ||
importSize: number; | ||
/** | ||
* @type {string?} | ||
* Name of this import, if set when the Import process was requested. | ||
*/ | ||
importName?: string; | ||
/** | ||
* @type {number=} | ||
@@ -1126,2 +1184,68 @@ * Number of Imported Memory objects so far. | ||
export interface AnalysisStatus extends ProcessStatus { | ||
/** | ||
* @type {string} | ||
* Analysis type. Can be one of the following: | ||
* - UserQuery: for Deep Thought User/query Match analysis | ||
*/ | ||
analysisType: 'UserQuery'; | ||
/** | ||
* @type {string} | ||
* Query to be used in the analysis. Used when AnalysisType is UserQuery. | ||
*/ | ||
query?: string; | ||
/** | ||
* @type {number=} | ||
* Number of Import Warning objects | ||
*/ | ||
analysisWarningsCount?: number; | ||
/** | ||
* @type {AnalysisWarning[]=} | ||
* List of Import Warning objects. May be empty. | ||
*/ | ||
analysisWarnings?: AnalysisWarning[]; | ||
} | ||
export interface UserQueryMatch { | ||
/** | ||
* @type {string} | ||
* Match ID. Unique and assigned by the system. | ||
*/ | ||
userQueryMatchID: string; | ||
/** | ||
* @type {string} | ||
* ID of the Analysis object this match refers to. | ||
*/ | ||
analysisID: string; | ||
/** | ||
* @type {string} | ||
* ID of the Memori object this match refers to. | ||
*/ | ||
memoriID: string; | ||
/** | ||
* @type {string} | ||
* ID of the corresponding User object on the Engine. | ||
*/ | ||
engineUserID: string; | ||
/** | ||
* @type {string} | ||
* User name. | ||
*/ | ||
userName: string; | ||
/** | ||
* @type {string} | ||
* User's Tenant name. | ||
*/ | ||
userTenantName: string; | ||
/** | ||
* @type {string} | ||
* User's e-mail. | ||
*/ | ||
userEmail: string; | ||
/** | ||
* @type {number} | ||
* Match level between the Analysis query and this User. Value is between 0 and 1, with 0.0 meaning no match and 1.0 meaning perfect match. | ||
*/ | ||
match: number; | ||
} | ||
export interface Badge { | ||
@@ -1128,0 +1252,0 @@ badgeID?: string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
782822
518
15204