@growsalesai/n8n-nodes-supermemory 0.1.4 → 0.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/dist/credentials/SupermemoryApi.credentials.d.ts +2 -1
- package/dist/credentials/SupermemoryApi.credentials.d.ts.map +1 -1
- package/dist/credentials/SupermemoryApi.credentials.js +8 -0
- package/dist/credentials/SupermemoryApi.credentials.js.map +1 -1
- package/dist/nodes/Supermemory/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/Supermemory/GenericFunctions.js +5 -1
- package/dist/nodes/Supermemory/GenericFunctions.js.map +1 -1
- package/dist/nodes/Supermemory/Supermemory.node.d.ts +6 -1
- package/dist/nodes/Supermemory/Supermemory.node.d.ts.map +1 -1
- package/dist/nodes/Supermemory/Supermemory.node.js +340 -43
- package/dist/nodes/Supermemory/Supermemory.node.js.map +1 -1
- package/dist/nodes/Supermemory/descriptions/ChatDescription.d.ts +4 -0
- package/dist/nodes/Supermemory/descriptions/ChatDescription.d.ts.map +1 -0
- package/dist/nodes/Supermemory/descriptions/ChatDescription.js +78 -0
- package/dist/nodes/Supermemory/descriptions/ChatDescription.js.map +1 -0
- package/dist/nodes/Supermemory/descriptions/ContainerTagDescription.d.ts.map +1 -1
- package/dist/nodes/Supermemory/descriptions/ContainerTagDescription.js +153 -6
- package/dist/nodes/Supermemory/descriptions/ContainerTagDescription.js.map +1 -1
- package/dist/nodes/Supermemory/descriptions/DocumentDescription.d.ts.map +1 -1
- package/dist/nodes/Supermemory/descriptions/DocumentDescription.js +397 -136
- package/dist/nodes/Supermemory/descriptions/DocumentDescription.js.map +1 -1
- package/dist/nodes/Supermemory/descriptions/ProfileDescription.d.ts.map +1 -1
- package/dist/nodes/Supermemory/descriptions/ProfileDescription.js +14 -13
- package/dist/nodes/Supermemory/descriptions/ProfileDescription.js.map +1 -1
- package/dist/nodes/Supermemory/descriptions/SearchDescription.d.ts +4 -0
- package/dist/nodes/Supermemory/descriptions/SearchDescription.d.ts.map +1 -0
- package/dist/nodes/Supermemory/descriptions/SearchDescription.js +111 -0
- package/dist/nodes/Supermemory/descriptions/SearchDescription.js.map +1 -0
- package/dist/nodes/Supermemory/descriptions/index.d.ts +1 -0
- package/dist/nodes/Supermemory/descriptions/index.d.ts.map +1 -1
- package/dist/nodes/Supermemory/descriptions/index.js +4 -1
- package/dist/nodes/Supermemory/descriptions/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
2
|
export declare class SupermemoryApi implements ICredentialType {
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
@@ -6,5 +6,6 @@ export declare class SupermemoryApi implements ICredentialType {
|
|
|
6
6
|
icon: "fa:brain";
|
|
7
7
|
properties: INodeProperties[];
|
|
8
8
|
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=SupermemoryApi.credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupermemoryApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/SupermemoryApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACpD,IAAI,SAAoB;IACxB,WAAW,SAAqB;IAChC,gBAAgB,SAAmD;IACnE,IAAI,EAAG,UAAU,CAAU;IAE3B,UAAU,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"SupermemoryApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/SupermemoryApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACpD,IAAI,SAAoB;IACxB,WAAW,SAAqB;IAChC,gBAAgB,SAAmD;IACnE,IAAI,EAAG,UAAU,CAAU;IAE3B,UAAU,EAAE,eAAe,EAAE,CAW3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAM1B;CACH"}
|
|
@@ -16,6 +16,7 @@ class SupermemoryApi {
|
|
|
16
16
|
default: '',
|
|
17
17
|
required: true,
|
|
18
18
|
description: 'API key from console.supermemory.ai. Scoped keys follow the pattern sm_orgId_...',
|
|
19
|
+
placeholder: 'sm_...',
|
|
19
20
|
},
|
|
20
21
|
];
|
|
21
22
|
this.authenticate = {
|
|
@@ -26,6 +27,13 @@ class SupermemoryApi {
|
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
};
|
|
30
|
+
this.test = {
|
|
31
|
+
request: {
|
|
32
|
+
baseURL: 'https://api.supermemory.ai',
|
|
33
|
+
url: '/v4/profile',
|
|
34
|
+
method: 'POST',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
exports.SupermemoryApi = SupermemoryApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupermemoryApi.credentials.js","sourceRoot":"","sources":["../../credentials/SupermemoryApi.credentials.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SupermemoryApi.credentials.js","sourceRoot":"","sources":["../../credentials/SupermemoryApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,cAAc;IAA3B;QACE,SAAI,GAAG,gBAAgB,CAAC;QACxB,gBAAW,GAAG,iBAAiB,CAAC;QAChC,qBAAgB,GAAG,+CAA+C,CAAC;QACnE,SAAI,GAAG,UAAmB,CAAC;QAE3B,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,kFAAkF;gBAC/F,WAAW,EAAE,QAAQ;aACtB;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,aAAa,EAAE,iCAAiC;iBACjD;aACF;SACF,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,4BAA4B;gBACrC,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,MAAM;aACf;SACF,CAAC;IACJ,CAAC;CAAA;AAnCD,wCAmCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.d.ts","sourceRoot":"","sources":["../../../nodes/Supermemory/GenericFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAuB,mBAAmB,EAA4B,MAAM,cAAc,CAAC;AAIlI,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,WAAW,EAClB,EAAE,CAAC,EAAE,WAAW,GACf,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"GenericFunctions.d.ts","sourceRoot":"","sources":["../../../nodes/Supermemory/GenericFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAuB,mBAAmB,EAA4B,MAAM,cAAc,CAAC;AAIlI,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,WAAW,EAClB,EAAE,CAAC,EAAE,WAAW,GACf,OAAO,CAAC,WAAW,CAAC,CA6BtB;AAED,wBAAgB,aAAa,CAC3B,cAAc,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,WAAW,CAcb;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAO7E"}
|
|
@@ -22,7 +22,11 @@ async function supermemoryApiRequest(method, endpoint, body, qs) {
|
|
|
22
22
|
options.qs = qs;
|
|
23
23
|
}
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
const response = await this.helpers.httpRequest(options);
|
|
26
|
+
if (response === undefined || response === null || response === '') {
|
|
27
|
+
return { success: true };
|
|
28
|
+
}
|
|
29
|
+
return response;
|
|
26
30
|
}
|
|
27
31
|
catch (error) {
|
|
28
32
|
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Supermemory/GenericFunctions.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Supermemory/GenericFunctions.ts"],"names":[],"mappings":";;AAIA,sDAmCC;AAED,sCAgBC;AAED,4CAOC;AAlED,+CAAkI;AAElI,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAEvC,KAAK,UAAU,qBAAqB,CAEzC,MAA2B,EAC3B,QAAgB,EAChB,IAAkB,EAClB,EAAgB;IAEhB,MAAM,WAAW,GAAG,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAuB,CAAC;IAExF,MAAM,OAAO,GAAwB;QACnC,MAAM;QACN,GAAG,EAAE,GAAG,QAAQ,GAAG,QAAQ,EAAE;QAC7B,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,WAAW,CAAC,MAAM,EAAE;SAC9C;KACF,CAAC;IAEF,IAAI,IAAI,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;YACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QACD,OAAO,QAAuB,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAC3B,cAAqD;IAErD,MAAM,QAAQ,GAAgB,EAAE,CAAC;IACjC,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,cAAc,EAAE,CAAC;QAC5C,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,KAAK,KAAK,MAAM;gBAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;iBACtC,IAAI,KAAK,KAAK,OAAO;gBAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;iBAC7C,CAAC;gBACJ,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE;oBAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;;oBAChD,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAChE,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAgB,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,4BAA4B,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
1
|
+
import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
2
|
export declare class Supermemory implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getContainerTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
4
9
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
10
|
}
|
|
6
11
|
//# sourceMappingURL=Supermemory.node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Supermemory.node.d.ts","sourceRoot":"","sources":["../../../nodes/Supermemory/Supermemory.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAGrB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Supermemory.node.d.ts","sourceRoot":"","sources":["../../../nodes/Supermemory/Supermemory.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,oBAAoB,EAGrB,MAAM,cAAc,CAAC;AAiBtB,qBAAa,WAAY,YAAW,SAAS;IAC3C,WAAW,EAAE,oBAAoB,CA4D/B;IAEF,OAAO;;mCAE0B,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;;MAgCtF;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAicxE"}
|
|
@@ -4,6 +4,7 @@ exports.Supermemory = void 0;
|
|
|
4
4
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
5
|
const descriptions_1 = require("./descriptions");
|
|
6
6
|
const GenericFunctions_1 = require("./GenericFunctions");
|
|
7
|
+
const BASE_URL = 'https://api.supermemory.ai';
|
|
7
8
|
class Supermemory {
|
|
8
9
|
constructor() {
|
|
9
10
|
this.description = {
|
|
@@ -13,10 +14,11 @@ class Supermemory {
|
|
|
13
14
|
group: ['transform'],
|
|
14
15
|
version: 1,
|
|
15
16
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
16
|
-
description: 'Interact with Supermemory — AI-powered memory and
|
|
17
|
+
description: 'Interact with Supermemory — AI-powered memory, document management, and semantic search',
|
|
17
18
|
defaults: {
|
|
18
19
|
name: 'Supermemory - Growsales AI',
|
|
19
20
|
},
|
|
21
|
+
usableAsTool: true,
|
|
20
22
|
inputs: ['main'],
|
|
21
23
|
outputs: ['main'],
|
|
22
24
|
credentials: [
|
|
@@ -26,7 +28,6 @@ class Supermemory {
|
|
|
26
28
|
},
|
|
27
29
|
],
|
|
28
30
|
properties: [
|
|
29
|
-
// ── Resource selector ──────────────────────────────────────
|
|
30
31
|
{
|
|
31
32
|
displayName: 'Resource',
|
|
32
33
|
name: 'resource',
|
|
@@ -36,43 +37,179 @@ class Supermemory {
|
|
|
36
37
|
{
|
|
37
38
|
name: 'Document',
|
|
38
39
|
value: 'document',
|
|
39
|
-
description: 'Add, update, list, and
|
|
40
|
+
description: 'Add, update, copy, delete, list, and get chunks from documents',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Search',
|
|
44
|
+
value: 'search',
|
|
45
|
+
description: 'Semantic search across stored memories and document chunks',
|
|
40
46
|
},
|
|
41
47
|
{
|
|
42
48
|
name: 'Container Tag',
|
|
43
49
|
value: 'containerTag',
|
|
44
|
-
description: '
|
|
50
|
+
description: 'List, configure, merge, and delete container tags',
|
|
45
51
|
},
|
|
46
52
|
{
|
|
47
53
|
name: 'Profile',
|
|
48
54
|
value: 'profile',
|
|
49
|
-
description: 'Retrieve user profile
|
|
55
|
+
description: 'Retrieve a structured AI-generated user profile from stored memories',
|
|
50
56
|
},
|
|
51
57
|
],
|
|
52
58
|
default: 'document',
|
|
53
59
|
},
|
|
54
|
-
// ── Operations & fields per resource ───────────────────────
|
|
55
60
|
...descriptions_1.documentOperations,
|
|
56
61
|
...descriptions_1.documentFields,
|
|
62
|
+
...descriptions_1.searchOperations,
|
|
63
|
+
...descriptions_1.searchFields,
|
|
57
64
|
...descriptions_1.containerTagOperations,
|
|
58
65
|
...descriptions_1.containerTagFields,
|
|
59
66
|
...descriptions_1.profileOperations,
|
|
60
67
|
...descriptions_1.profileFields,
|
|
61
68
|
],
|
|
62
69
|
};
|
|
70
|
+
this.methods = {
|
|
71
|
+
loadOptions: {
|
|
72
|
+
async getContainerTags() {
|
|
73
|
+
var _a;
|
|
74
|
+
const credentials = (await this.getCredentials('supermemoryApi'));
|
|
75
|
+
try {
|
|
76
|
+
const response = await this.helpers.httpRequest({
|
|
77
|
+
method: 'POST',
|
|
78
|
+
url: `${BASE_URL}/v3/documents/list`,
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Type': 'application/json',
|
|
81
|
+
Authorization: `Bearer ${credentials.apiKey}`,
|
|
82
|
+
},
|
|
83
|
+
body: { limit: 200 },
|
|
84
|
+
});
|
|
85
|
+
const memories = (_a = response.memories) !== null && _a !== void 0 ? _a : [];
|
|
86
|
+
const tags = new Set();
|
|
87
|
+
for (const doc of memories) {
|
|
88
|
+
if (doc.containerTag && typeof doc.containerTag === 'string') {
|
|
89
|
+
tags.add(doc.containerTag);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return Array.from(tags).sort().map((tag) => ({
|
|
93
|
+
name: tag,
|
|
94
|
+
value: tag,
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
63
103
|
}
|
|
64
104
|
async execute() {
|
|
65
|
-
var _a, _b, _c;
|
|
105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
66
106
|
const items = this.getInputData();
|
|
67
107
|
const returnData = [];
|
|
108
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
109
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
110
|
+
// ── BATCH ADD ────────────────────────────────────────────────────
|
|
111
|
+
if (resource === 'document' && operation === 'batchAdd') {
|
|
112
|
+
const documents = [];
|
|
113
|
+
for (let i = 0; i < items.length; i++) {
|
|
114
|
+
const content = this.getNodeParameter('content', i);
|
|
115
|
+
const fields = this.getNodeParameter('batchDocumentFields', i);
|
|
116
|
+
const doc = { content };
|
|
117
|
+
if (fields.containerTag)
|
|
118
|
+
doc.containerTag = fields.containerTag;
|
|
119
|
+
if (fields.customId)
|
|
120
|
+
doc.customId = fields.customId;
|
|
121
|
+
if (fields.entityContext)
|
|
122
|
+
doc.entityContext = fields.entityContext;
|
|
123
|
+
if (fields.taskType)
|
|
124
|
+
doc.taskType = fields.taskType;
|
|
125
|
+
if (fields.metadata) {
|
|
126
|
+
const metaCollection = fields.metadata;
|
|
127
|
+
if ((_a = metaCollection.metadataValues) === null || _a === void 0 ? void 0 : _a.length) {
|
|
128
|
+
doc.metadata = (0, GenericFunctions_1.buildMetadata)(metaCollection.metadataValues);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
documents.push(doc);
|
|
132
|
+
}
|
|
133
|
+
const responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents/batch', { documents });
|
|
134
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: 0 } });
|
|
135
|
+
return [[...executionData]];
|
|
136
|
+
}
|
|
137
|
+
// ── BATCH DELETE ─────────────────────────────────────────────────
|
|
138
|
+
if (resource === 'document' && operation === 'batchDelete') {
|
|
139
|
+
const results = [];
|
|
140
|
+
for (let i = 0; i < items.length; i++) {
|
|
141
|
+
const documentId = this.getNodeParameter('documentId', i);
|
|
142
|
+
if (!documentId)
|
|
143
|
+
continue;
|
|
144
|
+
try {
|
|
145
|
+
await GenericFunctions_1.supermemoryApiRequest.call(this, 'DELETE', `/v3/documents/${encodeURIComponent(documentId)}`);
|
|
146
|
+
results.push({ success: true, deleted: documentId });
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if (this.continueOnFail()) {
|
|
150
|
+
results.push({ success: false, documentId, error: error.message });
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(results), { itemData: { item: 0 } });
|
|
158
|
+
return [[...executionData]];
|
|
159
|
+
}
|
|
160
|
+
// ── BATCH UPDATE ─────────────────────────────────────────────────
|
|
161
|
+
if (resource === 'document' && operation === 'batchUpdate') {
|
|
162
|
+
const results = [];
|
|
163
|
+
for (let i = 0; i < items.length; i++) {
|
|
164
|
+
const documentId = this.getNodeParameter('documentId', i);
|
|
165
|
+
const updateFields = this.getNodeParameter('batchUpdateFields', i);
|
|
166
|
+
if (!documentId) {
|
|
167
|
+
if (this.continueOnFail()) {
|
|
168
|
+
results.push({ success: false, error: 'Document ID is required', itemIndex: i });
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document ID is required', { itemIndex: i });
|
|
172
|
+
}
|
|
173
|
+
const body = {};
|
|
174
|
+
if (updateFields.content)
|
|
175
|
+
body.content = updateFields.content;
|
|
176
|
+
if (updateFields.containerTag)
|
|
177
|
+
body.containerTag = updateFields.containerTag;
|
|
178
|
+
if (updateFields.customId)
|
|
179
|
+
body.customId = updateFields.customId;
|
|
180
|
+
if (updateFields.taskType)
|
|
181
|
+
body.taskType = updateFields.taskType;
|
|
182
|
+
if (updateFields.metadata) {
|
|
183
|
+
const metaCollection = updateFields.metadata;
|
|
184
|
+
if ((_b = metaCollection.metadataValues) === null || _b === void 0 ? void 0 : _b.length) {
|
|
185
|
+
body.metadata = (0, GenericFunctions_1.buildMetadata)(metaCollection.metadataValues);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const result = await GenericFunctions_1.supermemoryApiRequest.call(this, 'PATCH', `/v3/documents/${encodeURIComponent(documentId)}`, body);
|
|
190
|
+
results.push(result);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
if (this.continueOnFail()) {
|
|
194
|
+
results.push({ success: false, documentId, error: error.message });
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(results), { itemData: { item: 0 } });
|
|
202
|
+
return [[...executionData]];
|
|
203
|
+
}
|
|
204
|
+
// ── PER-ITEM OPERATIONS ──────────────────────────────────────────
|
|
68
205
|
for (let i = 0; i < items.length; i++) {
|
|
69
206
|
try {
|
|
70
|
-
const
|
|
71
|
-
const
|
|
207
|
+
const res = this.getNodeParameter('resource', i);
|
|
208
|
+
const op = this.getNodeParameter('operation', i);
|
|
72
209
|
let responseData;
|
|
73
|
-
// ── DOCUMENT
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
210
|
+
// ── DOCUMENT ────────────────────────────────────────────────
|
|
211
|
+
if (res === 'document') {
|
|
212
|
+
if (op === 'add') {
|
|
76
213
|
const content = this.getNodeParameter('content', i);
|
|
77
214
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
78
215
|
const body = { content };
|
|
@@ -86,13 +223,19 @@ class Supermemory {
|
|
|
86
223
|
body.taskType = additionalFields.taskType;
|
|
87
224
|
if (additionalFields.metadata) {
|
|
88
225
|
const metaCollection = additionalFields.metadata;
|
|
89
|
-
if ((
|
|
226
|
+
if ((_c = metaCollection.metadataValues) === null || _c === void 0 ? void 0 : _c.length) {
|
|
90
227
|
body.metadata = (0, GenericFunctions_1.buildMetadata)(metaCollection.metadataValues);
|
|
91
228
|
}
|
|
92
229
|
}
|
|
93
230
|
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents', body);
|
|
94
231
|
}
|
|
95
|
-
else if (
|
|
232
|
+
else if (op === 'get') {
|
|
233
|
+
const documentId = this.getNodeParameter('documentId', i);
|
|
234
|
+
if (!documentId)
|
|
235
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document ID is required', { itemIndex: i });
|
|
236
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'GET', `/v3/documents/${encodeURIComponent(documentId)}`);
|
|
237
|
+
}
|
|
238
|
+
else if (op === 'update') {
|
|
96
239
|
const documentId = this.getNodeParameter('documentId', i);
|
|
97
240
|
const updateFields = this.getNodeParameter('updateFields', i);
|
|
98
241
|
if (!documentId)
|
|
@@ -108,69 +251,223 @@ class Supermemory {
|
|
|
108
251
|
body.taskType = updateFields.taskType;
|
|
109
252
|
if (updateFields.metadata) {
|
|
110
253
|
const metaCollection = updateFields.metadata;
|
|
111
|
-
if ((
|
|
254
|
+
if ((_d = metaCollection.metadataValues) === null || _d === void 0 ? void 0 : _d.length) {
|
|
112
255
|
body.metadata = (0, GenericFunctions_1.buildMetadata)(metaCollection.metadataValues);
|
|
113
256
|
}
|
|
114
257
|
}
|
|
115
|
-
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'PATCH', `/v3/documents/${documentId}`, body);
|
|
258
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'PATCH', `/v3/documents/${encodeURIComponent(documentId)}`, body);
|
|
116
259
|
}
|
|
117
|
-
else if (
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
260
|
+
else if (op === 'delete') {
|
|
261
|
+
const documentId = this.getNodeParameter('documentId', i);
|
|
262
|
+
if (!documentId)
|
|
263
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document ID is required for delete', { itemIndex: i });
|
|
264
|
+
await GenericFunctions_1.supermemoryApiRequest.call(this, 'DELETE', `/v3/documents/${encodeURIComponent(documentId)}`);
|
|
265
|
+
responseData = { success: true, deleted: documentId };
|
|
266
|
+
}
|
|
267
|
+
else if (op === 'copy') {
|
|
268
|
+
const documentId = this.getNodeParameter('documentId', i);
|
|
269
|
+
const targetContainerTag = this.getNodeParameter('copyTargetTag', i);
|
|
270
|
+
const copyOptions = this.getNodeParameter('copyOptions', i, {});
|
|
271
|
+
if (!documentId)
|
|
272
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document ID is required', { itemIndex: i });
|
|
273
|
+
if (!targetContainerTag)
|
|
274
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Target Container Tag is required', { itemIndex: i });
|
|
275
|
+
const sourceDoc = await GenericFunctions_1.supermemoryApiRequest.call(this, 'GET', `/v3/documents/${encodeURIComponent(documentId)}`);
|
|
276
|
+
const sourceContent = (sourceDoc.content || sourceDoc.rawContent || '');
|
|
277
|
+
const body = { content: sourceContent, containerTag: targetContainerTag };
|
|
278
|
+
if (copyOptions.copyMetadata !== false && sourceDoc.metadata) {
|
|
279
|
+
body.metadata = sourceDoc.metadata;
|
|
280
|
+
}
|
|
281
|
+
if (copyOptions.customId) {
|
|
282
|
+
body.customId = copyOptions.customId;
|
|
124
283
|
}
|
|
284
|
+
else if (sourceDoc.customId) {
|
|
285
|
+
body.customId = `${sourceDoc.customId}-copy`;
|
|
286
|
+
}
|
|
287
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents', body);
|
|
288
|
+
}
|
|
289
|
+
else if (op === 'list') {
|
|
290
|
+
const returnAll = this.getNodeParameter('returnAll', i, false);
|
|
291
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
292
|
+
const containerTagsList = this.getNodeParameter('containerTagsList', i);
|
|
125
293
|
const filtersJson = this.getNodeParameter('filtersJson', i, '');
|
|
126
294
|
const filters = (0, GenericFunctions_1.parseFiltersJson)(filtersJson);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
295
|
+
const buildBody = (page) => {
|
|
296
|
+
var _a;
|
|
297
|
+
const body = { limit };
|
|
298
|
+
if (page > 1)
|
|
299
|
+
body.page = page;
|
|
300
|
+
if ((_a = containerTagsList.tags) === null || _a === void 0 ? void 0 : _a.length) {
|
|
301
|
+
body.containerTags = containerTagsList.tags.map((t) => t.tag).filter(Boolean);
|
|
302
|
+
}
|
|
303
|
+
if (filters)
|
|
304
|
+
body.filters = filters;
|
|
305
|
+
return body;
|
|
306
|
+
};
|
|
307
|
+
if (returnAll) {
|
|
308
|
+
const allMemories = [];
|
|
309
|
+
let currentPage = 1;
|
|
310
|
+
let totalPages = 1;
|
|
311
|
+
do {
|
|
312
|
+
const pageResponse = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents/list', buildBody(currentPage));
|
|
313
|
+
const memories = (_e = pageResponse.memories) !== null && _e !== void 0 ? _e : [];
|
|
314
|
+
allMemories.push(...memories);
|
|
315
|
+
const pagination = pageResponse.pagination;
|
|
316
|
+
totalPages = (_f = pagination === null || pagination === void 0 ? void 0 : pagination.totalPages) !== null && _f !== void 0 ? _f : 1;
|
|
317
|
+
currentPage++;
|
|
318
|
+
} while (currentPage <= totalPages);
|
|
319
|
+
responseData = allMemories;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
const page = this.getNodeParameter('page', i, 1);
|
|
323
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents/list', buildBody(page));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else if (op === 'getChunks') {
|
|
327
|
+
const chunksSource = this.getNodeParameter('chunksSource', i);
|
|
328
|
+
if (chunksSource === 'byId') {
|
|
329
|
+
const documentId = this.getNodeParameter('documentId', i);
|
|
330
|
+
if (!documentId)
|
|
331
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document ID is required', { itemIndex: i });
|
|
332
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'GET', `/v3/documents/${encodeURIComponent(documentId)}/chunks`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
const chunksAllOptions = this.getNodeParameter('chunksAllOptions', i, {});
|
|
336
|
+
const maxDocuments = (_g = chunksAllOptions.maxDocuments) !== null && _g !== void 0 ? _g : 100;
|
|
337
|
+
const listBody = { limit: maxDocuments };
|
|
338
|
+
if (chunksAllOptions.containerTag) {
|
|
339
|
+
listBody.containerTags = [chunksAllOptions.containerTag];
|
|
340
|
+
}
|
|
341
|
+
const listResponse = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents/list', listBody);
|
|
342
|
+
const memories = (_h = listResponse.memories) !== null && _h !== void 0 ? _h : [];
|
|
343
|
+
const allChunks = [];
|
|
344
|
+
for (const doc of memories) {
|
|
345
|
+
const docId = doc.id;
|
|
346
|
+
if (!docId)
|
|
347
|
+
continue;
|
|
348
|
+
try {
|
|
349
|
+
const chunkResponse = await GenericFunctions_1.supermemoryApiRequest.call(this, 'GET', `/v3/documents/${encodeURIComponent(docId)}/chunks`);
|
|
350
|
+
allChunks.push({
|
|
351
|
+
documentId: docId,
|
|
352
|
+
documentTitle: doc.title,
|
|
353
|
+
...chunkResponse,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
// skip documents that fail chunk retrieval
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
responseData = allChunks;
|
|
361
|
+
}
|
|
130
362
|
}
|
|
131
|
-
else
|
|
363
|
+
else {
|
|
364
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown document operation: ${op}`, { itemIndex: i });
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// ── SEARCH ──────────────────────────────────────────────────
|
|
368
|
+
else if (res === 'search') {
|
|
369
|
+
if (op === 'search') {
|
|
132
370
|
const query = this.getNodeParameter('query', i);
|
|
133
371
|
const searchAdditionalFields = this.getNodeParameter('searchAdditionalFields', i);
|
|
134
372
|
const body = { q: query };
|
|
135
373
|
if (searchAdditionalFields.containerTag)
|
|
136
374
|
body.containerTag = searchAdditionalFields.containerTag;
|
|
137
|
-
if (searchAdditionalFields.
|
|
138
|
-
body.
|
|
139
|
-
if (searchAdditionalFields.
|
|
140
|
-
body.
|
|
375
|
+
if (searchAdditionalFields.searchMode)
|
|
376
|
+
body.searchMode = searchAdditionalFields.searchMode;
|
|
377
|
+
if (searchAdditionalFields.limit)
|
|
378
|
+
body.limit = searchAdditionalFields.limit;
|
|
379
|
+
if (searchAdditionalFields.rerank !== undefined)
|
|
380
|
+
body.rerank = searchAdditionalFields.rerank;
|
|
381
|
+
if (searchAdditionalFields.threshold !== undefined &&
|
|
382
|
+
searchAdditionalFields.threshold !== '' &&
|
|
383
|
+
searchAdditionalFields.threshold > 0) {
|
|
384
|
+
body.threshold = searchAdditionalFields.threshold;
|
|
141
385
|
}
|
|
142
386
|
const filtersJson = searchAdditionalFields.filtersJson || '';
|
|
143
387
|
const filters = (0, GenericFunctions_1.parseFiltersJson)(filtersJson);
|
|
144
388
|
if (filters)
|
|
145
389
|
body.filters = filters;
|
|
146
|
-
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/
|
|
390
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v4/search', body);
|
|
147
391
|
}
|
|
148
392
|
else {
|
|
149
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown
|
|
393
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown search operation: ${op}`, { itemIndex: i });
|
|
150
394
|
}
|
|
151
395
|
}
|
|
152
|
-
// ── CONTAINER TAG
|
|
153
|
-
else if (
|
|
154
|
-
if (
|
|
396
|
+
// ── CONTAINER TAG ────────────────────────────────────────────
|
|
397
|
+
else if (res === 'containerTag') {
|
|
398
|
+
if (op === 'list') {
|
|
399
|
+
const listTagOptions = this.getNodeParameter('listTagOptions', i, {});
|
|
400
|
+
const scanLimit = (_j = listTagOptions.scanLimit) !== null && _j !== void 0 ? _j : 200;
|
|
401
|
+
const listResponse = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents/list', { limit: scanLimit });
|
|
402
|
+
const memories = (_k = listResponse.memories) !== null && _k !== void 0 ? _k : [];
|
|
403
|
+
const tagMap = new Map();
|
|
404
|
+
for (const doc of memories) {
|
|
405
|
+
if (doc.containerTag && typeof doc.containerTag === 'string') {
|
|
406
|
+
tagMap.set(doc.containerTag, ((_l = tagMap.get(doc.containerTag)) !== null && _l !== void 0 ? _l : 0) + 1);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
responseData = Array.from(tagMap.entries())
|
|
410
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
411
|
+
.map(([tag, count]) => ({ containerTag: tag, documentCount: count }));
|
|
412
|
+
}
|
|
413
|
+
else if (op === 'getSettings') {
|
|
155
414
|
const containerTag = this.getNodeParameter('containerTag', i);
|
|
156
415
|
if (!containerTag)
|
|
157
416
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Container Tag is required', { itemIndex: i });
|
|
158
417
|
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'GET', `/v3/container-tags/${encodeURIComponent(containerTag)}`);
|
|
159
418
|
}
|
|
419
|
+
else if (op === 'updateSettings') {
|
|
420
|
+
const containerTag = this.getNodeParameter('containerTag', i);
|
|
421
|
+
const tagUpdateFields = this.getNodeParameter('tagUpdateFields', i);
|
|
422
|
+
if (!containerTag)
|
|
423
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Container Tag is required', { itemIndex: i });
|
|
424
|
+
const body = {};
|
|
425
|
+
if (tagUpdateFields.entityContext !== undefined && tagUpdateFields.entityContext !== '') {
|
|
426
|
+
body.entityContext = tagUpdateFields.entityContext;
|
|
427
|
+
}
|
|
428
|
+
if (tagUpdateFields.memoryFilesystemPaths !== undefined && tagUpdateFields.memoryFilesystemPaths !== '') {
|
|
429
|
+
const raw = tagUpdateFields.memoryFilesystemPaths;
|
|
430
|
+
body.memoryFilesystemPaths = raw.split(',').map((p) => p.trim()).filter(Boolean);
|
|
431
|
+
}
|
|
432
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'PATCH', `/v3/container-tags/${encodeURIComponent(containerTag)}`, body);
|
|
433
|
+
}
|
|
434
|
+
else if (op === 'merge') {
|
|
435
|
+
const sourceA = this.getNodeParameter('mergeSourceA', i);
|
|
436
|
+
const sourceB = this.getNodeParameter('mergeSourceB', i);
|
|
437
|
+
const target = this.getNodeParameter('mergeTarget', i);
|
|
438
|
+
if (!sourceA || !sourceB)
|
|
439
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Both source tags are required for merge', { itemIndex: i });
|
|
440
|
+
if (!target)
|
|
441
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Target tag is required for merge', { itemIndex: i });
|
|
442
|
+
if (sourceA === sourceB)
|
|
443
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Source tags must be different', { itemIndex: i });
|
|
444
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/container-tags/merge', {
|
|
445
|
+
containerTags: [sourceA, sourceB],
|
|
446
|
+
targetContainerTag: target,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
else if (op === 'delete') {
|
|
450
|
+
const containerTag = this.getNodeParameter('containerTag', i);
|
|
451
|
+
if (!containerTag)
|
|
452
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Container Tag is required', { itemIndex: i });
|
|
453
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'DELETE', `/v3/container-tags/${encodeURIComponent(containerTag)}`);
|
|
454
|
+
}
|
|
160
455
|
else {
|
|
161
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown container tag operation: ${
|
|
456
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown container tag operation: ${op}`, { itemIndex: i });
|
|
162
457
|
}
|
|
163
458
|
}
|
|
164
|
-
// ── PROFILE
|
|
165
|
-
else if (
|
|
166
|
-
if (
|
|
459
|
+
// ── PROFILE ──────────────────────────────────────────────────
|
|
460
|
+
else if (res === 'profile') {
|
|
461
|
+
if (op === 'get') {
|
|
167
462
|
const profileAdditionalFields = this.getNodeParameter('profileAdditionalFields', i);
|
|
168
463
|
const body = {};
|
|
169
464
|
if (profileAdditionalFields.q)
|
|
170
465
|
body.q = profileAdditionalFields.q;
|
|
171
466
|
if (profileAdditionalFields.containerTag)
|
|
172
467
|
body.containerTag = profileAdditionalFields.containerTag;
|
|
173
|
-
if (profileAdditionalFields.threshold !== undefined &&
|
|
468
|
+
if (profileAdditionalFields.threshold !== undefined &&
|
|
469
|
+
profileAdditionalFields.threshold !== '' &&
|
|
470
|
+
profileAdditionalFields.threshold > 0) {
|
|
174
471
|
body.threshold = profileAdditionalFields.threshold;
|
|
175
472
|
}
|
|
176
473
|
const filtersJson = profileAdditionalFields.filtersJson || '';
|
|
@@ -180,11 +477,11 @@ class Supermemory {
|
|
|
180
477
|
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v4/profile', body);
|
|
181
478
|
}
|
|
182
479
|
else {
|
|
183
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown profile operation: ${
|
|
480
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown profile operation: ${op}`, { itemIndex: i });
|
|
184
481
|
}
|
|
185
482
|
}
|
|
186
483
|
else {
|
|
187
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${
|
|
484
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${res}`, { itemIndex: i });
|
|
188
485
|
}
|
|
189
486
|
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(Array.isArray(responseData) ? responseData : [responseData]), { itemData: { item: i } });
|
|
190
487
|
returnData.push(...executionData);
|