@memori.ai/memori-api-client 4.1.3 → 4.2.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.
- package/CHANGELOG.md +7 -0
- package/dist/backend/analysis.test.js +1 -1
- package/dist/backend/analysis.test.js.map +1 -1
- package/dist/backend/process.test.js +1 -1
- package/dist/backend/process.test.js.map +1 -1
- package/dist/engine/functions.d.ts +22 -0
- package/dist/engine/functions.js +32 -0
- package/dist/engine/functions.js.map +1 -0
- package/dist/engine/functions.test.d.ts +1 -0
- package/dist/engine/functions.test.js +14 -0
- package/dist/engine/functions.test.js.map +1 -0
- package/dist/engine.d.ts +38 -0
- package/dist/engine.js +3 -0
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +38 -0
- package/dist/types.d.ts +22 -0
- package/esm/backend/analysis.test.js +1 -1
- package/esm/backend/analysis.test.js.map +1 -1
- package/esm/backend/process.test.js +1 -1
- package/esm/backend/process.test.js.map +1 -1
- package/esm/engine/functions.d.ts +22 -0
- package/esm/engine/functions.js +30 -0
- package/esm/engine/functions.js.map +1 -0
- package/esm/engine/functions.test.d.ts +1 -0
- package/esm/engine/functions.test.js +11 -0
- package/esm/engine/functions.test.js.map +1 -0
- package/esm/engine.d.ts +38 -0
- package/esm/engine.js +3 -0
- package/esm/engine.js.map +1 -1
- package/esm/index.d.ts +38 -0
- package/esm/types.d.ts +22 -0
- package/package.json +1 -1
- package/src/backend/analysis.test.ts +1 -1
- package/src/backend/process.test.ts +1 -1
- package/src/engine/functions.test.ts +23 -0
- package/src/engine/functions.ts +116 -0
- package/src/engine.ts +3 -0
- package/src/types.ts +86 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [4.2.0](https://github.com/memori-ai/memori-api-client/compare/v4.1.3...v4.2.0) (2024-05-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add functions apis ([9a9a8ba](https://github.com/memori-ai/memori-api-client/commit/9a9a8bafbf8d75c2421e27ff539482204f43f265))
|
|
9
|
+
|
|
3
10
|
## [4.1.3](https://github.com/memori-ai/memori-api-client/compare/v4.1.2...v4.1.3) (2024-04-30)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const index_1 = tslib_1.__importDefault(require("../index"));
|
|
5
|
-
const client = (0, index_1.default)('https://backend
|
|
5
|
+
const client = (0, index_1.default)('https://backend.memori.ai');
|
|
6
6
|
describe('backend/analysis api', () => {
|
|
7
7
|
it('works on analysis apis', async () => {
|
|
8
8
|
expect(await client.backend.analysis.analyzeUserQuery('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b', { query: 'test' })).not.toBeNull();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.test.js","sourceRoot":"","sources":["../../src/backend/analysis.test.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAE9B,MAAM,MAAM,GAAG,IAAA,eAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"analysis.test.js","sourceRoot":"","sources":["../../src/backend/analysis.test.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAE9B,MAAM,MAAM,GAAG,IAAA,eAAM,EAAC,2BAA2B,CAAC,CAAC;AAEnD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAC5C,sCAAsC,EACtC,sCAAsC,EACtC,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,gBAAgB,CACnC,sCAAsC,EACtC,sCAAsC,EACtC,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const index_1 = tslib_1.__importDefault(require("../index"));
|
|
5
|
-
const client = (0, index_1.default)('https://backend
|
|
5
|
+
const client = (0, index_1.default)('https://backend.memori.ai');
|
|
6
6
|
describe('backend/process api', () => {
|
|
7
7
|
it('works on process apis', async () => {
|
|
8
8
|
expect(await client.backend.process.getProcessStatus('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b')).not.toBeNull();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../src/backend/process.test.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAE9B,MAAM,MAAM,GAAG,IAAA,eAAM,EAAC,
|
|
1
|
+
{"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../src/backend/process.test.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAE9B,MAAM,MAAM,GAAG,IAAA,eAAM,EAAC,2BAA2B,CAAC,CAAC;AAEnD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAC3C,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,gBAAgB,CACnC,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResponseSpec, Function } from '../types';
|
|
2
|
+
declare const _default: (apiUrl: string) => {
|
|
3
|
+
getAllFunctions: (sessionId: string) => Promise<ResponseSpec & {
|
|
4
|
+
count: number;
|
|
5
|
+
functions: Function[];
|
|
6
|
+
}>;
|
|
7
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<ResponseSpec & {
|
|
8
|
+
count: number;
|
|
9
|
+
functions: Function[];
|
|
10
|
+
}>;
|
|
11
|
+
getFunction: (sessionId: string, functionID: string) => Promise<ResponseSpec & {
|
|
12
|
+
function: Function;
|
|
13
|
+
}>;
|
|
14
|
+
patchFunction: (sessionId: string, func: Partial<Function> & {
|
|
15
|
+
functionID: string;
|
|
16
|
+
}) => Promise<ResponseSpec>;
|
|
17
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<ResponseSpec>;
|
|
18
|
+
createFunction: (sessionId: string, func: Function) => Promise<ResponseSpec & {
|
|
19
|
+
functionID: string;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const apiFetcher_1 = require("../apiFetcher");
|
|
4
|
+
exports.default = (apiUrl) => ({
|
|
5
|
+
getAllFunctions: async (sessionId) => (0, apiFetcher_1.apiFetcher)(`/Functions/${sessionId}`, {
|
|
6
|
+
method: 'GET',
|
|
7
|
+
apiUrl,
|
|
8
|
+
}),
|
|
9
|
+
getFunctionsPaginated: async (sessionId, from, howMany) => (0, apiFetcher_1.apiFetcher)(`/Functions/${sessionId}/${from}/${howMany}`, {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
apiUrl,
|
|
12
|
+
}),
|
|
13
|
+
getFunction: async (sessionId, functionID) => (0, apiFetcher_1.apiFetcher)(`/Function/${sessionId}/${functionID}`, {
|
|
14
|
+
method: 'GET',
|
|
15
|
+
apiUrl,
|
|
16
|
+
}),
|
|
17
|
+
patchFunction: async (sessionId, func) => (0, apiFetcher_1.apiFetcher)(`/Function/${sessionId}/${func.functionID}`, {
|
|
18
|
+
method: 'PATCH',
|
|
19
|
+
apiUrl,
|
|
20
|
+
body: func,
|
|
21
|
+
}),
|
|
22
|
+
deleteFunction: async (sessionId, functionID) => (0, apiFetcher_1.apiFetcher)(`/Function/${sessionId}/${functionID}`, {
|
|
23
|
+
method: 'DELETE',
|
|
24
|
+
apiUrl,
|
|
25
|
+
}),
|
|
26
|
+
createFunction: async (sessionId, func) => (0, apiFetcher_1.apiFetcher)(`/Function/${sessionId}`, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
apiUrl,
|
|
29
|
+
body: func,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/engine/functions.ts"],"names":[],"mappings":";;AACA,8CAA2C;AAQ3C,kBAAe,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IAKlC,eAAe,EAAE,KAAK,EAAE,SAAiB,EAAE,EAAE,CAC3C,IAAA,uBAAU,EAAC,cAAc,SAAS,EAAE,EAAE;QACpC,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAWA;IAQH,qBAAqB,EAAE,KAAK,EAC1B,SAAiB,EACjB,IAAY,EACZ,OAAe,EACf,EAAE,CACF,IAAA,uBAAU,EAAC,cAAc,SAAS,IAAI,IAAI,IAAI,OAAO,EAAE,EAAE;QACvD,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAWA;IAOH,WAAW,EAAE,KAAK,EAAE,SAAiB,EAAE,UAAkB,EAAE,EAAE,CAC3D,IAAA,uBAAU,EAAC,aAAa,SAAS,IAAI,UAAU,EAAE,EAAE;QACjD,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAIA;IAQH,aAAa,EAAE,KAAK,EAClB,SAAiB,EACjB,IAAgD,EAChD,EAAE,CACF,IAAA,uBAAU,EAAC,aAAa,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;QACtD,MAAM,EAAE,OAAO;QACf,MAAM;QACN,IAAI,EAAE,IAAI;KACX,CAA0B;IAO7B,cAAc,EAAE,KAAK,EAAE,SAAiB,EAAE,UAAkB,EAAE,EAAE,CAC9D,IAAA,uBAAU,EAAC,aAAa,SAAS,IAAI,UAAU,EAAE,EAAE;QACjD,MAAM,EAAE,QAAQ;QAChB,MAAM;KACP,CAA0B;IAO7B,cAAc,EAAE,KAAK,EAAE,SAAiB,EAAE,IAAc,EAAE,EAAE,CAC1D,IAAA,uBAAU,EAAC,aAAa,SAAS,EAAE,EAAE;QACnC,MAAM,EAAE,MAAM;QACd,MAAM;QACN,IAAI,EAAE,IAAI;KACX,CAIA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const index_1 = tslib_1.__importDefault(require("../index"));
|
|
5
|
+
const client = (0, index_1.default)('https://backend.memori.ai');
|
|
6
|
+
describe('engine/functions api', () => {
|
|
7
|
+
it('works on functions apis', async () => {
|
|
8
|
+
expect(await client.functions.getFunction('768b9654-e781-4c3c-81fa-ae1529d1bfbe', '768b9654-e781-4c3c-81fa-ae1529d1bfbe')).not.toBeNull();
|
|
9
|
+
});
|
|
10
|
+
it('works on functions apis with shorthand version', async () => {
|
|
11
|
+
expect(await client.getFunction('768b9654-e781-4c3c-81fa-ae1529d1bfbe', '768b9654-e781-4c3c-81fa-ae1529d1bfbe')).not.toBeNull();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=functions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.test.js","sourceRoot":"","sources":["../../src/engine/functions.test.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAE9B,MAAM,MAAM,GAAG,IAAA,eAAM,EAAC,2BAA2B,CAAC,CAAC;AAEnD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,CACJ,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAChC,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;QAC9D,MAAM,CACJ,MAAM,MAAM,CAAC,WAAW,CACtB,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
declare const _default: (apiUrl: string) => {
|
|
2
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
3
|
+
count: number;
|
|
4
|
+
functions: import("./types").Function[];
|
|
5
|
+
}>;
|
|
6
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
7
|
+
count: number;
|
|
8
|
+
functions: import("./types").Function[];
|
|
9
|
+
}>;
|
|
10
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
11
|
+
function: import("./types").Function;
|
|
12
|
+
}>;
|
|
13
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
14
|
+
functionID: string;
|
|
15
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
16
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
17
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
18
|
+
functionID: string;
|
|
19
|
+
}>;
|
|
20
|
+
functions: {
|
|
21
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
22
|
+
count: number;
|
|
23
|
+
functions: import("./types").Function[];
|
|
24
|
+
}>;
|
|
25
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
26
|
+
count: number;
|
|
27
|
+
functions: import("./types").Function[];
|
|
28
|
+
}>;
|
|
29
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
30
|
+
function: import("./types").Function;
|
|
31
|
+
}>;
|
|
32
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
33
|
+
functionID: string;
|
|
34
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
35
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
36
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
37
|
+
functionID: string;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
2
40
|
getTopics: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
3
41
|
count: number;
|
|
4
42
|
topics: import("./types").Topic[];
|
package/dist/engine.js
CHANGED
|
@@ -20,6 +20,7 @@ const expertReferences_1 = tslib_1.__importDefault(require("./engine/expertRefer
|
|
|
20
20
|
const knownFacts_1 = tslib_1.__importDefault(require("./engine/knownFacts"));
|
|
21
21
|
const user_1 = tslib_1.__importDefault(require("./engine/user"));
|
|
22
22
|
const topics_1 = tslib_1.__importDefault(require("./engine/topics"));
|
|
23
|
+
const functions_1 = tslib_1.__importDefault(require("./engine/functions"));
|
|
23
24
|
exports.default = (apiUrl) => ({
|
|
24
25
|
correlationPairs: (0, correlationPairs_1.default)(apiUrl),
|
|
25
26
|
...(0, correlationPairs_1.default)(apiUrl),
|
|
@@ -59,5 +60,7 @@ exports.default = (apiUrl) => ({
|
|
|
59
60
|
...(0, user_1.default)(apiUrl),
|
|
60
61
|
topics: (0, topics_1.default)(apiUrl),
|
|
61
62
|
...(0, topics_1.default)(apiUrl),
|
|
63
|
+
functions: (0, functions_1.default)(apiUrl),
|
|
64
|
+
...(0, functions_1.default)(apiUrl),
|
|
62
65
|
});
|
|
63
66
|
//# sourceMappingURL=engine.js.map
|
package/dist/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":";;;AAAA,yFAAyD;AACzD,qEAAqC;AACrC,uEAAuC;AACvC,yFAAyD;AACzD,mEAAmC;AACnC,yEAAyC;AACzC,+DAA+B;AAC/B,qEAAqC;AACrC,qEAAqC;AACrC,uEAAuC;AACvC,mEAAmC;AACnC,+FAA+D;AAC/D,+EAA+C;AAC/C,yFAAyD;AACzD,yEAAyC;AACzC,yFAAyD;AACzD,6EAA6C;AAC7C,iEAAiC;AACjC,qEAAqC;
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":";;;AAAA,yFAAyD;AACzD,qEAAqC;AACrC,uEAAuC;AACvC,yFAAyD;AACzD,mEAAmC;AACnC,yEAAyC;AACzC,+DAA+B;AAC/B,qEAAqC;AACrC,qEAAqC;AACrC,uEAAuC;AACvC,mEAAmC;AACnC,+FAA+D;AAC/D,+EAA+C;AAC/C,yFAAyD;AACzD,y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6BAAmB,EAAC,MAAM,CAAC;IAC9B,WAAW,EAAE,IAAA,qBAAW,EAAC,MAAM,CAAC;IAChC,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC;IACtB,gBAAgB,EAAE,IAAA,0BAAgB,EAAC,MAAM,CAAC;IAC1C,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,IAAA,kBAAQ,EAAC,MAAM,CAAC;IAC1B,GAAG,IAAA,kBAAQ,EAAC,MAAM,CAAC;IACnB,gBAAgB,EAAE,IAAA,0BAAgB,EAAC,MAAM,CAAC;IAC1C,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC;IAC3B,UAAU,EAAE,IAAA,oBAAU,EAAC,MAAM,CAAC;IAC9B,GAAG,IAAA,oBAAU,EAAC,MAAM,CAAC;IACrB,IAAI,EAAE,IAAA,cAAI,EAAC,MAAM,CAAC;IAClB,GAAG,IAAA,cAAI,EAAC,MAAM,CAAC;IACf,MAAM,EAAE,IAAA,gBAAM,EAAC,MAAM,CAAC;IACtB,GAAG,IAAA,gBAAM,EAAC,MAAM,CAAC;IACjB,SAAS,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC;IAC5B,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC;CACrB,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,44 @@ declare const api: (hostname?: string) => {
|
|
|
9
9
|
asset: {
|
|
10
10
|
getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: import("./helpers/asset").ResourceURLParams) => string;
|
|
11
11
|
};
|
|
12
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
13
|
+
count: number;
|
|
14
|
+
functions: import("./types").Function[];
|
|
15
|
+
}>;
|
|
16
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
17
|
+
count: number;
|
|
18
|
+
functions: import("./types").Function[];
|
|
19
|
+
}>;
|
|
20
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
21
|
+
function: import("./types").Function;
|
|
22
|
+
}>;
|
|
23
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
24
|
+
functionID: string;
|
|
25
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
26
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
27
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
28
|
+
functionID: string;
|
|
29
|
+
}>;
|
|
30
|
+
functions: {
|
|
31
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
32
|
+
count: number;
|
|
33
|
+
functions: import("./types").Function[];
|
|
34
|
+
}>;
|
|
35
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
36
|
+
count: number;
|
|
37
|
+
functions: import("./types").Function[];
|
|
38
|
+
}>;
|
|
39
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
40
|
+
function: import("./types").Function;
|
|
41
|
+
}>;
|
|
42
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
43
|
+
functionID: string;
|
|
44
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
45
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
46
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
47
|
+
functionID: string;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
12
50
|
getTopics: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
13
51
|
count: number;
|
|
14
52
|
topics: import("./types").Topic[];
|
package/dist/types.d.ts
CHANGED
|
@@ -632,6 +632,28 @@ export type IntentSlot = {
|
|
|
632
632
|
lastChangeTimestamp?: string;
|
|
633
633
|
lastChangeSessionID?: string;
|
|
634
634
|
};
|
|
635
|
+
export type FunctionParameter = {
|
|
636
|
+
parameterID?: string;
|
|
637
|
+
name: string;
|
|
638
|
+
description: string;
|
|
639
|
+
parameterType: 'string' | 'number' | 'integer' | 'boolean';
|
|
640
|
+
possibleValues?: string[];
|
|
641
|
+
required?: boolean;
|
|
642
|
+
};
|
|
643
|
+
export type Function = {
|
|
644
|
+
functionID?: string;
|
|
645
|
+
functionType: 'Internal' | 'WebHook';
|
|
646
|
+
name: string;
|
|
647
|
+
description: string;
|
|
648
|
+
parameters?: FunctionParameter[];
|
|
649
|
+
webHook: string;
|
|
650
|
+
httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
651
|
+
httpHeaders?: {
|
|
652
|
+
[key: string]: string;
|
|
653
|
+
};
|
|
654
|
+
httpQueryStringTemplate?: string;
|
|
655
|
+
httpBodyTemplate?: string;
|
|
656
|
+
};
|
|
635
657
|
export type CustomWord = {
|
|
636
658
|
customWordID: string;
|
|
637
659
|
word: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import memori from '../index';
|
|
2
|
-
const client = memori('https://backend
|
|
2
|
+
const client = memori('https://backend.memori.ai');
|
|
3
3
|
describe('backend/analysis api', () => {
|
|
4
4
|
it('works on analysis apis', async () => {
|
|
5
5
|
expect(await client.backend.analysis.analyzeUserQuery('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b', { query: 'test' })).not.toBeNull();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.test.js","sourceRoot":"","sources":["../../src/backend/analysis.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,MAAM,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"analysis.test.js","sourceRoot":"","sources":["../../src/backend/analysis.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,MAAM,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAEnD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACtC,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAC5C,sCAAsC,EACtC,sCAAsC,EACtC,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,gBAAgB,CACnC,sCAAsC,EACtC,sCAAsC,EACtC,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import memori from '../index';
|
|
2
|
-
const client = memori('https://backend
|
|
2
|
+
const client = memori('https://backend.memori.ai');
|
|
3
3
|
describe('backend/process api', () => {
|
|
4
4
|
it('works on process apis', async () => {
|
|
5
5
|
expect(await client.backend.process.getProcessStatus('768b9654-e781-4c3c-81fa-ae1529d1bfbe', 'be2e4a44-890b-483b-a26a-f6e122f36e2b')).not.toBeNull();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../src/backend/process.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,MAAM,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../src/backend/process.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,MAAM,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAEnD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAC3C,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,CACJ,MAAM,MAAM,CAAC,OAAO,CAAC,gBAAgB,CACnC,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResponseSpec, Function } from '../types';
|
|
2
|
+
declare const _default: (apiUrl: string) => {
|
|
3
|
+
getAllFunctions: (sessionId: string) => Promise<ResponseSpec & {
|
|
4
|
+
count: number;
|
|
5
|
+
functions: Function[];
|
|
6
|
+
}>;
|
|
7
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<ResponseSpec & {
|
|
8
|
+
count: number;
|
|
9
|
+
functions: Function[];
|
|
10
|
+
}>;
|
|
11
|
+
getFunction: (sessionId: string, functionID: string) => Promise<ResponseSpec & {
|
|
12
|
+
function: Function;
|
|
13
|
+
}>;
|
|
14
|
+
patchFunction: (sessionId: string, func: Partial<Function> & {
|
|
15
|
+
functionID: string;
|
|
16
|
+
}) => Promise<ResponseSpec>;
|
|
17
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<ResponseSpec>;
|
|
18
|
+
createFunction: (sessionId: string, func: Function) => Promise<ResponseSpec & {
|
|
19
|
+
functionID: string;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { apiFetcher } from '../apiFetcher';
|
|
2
|
+
export default (apiUrl) => ({
|
|
3
|
+
getAllFunctions: async (sessionId) => apiFetcher(`/Functions/${sessionId}`, {
|
|
4
|
+
method: 'GET',
|
|
5
|
+
apiUrl,
|
|
6
|
+
}),
|
|
7
|
+
getFunctionsPaginated: async (sessionId, from, howMany) => apiFetcher(`/Functions/${sessionId}/${from}/${howMany}`, {
|
|
8
|
+
method: 'GET',
|
|
9
|
+
apiUrl,
|
|
10
|
+
}),
|
|
11
|
+
getFunction: async (sessionId, functionID) => apiFetcher(`/Function/${sessionId}/${functionID}`, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
apiUrl,
|
|
14
|
+
}),
|
|
15
|
+
patchFunction: async (sessionId, func) => apiFetcher(`/Function/${sessionId}/${func.functionID}`, {
|
|
16
|
+
method: 'PATCH',
|
|
17
|
+
apiUrl,
|
|
18
|
+
body: func,
|
|
19
|
+
}),
|
|
20
|
+
deleteFunction: async (sessionId, functionID) => apiFetcher(`/Function/${sessionId}/${functionID}`, {
|
|
21
|
+
method: 'DELETE',
|
|
22
|
+
apiUrl,
|
|
23
|
+
}),
|
|
24
|
+
createFunction: async (sessionId, func) => apiFetcher(`/Function/${sessionId}`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
apiUrl,
|
|
27
|
+
body: func,
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/engine/functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,eAAe,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;IAKlC,eAAe,EAAE,KAAK,EAAE,SAAiB,EAAE,EAAE,CAC3C,UAAU,CAAC,cAAc,SAAS,EAAE,EAAE;QACpC,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAWA;IAQH,qBAAqB,EAAE,KAAK,EAC1B,SAAiB,EACjB,IAAY,EACZ,OAAe,EACf,EAAE,CACF,UAAU,CAAC,cAAc,SAAS,IAAI,IAAI,IAAI,OAAO,EAAE,EAAE;QACvD,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAWA;IAOH,WAAW,EAAE,KAAK,EAAE,SAAiB,EAAE,UAAkB,EAAE,EAAE,CAC3D,UAAU,CAAC,aAAa,SAAS,IAAI,UAAU,EAAE,EAAE;QACjD,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAIA;IAQH,aAAa,EAAE,KAAK,EAClB,SAAiB,EACjB,IAAgD,EAChD,EAAE,CACF,UAAU,CAAC,aAAa,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;QACtD,MAAM,EAAE,OAAO;QACf,MAAM;QACN,IAAI,EAAE,IAAI;KACX,CAA0B;IAO7B,cAAc,EAAE,KAAK,EAAE,SAAiB,EAAE,UAAkB,EAAE,EAAE,CAC9D,UAAU,CAAC,aAAa,SAAS,IAAI,UAAU,EAAE,EAAE;QACjD,MAAM,EAAE,QAAQ;QAChB,MAAM;KACP,CAA0B;IAO7B,cAAc,EAAE,KAAK,EAAE,SAAiB,EAAE,IAAc,EAAE,EAAE,CAC1D,UAAU,CAAC,aAAa,SAAS,EAAE,EAAE;QACnC,MAAM,EAAE,MAAM;QACd,MAAM;QACN,IAAI,EAAE,IAAI;KACX,CAIA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import memori from '../index';
|
|
2
|
+
const client = memori('https://backend.memori.ai');
|
|
3
|
+
describe('engine/functions api', () => {
|
|
4
|
+
it('works on functions apis', async () => {
|
|
5
|
+
expect(await client.functions.getFunction('768b9654-e781-4c3c-81fa-ae1529d1bfbe', '768b9654-e781-4c3c-81fa-ae1529d1bfbe')).not.toBeNull();
|
|
6
|
+
});
|
|
7
|
+
it('works on functions apis with shorthand version', async () => {
|
|
8
|
+
expect(await client.getFunction('768b9654-e781-4c3c-81fa-ae1529d1bfbe', '768b9654-e781-4c3c-81fa-ae1529d1bfbe')).not.toBeNull();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=functions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.test.js","sourceRoot":"","sources":["../../src/engine/functions.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,MAAM,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAEnD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,CACJ,MAAM,MAAM,CAAC,SAAS,CAAC,WAAW,CAChC,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;QAC9D,MAAM,CACJ,MAAM,MAAM,CAAC,WAAW,CACtB,sCAAsC,EACtC,sCAAsC,CACvC,CACF,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/esm/engine.d.ts
CHANGED
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
declare const _default: (apiUrl: string) => {
|
|
2
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
3
|
+
count: number;
|
|
4
|
+
functions: import("./types").Function[];
|
|
5
|
+
}>;
|
|
6
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
7
|
+
count: number;
|
|
8
|
+
functions: import("./types").Function[];
|
|
9
|
+
}>;
|
|
10
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
11
|
+
function: import("./types").Function;
|
|
12
|
+
}>;
|
|
13
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
14
|
+
functionID: string;
|
|
15
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
16
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
17
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
18
|
+
functionID: string;
|
|
19
|
+
}>;
|
|
20
|
+
functions: {
|
|
21
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
22
|
+
count: number;
|
|
23
|
+
functions: import("./types").Function[];
|
|
24
|
+
}>;
|
|
25
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
26
|
+
count: number;
|
|
27
|
+
functions: import("./types").Function[];
|
|
28
|
+
}>;
|
|
29
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
30
|
+
function: import("./types").Function;
|
|
31
|
+
}>;
|
|
32
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
33
|
+
functionID: string;
|
|
34
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
35
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
36
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
37
|
+
functionID: string;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
2
40
|
getTopics: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
3
41
|
count: number;
|
|
4
42
|
topics: import("./types").Topic[];
|
package/esm/engine.js
CHANGED
|
@@ -17,6 +17,7 @@ import expertReferences from './engine/expertReferences';
|
|
|
17
17
|
import knownFacts from './engine/knownFacts';
|
|
18
18
|
import user from './engine/user';
|
|
19
19
|
import topics from './engine/topics';
|
|
20
|
+
import functions from './engine/functions';
|
|
20
21
|
export default (apiUrl) => ({
|
|
21
22
|
correlationPairs: correlationPairs(apiUrl),
|
|
22
23
|
...correlationPairs(apiUrl),
|
|
@@ -56,5 +57,7 @@ export default (apiUrl) => ({
|
|
|
56
57
|
...user(apiUrl),
|
|
57
58
|
topics: topics(apiUrl),
|
|
58
59
|
...topics(apiUrl),
|
|
60
|
+
functions: functions(apiUrl),
|
|
61
|
+
...functions(apiUrl),
|
|
59
62
|
});
|
|
60
63
|
//# sourceMappingURL=engine.js.map
|
package/esm/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAC/D,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AACzD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,MAAM,MAAM,iB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,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;IAC5B,GAAG,SAAS,CAAC,MAAM,CAAC;CACrB,CAAC,CAAC"}
|
package/esm/index.d.ts
CHANGED
|
@@ -9,6 +9,44 @@ declare const api: (hostname?: string) => {
|
|
|
9
9
|
asset: {
|
|
10
10
|
getResourceUrl: ({ type, resourceURI, sessionID, baseURL, }: import("./helpers/asset").ResourceURLParams) => string;
|
|
11
11
|
};
|
|
12
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
13
|
+
count: number;
|
|
14
|
+
functions: import("./types").Function[];
|
|
15
|
+
}>;
|
|
16
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
17
|
+
count: number;
|
|
18
|
+
functions: import("./types").Function[];
|
|
19
|
+
}>;
|
|
20
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
21
|
+
function: import("./types").Function;
|
|
22
|
+
}>;
|
|
23
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
24
|
+
functionID: string;
|
|
25
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
26
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
27
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
28
|
+
functionID: string;
|
|
29
|
+
}>;
|
|
30
|
+
functions: {
|
|
31
|
+
getAllFunctions: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
32
|
+
count: number;
|
|
33
|
+
functions: import("./types").Function[];
|
|
34
|
+
}>;
|
|
35
|
+
getFunctionsPaginated: (sessionId: string, from: number, howMany: number) => Promise<import("./types").ResponseSpec & {
|
|
36
|
+
count: number;
|
|
37
|
+
functions: import("./types").Function[];
|
|
38
|
+
}>;
|
|
39
|
+
getFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec & {
|
|
40
|
+
function: import("./types").Function;
|
|
41
|
+
}>;
|
|
42
|
+
patchFunction: (sessionId: string, func: Partial<import("./types").Function> & {
|
|
43
|
+
functionID: string;
|
|
44
|
+
}) => Promise<import("./types").ResponseSpec>;
|
|
45
|
+
deleteFunction: (sessionId: string, functionID: string) => Promise<import("./types").ResponseSpec>;
|
|
46
|
+
createFunction: (sessionId: string, func: import("./types").Function) => Promise<import("./types").ResponseSpec & {
|
|
47
|
+
functionID: string;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
12
50
|
getTopics: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
13
51
|
count: number;
|
|
14
52
|
topics: import("./types").Topic[];
|
package/esm/types.d.ts
CHANGED
|
@@ -632,6 +632,28 @@ export type IntentSlot = {
|
|
|
632
632
|
lastChangeTimestamp?: string;
|
|
633
633
|
lastChangeSessionID?: string;
|
|
634
634
|
};
|
|
635
|
+
export type FunctionParameter = {
|
|
636
|
+
parameterID?: string;
|
|
637
|
+
name: string;
|
|
638
|
+
description: string;
|
|
639
|
+
parameterType: 'string' | 'number' | 'integer' | 'boolean';
|
|
640
|
+
possibleValues?: string[];
|
|
641
|
+
required?: boolean;
|
|
642
|
+
};
|
|
643
|
+
export type Function = {
|
|
644
|
+
functionID?: string;
|
|
645
|
+
functionType: 'Internal' | 'WebHook';
|
|
646
|
+
name: string;
|
|
647
|
+
description: string;
|
|
648
|
+
parameters?: FunctionParameter[];
|
|
649
|
+
webHook: string;
|
|
650
|
+
httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
651
|
+
httpHeaders?: {
|
|
652
|
+
[key: string]: string;
|
|
653
|
+
};
|
|
654
|
+
httpQueryStringTemplate?: string;
|
|
655
|
+
httpBodyTemplate?: string;
|
|
656
|
+
};
|
|
635
657
|
export type CustomWord = {
|
|
636
658
|
customWordID: string;
|
|
637
659
|
word: string;
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import memori from '../index';
|
|
2
|
+
|
|
3
|
+
const client = memori('https://backend.memori.ai');
|
|
4
|
+
|
|
5
|
+
describe('engine/functions api', () => {
|
|
6
|
+
it('works on functions apis', async () => {
|
|
7
|
+
expect(
|
|
8
|
+
await client.functions.getFunction(
|
|
9
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe',
|
|
10
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe'
|
|
11
|
+
)
|
|
12
|
+
).not.toBeNull();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('works on functions apis with shorthand version', async () => {
|
|
16
|
+
expect(
|
|
17
|
+
await client.getFunction(
|
|
18
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe',
|
|
19
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe'
|
|
20
|
+
)
|
|
21
|
+
).not.toBeNull();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { ResponseSpec, Function } from '../types';
|
|
2
|
+
import { apiFetcher } from '../apiFetcher';
|
|
3
|
+
|
|
4
|
+
/*********************
|
|
5
|
+
* *
|
|
6
|
+
* Functions *
|
|
7
|
+
* *
|
|
8
|
+
*********************/
|
|
9
|
+
|
|
10
|
+
export default (apiUrl: string) => ({
|
|
11
|
+
/**
|
|
12
|
+
* Lists all Functions objects.
|
|
13
|
+
* @param {string} sessionId The session ID
|
|
14
|
+
*/
|
|
15
|
+
getAllFunctions: async (sessionId: string) =>
|
|
16
|
+
apiFetcher(`/Functions/${sessionId}`, {
|
|
17
|
+
method: 'GET',
|
|
18
|
+
apiUrl,
|
|
19
|
+
}) as Promise<
|
|
20
|
+
ResponseSpec & {
|
|
21
|
+
/**
|
|
22
|
+
* Total number of Function objects.
|
|
23
|
+
*/
|
|
24
|
+
count: number;
|
|
25
|
+
/**
|
|
26
|
+
* List of Function objects. May be empty.
|
|
27
|
+
*/
|
|
28
|
+
functions: Function[];
|
|
29
|
+
}
|
|
30
|
+
>,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Lists Function objects with pagination.
|
|
34
|
+
* @param {string} sessionId The session ID
|
|
35
|
+
* @param {number} from The 0-based index of the first Function object to list
|
|
36
|
+
* @param {number} howMany The number of the Function objects to list
|
|
37
|
+
*/
|
|
38
|
+
getFunctionsPaginated: async (
|
|
39
|
+
sessionId: string,
|
|
40
|
+
from: number,
|
|
41
|
+
howMany: number
|
|
42
|
+
) =>
|
|
43
|
+
apiFetcher(`/Functions/${sessionId}/${from}/${howMany}`, {
|
|
44
|
+
method: 'GET',
|
|
45
|
+
apiUrl,
|
|
46
|
+
}) as Promise<
|
|
47
|
+
ResponseSpec & {
|
|
48
|
+
/**
|
|
49
|
+
* Total number of Function objects.
|
|
50
|
+
*/
|
|
51
|
+
count: number;
|
|
52
|
+
/**
|
|
53
|
+
* List of Function objects. May be empty.
|
|
54
|
+
*/
|
|
55
|
+
functions: Function[];
|
|
56
|
+
}
|
|
57
|
+
>,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the details of a Function object.
|
|
61
|
+
* @param {string} sessionId The session ID
|
|
62
|
+
* @param {string} functionID The Function object ID
|
|
63
|
+
*/
|
|
64
|
+
getFunction: async (sessionId: string, functionID: string) =>
|
|
65
|
+
apiFetcher(`/Function/${sessionId}/${functionID}`, {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
apiUrl,
|
|
68
|
+
}) as Promise<
|
|
69
|
+
ResponseSpec & {
|
|
70
|
+
function: Function;
|
|
71
|
+
}
|
|
72
|
+
>,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Updates an existing Function object.
|
|
76
|
+
* Only non-null (present) fields are considered for update. Null or absent fields are left unaltered.
|
|
77
|
+
* @param {string} sessionId The session ID
|
|
78
|
+
* @param {Function} func The Function object
|
|
79
|
+
*/
|
|
80
|
+
patchFunction: async (
|
|
81
|
+
sessionId: string,
|
|
82
|
+
func: Partial<Function> & { functionID: string }
|
|
83
|
+
) =>
|
|
84
|
+
apiFetcher(`/Function/${sessionId}/${func.functionID}`, {
|
|
85
|
+
method: 'PATCH',
|
|
86
|
+
apiUrl,
|
|
87
|
+
body: func,
|
|
88
|
+
}) as Promise<ResponseSpec>,
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Removes an existing Function object.
|
|
92
|
+
* @param {string} sessionId The session ID
|
|
93
|
+
* @param {string} functionID The Function object ID
|
|
94
|
+
*/
|
|
95
|
+
deleteFunction: async (sessionId: string, functionID: string) =>
|
|
96
|
+
apiFetcher(`/Function/${sessionId}/${functionID}`, {
|
|
97
|
+
method: 'DELETE',
|
|
98
|
+
apiUrl,
|
|
99
|
+
}) as Promise<ResponseSpec>,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new Function object.
|
|
103
|
+
* @param {string} sessionId The session ID
|
|
104
|
+
* @param {Function} func The Function object
|
|
105
|
+
*/
|
|
106
|
+
createFunction: async (sessionId: string, func: Function) =>
|
|
107
|
+
apiFetcher(`/Function/${sessionId}`, {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
apiUrl,
|
|
110
|
+
body: func,
|
|
111
|
+
}) as Promise<
|
|
112
|
+
ResponseSpec & {
|
|
113
|
+
functionID: string;
|
|
114
|
+
}
|
|
115
|
+
>,
|
|
116
|
+
});
|
package/src/engine.ts
CHANGED
|
@@ -17,6 +17,7 @@ import expertReferences from './engine/expertReferences';
|
|
|
17
17
|
import knownFacts from './engine/knownFacts';
|
|
18
18
|
import user from './engine/user';
|
|
19
19
|
import topics from './engine/topics';
|
|
20
|
+
import functions from './engine/functions';
|
|
20
21
|
|
|
21
22
|
export default (apiUrl: string) => ({
|
|
22
23
|
correlationPairs: correlationPairs(apiUrl),
|
|
@@ -57,4 +58,6 @@ export default (apiUrl: string) => ({
|
|
|
57
58
|
...user(apiUrl),
|
|
58
59
|
topics: topics(apiUrl),
|
|
59
60
|
...topics(apiUrl),
|
|
61
|
+
functions: functions(apiUrl),
|
|
62
|
+
...functions(apiUrl),
|
|
60
63
|
});
|
package/src/types.ts
CHANGED
|
@@ -1037,6 +1037,92 @@ export type IntentSlot = {
|
|
|
1037
1037
|
lastChangeSessionID?: string;
|
|
1038
1038
|
};
|
|
1039
1039
|
|
|
1040
|
+
export type FunctionParameter = {
|
|
1041
|
+
/**
|
|
1042
|
+
* Function Parameter object ID.
|
|
1043
|
+
*/
|
|
1044
|
+
parameterID?: string;
|
|
1045
|
+
/**
|
|
1046
|
+
* Name of the Function Parameter object.
|
|
1047
|
+
*/
|
|
1048
|
+
name: string;
|
|
1049
|
+
/**
|
|
1050
|
+
* Description of the Function Parameter object. The description is provided to the generative AI to help it understand the purpose of the parameter.
|
|
1051
|
+
*/
|
|
1052
|
+
description: string;
|
|
1053
|
+
/**
|
|
1054
|
+
* Parameter type, e.g. "string", "number", "integer", "boolean".
|
|
1055
|
+
* Currently supported types are:
|
|
1056
|
+
* - string: string value
|
|
1057
|
+
* - number: floating point value
|
|
1058
|
+
* - integer: integer value
|
|
1059
|
+
* - boolean: boolean value
|
|
1060
|
+
*/
|
|
1061
|
+
parameterType: 'string' | 'number' | 'integer' | 'boolean';
|
|
1062
|
+
/**
|
|
1063
|
+
* Optional list of possible values of the parameter. If empty or null, the parameter accepts any value of the specified type.
|
|
1064
|
+
*/
|
|
1065
|
+
possibleValues?: string[];
|
|
1066
|
+
/**
|
|
1067
|
+
* Whether the parameter is required or not. Default is not required.
|
|
1068
|
+
*/
|
|
1069
|
+
required?: boolean;
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
export type Function = {
|
|
1073
|
+
/**
|
|
1074
|
+
* Function object ID.
|
|
1075
|
+
*/
|
|
1076
|
+
functionID?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Function type, e.g. Internal or WebHook.
|
|
1079
|
+
* Internal functions are a limited subset implemented internally,
|
|
1080
|
+
* while WebHook intents perform an external HTTP call to the specified web hook, using the specified templates.
|
|
1081
|
+
*/
|
|
1082
|
+
functionType: 'Internal' | 'WebHook';
|
|
1083
|
+
/**
|
|
1084
|
+
* Name of the Function object.
|
|
1085
|
+
*/
|
|
1086
|
+
name: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* Description of the Function object. The description is provided to the generative AI to help it understand the purpose of the function.
|
|
1089
|
+
*/
|
|
1090
|
+
description: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* List of its Function Parameter objects. May be empty.
|
|
1093
|
+
*/
|
|
1094
|
+
parameters?: FunctionParameter[];
|
|
1095
|
+
/**
|
|
1096
|
+
* HTTP URL of the web hook to be called when the function is invoked, up to the path part.
|
|
1097
|
+
* The query string part is specified separately.
|
|
1098
|
+
* It may include the value of function parameters using the syntax {parameter}, where "parameter" is the parameter name.
|
|
1099
|
+
* E.g.: http://example.com/{param}/something.
|
|
1100
|
+
*/
|
|
1101
|
+
webHook: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* HTTP method to be used when calling the web hook, e.g. "GET", "POST" etc.
|
|
1104
|
+
*/
|
|
1105
|
+
httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
1106
|
+
/**
|
|
1107
|
+
* Optional set of HTTP headers to be passed to the web hook.
|
|
1108
|
+
*/
|
|
1109
|
+
httpHeaders?: { [key: string]: string };
|
|
1110
|
+
/**
|
|
1111
|
+
* Template of the HTTP query string to be passed to the web hook.
|
|
1112
|
+
* It may include the value of function parameters using the syntax {parameter}, where "parameter" is the parameter name.
|
|
1113
|
+
* E.g.: param1={param1}¶m2={param2}.
|
|
1114
|
+
*/
|
|
1115
|
+
httpQueryStringTemplate?: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* Template of the HTTP request body to be passed to the web hook.
|
|
1118
|
+
* It may be in any format (JSON, XML etc.), and may include the value of function parameters using the syntax {parameter},
|
|
1119
|
+
* where "parameter" is the parameter name.
|
|
1120
|
+
* E.g.: { "param1": "{param1}", "param2": "{param2}" },
|
|
1121
|
+
* or: <request><param1>{param1}</param1><param2>{param2}</param2></request>.
|
|
1122
|
+
*/
|
|
1123
|
+
httpBodyTemplate?: string;
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1040
1126
|
export type CustomWord = {
|
|
1041
1127
|
customWordID: string;
|
|
1042
1128
|
word: string;
|