@n8n/stores 1.22.0 → 1.24.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/chunk-CUT6urMc.cjs +30 -0
- package/dist/constants-BJ-tXiwj.d.cts +47 -0
- package/dist/constants-BbnUagQU.cjs +54 -0
- package/dist/constants-BbnUagQU.cjs.map +1 -0
- package/dist/constants-BcqRYAbr.js +48 -0
- package/dist/constants-BcqRYAbr.js.map +1 -0
- package/dist/constants-GzFkR8Mu.d.ts +47 -0
- package/dist/constants.cjs +2 -6
- package/dist/constants.d.cts +2 -42
- package/dist/constants.d.ts +2 -42
- package/dist/constants.js +3 -7
- package/dist/index.cjs +2 -6
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -7
- package/dist/metaTagConfig-DEzM-BAY.cjs +49 -0
- package/dist/metaTagConfig-DEzM-BAY.cjs.map +1 -0
- package/dist/metaTagConfig-DHiZO9w0.js +37 -0
- package/dist/metaTagConfig-DHiZO9w0.js.map +1 -0
- package/dist/metaTagConfig.cjs +3 -8
- package/dist/metaTagConfig.d.cts +3 -1
- package/dist/metaTagConfig.d.ts +3 -1
- package/dist/metaTagConfig.js +3 -9
- package/dist/useAgentRequestStore.cjs +49 -57
- package/dist/useAgentRequestStore.cjs.map +1 -1
- package/dist/useAgentRequestStore.d.cts +34 -32
- package/dist/useAgentRequestStore.d.ts +34 -32
- package/dist/useAgentRequestStore.js +46 -57
- package/dist/useAgentRequestStore.js.map +1 -1
- package/dist/useRootStore.cjs +163 -169
- package/dist/useRootStore.cjs.map +1 -1
- package/dist/useRootStore.d.cts +159 -157
- package/dist/useRootStore.d.ts +159 -157
- package/dist/useRootStore.js +160 -170
- package/dist/useRootStore.js.map +1 -1
- package/package.json +10 -10
- package/dist/chunk-2IC4OJEY.js +0 -46
- package/dist/chunk-2IC4OJEY.js.map +0 -1
- package/dist/chunk-IHYU4LOJ.cjs +0 -46
- package/dist/chunk-IHYU4LOJ.cjs.map +0 -1
- package/dist/chunk-MFIRIEND.js +0 -40
- package/dist/chunk-MFIRIEND.js.map +0 -1
- package/dist/chunk-TI4WVUCB.cjs +0 -40
- package/dist/chunk-TI4WVUCB.cjs.map +0 -1
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/metaTagConfig.cjs.map +0 -1
- package/dist/metaTagConfig.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useAgentRequestStore.cjs","names":[],"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type { INodeParameters, NodeParameterValueType } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\n\nconst LOCAL_STORAGE_AGENT_REQUESTS = 'N8N_AGENT_REQUESTS';\n\nexport interface IAgentRequest {\n\tquery: INodeParameters | string;\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): INodeParameters | string => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId]?.query || {};\n\t};\n\n\tconst getQueryValue = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tparamName: string,\n\t): NodeParameterValueType | undefined => {\n\t\tconst query = agentRequests.value[workflowId]?.[nodeId]?.query;\n\t\tif (typeof query === 'string') {\n\t\t\treturn undefined;\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: typeof request.query === 'string' ? request.query : { ...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,WAA6C;AAC1F,SAAO,cAAc,MAAM,cAAc,SAAS,SAAS,EAAE;;CAG9D,MAAM,iBACL,YACA,QACA,cACwC;EACxC,MAAM,QAAQ,cAAc,MAAM,cAAc,SAAS;AACzD,MAAI,OAAO,UAAU,SACpB;AAED,SAAO,QAAQ;;CAGhB,MAAM,0BACL,YACA,QACA,YACU;AACV,6BAA2B,YAAY,OAAO;AAE9C,gBAAc,MAAM,YAAY,UAAU;GACzC,GAAG;GACH,OAAO,OAAO,QAAQ,UAAU,WAAW,QAAQ,QAAQ,EAAE,GAAG,QAAQ,OAAO;GAC/E;;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,40 +1,42 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import { INodeParameters, NodeParameterValueType } from
|
|
1
|
+
import * as _vueuse_core0 from "@vueuse/core";
|
|
2
|
+
import * as pinia0 from "pinia";
|
|
3
|
+
import { INodeParameters, NodeParameterValueType } from "n8n-workflow";
|
|
4
4
|
|
|
5
|
+
//#region src/useAgentRequestStore.d.ts
|
|
5
6
|
interface IAgentRequest {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
query: INodeParameters | string;
|
|
8
|
+
toolName?: string;
|
|
8
9
|
}
|
|
9
10
|
interface IAgentRequestStoreState {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
[workflowId: string]: {
|
|
12
|
+
[nodeName: string]: IAgentRequest;
|
|
13
|
+
};
|
|
13
14
|
}
|
|
14
|
-
declare const useAgentRequestStore:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
declare const useAgentRequestStore: pinia0.StoreDefinition<"agentRequest", Pick<{
|
|
16
|
+
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
17
|
+
getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters | string;
|
|
18
|
+
getQueryValue: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
|
|
19
|
+
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
20
|
+
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
21
|
+
clearAllAgentRequests: (workflowId?: string) => void;
|
|
22
|
+
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
22
23
|
}, "agentRequests">, Pick<{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
25
|
+
getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters | string;
|
|
26
|
+
getQueryValue: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
|
|
27
|
+
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
28
|
+
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
29
|
+
clearAllAgentRequests: (workflowId?: string) => void;
|
|
30
|
+
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
30
31
|
}, never>, Pick<{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
33
|
+
getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters | string;
|
|
34
|
+
getQueryValue: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
|
|
35
|
+
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
36
|
+
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
37
|
+
clearAllAgentRequests: (workflowId?: string) => void;
|
|
38
|
+
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
38
39
|
}, "getAgentRequests" | "getQueryValue" | "setAgentRequestForNode" | "clearAgentRequests" | "clearAllAgentRequests" | "getAgentRequest">>;
|
|
39
|
-
|
|
40
|
-
export {
|
|
40
|
+
//#endregion
|
|
41
|
+
export { IAgentRequest, IAgentRequestStoreState, useAgentRequestStore };
|
|
42
|
+
//# sourceMappingURL=useAgentRequestStore.d.cts.map
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import { INodeParameters, NodeParameterValueType } from
|
|
1
|
+
import * as _vueuse_core0 from "@vueuse/core";
|
|
2
|
+
import * as pinia0 from "pinia";
|
|
3
|
+
import { INodeParameters, NodeParameterValueType } from "n8n-workflow";
|
|
4
4
|
|
|
5
|
+
//#region src/useAgentRequestStore.d.ts
|
|
5
6
|
interface IAgentRequest {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
query: INodeParameters | string;
|
|
8
|
+
toolName?: string;
|
|
8
9
|
}
|
|
9
10
|
interface IAgentRequestStoreState {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
[workflowId: string]: {
|
|
12
|
+
[nodeName: string]: IAgentRequest;
|
|
13
|
+
};
|
|
13
14
|
}
|
|
14
|
-
declare const useAgentRequestStore:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
declare const useAgentRequestStore: pinia0.StoreDefinition<"agentRequest", Pick<{
|
|
16
|
+
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
17
|
+
getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters | string;
|
|
18
|
+
getQueryValue: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
|
|
19
|
+
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
20
|
+
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
21
|
+
clearAllAgentRequests: (workflowId?: string) => void;
|
|
22
|
+
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
22
23
|
}, "agentRequests">, Pick<{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
25
|
+
getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters | string;
|
|
26
|
+
getQueryValue: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
|
|
27
|
+
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
28
|
+
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
29
|
+
clearAllAgentRequests: (workflowId?: string) => void;
|
|
30
|
+
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
30
31
|
}, never>, Pick<{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
agentRequests: _vueuse_core0.RemovableRef<IAgentRequestStoreState>;
|
|
33
|
+
getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters | string;
|
|
34
|
+
getQueryValue: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
|
|
35
|
+
setAgentRequestForNode: (workflowId: string, nodeId: string, request: IAgentRequest) => void;
|
|
36
|
+
clearAgentRequests: (workflowId: string, nodeId: string) => void;
|
|
37
|
+
clearAllAgentRequests: (workflowId?: string) => void;
|
|
38
|
+
getAgentRequest: (workflowId: string, nodeId: string) => IAgentRequest | undefined;
|
|
38
39
|
}, "getAgentRequests" | "getQueryValue" | "setAgentRequestForNode" | "clearAgentRequests" | "clearAllAgentRequests" | "getAgentRequest">>;
|
|
39
|
-
|
|
40
|
-
export {
|
|
40
|
+
//#endregion
|
|
41
|
+
export { IAgentRequest, IAgentRequestStoreState, useAgentRequestStore };
|
|
42
|
+
//# sourceMappingURL=useAgentRequestStore.d.ts.map
|
|
@@ -1,61 +1,50 @@
|
|
|
1
|
-
// src/useAgentRequestStore.ts
|
|
2
1
|
import { useLocalStorage } from "@vueuse/core";
|
|
3
2
|
import { defineStore } from "pinia";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
agentRequests,
|
|
50
|
-
getAgentRequests,
|
|
51
|
-
getQueryValue,
|
|
52
|
-
setAgentRequestForNode,
|
|
53
|
-
clearAgentRequests,
|
|
54
|
-
clearAllAgentRequests,
|
|
55
|
-
getAgentRequest
|
|
56
|
-
};
|
|
3
|
+
|
|
4
|
+
//#region src/useAgentRequestStore.ts
|
|
5
|
+
const LOCAL_STORAGE_AGENT_REQUESTS = "N8N_AGENT_REQUESTS";
|
|
6
|
+
const useAgentRequestStore = defineStore("agentRequest", () => {
|
|
7
|
+
const agentRequests = useLocalStorage(LOCAL_STORAGE_AGENT_REQUESTS, {});
|
|
8
|
+
const ensureWorkflowAndNodeExist = (workflowId, nodeId) => {
|
|
9
|
+
if (!agentRequests.value[workflowId]) agentRequests.value[workflowId] = {};
|
|
10
|
+
if (!agentRequests.value[workflowId][nodeId]) agentRequests.value[workflowId][nodeId] = { query: {} };
|
|
11
|
+
};
|
|
12
|
+
const getAgentRequests = (workflowId, nodeId) => {
|
|
13
|
+
return agentRequests.value[workflowId]?.[nodeId]?.query || {};
|
|
14
|
+
};
|
|
15
|
+
const getQueryValue = (workflowId, nodeId, paramName) => {
|
|
16
|
+
const query = agentRequests.value[workflowId]?.[nodeId]?.query;
|
|
17
|
+
if (typeof query === "string") return;
|
|
18
|
+
return query?.[paramName];
|
|
19
|
+
};
|
|
20
|
+
const setAgentRequestForNode = (workflowId, nodeId, request) => {
|
|
21
|
+
ensureWorkflowAndNodeExist(workflowId, nodeId);
|
|
22
|
+
agentRequests.value[workflowId][nodeId] = {
|
|
23
|
+
...request,
|
|
24
|
+
query: typeof request.query === "string" ? request.query : { ...request.query }
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const clearAgentRequests = (workflowId, nodeId) => {
|
|
28
|
+
if (agentRequests.value[workflowId]) agentRequests.value[workflowId][nodeId] = { query: {} };
|
|
29
|
+
};
|
|
30
|
+
const clearAllAgentRequests = (workflowId) => {
|
|
31
|
+
if (workflowId) agentRequests.value[workflowId] = {};
|
|
32
|
+
else agentRequests.value = {};
|
|
33
|
+
};
|
|
34
|
+
const getAgentRequest = (workflowId, nodeId) => {
|
|
35
|
+
if (agentRequests.value[workflowId]) return agentRequests.value[workflowId]?.[nodeId];
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
agentRequests,
|
|
39
|
+
getAgentRequests,
|
|
40
|
+
getQueryValue,
|
|
41
|
+
setAgentRequestForNode,
|
|
42
|
+
clearAgentRequests,
|
|
43
|
+
clearAllAgentRequests,
|
|
44
|
+
getAgentRequest
|
|
45
|
+
};
|
|
57
46
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { useAgentRequestStore };
|
|
61
50
|
//# sourceMappingURL=useAgentRequestStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type { INodeParameters, NodeParameterValueType } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\n\nconst LOCAL_STORAGE_AGENT_REQUESTS = 'N8N_AGENT_REQUESTS';\n\nexport interface IAgentRequest {\n\tquery: INodeParameters | string;\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): INodeParameters | string => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId]?.query || {};\n\t};\n\n\tconst getQueryValue = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tparamName: string,\n\t): NodeParameterValueType | undefined => {\n\t\tconst query = agentRequests.value[workflowId]?.[nodeId]?.query;\n\t\tif (typeof query === 'string') {\n\t\t\treturn undefined;\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: typeof request.query === 'string' ? request.query : { ...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":"
|
|
1
|
+
{"version":3,"file":"useAgentRequestStore.js","names":[],"sources":["../src/useAgentRequestStore.ts"],"sourcesContent":["import { useLocalStorage } from '@vueuse/core';\nimport type { INodeParameters, NodeParameterValueType } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\n\nconst LOCAL_STORAGE_AGENT_REQUESTS = 'N8N_AGENT_REQUESTS';\n\nexport interface IAgentRequest {\n\tquery: INodeParameters | string;\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): INodeParameters | string => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId]?.query || {};\n\t};\n\n\tconst getQueryValue = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tparamName: string,\n\t): NodeParameterValueType | undefined => {\n\t\tconst query = agentRequests.value[workflowId]?.[nodeId]?.query;\n\t\tif (typeof query === 'string') {\n\t\t\treturn undefined;\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: typeof request.query === 'string' ? request.query : { ...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,WAA6C;AAC1F,SAAO,cAAc,MAAM,cAAc,SAAS,SAAS,EAAE;;CAG9D,MAAM,iBACL,YACA,QACA,cACwC;EACxC,MAAM,QAAQ,cAAc,MAAM,cAAc,SAAS;AACzD,MAAI,OAAO,UAAU,SACpB;AAED,SAAO,QAAQ;;CAGhB,MAAM,0BACL,YACA,QACA,YACU;AACV,6BAA2B,YAAY,OAAO;AAE9C,gBAAc,MAAM,YAAY,UAAU;GACzC,GAAG;GACH,OAAO,OAAO,QAAQ,UAAU,WAAW,QAAQ,QAAQ,EAAE,GAAG,QAAQ,OAAO;GAC/E;;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"}
|