@n8n/stores 1.1.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/LICENSE.md ADDED
@@ -0,0 +1,88 @@
1
+ # License
2
+
3
+ Portions of this software are licensed as follows:
4
+
5
+ - Content of branches other than the main branch (i.e. "master") are not licensed.
6
+ - Source code files that contain ".ee." in their filename or ".ee" in their dirname are NOT licensed under
7
+ the Sustainable Use License.
8
+ To use source code files that contain ".ee." in their filename or ".ee" in their dirname you must hold a
9
+ valid n8n Enterprise License specifically allowing you access to such source code files and as defined
10
+ in "LICENSE_EE.md".
11
+ - All third party components incorporated into the n8n Software are licensed under the original license
12
+ provided by the owner of the applicable component.
13
+ - Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
14
+ License" as defined below.
15
+
16
+ ## Sustainable Use License
17
+
18
+ Version 1.0
19
+
20
+ ### Acceptance
21
+
22
+ By using the software, you agree to all of the terms and conditions below.
23
+
24
+ ### Copyright License
25
+
26
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
27
+ to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
28
+ to the limitations below.
29
+
30
+ ### Limitations
31
+
32
+ You may use or modify the software only for your own internal business purposes or for non-commercial or
33
+ personal use. You may distribute the software or provide it to others only if you do so free of charge for
34
+ non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
35
+ the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
36
+
37
+ ### Patents
38
+
39
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
40
+ license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
41
+ subject to the limitations and conditions in this license. This license does not cover any patent claims that
42
+ you cause to be infringed by modifications or additions to the software. If you or your company make any
43
+ written claim that the software infringes or contributes to infringement of any patent, your patent license
44
+ for the software granted under these terms ends immediately. If your company makes such a claim, your patent
45
+ license ends immediately for work on behalf of your company.
46
+
47
+ ### Notices
48
+
49
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
50
+ terms. If you modify the software, you must include in any modified copies of the software a prominent notice
51
+ stating that you have modified the software.
52
+
53
+ ### No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in these terms.
56
+
57
+ ### Termination
58
+
59
+ If you use the software in violation of these terms, such use is not licensed, and your license will
60
+ automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
61
+ violation of this license no later than 30 days after you receive that notice, your license will be reinstated
62
+ retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
63
+ terms will cause your license to terminate automatically and permanently.
64
+
65
+ ### No Liability
66
+
67
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
68
+ not be liable to you for any damages arising out of these terms or the use or nature of the software, under
69
+ any kind of legal claim.
70
+
71
+ ### Definitions
72
+
73
+ The “licensor” is the entity offering these terms.
74
+
75
+ The “software” is the software the licensor makes available under these terms, including any portion of it.
76
+
77
+ “You” refers to the individual or entity agreeing to these terms.
78
+
79
+ “Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
80
+ all organizations that have control over, are under the control of, or are under common control with that
81
+ organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
82
+ management and policies by vote, contract, or otherwise. Control can be direct or indirect.
83
+
84
+ “Your license” is the license granted to you for the software under these terms.
85
+
86
+ “Use” means anything you do with the software requiring your license.
87
+
88
+ “Trademark” means trademarks, service marks, and similar rights.
package/LICENSE_EE.md ADDED
@@ -0,0 +1,27 @@
1
+ # The n8n Enterprise License (the “Enterprise License”)
2
+
3
+ Copyright (c) 2022-present n8n GmbH.
4
+
5
+ With regard to the n8n Software:
6
+
7
+ This software and associated documentation files (the "Software") may only be used in production, if
8
+ you (and any entity that you represent) hold a valid n8n Enterprise license corresponding to your
9
+ usage. Subject to the foregoing sentence, you are free to modify this Software and publish patches
10
+ to the Software. You agree that n8n and/or its licensors (as applicable) retain all right, title and
11
+ interest in and to all such modifications and/or patches, and all such modifications and/or patches
12
+ may only be used, copied, modified, displayed, distributed, or otherwise exploited with a valid n8n
13
+ Enterprise license for the corresponding usage. Notwithstanding the foregoing, you may copy and
14
+ modify the Software for development and testing purposes, without requiring a subscription. You
15
+ agree that n8n and/or its licensors (as applicable) retain all right, title and interest in and to
16
+ all such modifications. You are not granted any other rights beyond what is expressly stated herein.
17
+ Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense, and/or
18
+ sell the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
21
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
23
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ For all third party components incorporated into the n8n Software, those components are licensed
27
+ under the original license provided by the owner of the applicable component.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @n8n/stores
2
+
3
+ A collection of Pinia stores that provide common data-related functionality across n8n's Front-End packages.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Features](#features)
8
+ - [Contributing](#contributing)
9
+ - [License](#license)
10
+
11
+ ## Features
12
+
13
+ - **Composable State Management**: Share and reuse stateful logic across multiple Vue components using Pinia stores.
14
+ - **Consistent Patterns**: Promote uniform state handling and best practices throughout the front-end codebase.
15
+ - **Easy Extensibility**: Add or modify stores as project requirements evolve, supporting scalable development.
16
+ - **Composition API Support**: Designed to work seamlessly with Vue's Composition API for modern, maintainable code.
17
+
18
+ ## Contributing
19
+
20
+ For more details, please read our [CONTRIBUTING.md](CONTRIBUTING.md).
21
+
22
+ ## License
23
+
24
+ For more details, please read our [LICENSE.md](LICENSE.md).
@@ -0,0 +1,39 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/constants.ts
2
+ var STORES = {
3
+ COMMUNITY_NODES: "communityNodes",
4
+ ROOT: "root",
5
+ SETTINGS: "settings",
6
+ UI: "ui",
7
+ USERS: "users",
8
+ WORKFLOWS: "workflows",
9
+ WORKFLOWS_V2: "workflowsV2",
10
+ WORKFLOWS_EE: "workflowsEE",
11
+ EXECUTIONS: "executions",
12
+ NDV: "ndv",
13
+ TEMPLATES: "templates",
14
+ NODE_TYPES: "nodeTypes",
15
+ CREDENTIALS: "credentials",
16
+ TAGS: "tags",
17
+ ANNOTATION_TAGS: "annotationTags",
18
+ VERSIONS: "versions",
19
+ NODE_CREATOR: "nodeCreator",
20
+ WEBHOOKS: "webhooks",
21
+ HISTORY: "history",
22
+ CLOUD_PLAN: "cloudPlan",
23
+ RBAC: "rbac",
24
+ PUSH: "push",
25
+ COLLABORATION: "collaboration",
26
+ ASSISTANT: "assistant",
27
+ BUILDER: "builder",
28
+ BECOME_TEMPLATE_CREATOR: "becomeTemplateCreator",
29
+ PROJECTS: "projects",
30
+ API_KEYS: "apiKeys",
31
+ TEST_DEFINITION: "testDefinition",
32
+ FOLDERS: "folders",
33
+ MODULES: "modules"
34
+ };
35
+
36
+
37
+
38
+ exports.STORES = STORES;
39
+ //# sourceMappingURL=chunk-4NAC3BDH.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/chunk-4NAC3BDH.cjs","../src/constants.ts"],"names":[],"mappings":"AAAA;ACAO,IAAM,OAAA,EAAS;AAAA,EACrB,eAAA,EAAiB,gBAAA;AAAA,EACjB,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,UAAA;AAAA,EACV,EAAA,EAAI,IAAA;AAAA,EACJ,KAAA,EAAO,OAAA;AAAA,EACP,SAAA,EAAW,WAAA;AAAA,EACX,YAAA,EAAc,aAAA;AAAA,EACd,YAAA,EAAc,aAAA;AAAA,EACd,UAAA,EAAY,YAAA;AAAA,EACZ,GAAA,EAAK,KAAA;AAAA,EACL,SAAA,EAAW,WAAA;AAAA,EACX,UAAA,EAAY,WAAA;AAAA,EACZ,WAAA,EAAa,aAAA;AAAA,EACb,IAAA,EAAM,MAAA;AAAA,EACN,eAAA,EAAiB,gBAAA;AAAA,EACjB,QAAA,EAAU,UAAA;AAAA,EACV,YAAA,EAAc,aAAA;AAAA,EACd,QAAA,EAAU,UAAA;AAAA,EACV,OAAA,EAAS,SAAA;AAAA,EACT,UAAA,EAAY,WAAA;AAAA,EACZ,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,MAAA;AAAA,EACN,aAAA,EAAe,eAAA;AAAA,EACf,SAAA,EAAW,WAAA;AAAA,EACX,OAAA,EAAS,SAAA;AAAA,EACT,uBAAA,EAAyB,uBAAA;AAAA,EACzB,QAAA,EAAU,UAAA;AAAA,EACV,QAAA,EAAU,SAAA;AAAA,EACV,eAAA,EAAiB,gBAAA;AAAA,EACjB,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS;AACV,CAAA;ADEA;AACA;AACE;AACF,wBAAC","file":"/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/chunk-4NAC3BDH.cjs","sourcesContent":[null,"export const STORES = {\n\tCOMMUNITY_NODES: 'communityNodes',\n\tROOT: 'root',\n\tSETTINGS: 'settings',\n\tUI: 'ui',\n\tUSERS: 'users',\n\tWORKFLOWS: 'workflows',\n\tWORKFLOWS_V2: 'workflowsV2',\n\tWORKFLOWS_EE: 'workflowsEE',\n\tEXECUTIONS: 'executions',\n\tNDV: 'ndv',\n\tTEMPLATES: 'templates',\n\tNODE_TYPES: 'nodeTypes',\n\tCREDENTIALS: 'credentials',\n\tTAGS: 'tags',\n\tANNOTATION_TAGS: 'annotationTags',\n\tVERSIONS: 'versions',\n\tNODE_CREATOR: 'nodeCreator',\n\tWEBHOOKS: 'webhooks',\n\tHISTORY: 'history',\n\tCLOUD_PLAN: 'cloudPlan',\n\tRBAC: 'rbac',\n\tPUSH: 'push',\n\tCOLLABORATION: 'collaboration',\n\tASSISTANT: 'assistant',\n\tBUILDER: 'builder',\n\tBECOME_TEMPLATE_CREATOR: 'becomeTemplateCreator',\n\tPROJECTS: 'projects',\n\tAPI_KEYS: 'apiKeys',\n\tTEST_DEFINITION: 'testDefinition',\n\tFOLDERS: 'folders',\n\tMODULES: 'modules',\n} as const;\n"]}
@@ -0,0 +1,39 @@
1
+ // src/constants.ts
2
+ var STORES = {
3
+ COMMUNITY_NODES: "communityNodes",
4
+ ROOT: "root",
5
+ SETTINGS: "settings",
6
+ UI: "ui",
7
+ USERS: "users",
8
+ WORKFLOWS: "workflows",
9
+ WORKFLOWS_V2: "workflowsV2",
10
+ WORKFLOWS_EE: "workflowsEE",
11
+ EXECUTIONS: "executions",
12
+ NDV: "ndv",
13
+ TEMPLATES: "templates",
14
+ NODE_TYPES: "nodeTypes",
15
+ CREDENTIALS: "credentials",
16
+ TAGS: "tags",
17
+ ANNOTATION_TAGS: "annotationTags",
18
+ VERSIONS: "versions",
19
+ NODE_CREATOR: "nodeCreator",
20
+ WEBHOOKS: "webhooks",
21
+ HISTORY: "history",
22
+ CLOUD_PLAN: "cloudPlan",
23
+ RBAC: "rbac",
24
+ PUSH: "push",
25
+ COLLABORATION: "collaboration",
26
+ ASSISTANT: "assistant",
27
+ BUILDER: "builder",
28
+ BECOME_TEMPLATE_CREATOR: "becomeTemplateCreator",
29
+ PROJECTS: "projects",
30
+ API_KEYS: "apiKeys",
31
+ TEST_DEFINITION: "testDefinition",
32
+ FOLDERS: "folders",
33
+ MODULES: "modules"
34
+ };
35
+
36
+ export {
37
+ STORES
38
+ };
39
+ //# sourceMappingURL=chunk-GWOUPYDG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const STORES = {\n\tCOMMUNITY_NODES: 'communityNodes',\n\tROOT: 'root',\n\tSETTINGS: 'settings',\n\tUI: 'ui',\n\tUSERS: 'users',\n\tWORKFLOWS: 'workflows',\n\tWORKFLOWS_V2: 'workflowsV2',\n\tWORKFLOWS_EE: 'workflowsEE',\n\tEXECUTIONS: 'executions',\n\tNDV: 'ndv',\n\tTEMPLATES: 'templates',\n\tNODE_TYPES: 'nodeTypes',\n\tCREDENTIALS: 'credentials',\n\tTAGS: 'tags',\n\tANNOTATION_TAGS: 'annotationTags',\n\tVERSIONS: 'versions',\n\tNODE_CREATOR: 'nodeCreator',\n\tWEBHOOKS: 'webhooks',\n\tHISTORY: 'history',\n\tCLOUD_PLAN: 'cloudPlan',\n\tRBAC: 'rbac',\n\tPUSH: 'push',\n\tCOLLABORATION: 'collaboration',\n\tASSISTANT: 'assistant',\n\tBUILDER: 'builder',\n\tBECOME_TEMPLATE_CREATOR: 'becomeTemplateCreator',\n\tPROJECTS: 'projects',\n\tAPI_KEYS: 'apiKeys',\n\tTEST_DEFINITION: 'testDefinition',\n\tFOLDERS: 'folders',\n\tMODULES: 'modules',\n} as const;\n"],"mappings":";AAAO,IAAM,SAAS;AAAA,EACrB,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,WAAW;AAAA,EACX,cAAc;AAAA,EACd,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,cAAc;AAAA,EACd,UAAU;AAAA,EACV,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,MAAM;AAAA,EACN,eAAe;AAAA,EACf,WAAW;AAAA,EACX,SAAS;AAAA,EACT,yBAAyB;AAAA,EACzB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,SAAS;AACV;","names":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk4NAC3BDHcjs = require('./chunk-4NAC3BDH.cjs');
4
+
5
+
6
+ exports.STORES = _chunk4NAC3BDHcjs.STORES;
7
+ //# sourceMappingURL=constants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/constants.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,0CAAC","file":"/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/constants.cjs"}
@@ -0,0 +1,35 @@
1
+ declare const STORES: {
2
+ readonly COMMUNITY_NODES: "communityNodes";
3
+ readonly ROOT: "root";
4
+ readonly SETTINGS: "settings";
5
+ readonly UI: "ui";
6
+ readonly USERS: "users";
7
+ readonly WORKFLOWS: "workflows";
8
+ readonly WORKFLOWS_V2: "workflowsV2";
9
+ readonly WORKFLOWS_EE: "workflowsEE";
10
+ readonly EXECUTIONS: "executions";
11
+ readonly NDV: "ndv";
12
+ readonly TEMPLATES: "templates";
13
+ readonly NODE_TYPES: "nodeTypes";
14
+ readonly CREDENTIALS: "credentials";
15
+ readonly TAGS: "tags";
16
+ readonly ANNOTATION_TAGS: "annotationTags";
17
+ readonly VERSIONS: "versions";
18
+ readonly NODE_CREATOR: "nodeCreator";
19
+ readonly WEBHOOKS: "webhooks";
20
+ readonly HISTORY: "history";
21
+ readonly CLOUD_PLAN: "cloudPlan";
22
+ readonly RBAC: "rbac";
23
+ readonly PUSH: "push";
24
+ readonly COLLABORATION: "collaboration";
25
+ readonly ASSISTANT: "assistant";
26
+ readonly BUILDER: "builder";
27
+ readonly BECOME_TEMPLATE_CREATOR: "becomeTemplateCreator";
28
+ readonly PROJECTS: "projects";
29
+ readonly API_KEYS: "apiKeys";
30
+ readonly TEST_DEFINITION: "testDefinition";
31
+ readonly FOLDERS: "folders";
32
+ readonly MODULES: "modules";
33
+ };
34
+
35
+ export { STORES };
@@ -0,0 +1,35 @@
1
+ declare const STORES: {
2
+ readonly COMMUNITY_NODES: "communityNodes";
3
+ readonly ROOT: "root";
4
+ readonly SETTINGS: "settings";
5
+ readonly UI: "ui";
6
+ readonly USERS: "users";
7
+ readonly WORKFLOWS: "workflows";
8
+ readonly WORKFLOWS_V2: "workflowsV2";
9
+ readonly WORKFLOWS_EE: "workflowsEE";
10
+ readonly EXECUTIONS: "executions";
11
+ readonly NDV: "ndv";
12
+ readonly TEMPLATES: "templates";
13
+ readonly NODE_TYPES: "nodeTypes";
14
+ readonly CREDENTIALS: "credentials";
15
+ readonly TAGS: "tags";
16
+ readonly ANNOTATION_TAGS: "annotationTags";
17
+ readonly VERSIONS: "versions";
18
+ readonly NODE_CREATOR: "nodeCreator";
19
+ readonly WEBHOOKS: "webhooks";
20
+ readonly HISTORY: "history";
21
+ readonly CLOUD_PLAN: "cloudPlan";
22
+ readonly RBAC: "rbac";
23
+ readonly PUSH: "push";
24
+ readonly COLLABORATION: "collaboration";
25
+ readonly ASSISTANT: "assistant";
26
+ readonly BUILDER: "builder";
27
+ readonly BECOME_TEMPLATE_CREATOR: "becomeTemplateCreator";
28
+ readonly PROJECTS: "projects";
29
+ readonly API_KEYS: "apiKeys";
30
+ readonly TEST_DEFINITION: "testDefinition";
31
+ readonly FOLDERS: "folders";
32
+ readonly MODULES: "modules";
33
+ };
34
+
35
+ export { STORES };
@@ -0,0 +1,7 @@
1
+ import {
2
+ STORES
3
+ } from "./chunk-GWOUPYDG.js";
4
+ export {
5
+ STORES
6
+ };
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk4NAC3BDHcjs = require('./chunk-4NAC3BDH.cjs');
4
+
5
+
6
+ exports.STORES = _chunk4NAC3BDHcjs.STORES;
7
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,0CAAC","file":"/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/index.cjs"}
@@ -0,0 +1 @@
1
+ export { STORES } from './constants.cjs';
@@ -0,0 +1 @@
1
+ export { STORES } from './constants.js';
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ STORES
3
+ } from "./chunk-GWOUPYDG.js";
4
+ export {
5
+ STORES
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,156 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/useAgentRequestStore.ts
2
+ var _pinia = require('pinia');
3
+ var _vue = require('vue');
4
+ var STORAGE_KEY = "n8n-agent-requests";
5
+ var useAgentRequestStore = _pinia.defineStore.call(void 0, "agentRequest", () => {
6
+ const agentRequests = _vue.ref.call(void 0, loadFromLocalStorage());
7
+ function loadFromLocalStorage() {
8
+ try {
9
+ const storedData = localStorage.getItem(STORAGE_KEY);
10
+ return storedData ? JSON.parse(storedData) : {};
11
+ } catch (error) {
12
+ return {};
13
+ }
14
+ }
15
+ _vue.watch.call(void 0,
16
+ agentRequests,
17
+ (newValue) => {
18
+ try {
19
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(newValue));
20
+ } catch (error) {
21
+ console.error("Failed to save agent requests to localStorage:", error);
22
+ }
23
+ },
24
+ { deep: true }
25
+ );
26
+ const ensureWorkflowAndNodeExist = (workflowId, nodeId) => {
27
+ if (!agentRequests.value[workflowId]) {
28
+ agentRequests.value[workflowId] = {};
29
+ }
30
+ if (!agentRequests.value[workflowId][nodeId]) {
31
+ agentRequests.value[workflowId][nodeId] = {};
32
+ }
33
+ };
34
+ const getAgentRequests = (workflowId, nodeId) => {
35
+ return _optionalChain([agentRequests, 'access', _ => _.value, 'access', _2 => _2[workflowId], 'optionalAccess', _3 => _3[nodeId]]) || {};
36
+ };
37
+ const getAgentRequest = (workflowId, nodeId, paramName) => {
38
+ return _optionalChain([agentRequests, 'access', _4 => _4.value, 'access', _5 => _5[workflowId], 'optionalAccess', _6 => _6[nodeId], 'optionalAccess', _7 => _7[paramName]]);
39
+ };
40
+ const addAgentRequest = (workflowId, nodeId, paramName, paramValues) => {
41
+ ensureWorkflowAndNodeExist(workflowId, nodeId);
42
+ agentRequests.value[workflowId][nodeId] = {
43
+ ...agentRequests.value[workflowId][nodeId],
44
+ [paramName]: paramValues
45
+ };
46
+ return agentRequests.value[workflowId][nodeId];
47
+ };
48
+ const addAgentRequests = (workflowId, nodeId, params) => {
49
+ ensureWorkflowAndNodeExist(workflowId, nodeId);
50
+ agentRequests.value[workflowId][nodeId] = {
51
+ ...agentRequests.value[workflowId][nodeId],
52
+ ...params
53
+ };
54
+ };
55
+ const clearAgentRequests = (workflowId, nodeId) => {
56
+ if (agentRequests.value[workflowId]) {
57
+ agentRequests.value[workflowId][nodeId] = {};
58
+ }
59
+ };
60
+ const clearAllAgentRequests = (workflowId) => {
61
+ if (workflowId) {
62
+ agentRequests.value[workflowId] = {};
63
+ } else {
64
+ agentRequests.value = {};
65
+ }
66
+ };
67
+ function parsePath(path) {
68
+ return path.split(".").reduce((acc, part) => {
69
+ if (part.includes("[")) {
70
+ const [arrayName, index] = part.split("[");
71
+ if (arrayName) acc.push(arrayName);
72
+ if (index) acc.push(index.replace("]", ""));
73
+ } else {
74
+ acc.push(part);
75
+ }
76
+ return acc;
77
+ }, []);
78
+ }
79
+ function buildRequestObject(path, value) {
80
+ const result = {};
81
+ let current = result;
82
+ for (let i = 0; i < path.length - 1; i++) {
83
+ const part = path[i];
84
+ const nextPart = path[i + 1];
85
+ const isArrayIndex = nextPart && !isNaN(Number(nextPart));
86
+ if (isArrayIndex) {
87
+ if (!current[part]) {
88
+ current[part] = [];
89
+ }
90
+ while (current[part].length <= Number(nextPart)) {
91
+ current[part].push({});
92
+ }
93
+ } else if (!current[part]) {
94
+ current[part] = {};
95
+ }
96
+ current = current[part];
97
+ }
98
+ current[path[path.length - 1]] = value;
99
+ return result;
100
+ }
101
+ function deepMerge(target, source) {
102
+ const result = { ...target };
103
+ for (const key in source) {
104
+ if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
105
+ result[key] = deepMerge(
106
+ result[key] || {},
107
+ source[key]
108
+ );
109
+ } else if (Array.isArray(source[key])) {
110
+ if (Array.isArray(result[key])) {
111
+ const targetArray = result[key];
112
+ const sourceArray = source[key];
113
+ while (targetArray.length < sourceArray.length) {
114
+ targetArray.push({});
115
+ }
116
+ sourceArray.forEach((item, index) => {
117
+ if (item && typeof item === "object") {
118
+ targetArray[index] = deepMerge(
119
+ targetArray[index] || {},
120
+ item
121
+ );
122
+ } else {
123
+ targetArray[index] = item;
124
+ }
125
+ });
126
+ } else {
127
+ result[key] = source[key];
128
+ }
129
+ } else {
130
+ result[key] = source[key];
131
+ }
132
+ }
133
+ return result;
134
+ }
135
+ const generateAgentRequest = (workflowId, nodeId) => {
136
+ const nodeRequests = _optionalChain([agentRequests, 'access', _8 => _8.value, 'access', _9 => _9[workflowId], 'optionalAccess', _10 => _10[nodeId]]) || {};
137
+ return Object.entries(nodeRequests).reduce(
138
+ (acc, [path, value]) => deepMerge(acc, buildRequestObject(parsePath(path), value)),
139
+ {}
140
+ );
141
+ };
142
+ return {
143
+ agentRequests,
144
+ getAgentRequests,
145
+ getAgentRequest,
146
+ addAgentRequest,
147
+ addAgentRequests,
148
+ clearAgentRequests,
149
+ clearAllAgentRequests,
150
+ generateAgentRequest
151
+ };
152
+ });
153
+
154
+
155
+ exports.useAgentRequestStore = useAgentRequestStore;
156
+ //# sourceMappingURL=useAgentRequestStore.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/useAgentRequestStore.cjs","../src/useAgentRequestStore.ts"],"names":[],"mappings":"AAAA;ACCA,8BAA4B;AAC5B,0BAA2B;AAQ3B,IAAM,YAAA,EAAc,oBAAA;AAEb,IAAM,qBAAA,EAAuB,gCAAA,cAAY,EAAgB,CAAA,EAAA,GAAM;AAErE,EAAA,MAAM,cAAA,EAAgB,sBAAA,oBAA6B,CAAqB,CAAC,CAAA;AAGzE,EAAA,SAAS,oBAAA,CAAA,EAAgD;AACxD,IAAA,IAAI;AACH,MAAA,MAAM,WAAA,EAAa,YAAA,CAAa,OAAA,CAAQ,WAAW,CAAA;AACnD,MAAA,OAAO,WAAA,EAAa,IAAA,CAAK,KAAA,CAAM,UAAU,EAAA,EAAI,CAAC,CAAA;AAAA,IAC/C,EAAA,MAAA,CAAS,KAAA,EAAO;AACf,MAAA,OAAO,CAAC,CAAA;AAAA,IACT;AAAA,EACD;AAGA,EAAA,wBAAA;AAAA,IACC,aAAA;AAAA,IACA,CAAC,QAAA,EAAA,GAAa;AACb,MAAA,IAAI;AACH,QAAA,YAAA,CAAa,OAAA,CAAQ,WAAA,EAAa,IAAA,CAAK,SAAA,CAAU,QAAQ,CAAC,CAAA;AAAA,MAC3D,EAAA,MAAA,CAAS,KAAA,EAAO;AACf,QAAA,OAAA,CAAQ,KAAA,CAAM,gDAAA,EAAkD,KAAK,CAAA;AAAA,MACtE;AAAA,IACD,CAAA;AAAA,IACA,EAAE,IA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DAAC","file":"/home/runner/work/n8n/n8n/packages/frontend/@n8n/stores/dist/useAgentRequestStore.cjs","sourcesContent":[null,"import type { INodeParameters, NodeParameterValueType } from 'n8n-workflow';\nimport { defineStore } from 'pinia';\nimport { ref, watch } from 'vue';\n\ninterface IAgentRequestStoreState {\n\t[workflowId: string]: {\n\t\t[nodeName: string]: INodeParameters;\n\t};\n}\n\nconst STORAGE_KEY = 'n8n-agent-requests';\n\nexport const useAgentRequestStore = defineStore('agentRequest', () => {\n\t// State\n\tconst agentRequests = ref<IAgentRequestStoreState>(loadFromLocalStorage());\n\n\t// Load initial state from localStorage\n\tfunction loadFromLocalStorage(): IAgentRequestStoreState {\n\t\ttry {\n\t\t\tconst storedData = localStorage.getItem(STORAGE_KEY);\n\t\t\treturn storedData ? JSON.parse(storedData) : {};\n\t\t} catch (error) {\n\t\t\treturn {};\n\t\t}\n\t}\n\n\t// Save state to localStorage whenever it changes\n\twatch(\n\t\tagentRequests,\n\t\t(newValue) => {\n\t\t\ttry {\n\t\t\t\tlocalStorage.setItem(STORAGE_KEY, JSON.stringify(newValue));\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to save agent requests to localStorage:', error);\n\t\t\t}\n\t\t},\n\t\t{ deep: true },\n\t);\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] = {};\n\t\t}\n\t};\n\n\t// Getters\n\tconst getAgentRequests = (workflowId: string, nodeId: string): INodeParameters => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId] || {};\n\t};\n\n\tconst getAgentRequest = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tparamName: string,\n\t): NodeParameterValueType | undefined => {\n\t\treturn agentRequests.value[workflowId]?.[nodeId]?.[paramName];\n\t};\n\n\t// Actions\n\tconst addAgentRequest = (\n\t\tworkflowId: string,\n\t\tnodeId: string,\n\t\tparamName: string,\n\t\tparamValues: NodeParameterValueType,\n\t): INodeParameters => {\n\t\tensureWorkflowAndNodeExist(workflowId, nodeId);\n\n\t\tagentRequests.value[workflowId][nodeId] = {\n\t\t\t...agentRequests.value[workflowId][nodeId],\n\t\t\t[paramName]: paramValues,\n\t\t};\n\n\t\treturn agentRequests.value[workflowId][nodeId];\n\t};\n\n\tconst addAgentRequests = (workflowId: string, nodeId: string, params: INodeParameters): void => {\n\t\tensureWorkflowAndNodeExist(workflowId, nodeId);\n\n\t\tagentRequests.value[workflowId][nodeId] = {\n\t\t\t...agentRequests.value[workflowId][nodeId],\n\t\t\t...params,\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] = {};\n\t\t}\n\t};\n\n\tconst clearAllAgentRequests = (workflowId?: string): void => {\n\t\tif (workflowId) {\n\t\t\t// Clear requests for a specific workflow\n\t\t\tagentRequests.value[workflowId] = {};\n\t\t} else {\n\t\t\t// Clear all requests\n\t\t\tagentRequests.value = {};\n\t\t}\n\t};\n\n\tfunction parsePath(path: string): string[] {\n\t\treturn path.split('.').reduce((acc: string[], part) => {\n\t\t\tif (part.includes('[')) {\n\t\t\t\tconst [arrayName, index] = part.split('[');\n\t\t\t\tif (arrayName) acc.push(arrayName);\n\t\t\t\tif (index) acc.push(index.replace(']', ''));\n\t\t\t} else {\n\t\t\t\tacc.push(part);\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, []);\n\t}\n\n\tfunction buildRequestObject(path: string[], value: NodeParameterValueType): INodeParameters {\n\t\tconst result: INodeParameters = {};\n\t\tlet current = result;\n\n\t\tfor (let i = 0; i < path.length - 1; i++) {\n\t\t\tconst part = path[i];\n\t\t\tconst nextPart = path[i + 1];\n\t\t\tconst isArrayIndex = nextPart && !isNaN(Number(nextPart));\n\n\t\t\tif (isArrayIndex) {\n\t\t\t\tif (!current[part]) {\n\t\t\t\t\tcurrent[part] = [];\n\t\t\t\t}\n\t\t\t\twhile ((current[part] as NodeParameterValueType[]).length <= Number(nextPart)) {\n\t\t\t\t\t(current[part] as NodeParameterValueType[]).push({});\n\t\t\t\t}\n\t\t\t} else if (!current[part]) {\n\t\t\t\tcurrent[part] = {};\n\t\t\t}\n\n\t\t\tcurrent = current[part] as INodeParameters;\n\t\t}\n\n\t\tcurrent[path[path.length - 1]] = value;\n\t\treturn result;\n\t}\n\n\t// Helper function to deep merge objects\n\tfunction deepMerge(target: INodeParameters, source: INodeParameters): INodeParameters {\n\t\tconst result = { ...target };\n\n\t\tfor (const key in source) {\n\t\t\tif (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n\t\t\t\t// Recursively merge nested objects\n\t\t\t\tresult[key] = deepMerge(\n\t\t\t\t\t(result[key] as INodeParameters) || {},\n\t\t\t\t\tsource[key] as INodeParameters,\n\t\t\t\t);\n\t\t\t} else if (Array.isArray(source[key])) {\n\t\t\t\t// For arrays, merge by index\n\t\t\t\tif (Array.isArray(result[key])) {\n\t\t\t\t\tconst targetArray = result[key] as NodeParameterValueType[];\n\t\t\t\t\tconst sourceArray = source[key] as NodeParameterValueType[];\n\n\t\t\t\t\t// Ensure target array has enough elements\n\t\t\t\t\twhile (targetArray.length < sourceArray.length) {\n\t\t\t\t\t\ttargetArray.push({});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Merge each array item\n\t\t\t\t\tsourceArray.forEach((item, index) => {\n\t\t\t\t\t\tif (item && typeof item === 'object') {\n\t\t\t\t\t\t\ttargetArray[index] = deepMerge(\n\t\t\t\t\t\t\t\t(targetArray[index] as INodeParameters) || {},\n\t\t\t\t\t\t\t\titem as INodeParameters,\n\t\t\t\t\t\t\t) as NodeParameterValueType;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetArray[index] = item;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tresult[key] = source[key];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For primitive values, use source value\n\t\t\t\tresult[key] = source[key];\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tconst generateAgentRequest = (workflowId: string, nodeId: string): INodeParameters => {\n\t\tconst nodeRequests = agentRequests.value[workflowId]?.[nodeId] || {};\n\n\t\treturn Object.entries(nodeRequests).reduce(\n\t\t\t(acc, [path, value]) => deepMerge(acc, buildRequestObject(parsePath(path), value)),\n\t\t\t{} as INodeParameters,\n\t\t);\n\t};\n\n\treturn {\n\t\tagentRequests,\n\t\tgetAgentRequests,\n\t\tgetAgentRequest,\n\t\taddAgentRequest,\n\t\taddAgentRequests,\n\t\tclearAgentRequests,\n\t\tclearAllAgentRequests,\n\t\tgenerateAgentRequest,\n\t};\n});\n"]}
@@ -0,0 +1,39 @@
1
+ import * as pinia from 'pinia';
2
+ import * as vue from 'vue';
3
+ import { INodeParameters, NodeParameterValueType } from 'n8n-workflow';
4
+
5
+ interface IAgentRequestStoreState {
6
+ [workflowId: string]: {
7
+ [nodeName: string]: INodeParameters;
8
+ };
9
+ }
10
+ declare const useAgentRequestStore: pinia.StoreDefinition<"agentRequest", Pick<{
11
+ agentRequests: vue.Ref<IAgentRequestStoreState, IAgentRequestStoreState>;
12
+ getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters;
13
+ getAgentRequest: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
14
+ addAgentRequest: (workflowId: string, nodeId: string, paramName: string, paramValues: NodeParameterValueType) => INodeParameters;
15
+ addAgentRequests: (workflowId: string, nodeId: string, params: INodeParameters) => void;
16
+ clearAgentRequests: (workflowId: string, nodeId: string) => void;
17
+ clearAllAgentRequests: (workflowId?: string) => void;
18
+ generateAgentRequest: (workflowId: string, nodeId: string) => INodeParameters;
19
+ }, "agentRequests">, Pick<{
20
+ agentRequests: vue.Ref<IAgentRequestStoreState, IAgentRequestStoreState>;
21
+ getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters;
22
+ getAgentRequest: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
23
+ addAgentRequest: (workflowId: string, nodeId: string, paramName: string, paramValues: NodeParameterValueType) => INodeParameters;
24
+ addAgentRequests: (workflowId: string, nodeId: string, params: INodeParameters) => void;
25
+ clearAgentRequests: (workflowId: string, nodeId: string) => void;
26
+ clearAllAgentRequests: (workflowId?: string) => void;
27
+ generateAgentRequest: (workflowId: string, nodeId: string) => INodeParameters;
28
+ }, never>, Pick<{
29
+ agentRequests: vue.Ref<IAgentRequestStoreState, IAgentRequestStoreState>;
30
+ getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters;
31
+ getAgentRequest: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
32
+ addAgentRequest: (workflowId: string, nodeId: string, paramName: string, paramValues: NodeParameterValueType) => INodeParameters;
33
+ addAgentRequests: (workflowId: string, nodeId: string, params: INodeParameters) => void;
34
+ clearAgentRequests: (workflowId: string, nodeId: string) => void;
35
+ clearAllAgentRequests: (workflowId?: string) => void;
36
+ generateAgentRequest: (workflowId: string, nodeId: string) => INodeParameters;
37
+ }, "getAgentRequests" | "getAgentRequest" | "addAgentRequest" | "addAgentRequests" | "clearAgentRequests" | "clearAllAgentRequests" | "generateAgentRequest">>;
38
+
39
+ export { useAgentRequestStore };
@@ -0,0 +1,39 @@
1
+ import * as pinia from 'pinia';
2
+ import * as vue from 'vue';
3
+ import { INodeParameters, NodeParameterValueType } from 'n8n-workflow';
4
+
5
+ interface IAgentRequestStoreState {
6
+ [workflowId: string]: {
7
+ [nodeName: string]: INodeParameters;
8
+ };
9
+ }
10
+ declare const useAgentRequestStore: pinia.StoreDefinition<"agentRequest", Pick<{
11
+ agentRequests: vue.Ref<IAgentRequestStoreState, IAgentRequestStoreState>;
12
+ getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters;
13
+ getAgentRequest: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
14
+ addAgentRequest: (workflowId: string, nodeId: string, paramName: string, paramValues: NodeParameterValueType) => INodeParameters;
15
+ addAgentRequests: (workflowId: string, nodeId: string, params: INodeParameters) => void;
16
+ clearAgentRequests: (workflowId: string, nodeId: string) => void;
17
+ clearAllAgentRequests: (workflowId?: string) => void;
18
+ generateAgentRequest: (workflowId: string, nodeId: string) => INodeParameters;
19
+ }, "agentRequests">, Pick<{
20
+ agentRequests: vue.Ref<IAgentRequestStoreState, IAgentRequestStoreState>;
21
+ getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters;
22
+ getAgentRequest: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
23
+ addAgentRequest: (workflowId: string, nodeId: string, paramName: string, paramValues: NodeParameterValueType) => INodeParameters;
24
+ addAgentRequests: (workflowId: string, nodeId: string, params: INodeParameters) => void;
25
+ clearAgentRequests: (workflowId: string, nodeId: string) => void;
26
+ clearAllAgentRequests: (workflowId?: string) => void;
27
+ generateAgentRequest: (workflowId: string, nodeId: string) => INodeParameters;
28
+ }, never>, Pick<{
29
+ agentRequests: vue.Ref<IAgentRequestStoreState, IAgentRequestStoreState>;
30
+ getAgentRequests: (workflowId: string, nodeId: string) => INodeParameters;
31
+ getAgentRequest: (workflowId: string, nodeId: string, paramName: string) => NodeParameterValueType | undefined;
32
+ addAgentRequest: (workflowId: string, nodeId: string, paramName: string, paramValues: NodeParameterValueType) => INodeParameters;
33
+ addAgentRequests: (workflowId: string, nodeId: string, params: INodeParameters) => void;
34
+ clearAgentRequests: (workflowId: string, nodeId: string) => void;
35
+ clearAllAgentRequests: (workflowId?: string) => void;
36
+ generateAgentRequest: (workflowId: string, nodeId: string) => INodeParameters;
37
+ }, "getAgentRequests" | "getAgentRequest" | "addAgentRequest" | "addAgentRequests" | "clearAgentRequests" | "clearAllAgentRequests" | "generateAgentRequest">>;
38
+
39
+ export { useAgentRequestStore };