refactor(core): Rename push sessionId to pushRef (#8905)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-04-03 13:43:14 +02:00
committed by GitHub
parent eaaefd76da
commit 072c3db97d
58 changed files with 248 additions and 257 deletions

View File

@@ -105,7 +105,7 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
};
const getInstanceCurrentUsage = async () => {
const usage = await getCurrentUsage({ baseUrl: rootStore.getBaseUrl, sessionId: '' });
const usage = await getCurrentUsage({ baseUrl: rootStore.getBaseUrl, pushRef: '' });
state.usage = usage;
return usage;
};

View File

@@ -25,7 +25,7 @@ export const useRootStore = defineStore(STORES.ROOT, {
versionCli: '0.0.0',
oauthCallbackUrls: {},
n8nMetadata: {},
sessionId: Math.random().toString(36).substring(2, 15),
pushRef: Math.random().toString(36).substring(2, 15),
urlBaseWebhook: 'http://localhost:5678/',
urlBaseEditor: 'http://localhost:5678',
isNpmAvailable: false,
@@ -66,14 +66,14 @@ export const useRootStore = defineStore(STORES.ROOT, {
baseUrl: window.location.host.includes('stage-app.n8n.cloud')
? CLOUD_BASE_URL_STAGING
: CLOUD_BASE_URL_PRODUCTION,
sessionId: '',
pushRef: '',
};
},
getRestApiContext(): IRestApiContext {
return {
baseUrl: this.getRestUrl,
sessionId: this.sessionId,
pushRef: this.pushRef,
};
},
},

View File

@@ -22,7 +22,7 @@ export const useNDVStore = defineStore(STORES.NDV, {
state: (): NDVState => ({
activeNodeName: null,
mainPanelDimensions: {},
sessionId: '',
pushRef: '',
input: {
displayMode: 'schema',
nodeName: undefined,
@@ -184,11 +184,11 @@ export const useNDVStore = defineStore(STORES.NDV, {
},
};
},
setNDVSessionId(): void {
this.sessionId = `ndv-${uuid()}`;
setNDVPushRef(): void {
this.pushRef = `ndv-${uuid()}`;
},
resetNDVSessionId(): void {
this.sessionId = '';
resetNDVPushRef(): void {
this.pushRef = '';
},
setPanelDisplayMode(params: { pane: NodePanelType; mode: IRunDataDisplayMode }): void {
this[params.pane].displayMode = params.mode;

View File

@@ -6,7 +6,7 @@ import { useRootStore } from './n8nRoot.store';
import type { IPushData } from '../Interface';
export interface PushState {
sessionId: string;
pushRef: string;
pushSource: WebSocket | EventSource | null;
reconnectTimeout: NodeJS.Timeout | null;
retryTimeout: NodeJS.Timeout | null;
@@ -26,7 +26,7 @@ export const usePushConnectionStore = defineStore(STORES.PUSH, () => {
const rootStore = useRootStore();
const settingsStore = useSettingsStore();
const sessionId = computed(() => rootStore.sessionId);
const pushRef = computed(() => rootStore.pushRef);
const pushSource = ref<WebSocket | EventSource | null>(null);
const reconnectTimeout = ref<NodeJS.Timeout | null>(null);
const connectRetries = ref(0);
@@ -85,7 +85,7 @@ export const usePushConnectionStore = defineStore(STORES.PUSH, () => {
const useWebSockets = settingsStore.pushBackend === 'websocket';
const { getRestUrl: restUrl } = rootStore;
const url = `/push?sessionId=${sessionId.value}`;
const url = `/push?pushRef=${pushRef.value}`;
if (useWebSockets) {
const { protocol, host } = window.location;
@@ -151,7 +151,7 @@ export const usePushConnectionStore = defineStore(STORES.PUSH, () => {
}
return {
sessionId,
pushRef,
pushSource,
isConnectionOpen,
addEventListener,