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:
@@ -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([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user