@n8n/stores 2.32.2 → 2.33.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.
Files changed (82) hide show
  1. package/dist/cloudPlan.store.cjs +243 -0
  2. package/dist/cloudPlan.store.cjs.map +1 -0
  3. package/dist/cloudPlan.store.d.cts +528 -0
  4. package/dist/cloudPlan.store.d.mts +528 -0
  5. package/dist/cloudPlan.store.mjs +243 -0
  6. package/dist/cloudPlan.store.mjs.map +1 -0
  7. package/dist/constants2.cjs +1 -0
  8. package/dist/constants2.cjs.map +1 -1
  9. package/dist/constants2.d.cts +1 -0
  10. package/dist/constants2.d.mts +1 -0
  11. package/dist/constants2.mjs +1 -0
  12. package/dist/constants2.mjs.map +1 -1
  13. package/dist/invitation.api.cjs +4 -0
  14. package/dist/invitation.api.d.cts +2 -0
  15. package/dist/invitation.api.d.mts +2 -0
  16. package/dist/invitation.api.mjs +3 -0
  17. package/dist/invitation2.api.cjs +26 -0
  18. package/dist/invitation2.api.cjs.map +1 -0
  19. package/dist/invitation2.api.d.cts +30 -0
  20. package/dist/invitation2.api.d.mts +30 -0
  21. package/dist/invitation2.api.mjs +14 -0
  22. package/dist/invitation2.api.mjs.map +1 -0
  23. package/dist/modalOpeners.cjs +0 -0
  24. package/dist/modalOpeners.d.cts +2 -0
  25. package/dist/modalOpeners.d.mts +2 -0
  26. package/dist/modalOpeners.mjs +1 -0
  27. package/dist/modalOpeners2.d.cts +11 -0
  28. package/dist/modalOpeners2.d.mts +11 -0
  29. package/dist/notifications.store.cjs +33 -0
  30. package/dist/notifications.store.cjs.map +1 -0
  31. package/dist/notifications.store.d.cts +36 -0
  32. package/dist/notifications.store.d.mts +36 -0
  33. package/dist/notifications.store.mjs +32 -0
  34. package/dist/notifications.store.mjs.map +1 -0
  35. package/dist/onboarding.api.cjs +3 -0
  36. package/dist/onboarding.api.d.cts +7 -0
  37. package/dist/onboarding.api.d.mts +7 -0
  38. package/dist/onboarding.api.mjs +3 -0
  39. package/dist/onboarding2.api.cjs +24 -0
  40. package/dist/onboarding2.api.cjs.map +1 -0
  41. package/dist/onboarding2.api.mjs +18 -0
  42. package/dist/onboarding2.api.mjs.map +1 -0
  43. package/dist/rbac.store.cjs +2 -1
  44. package/dist/rbac.store.cjs.map +1 -1
  45. package/dist/rbac.store.d.cts +18 -18
  46. package/dist/rbac.store.d.mts +1 -1
  47. package/dist/rbac.store.mjs +1 -1
  48. package/dist/roles.store.cjs +88 -0
  49. package/dist/roles.store.cjs.map +1 -0
  50. package/dist/roles.store.d.cts +637 -0
  51. package/dist/roles.store.d.mts +637 -0
  52. package/dist/roles.store.mjs +87 -0
  53. package/dist/roles.store.mjs.map +1 -0
  54. package/dist/settings.store.cjs +6 -0
  55. package/dist/settings.store.d.cts +3795 -0
  56. package/dist/settings.store.d.mts +3795 -0
  57. package/dist/settings.store.mjs +6 -0
  58. package/dist/settings2.store.cjs +387 -0
  59. package/dist/settings2.store.cjs.map +1 -0
  60. package/dist/settings2.store.mjs +348 -0
  61. package/dist/settings2.store.mjs.map +1 -0
  62. package/dist/useAgentRequestStore.cjs +1 -0
  63. package/dist/useAgentRequestStore.cjs.map +1 -1
  64. package/dist/useAgentRequestStore.d.cts +1 -1
  65. package/dist/useAgentRequestStore.d.mts +3 -3
  66. package/dist/useRootStore.cjs +4 -182
  67. package/dist/useRootStore.d.cts +73 -73
  68. package/dist/useRootStore.d.mts +73 -73
  69. package/dist/useRootStore.mjs +4 -182
  70. package/dist/useRootStore2.cjs +189 -0
  71. package/dist/useRootStore2.cjs.map +1 -0
  72. package/dist/useRootStore2.mjs +183 -0
  73. package/dist/useRootStore2.mjs.map +1 -0
  74. package/dist/users.store.cjs +354 -0
  75. package/dist/users.store.cjs.map +1 -0
  76. package/dist/users.store.d.cts +540 -0
  77. package/dist/users.store.d.mts +540 -0
  78. package/dist/users.store.mjs +351 -0
  79. package/dist/users.store.mjs.map +1 -0
  80. package/package.json +14 -8
  81. package/dist/useRootStore.cjs.map +0 -1
  82. package/dist/useRootStore.mjs.map +0 -1
@@ -0,0 +1,32 @@
1
+ import { t as STORES } from "./constants2.mjs";
2
+ import { defineStore } from "pinia";
3
+ import { ref } from "vue";
4
+
5
+ //#region src/notifications.store.ts
6
+ /**
7
+ * Notification state extracted from `ui.store`: the per-view queue of pending
8
+ * notifications and the suppression flags read by the toast layer.
9
+ */
10
+ const useNotificationsStore = defineStore(STORES.NOTIFICATIONS, () => {
11
+ const pendingNotificationsForViews = ref({});
12
+ const areNotificationsSuppressed = ref(false);
13
+ const allowErrorNotificationsWhenSuppressed = ref(false);
14
+ const setNotificationsForView = (view, notifications) => {
15
+ pendingNotificationsForViews.value[view] = notifications;
16
+ };
17
+ const setNotificationsSuppressed = (suppressed, options) => {
18
+ areNotificationsSuppressed.value = suppressed;
19
+ allowErrorNotificationsWhenSuppressed.value = suppressed && options?.allowErrors === true;
20
+ };
21
+ return {
22
+ pendingNotificationsForViews,
23
+ areNotificationsSuppressed,
24
+ allowErrorNotificationsWhenSuppressed,
25
+ setNotificationsForView,
26
+ setNotificationsSuppressed
27
+ };
28
+ });
29
+
30
+ //#endregion
31
+ export { useNotificationsStore };
32
+ //# sourceMappingURL=notifications.store.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.store.mjs","names":[],"sources":["../src/notifications.store.ts"],"sourcesContent":["import type { VIEWS } from '@n8n/frontend-constants/views';\nimport { defineStore } from 'pinia';\nimport { ref, type Component, type Ref, type VNode } from 'vue';\n\nimport { STORES } from './constants';\n\ntype NotificationType = '' | 'success' | 'warning' | 'error' | 'info';\ntype NotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';\n\n/**\n * Notification payload accepted by the toast layer.\n *\n * This mirrors Element Plus' notification options (the shape the toast layer\n * ultimately forwards to `ElNotification`) but is declared inline so this\n * package carries no dependency on `element-plus`. `message` is required; every\n * other field is optional, matching the original `Partial<...>`-based type.\n *\n * Relocated here from `editor-ui`'s `@/Interface` so it can travel with the\n * notifications store; `editor-ui` re-exports it for existing importers.\n */\nexport interface NotificationOptions {\n\tmessage: string | VNode;\n\ttitle?: string;\n\ttype?: NotificationType;\n\ticon?: string | Component;\n\tcustomClass?: string;\n\tduration?: number;\n\tposition?: NotificationPosition;\n\tshowClose?: boolean;\n\tdangerouslyUseHTMLString?: boolean;\n\toffset?: number;\n\tappendTo?: HTMLElement | string;\n\tzIndex?: number;\n\tonClick?: () => void;\n\tonClose?: () => void;\n}\n\n/**\n * Public surface of the notifications store. Declared explicitly so the emitted\n * type declarations reference these named types instead of inlining the\n * structural notification/Vue types, keeping the declarations portable across\n * the package boundary.\n */\nexport interface NotificationsStore {\n\tpendingNotificationsForViews: Ref<Partial<Record<VIEWS, NotificationOptions[]>>>;\n\tareNotificationsSuppressed: Ref<boolean>;\n\tallowErrorNotificationsWhenSuppressed: Ref<boolean>;\n\tsetNotificationsForView: (view: VIEWS, notifications: NotificationOptions[]) => void;\n\tsetNotificationsSuppressed: (suppressed: boolean, options?: { allowErrors?: boolean }) => void;\n}\n\n/**\n * Notification state extracted from `ui.store`: the per-view queue of pending\n * notifications and the suppression flags read by the toast layer.\n */\nexport const useNotificationsStore = defineStore(STORES.NOTIFICATIONS, (): NotificationsStore => {\n\tconst pendingNotificationsForViews = ref<Partial<Record<VIEWS, NotificationOptions[]>>>({});\n\tconst areNotificationsSuppressed = ref(false);\n\tconst allowErrorNotificationsWhenSuppressed = ref(false);\n\n\tconst setNotificationsForView = (view: VIEWS, notifications: NotificationOptions[]) => {\n\t\tpendingNotificationsForViews.value[view] = notifications;\n\t};\n\n\tconst setNotificationsSuppressed = (suppressed: boolean, options?: { allowErrors?: boolean }) => {\n\t\tareNotificationsSuppressed.value = suppressed;\n\t\tallowErrorNotificationsWhenSuppressed.value = suppressed && options?.allowErrors === true;\n\t};\n\n\treturn {\n\t\tpendingNotificationsForViews,\n\t\tareNotificationsSuppressed,\n\t\tallowErrorNotificationsWhenSuppressed,\n\t\tsetNotificationsForView,\n\t\tsetNotificationsSuppressed,\n\t};\n});\n"],"mappings":";;;;;;;;;AAuDA,MAAa,wBAAwB,YAAY,OAAO,qBAAyC;CAChG,MAAM,+BAA+B,IAAmD,EAAE,CAAC;CAC3F,MAAM,6BAA6B,IAAI,MAAM;CAC7C,MAAM,wCAAwC,IAAI,MAAM;CAExD,MAAM,2BAA2B,MAAa,kBAAyC;AACtF,+BAA6B,MAAM,QAAQ;;CAG5C,MAAM,8BAA8B,YAAqB,YAAwC;AAChG,6BAA2B,QAAQ;AACnC,wCAAsC,QAAQ,cAAc,SAAS,gBAAgB;;AAGtF,QAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA"}
@@ -0,0 +1,3 @@
1
+ const require_onboarding_api = require('./onboarding2.api.cjs');
2
+
3
+ exports.submitEmailOnSignup = require_onboarding_api.submitEmailOnSignup;
@@ -0,0 +1,7 @@
1
+ import { IUser } from "@n8n/rest-api-client/api/users";
2
+
3
+ //#region src/onboarding.api.d.ts
4
+ declare function submitEmailOnSignup(instanceId: string, currentUser: IUser, email: string | undefined, agree: boolean): Promise<string>;
5
+ //#endregion
6
+ export { submitEmailOnSignup };
7
+ //# sourceMappingURL=onboarding.api.d.cts.map
@@ -0,0 +1,7 @@
1
+ import { IUser } from "@n8n/rest-api-client/api/users";
2
+
3
+ //#region src/onboarding.api.d.ts
4
+ declare function submitEmailOnSignup(instanceId: string, currentUser: IUser, email: string | undefined, agree: boolean): Promise<string>;
5
+ //#endregion
6
+ export { submitEmailOnSignup };
7
+ //# sourceMappingURL=onboarding.api.d.mts.map
@@ -0,0 +1,3 @@
1
+ import { t as submitEmailOnSignup } from "./onboarding2.api.mjs";
2
+
3
+ export { submitEmailOnSignup };
@@ -0,0 +1,24 @@
1
+ const require_settings_store = require('./settings2.store.cjs');
2
+ let __n8n_rest_api_client = require("@n8n/rest-api-client");
3
+
4
+ //#region src/onboarding.api.ts
5
+ const N8N_API_BASE_URL = "https://api.n8n.io/api";
6
+ const CONTACT_EMAIL_SUBMISSION_ENDPOINT = "/accounts/onboarding";
7
+ async function submitEmailOnSignup(instanceId, currentUser, email, agree) {
8
+ return await (0, __n8n_rest_api_client.post)(N8N_API_BASE_URL, CONTACT_EMAIL_SUBMISSION_ENDPOINT, {
9
+ instance_id: instanceId,
10
+ user_id: `${instanceId}#${currentUser.id}`,
11
+ email,
12
+ agree,
13
+ agree_updates: true
14
+ });
15
+ }
16
+
17
+ //#endregion
18
+ Object.defineProperty(exports, 'submitEmailOnSignup', {
19
+ enumerable: true,
20
+ get: function () {
21
+ return submitEmailOnSignup;
22
+ }
23
+ });
24
+ //# sourceMappingURL=onboarding2.api.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding2.api.cjs","names":[],"sources":["../src/onboarding.api.ts"],"sourcesContent":["import { post } from '@n8n/rest-api-client';\nimport type { IUser } from '@n8n/rest-api-client/api/users';\n\nconst N8N_API_BASE_URL = 'https://api.n8n.io/api';\nconst CONTACT_EMAIL_SUBMISSION_ENDPOINT = '/accounts/onboarding';\n\nexport async function submitEmailOnSignup(\n\tinstanceId: string,\n\tcurrentUser: IUser,\n\temail: string | undefined,\n\tagree: boolean,\n): Promise<string> {\n\t// `post` targets the external onboarding API and is untyped; the response is the\n\t// created onboarding record id.\n\treturn (await post(N8N_API_BASE_URL, CONTACT_EMAIL_SUBMISSION_ENDPOINT, {\n\t\tinstance_id: instanceId,\n\t\tuser_id: `${instanceId}#${currentUser.id}`,\n\t\temail,\n\t\tagree,\n\t\tagree_updates: true,\n\t})) as string;\n}\n"],"mappings":";;;;AAGA,MAAM,mBAAmB;AACzB,MAAM,oCAAoC;AAE1C,eAAsB,oBACrB,YACA,aACA,OACA,OACkB;AAGlB,QAAQ,sCAAW,kBAAkB,mCAAmC;EACvE,aAAa;EACb,SAAS,GAAG,WAAW,GAAG,YAAY;EACtC;EACA;EACA,eAAe;EACf,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { post } from "@n8n/rest-api-client";
2
+
3
+ //#region src/onboarding.api.ts
4
+ const N8N_API_BASE_URL = "https://api.n8n.io/api";
5
+ const CONTACT_EMAIL_SUBMISSION_ENDPOINT = "/accounts/onboarding";
6
+ async function submitEmailOnSignup(instanceId, currentUser, email, agree) {
7
+ return await post(N8N_API_BASE_URL, CONTACT_EMAIL_SUBMISSION_ENDPOINT, {
8
+ instance_id: instanceId,
9
+ user_id: `${instanceId}#${currentUser.id}`,
10
+ email,
11
+ agree,
12
+ agree_updates: true
13
+ });
14
+ }
15
+
16
+ //#endregion
17
+ export { submitEmailOnSignup as t };
18
+ //# sourceMappingURL=onboarding2.api.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding2.api.mjs","names":[],"sources":["../src/onboarding.api.ts"],"sourcesContent":["import { post } from '@n8n/rest-api-client';\nimport type { IUser } from '@n8n/rest-api-client/api/users';\n\nconst N8N_API_BASE_URL = 'https://api.n8n.io/api';\nconst CONTACT_EMAIL_SUBMISSION_ENDPOINT = '/accounts/onboarding';\n\nexport async function submitEmailOnSignup(\n\tinstanceId: string,\n\tcurrentUser: IUser,\n\temail: string | undefined,\n\tagree: boolean,\n): Promise<string> {\n\t// `post` targets the external onboarding API and is untyped; the response is the\n\t// created onboarding record id.\n\treturn (await post(N8N_API_BASE_URL, CONTACT_EMAIL_SUBMISSION_ENDPOINT, {\n\t\tinstance_id: instanceId,\n\t\tuser_id: `${instanceId}#${currentUser.id}`,\n\t\temail,\n\t\tagree,\n\t\tagree_updates: true,\n\t})) as string;\n}\n"],"mappings":";;;AAGA,MAAM,mBAAmB;AACzB,MAAM,oCAAoC;AAE1C,eAAsB,oBACrB,YACA,aACA,OACA,OACkB;AAGlB,QAAQ,MAAM,KAAK,kBAAkB,mCAAmC;EACvE,aAAa;EACb,SAAS,GAAG,WAAW,GAAG,YAAY;EACtC;EACA;EACA,eAAe;EACf,CAAC"}
@@ -1,7 +1,8 @@
1
+ const require_settings_store = require('./settings2.store.cjs');
1
2
  const require_constants = require('./constants2.cjs');
2
- let __n8n_permissions = require("@n8n/permissions");
3
3
  let pinia = require("pinia");
4
4
  let vue = require("vue");
5
+ let __n8n_permissions = require("@n8n/permissions");
5
6
 
6
7
  //#region src/rbac.store.ts
7
8
  const useRBACStore = (0, pinia.defineStore)(require_constants.STORES.RBAC, () => {
@@ -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;EACZ,KAAK,EAAE;EACP,eAAe,EAAE;EACjB,MAAM,EAAE;EACR,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,iBAAiB,EAAE;EACnB,eAAe,EAAE;EACjB,yBAAyB,EAAE;EAC3B,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACX,eAAe,EAAE;EACjB,aAAa,EAAE;EACf,qBAAqB,EAAE;EACvB,WAAW,EAAE;EACb,QAAQ,EAAE;EACV,WAAW,EAAE;EACb,kBAAkB,EAAE;EACpB,MAAM,EAAE;EACR,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,MAAM,EAAE;EACR,MAAM,EAAE;EACR,cAAc,EAAE;EAChB,eAAe,EAAE;EACjB,QAAQ,EAAE;EACV,UAAU,EAAE;EACZ,WAAW,EAAE;EACb,WAAW,EAAE;EACb,SAAS,EAAE;EACX,cAAc,E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D,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\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,EAAE;EACd,UAAU,EAAE;EACZ,iBAAiB,EAAE;EACnB,eAAe,EAAE;EACjB,yBAAyB,EAAE;EAC3B,gBAAgB,EAAE;EAClB,SAAS,EAAE;EACX,eAAe,EAAE;EACjB,aAAa,EAAE;EACf,qBAAqB,EAAE;EACvB,WAAW,EAAE;EACb,QAAQ,EAAE;EACV,WAAW,EAAE;EACb,kBAAkB,EAAE;EACpB,MAAM,EAAE;EACR,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,MAAM,EAAE;EACR,MAAM,EAAE;EACR,cAAc,EAAE;EAChB,eAAe,EAAE;EACjB,QAAQ,EAAE;EACV,UAAU,EAAE;EACZ,WAAW,EAAE;EACb,WAAW,EAAE;EACb,SAAS,EAAE;EACX,cAAc,EAAE;EAChB,MAAM,EAAE;EACR,KAAK,EAAE;EACP,WAAW,EAAE;EACb,SAAS,EAAE;EACX,cAAc,EAAE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ACA"}
@@ -1,15 +1,15 @@
1
- import * as vue0 from "vue";
2
- import * as pinia0 from "pinia";
1
+ import * as vue128 from "vue";
2
+ import * as pinia4 from "pinia";
3
3
  import { Role } from "@n8n/api-types";
4
4
  import { Resource, Scope, ScopeOptions } from "@n8n/permissions";
5
5
 
6
6
  //#region src/rbac.store.d.ts
7
- declare const useRBACStore: pinia0.StoreDefinition<"rbac", Pick<{
8
- globalRoles: vue0.Ref<Role[], Role[]>;
9
- rolesByProjectId: vue0.Ref<Record<string, string[]>, Record<string, string[]>>;
10
- globalScopes: vue0.Ref<Scope[], Scope[]>;
11
- scopesByProjectId: vue0.Ref<Record<string, Scope[]>, Record<string, Scope[]>>;
12
- scopesByResourceId: vue0.Ref<{
7
+ declare const useRBACStore: pinia4.StoreDefinition<"rbac", Pick<{
8
+ globalRoles: vue128.Ref<Role[], Role[]>;
9
+ rolesByProjectId: vue128.Ref<Record<string, string[]>, Record<string, string[]>>;
10
+ globalScopes: vue128.Ref<Scope[], Scope[]>;
11
+ scopesByProjectId: vue128.Ref<Record<string, Scope[]>, Record<string, Scope[]>>;
12
+ scopesByResourceId: vue128.Ref<{
13
13
  chatHub: Record<string, Scope[]>;
14
14
  agent: Record<string, Scope[]>;
15
15
  aiAssistant: Record<string, Scope[]>;
@@ -121,11 +121,11 @@ declare const useRBACStore: pinia0.StoreDefinition<"rbac", Pick<{
121
121
  projectId?: string;
122
122
  }, options?: ScopeOptions) => boolean;
123
123
  }, "globalRoles" | "rolesByProjectId" | "globalScopes" | "scopesByProjectId" | "scopesByResourceId">, Pick<{
124
- globalRoles: vue0.Ref<Role[], Role[]>;
125
- rolesByProjectId: vue0.Ref<Record<string, string[]>, Record<string, string[]>>;
126
- globalScopes: vue0.Ref<Scope[], Scope[]>;
127
- scopesByProjectId: vue0.Ref<Record<string, Scope[]>, Record<string, Scope[]>>;
128
- scopesByResourceId: vue0.Ref<{
124
+ globalRoles: vue128.Ref<Role[], Role[]>;
125
+ rolesByProjectId: vue128.Ref<Record<string, string[]>, Record<string, string[]>>;
126
+ globalScopes: vue128.Ref<Scope[], Scope[]>;
127
+ scopesByProjectId: vue128.Ref<Record<string, Scope[]>, Record<string, Scope[]>>;
128
+ scopesByResourceId: vue128.Ref<{
129
129
  chatHub: Record<string, Scope[]>;
130
130
  agent: Record<string, Scope[]>;
131
131
  aiAssistant: Record<string, Scope[]>;
@@ -237,11 +237,11 @@ declare const useRBACStore: pinia0.StoreDefinition<"rbac", Pick<{
237
237
  projectId?: string;
238
238
  }, options?: ScopeOptions) => boolean;
239
239
  }, never>, Pick<{
240
- globalRoles: vue0.Ref<Role[], Role[]>;
241
- rolesByProjectId: vue0.Ref<Record<string, string[]>, Record<string, string[]>>;
242
- globalScopes: vue0.Ref<Scope[], Scope[]>;
243
- scopesByProjectId: vue0.Ref<Record<string, Scope[]>, Record<string, Scope[]>>;
244
- scopesByResourceId: vue0.Ref<{
240
+ globalRoles: vue128.Ref<Role[], Role[]>;
241
+ rolesByProjectId: vue128.Ref<Record<string, string[]>, Record<string, string[]>>;
242
+ globalScopes: vue128.Ref<Scope[], Scope[]>;
243
+ scopesByProjectId: vue128.Ref<Record<string, Scope[]>, Record<string, Scope[]>>;
244
+ scopesByResourceId: vue128.Ref<{
245
245
  chatHub: Record<string, Scope[]>;
246
246
  agent: Record<string, Scope[]>;
247
247
  aiAssistant: Record<string, Scope[]>;
@@ -1,7 +1,7 @@
1
- import { Resource, Scope, ScopeOptions } from "@n8n/permissions";
2
1
  import * as pinia0 from "pinia";
3
2
  import * as vue0 from "vue";
4
3
  import { Role } from "@n8n/api-types";
4
+ import { Resource, Scope, ScopeOptions } from "@n8n/permissions";
5
5
 
6
6
  //#region src/rbac.store.d.ts
7
7
  declare const useRBACStore: pinia0.StoreDefinition<"rbac", Pick<{
@@ -1,7 +1,7 @@
1
1
  import { t as STORES } from "./constants2.mjs";
2
- import { hasScope } from "@n8n/permissions";
3
2
  import { defineStore } from "pinia";
4
3
  import { ref } from "vue";
4
+ import { hasScope } from "@n8n/permissions";
5
5
 
6
6
  //#region src/rbac.store.ts
7
7
  const useRBACStore = defineStore(STORES.RBAC, () => {
@@ -0,0 +1,88 @@
1
+ const require_settings_store = require('./settings2.store.cjs');
2
+ require('./constants2.cjs');
3
+ require('./metaTagConfig2.cjs');
4
+ const require_useRootStore = require('./useRootStore2.cjs');
5
+ let pinia = require("pinia");
6
+ let vue = require("vue");
7
+ let __n8n_permissions = require("@n8n/permissions");
8
+ let __n8n_rest_api_client_api_roles = require("@n8n/rest-api-client/api/roles");
9
+ __n8n_rest_api_client_api_roles = require_settings_store.__toESM(__n8n_rest_api_client_api_roles);
10
+
11
+ //#region src/roles.store.ts
12
+ function sortByOrderThenName(orderMap) {
13
+ return (a, b) => {
14
+ const orderA = orderMap.get(a.slug);
15
+ const orderB = orderMap.get(b.slug);
16
+ if (orderA !== void 0 || orderB !== void 0) return (orderA ?? Number.MAX_SAFE_INTEGER) - (orderB ?? Number.MAX_SAFE_INTEGER);
17
+ return a.displayName.localeCompare(b.displayName);
18
+ };
19
+ }
20
+ const useRolesStore = (0, pinia.defineStore)("roles", () => {
21
+ const rootStore = require_useRootStore.useRootStore();
22
+ const settingsStore = require_settings_store.useSettingsStore();
23
+ const roles = (0, vue.ref)({
24
+ global: [],
25
+ project: [],
26
+ credential: [],
27
+ workflow: [],
28
+ secretsProviderConnection: []
29
+ });
30
+ const projectRoleOrder = (0, vue.ref)([
31
+ "project:viewer",
32
+ "project:chatUser",
33
+ "project:editor",
34
+ "project:admin"
35
+ ]);
36
+ const projectRoleOrderMap = (0, vue.computed)(() => new Map(projectRoleOrder.value.map((role, idx) => [role, idx])));
37
+ const globalRoleOrder = (0, vue.ref)(["global:admin", "global:member"]);
38
+ const globalRoleOrderMap = (0, vue.computed)(() => new Map(globalRoleOrder.value.map((role, idx) => [role, idx])));
39
+ const processedInstanceRoles = (0, vue.computed)(() => roles.value.global.filter((role) => role.slug !== __n8n_permissions.GLOBAL_OWNER_ROLE_SLUG && (settingsStore.isChatFeatureEnabled || role.slug !== __n8n_permissions.GLOBAL_CHAT_USER_ROLE_SLUG)).sort(sortByOrderThenName(globalRoleOrderMap.value)));
40
+ const customInstanceRoles = (0, vue.computed)(() => processedInstanceRoles.value.filter((role) => !role.systemRole));
41
+ const processedProjectRoles = (0, vue.computed)(() => roles.value.project.filter((role) => role.slug !== __n8n_permissions.PROJECT_OWNER_ROLE_SLUG && (settingsStore.isChatFeatureEnabled || role.slug !== __n8n_permissions.PROJECT_CHAT_USER_ROLE_SLUG)).sort(sortByOrderThenName(projectRoleOrderMap.value)));
42
+ const processedCredentialRoles = (0, vue.computed)(() => roles.value.credential.filter((role) => role.slug !== "credential:owner"));
43
+ const processedWorkflowRoles = (0, vue.computed)(() => roles.value.workflow.filter((role) => role.slug !== "workflow:owner"));
44
+ const fetchRoles = async () => {
45
+ roles.value = await __n8n_rest_api_client_api_roles.getRoles(rootStore.restApiContext);
46
+ };
47
+ const createRole = async (body) => {
48
+ return await __n8n_rest_api_client_api_roles.createRole(rootStore.restApiContext, body);
49
+ };
50
+ const fetchRoleBySlug = async (payload) => {
51
+ return await __n8n_rest_api_client_api_roles.getRoleBySlug(rootStore.restApiContext, payload);
52
+ };
53
+ const deleteRole = async (slug, reassignRoleSlug) => {
54
+ return await __n8n_rest_api_client_api_roles.deleteRole(rootStore.restApiContext, slug, reassignRoleSlug);
55
+ };
56
+ const updateRole = async (slug, body) => {
57
+ return await __n8n_rest_api_client_api_roles.updateRole(rootStore.restApiContext, slug, body);
58
+ };
59
+ const fetchRoleAssignments = async (slug) => {
60
+ return await __n8n_rest_api_client_api_roles.getRoleAssignments(rootStore.restApiContext, slug);
61
+ };
62
+ const fetchRoleProjectMembers = async (slug, projectId) => {
63
+ return await __n8n_rest_api_client_api_roles.getRoleProjectMembers(rootStore.restApiContext, slug, projectId);
64
+ };
65
+ const fetchRoleMembers = async (slug) => {
66
+ return await __n8n_rest_api_client_api_roles.getRoleMembers(rootStore.restApiContext, slug);
67
+ };
68
+ return {
69
+ roles,
70
+ processedProjectRoles,
71
+ processedInstanceRoles,
72
+ customInstanceRoles,
73
+ processedCredentialRoles,
74
+ processedWorkflowRoles,
75
+ fetchRoles,
76
+ createRole,
77
+ fetchRoleBySlug,
78
+ updateRole,
79
+ deleteRole,
80
+ fetchRoleAssignments,
81
+ fetchRoleProjectMembers,
82
+ fetchRoleMembers
83
+ };
84
+ });
85
+
86
+ //#endregion
87
+ exports.useRolesStore = useRolesStore;
88
+ //# sourceMappingURL=roles.store.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roles.store.cjs","names":["useRootStore","useSettingsStore","GLOBAL_OWNER_ROLE_SLUG","GLOBAL_CHAT_USER_ROLE_SLUG","PROJECT_OWNER_ROLE_SLUG","PROJECT_CHAT_USER_ROLE_SLUG","rolesApi"],"sources":["../src/roles.store.ts"],"sourcesContent":["import type {\n\tCreateRoleDto,\n\tRoleAssignmentsResponse,\n\tRoleMembersResponse,\n\tRoleProjectMembersResponse,\n\tUpdateRoleDto,\n} from '@n8n/api-types';\nimport {\n\ttype AllRolesMap,\n\ttype Role,\n\tGLOBAL_OWNER_ROLE_SLUG,\n\tGLOBAL_CHAT_USER_ROLE_SLUG,\n\tPROJECT_OWNER_ROLE_SLUG,\n\tPROJECT_CHAT_USER_ROLE_SLUG,\n} from '@n8n/permissions';\nimport * as rolesApi from '@n8n/rest-api-client/api/roles';\nimport { defineStore } from 'pinia';\nimport { ref, computed } from 'vue';\n\nimport { useSettingsStore } from './settings.store';\nimport { useRootStore } from './useRootStore';\n\nfunction sortByOrderThenName(orderMap: Map<string, number>) {\n\treturn (a: { slug: string; displayName: string }, b: { slug: string; displayName: string }) => {\n\t\tconst orderA = orderMap.get(a.slug);\n\t\tconst orderB = orderMap.get(b.slug);\n\t\t// Roles with an explicit order come first; the rest sort alphabetically by name.\n\t\tif (orderA !== undefined || orderB !== undefined) {\n\t\t\treturn (orderA ?? Number.MAX_SAFE_INTEGER) - (orderB ?? Number.MAX_SAFE_INTEGER);\n\t\t}\n\t\treturn a.displayName.localeCompare(b.displayName);\n\t};\n}\n\nexport const useRolesStore = defineStore('roles', () => {\n\tconst rootStore = useRootStore();\n\tconst settingsStore = useSettingsStore();\n\tconst roles = ref<AllRolesMap>({\n\t\tglobal: [],\n\t\tproject: [],\n\t\tcredential: [],\n\t\tworkflow: [],\n\t\tsecretsProviderConnection: [],\n\t});\n\tconst projectRoleOrder = ref<string[]>([\n\t\t'project:viewer',\n\t\t'project:chatUser',\n\t\t'project:editor',\n\t\t'project:admin',\n\t]);\n\tconst projectRoleOrderMap = computed<Map<string, number>>(\n\t\t() => new Map(projectRoleOrder.value.map((role, idx) => [role, idx])),\n\t);\n\n\tconst globalRoleOrder = ref<string[]>(['global:admin', 'global:member']);\n\tconst globalRoleOrderMap = computed<Map<string, number>>(\n\t\t() => new Map(globalRoleOrder.value.map((role, idx) => [role, idx])),\n\t);\n\n\tconst processedInstanceRoles = computed<AllRolesMap['global']>(() =>\n\t\troles.value.global\n\t\t\t.filter(\n\t\t\t\t(role) =>\n\t\t\t\t\trole.slug !== GLOBAL_OWNER_ROLE_SLUG &&\n\t\t\t\t\t(settingsStore.isChatFeatureEnabled || role.slug !== GLOBAL_CHAT_USER_ROLE_SLUG),\n\t\t\t)\n\t\t\t.sort(sortByOrderThenName(globalRoleOrderMap.value)),\n\t);\n\n\tconst customInstanceRoles = computed<AllRolesMap['global']>(() =>\n\t\tprocessedInstanceRoles.value.filter((role) => !role.systemRole),\n\t);\n\n\tconst processedProjectRoles = computed<AllRolesMap['project']>(() =>\n\t\troles.value.project\n\t\t\t.filter(\n\t\t\t\t(role) =>\n\t\t\t\t\trole.slug !== PROJECT_OWNER_ROLE_SLUG &&\n\t\t\t\t\t(settingsStore.isChatFeatureEnabled || role.slug !== PROJECT_CHAT_USER_ROLE_SLUG),\n\t\t\t)\n\t\t\t.sort(sortByOrderThenName(projectRoleOrderMap.value)),\n\t);\n\n\tconst processedCredentialRoles = computed<AllRolesMap['credential']>(() =>\n\t\troles.value.credential.filter((role) => role.slug !== 'credential:owner'),\n\t);\n\n\tconst processedWorkflowRoles = computed<AllRolesMap['workflow']>(() =>\n\t\troles.value.workflow.filter((role) => role.slug !== 'workflow:owner'),\n\t);\n\n\tconst fetchRoles = async () => {\n\t\troles.value = await rolesApi.getRoles(rootStore.restApiContext);\n\t};\n\n\tconst createRole = async (body: CreateRoleDto): Promise<Role> => {\n\t\treturn await rolesApi.createRole(rootStore.restApiContext, body);\n\t};\n\n\tconst fetchRoleBySlug = async (payload: { slug: string }): Promise<Role> => {\n\t\treturn await rolesApi.getRoleBySlug(rootStore.restApiContext, payload);\n\t};\n\n\tconst deleteRole = async (slug: string, reassignRoleSlug?: string): Promise<Role> => {\n\t\treturn await rolesApi.deleteRole(rootStore.restApiContext, slug, reassignRoleSlug);\n\t};\n\n\tconst updateRole = async (slug: string, body: UpdateRoleDto): Promise<Role> => {\n\t\treturn await rolesApi.updateRole(rootStore.restApiContext, slug, body);\n\t};\n\n\tconst fetchRoleAssignments = async (slug: string): Promise<RoleAssignmentsResponse> => {\n\t\treturn await rolesApi.getRoleAssignments(rootStore.restApiContext, slug);\n\t};\n\n\tconst fetchRoleProjectMembers = async (\n\t\tslug: string,\n\t\tprojectId: string,\n\t): Promise<RoleProjectMembersResponse> => {\n\t\treturn await rolesApi.getRoleProjectMembers(rootStore.restApiContext, slug, projectId);\n\t};\n\n\tconst fetchRoleMembers = async (slug: string): Promise<RoleMembersResponse> => {\n\t\treturn await rolesApi.getRoleMembers(rootStore.restApiContext, slug);\n\t};\n\n\treturn {\n\t\troles,\n\t\tprocessedProjectRoles,\n\t\tprocessedInstanceRoles,\n\t\tcustomInstanceRoles,\n\t\tprocessedCredentialRoles,\n\t\tprocessedWorkflowRoles,\n\t\tfetchRoles,\n\t\tcreateRole,\n\t\tfetchRoleBySlug,\n\t\tupdateRole,\n\t\tdeleteRole,\n\t\tfetchRoleAssignments,\n\t\tfetchRoleProjectMembers,\n\t\tfetchRoleMembers,\n\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