fix(wizard): unique names on createStep/View/Version to avoid (tenant_id,name,kind) collisions
This commit is contained in:
@@ -122,7 +122,8 @@ export const wizardApi = {
|
||||
|
||||
ops: {
|
||||
createStep(node: { display_name: string; dispatch_kind: string; agent_capability?: string; description?: string }): CreateOp {
|
||||
const name = node.display_name.toLowerCase().replace(/[^a-z0-9]+/g, "_").slice(0, 40) || "step";
|
||||
const slug = node.display_name.toLowerCase().replace(/[^a-z0-9]+/g, "_").slice(0, 30) || "step";
|
||||
const name = `${slug}_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
||||
return {
|
||||
op: "create",
|
||||
coll: "flow",
|
||||
@@ -139,7 +140,8 @@ export const wizardApi = {
|
||||
};
|
||||
},
|
||||
createView(node: { display_name: string }): CreateOp {
|
||||
const name = `${node.display_name.toLowerCase().replace(/[^a-z0-9]+/g, "_").slice(0, 40) || "view"}_view`;
|
||||
const slug = node.display_name.toLowerCase().replace(/[^a-z0-9]+/g, "_").slice(0, 30) || "view";
|
||||
const name = `${slug}_view_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
||||
return {
|
||||
op: "create",
|
||||
coll: "view",
|
||||
@@ -162,7 +164,8 @@ export const wizardApi = {
|
||||
};
|
||||
},
|
||||
createVersion(parentDisplayName: string): CreateOp {
|
||||
const name = `${parentDisplayName.toLowerCase().replace(/[^a-z0-9]+/g, "_").slice(0, 40) || "process"}_v1`;
|
||||
const slug = parentDisplayName.toLowerCase().replace(/[^a-z0-9]+/g, "_").slice(0, 30) || "process";
|
||||
const name = `${slug}_v1_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
||||
return {
|
||||
op: "create",
|
||||
coll: "version",
|
||||
|
||||
Reference in New Issue
Block a user