@n8n/stores 2.33.0 → 2.34.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/cloudPlan.store.cjs +5 -241
- package/dist/cloudPlan.store.d.cts +6 -0
- package/dist/cloudPlan.store.d.mts +72 -66
- package/dist/cloudPlan.store.mjs +5 -241
- package/dist/cloudPlan2.store.cjs +247 -0
- package/dist/cloudPlan2.store.cjs.map +1 -0
- package/dist/cloudPlan2.store.mjs +242 -0
- package/dist/cloudPlan2.store.mjs.map +1 -0
- package/dist/composables/useBasePageRedirectionHelper.cjs +87 -0
- package/dist/composables/useBasePageRedirectionHelper.cjs.map +1 -0
- package/dist/composables/useBasePageRedirectionHelper.d.cts +16 -0
- package/dist/composables/useBasePageRedirectionHelper.d.mts +16 -0
- package/dist/composables/useBasePageRedirectionHelper.mjs +87 -0
- package/dist/composables/useBasePageRedirectionHelper.mjs.map +1 -0
- 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.cjs +2 -8
- package/dist/notifications.store.cjs.map +1 -1
- package/dist/notifications.store.d.cts +3 -24
- package/dist/notifications.store.d.mts +3 -24
- package/dist/notifications.store.mjs +2 -8
- package/dist/notifications.store.mjs.map +1 -1
- package/dist/pageRedirection.d.cts +6 -0
- package/dist/pageRedirection.d.mts +6 -0
- package/dist/rbac.store.d.cts +123 -123
- package/dist/rbac.store.d.mts +123 -123
- package/dist/roles.store.d.cts +21 -21
- package/dist/roles.store.d.mts +19 -19
- package/dist/settings.store.d.cts +243 -237
- package/dist/settings.store.d.mts +243 -237
- package/dist/settings2.store.cjs +5 -5
- package/dist/settings2.store.cjs.map +1 -1
- package/dist/settings2.store.mjs +5 -5
- package/dist/settings2.store.mjs.map +1 -1
- package/dist/types/pageRedirection.cjs +0 -0
- package/dist/types/pageRedirection.d.cts +2 -0
- package/dist/types/pageRedirection.d.mts +2 -0
- package/dist/types/pageRedirection.mjs +1 -0
- package/dist/useAgentRequestStore.d.mts +6 -6
- package/dist/useRootStore.d.cts +72 -72
- package/dist/useRootStore.d.mts +70 -70
- package/dist/users.store.cjs +7 -352
- package/dist/users.store.d.cts +67 -55
- package/dist/users.store.d.mts +69 -57
- package/dist/users.store.mjs +7 -349
- package/dist/users2.store.cjs +362 -0
- package/dist/users2.store.cjs.map +1 -0
- package/dist/users2.store.mjs +353 -0
- package/dist/users2.store.mjs.map +1 -0
- package/dist/versions.store.cjs +11 -0
- package/dist/versions.store.d.cts +384 -0
- package/dist/versions.store.d.mts +384 -0
- package/dist/versions.store.mjs +10 -0
- package/dist/versions2.store.cjs +230 -0
- package/dist/versions2.store.cjs.map +1 -0
- package/dist/versions2.store.mjs +218 -0
- package/dist/versions2.store.mjs.map +1 -0
- package/package.json +14 -13
- package/dist/cloudPlan.store.cjs.map +0 -1
- package/dist/cloudPlan.store.mjs.map +0 -1
- package/dist/users.store.cjs.map +0 -1
- package/dist/users.store.mjs.map +0 -1
package/dist/useRootStore.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as pinia4 from "pinia";
|
|
2
|
-
import * as
|
|
2
|
+
import * as vue323 from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/useRootStore.d.ts
|
|
5
5
|
type RootStoreState = {
|
|
@@ -31,32 +31,32 @@ type RootStoreState = {
|
|
|
31
31
|
binaryDataMode: 'default' | 'filesystem' | 's3' | 'azure' | 'database';
|
|
32
32
|
};
|
|
33
33
|
declare const useRootStore: pinia4.StoreDefinition<"root", Pick<{
|
|
34
|
-
baseUrl:
|
|
35
|
-
formUrl:
|
|
36
|
-
formTestUrl:
|
|
37
|
-
formWaitingUrl:
|
|
38
|
-
mcpUrl:
|
|
39
|
-
mcpTestUrl:
|
|
40
|
-
webhookUrl:
|
|
41
|
-
webhookTestUrl:
|
|
42
|
-
webhookWaitingUrl:
|
|
43
|
-
restUrl:
|
|
44
|
-
restApiContext:
|
|
34
|
+
baseUrl: vue323.ComputedRef<string>;
|
|
35
|
+
formUrl: vue323.ComputedRef<string>;
|
|
36
|
+
formTestUrl: vue323.ComputedRef<string>;
|
|
37
|
+
formWaitingUrl: vue323.ComputedRef<string>;
|
|
38
|
+
mcpUrl: vue323.ComputedRef<string>;
|
|
39
|
+
mcpTestUrl: vue323.ComputedRef<string>;
|
|
40
|
+
webhookUrl: vue323.ComputedRef<string>;
|
|
41
|
+
webhookTestUrl: vue323.ComputedRef<string>;
|
|
42
|
+
webhookWaitingUrl: vue323.ComputedRef<string>;
|
|
43
|
+
restUrl: vue323.ComputedRef<string>;
|
|
44
|
+
restApiContext: vue323.ComputedRef<{
|
|
45
45
|
baseUrl: string;
|
|
46
46
|
pushRef: string;
|
|
47
47
|
}>;
|
|
48
|
-
urlBaseEditor:
|
|
49
|
-
urlBaseWebhook:
|
|
50
|
-
versionCli:
|
|
51
|
-
instanceId:
|
|
52
|
-
pushRef:
|
|
53
|
-
defaultLocale:
|
|
54
|
-
binaryDataMode:
|
|
55
|
-
OAuthCallbackUrls:
|
|
56
|
-
jwksUri:
|
|
57
|
-
executionTimeout:
|
|
58
|
-
maxExecutionTimeout:
|
|
59
|
-
timezone:
|
|
48
|
+
urlBaseEditor: vue323.ComputedRef<string>;
|
|
49
|
+
urlBaseWebhook: vue323.ComputedRef<string>;
|
|
50
|
+
versionCli: vue323.ComputedRef<string>;
|
|
51
|
+
instanceId: vue323.ComputedRef<string>;
|
|
52
|
+
pushRef: vue323.ComputedRef<string>;
|
|
53
|
+
defaultLocale: vue323.ComputedRef<string>;
|
|
54
|
+
binaryDataMode: vue323.ComputedRef<"default" | "filesystem" | "s3" | "azure" | "database">;
|
|
55
|
+
OAuthCallbackUrls: vue323.ComputedRef<object>;
|
|
56
|
+
jwksUri: vue323.ComputedRef<string>;
|
|
57
|
+
executionTimeout: vue323.ComputedRef<number>;
|
|
58
|
+
maxExecutionTimeout: vue323.ComputedRef<number>;
|
|
59
|
+
timezone: vue323.ComputedRef<string>;
|
|
60
60
|
setUrlBaseWebhook: (value: string) => void;
|
|
61
61
|
setUrlBaseEditor: (value: string) => void;
|
|
62
62
|
setUrlBaseWebhookTest: (value: string) => void;
|
|
@@ -80,32 +80,32 @@ declare const useRootStore: pinia4.StoreDefinition<"root", Pick<{
|
|
|
80
80
|
setBinaryDataMode: (value: RootStoreState["binaryDataMode"]) => void;
|
|
81
81
|
setPushRef: (value: string) => void;
|
|
82
82
|
}, never>, Pick<{
|
|
83
|
-
baseUrl:
|
|
84
|
-
formUrl:
|
|
85
|
-
formTestUrl:
|
|
86
|
-
formWaitingUrl:
|
|
87
|
-
mcpUrl:
|
|
88
|
-
mcpTestUrl:
|
|
89
|
-
webhookUrl:
|
|
90
|
-
webhookTestUrl:
|
|
91
|
-
webhookWaitingUrl:
|
|
92
|
-
restUrl:
|
|
93
|
-
restApiContext:
|
|
83
|
+
baseUrl: vue323.ComputedRef<string>;
|
|
84
|
+
formUrl: vue323.ComputedRef<string>;
|
|
85
|
+
formTestUrl: vue323.ComputedRef<string>;
|
|
86
|
+
formWaitingUrl: vue323.ComputedRef<string>;
|
|
87
|
+
mcpUrl: vue323.ComputedRef<string>;
|
|
88
|
+
mcpTestUrl: vue323.ComputedRef<string>;
|
|
89
|
+
webhookUrl: vue323.ComputedRef<string>;
|
|
90
|
+
webhookTestUrl: vue323.ComputedRef<string>;
|
|
91
|
+
webhookWaitingUrl: vue323.ComputedRef<string>;
|
|
92
|
+
restUrl: vue323.ComputedRef<string>;
|
|
93
|
+
restApiContext: vue323.ComputedRef<{
|
|
94
94
|
baseUrl: string;
|
|
95
95
|
pushRef: string;
|
|
96
96
|
}>;
|
|
97
|
-
urlBaseEditor:
|
|
98
|
-
urlBaseWebhook:
|
|
99
|
-
versionCli:
|
|
100
|
-
instanceId:
|
|
101
|
-
pushRef:
|
|
102
|
-
defaultLocale:
|
|
103
|
-
binaryDataMode:
|
|
104
|
-
OAuthCallbackUrls:
|
|
105
|
-
jwksUri:
|
|
106
|
-
executionTimeout:
|
|
107
|
-
maxExecutionTimeout:
|
|
108
|
-
timezone:
|
|
97
|
+
urlBaseEditor: vue323.ComputedRef<string>;
|
|
98
|
+
urlBaseWebhook: vue323.ComputedRef<string>;
|
|
99
|
+
versionCli: vue323.ComputedRef<string>;
|
|
100
|
+
instanceId: vue323.ComputedRef<string>;
|
|
101
|
+
pushRef: vue323.ComputedRef<string>;
|
|
102
|
+
defaultLocale: vue323.ComputedRef<string>;
|
|
103
|
+
binaryDataMode: vue323.ComputedRef<"default" | "filesystem" | "s3" | "azure" | "database">;
|
|
104
|
+
OAuthCallbackUrls: vue323.ComputedRef<object>;
|
|
105
|
+
jwksUri: vue323.ComputedRef<string>;
|
|
106
|
+
executionTimeout: vue323.ComputedRef<number>;
|
|
107
|
+
maxExecutionTimeout: vue323.ComputedRef<number>;
|
|
108
|
+
timezone: vue323.ComputedRef<string>;
|
|
109
109
|
setUrlBaseWebhook: (value: string) => void;
|
|
110
110
|
setUrlBaseEditor: (value: string) => void;
|
|
111
111
|
setUrlBaseWebhookTest: (value: string) => void;
|
|
@@ -129,32 +129,32 @@ declare const useRootStore: pinia4.StoreDefinition<"root", Pick<{
|
|
|
129
129
|
setBinaryDataMode: (value: RootStoreState["binaryDataMode"]) => void;
|
|
130
130
|
setPushRef: (value: string) => void;
|
|
131
131
|
}, "executionTimeout" | "maxExecutionTimeout" | "jwksUri" | "timezone" | "urlBaseWebhook" | "urlBaseEditor" | "versionCli" | "binaryDataMode" | "instanceId" | "defaultLocale" | "baseUrl" | "pushRef" | "formUrl" | "formTestUrl" | "formWaitingUrl" | "mcpUrl" | "mcpTestUrl" | "webhookUrl" | "webhookTestUrl" | "webhookWaitingUrl" | "restUrl" | "restApiContext" | "OAuthCallbackUrls">, Pick<{
|
|
132
|
-
baseUrl:
|
|
133
|
-
formUrl:
|
|
134
|
-
formTestUrl:
|
|
135
|
-
formWaitingUrl:
|
|
136
|
-
mcpUrl:
|
|
137
|
-
mcpTestUrl:
|
|
138
|
-
webhookUrl:
|
|
139
|
-
webhookTestUrl:
|
|
140
|
-
webhookWaitingUrl:
|
|
141
|
-
restUrl:
|
|
142
|
-
restApiContext:
|
|
132
|
+
baseUrl: vue323.ComputedRef<string>;
|
|
133
|
+
formUrl: vue323.ComputedRef<string>;
|
|
134
|
+
formTestUrl: vue323.ComputedRef<string>;
|
|
135
|
+
formWaitingUrl: vue323.ComputedRef<string>;
|
|
136
|
+
mcpUrl: vue323.ComputedRef<string>;
|
|
137
|
+
mcpTestUrl: vue323.ComputedRef<string>;
|
|
138
|
+
webhookUrl: vue323.ComputedRef<string>;
|
|
139
|
+
webhookTestUrl: vue323.ComputedRef<string>;
|
|
140
|
+
webhookWaitingUrl: vue323.ComputedRef<string>;
|
|
141
|
+
restUrl: vue323.ComputedRef<string>;
|
|
142
|
+
restApiContext: vue323.ComputedRef<{
|
|
143
143
|
baseUrl: string;
|
|
144
144
|
pushRef: string;
|
|
145
145
|
}>;
|
|
146
|
-
urlBaseEditor:
|
|
147
|
-
urlBaseWebhook:
|
|
148
|
-
versionCli:
|
|
149
|
-
instanceId:
|
|
150
|
-
pushRef:
|
|
151
|
-
defaultLocale:
|
|
152
|
-
binaryDataMode:
|
|
153
|
-
OAuthCallbackUrls:
|
|
154
|
-
jwksUri:
|
|
155
|
-
executionTimeout:
|
|
156
|
-
maxExecutionTimeout:
|
|
157
|
-
timezone:
|
|
146
|
+
urlBaseEditor: vue323.ComputedRef<string>;
|
|
147
|
+
urlBaseWebhook: vue323.ComputedRef<string>;
|
|
148
|
+
versionCli: vue323.ComputedRef<string>;
|
|
149
|
+
instanceId: vue323.ComputedRef<string>;
|
|
150
|
+
pushRef: vue323.ComputedRef<string>;
|
|
151
|
+
defaultLocale: vue323.ComputedRef<string>;
|
|
152
|
+
binaryDataMode: vue323.ComputedRef<"default" | "filesystem" | "s3" | "azure" | "database">;
|
|
153
|
+
OAuthCallbackUrls: vue323.ComputedRef<object>;
|
|
154
|
+
jwksUri: vue323.ComputedRef<string>;
|
|
155
|
+
executionTimeout: vue323.ComputedRef<number>;
|
|
156
|
+
maxExecutionTimeout: vue323.ComputedRef<number>;
|
|
157
|
+
timezone: vue323.ComputedRef<string>;
|
|
158
158
|
setUrlBaseWebhook: (value: string) => void;
|
|
159
159
|
setUrlBaseEditor: (value: string) => void;
|
|
160
160
|
setUrlBaseWebhookTest: (value: string) => void;
|
package/dist/users.store.cjs
CHANGED
|
@@ -1,354 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require('./settings2.store.cjs');
|
|
2
|
+
require('./constants2.cjs');
|
|
3
3
|
require('./metaTagConfig2.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
__n8n_rest_api_client_api_cloudPlans = require_settings_store.__toESM(__n8n_rest_api_client_api_cloudPlans);
|
|
9
|
-
let pinia = require("pinia");
|
|
10
|
-
let vue = require("vue");
|
|
11
|
-
let __n8n_api_types = require("@n8n/api-types");
|
|
12
|
-
let __vueuse_core = require("@vueuse/core");
|
|
13
|
-
let __n8n_constants = require("@n8n/constants");
|
|
14
|
-
let __n8n_rest_api_client_api_mfa = require("@n8n/rest-api-client/api/mfa");
|
|
15
|
-
__n8n_rest_api_client_api_mfa = require_settings_store.__toESM(__n8n_rest_api_client_api_mfa);
|
|
16
|
-
let __n8n_rest_api_client_api_users = require("@n8n/rest-api-client/api/users");
|
|
17
|
-
__n8n_rest_api_client_api_users = require_settings_store.__toESM(__n8n_rest_api_client_api_users);
|
|
4
|
+
require('./useRootStore2.cjs');
|
|
5
|
+
require('./invitation2.api.cjs');
|
|
6
|
+
require('./onboarding2.api.cjs');
|
|
7
|
+
const require_users_store = require('./users2.store.cjs');
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Registration key of the app's personalization modal, passed to the injected
|
|
22
|
-
* modal opener. Mirrors `PERSONALIZATION_MODAL_KEY` in editor-ui's
|
|
23
|
-
* `users.constants`; kept as a literal so the store carries no `@/app` import.
|
|
24
|
-
*/
|
|
25
|
-
const PERSONALIZATION_MODAL_KEY = "personalization";
|
|
26
|
-
const _isPendingUser = (user) => !!user?.isPending;
|
|
27
|
-
const _isInstanceOwner = (user) => user?.role === __n8n_api_types.ROLE.Owner;
|
|
28
|
-
const _isDefaultUser = (user) => _isInstanceOwner(user) && _isPendingUser(user);
|
|
29
|
-
const _isAdmin = (user) => user?.role === __n8n_api_types.ROLE.Admin;
|
|
30
|
-
const useUsersStore = (0, pinia.defineStore)(require_constants.STORES.USERS, () => {
|
|
31
|
-
const initialized = (0, vue.ref)(false);
|
|
32
|
-
const currentUserId = (0, vue.ref)(null);
|
|
33
|
-
const usersById = (0, vue.ref)({});
|
|
34
|
-
const userQuota = (0, vue.ref)(-1);
|
|
35
|
-
const loginHooks = (0, vue.ref)([]);
|
|
36
|
-
const logoutHooks = (0, vue.ref)([]);
|
|
37
|
-
const warnModalOpenerMissing = (action) => {
|
|
38
|
-
if ({}.env.DEV) console.warn(`[users.store] ${action} called before modal openers were registered; ignoring. Call registerModalOpeners() at app bootstrap.`);
|
|
39
|
-
};
|
|
40
|
-
const modalOpeners = (0, vue.ref)({
|
|
41
|
-
openModal: (name) => warnModalOpenerMissing(`openModal(${String(name)})`),
|
|
42
|
-
openModalWithData: (payload) => warnModalOpenerMissing(`openModalWithData(${String(payload.name)})`)
|
|
43
|
-
});
|
|
44
|
-
const registerModalOpeners = (openers) => {
|
|
45
|
-
modalOpeners.value = openers;
|
|
46
|
-
};
|
|
47
|
-
const canListUsers = (0, vue.ref)(() => false);
|
|
48
|
-
const setPermissionsResolvers = (resolvers) => {
|
|
49
|
-
canListUsers.value = resolvers.listUsers;
|
|
50
|
-
};
|
|
51
|
-
const rootStore = require_useRootStore.useRootStore();
|
|
52
|
-
const settingsStore = require_settings_store.useSettingsStore();
|
|
53
|
-
const allUsers = (0, vue.computed)(() => Object.values(usersById.value));
|
|
54
|
-
const currentUser = (0, vue.computed)(() => currentUserId.value ? usersById.value[currentUserId.value] : null);
|
|
55
|
-
const userActivated = (0, vue.computed)(() => Boolean(currentUser.value?.settings?.userActivated));
|
|
56
|
-
const isDefaultUser = (0, vue.computed)(() => _isDefaultUser(currentUser.value));
|
|
57
|
-
const isInstanceOwner = (0, vue.computed)(() => _isInstanceOwner(currentUser.value));
|
|
58
|
-
const isAdmin = (0, vue.computed)(() => _isAdmin(currentUser.value));
|
|
59
|
-
const isAdminOrOwner = (0, vue.computed)(() => isInstanceOwner.value || isAdmin.value);
|
|
60
|
-
const mfaEnabled = (0, vue.computed)(() => currentUser.value?.mfaEnabled ?? false);
|
|
61
|
-
const globalRoleName = (0, vue.computed)(() => currentUser.value?.role ?? "default");
|
|
62
|
-
const userClaimedAiCredits = (0, vue.computed)(() => currentUser.value?.settings?.userClaimedAiCredits);
|
|
63
|
-
const isEasyAIWorkflowOnboardingDone = (0, vue.computed)(() => Boolean(currentUser.value?.settings?.easyAIWorkflowOnboarded));
|
|
64
|
-
const canUserUpdateVersion = (0, vue.computed)(() => {
|
|
65
|
-
return isInstanceOwner.value;
|
|
66
|
-
});
|
|
67
|
-
const setEasyAIWorkflowOnboardingDone = () => {
|
|
68
|
-
if (currentUser.value?.settings) currentUser.value.settings.easyAIWorkflowOnboarded = true;
|
|
69
|
-
};
|
|
70
|
-
const isCalloutDismissed = (callout) => Boolean(currentUser.value?.settings?.dismissedCallouts?.[callout]);
|
|
71
|
-
const setCalloutDismissed = (callout) => {
|
|
72
|
-
if (currentUser.value?.settings) {
|
|
73
|
-
currentUser.value.settings.dismissedCallouts ??= {};
|
|
74
|
-
currentUser.value.settings.dismissedCallouts[callout] = true;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const usersLimitNotReached = (0, vue.computed)(() => userQuota.value === -1 || userQuota.value > allUsers.value.length);
|
|
78
|
-
const addUsers = (newUsers) => {
|
|
79
|
-
newUsers.forEach((userResponse) => {
|
|
80
|
-
const updatedUser = {
|
|
81
|
-
...usersById.value[userResponse.id] || {},
|
|
82
|
-
...userResponse
|
|
83
|
-
};
|
|
84
|
-
const user = {
|
|
85
|
-
...updatedUser,
|
|
86
|
-
fullName: userResponse.firstName ? `${updatedUser.firstName} ${updatedUser.lastName ?? ""}` : void 0,
|
|
87
|
-
isDefaultUser: _isDefaultUser(updatedUser),
|
|
88
|
-
isPendingUser: _isPendingUser(updatedUser)
|
|
89
|
-
};
|
|
90
|
-
usersById.value = {
|
|
91
|
-
...usersById.value,
|
|
92
|
-
[user.id]: user
|
|
93
|
-
};
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
const setCurrentUser = async (user) => {
|
|
97
|
-
addUsers([user]);
|
|
98
|
-
currentUserId.value = user.id;
|
|
99
|
-
for (const hook of loginHooks.value) try {
|
|
100
|
-
await hook(user);
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error("Error executing login hook:", error);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
const loginWithCookie = async () => {
|
|
106
|
-
const user = await __n8n_rest_api_client_api_users.loginCurrentUser(rootStore.restApiContext);
|
|
107
|
-
if (!user) return;
|
|
108
|
-
await setCurrentUser(user);
|
|
109
|
-
};
|
|
110
|
-
const initialize = async () => {
|
|
111
|
-
if (initialized.value) return;
|
|
112
|
-
try {
|
|
113
|
-
await loginWithCookie();
|
|
114
|
-
initialized.value = true;
|
|
115
|
-
} catch {}
|
|
116
|
-
};
|
|
117
|
-
const unsetCurrentUser = () => {
|
|
118
|
-
currentUserId.value = null;
|
|
119
|
-
};
|
|
120
|
-
const deleteUserById = (userId) => {
|
|
121
|
-
const { [userId]: _, ...rest } = usersById.value;
|
|
122
|
-
usersById.value = rest;
|
|
123
|
-
};
|
|
124
|
-
const setPersonalizationAnswers = (answers) => {
|
|
125
|
-
if (!currentUser.value) return;
|
|
126
|
-
usersById.value = {
|
|
127
|
-
...usersById.value,
|
|
128
|
-
[currentUser.value.id]: {
|
|
129
|
-
...currentUser.value,
|
|
130
|
-
personalizationAnswers: answers
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
const loginWithCreds = async (params) => {
|
|
135
|
-
const user = await __n8n_rest_api_client_api_users.login(rootStore.restApiContext, params);
|
|
136
|
-
if (!user) return;
|
|
137
|
-
await setCurrentUser(user);
|
|
138
|
-
};
|
|
139
|
-
const registerLoginHook = (hook) => {
|
|
140
|
-
loginHooks.value.push(hook);
|
|
141
|
-
};
|
|
142
|
-
const registerLogoutHook = (hook) => {
|
|
143
|
-
logoutHooks.value.push(hook);
|
|
144
|
-
};
|
|
145
|
-
const logout = async () => {
|
|
146
|
-
await __n8n_rest_api_client_api_users.logout(rootStore.restApiContext);
|
|
147
|
-
unsetCurrentUser();
|
|
148
|
-
for (const hook of logoutHooks.value) try {
|
|
149
|
-
await hook();
|
|
150
|
-
} catch (error) {
|
|
151
|
-
console.error("Error executing logout hook:", error);
|
|
152
|
-
}
|
|
153
|
-
localStorage.removeItem(__n8n_constants.BROWSER_ID_STORAGE_KEY);
|
|
154
|
-
};
|
|
155
|
-
const createOwner = async (params) => {
|
|
156
|
-
const user = await __n8n_rest_api_client_api_users.setupOwner(rootStore.restApiContext, params);
|
|
157
|
-
if (user) {
|
|
158
|
-
await setCurrentUser(user);
|
|
159
|
-
settingsStore.stopShowingSetupPage();
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
const validateSignupToken = async (params) => {
|
|
163
|
-
return await __n8n_rest_api_client_api_users.validateSignupToken(rootStore.restApiContext, params);
|
|
164
|
-
};
|
|
165
|
-
const acceptInvitation$1 = async (params) => {
|
|
166
|
-
const user = await require_invitation_api.acceptInvitation(rootStore.restApiContext, params);
|
|
167
|
-
if (user) await setCurrentUser(user);
|
|
168
|
-
};
|
|
169
|
-
const sendForgotPasswordEmail = async (params) => {
|
|
170
|
-
await __n8n_rest_api_client_api_users.sendForgotPasswordEmail(rootStore.restApiContext, params);
|
|
171
|
-
};
|
|
172
|
-
const validatePasswordToken = async (params) => {
|
|
173
|
-
await __n8n_rest_api_client_api_users.validatePasswordToken(rootStore.restApiContext, params);
|
|
174
|
-
};
|
|
175
|
-
const changePassword = async (params) => {
|
|
176
|
-
await __n8n_rest_api_client_api_users.changePassword(rootStore.restApiContext, params);
|
|
177
|
-
};
|
|
178
|
-
const updateUser = async (params) => {
|
|
179
|
-
const user = await __n8n_rest_api_client_api_users.updateCurrentUser(rootStore.restApiContext, params);
|
|
180
|
-
addUsers([user]);
|
|
181
|
-
return user;
|
|
182
|
-
};
|
|
183
|
-
const updateUserName = async (params) => {
|
|
184
|
-
if (!currentUser.value) return;
|
|
185
|
-
return await updateUser({
|
|
186
|
-
email: currentUser.value.email,
|
|
187
|
-
...params
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
const updateUserSettings = async (settings) => {
|
|
191
|
-
const updatedSettings = await __n8n_rest_api_client_api_users.updateCurrentUserSettings(rootStore.restApiContext, settings);
|
|
192
|
-
if (currentUser.value) {
|
|
193
|
-
currentUser.value.settings = updatedSettings;
|
|
194
|
-
addUsers([currentUser.value]);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const updateOtherUserSettings = async (userId, settings) => {
|
|
198
|
-
await __n8n_rest_api_client_api_users.updateOtherUserSettings(rootStore.restApiContext, userId, settings);
|
|
199
|
-
};
|
|
200
|
-
const updateCurrentUserPassword = async (params) => {
|
|
201
|
-
await __n8n_rest_api_client_api_users.updateCurrentUserPassword(rootStore.restApiContext, params);
|
|
202
|
-
};
|
|
203
|
-
const deleteUser = async (params) => {
|
|
204
|
-
await __n8n_rest_api_client_api_users.deleteUser(rootStore.restApiContext, params);
|
|
205
|
-
deleteUserById(params.id);
|
|
206
|
-
};
|
|
207
|
-
const fetchUsers = async ({ take, skip, filter } = {}) => {
|
|
208
|
-
if (!canListUsers.value()) return;
|
|
209
|
-
const { items } = await __n8n_rest_api_client_api_users.getUsers(rootStore.restApiContext, {
|
|
210
|
-
take: take ?? 50,
|
|
211
|
-
skip: skip ?? 0,
|
|
212
|
-
filter
|
|
213
|
-
});
|
|
214
|
-
addUsers(items);
|
|
215
|
-
};
|
|
216
|
-
const inviteUsers$1 = async (params) => {
|
|
217
|
-
const invitedUsers = await require_invitation_api.inviteUsers(rootStore.restApiContext, params);
|
|
218
|
-
addUsers(invitedUsers.map(({ user }) => ({
|
|
219
|
-
isPending: true,
|
|
220
|
-
...user
|
|
221
|
-
})));
|
|
222
|
-
return invitedUsers;
|
|
223
|
-
};
|
|
224
|
-
const reinviteUser = async ({ email, role }) => {
|
|
225
|
-
const invitationResponse = await require_invitation_api.inviteUsers(rootStore.restApiContext, [{
|
|
226
|
-
email,
|
|
227
|
-
role
|
|
228
|
-
}]);
|
|
229
|
-
if (!invitationResponse[0].user.emailSent) throw Error(invitationResponse[0].error);
|
|
230
|
-
};
|
|
231
|
-
const getUserPasswordResetLink = async (params) => {
|
|
232
|
-
return await __n8n_rest_api_client_api_users.getPasswordResetLink(rootStore.restApiContext, params);
|
|
233
|
-
};
|
|
234
|
-
const generateInviteLink = async (params) => {
|
|
235
|
-
return await __n8n_rest_api_client_api_users.generateInviteLink(rootStore.restApiContext, params);
|
|
236
|
-
};
|
|
237
|
-
const submitPersonalizationSurvey = async (results) => {
|
|
238
|
-
await __n8n_rest_api_client_api_users.submitPersonalizationSurvey(rootStore.restApiContext, results);
|
|
239
|
-
setPersonalizationAnswers(results);
|
|
240
|
-
};
|
|
241
|
-
const showPersonalizationSurvey = () => {
|
|
242
|
-
if (settingsStore.isPersonalizationSurveyEnabled && currentUser.value && !currentUser.value.personalizationAnswers) modalOpeners.value.openModal(PERSONALIZATION_MODAL_KEY);
|
|
243
|
-
};
|
|
244
|
-
const fetchMfaQR = async () => {
|
|
245
|
-
return await __n8n_rest_api_client_api_mfa.getMfaQR(rootStore.restApiContext);
|
|
246
|
-
};
|
|
247
|
-
const verifyMfaCode = async (data) => {
|
|
248
|
-
return await __n8n_rest_api_client_api_mfa.verifyMfaCode(rootStore.restApiContext, data);
|
|
249
|
-
};
|
|
250
|
-
const canEnableMFA = async () => {
|
|
251
|
-
return await __n8n_rest_api_client_api_mfa.canEnableMFA(rootStore.restApiContext);
|
|
252
|
-
};
|
|
253
|
-
const enableMfa = async (data) => {
|
|
254
|
-
await __n8n_rest_api_client_api_mfa.enableMfa(rootStore.restApiContext, data);
|
|
255
|
-
if (currentUser.value) currentUser.value.mfaEnabled = true;
|
|
256
|
-
};
|
|
257
|
-
const disableMfa = async (data) => {
|
|
258
|
-
await __n8n_rest_api_client_api_mfa.disableMfa(rootStore.restApiContext, data);
|
|
259
|
-
if (currentUser.value) currentUser.value.mfaEnabled = false;
|
|
260
|
-
};
|
|
261
|
-
const updateEnforceMfa = async (enforce) => {
|
|
262
|
-
await __n8n_rest_api_client_api_mfa.updateEnforceMfa(rootStore.restApiContext, enforce);
|
|
263
|
-
settingsStore.isMFAEnforced = enforce;
|
|
264
|
-
};
|
|
265
|
-
const sendConfirmationEmail = async () => {
|
|
266
|
-
await __n8n_rest_api_client_api_cloudPlans.sendConfirmationEmail(rootStore.restApiContext);
|
|
267
|
-
};
|
|
268
|
-
const updateGlobalRole = async ({ id, newRoleName }) => {
|
|
269
|
-
await __n8n_rest_api_client_api_users.updateGlobalRole(rootStore.restApiContext, {
|
|
270
|
-
id,
|
|
271
|
-
newRoleName
|
|
272
|
-
});
|
|
273
|
-
await fetchUsers({ filter: { ids: [id] } });
|
|
274
|
-
};
|
|
275
|
-
const submitContactEmail = async (email, agree) => {
|
|
276
|
-
if (currentUser.value) return await require_onboarding_api.submitEmailOnSignup(rootStore.instanceId, currentUser.value, email ?? currentUser.value.email, agree);
|
|
277
|
-
return null;
|
|
278
|
-
};
|
|
279
|
-
const usersList = (0, __vueuse_core.useAsyncState)(async (filter) => await __n8n_rest_api_client_api_users.getUsers(rootStore.restApiContext, filter), {
|
|
280
|
-
count: 0,
|
|
281
|
-
items: []
|
|
282
|
-
}, {
|
|
283
|
-
immediate: false,
|
|
284
|
-
resetOnExecute: false
|
|
285
|
-
});
|
|
286
|
-
const setUserQuota = (quota) => {
|
|
287
|
-
if (typeof quota !== "undefined") userQuota.value = quota;
|
|
288
|
-
};
|
|
289
|
-
return {
|
|
290
|
-
initialized,
|
|
291
|
-
currentUserId,
|
|
292
|
-
usersById,
|
|
293
|
-
allUsers,
|
|
294
|
-
currentUser,
|
|
295
|
-
userActivated,
|
|
296
|
-
isDefaultUser,
|
|
297
|
-
isInstanceOwner,
|
|
298
|
-
isAdmin,
|
|
299
|
-
isAdminOrOwner,
|
|
300
|
-
mfaEnabled,
|
|
301
|
-
globalRoleName,
|
|
302
|
-
userClaimedAiCredits,
|
|
303
|
-
isEasyAIWorkflowOnboardingDone,
|
|
304
|
-
canUserUpdateVersion,
|
|
305
|
-
usersLimitNotReached,
|
|
306
|
-
addUsers,
|
|
307
|
-
loginWithCookie,
|
|
308
|
-
initialize,
|
|
309
|
-
setPersonalizationAnswers,
|
|
310
|
-
loginWithCreds,
|
|
311
|
-
logout,
|
|
312
|
-
registerLoginHook,
|
|
313
|
-
registerLogoutHook,
|
|
314
|
-
registerModalOpeners,
|
|
315
|
-
setPermissionsResolvers,
|
|
316
|
-
createOwner,
|
|
317
|
-
validateSignupToken,
|
|
318
|
-
acceptInvitation: acceptInvitation$1,
|
|
319
|
-
sendForgotPasswordEmail,
|
|
320
|
-
validatePasswordToken,
|
|
321
|
-
changePassword,
|
|
322
|
-
updateUser,
|
|
323
|
-
updateUserName,
|
|
324
|
-
updateUserSettings,
|
|
325
|
-
updateOtherUserSettings,
|
|
326
|
-
updateCurrentUserPassword,
|
|
327
|
-
deleteUser,
|
|
328
|
-
fetchUsers,
|
|
329
|
-
inviteUsers: inviteUsers$1,
|
|
330
|
-
reinviteUser,
|
|
331
|
-
getUserPasswordResetLink,
|
|
332
|
-
generateInviteLink,
|
|
333
|
-
submitPersonalizationSurvey,
|
|
334
|
-
showPersonalizationSurvey,
|
|
335
|
-
fetchMfaQR,
|
|
336
|
-
verifyMfaCode,
|
|
337
|
-
enableMfa,
|
|
338
|
-
disableMfa,
|
|
339
|
-
updateEnforceMfa,
|
|
340
|
-
canEnableMFA,
|
|
341
|
-
sendConfirmationEmail,
|
|
342
|
-
updateGlobalRole,
|
|
343
|
-
setEasyAIWorkflowOnboardingDone,
|
|
344
|
-
isCalloutDismissed,
|
|
345
|
-
setCalloutDismissed,
|
|
346
|
-
submitContactEmail,
|
|
347
|
-
setUserQuota,
|
|
348
|
-
usersList
|
|
349
|
-
};
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
//#endregion
|
|
353
|
-
exports.useUsersStore = useUsersStore;
|
|
354
|
-
//# sourceMappingURL=users.store.cjs.map
|
|
9
|
+
exports.useUsersStore = require_users_store.useUsersStore;
|