refactor(editor): Add infix to Pinia stores (no-changelog) (#6149)
* ⚡ Add infix to Pinia stores * ⚡ Fix paths in mocks * 🐛 Fix import
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { afterAll, beforeAll } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { setupServer } from '@/__tests__/server';
|
||||
import { useCredentialsStore } from '@/stores/credentials';
|
||||
import { useCredentialsStore } from '@/stores/credentials.store';
|
||||
|
||||
describe('store', () => {
|
||||
let server: ReturnType<typeof setupServer>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterAll, beforeAll } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { setupServer } from '@/__tests__/server';
|
||||
import { useEnvironmentsStore } from '@/stores/environments.ee';
|
||||
import { useEnvironmentsStore } from '@/stores/environments.ee.store';
|
||||
import type { EnvironmentVariable } from '@/Interface';
|
||||
|
||||
describe('store', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { usePostHog } from '@/stores/posthog';
|
||||
import { useUsersStore } from '@/stores/users';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useTelemetryStore } from '@/stores/telemetry';
|
||||
import { usePostHog } from '@/stores/posthog.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useTelemetryStore } from '@/stores/telemetry.store';
|
||||
import type { IN8nUISettings } from 'n8n-workflow';
|
||||
|
||||
const DEFAULT_POSTHOG_SETTINGS: IN8nUISettings['posthog'] = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useSSOStore } from '@/stores/sso';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useSSOStore } from '@/stores/sso.store';
|
||||
import { merge } from 'lodash-es';
|
||||
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
|
||||
import type { IN8nUISettings } from 'n8n-workflow';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { merge } from 'lodash-es';
|
||||
import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
import { useUsageStore } from '@/stores/usage';
|
||||
import { useUsageStore } from '@/stores/usage.store';
|
||||
|
||||
describe('Usage and plan store', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -2,10 +2,10 @@ import { computed, ref } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import normalizeWheel from 'normalize-wheel';
|
||||
import { useWorkflowsStore } from '@/stores/workflows';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
import { useHistoryStore } from '@/stores/history';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useHistoryStore } from '@/stores/history.store';
|
||||
import type { INodeUi, XYPosition } from '@/Interface';
|
||||
import { scaleBigger, scaleReset, scaleSmaller } from '@/utils';
|
||||
import { START_NODE_TYPE } from '@/constants';
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from '@/api/communityNodes';
|
||||
import { getAvailableCommunityPackageCount } from '@/api/settings';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import type { PublicInstalledPackage } from 'n8n-workflow';
|
||||
import Vue from 'vue';
|
||||
import type { CommunityNodesState, CommunityPackageMap } from '@/Interface';
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { INodeUi, IUsedCredential } from './../Interface';
|
||||
import type { INodeUi, IUsedCredential } from '../Interface';
|
||||
import {
|
||||
createNewCredential,
|
||||
deleteCredential,
|
||||
@@ -32,10 +32,10 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useNodeTypesStore } from './nodeTypes';
|
||||
import { useSettingsStore } from './settings';
|
||||
import { useUsersStore } from './users';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { useNodeTypesStore } from './nodeTypes.store';
|
||||
import { useSettingsStore } from './settings.store';
|
||||
import { useUsersStore } from './users.store';
|
||||
|
||||
const DEFAULT_CREDENTIAL_NAME = 'Unnamed credential';
|
||||
const DEFAULT_CREDENTIAL_POSTFIX = 'account';
|
||||
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import type { EnvironmentVariable } from '@/Interface';
|
||||
import * as environmentsApi from '@/api/environments.ee';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
|
||||
export const useEnvironmentsStore = defineStore('environments', () => {
|
||||
const rootStore = useRootStore();
|
||||
@@ -1,23 +1,23 @@
|
||||
export * from './canvas';
|
||||
export * from './communityNodes';
|
||||
export * from './credentials';
|
||||
export * from './environments.ee';
|
||||
export * from './history';
|
||||
export * from './logStreamingStore';
|
||||
export * from './n8nRootStore';
|
||||
export * from './ndv';
|
||||
export * from './nodeCreator';
|
||||
export * from './nodeTypes';
|
||||
export * from './posthog';
|
||||
export * from './segment';
|
||||
export * from './settings';
|
||||
export * from './tags';
|
||||
export * from './telemetry';
|
||||
export * from './templates';
|
||||
export * from './ui';
|
||||
export * from './usage';
|
||||
export * from './users';
|
||||
export * from './versions';
|
||||
export * from './webhooks';
|
||||
export * from './workflows.ee';
|
||||
export * from './workflows';
|
||||
export * from './canvas.store';
|
||||
export * from './communityNodes.store';
|
||||
export * from './credentials.store';
|
||||
export * from './environments.ee.store';
|
||||
export * from './history.store';
|
||||
export * from './logStreaming.store';
|
||||
export * from './n8nRoot.store';
|
||||
export * from './ndv.store';
|
||||
export * from './nodeCreator.store';
|
||||
export * from './nodeTypes.store';
|
||||
export * from './posthog.store';
|
||||
export * from './segment.store';
|
||||
export * from './settings.store';
|
||||
export * from './tags.store';
|
||||
export * from './telemetry.store';
|
||||
export * from './templates.store';
|
||||
export * from './ui.store';
|
||||
export * from './usage.store';
|
||||
export * from './users.store';
|
||||
export * from './versions.store';
|
||||
export * from './webhooks.store';
|
||||
export * from './workflows.ee.store';
|
||||
export * from './workflows.store';
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
saveDestinationToDb,
|
||||
sendTestMessageToDestination,
|
||||
} from '../api/eventbus.ee';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
|
||||
export interface EventSelectionItem {
|
||||
selected: boolean;
|
||||
@@ -3,7 +3,7 @@ import type { IRestApiContext, RootState } from '@/Interface';
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useNodeTypesStore } from './nodeTypes';
|
||||
import { useNodeTypesStore } from './nodeTypes.store';
|
||||
|
||||
const { VUE_APP_URL_BASE_API } = import.meta.env;
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
import type { IRunData } from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useWorkflowsStore } from './workflows';
|
||||
import { useWorkflowsStore } from './workflows.store';
|
||||
|
||||
export const useNDVStore = defineStore(STORES.NDV, {
|
||||
state: (): NDVState => ({
|
||||
@@ -20,8 +20,8 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useCredentialsStore } from './credentials';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useCredentialsStore } from './credentials.store';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
|
||||
function getNodeVersions(nodeType: INodeTypeDescription) {
|
||||
return Array.isArray(nodeType.version) ? nodeType.version : [nodeType.version];
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { Ref } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useUsersStore } from '@/stores/users';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import type { FeatureFlags } from 'n8n-workflow';
|
||||
import {
|
||||
EXPERIMENTS_TO_TRACK,
|
||||
LOCAL_STORAGE_EXPERIMENT_OVERRIDES,
|
||||
TEMPLATE_EXPERIMENT,
|
||||
} from '@/constants';
|
||||
import { useTelemetryStore } from './telemetry';
|
||||
import { useTelemetryStore } from './telemetry.store';
|
||||
import { debounce } from 'lodash-es';
|
||||
|
||||
const EVENTS = {
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
WEBHOOK_NODE_TYPE,
|
||||
} from '@/constants';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import type { INodeTypeDescription, IRun, ITelemetryTrackProperties } from 'n8n-workflow';
|
||||
import { useWorkflowsStore } from '@/stores/workflows';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
|
||||
const EVENTS = {
|
||||
ADDED_MANUAL_TRIGGER: 'User added manual trigger',
|
||||
@@ -27,10 +27,10 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useUIStore } from './ui';
|
||||
import { useUsersStore } from './users';
|
||||
import { useVersionsStore } from './versions';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { useUIStore } from './ui.store';
|
||||
import { useUsersStore } from './users.store';
|
||||
import { useVersionsStore } from './versions.store';
|
||||
import { makeRestApiRequest } from '@/utils';
|
||||
|
||||
export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
||||
@@ -1,12 +1,12 @@
|
||||
import { computed, reactive } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { EnterpriseEditionFeature } from '@/constants';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import * as ssoApi from '@/api/sso';
|
||||
import type { SamlPreferences } from '@/Interface';
|
||||
import { updateCurrentUser } from '@/api/users';
|
||||
import { useUsersStore } from '@/stores/users';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
|
||||
export const useSSOStore = defineStore('sso', () => {
|
||||
const rootStore = useRootStore();
|
||||
@@ -3,8 +3,8 @@ import { STORES } from '@/constants';
|
||||
import type { ITag, ITagsState } from '@/Interface';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useWorkflowsStore } from './workflows';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { useWorkflowsStore } from './workflows.store';
|
||||
|
||||
export const useTagsStore = defineStore(STORES.TAGS, {
|
||||
state: (): ITagsState => ({
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
IWorkflowTemplate,
|
||||
} from '@/Interface';
|
||||
import Vue from 'vue';
|
||||
import { useSettingsStore } from './settings';
|
||||
import { useSettingsStore } from './settings.store';
|
||||
import {
|
||||
getCategories,
|
||||
getCollectionById,
|
||||
@@ -44,11 +44,11 @@ import type {
|
||||
} from '@/Interface';
|
||||
import Vue from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { getCurlToJson } from '@/api/curlHelper';
|
||||
import { useWorkflowsStore } from './workflows';
|
||||
import { useSettingsStore } from './settings';
|
||||
import { useUsageStore } from './usage';
|
||||
import { useWorkflowsStore } from './workflows.store';
|
||||
import { useSettingsStore } from './settings.store';
|
||||
import { useUsageStore } from './usage.store';
|
||||
import type { BaseTextKey } from '@/plugins/i18n';
|
||||
import { i18n as locale } from '@/plugins/i18n';
|
||||
|
||||
@@ -2,9 +2,9 @@ import { computed, reactive } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import type { UsageState } from '@/Interface';
|
||||
import { activateLicenseKey, getLicense, renewLicense } from '@/api/usage';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useUsersStore } from '@/stores/users';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
|
||||
export type UsageTelemetry = {
|
||||
instance_id: string;
|
||||
@@ -34,10 +34,10 @@ import { getCredentialPermissions } from '@/permissions';
|
||||
import { getPersonalizedNodeTypes, isAuthorized, PERMISSIONS, ROLE } from '@/utils';
|
||||
import { defineStore } from 'pinia';
|
||||
import Vue from 'vue';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { usePostHog } from './posthog';
|
||||
import { useSettingsStore } from './settings';
|
||||
import { useUIStore } from './ui';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { usePostHog } from './posthog.store';
|
||||
import { useSettingsStore } from './settings.store';
|
||||
import { useUIStore } from './ui.store';
|
||||
|
||||
const isDefaultUser = (user: IUserResponse | null) =>
|
||||
Boolean(user && user.isPending && user.globalRole && user.globalRole.name === ROLE.Owner);
|
||||
@@ -2,9 +2,9 @@ import { computed, reactive } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
import { EnterpriseEditionFeature } from '@/constants';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import * as vcApi from '@/api/versionControl';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import type { VersionControlPreferences } from '@/Interface';
|
||||
|
||||
export const useVersionControlStore = defineStore('versionControl', () => {
|
||||
@@ -2,7 +2,7 @@ import { getNextVersions } from '@/api/versions';
|
||||
import { STORES } from '@/constants';
|
||||
import type { IVersion, IVersionNotificationSettings, IVersionsState } from '@/Interface';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
|
||||
export const useVersionsStore = defineStore(STORES.VERSIONS, {
|
||||
state: (): IVersionsState => ({
|
||||
@@ -3,12 +3,12 @@ import type { IFakeDoor, INodeUi, IRootState, NestedRecord } from '@/Interface';
|
||||
import type { IMenuItem } from 'n8n-design-system';
|
||||
import type { IWorkflowSettings } from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useNDVStore } from './ndv';
|
||||
import { useSettingsStore } from './settings';
|
||||
import { useUIStore } from './ui';
|
||||
import { useUsersStore } from './users';
|
||||
import { useWorkflowsStore } from './workflows';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { useNDVStore } from './ndv.store';
|
||||
import { useSettingsStore } from './settings.store';
|
||||
import { useUIStore } from './ui.store';
|
||||
import { useUsersStore } from './users.store';
|
||||
import { useWorkflowsStore } from './workflows.store';
|
||||
|
||||
export const useWebhooksStore = defineStore(STORES.WEBHOOKS, {
|
||||
getters: {
|
||||
@@ -2,10 +2,10 @@ import Vue from 'vue';
|
||||
import type { IUser } from '../Interface';
|
||||
import { setWorkflowSharedWith } from '@/api/workflows.ee';
|
||||
import { EnterpriseEditionFeature, STORES } from '@/constants';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useWorkflowsStore } from '@/stores/workflows';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { i18n } from '@/plugins/i18n';
|
||||
|
||||
export const useWorkflowsEEStore = defineStore(STORES.WORKFLOWS_EE, {
|
||||
@@ -57,7 +57,7 @@ import type {
|
||||
import { deepCopy, NodeHelpers, Workflow } from 'n8n-workflow';
|
||||
import Vue from 'vue';
|
||||
|
||||
import { useRootStore } from './n8nRootStore';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import {
|
||||
getActiveWorkflows,
|
||||
getCurrentExecutions,
|
||||
@@ -67,7 +67,7 @@ import {
|
||||
getWorkflow,
|
||||
getWorkflows,
|
||||
} from '@/api/workflows';
|
||||
import { useUIStore } from './ui';
|
||||
import { useUIStore } from './ui.store';
|
||||
import { dataPinningEventBus } from '@/event-bus';
|
||||
import {
|
||||
isJsonKeyObject,
|
||||
@@ -78,11 +78,11 @@ import {
|
||||
makeRestApiRequest,
|
||||
unflattenExecutionData,
|
||||
} from '@/utils';
|
||||
import { useNDVStore } from './ndv';
|
||||
import { useNodeTypesStore } from './nodeTypes';
|
||||
import { useWorkflowsEEStore } from '@/stores/workflows.ee';
|
||||
import { useUsersStore } from '@/stores/users';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { useNDVStore } from './ndv.store';
|
||||
import { useNodeTypesStore } from './nodeTypes.store';
|
||||
import { useWorkflowsEEStore } from '@/stores/workflows.ee.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
|
||||
const createEmptyWorkflow = (): IWorkflowDb => ({
|
||||
id: PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
||||
Reference in New Issue
Block a user