refactor(editor): Move editor-ui and design-system to frontend dir (no-changelog) (#13564)

This commit is contained in:
Alex Grozav
2025-02-28 14:28:30 +02:00
committed by GitHub
parent 684353436d
commit f5743176e5
1635 changed files with 805 additions and 1079 deletions

View File

@@ -0,0 +1,30 @@
import { request } from '@/utils/apiUtils';
import type { JSONSchema7 } from 'json-schema';
export type GetSchemaPreviewOptions = {
nodeType: string;
version: number;
resource?: string;
operation?: string;
};
const padVersion = (version: number) => {
return version.toString().split('.').concat(['0', '0']).slice(0, 3).join('.');
};
export const getSchemaPreview = async (
baseUrl: string,
options: GetSchemaPreviewOptions,
): Promise<JSONSchema7> => {
const { nodeType, version, resource, operation } = options;
const versionString = padVersion(version);
const path = ['schemas', nodeType.replace('@n8n/', ''), versionString, resource, operation]
.filter(Boolean)
.join('/');
return await request({
method: 'GET',
baseURL: baseUrl,
endpoint: `${path}.json`,
withCredentials: false,
});
};