@n8n/stores 2.5.0 → 2.6.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/useAgentRequestStore.cjs +4 -4
- package/dist/useAgentRequestStore.cjs.map +1 -1
- package/dist/useAgentRequestStore.d.cts +8 -8
- package/dist/useAgentRequestStore.d.mts +8 -8
- package/dist/useAgentRequestStore.mjs +4 -4
- package/dist/useAgentRequestStore.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -12,16 +12,16 @@ const useAgentRequestStore = (0, pinia.defineStore)("agentRequest", () => {
|
|
|
12
12
|
const getAgentRequests = (workflowId, nodeId) => {
|
|
13
13
|
return agentRequests.value[workflowId]?.[nodeId]?.query || {};
|
|
14
14
|
};
|
|
15
|
-
const getQueryValue = (workflowId, nodeId, paramName) => {
|
|
16
|
-
const query = agentRequests.value[workflowId]?.[nodeId]?.query;
|
|
17
|
-
if (typeof query === "string") return;
|
|
15
|
+
const getQueryValue = (workflowId, nodeId, nodeName, paramName) => {
|
|
16
|
+
const query = agentRequests.value[workflowId]?.[nodeId]?.query?.[nodeName];
|
|
17
|
+
if (typeof query === "string" || !paramName) return query;
|
|
18
18
|
return query?.[paramName];
|
|
19
19
|
};
|
|
20
20
|
const setAgentRequestForNode = (workflowId, nodeId, request) => {
|
|
21
21
|
ensureWorkflowAndNodeExist(workflowId, nodeId);
|
|
22
22
|
agentRequests.value[workflowId][nodeId] = {
|
|
23
23
|
...request,
|
|
24
|
-
query:
|
|
24
|
+
query: { ...request.query }
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
const clearAgentRequests = (workflowId, nodeId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentRequestStore.cjs","names":[],"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type {
|
|
1
|
+
{"version":3,"file":"useAgentRequestStore.cjs","names":[],"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type { AgentRequestQuery } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\n\nconst LOCAL_STORAGE_AGENT_REQUESTS = 'N8N_AGENT_REQUESTS';\n\nexport interface IAgentRequest {\n\tquery: AgentRequestQuery;\n\ttoolName?: string;\n}\n\nexport interface IAgentRequestStoreState {\n\t[workflowId: string]: {\n\t\t[nodeName: string]: IAgentRequest;\n\t};\n}\n\nexport const useAgentRequestStore = defineStore('agentRequest', () => {\n\t// State\n\tconst agentRequests = useLocalStorage<IAgentRequestStoreState>(LOCAL_STORAGE_AGENT_REQUESTS, {});\n\n\t// Helper function to ensure workflow and node entries exist\n\tconst ensureWorkflowAndNodeExist = (workflowId: string, nodeId: string): void => {\n\t\tif (!agentRequests.value[workflowId]) {\n\t\t\tagentRequests.value[workflowId] = {};\n\t\t}\n\n\t\tif (!agentRequests.value[workflowId][nodeId]) {\n\t\t\tagentRequests.value[workflowId][nodeId] = { query: {} };\n\t\t}\n\t};\n\n\t// Getters\n\tconst getAgentRequests = (workflowId: string, nodeId: string): IAgentRequest['query'] => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId]?.query || {};\n\t};\n\n\tconst getQueryValue = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tnodeName: string,\n\t\tparamName?: string,\n\t): unknown => {\n\t\tconst query = agentRequests.value[workflowId]?.[nodeId]?.query?.[nodeName];\n\t\tif (typeof query === 'string' || !paramName) {\n\t\t\treturn query;\n\t\t}\n\t\treturn query?.[paramName];\n\t};\n\n\tconst setAgentRequestForNode = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\trequest: IAgentRequest,\n\t): void => {\n\t\tensureWorkflowAndNodeExist(workflowId, nodeId);\n\n\t\tagentRequests.value[workflowId][nodeId] = {\n\t\t\t...request,\n\t\t\tquery: { ...request.query },\n\t\t};\n\t};\n\n\tconst clearAgentRequests = (workflowId: string, nodeId: string): void => {\n\t\tif (agentRequests.value[workflowId]) {\n\t\t\tagentRequests.value[workflowId][nodeId] = { query: {} };\n\t\t}\n\t};\n\n\tconst clearAllAgentRequests = (workflowId?: string): void => {\n\t\tif (workflowId) {\n\t\t\tagentRequests.value[workflowId] = {};\n\t\t} else {\n\t\t\tagentRequests.value = {};\n\t\t}\n\t};\n\n\tconst getAgentRequest = (workflowId: string, nodeId: string): IAgentRequest | undefined => {\n\t\tif (agentRequests.value[workflowId]) return agentRequests.value[workflowId]?.[nodeId];\n\t\treturn undefined;\n\t};\n\n\treturn {\n\t\tagentRequests,\n\t\tgetAgentRequests,\n\t\tgetQueryValue,\n\t\tsetAgentRequestForNode,\n\t\tclearAgentRequests,\n\t\tclearAllAgentRequests,\n\t\tgetAgentRequest,\n\t};\n});\n"],"mappings":";;;;AAIA,MAAM,+BAA+B;AAarC,MAAa,8CAAmC,sBAAsB;CAErE,MAAM,mDAAyD,8BAA8B,EAAE,CAAC;CAGhG,MAAM,8BAA8B,YAAoB,WAAyB;AAChF,MAAI,CAAC,cAAc,MAAM,YACxB,eAAc,MAAM,cAAc,EAAE;AAGrC,MAAI,CAAC,cAAc,MAAM,YAAY,QACpC,eAAc,MAAM,YAAY,UAAU,EAAE,OAAO,EAAE,EAAE;;CAKzD,MAAM,oBAAoB,YAAoB,WAA2C;AACxF,SAAO,cAAc,MAAM,cAAc,SAAS,SAAS,EAAE;;CAG9D,MAAM,iBACL,YACA,QACA,UACA,cACa;EACb,MAAM,QAAQ,cAAc,MAAM,cAAc,SAAS,QAAQ;AACjE,MAAI,OAAO,UAAU,YAAY,CAAC,UACjC,QAAO;AAER,SAAO,QAAQ;;CAGhB,MAAM,0BACL,YACA,QACA,YACU;AACV,6BAA2B,YAAY,OAAO;AAE9C,gBAAc,MAAM,YAAY,UAAU;GACzC,GAAG;GACH,OAAO,EAAE,GAAG,QAAQ,OAAO;GAC3B;;CAGF,MAAM,sBAAsB,YAAoB,WAAyB;AACxE,MAAI,cAAc,MAAM,YACvB,eAAc,MAAM,YAAY,UAAU,EAAE,OAAO,EAAE,EAAE;;CAIzD,MAAM,yBAAyB,eAA8B;AAC5D,MAAI,WACH,eAAc,MAAM,cAAc,EAAE;MAEpC,eAAc,QAAQ,EAAE;;CAI1B,MAAM,mBAAmB,YAAoB,WAA8C;AAC1F,MAAI,cAAc,MAAM,YAAa,QAAO,cAAc,MAAM,cAAc;;AAI/E,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _vueuse_core0 from "@vueuse/core";
|
|
2
2
|
import * as pinia0 from "pinia";
|
|
3
|
-
import {
|
|
3
|
+
import { AgentRequestQuery } from "n8n-workflow";
|
|
4
4
|
|
|
5
5
|
//#region src/useAgentRequestStore.d.ts
|
|
6
6
|
interface IAgentRequest {
|
|
7
|
-
query:
|
|
7
|
+
query: AgentRequestQuery;
|
|
8
8
|
toolName?: string;
|
|
9
9
|
}
|
|
10
10
|
interface IAgentRequestStoreState {
|
|
@@ -14,24 +14,24 @@ interface IAgentRequestStoreState {
|
|
|
14
14
|
}
|
|
15
15
|
declare const useAgentRequestStore: pinia0.StoreDefinition<"agentRequest", Pick<{
|
|
16
16
|
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
17
|
-
getAgentRequests: (workflowId: string, nodeId: string) =>
|
|
18
|
-
getQueryValue: (workflowId: string, nodeId: string,
|
|
17
|
+
getAgentRequests: (workflowId: string, nodeId: string) => IAgentRequest["query"];
|
|
18
|
+
getQueryValue: (workflowId: string, nodeId: string, nodeName: string, paramName?: string) => unknown;
|
|
19
19
|
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
20
20
|
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
21
21
|
clearAllAgentRequests: (workflowId?: string) => void;
|
|
22
22
|
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
23
23
|
}, "agentRequests">, Pick<{
|
|
24
24
|
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
25
|
-
getAgentRequests: (workflowId: string, nodeId: string) =>
|
|
26
|
-
getQueryValue: (workflowId: string, nodeId: string,
|
|
25
|
+
getAgentRequests: (workflowId: string, nodeId: string) => IAgentRequest["query"];
|
|
26
|
+
getQueryValue: (workflowId: string, nodeId: string, nodeName: string, paramName?: string) => unknown;
|
|
27
27
|
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
28
28
|
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
29
29
|
clearAllAgentRequests: (workflowId?: string) => void;
|
|
30
30
|
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
31
31
|
}, never>, Pick<{
|
|
32
32
|
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
33
|
-
getAgentRequests: (workflowId: string, nodeId: string) =>
|
|
34
|
-
getQueryValue: (workflowId: string, nodeId: string,
|
|
33
|
+
getAgentRequests: (workflowId: string, nodeId: string) => IAgentRequest["query"];
|
|
34
|
+
getQueryValue: (workflowId: string, nodeId: string, nodeName: string, paramName?: string) => unknown;
|
|
35
35
|
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
36
36
|
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
37
37
|
clearAllAgentRequests: (workflowId?: string) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _vueuse_core0 from "@vueuse/core";
|
|
2
2
|
import * as pinia0 from "pinia";
|
|
3
|
-
import {
|
|
3
|
+
import { AgentRequestQuery } from "n8n-workflow";
|
|
4
4
|
|
|
5
5
|
//#region src/useAgentRequestStore.d.ts
|
|
6
6
|
interface IAgentRequest {
|
|
7
|
-
query:
|
|
7
|
+
query: AgentRequestQuery;
|
|
8
8
|
toolName?: string;
|
|
9
9
|
}
|
|
10
10
|
interface IAgentRequestStoreState {
|
|
@@ -14,24 +14,24 @@ interface IAgentRequestStoreState {
|
|
|
14
14
|
}
|
|
15
15
|
declare const useAgentRequestStore: pinia0.StoreDefinition<"agentRequest", Pick<{
|
|
16
16
|
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
17
|
-
getAgentRequests: (workflowId: string, nodeId: string) =>
|
|
18
|
-
getQueryValue: (workflowId: string, nodeId: string,
|
|
17
|
+
getAgentRequests: (workflowId: string, nodeId: string) => IAgentRequest["query"];
|
|
18
|
+
getQueryValue: (workflowId: string, nodeId: string, nodeName: string, paramName?: string) => unknown;
|
|
19
19
|
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
20
20
|
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
21
21
|
clearAllAgentRequests: (workflowId?: string) => void;
|
|
22
22
|
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
23
23
|
}, "agentRequests">, Pick<{
|
|
24
24
|
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
25
|
-
getAgentRequests: (workflowId: string, nodeId: string) =>
|
|
26
|
-
getQueryValue: (workflowId: string, nodeId: string,
|
|
25
|
+
getAgentRequests: (workflowId: string, nodeId: string) => IAgentRequest["query"];
|
|
26
|
+
getQueryValue: (workflowId: string, nodeId: string, nodeName: string, paramName?: string) => unknown;
|
|
27
27
|
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
28
28
|
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
29
29
|
clearAllAgentRequests: (workflowId?: string) => void;
|
|
30
30
|
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
31
31
|
}, never>, Pick<{
|
|
32
32
|
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
33
|
-
getAgentRequests: (workflowId: string, nodeId: string) =>
|
|
34
|
-
getQueryValue: (workflowId: string, nodeId: string,
|
|
33
|
+
getAgentRequests: (workflowId: string, nodeId: string) => IAgentRequest["query"];
|
|
34
|
+
getQueryValue: (workflowId: string, nodeId: string, nodeName: string, paramName?: string) => unknown;
|
|
35
35
|
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
36
36
|
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
37
37
|
clearAllAgentRequests: (workflowId?: string) => void;
|
|
@@ -12,16 +12,16 @@ const useAgentRequestStore = defineStore("agentRequest", () => {
|
|
|
12
12
|
const getAgentRequests = (workflowId, nodeId) => {
|
|
13
13
|
return agentRequests.value[workflowId]?.[nodeId]?.query || {};
|
|
14
14
|
};
|
|
15
|
-
const getQueryValue = (workflowId, nodeId, paramName) => {
|
|
16
|
-
const query = agentRequests.value[workflowId]?.[nodeId]?.query;
|
|
17
|
-
if (typeof query === "string") return;
|
|
15
|
+
const getQueryValue = (workflowId, nodeId, nodeName, paramName) => {
|
|
16
|
+
const query = agentRequests.value[workflowId]?.[nodeId]?.query?.[nodeName];
|
|
17
|
+
if (typeof query === "string" || !paramName) return query;
|
|
18
18
|
return query?.[paramName];
|
|
19
19
|
};
|
|
20
20
|
const setAgentRequestForNode = (workflowId, nodeId, request) => {
|
|
21
21
|
ensureWorkflowAndNodeExist(workflowId, nodeId);
|
|
22
22
|
agentRequests.value[workflowId][nodeId] = {
|
|
23
23
|
...request,
|
|
24
|
-
query:
|
|
24
|
+
query: { ...request.query }
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
const clearAgentRequests = (workflowId, nodeId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentRequestStore.mjs","names":[],"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type {
|
|
1
|
+
{"version":3,"file":"useAgentRequestStore.mjs","names":[],"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type { AgentRequestQuery } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\n\nconst LOCAL_STORAGE_AGENT_REQUESTS = 'N8N_AGENT_REQUESTS';\n\nexport interface IAgentRequest {\n\tquery: AgentRequestQuery;\n\ttoolName?: string;\n}\n\nexport interface IAgentRequestStoreState {\n\t[workflowId: string]: {\n\t\t[nodeName: string]: IAgentRequest;\n\t};\n}\n\nexport const useAgentRequestStore = defineStore('agentRequest', () => {\n\t// State\n\tconst agentRequests = useLocalStorage<IAgentRequestStoreState>(LOCAL_STORAGE_AGENT_REQUESTS, {});\n\n\t// Helper function to ensure workflow and node entries exist\n\tconst ensureWorkflowAndNodeExist = (workflowId: string, nodeId: string): void => {\n\t\tif (!agentRequests.value[workflowId]) {\n\t\t\tagentRequests.value[workflowId] = {};\n\t\t}\n\n\t\tif (!agentRequests.value[workflowId][nodeId]) {\n\t\t\tagentRequests.value[workflowId][nodeId] = { query: {} };\n\t\t}\n\t};\n\n\t// Getters\n\tconst getAgentRequests = (workflowId: string, nodeId: string): IAgentRequest['query'] => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId]?.query || {};\n\t};\n\n\tconst getQueryValue = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tnodeName: string,\n\t\tparamName?: string,\n\t): unknown => {\n\t\tconst query = agentRequests.value[workflowId]?.[nodeId]?.query?.[nodeName];\n\t\tif (typeof query === 'string' || !paramName) {\n\t\t\treturn query;\n\t\t}\n\t\treturn query?.[paramName];\n\t};\n\n\tconst setAgentRequestForNode = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\trequest: IAgentRequest,\n\t): void => {\n\t\tensureWorkflowAndNodeExist(workflowId, nodeId);\n\n\t\tagentRequests.value[workflowId][nodeId] = {\n\t\t\t...request,\n\t\t\tquery: { ...request.query },\n\t\t};\n\t};\n\n\tconst clearAgentRequests = (workflowId: string, nodeId: string): void => {\n\t\tif (agentRequests.value[workflowId]) {\n\t\t\tagentRequests.value[workflowId][nodeId] = { query: {} };\n\t\t}\n\t};\n\n\tconst clearAllAgentRequests = (workflowId?: string): void => {\n\t\tif (workflowId) {\n\t\t\tagentRequests.value[workflowId] = {};\n\t\t} else {\n\t\t\tagentRequests.value = {};\n\t\t}\n\t};\n\n\tconst getAgentRequest = (workflowId: string, nodeId: string): IAgentRequest | undefined => {\n\t\tif (agentRequests.value[workflowId]) return agentRequests.value[workflowId]?.[nodeId];\n\t\treturn undefined;\n\t};\n\n\treturn {\n\t\tagentRequests,\n\t\tgetAgentRequests,\n\t\tgetQueryValue,\n\t\tsetAgentRequestForNode,\n\t\tclearAgentRequests,\n\t\tclearAllAgentRequests,\n\t\tgetAgentRequest,\n\t};\n});\n"],"mappings":";;;;AAIA,MAAM,+BAA+B;AAarC,MAAa,uBAAuB,YAAY,sBAAsB;CAErE,MAAM,gBAAgB,gBAAyC,8BAA8B,EAAE,CAAC;CAGhG,MAAM,8BAA8B,YAAoB,WAAyB;AAChF,MAAI,CAAC,cAAc,MAAM,YACxB,eAAc,MAAM,cAAc,EAAE;AAGrC,MAAI,CAAC,cAAc,MAAM,YAAY,QACpC,eAAc,MAAM,YAAY,UAAU,EAAE,OAAO,EAAE,EAAE;;CAKzD,MAAM,oBAAoB,YAAoB,WAA2C;AACxF,SAAO,cAAc,MAAM,cAAc,SAAS,SAAS,EAAE;;CAG9D,MAAM,iBACL,YACA,QACA,UACA,cACa;EACb,MAAM,QAAQ,cAAc,MAAM,cAAc,SAAS,QAAQ;AACjE,MAAI,OAAO,UAAU,YAAY,CAAC,UACjC,QAAO;AAER,SAAO,QAAQ;;CAGhB,MAAM,0BACL,YACA,QACA,YACU;AACV,6BAA2B,YAAY,OAAO;AAE9C,gBAAc,MAAM,YAAY,UAAU;GACzC,GAAG;GACH,OAAO,EAAE,GAAG,QAAQ,OAAO;GAC3B;;CAGF,MAAM,sBAAsB,YAAoB,WAAyB;AACxE,MAAI,cAAc,MAAM,YACvB,eAAc,MAAM,YAAY,UAAU,EAAE,OAAO,EAAE,EAAE;;CAIzD,MAAM,yBAAyB,eAA8B;AAC5D,MAAI,WACH,eAAc,MAAM,cAAc,EAAE;MAEpC,eAAc,QAAQ,EAAE;;CAI1B,MAAM,mBAAmB,YAAoB,WAA8C;AAC1F,MAAI,cAAc,MAAM,YAAa,QAAO,cAAc,MAAM,cAAc;;AAI/E,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/stores",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"LICENSE.md",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"n8n-workflow": "2.
|
|
26
|
+
"n8n-workflow": "2.6.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"vitest": "^3.1.3",
|
|
41
41
|
"vue-tsc": "^2.2.8",
|
|
42
42
|
"@n8n/typescript-config": "1.3.0",
|
|
43
|
-
"@n8n/
|
|
44
|
-
"@n8n/
|
|
43
|
+
"@n8n/eslint-config": "0.0.1",
|
|
44
|
+
"@n8n/vitest-config": "1.6.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@vueuse/core": "^10.11.0",
|