Add default relation to standard object on custom object in manifest (#18033)
add default relation fields when creating an object from an application --------- Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
+5
@@ -1,3 +1,8 @@
|
||||
export const DEFAULT_BUILT_HANDLER_PATH = 'src/index.mjs';
|
||||
export const DEFAULT_SOURCE_HANDLER_PATH = 'src/index.ts';
|
||||
export const DEFAULT_HANDLER_NAME = 'main';
|
||||
|
||||
// Matches a valid JS identifier or dotted member expression
|
||||
// e.g. "main", "handler", "default.config.handler", "exports.run"
|
||||
export const HANDLER_NAME_REGEX =
|
||||
/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/;
|
||||
|
||||
+4
-2
@@ -3,6 +3,8 @@ import { Field, InputType } from '@nestjs/graphql';
|
||||
import { IsObject, IsString, Matches } from 'class-validator';
|
||||
import graphqlTypeJson from 'graphql-type-json';
|
||||
|
||||
import { HANDLER_NAME_REGEX } from 'src/engine/metadata-modules/logic-function/constants/handler.contant';
|
||||
|
||||
@InputType()
|
||||
export class LogicFunctionSourceInput {
|
||||
@IsString()
|
||||
@@ -14,8 +16,8 @@ export class LogicFunctionSourceInput {
|
||||
toolInputSchema: object;
|
||||
|
||||
@IsString()
|
||||
@Matches(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/, {
|
||||
message: 'handlerName must be a valid JavaScript identifier',
|
||||
@Matches(HANDLER_NAME_REGEX, {
|
||||
message: 'handlerName must be a valid JavaScript identifier or dotted path',
|
||||
})
|
||||
@Field({ nullable: false })
|
||||
handlerName: string;
|
||||
|
||||
+3
-2
@@ -22,6 +22,7 @@ import {
|
||||
} from 'twenty-shared/application';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { HANDLER_NAME_REGEX } from 'src/engine/metadata-modules/logic-function/constants/handler.contant';
|
||||
import type { JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
|
||||
|
||||
@InputType()
|
||||
@@ -54,8 +55,8 @@ class UpdateLogicFunctionFromSourceInputUpdates {
|
||||
toolInputSchema?: object;
|
||||
|
||||
@IsString()
|
||||
@Matches(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/, {
|
||||
message: 'handlerName must be a valid JavaScript identifier',
|
||||
@Matches(HANDLER_NAME_REGEX, {
|
||||
message: 'handlerName must be a valid JavaScript identifier or dotted path',
|
||||
})
|
||||
@Field({ nullable: true })
|
||||
@IsOptional()
|
||||
|
||||
Reference in New Issue
Block a user