@n8n/stores 2.36.2 → 2.37.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/composables/useBasePageRedirectionHelper.cjs +28 -8
- package/dist/composables/useBasePageRedirectionHelper.cjs.map +1 -1
- package/dist/composables/useBasePageRedirectionHelper.d.cts +7 -0
- package/dist/composables/useBasePageRedirectionHelper.d.mts +7 -0
- package/dist/composables/useBasePageRedirectionHelper.mjs +28 -8
- package/dist/composables/useBasePageRedirectionHelper.mjs.map +1 -1
- package/dist/constants2.cjs +1 -0
- package/dist/constants2.cjs.map +1 -1
- package/dist/constants2.d.cts +1 -0
- package/dist/constants2.d.mts +1 -0
- package/dist/constants2.mjs +1 -0
- package/dist/constants2.mjs.map +1 -1
- package/dist/notifications.store.d.cts +2 -2
- package/dist/pageRedirection.d.cts +2 -2
- package/dist/pageRedirection.d.mts +2 -2
- package/dist/rbac.store.cjs +1 -0
- package/dist/rbac.store.cjs.map +1 -1
- package/dist/rbac.store.d.cts +51 -45
- package/dist/rbac.store.d.mts +51 -45
- package/dist/rbac.store.mjs +1 -0
- package/dist/rbac.store.mjs.map +1 -1
- package/dist/roles.store.d.cts +21 -21
- package/dist/roles.store.d.mts +21 -21
- package/dist/settings.store.d.cts +250 -244
- package/dist/settings.store.d.mts +250 -244
- package/dist/settings2.store.cjs +9 -0
- package/dist/settings2.store.cjs.map +1 -1
- package/dist/settings2.store.mjs +9 -0
- package/dist/settings2.store.mjs.map +1 -1
- package/dist/useAgentRequestStore.d.cts +2 -2
- package/dist/useAgentRequestStore.d.mts +2 -2
- package/dist/useRootStore.d.cts +75 -75
- package/dist/useRootStore.d.mts +75 -75
- package/dist/users.store.d.cts +49 -49
- package/dist/users.store.d.mts +51 -51
- package/dist/versions.store.d.cts +30 -30
- package/dist/versions.store.d.mts +30 -30
- package/package.json +13 -13
|
@@ -27,23 +27,42 @@ function useBasePageRedirectionHelper({ guard }) {
|
|
|
27
27
|
const versionsStore = require_versions_store.useVersionsStore();
|
|
28
28
|
const telemetry = (0, __n8n_composables_useTelemetry.useTelemetry)();
|
|
29
29
|
const settingsStore = require_settings_store.useSettingsStore();
|
|
30
|
+
const canAutoLoginToCloudDashboard = () => usersStore.isInstanceOwner && settingsStore.isCloudDeployment;
|
|
31
|
+
/**
|
|
32
|
+
* `open` reserves the tab in the click so later navigation is not treated as a popup.
|
|
33
|
+
*/
|
|
34
|
+
const goToCloudDashboard = async ({ redirectionPath, mode = "redirect" }) => {
|
|
35
|
+
if (!canAutoLoginToCloudDashboard()) return false;
|
|
36
|
+
if (mode === "redirect") {
|
|
37
|
+
location.href = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath });
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
const tab = window.open("", "_blank");
|
|
41
|
+
if (tab) tab.opener = null;
|
|
42
|
+
try {
|
|
43
|
+
const link = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath });
|
|
44
|
+
if (tab) tab.location.href = link;
|
|
45
|
+
else location.href = link;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
tab?.close();
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
};
|
|
30
52
|
/**
|
|
31
53
|
* If the user is an instance owner in the cloud, it generates an auto-login link to the
|
|
32
54
|
* cloud dashboard that redirects the user to the /manage page where they can upgrade to a new n8n version.
|
|
33
55
|
* Otherwise, it redirect them to our docs.
|
|
34
56
|
*/
|
|
35
57
|
const goToVersions = async () => {
|
|
36
|
-
if (
|
|
37
|
-
|
|
58
|
+
if (!canAutoLoginToCloudDashboard()) {
|
|
59
|
+
window.open(versionsStore.infoUrl, "_blank", "noopener");
|
|
38
60
|
return;
|
|
39
61
|
}
|
|
40
|
-
|
|
62
|
+
await goToCloudDashboard({ redirectionPath: "/manage" });
|
|
41
63
|
};
|
|
42
64
|
const goToDashboard = async () => {
|
|
43
|
-
|
|
44
|
-
const dashboardLink = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath: "/dashboard" });
|
|
45
|
-
location.href = dashboardLink;
|
|
46
|
-
}
|
|
65
|
+
await goToCloudDashboard({ redirectionPath: "/dashboard" });
|
|
47
66
|
};
|
|
48
67
|
/**
|
|
49
68
|
* If the user is an instance owner in the cloud, it generates an auto-login link to the
|
|
@@ -69,13 +88,14 @@ function useBasePageRedirectionHelper({ guard }) {
|
|
|
69
88
|
};
|
|
70
89
|
const generateUpgradeLink = async (source, utm_campaign) => {
|
|
71
90
|
let upgradeLink = __n8n_frontend_constants_urls.N8N_PRICING_PAGE_URL;
|
|
72
|
-
if (
|
|
91
|
+
if (canAutoLoginToCloudDashboard()) upgradeLink = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath: "/account/change-plan" });
|
|
73
92
|
const url = new URL(upgradeLink);
|
|
74
93
|
if (utm_campaign) url.searchParams.set("utm_campaign", utm_campaign);
|
|
75
94
|
if (source) url.searchParams.set("source", source);
|
|
76
95
|
return url.toString();
|
|
77
96
|
};
|
|
78
97
|
return {
|
|
98
|
+
goToCloudDashboard,
|
|
79
99
|
goToDashboard,
|
|
80
100
|
goToVersions,
|
|
81
101
|
goToUpgrade
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBasePageRedirectionHelper.cjs","names":["useUsersStore","useCloudPlanStore","useVersionsStore","useSettingsStore","N8N_PRICING_PAGE_URL"],"sources":["../../src/composables/useBasePageRedirectionHelper.ts"],"sourcesContent":["import { useTelemetry } from '@n8n/composables/useTelemetry';\nimport { N8N_PRICING_PAGE_URL } from '@n8n/frontend-constants/urls';\n\nimport { useCloudPlanStore } from '../cloudPlan.store';\nimport { useSettingsStore } from '../settings.store';\nimport type { CloudUpdateLinkSourceType, UTMCampaign } from '../types/pageRedirection';\nimport { useUsersStore } from '../users.store';\nimport { useVersionsStore } from '../versions.store';\n\n/**\n * Guard consulted before an upgrade redirect. Resolves `true` to proceed, `false`\n * to abort. Required and injected by the caller, so this composable carries no\n * feature dependency of its own (e.g. the AI builder streaming confirmation).\n */\nexport type UpgradeRedirectGuard = () => Promise<boolean>;\n\n/**\n * Injectable page-redirection composable. The app-facing `usePageRedirectionHelper`\n * wraps this and supplies the guard, which keeps this base free of any feature\n * dependency.\n *\n * It lives in `@n8n/stores` rather than `@n8n/composables` because its body is\n * store orchestration end to end — all four stores it reads are in this package,\n * and `@n8n/composables` sits *below* the stores tier (see that package's\n * `packageBoundary.test.ts`), so it cannot reach them.\n */\nexport function useBasePageRedirectionHelper({ guard }: { guard: UpgradeRedirectGuard }) {\n\tconst usersStore = useUsersStore();\n\tconst cloudPlanStore = useCloudPlanStore();\n\tconst versionsStore = useVersionsStore();\n\tconst telemetry = useTelemetry();\n\tconst settingsStore = useSettingsStore();\n\n\
|
|
1
|
+
{"version":3,"file":"useBasePageRedirectionHelper.cjs","names":["useUsersStore","useCloudPlanStore","useVersionsStore","useSettingsStore","N8N_PRICING_PAGE_URL"],"sources":["../../src/composables/useBasePageRedirectionHelper.ts"],"sourcesContent":["import { useTelemetry } from '@n8n/composables/useTelemetry';\nimport { N8N_PRICING_PAGE_URL } from '@n8n/frontend-constants/urls';\n\nimport { useCloudPlanStore } from '../cloudPlan.store';\nimport { useSettingsStore } from '../settings.store';\nimport type { CloudUpdateLinkSourceType, UTMCampaign } from '../types/pageRedirection';\nimport { useUsersStore } from '../users.store';\nimport { useVersionsStore } from '../versions.store';\n\n/**\n * Guard consulted before an upgrade redirect. Resolves `true` to proceed, `false`\n * to abort. Required and injected by the caller, so this composable carries no\n * feature dependency of its own (e.g. the AI builder streaming confirmation).\n */\nexport type UpgradeRedirectGuard = () => Promise<boolean>;\n\n/**\n * Injectable page-redirection composable. The app-facing `usePageRedirectionHelper`\n * wraps this and supplies the guard, which keeps this base free of any feature\n * dependency.\n *\n * It lives in `@n8n/stores` rather than `@n8n/composables` because its body is\n * store orchestration end to end — all four stores it reads are in this package,\n * and `@n8n/composables` sits *below* the stores tier (see that package's\n * `packageBoundary.test.ts`), so it cannot reach them.\n */\nexport function useBasePageRedirectionHelper({ guard }: { guard: UpgradeRedirectGuard }) {\n\tconst usersStore = useUsersStore();\n\tconst cloudPlanStore = useCloudPlanStore();\n\tconst versionsStore = useVersionsStore();\n\tconst telemetry = useTelemetry();\n\tconst settingsStore = useSettingsStore();\n\n\tconst canAutoLoginToCloudDashboard = () =>\n\t\tusersStore.isInstanceOwner && settingsStore.isCloudDeployment;\n\n\t/**\n\t * `open` reserves the tab in the click so later navigation is not treated as a popup.\n\t */\n\tconst goToCloudDashboard = async ({\n\t\tredirectionPath,\n\t\tmode = 'redirect',\n\t}: {\n\t\tredirectionPath: string;\n\t\tmode?: 'open' | 'redirect';\n\t}): Promise<boolean> => {\n\t\tif (!canAutoLoginToCloudDashboard()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (mode === 'redirect') {\n\t\t\tlocation.href = await cloudPlanStore.generateCloudDashboardAutoLoginLink({\n\t\t\t\tredirectionPath,\n\t\t\t});\n\t\t\treturn true;\n\t\t}\n\n\t\tconst tab = window.open('', '_blank');\n\t\tif (tab) tab.opener = null;\n\t\ttry {\n\t\t\tconst link = await cloudPlanStore.generateCloudDashboardAutoLoginLink({\n\t\t\t\tredirectionPath,\n\t\t\t});\n\t\t\tif (tab) {\n\t\t\t\ttab.location.href = link;\n\t\t\t} else {\n\t\t\t\tlocation.href = link;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\ttab?.close();\n\t\t\tthrow error;\n\t\t}\n\t\treturn true;\n\t};\n\n\t/**\n\t * If the user is an instance owner in the cloud, it generates an auto-login link to the\n\t * cloud dashboard that redirects the user to the /manage page where they can upgrade to a new n8n version.\n\t * Otherwise, it redirect them to our docs.\n\t */\n\tconst goToVersions = async () => {\n\t\tif (!canAutoLoginToCloudDashboard()) {\n\t\t\twindow.open(versionsStore.infoUrl, '_blank', 'noopener');\n\t\t\treturn;\n\t\t}\n\n\t\tawait goToCloudDashboard({ redirectionPath: '/manage' });\n\t};\n\n\tconst goToDashboard = async () => {\n\t\tawait goToCloudDashboard({ redirectionPath: '/dashboard' });\n\t};\n\n\t/**\n\t * If the user is an instance owner in the cloud, it generates an auto-login link to the\n\t * cloud dashboard that redirects the user to the /account/change-plan page where they upgrade/downgrade the current plan.\n\t * Otherwise, it redirect them our website.\n\t */\n\n\tconst goToUpgrade = async (\n\t\tsource: CloudUpdateLinkSourceType,\n\t\tutm_campaign: UTMCampaign,\n\t\tmode: 'open' | 'redirect' = 'open',\n\t) => {\n\t\tconst shouldProceed = await guard();\n\t\tif (!shouldProceed) return;\n\n\t\tconst { usageLeft, trialDaysLeft, userIsTrialing } = cloudPlanStore;\n\t\tconst { executionsLeft, workflowsLeft } = usageLeft;\n\t\tconst deploymentType = settingsStore.deploymentType;\n\n\t\ttelemetry.track('User clicked upgrade CTA', {\n\t\t\tsource,\n\t\t\tisTrial: userIsTrialing,\n\t\t\tdeploymentType,\n\t\t\ttrialDaysLeft,\n\t\t\texecutionsLeft,\n\t\t\tworkflowsLeft,\n\t\t});\n\n\t\tconst upgradeLink = await generateUpgradeLink(source, utm_campaign);\n\n\t\tif (mode === 'open') {\n\t\t\twindow.open(upgradeLink, '_blank');\n\t\t} else {\n\t\t\tlocation.href = upgradeLink;\n\t\t}\n\t};\n\n\tconst generateUpgradeLink = async (source: string, utm_campaign: string) => {\n\t\tlet upgradeLink = N8N_PRICING_PAGE_URL;\n\n\t\tif (canAutoLoginToCloudDashboard()) {\n\t\t\tupgradeLink = await cloudPlanStore.generateCloudDashboardAutoLoginLink({\n\t\t\t\tredirectionPath: '/account/change-plan',\n\t\t\t});\n\t\t}\n\n\t\tconst url = new URL(upgradeLink);\n\n\t\tif (utm_campaign) {\n\t\t\turl.searchParams.set('utm_campaign', utm_campaign);\n\t\t}\n\n\t\tif (source) {\n\t\t\turl.searchParams.set('source', source);\n\t\t}\n\n\t\treturn url.toString();\n\t};\n\n\treturn {\n\t\tgoToCloudDashboard,\n\t\tgoToDashboard,\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EAEF,MAAM,cAAc,MAAM,oBAAoB,QAAQ,aAAa;AAEnE,MAAI,SAAS,OACZ,QAAO,KAAK,aAAa,SAAS;MAElC,UAAS,OAAO;;CAIlB,MAAM,sBAAsB,OAAO,QAAgB,iBAAyB;EAC3E,IAAI,cAAcC;AAElB,MAAI,8BAA8B,CACjC,eAAc,MAAM,eAAe,oCAAoC,EACtE,iBAAiB,wBACjB,CAAC;EAGH,MAAM,MAAM,IAAI,IAAI,YAAY;AAEhC,MAAI,aACH,KAAI,aAAa,IAAI,gBAAgB,aAAa;AAGnD,MAAI,OACH,KAAI,aAAa,IAAI,UAAU,OAAO;AAGvC,SAAO,IAAI,UAAU;;AAGtB,QAAO;EACN;EACA;EACA;EACA;EACA"}
|
|
@@ -7,6 +7,13 @@ declare function useBasePageRedirectionHelper({
|
|
|
7
7
|
}: {
|
|
8
8
|
guard: UpgradeRedirectGuard;
|
|
9
9
|
}): {
|
|
10
|
+
goToCloudDashboard: ({
|
|
11
|
+
redirectionPath,
|
|
12
|
+
mode
|
|
13
|
+
}: {
|
|
14
|
+
redirectionPath: string;
|
|
15
|
+
mode?: "open" | "redirect";
|
|
16
|
+
}) => Promise<boolean>;
|
|
10
17
|
goToDashboard: () => Promise<void>;
|
|
11
18
|
goToVersions: () => Promise<void>;
|
|
12
19
|
goToUpgrade: (source: CloudUpdateLinkSourceType, utm_campaign: UTMCampaign, mode?: "open" | "redirect") => Promise<void>;
|
|
@@ -7,6 +7,13 @@ declare function useBasePageRedirectionHelper({
|
|
|
7
7
|
}: {
|
|
8
8
|
guard: UpgradeRedirectGuard;
|
|
9
9
|
}): {
|
|
10
|
+
goToCloudDashboard: ({
|
|
11
|
+
redirectionPath,
|
|
12
|
+
mode
|
|
13
|
+
}: {
|
|
14
|
+
redirectionPath: string;
|
|
15
|
+
mode?: "open" | "redirect";
|
|
16
|
+
}) => Promise<boolean>;
|
|
10
17
|
goToDashboard: () => Promise<void>;
|
|
11
18
|
goToVersions: () => Promise<void>;
|
|
12
19
|
goToUpgrade: (source: CloudUpdateLinkSourceType, utm_campaign: UTMCampaign, mode?: "open" | "redirect") => Promise<void>;
|
|
@@ -27,23 +27,42 @@ function useBasePageRedirectionHelper({ guard }) {
|
|
|
27
27
|
const versionsStore = useVersionsStore();
|
|
28
28
|
const telemetry = useTelemetry();
|
|
29
29
|
const settingsStore = useSettingsStore();
|
|
30
|
+
const canAutoLoginToCloudDashboard = () => usersStore.isInstanceOwner && settingsStore.isCloudDeployment;
|
|
31
|
+
/**
|
|
32
|
+
* `open` reserves the tab in the click so later navigation is not treated as a popup.
|
|
33
|
+
*/
|
|
34
|
+
const goToCloudDashboard = async ({ redirectionPath, mode = "redirect" }) => {
|
|
35
|
+
if (!canAutoLoginToCloudDashboard()) return false;
|
|
36
|
+
if (mode === "redirect") {
|
|
37
|
+
location.href = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath });
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
const tab = window.open("", "_blank");
|
|
41
|
+
if (tab) tab.opener = null;
|
|
42
|
+
try {
|
|
43
|
+
const link = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath });
|
|
44
|
+
if (tab) tab.location.href = link;
|
|
45
|
+
else location.href = link;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
tab?.close();
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
};
|
|
30
52
|
/**
|
|
31
53
|
* If the user is an instance owner in the cloud, it generates an auto-login link to the
|
|
32
54
|
* cloud dashboard that redirects the user to the /manage page where they can upgrade to a new n8n version.
|
|
33
55
|
* Otherwise, it redirect them to our docs.
|
|
34
56
|
*/
|
|
35
57
|
const goToVersions = async () => {
|
|
36
|
-
if (
|
|
37
|
-
|
|
58
|
+
if (!canAutoLoginToCloudDashboard()) {
|
|
59
|
+
window.open(versionsStore.infoUrl, "_blank", "noopener");
|
|
38
60
|
return;
|
|
39
61
|
}
|
|
40
|
-
|
|
62
|
+
await goToCloudDashboard({ redirectionPath: "/manage" });
|
|
41
63
|
};
|
|
42
64
|
const goToDashboard = async () => {
|
|
43
|
-
|
|
44
|
-
const dashboardLink = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath: "/dashboard" });
|
|
45
|
-
location.href = dashboardLink;
|
|
46
|
-
}
|
|
65
|
+
await goToCloudDashboard({ redirectionPath: "/dashboard" });
|
|
47
66
|
};
|
|
48
67
|
/**
|
|
49
68
|
* If the user is an instance owner in the cloud, it generates an auto-login link to the
|
|
@@ -69,13 +88,14 @@ function useBasePageRedirectionHelper({ guard }) {
|
|
|
69
88
|
};
|
|
70
89
|
const generateUpgradeLink = async (source, utm_campaign) => {
|
|
71
90
|
let upgradeLink = N8N_PRICING_PAGE_URL;
|
|
72
|
-
if (
|
|
91
|
+
if (canAutoLoginToCloudDashboard()) upgradeLink = await cloudPlanStore.generateCloudDashboardAutoLoginLink({ redirectionPath: "/account/change-plan" });
|
|
73
92
|
const url = new URL(upgradeLink);
|
|
74
93
|
if (utm_campaign) url.searchParams.set("utm_campaign", utm_campaign);
|
|
75
94
|
if (source) url.searchParams.set("source", source);
|
|
76
95
|
return url.toString();
|
|
77
96
|
};
|
|
78
97
|
return {
|
|
98
|
+
goToCloudDashboard,
|
|
79
99
|
goToDashboard,
|
|
80
100
|
goToVersions,
|
|
81
101
|
goToUpgrade
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBasePageRedirectionHelper.mjs","names":[],"sources":["../../src/composables/useBasePageRedirectionHelper.ts"],"sourcesContent":["import { useTelemetry } from '@n8n/composables/useTelemetry';\nimport { N8N_PRICING_PAGE_URL } from '@n8n/frontend-constants/urls';\n\nimport { useCloudPlanStore } from '../cloudPlan.store';\nimport { useSettingsStore } from '../settings.store';\nimport type { CloudUpdateLinkSourceType, UTMCampaign } from '../types/pageRedirection';\nimport { useUsersStore } from '../users.store';\nimport { useVersionsStore } from '../versions.store';\n\n/**\n * Guard consulted before an upgrade redirect. Resolves `true` to proceed, `false`\n * to abort. Required and injected by the caller, so this composable carries no\n * feature dependency of its own (e.g. the AI builder streaming confirmation).\n */\nexport type UpgradeRedirectGuard = () => Promise<boolean>;\n\n/**\n * Injectable page-redirection composable. The app-facing `usePageRedirectionHelper`\n * wraps this and supplies the guard, which keeps this base free of any feature\n * dependency.\n *\n * It lives in `@n8n/stores` rather than `@n8n/composables` because its body is\n * store orchestration end to end — all four stores it reads are in this package,\n * and `@n8n/composables` sits *below* the stores tier (see that package's\n * `packageBoundary.test.ts`), so it cannot reach them.\n */\nexport function useBasePageRedirectionHelper({ guard }: { guard: UpgradeRedirectGuard }) {\n\tconst usersStore = useUsersStore();\n\tconst cloudPlanStore = useCloudPlanStore();\n\tconst versionsStore = useVersionsStore();\n\tconst telemetry = useTelemetry();\n\tconst settingsStore = useSettingsStore();\n\n\
|
|
1
|
+
{"version":3,"file":"useBasePageRedirectionHelper.mjs","names":[],"sources":["../../src/composables/useBasePageRedirectionHelper.ts"],"sourcesContent":["import { useTelemetry } from '@n8n/composables/useTelemetry';\nimport { N8N_PRICING_PAGE_URL } from '@n8n/frontend-constants/urls';\n\nimport { useCloudPlanStore } from '../cloudPlan.store';\nimport { useSettingsStore } from '../settings.store';\nimport type { CloudUpdateLinkSourceType, UTMCampaign } from '../types/pageRedirection';\nimport { useUsersStore } from '../users.store';\nimport { useVersionsStore } from '../versions.store';\n\n/**\n * Guard consulted before an upgrade redirect. Resolves `true` to proceed, `false`\n * to abort. Required and injected by the caller, so this composable carries no\n * feature dependency of its own (e.g. the AI builder streaming confirmation).\n */\nexport type UpgradeRedirectGuard = () => Promise<boolean>;\n\n/**\n * Injectable page-redirection composable. The app-facing `usePageRedirectionHelper`\n * wraps this and supplies the guard, which keeps this base free of any feature\n * dependency.\n *\n * It lives in `@n8n/stores` rather than `@n8n/composables` because its body is\n * store orchestration end to end — all four stores it reads are in this package,\n * and `@n8n/composables` sits *below* the stores tier (see that package's\n * `packageBoundary.test.ts`), so it cannot reach them.\n */\nexport function useBasePageRedirectionHelper({ guard }: { guard: UpgradeRedirectGuard }) {\n\tconst usersStore = useUsersStore();\n\tconst cloudPlanStore = useCloudPlanStore();\n\tconst versionsStore = useVersionsStore();\n\tconst telemetry = useTelemetry();\n\tconst settingsStore = useSettingsStore();\n\n\tconst canAutoLoginToCloudDashboard = () =>\n\t\tusersStore.isInstanceOwner && settingsStore.isCloudDeployment;\n\n\t/**\n\t * `open` reserves the tab in the click so later navigation is not treated as a popup.\n\t */\n\tconst goToCloudDashboard = async ({\n\t\tredirectionPath,\n\t\tmode = 'redirect',\n\t}: {\n\t\tredirectionPath: string;\n\t\tmode?: 'open' | 'redirect';\n\t}): Promise<boolean> => {\n\t\tif (!canAutoLoginToCloudDashboard()) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (mode === 'redirect') {\n\t\t\tlocation.href = await cloudPlanStore.generateCloudDashboardAutoLoginLink({\n\t\t\t\tredirectionPath,\n\t\t\t});\n\t\t\treturn true;\n\t\t}\n\n\t\tconst tab = window.open('', '_blank');\n\t\tif (tab) tab.opener = null;\n\t\ttry {\n\t\t\tconst link = await cloudPlanStore.generateCloudDashboardAutoLoginLink({\n\t\t\t\tredirectionPath,\n\t\t\t});\n\t\t\tif (tab) {\n\t\t\t\ttab.location.href = link;\n\t\t\t} else {\n\t\t\t\tlocation.href = link;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\ttab?.close();\n\t\t\tthrow error;\n\t\t}\n\t\treturn true;\n\t};\n\n\t/**\n\t * If the user is an instance owner in the cloud, it generates an auto-login link to the\n\t * cloud dashboard that redirects the user to the /manage page where they can upgrade to a new n8n version.\n\t * Otherwise, it redirect them to our docs.\n\t */\n\tconst goToVersions = async () => {\n\t\tif (!canAutoLoginToCloudDashboard()) {\n\t\t\twindow.open(versionsStore.infoUrl, '_blank', 'noopener');\n\t\t\treturn;\n\t\t}\n\n\t\tawait goToCloudDashboard({ redirectionPath: '/manage' });\n\t};\n\n\tconst goToDashboard = async () => {\n\t\tawait goToCloudDashboard({ redirectionPath: '/dashboard' });\n\t};\n\n\t/**\n\t * If the user is an instance owner in the cloud, it generates an auto-login link to the\n\t * cloud dashboard that redirects the user to the /account/change-plan page where they upgrade/downgrade the current plan.\n\t * Otherwise, it redirect them our website.\n\t */\n\n\tconst goToUpgrade = async (\n\t\tsource: CloudUpdateLinkSourceType,\n\t\tutm_campaign: UTMCampaign,\n\t\tmode: 'open' | 'redirect' = 'open',\n\t) => {\n\t\tconst shouldProceed = await guard();\n\t\tif (!shouldProceed) return;\n\n\t\tconst { usageLeft, trialDaysLeft, userIsTrialing } = cloudPlanStore;\n\t\tconst { executionsLeft, workflowsLeft } = usageLeft;\n\t\tconst deploymentType = settingsStore.deploymentType;\n\n\t\ttelemetry.track('User clicked upgrade CTA', {\n\t\t\tsource,\n\t\t\tisTrial: userIsTrialing,\n\t\t\tdeploymentType,\n\t\t\ttrialDaysLeft,\n\t\t\texecutionsLeft,\n\t\t\tworkflowsLeft,\n\t\t});\n\n\t\tconst upgradeLink = await generateUpgradeLink(source, utm_campaign);\n\n\t\tif (mode === 'open') {\n\t\t\twindow.open(upgradeLink, '_blank');\n\t\t} else {\n\t\t\tlocation.href = upgradeLink;\n\t\t}\n\t};\n\n\tconst generateUpgradeLink = async (source: string, utm_campaign: string) => {\n\t\tlet upgradeLink = N8N_PRICING_PAGE_URL;\n\n\t\tif (canAutoLoginToCloudDashboard()) {\n\t\t\tupgradeLink = await cloudPlanStore.generateCloudDashboardAutoLoginLink({\n\t\t\t\tredirectionPath: '/account/change-plan',\n\t\t\t});\n\t\t}\n\n\t\tconst url = new URL(upgradeLink);\n\n\t\tif (utm_campaign) {\n\t\t\turl.searchParams.set('utm_campaign', utm_campaign);\n\t\t}\n\n\t\tif (source) {\n\t\t\turl.searchParams.set('source', source);\n\t\t}\n\n\t\treturn url.toString();\n\t};\n\n\treturn {\n\t\tgoToCloudDashboard,\n\t\tgoToDashboard,\n\t\tgoToVersions,\n\t\tgoToUp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B,QAAQ,aAAa;AAEnE,MAAI,SAAS,OACZ,QAAO,KAAK,aAAa,SAAS;MAElC,UAAS,OAAO;;CAIlB,MAAM,sBAAsB,OAAO,QAAgB,iBAAyB;EAC3E,IAAI,cAAc;AAElB,MAAI,8BAA8B,CACjC,eAAc,MAAM,eAAe,oCAAoC,EACtE,iBAAiB,wBACjB,CAAC;EAGH,MAAM,MAAM,IAAI,IAAI,YAAY;AAEhC,MAAI,aACH,KAAI,aAAa,IAAI,gBAAgB,aAAa;AAGnD,MAAI,OACH,KAAI,aAAa,IAAI,UAAU,OAAO;AAGvC,SAAO,IAAI,UAAU;;AAGtB,QAAO;EACN;EACA;EACA;EACA;EACA"}
|
package/dist/constants2.cjs
CHANGED
|
@@ -58,6 +58,7 @@ const STORES = {
|
|
|
58
58
|
EXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: "surfaceMcpToNewCloudUsers",
|
|
59
59
|
EXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: "exposeAllWorkflowsToMcp",
|
|
60
60
|
EXPERIMENT_TRIAL_INTRO_MODAL: "trialIntroModal",
|
|
61
|
+
EXPERIMENT_INSTANCE_AI_FREE_NUDGE: "instanceAiFreeNudge",
|
|
61
62
|
SETUP_PANEL: "setupPanel",
|
|
62
63
|
FOCUSED_NODES: "focusedNodes",
|
|
63
64
|
FAVORITES: "favorites",
|
package/dist/constants2.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants2.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const STORES = {\n\tCOMMUNITY_NODES: 'communityNodes',\n\tROOT: 'root',\n\tSETTINGS: 'settings',\n\tNOTIFICATIONS: 'notifications',\n\tUI: 'ui',\n\tUSERS: 'users',\n\tWORKFLOWS: 'workflows',\n\tWORKFLOWS_LIST: 'workflowsList',\n\tWORKFLOWS_V2: 'workflowsV2',\n\tWORKFLOWS_EE: 'workflowsEE',\n\tWORKFLOW_DOCUMENTS: 'workflowDocuments',\n\tEXECUTION_DATA: 'executionData',\n\tWORKFLOW_EXECUTION_STATES: 'workflowExecutionStates',\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\tCHAT_PANEL: 'chatPanel',\n\tCHAT_PANEL_STATE: 'chatPanelState',\n\tBECOME_TEMPLATE_CREATOR: 'becomeTemplateCreator',\n\tPROJECTS: 'projects',\n\tAPI_KEYS: 'apiKeys',\n\tEVALUATION: 'evaluation',\n\tEVAL_COLLECTIONS: 'evalCollections',\n\tAGENT_EVALS: 'agentEvals',\n\tFOLDERS: 'folders',\n\tMODULES: 'modules',\n\tFOCUS_PANEL: 'focusPanel',\n\tAI_TEMPLATES_STARTER_COLLECTION: 'aiTemplatesStarterCollection',\n\tPERSONALIZED_TEMPLATES: 'personalizedTemplates',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS: 'readyToRunWorkflows',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS_V2: 'readyToRunWorkflowsV2',\n\tEXPERIMENT_TEMPLATE_RECO_V2: 'templateRecoV2',\n\tPERSONALIZED_TEMPLATES_V3: 'personalizedTemplatesV3',\n\tREADY_TO_RUN: 'readyToRun',\n\tTEMPLATES_DATA_QUALITY: 'templatesDataQuality',\n\tBANNERS: 'banners',\n\tCONSENT: 'consent',\n\tCHAT_HUB: 'chatHub',\n\tCHAT_HUB_PANEL: 'chatHubPanel',\n\tEXPERIMENT_CREDENTIALS_APP_SELECTION: 'credentialsAppSelection',\n\tEXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: 'surfaceMcpToNewCloudUsers',\n\tEXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: 'exposeAllWorkflowsToMcp',\n\tEXPERIMENT_TRIAL_INTRO_MODAL: 'trialIntroModal',\n\tSETUP_PANEL: 'setupPanel',\n\tFOCUSED_NODES: 'focusedNodes',\n\tFAVORITES: 'favorites',\n\tAI_GATEWAY: 'aiGateway',\n\tEVALUATIONS_WIZARD_SIDEPANEL: 'evaluationsWizardSidepanel',\n} as const;\n"],"mappings":";;AAAA,MAAa,SAAS;CACrB,iBAAiB;CACjB,MAAM;CACN,UAAU;CACV,eAAe;CACf,IAAI;CACJ,OAAO;CACP,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,gBAAgB;CAChB,2BAA2B;CAC3B,YAAY;CACZ,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa;CACb,MAAM;CACN,iBAAiB;CACjB,UAAU;CACV,cAAc;CACd,UAAU;CACV,SAAS;CACT,YAAY;CACZ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW;CACX,SAAS;CACT,YAAY;CACZ,kBAAkB;CAClB,yBAAyB;CACzB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,kBAAkB;CAClB,aAAa;CACb,SAAS;CACT,SAAS;CACT,aAAa;CACb,iCAAiC;CACjC,wBAAwB;CACxB,mCAAmC;CACnC,sCAAsC;CACtC,6BAA6B;CAC7B,2BAA2B;CAC3B,cAAc;CACd,wBAAwB;CACxB,SAAS;CACT,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,sCAAsC;CACtC,2CAA2C;CAC3C,wCAAwC;CACxC,8BAA8B;CAC9B,aAAa;CACb,eAAe;CACf,WAAW;CACX,YAAY;CACZ,8BAA8B;CAC9B"}
|
|
1
|
+
{"version":3,"file":"constants2.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const STORES = {\n\tCOMMUNITY_NODES: 'communityNodes',\n\tROOT: 'root',\n\tSETTINGS: 'settings',\n\tNOTIFICATIONS: 'notifications',\n\tUI: 'ui',\n\tUSERS: 'users',\n\tWORKFLOWS: 'workflows',\n\tWORKFLOWS_LIST: 'workflowsList',\n\tWORKFLOWS_V2: 'workflowsV2',\n\tWORKFLOWS_EE: 'workflowsEE',\n\tWORKFLOW_DOCUMENTS: 'workflowDocuments',\n\tEXECUTION_DATA: 'executionData',\n\tWORKFLOW_EXECUTION_STATES: 'workflowExecutionStates',\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\tCHAT_PANEL: 'chatPanel',\n\tCHAT_PANEL_STATE: 'chatPanelState',\n\tBECOME_TEMPLATE_CREATOR: 'becomeTemplateCreator',\n\tPROJECTS: 'projects',\n\tAPI_KEYS: 'apiKeys',\n\tEVALUATION: 'evaluation',\n\tEVAL_COLLECTIONS: 'evalCollections',\n\tAGENT_EVALS: 'agentEvals',\n\tFOLDERS: 'folders',\n\tMODULES: 'modules',\n\tFOCUS_PANEL: 'focusPanel',\n\tAI_TEMPLATES_STARTER_COLLECTION: 'aiTemplatesStarterCollection',\n\tPERSONALIZED_TEMPLATES: 'personalizedTemplates',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS: 'readyToRunWorkflows',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS_V2: 'readyToRunWorkflowsV2',\n\tEXPERIMENT_TEMPLATE_RECO_V2: 'templateRecoV2',\n\tPERSONALIZED_TEMPLATES_V3: 'personalizedTemplatesV3',\n\tREADY_TO_RUN: 'readyToRun',\n\tTEMPLATES_DATA_QUALITY: 'templatesDataQuality',\n\tBANNERS: 'banners',\n\tCONSENT: 'consent',\n\tCHAT_HUB: 'chatHub',\n\tCHAT_HUB_PANEL: 'chatHubPanel',\n\tEXPERIMENT_CREDENTIALS_APP_SELECTION: 'credentialsAppSelection',\n\tEXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: 'surfaceMcpToNewCloudUsers',\n\tEXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: 'exposeAllWorkflowsToMcp',\n\tEXPERIMENT_TRIAL_INTRO_MODAL: 'trialIntroModal',\n\tEXPERIMENT_INSTANCE_AI_FREE_NUDGE: 'instanceAiFreeNudge',\n\tSETUP_PANEL: 'setupPanel',\n\tFOCUSED_NODES: 'focusedNodes',\n\tFAVORITES: 'favorites',\n\tAI_GATEWAY: 'aiGateway',\n\tEVALUATIONS_WIZARD_SIDEPANEL: 'evaluationsWizardSidepanel',\n} as const;\n"],"mappings":";;AAAA,MAAa,SAAS;CACrB,iBAAiB;CACjB,MAAM;CACN,UAAU;CACV,eAAe;CACf,IAAI;CACJ,OAAO;CACP,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,gBAAgB;CAChB,2BAA2B;CAC3B,YAAY;CACZ,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa;CACb,MAAM;CACN,iBAAiB;CACjB,UAAU;CACV,cAAc;CACd,UAAU;CACV,SAAS;CACT,YAAY;CACZ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW;CACX,SAAS;CACT,YAAY;CACZ,kBAAkB;CAClB,yBAAyB;CACzB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,kBAAkB;CAClB,aAAa;CACb,SAAS;CACT,SAAS;CACT,aAAa;CACb,iCAAiC;CACjC,wBAAwB;CACxB,mCAAmC;CACnC,sCAAsC;CACtC,6BAA6B;CAC7B,2BAA2B;CAC3B,cAAc;CACd,wBAAwB;CACxB,SAAS;CACT,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,sCAAsC;CACtC,2CAA2C;CAC3C,wCAAwC;CACxC,8BAA8B;CAC9B,mCAAmC;CACnC,aAAa;CACb,eAAe;CACf,WAAW;CACX,YAAY;CACZ,8BAA8B;CAC9B"}
|
package/dist/constants2.d.cts
CHANGED
|
@@ -57,6 +57,7 @@ declare const STORES: {
|
|
|
57
57
|
readonly EXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: "surfaceMcpToNewCloudUsers";
|
|
58
58
|
readonly EXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: "exposeAllWorkflowsToMcp";
|
|
59
59
|
readonly EXPERIMENT_TRIAL_INTRO_MODAL: "trialIntroModal";
|
|
60
|
+
readonly EXPERIMENT_INSTANCE_AI_FREE_NUDGE: "instanceAiFreeNudge";
|
|
60
61
|
readonly SETUP_PANEL: "setupPanel";
|
|
61
62
|
readonly FOCUSED_NODES: "focusedNodes";
|
|
62
63
|
readonly FAVORITES: "favorites";
|
package/dist/constants2.d.mts
CHANGED
|
@@ -57,6 +57,7 @@ declare const STORES: {
|
|
|
57
57
|
readonly EXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: "surfaceMcpToNewCloudUsers";
|
|
58
58
|
readonly EXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: "exposeAllWorkflowsToMcp";
|
|
59
59
|
readonly EXPERIMENT_TRIAL_INTRO_MODAL: "trialIntroModal";
|
|
60
|
+
readonly EXPERIMENT_INSTANCE_AI_FREE_NUDGE: "instanceAiFreeNudge";
|
|
60
61
|
readonly SETUP_PANEL: "setupPanel";
|
|
61
62
|
readonly FOCUSED_NODES: "focusedNodes";
|
|
62
63
|
readonly FAVORITES: "favorites";
|
package/dist/constants2.mjs
CHANGED
|
@@ -57,6 +57,7 @@ const STORES = {
|
|
|
57
57
|
EXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: "surfaceMcpToNewCloudUsers",
|
|
58
58
|
EXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: "exposeAllWorkflowsToMcp",
|
|
59
59
|
EXPERIMENT_TRIAL_INTRO_MODAL: "trialIntroModal",
|
|
60
|
+
EXPERIMENT_INSTANCE_AI_FREE_NUDGE: "instanceAiFreeNudge",
|
|
60
61
|
SETUP_PANEL: "setupPanel",
|
|
61
62
|
FOCUSED_NODES: "focusedNodes",
|
|
62
63
|
FAVORITES: "favorites",
|
package/dist/constants2.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants2.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const STORES = {\n\tCOMMUNITY_NODES: 'communityNodes',\n\tROOT: 'root',\n\tSETTINGS: 'settings',\n\tNOTIFICATIONS: 'notifications',\n\tUI: 'ui',\n\tUSERS: 'users',\n\tWORKFLOWS: 'workflows',\n\tWORKFLOWS_LIST: 'workflowsList',\n\tWORKFLOWS_V2: 'workflowsV2',\n\tWORKFLOWS_EE: 'workflowsEE',\n\tWORKFLOW_DOCUMENTS: 'workflowDocuments',\n\tEXECUTION_DATA: 'executionData',\n\tWORKFLOW_EXECUTION_STATES: 'workflowExecutionStates',\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\tCHAT_PANEL: 'chatPanel',\n\tCHAT_PANEL_STATE: 'chatPanelState',\n\tBECOME_TEMPLATE_CREATOR: 'becomeTemplateCreator',\n\tPROJECTS: 'projects',\n\tAPI_KEYS: 'apiKeys',\n\tEVALUATION: 'evaluation',\n\tEVAL_COLLECTIONS: 'evalCollections',\n\tAGENT_EVALS: 'agentEvals',\n\tFOLDERS: 'folders',\n\tMODULES: 'modules',\n\tFOCUS_PANEL: 'focusPanel',\n\tAI_TEMPLATES_STARTER_COLLECTION: 'aiTemplatesStarterCollection',\n\tPERSONALIZED_TEMPLATES: 'personalizedTemplates',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS: 'readyToRunWorkflows',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS_V2: 'readyToRunWorkflowsV2',\n\tEXPERIMENT_TEMPLATE_RECO_V2: 'templateRecoV2',\n\tPERSONALIZED_TEMPLATES_V3: 'personalizedTemplatesV3',\n\tREADY_TO_RUN: 'readyToRun',\n\tTEMPLATES_DATA_QUALITY: 'templatesDataQuality',\n\tBANNERS: 'banners',\n\tCONSENT: 'consent',\n\tCHAT_HUB: 'chatHub',\n\tCHAT_HUB_PANEL: 'chatHubPanel',\n\tEXPERIMENT_CREDENTIALS_APP_SELECTION: 'credentialsAppSelection',\n\tEXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: 'surfaceMcpToNewCloudUsers',\n\tEXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: 'exposeAllWorkflowsToMcp',\n\tEXPERIMENT_TRIAL_INTRO_MODAL: 'trialIntroModal',\n\tSETUP_PANEL: 'setupPanel',\n\tFOCUSED_NODES: 'focusedNodes',\n\tFAVORITES: 'favorites',\n\tAI_GATEWAY: 'aiGateway',\n\tEVALUATIONS_WIZARD_SIDEPANEL: 'evaluationsWizardSidepanel',\n} as const;\n"],"mappings":";AAAA,MAAa,SAAS;CACrB,iBAAiB;CACjB,MAAM;CACN,UAAU;CACV,eAAe;CACf,IAAI;CACJ,OAAO;CACP,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,gBAAgB;CAChB,2BAA2B;CAC3B,YAAY;CACZ,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa;CACb,MAAM;CACN,iBAAiB;CACjB,UAAU;CACV,cAAc;CACd,UAAU;CACV,SAAS;CACT,YAAY;CACZ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW;CACX,SAAS;CACT,YAAY;CACZ,kBAAkB;CAClB,yBAAyB;CACzB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,kBAAkB;CAClB,aAAa;CACb,SAAS;CACT,SAAS;CACT,aAAa;CACb,iCAAiC;CACjC,wBAAwB;CACxB,mCAAmC;CACnC,sCAAsC;CACtC,6BAA6B;CAC7B,2BAA2B;CAC3B,cAAc;CACd,wBAAwB;CACxB,SAAS;CACT,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,sCAAsC;CACtC,2CAA2C;CAC3C,wCAAwC;CACxC,8BAA8B;CAC9B,aAAa;CACb,eAAe;CACf,WAAW;CACX,YAAY;CACZ,8BAA8B;CAC9B"}
|
|
1
|
+
{"version":3,"file":"constants2.mjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const STORES = {\n\tCOMMUNITY_NODES: 'communityNodes',\n\tROOT: 'root',\n\tSETTINGS: 'settings',\n\tNOTIFICATIONS: 'notifications',\n\tUI: 'ui',\n\tUSERS: 'users',\n\tWORKFLOWS: 'workflows',\n\tWORKFLOWS_LIST: 'workflowsList',\n\tWORKFLOWS_V2: 'workflowsV2',\n\tWORKFLOWS_EE: 'workflowsEE',\n\tWORKFLOW_DOCUMENTS: 'workflowDocuments',\n\tEXECUTION_DATA: 'executionData',\n\tWORKFLOW_EXECUTION_STATES: 'workflowExecutionStates',\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\tCHAT_PANEL: 'chatPanel',\n\tCHAT_PANEL_STATE: 'chatPanelState',\n\tBECOME_TEMPLATE_CREATOR: 'becomeTemplateCreator',\n\tPROJECTS: 'projects',\n\tAPI_KEYS: 'apiKeys',\n\tEVALUATION: 'evaluation',\n\tEVAL_COLLECTIONS: 'evalCollections',\n\tAGENT_EVALS: 'agentEvals',\n\tFOLDERS: 'folders',\n\tMODULES: 'modules',\n\tFOCUS_PANEL: 'focusPanel',\n\tAI_TEMPLATES_STARTER_COLLECTION: 'aiTemplatesStarterCollection',\n\tPERSONALIZED_TEMPLATES: 'personalizedTemplates',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS: 'readyToRunWorkflows',\n\tEXPERIMENT_READY_TO_RUN_WORKFLOWS_V2: 'readyToRunWorkflowsV2',\n\tEXPERIMENT_TEMPLATE_RECO_V2: 'templateRecoV2',\n\tPERSONALIZED_TEMPLATES_V3: 'personalizedTemplatesV3',\n\tREADY_TO_RUN: 'readyToRun',\n\tTEMPLATES_DATA_QUALITY: 'templatesDataQuality',\n\tBANNERS: 'banners',\n\tCONSENT: 'consent',\n\tCHAT_HUB: 'chatHub',\n\tCHAT_HUB_PANEL: 'chatHubPanel',\n\tEXPERIMENT_CREDENTIALS_APP_SELECTION: 'credentialsAppSelection',\n\tEXPERIMENT_SURFACE_MCP_TO_NEW_CLOUD_USERS: 'surfaceMcpToNewCloudUsers',\n\tEXPERIMENT_EXPOSE_ALL_WORKFLOWS_TO_MCP: 'exposeAllWorkflowsToMcp',\n\tEXPERIMENT_TRIAL_INTRO_MODAL: 'trialIntroModal',\n\tEXPERIMENT_INSTANCE_AI_FREE_NUDGE: 'instanceAiFreeNudge',\n\tSETUP_PANEL: 'setupPanel',\n\tFOCUSED_NODES: 'focusedNodes',\n\tFAVORITES: 'favorites',\n\tAI_GATEWAY: 'aiGateway',\n\tEVALUATIONS_WIZARD_SIDEPANEL: 'evaluationsWizardSidepanel',\n} as const;\n"],"mappings":";AAAA,MAAa,SAAS;CACrB,iBAAiB;CACjB,MAAM;CACN,UAAU;CACV,eAAe;CACf,IAAI;CACJ,OAAO;CACP,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,gBAAgB;CAChB,2BAA2B;CAC3B,YAAY;CACZ,KAAK;CACL,WAAW;CACX,YAAY;CACZ,aAAa;CACb,MAAM;CACN,iBAAiB;CACjB,UAAU;CACV,cAAc;CACd,UAAU;CACV,SAAS;CACT,YAAY;CACZ,MAAM;CACN,MAAM;CACN,eAAe;CACf,WAAW;CACX,SAAS;CACT,YAAY;CACZ,kBAAkB;CAClB,yBAAyB;CACzB,UAAU;CACV,UAAU;CACV,YAAY;CACZ,kBAAkB;CAClB,aAAa;CACb,SAAS;CACT,SAAS;CACT,aAAa;CACb,iCAAiC;CACjC,wBAAwB;CACxB,mCAAmC;CACnC,sCAAsC;CACtC,6BAA6B;CAC7B,2BAA2B;CAC3B,cAAc;CACd,wBAAwB;CACxB,SAAS;CACT,SAAS;CACT,UAAU;CACV,gBAAgB;CAChB,sCAAsC;CACtC,2CAA2C;CAC3C,wCAAwC;CACxC,8BAA8B;CAC9B,mCAAmC;CACnC,aAAa;CACb,eAAe;CACf,WAAW;CACX,YAAY;CACZ,8BAA8B;CAC9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref } from "vue";
|
|
2
|
-
import * as
|
|
2
|
+
import * as pinia4 from "pinia";
|
|
3
3
|
|
|
4
4
|
//#region src/notifications.store.d.ts
|
|
5
5
|
interface NotificationsStore {
|
|
@@ -9,7 +9,7 @@ interface NotificationsStore {
|
|
|
9
9
|
allowErrors?: boolean;
|
|
10
10
|
}) => void;
|
|
11
11
|
}
|
|
12
|
-
declare const useNotificationsStore:
|
|
12
|
+
declare const useNotificationsStore: pinia4.StoreDefinition<"notifications", Pick<NotificationsStore, "areNotificationsSuppressed" | "allowErrorNotificationsWhenSuppressed">, Pick<NotificationsStore, never>, Pick<NotificationsStore, "setNotificationsSuppressed">>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { NotificationsStore, useNotificationsStore };
|
|
15
15
|
//# sourceMappingURL=notifications.store.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/types/pageRedirection.d.ts
|
|
2
|
-
type CloudUpdateLinkSourceType = 'advanced-permissions' | 'canvas-nav' | 'concurrency' | 'custom-data-filter' | 'workflow_sharing' | 'credential_sharing' | 'settings-n8n-api' | 'audit-logs' | 'ldap' | 'log-streaming' | 'source-control' | 'sso' | 'usage_page' | 'settings-users' | 'variables' | 'community-nodes' | 'workflow-history' | 'worker-view' | 'external-secrets' | 'rbac' | 'debug' | 'insights' | 'evaluations' | 'ai-builder-sidebar' | 'ai-builder-canvas' | 'custom-roles' | 'custom-roles-selector' | 'custom-roles-list' | 'main-sidebar' | 'chat-hub' | 'empty-state-builder-prompt' | 'instance-ai' | 'data-redaction' | 'workflow-settings' | 'trial-welcome-modal';
|
|
3
|
-
type UTMCampaign = 'upgrade-custom-data-filter' | 'upgrade-concurrency' | 'upgrade-workflow-sharing' | 'upgrade-credentials-sharing' | 'upgrade-api' | 'upgrade-audit-logs' | 'upgrade-ldap' | 'upgrade-log-streaming' | 'upgrade-source-control' | 'upgrade-sso' | 'open' | 'upgrade-users' | 'upgrade-variables' | 'upgrade-community-nodes' | 'upgrade-workflow-history' | 'upgrade-advanced-permissions' | 'upgrade-worker-view' | 'upgrade-external-secrets' | 'upgrade-rbac' | 'upgrade-debug' | 'upgrade-insights' | 'upgrade-evaluations' | 'upgrade-builder' | 'upgrade-custom-roles' | 'upgrade-canvas-nav' | 'upgrade-main-sidebar' | 'upgrade-instance-ai' | 'upgrade-data-redaction';
|
|
2
|
+
type CloudUpdateLinkSourceType = 'advanced-permissions' | 'canvas-nav' | 'concurrency' | 'custom-data-filter' | 'workflow_sharing' | 'credential_sharing' | 'settings-n8n-api' | 'audit-logs' | 'ldap' | 'log-streaming' | 'source-control' | 'sso' | 'usage_page' | 'settings-users' | 'variables' | 'community-nodes' | 'workflow-history' | 'worker-view' | 'external-secrets' | 'rbac' | 'debug' | 'insights' | 'evaluations' | 'ai-builder-sidebar' | 'ai-builder-canvas' | 'custom-roles' | 'custom-roles-selector' | 'custom-roles-list' | 'main-sidebar' | 'chat-hub' | 'empty-state-builder-prompt' | 'instance-ai' | 'data-redaction' | 'workflow-settings' | 'trial-welcome-modal' | 'ai-gateway-top-up';
|
|
3
|
+
type UTMCampaign = 'upgrade-custom-data-filter' | 'upgrade-concurrency' | 'upgrade-workflow-sharing' | 'upgrade-credentials-sharing' | 'upgrade-api' | 'upgrade-audit-logs' | 'upgrade-ldap' | 'upgrade-log-streaming' | 'upgrade-source-control' | 'upgrade-sso' | 'open' | 'upgrade-users' | 'upgrade-variables' | 'upgrade-community-nodes' | 'upgrade-workflow-history' | 'upgrade-advanced-permissions' | 'upgrade-worker-view' | 'upgrade-external-secrets' | 'upgrade-rbac' | 'upgrade-debug' | 'upgrade-insights' | 'upgrade-evaluations' | 'upgrade-builder' | 'upgrade-custom-roles' | 'upgrade-canvas-nav' | 'upgrade-main-sidebar' | 'upgrade-instance-ai' | 'upgrade-data-redaction' | 'upgrade-ai-gateway-top-up';
|
|
4
4
|
//#endregion
|
|
5
5
|
export { UTMCampaign as n, CloudUpdateLinkSourceType as t };
|
|
6
6
|
//# sourceMappingURL=pageRedirection.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/types/pageRedirection.d.ts
|
|
2
|
-
type CloudUpdateLinkSourceType = 'advanced-permissions' | 'canvas-nav' | 'concurrency' | 'custom-data-filter' | 'workflow_sharing' | 'credential_sharing' | 'settings-n8n-api' | 'audit-logs' | 'ldap' | 'log-streaming' | 'source-control' | 'sso' | 'usage_page' | 'settings-users' | 'variables' | 'community-nodes' | 'workflow-history' | 'worker-view' | 'external-secrets' | 'rbac' | 'debug' | 'insights' | 'evaluations' | 'ai-builder-sidebar' | 'ai-builder-canvas' | 'custom-roles' | 'custom-roles-selector' | 'custom-roles-list' | 'main-sidebar' | 'chat-hub' | 'empty-state-builder-prompt' | 'instance-ai' | 'data-redaction' | 'workflow-settings' | 'trial-welcome-modal';
|
|
3
|
-
type UTMCampaign = 'upgrade-custom-data-filter' | 'upgrade-concurrency' | 'upgrade-workflow-sharing' | 'upgrade-credentials-sharing' | 'upgrade-api' | 'upgrade-audit-logs' | 'upgrade-ldap' | 'upgrade-log-streaming' | 'upgrade-source-control' | 'upgrade-sso' | 'open' | 'upgrade-users' | 'upgrade-variables' | 'upgrade-community-nodes' | 'upgrade-workflow-history' | 'upgrade-advanced-permissions' | 'upgrade-worker-view' | 'upgrade-external-secrets' | 'upgrade-rbac' | 'upgrade-debug' | 'upgrade-insights' | 'upgrade-evaluations' | 'upgrade-builder' | 'upgrade-custom-roles' | 'upgrade-canvas-nav' | 'upgrade-main-sidebar' | 'upgrade-instance-ai' | 'upgrade-data-redaction';
|
|
2
|
+
type CloudUpdateLinkSourceType = 'advanced-permissions' | 'canvas-nav' | 'concurrency' | 'custom-data-filter' | 'workflow_sharing' | 'credential_sharing' | 'settings-n8n-api' | 'audit-logs' | 'ldap' | 'log-streaming' | 'source-control' | 'sso' | 'usage_page' | 'settings-users' | 'variables' | 'community-nodes' | 'workflow-history' | 'worker-view' | 'external-secrets' | 'rbac' | 'debug' | 'insights' | 'evaluations' | 'ai-builder-sidebar' | 'ai-builder-canvas' | 'custom-roles' | 'custom-roles-selector' | 'custom-roles-list' | 'main-sidebar' | 'chat-hub' | 'empty-state-builder-prompt' | 'instance-ai' | 'data-redaction' | 'workflow-settings' | 'trial-welcome-modal' | 'ai-gateway-top-up';
|
|
3
|
+
type UTMCampaign = 'upgrade-custom-data-filter' | 'upgrade-concurrency' | 'upgrade-workflow-sharing' | 'upgrade-credentials-sharing' | 'upgrade-api' | 'upgrade-audit-logs' | 'upgrade-ldap' | 'upgrade-log-streaming' | 'upgrade-source-control' | 'upgrade-sso' | 'open' | 'upgrade-users' | 'upgrade-variables' | 'upgrade-community-nodes' | 'upgrade-workflow-history' | 'upgrade-advanced-permissions' | 'upgrade-worker-view' | 'upgrade-external-secrets' | 'upgrade-rbac' | 'upgrade-debug' | 'upgrade-insights' | 'upgrade-evaluations' | 'upgrade-builder' | 'upgrade-custom-roles' | 'upgrade-canvas-nav' | 'upgrade-main-sidebar' | 'upgrade-instance-ai' | 'upgrade-data-redaction' | 'upgrade-ai-gateway-top-up';
|
|
4
4
|
//#endregion
|
|
5
5
|
export { UTMCampaign as n, CloudUpdateLinkSourceType as t };
|
|
6
6
|
//# sourceMappingURL=pageRedirection.d.mts.map
|
package/dist/rbac.store.cjs
CHANGED
package/dist/rbac.store.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rbac.store.cjs","names":["STORES"],"sources":["../src/rbac.store.ts"],"sourcesContent":["import type { Role } from '@n8n/api-types';\nimport { hasScope as genericHasScope } from '@n8n/permissions';\nimport type { ScopeOptions, Scope, Resource } from '@n8n/permissions';\nimport { defineStore } from 'pinia';\nimport { ref } from 'vue';\n\nimport { STORES } from './constants';\n\nexport const useRBACStore = defineStore(STORES.RBAC, () => {\n\tconst globalRoles = ref<Role[]>([]);\n\tconst rolesByProjectId = ref<Record<string, string[]>>({});\n\n\tconst globalScopes = ref<Scope[]>([]);\n\tconst scopesByProjectId = ref<Record<string, Scope[]>>({});\n\tconst scopesByResourceId = ref<Record<Resource, Record<string, Scope[]>>>({\n\t\tagent: {},\n\t\taiAssistant: {},\n\t\tworkflow: {},\n\t\ttag: {},\n\t\tannotationTag: {},\n\t\tuser: {},\n\t\tcredential: {},\n\t\tvariable: {},\n\t\tprojectVariable: {},\n\t\tsourceControl: {},\n\t\texternalSecretsProvider: {},\n\t\texternalSecret: {},\n\t\tproject: {},\n\t\torchestration: {},\n\t\tworkersView: {},\n\t\teventBusDestination: {},\n\t\tauditLogs: {},\n\t\tbanner: {},\n\t\tcommunity: {},\n\t\tcommunityPackage: {},\n\t\tldap: {},\n\t\tlicense: {},\n\t\tlogStreaming: {},\n\t\tsaml: {},\n\t\toidc: {},\n\t\tprovisioning: {},\n\t\tsecurityAudit: {},\n\t\tfolder: {},\n\t\tinsights: {},\n\t\tdataTable: {},\n\t\texecution: {},\n\t\ttestRun: {},\n\t\tworkflowTags: {},\n\t\trole: {},\n\t\tmcp: {},\n\t\tmcpApiKey: {},\n\t\tchatHub: {},\n\t\tchatHubAgent: {},\n\t\tbreakingChanges: {},\n\t\tapiKey: {},\n\t\tencryptionKey: {},\n\t\tcredentialResolver: {},\n\t\tinstanceAi: {},\n\t\tsecuritySettings: {},\n\t\troleMappingRule: {},\n\t\totel: {},\n\t});\n\n\tfunction addGlobalRole(role: Role) {\n\t\tif (!globalRoles.value.includes(role)) {\n\t\t\tglobalRoles.value.push(role);\n\t\t}\n\t}\n\n\tfunction hasRole(role: Role) {\n\t\treturn globalRoles.value.includes(role);\n\t}\n\n\tfunction addGlobalScope(scope: Scope) {\n\t\tif (!globalScopes.value.includes(scope)) {\n\t\t\tglobalScopes.value.push(scope);\n\t\t}\n\t}\n\n\tfunction setGlobalScopes(scopes: Scope[]) {\n\t\tglobalScopes.value = scopes;\n\t}\n\n\tfunction addProjectScope(\n\t\tscope: Scope,\n\t\tcontext: {\n\t\t\tprojectId: string;\n\t\t},\n\t) {\n\t\tif (!scopesByProjectId.value[context.projectId]) {\n\t\t\tscopesByProjectId.value[context.projectId] = [];\n\t\t}\n\n\t\tif (!scopesByProjectId.value[context.projectId].includes(scope)) {\n\t\t\tscopesByProjectId.value[context.projectId].push(scope);\n\t\t}\n\t}\n\n\tfunction addResourceScope(\n\t\tscope: Scope,\n\t\tcontext: {\n\t\t\tresourceType: Resource;\n\t\t\tresourceId: string;\n\t\t},\n\t) {\n\t\tconst scopesByResourceType = scopesByResourceId.value[context.resourceType];\n\t\tif (!scopesByResourceType[context.resourceId]) {\n\t\t\tscopesByResourceType[context.resourceId] = [];\n\t\t}\n\n\t\tif (!scopesByResourceType[context.resourceId].includes(scope)) {\n\t\t\tscopesByResourceType[context.resourceId].push(scope);\n\t\t}\n\t}\n\n\tfunction hasScope(\n\t\tscope: Scope | Scope[],\n\t\tcontext?: {\n\t\t\tresourceType?: Resource;\n\t\t\tresourceId?: string;\n\t\t\tprojectId?: string;\n\t\t},\n\t\toptions?: ScopeOptions,\n\t): boolean {\n\t\treturn genericHasScope(\n\t\t\tscope,\n\t\t\t{\n\t\t\t\tglobal: globalScopes.value,\n\t\t\t\tproject: context?.projectId ? scopesByProjectId.value[context.projectId] : [],\n\t\t\t\tresource:\n\t\t\t\t\tcontext?.resourceType && context?.resourceId\n\t\t\t\t\t\t? scopesByResourceId.value[context.resourceType][context.resourceId]\n\t\t\t\t\t\t: [],\n\t\t\t},\n\t\t\tundefined,\n\t\t\toptions,\n\t\t);\n\t}\n\n\treturn {\n\t\tglobalRoles,\n\t\trolesByProjectId,\n\t\tglobalScopes,\n\t\tscopesByProjectId,\n\t\tscopesByResourceId,\n\t\taddGlobalRole,\n\t\thasRole,\n\t\taddGlobalScope,\n\t\tsetGlobalScopes,\n\t\taddProjectScope,\n\t\taddResourceScope,\n\t\thasScope,\n\t};\n});\n"],"mappings":";;;;;;;AAQA,MAAa,sCAA2BA,yBAAO,YAAY;CAC1D,MAAM,2BAA0B,EAAE,CAAC;CACnC,MAAM,gCAAiD,EAAE,CAAC;CAE1D,MAAM,4BAA4B,EAAE,CAAC;CACrC,MAAM,iCAAiD,EAAE,CAAC;CAC1D,MAAM,kCAAoE;EACzE,OAAO,EAAE;EACT,aAAa,EAAE;EACf,UAAU,EAAE;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,MAAM,QAAQ,WAAW,SAAS,MAAM,CAC9D,mBAAkB,MAAM,QAAQ,WAAW,KAAK,MAAM;;CAIxD,SAAS,iBACR,OACA,SAIC;EACD,MAAM,uBAAuB,mBAAmB,MAAM,QAAQ;AAC9D,MAAI,CAAC,qBAAqB,QAAQ,YACjC,sBAAqB,QAAQ,cAAc,EAAE;AAG9C,MAAI,CAAC,qBAAqB,QAAQ,YAAY,SAAS,MAAM,CAC5D,sBAAqB,QAAQ,YAAY,KAAK,MAAM;;CAItD,SAAS,SACR,OACA,SAKA,SACU;AACV,yCACC,OACA;GACC,QAAQ,aAAa;GACrB,SAAS,SAAS,YAAY,kBAAkB,MAAM,QAAQ,aAAa,EAAE;GAC7E,UACC,SAAS,gBAAgB,SAAS,aAC/B,mBAAmB,MAAM,QAAQ,cAAc,QAAQ,cACvD,EAAE;GACN,EACD,QACA,QACA;;AAGF,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
|
|
1
|
+
{"version":3,"file":"rbac.store.cjs","names":["STORES"],"sources":["../src/rbac.store.ts"],"sourcesContent":["import type { Role } from '@n8n/api-types';\nimport { hasScope as genericHasScope } from '@n8n/permissions';\nimport type { ScopeOptions, Scope, Resource } from '@n8n/permissions';\nimport { defineStore } from 'pinia';\nimport { ref } from 'vue';\n\nimport { STORES } from './constants';\n\nexport const useRBACStore = defineStore(STORES.RBAC, () => {\n\tconst globalRoles = ref<Role[]>([]);\n\tconst rolesByProjectId = ref<Record<string, string[]>>({});\n\n\tconst globalScopes = ref<Scope[]>([]);\n\tconst scopesByProjectId = ref<Record<string, Scope[]>>({});\n\tconst scopesByResourceId = ref<Record<Resource, Record<string, Scope[]>>>({\n\t\tagent: {},\n\t\taiAssistant: {},\n\t\tworkflow: {},\n\t\ttag: {},\n\t\tannotationTag: {},\n\t\tuser: {},\n\t\tcredential: {},\n\t\tvariable: {},\n\t\tprojectVariable: {},\n\t\tsourceControl: {},\n\t\tgitConnection: {},\n\t\texternalSecretsProvider: {},\n\t\texternalSecret: {},\n\t\tproject: {},\n\t\torchestration: {},\n\t\tworkersView: {},\n\t\teventBusDestination: {},\n\t\tauditLogs: {},\n\t\tbanner: {},\n\t\tcommunity: {},\n\t\tcommunityPackage: {},\n\t\tldap: {},\n\t\tlicense: {},\n\t\tlogStreaming: {},\n\t\tsaml: {},\n\t\toidc: {},\n\t\tprovisioning: {},\n\t\tsecurityAudit: {},\n\t\tfolder: {},\n\t\tinsights: {},\n\t\tdataTable: {},\n\t\texecution: {},\n\t\ttestRun: {},\n\t\tworkflowTags: {},\n\t\trole: {},\n\t\tmcp: {},\n\t\tmcpApiKey: {},\n\t\tchatHub: {},\n\t\tchatHubAgent: {},\n\t\tbreakingChanges: {},\n\t\tapiKey: {},\n\t\tencryptionKey: {},\n\t\tcredentialResolver: {},\n\t\tinstanceAi: {},\n\t\tsecuritySettings: {},\n\t\troleMappingRule: {},\n\t\totel: {},\n\t});\n\n\tfunction addGlobalRole(role: Role) {\n\t\tif (!globalRoles.value.includes(role)) {\n\t\t\tglobalRoles.value.push(role);\n\t\t}\n\t}\n\n\tfunction hasRole(role: Role) {\n\t\treturn globalRoles.value.includes(role);\n\t}\n\n\tfunction addGlobalScope(scope: Scope) {\n\t\tif (!globalScopes.value.includes(scope)) {\n\t\t\tglobalScopes.value.push(scope);\n\t\t}\n\t}\n\n\tfunction setGlobalScopes(scopes: Scope[]) {\n\t\tglobalScopes.value = scopes;\n\t}\n\n\tfunction addProjectScope(\n\t\tscope: Scope,\n\t\tcontext: {\n\t\t\tprojectId: string;\n\t\t},\n\t) {\n\t\tif (!scopesByProjectId.value[context.projectId]) {\n\t\t\tscopesByProjectId.value[context.projectId] = [];\n\t\t}\n\n\t\tif (!scopesByProjectId.value[context.projectId].includes(scope)) {\n\t\t\tscopesByProjectId.value[context.projectId].push(scope);\n\t\t}\n\t}\n\n\tfunction addResourceScope(\n\t\tscope: Scope,\n\t\tcontext: {\n\t\t\tresourceType: Resource;\n\t\t\tresourceId: string;\n\t\t},\n\t) {\n\t\tconst scopesByResourceType = scopesByResourceId.value[context.resourceType];\n\t\tif (!scopesByResourceType[context.resourceId]) {\n\t\t\tscopesByResourceType[context.resourceId] = [];\n\t\t}\n\n\t\tif (!scopesByResourceType[context.resourceId].includes(scope)) {\n\t\t\tscopesByResourceType[context.resourceId].push(scope);\n\t\t}\n\t}\n\n\tfunction hasScope(\n\t\tscope: Scope | Scope[],\n\t\tcontext?: {\n\t\t\tresourceType?: Resource;\n\t\t\tresourceId?: string;\n\t\t\tprojectId?: string;\n\t\t},\n\t\toptions?: ScopeOptions,\n\t): boolean {\n\t\treturn genericHasScope(\n\t\t\tscope,\n\t\t\t{\n\t\t\t\tglobal: globalScopes.value,\n\t\t\t\tproject: context?.projectId ? scopesByProjectId.value[context.projectId] : [],\n\t\t\t\tresource:\n\t\t\t\t\tcontext?.resourceType && context?.resourceId\n\t\t\t\t\t\t? scopesByResourceId.value[context.resourceType][context.resourceId]\n\t\t\t\t\t\t: [],\n\t\t\t},\n\t\t\tundefined,\n\t\t\toptions,\n\t\t);\n\t}\n\n\treturn {\n\t\tglobalRoles,\n\t\trolesByProjectId,\n\t\tglobalScopes,\n\t\tscopesByProjectId,\n\t\tscopesByResourceId,\n\t\taddGlobalRole,\n\t\thasRole,\n\t\taddGlobalScope,\n\t\tsetGlobalScopes,\n\t\taddProjectScope,\n\t\taddResourceScope,\n\t\thasScope,\n\t};\n});\n"],"mappings":";;;;;;;AAQA,MAAa,sCAA2BA,yBAAO,YAAY;CAC1D,MAAM,2BAA0B,EAAE,CAAC;CACnC,MAAM,gCAAiD,EAAE,CAAC;CAE1D,MAAM,4BAA4B,EAAE,CAAC;CACrC,MAAM,iCAAiD,EAAE,CAAC;CAC1D,MAAM,kCAAoE;EACzE,OAAO,EAAE;EACT,aAAa,EAAE;EACf,UAAU,EAAE;EACZ,KAAK,EAAE;EACP,eAAe,EAAE;EACjB,MAAM,EAAE;EACR,YAAY,E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