1574 extensibility twenty cli use workspace migration v2 to synchronize serverless function triggers (#14830)

twenty-cli serverless triggers follow up. Fixes:
- eventName don't support wildcard
- universalIdentifier not used to create or update trigger : update does
not work properly (does deletion then creation)
- add a base project in twenty-cli that is copied when creating a new
app
This commit is contained in:
martmull
2025-10-02 14:06:56 +02:00
committed by GitHub
parent 326d2a99ed
commit 0368d2a094
24 changed files with 1143 additions and 407 deletions
@@ -2,7 +2,7 @@ import chalk from 'chalk';
import * as fs from 'fs-extra';
import inquirer from 'inquirer';
import path from 'path';
import { v4 } from 'uuid';
import { randomUUID } from 'crypto';
import { resolveAppPath } from '../utils/app-path-resolver';
import { parseJsoncFile, writeJsoncFile } from '../utils/jsonc-parser';
import { getSchemaUrls } from '../utils/schema-validator';
@@ -141,7 +141,7 @@ export class AppAddCommand {
) {
const schemas = getSchemaUrls();
const uuid = v4();
const uuid = randomUUID();
const entityToCreateData: Record<string, string> = {
$schema: schemas[entity],
@@ -255,7 +255,7 @@ export class AppAddCommand {
}
private async createDatabaseEventTrigger() {
const uuid = v4();
const uuid = randomUUID();
const { eventName } = await inquirer.prompt([
{
@@ -266,8 +266,8 @@ export class AppAddCommand {
if (input.length === 0) {
return 'Event name is required';
}
if (!/^[a-zA-Z]+\.(created|updated|deleted)$/.test(input)) {
return 'Event name must be in format: objectName.(created|updated|deleted)';
if (!/^(?:[a-zA-Z]+|\*)\.(created|updated|deleted|\*)$/.test(input)) {
return 'Event name must be in format: (objectName|*).(created|updated|deleted|*)';
}
return true;
},
@@ -282,7 +282,7 @@ export class AppAddCommand {
}
private async createCronTrigger() {
const uuid = v4();
const uuid = randomUUID();
const { schedule } = await inquirer.prompt([
{