mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(n8n Form Trigger Node): Improvements (#7571)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in> Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
@@ -1674,6 +1674,8 @@ export interface IWebhookDescription {
|
||||
responseMode?: WebhookResponseMode | string;
|
||||
responseData?: WebhookResponseData | string;
|
||||
restartWebhook?: boolean;
|
||||
isForm?: boolean;
|
||||
hasLifecycleMethods?: boolean; // set automatically by generate-ui-types
|
||||
ndvHideUrl?: boolean; // If true the webhook will not be displayed in the editor
|
||||
ndvHideMethod?: boolean; // If true the method will not be displayed in the editor
|
||||
}
|
||||
@@ -1920,6 +1922,7 @@ export interface IWorkflowExecuteAdditionalData {
|
||||
instanceBaseUrl: string;
|
||||
setExecutionStatus?: (status: ExecutionStatus) => void;
|
||||
sendDataToUI?: (type: string, data: IDataObject | IDataObject[]) => void;
|
||||
formWaitingBaseUrl: string;
|
||||
webhookBaseUrl: string;
|
||||
webhookWaitingBaseUrl: string;
|
||||
webhookTestBaseUrl: string;
|
||||
@@ -2209,7 +2212,8 @@ export type FieldType =
|
||||
| 'time'
|
||||
| 'array'
|
||||
| 'object'
|
||||
| 'options';
|
||||
| 'options'
|
||||
| 'url';
|
||||
|
||||
export type ValidationResult = {
|
||||
valid: boolean;
|
||||
@@ -2305,6 +2309,9 @@ export interface IPublicApiSettings {
|
||||
export type ExpressionEvaluatorType = 'tmpl' | 'tournament';
|
||||
|
||||
export interface IN8nUISettings {
|
||||
endpointForm: string;
|
||||
endpointFormTest: string;
|
||||
endpointFormWaiting: string;
|
||||
endpointWebhook: string;
|
||||
endpointWebhookTest: string;
|
||||
saveDataErrorExecution: WorkflowSettings.SaveDataExecution;
|
||||
|
||||
@@ -122,6 +122,19 @@ export const tryToParseObject = (value: unknown): object => {
|
||||
}
|
||||
};
|
||||
|
||||
export const tryToParseUrl = (value: unknown): string => {
|
||||
if (typeof value === 'string' && !value.includes('://')) {
|
||||
value = `http://${value}`;
|
||||
}
|
||||
const urlPattern = /^(https?|ftp|file):\/\/\S+|www\.\S+/;
|
||||
if (!urlPattern.test(String(value))) {
|
||||
throw new ApplicationError(`The value "${String(value)}" is not a valid url.`, {
|
||||
extra: { value },
|
||||
});
|
||||
}
|
||||
return String(value);
|
||||
};
|
||||
|
||||
type ValidateFieldTypeOptions = Partial<{
|
||||
valueOptions: INodePropertyOptions[];
|
||||
strict: boolean;
|
||||
@@ -225,6 +238,13 @@ export const validateFieldType = (
|
||||
}
|
||||
return { valid: true, newValue: value };
|
||||
}
|
||||
case 'url': {
|
||||
try {
|
||||
return { valid: true, newValue: tryToParseUrl(value) };
|
||||
} catch (e) {
|
||||
return { valid: false, errorMessage: defaultErrorMessage };
|
||||
}
|
||||
}
|
||||
default: {
|
||||
return { valid: true, newValue: value };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user