@lead-routing/cli 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ function bail2(value) {
|
|
|
111
111
|
}
|
|
112
112
|
throw new Error("Unexpected cancel");
|
|
113
113
|
}
|
|
114
|
-
async function collectConfig(opts = {}, authEmail) {
|
|
114
|
+
async function collectConfig(opts = {}, authEmail, authPassword) {
|
|
115
115
|
const crmType = opts.crmType ?? "salesforce";
|
|
116
116
|
note2(
|
|
117
117
|
"You will need:\n \u2022 Public HTTPS URLs for the web app and routing engine",
|
|
@@ -168,14 +168,19 @@ async function collectConfig(opts = {}, authEmail) {
|
|
|
168
168
|
});
|
|
169
169
|
if (isCancel2(adminEmail)) bail2(adminEmail);
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
let adminPassword;
|
|
172
|
+
if (authPassword) {
|
|
173
|
+
adminPassword = authPassword;
|
|
174
|
+
} else {
|
|
175
|
+
adminPassword = await password2({
|
|
176
|
+
message: "Admin password (min 8 characters)",
|
|
177
|
+
validate: (v) => {
|
|
178
|
+
if (!v) return "Required";
|
|
179
|
+
if (v.length < 8) return "Must be at least 8 characters";
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
if (isCancel2(adminPassword)) bail2(adminPassword);
|
|
183
|
+
}
|
|
179
184
|
const sessionSecret = generateSecret(32);
|
|
180
185
|
const engineWebhookSecret = generateSecret(32);
|
|
181
186
|
const internalApiKey = generateSecret(32);
|
|
@@ -1245,6 +1250,7 @@ async function runInit(options = {}) {
|
|
|
1245
1250
|
return;
|
|
1246
1251
|
}
|
|
1247
1252
|
let auth;
|
|
1253
|
+
let authPassword;
|
|
1248
1254
|
try {
|
|
1249
1255
|
auth = await requireAuth();
|
|
1250
1256
|
} catch {
|
|
@@ -1314,6 +1320,7 @@ After verifying, press Enter to continue.`,
|
|
|
1314
1320
|
}
|
|
1315
1321
|
saveCredentials({ token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
1316
1322
|
auth = { token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
1323
|
+
authPassword = signupPw;
|
|
1317
1324
|
} catch (err) {
|
|
1318
1325
|
log7.error(err instanceof Error ? err.message : "Login failed");
|
|
1319
1326
|
process.exit(1);
|
|
@@ -1344,6 +1351,7 @@ After verifying, press Enter to continue.`,
|
|
|
1344
1351
|
}
|
|
1345
1352
|
saveCredentials({ token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
1346
1353
|
auth = { token, customer, storedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
1354
|
+
authPassword = loginPw;
|
|
1347
1355
|
} catch (err) {
|
|
1348
1356
|
log7.error(err instanceof Error ? err.message : "Login failed");
|
|
1349
1357
|
process.exit(1);
|
|
@@ -1432,7 +1440,7 @@ Install URL: ${chalk2.cyan(MANAGED_PACKAGE_INSTALL_URL)}`,
|
|
|
1432
1440
|
externalDb: options.externalDb,
|
|
1433
1441
|
externalRedis: options.externalRedis,
|
|
1434
1442
|
crmType
|
|
1435
|
-
}, auth.customer.email);
|
|
1443
|
+
}, auth.customer.email, authPassword);
|
|
1436
1444
|
await checkDnsResolvable(cfg.appUrl, cfg.engineUrl);
|
|
1437
1445
|
log7.step("Step 6/9 Generating config files");
|
|
1438
1446
|
const { dir } = generateFiles(cfg, sshCfg, {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "FlowStatus" AS ENUM ('DRAFT', 'ACTIVE', 'INACTIVE');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "FlowNodeType" AS ENUM ('ENTRY', 'DECISION', 'BRANCH_DECISION', 'MATCH', 'ASSIGNMENT', 'UPDATE_FIELD', 'CREATE_TASK', 'FILTER', 'DEFAULT');
|
|
6
|
+
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "organizations" ADD COLUMN "routingMode" JSONB;
|
|
9
|
+
|
|
10
|
+
-- AlterTable
|
|
11
|
+
ALTER TABLE "routing_logs" ADD COLUMN "flowId" TEXT,
|
|
12
|
+
ADD COLUMN "flowNodePath" JSONB;
|
|
13
|
+
|
|
14
|
+
-- CreateTable
|
|
15
|
+
CREATE TABLE "routing_flows" (
|
|
16
|
+
"id" TEXT NOT NULL,
|
|
17
|
+
"orgId" TEXT NOT NULL,
|
|
18
|
+
"objectType" "SfdcObjectType" NOT NULL,
|
|
19
|
+
"name" TEXT NOT NULL DEFAULT 'Untitled Flow',
|
|
20
|
+
"status" "FlowStatus" NOT NULL DEFAULT 'DRAFT',
|
|
21
|
+
"triggerEvent" "TriggerEvent" NOT NULL DEFAULT 'BOTH',
|
|
22
|
+
"isDryRun" BOOLEAN NOT NULL DEFAULT false,
|
|
23
|
+
"version" INTEGER NOT NULL DEFAULT 1,
|
|
24
|
+
"publishedAt" TIMESTAMP(3),
|
|
25
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
26
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
27
|
+
|
|
28
|
+
CONSTRAINT "routing_flows_pkey" PRIMARY KEY ("id")
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
-- CreateTable
|
|
32
|
+
CREATE TABLE "flow_nodes" (
|
|
33
|
+
"id" TEXT NOT NULL,
|
|
34
|
+
"flowId" TEXT NOT NULL,
|
|
35
|
+
"type" "FlowNodeType" NOT NULL,
|
|
36
|
+
"label" TEXT,
|
|
37
|
+
"positionX" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
38
|
+
"positionY" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
39
|
+
"config" JSONB,
|
|
40
|
+
"sortOrder" INTEGER NOT NULL DEFAULT 0,
|
|
41
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
42
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
43
|
+
|
|
44
|
+
CONSTRAINT "flow_nodes_pkey" PRIMARY KEY ("id")
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
-- CreateTable
|
|
48
|
+
CREATE TABLE "flow_edges" (
|
|
49
|
+
"id" TEXT NOT NULL,
|
|
50
|
+
"flowId" TEXT NOT NULL,
|
|
51
|
+
"fromId" TEXT NOT NULL,
|
|
52
|
+
"toId" TEXT NOT NULL,
|
|
53
|
+
"label" TEXT,
|
|
54
|
+
"sortOrder" INTEGER NOT NULL DEFAULT 0,
|
|
55
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
56
|
+
|
|
57
|
+
CONSTRAINT "flow_edges_pkey" PRIMARY KEY ("id")
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
-- CreateIndex
|
|
61
|
+
CREATE UNIQUE INDEX "routing_flows_orgId_objectType_key" ON "routing_flows"("orgId", "objectType");
|
|
62
|
+
|
|
63
|
+
-- AddForeignKey
|
|
64
|
+
ALTER TABLE "routing_flows" ADD CONSTRAINT "routing_flows_orgId_fkey" FOREIGN KEY ("orgId") REFERENCES "organizations"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
65
|
+
|
|
66
|
+
-- AddForeignKey
|
|
67
|
+
ALTER TABLE "flow_nodes" ADD CONSTRAINT "flow_nodes_flowId_fkey" FOREIGN KEY ("flowId") REFERENCES "routing_flows"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
68
|
+
|
|
69
|
+
-- AddForeignKey
|
|
70
|
+
ALTER TABLE "flow_edges" ADD CONSTRAINT "flow_edges_flowId_fkey" FOREIGN KEY ("flowId") REFERENCES "routing_flows"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
71
|
+
|
|
72
|
+
-- AddForeignKey
|
|
73
|
+
ALTER TABLE "flow_edges" ADD CONSTRAINT "flow_edges_fromId_fkey" FOREIGN KEY ("fromId") REFERENCES "flow_nodes"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
74
|
+
|
|
75
|
+
-- AddForeignKey
|
|
76
|
+
ALTER TABLE "flow_edges" ADD CONSTRAINT "flow_edges_toId_fkey" FOREIGN KEY ("toId") REFERENCES "flow_nodes"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|