@memori.ai/memori-api-client 2.1.5 → 2.2.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 +14 -0
- package/dist/backend/importExport.d.ts +20 -0
- package/dist/backend/importExport.js +43 -0
- package/dist/backend/importExport.js.map +1 -0
- package/dist/backend/importExport.test.d.ts +1 -0
- package/dist/backend/importExport.test.js +14 -0
- package/dist/backend/importExport.test.js.map +1 -0
- package/dist/backend.d.ts +34 -0
- package/dist/backend.js +3 -0
- package/dist/backend.js.map +1 -1
- package/dist/engine.d.ts +0 -34
- package/dist/engine.js +0 -3
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +34 -34
- package/dist/types.d.ts +33 -21
- package/esm/backend/importExport.d.ts +20 -0
- package/esm/backend/importExport.js +41 -0
- package/esm/backend/importExport.js.map +1 -0
- package/esm/backend/importExport.test.d.ts +1 -0
- package/esm/backend/importExport.test.js +11 -0
- package/esm/backend/importExport.test.js.map +1 -0
- package/esm/backend.d.ts +34 -0
- package/esm/backend.js +3 -0
- package/esm/backend.js.map +1 -1
- package/esm/engine.d.ts +0 -34
- package/esm/engine.js +0 -3
- package/esm/engine.js.map +1 -1
- package/esm/index.d.ts +34 -34
- package/esm/types.d.ts +33 -21
- package/package.json +1 -1
- package/src/backend/importExport.test.ts +23 -0
- package/src/backend/importExport.ts +135 -0
- package/src/backend.ts +3 -0
- package/src/engine.ts +0 -3
- package/src/types.ts +71 -21
- package/src/engine/importExport.test.ts +0 -38
- package/src/engine/importExport.ts +0 -115
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ResponseSpec,
|
|
3
|
-
ImportParams,
|
|
4
|
-
ImportResponse,
|
|
5
|
-
ExportCSVParams,
|
|
6
|
-
} from '../types';
|
|
7
|
-
import { apiFetcher } from '../apiFetcher';
|
|
8
|
-
|
|
9
|
-
/************************
|
|
10
|
-
* *
|
|
11
|
-
* ImportExport *
|
|
12
|
-
* *
|
|
13
|
-
************************/
|
|
14
|
-
|
|
15
|
-
export default (apiUrl: string) => ({
|
|
16
|
-
/**
|
|
17
|
-
* Imports memories from a CSV file.
|
|
18
|
-
* @param {string} sessionId The session ID
|
|
19
|
-
* @param {string[]} rows Rows of the CSV file.
|
|
20
|
-
* @param {ImportParams} params The specifications and content of the CSV file
|
|
21
|
-
*/
|
|
22
|
-
importCSV: async (sessionId: string, rows: string[], params: ImportParams) =>
|
|
23
|
-
apiFetcher(`/ImportExport/ImportCSV/${sessionId}`, {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
apiUrl,
|
|
26
|
-
body: {
|
|
27
|
-
rows,
|
|
28
|
-
...params,
|
|
29
|
-
},
|
|
30
|
-
}) as Promise<
|
|
31
|
-
ResponseSpec & {
|
|
32
|
-
status: ImportResponse;
|
|
33
|
-
}
|
|
34
|
-
>,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Gets the list of recent Import processes for the Memori object associated with the specified session ID.
|
|
38
|
-
* @param {string} sessionId The session ID
|
|
39
|
-
*/
|
|
40
|
-
importProcesses: async (sessionId: string) =>
|
|
41
|
-
apiFetcher(`/ImportExport/ImportProcesses/${sessionId}`, {
|
|
42
|
-
method: 'GET',
|
|
43
|
-
apiUrl,
|
|
44
|
-
}) as Promise<
|
|
45
|
-
ResponseSpec & {
|
|
46
|
-
importProcesses: ImportResponse[];
|
|
47
|
-
}
|
|
48
|
-
>,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Gets the status of an ongoing Import process.
|
|
52
|
-
* @param {string} importID The import process ID
|
|
53
|
-
*/
|
|
54
|
-
importStatus: async (importID: string) =>
|
|
55
|
-
apiFetcher(`/ImportExport/ImportStatus/${importID}`, {
|
|
56
|
-
method: 'GET',
|
|
57
|
-
apiUrl,
|
|
58
|
-
}) as Promise<
|
|
59
|
-
ResponseSpec & {
|
|
60
|
-
status: ImportResponse;
|
|
61
|
-
}
|
|
62
|
-
>,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Interrupts an ongoing Import process.
|
|
66
|
-
* @param {string} importID The import process ID
|
|
67
|
-
*/
|
|
68
|
-
stopImport: async (importID: string) =>
|
|
69
|
-
apiFetcher(`/ImportExport/StopImport/${importID}`, {
|
|
70
|
-
method: 'POST',
|
|
71
|
-
apiUrl,
|
|
72
|
-
}) as Promise<
|
|
73
|
-
ResponseSpec & {
|
|
74
|
-
status: ImportResponse;
|
|
75
|
-
}
|
|
76
|
-
>,
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Imports memories from a TXT file.
|
|
80
|
-
* @param {string} sessionId The session ID
|
|
81
|
-
* @param {string[]} rows Rows of the TXT file.
|
|
82
|
-
* @param {ImportCSVParams} params The specifications and content of the TXT file
|
|
83
|
-
*/
|
|
84
|
-
importTXT: async (
|
|
85
|
-
sessionId: string,
|
|
86
|
-
rows: string[],
|
|
87
|
-
params: Omit<ImportParams, 'csvSpecs'>
|
|
88
|
-
) =>
|
|
89
|
-
apiFetcher(`/ImportExport/ImportTXT/${sessionId}`, {
|
|
90
|
-
method: 'POST',
|
|
91
|
-
apiUrl,
|
|
92
|
-
body: {
|
|
93
|
-
rows,
|
|
94
|
-
...params,
|
|
95
|
-
},
|
|
96
|
-
}) as Promise<
|
|
97
|
-
ResponseSpec & {
|
|
98
|
-
status: ImportResponse;
|
|
99
|
-
}
|
|
100
|
-
>,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Exports memories to a CSV file.
|
|
104
|
-
* @param {string} sessionID The session ID
|
|
105
|
-
* @param {ExportCSVParams} params - The specifications of the CSV file
|
|
106
|
-
* @returns The CSV file content
|
|
107
|
-
*/
|
|
108
|
-
exportCSV: async (sessionID: string, params: ExportCSVParams) =>
|
|
109
|
-
apiFetcher(`/ImportExport/ExportCSV/${sessionID}`, {
|
|
110
|
-
method: 'POST',
|
|
111
|
-
apiUrl,
|
|
112
|
-
body: params,
|
|
113
|
-
text: true,
|
|
114
|
-
}) as Promise<string>,
|
|
115
|
-
});
|