@growsalesai/n8n-nodes-supermemory 0.1.4 → 0.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/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 +349 -39
- 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 +446 -115
- 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/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;CAkdxE"}
|
|
@@ -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 RAG-based Q&A',
|
|
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 search documents',
|
|
40
|
+
description: 'Add, update, copy, delete, list, and search documents',
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
name: 'Container Tag',
|
|
43
44
|
value: 'containerTag',
|
|
44
|
-
description: '
|
|
45
|
+
description: 'List, configure, merge, and delete container tags',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Memory Chat',
|
|
49
|
+
value: 'chat',
|
|
50
|
+
description: 'Ask questions answered by AI using your stored memories',
|
|
45
51
|
},
|
|
46
52
|
{
|
|
47
53
|
name: 'Profile',
|
|
48
54
|
value: 'profile',
|
|
49
|
-
description: 'Retrieve user profile
|
|
55
|
+
description: 'Retrieve a structured user profile built 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,
|
|
57
62
|
...descriptions_1.containerTagOperations,
|
|
58
63
|
...descriptions_1.containerTagFields,
|
|
64
|
+
...descriptions_1.chatOperations,
|
|
65
|
+
...descriptions_1.chatFields,
|
|
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: 1100 },
|
|
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,27 +251,116 @@ 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;
|
|
283
|
+
}
|
|
284
|
+
else if (sourceDoc.customId) {
|
|
285
|
+
body.customId = `${sourceDoc.customId}-copy`;
|
|
124
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
|
+
}
|
|
130
325
|
}
|
|
131
|
-
else if (
|
|
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
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else if (op === 'search') {
|
|
132
364
|
const query = this.getNodeParameter('query', i);
|
|
133
365
|
const searchAdditionalFields = this.getNodeParameter('searchAdditionalFields', i);
|
|
134
366
|
const body = { q: query };
|
|
@@ -136,7 +368,11 @@ class Supermemory {
|
|
|
136
368
|
body.containerTag = searchAdditionalFields.containerTag;
|
|
137
369
|
if (searchAdditionalFields.docId)
|
|
138
370
|
body.docId = searchAdditionalFields.docId;
|
|
139
|
-
if (searchAdditionalFields.
|
|
371
|
+
if (searchAdditionalFields.limit)
|
|
372
|
+
body.limit = searchAdditionalFields.limit;
|
|
373
|
+
if (searchAdditionalFields.chunkThreshold !== undefined &&
|
|
374
|
+
searchAdditionalFields.chunkThreshold !== '' &&
|
|
375
|
+
searchAdditionalFields.chunkThreshold > 0) {
|
|
140
376
|
body.chunkThreshold = searchAdditionalFields.chunkThreshold;
|
|
141
377
|
}
|
|
142
378
|
const filtersJson = searchAdditionalFields.filtersJson || '';
|
|
@@ -146,31 +382,105 @@ class Supermemory {
|
|
|
146
382
|
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/search', body);
|
|
147
383
|
}
|
|
148
384
|
else {
|
|
149
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown document operation: ${
|
|
385
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown document operation: ${op}`, { itemIndex: i });
|
|
150
386
|
}
|
|
151
387
|
}
|
|
152
|
-
// ── CONTAINER TAG
|
|
153
|
-
else if (
|
|
154
|
-
if (
|
|
388
|
+
// ── CONTAINER TAG ────────────────────────────────────────────
|
|
389
|
+
else if (res === 'containerTag') {
|
|
390
|
+
if (op === 'list') {
|
|
391
|
+
const listTagOptions = this.getNodeParameter('listTagOptions', i, {});
|
|
392
|
+
const scanLimit = (_j = listTagOptions.scanLimit) !== null && _j !== void 0 ? _j : 1100;
|
|
393
|
+
const listResponse = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/documents/list', { limit: scanLimit });
|
|
394
|
+
const memories = (_k = listResponse.memories) !== null && _k !== void 0 ? _k : [];
|
|
395
|
+
const tagMap = new Map();
|
|
396
|
+
for (const doc of memories) {
|
|
397
|
+
if (doc.containerTag && typeof doc.containerTag === 'string') {
|
|
398
|
+
tagMap.set(doc.containerTag, ((_l = tagMap.get(doc.containerTag)) !== null && _l !== void 0 ? _l : 0) + 1);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
responseData = Array.from(tagMap.entries())
|
|
402
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
403
|
+
.map(([tag, count]) => ({ containerTag: tag, documentCount: count }));
|
|
404
|
+
}
|
|
405
|
+
else if (op === 'getSettings') {
|
|
155
406
|
const containerTag = this.getNodeParameter('containerTag', i);
|
|
156
407
|
if (!containerTag)
|
|
157
408
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Container Tag is required', { itemIndex: i });
|
|
158
409
|
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'GET', `/v3/container-tags/${encodeURIComponent(containerTag)}`);
|
|
159
410
|
}
|
|
411
|
+
else if (op === 'updateSettings') {
|
|
412
|
+
const containerTag = this.getNodeParameter('containerTag', i);
|
|
413
|
+
const tagUpdateFields = this.getNodeParameter('tagUpdateFields', i);
|
|
414
|
+
if (!containerTag)
|
|
415
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Container Tag is required', { itemIndex: i });
|
|
416
|
+
const body = {};
|
|
417
|
+
if (tagUpdateFields.entityContext !== undefined && tagUpdateFields.entityContext !== '') {
|
|
418
|
+
body.entityContext = tagUpdateFields.entityContext;
|
|
419
|
+
}
|
|
420
|
+
if (tagUpdateFields.memoryFilesystemPaths !== undefined && tagUpdateFields.memoryFilesystemPaths !== '') {
|
|
421
|
+
const raw = tagUpdateFields.memoryFilesystemPaths;
|
|
422
|
+
body.memoryFilesystemPaths = raw.split(',').map((p) => p.trim()).filter(Boolean);
|
|
423
|
+
}
|
|
424
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'PATCH', `/v3/container-tags/${encodeURIComponent(containerTag)}`, body);
|
|
425
|
+
}
|
|
426
|
+
else if (op === 'merge') {
|
|
427
|
+
const sourceA = this.getNodeParameter('mergeSourceA', i);
|
|
428
|
+
const sourceB = this.getNodeParameter('mergeSourceB', i);
|
|
429
|
+
const target = this.getNodeParameter('mergeTarget', i);
|
|
430
|
+
if (!sourceA || !sourceB)
|
|
431
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Both source tags are required for merge', { itemIndex: i });
|
|
432
|
+
if (!target)
|
|
433
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Target tag is required for merge', { itemIndex: i });
|
|
434
|
+
if (sourceA === sourceB)
|
|
435
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Source tags must be different', { itemIndex: i });
|
|
436
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/container-tags/merge', {
|
|
437
|
+
containerTags: [sourceA, sourceB],
|
|
438
|
+
targetContainerTag: target,
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
else if (op === 'delete') {
|
|
442
|
+
const containerTag = this.getNodeParameter('containerTag', i);
|
|
443
|
+
if (!containerTag)
|
|
444
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Container Tag is required', { itemIndex: i });
|
|
445
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'DELETE', `/v3/container-tags/${encodeURIComponent(containerTag)}`);
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown container tag operation: ${op}`, { itemIndex: i });
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
// ── MEMORY CHAT ──────────────────────────────────────────────
|
|
452
|
+
else if (res === 'chat') {
|
|
453
|
+
if (op === 'ask') {
|
|
454
|
+
const question = this.getNodeParameter('question', i);
|
|
455
|
+
const chatAdditionalFields = this.getNodeParameter('chatAdditionalFields', i);
|
|
456
|
+
const body = { q: question };
|
|
457
|
+
if (chatAdditionalFields.containerTag)
|
|
458
|
+
body.containerTag = chatAdditionalFields.containerTag;
|
|
459
|
+
if (chatAdditionalFields.systemPrompt)
|
|
460
|
+
body.systemPrompt = chatAdditionalFields.systemPrompt;
|
|
461
|
+
if (chatAdditionalFields.threshold !== undefined &&
|
|
462
|
+
chatAdditionalFields.threshold !== '' &&
|
|
463
|
+
chatAdditionalFields.threshold > 0) {
|
|
464
|
+
body.threshold = chatAdditionalFields.threshold;
|
|
465
|
+
}
|
|
466
|
+
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v3/chat', body);
|
|
467
|
+
}
|
|
160
468
|
else {
|
|
161
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown
|
|
469
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown chat operation: ${op}`, { itemIndex: i });
|
|
162
470
|
}
|
|
163
471
|
}
|
|
164
|
-
// ── PROFILE
|
|
165
|
-
else if (
|
|
166
|
-
if (
|
|
472
|
+
// ── PROFILE ──────────────────────────────────────────────────
|
|
473
|
+
else if (res === 'profile') {
|
|
474
|
+
if (op === 'get') {
|
|
167
475
|
const profileAdditionalFields = this.getNodeParameter('profileAdditionalFields', i);
|
|
168
476
|
const body = {};
|
|
169
477
|
if (profileAdditionalFields.q)
|
|
170
478
|
body.q = profileAdditionalFields.q;
|
|
171
479
|
if (profileAdditionalFields.containerTag)
|
|
172
480
|
body.containerTag = profileAdditionalFields.containerTag;
|
|
173
|
-
if (profileAdditionalFields.threshold !== undefined &&
|
|
481
|
+
if (profileAdditionalFields.threshold !== undefined &&
|
|
482
|
+
profileAdditionalFields.threshold !== '' &&
|
|
483
|
+
profileAdditionalFields.threshold > 0) {
|
|
174
484
|
body.threshold = profileAdditionalFields.threshold;
|
|
175
485
|
}
|
|
176
486
|
const filtersJson = profileAdditionalFields.filtersJson || '';
|
|
@@ -180,11 +490,11 @@ class Supermemory {
|
|
|
180
490
|
responseData = await GenericFunctions_1.supermemoryApiRequest.call(this, 'POST', '/v4/profile', body);
|
|
181
491
|
}
|
|
182
492
|
else {
|
|
183
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown profile operation: ${
|
|
493
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown profile operation: ${op}`, { itemIndex: i });
|
|
184
494
|
}
|
|
185
495
|
}
|
|
186
496
|
else {
|
|
187
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${
|
|
497
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${res}`, { itemIndex: i });
|
|
188
498
|
}
|
|
189
499
|
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(Array.isArray(responseData) ? responseData : [responseData]), { itemData: { item: i } });
|
|
190
500
|
returnData.push(...executionData);
|