@memori.ai/memori-api-client 5.2.1 → 5.3.0

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/backend/user.d.ts +5 -1
  3. package/dist/backend/user.js +5 -0
  4. package/dist/backend/user.js.map +1 -1
  5. package/dist/backend.d.ts +8 -0
  6. package/dist/client.test.js +19 -0
  7. package/dist/client.test.js.map +1 -1
  8. package/dist/engine/chatLogs.d.ts +3 -0
  9. package/dist/engine/chatLogs.js +4 -0
  10. package/dist/engine/chatLogs.js.map +1 -1
  11. package/dist/engine/functions.d.ts +4 -0
  12. package/dist/engine/functions.js +4 -0
  13. package/dist/engine/functions.js.map +1 -1
  14. package/dist/engine/search.d.ts +1 -0
  15. package/dist/engine/search.js.map +1 -1
  16. package/dist/engine.d.ts +18 -2
  17. package/dist/index.d.ts +26 -2
  18. package/dist/types.d.ts +382 -271
  19. package/esm/backend/user.d.ts +5 -1
  20. package/esm/backend/user.js +5 -0
  21. package/esm/backend/user.js.map +1 -1
  22. package/esm/backend.d.ts +8 -0
  23. package/esm/client.test.js +19 -0
  24. package/esm/client.test.js.map +1 -1
  25. package/esm/engine/chatLogs.d.ts +3 -0
  26. package/esm/engine/chatLogs.js +4 -0
  27. package/esm/engine/chatLogs.js.map +1 -1
  28. package/esm/engine/functions.d.ts +4 -0
  29. package/esm/engine/functions.js +4 -0
  30. package/esm/engine/functions.js.map +1 -1
  31. package/esm/engine/search.d.ts +1 -0
  32. package/esm/engine/search.js.map +1 -1
  33. package/esm/engine.d.ts +18 -2
  34. package/esm/index.d.ts +26 -2
  35. package/esm/types.d.ts +382 -271
  36. package/package.json +1 -1
  37. package/src/backend/user.ts +20 -1
  38. package/src/client.test.ts +42 -0
  39. package/src/engine/chatLogs.ts +27 -0
  40. package/src/engine/functions.ts +21 -0
  41. package/src/engine/search.ts +1 -0
  42. package/src/types.ts +547 -337
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.2.1",
2
+ "version": "5.3.0",
3
3
  "name": "@memori.ai/memori-api-client",
4
4
  "description": "React library to integrate a Memori in your app or website",
5
5
  "license": "Apache-2.0",
@@ -1,4 +1,4 @@
1
- import { ResponseSpec, Tenant, User } from '../types';
1
+ import { ResponseSpec, Tenant, User, UserFilters } from '../types';
2
2
  import { apiFetcher } from '../apiFetcher';
3
3
 
4
4
  export default (apiUrl: string) => ({
@@ -93,6 +93,25 @@ export default (apiUrl: string) => ({
93
93
  }
94
94
  >,
95
95
 
96
+ /**
97
+ * Gets a list of all the existing User objects paginated.
98
+ * @param authToken - The login token
99
+ * @param from - The 0-based index of the first User object to list
100
+ * @param howMany - The number of User objects to list
101
+ * @returns A list of User objects
102
+ */
103
+ getUsersListPaginated: (authToken: string, filters: UserFilters) =>
104
+ apiFetcher(`/FilterUsers/${authToken}`, {
105
+ apiUrl,
106
+ body: filters,
107
+ method: 'POST',
108
+ }) as Promise<
109
+ ResponseSpec & {
110
+ users: User[];
111
+ count: number;
112
+ }
113
+ >,
114
+
96
115
  /**
97
116
  * Deletes the currently logged in User.
98
117
  * @param {string} authToken - The login token
@@ -19,6 +19,36 @@ describe('client', () => {
19
19
  'https://custom.backend.com/api/v2'
20
20
  );
21
21
  });
22
+ it('works with staging backend url', () => {
23
+ const customClient = memori('https://backend-staging.memori.ai/api/v2');
24
+ expect(customClient.constants.BACKEND_URL).toBe(
25
+ 'https://backend-staging.memori.ai/api/v2'
26
+ );
27
+ expect(customClient.constants.ENGINE_URL).toBe(
28
+ 'https://engine-staging.memori.ai/memori/v2'
29
+ );
30
+ });
31
+ it('works with staging engine url', () => {
32
+ const customClient = memori(
33
+ undefined,
34
+ 'https://engine-staging.memori.ai/memori/v2'
35
+ );
36
+ expect(customClient.constants.ENGINE_URL).toBe(
37
+ 'https://engine-staging.memori.ai/memori/v2'
38
+ );
39
+ });
40
+ it('works with staging endpoints url', () => {
41
+ const customClient = memori(
42
+ 'https://backend-staging.memori.ai/api/v2',
43
+ 'https://engine-staging.memori.ai/memori/v2'
44
+ );
45
+ expect(customClient.constants.ENGINE_URL).toBe(
46
+ 'https://engine-staging.memori.ai/memori/v2'
47
+ );
48
+ expect(customClient.constants.BACKEND_URL).toBe(
49
+ 'https://backend-staging.memori.ai/api/v2'
50
+ );
51
+ });
22
52
  it('works with custom engine url', () => {
23
53
  const customClient = memori(
24
54
  undefined,
@@ -28,6 +58,18 @@ describe('client', () => {
28
58
  'https://custom.engine.com/memori/v2'
29
59
  );
30
60
  });
61
+ it('works with custom endpoints url', () => {
62
+ const customClient = memori(
63
+ 'https://custom.backend.com/api/v2',
64
+ 'https://custom.engine.com/memori/v2'
65
+ );
66
+ expect(customClient.constants.ENGINE_URL).toBe(
67
+ 'https://custom.engine.com/memori/v2'
68
+ );
69
+ expect(customClient.constants.BACKEND_URL).toBe(
70
+ 'https://custom.backend.com/api/v2'
71
+ );
72
+ });
31
73
 
32
74
  it('works', async () => {
33
75
  expect(
@@ -44,6 +44,33 @@ export default (apiUrl: string) => ({
44
44
  }
45
45
  >,
46
46
 
47
+ /**
48
+ * Gets the Chat Log objects for the Memori of the current session recorded during a specific other session.
49
+ * @param {string} sessionId The session ID
50
+ * @param {string} userID The user ID
51
+ * @param {?string} dateFrom The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
52
+ * @param {?string} dateTo The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
53
+ */
54
+ getUserChatLogs: async (
55
+ sessionId: string,
56
+ userID: string,
57
+ dateFrom?: string,
58
+ dateTo?: string
59
+ ) =>
60
+ apiFetcher(
61
+ `/UserChatLogs/${sessionId}/${userID}${dateFrom ? `/${dateFrom}` : ''}${
62
+ dateFrom && dateTo ? `/${dateTo}` : ''
63
+ }`,
64
+ {
65
+ method: 'GET',
66
+ apiUrl,
67
+ }
68
+ ) as Promise<
69
+ ResponseSpec & {
70
+ chatLogs: ChatLog[];
71
+ }
72
+ >,
73
+
47
74
  /**
48
75
  * Removes all Chat Log objects in a specific date internval.
49
76
  * @param {string} sessionId The session ID
@@ -113,4 +113,25 @@ export default (apiUrl: string) => ({
113
113
  functionID: string;
114
114
  }
115
115
  >,
116
+
117
+ /**
118
+ * Lists all Macro Function objects.
119
+ * @param {string} sessionId The session ID
120
+ */
121
+ getMacroFunctions: async (sessionId: string) =>
122
+ apiFetcher(`/MacroFunctions/${sessionId}`, {
123
+ method: 'GET',
124
+ apiUrl,
125
+ }) as Promise<
126
+ ResponseSpec & {
127
+ /**
128
+ * Total number of Macro Function objects.
129
+ */
130
+ count: number;
131
+ /**
132
+ * List of Function objects. May be empty.
133
+ */
134
+ macroFunctions: Function[];
135
+ }
136
+ >,
116
137
  });
@@ -20,6 +20,7 @@ export default (apiUrl: string) => ({
20
20
  apiUrl,
21
21
  }) as Promise<
22
22
  ResponseSpec & {
23
+ count: number;
23
24
  matches: SearchMatches[];
24
25
  }
25
26
  >,