@graph8/sdk 0.4.0 → 0.5.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.d.mts +1492 -2
- package/dist/index.d.ts +1492 -2
- package/dist/index.js +758 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +758 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1471 -0
- package/dist/react.d.ts +1471 -0
- package/dist/react.js +758 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +758 -2
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -706,6 +706,38 @@ var createVoiceClient = (apiKey, apiUrl) => {
|
|
|
706
706
|
);
|
|
707
707
|
const data = await resp.json();
|
|
708
708
|
return data.data || data;
|
|
709
|
+
},
|
|
710
|
+
/** Fetch the full transcript for a single dialer call. */
|
|
711
|
+
async callTranscript(roomName) {
|
|
712
|
+
const resp = await fetch(
|
|
713
|
+
`${baseUrl}/api/v1/voice/dialer/calls/${encodeURIComponent(roomName)}/transcript`,
|
|
714
|
+
{ headers: headers() }
|
|
715
|
+
);
|
|
716
|
+
return resp.json();
|
|
717
|
+
},
|
|
718
|
+
/** List dialer calls — pass `contact_id` or `user_email` to scope. */
|
|
719
|
+
async listCalls(params = {}) {
|
|
720
|
+
const resp = await fetch(
|
|
721
|
+
`${baseUrl}/api/v1/voice/dialer/calls${toQuery(params)}`,
|
|
722
|
+
{ headers: headers() }
|
|
723
|
+
);
|
|
724
|
+
return resp.json();
|
|
725
|
+
},
|
|
726
|
+
/** Convenience: list calls for a single contact. */
|
|
727
|
+
async listCallsForContact(contactId, extra = {}) {
|
|
728
|
+
const resp = await fetch(
|
|
729
|
+
`${baseUrl}/api/v1/voice/dialer/calls${toQuery({ contact_id: contactId, ...extra })}`,
|
|
730
|
+
{ headers: headers() }
|
|
731
|
+
);
|
|
732
|
+
return resp.json();
|
|
733
|
+
},
|
|
734
|
+
/** Convenience: list calls placed by a specific SDR. */
|
|
735
|
+
async listCallsForSdr(userEmail, extra = {}) {
|
|
736
|
+
const resp = await fetch(
|
|
737
|
+
`${baseUrl}/api/v1/voice/dialer/calls${toQuery({ user_email: userEmail, ...extra })}`,
|
|
738
|
+
{ headers: headers() }
|
|
739
|
+
);
|
|
740
|
+
return resp.json();
|
|
709
741
|
}
|
|
710
742
|
};
|
|
711
743
|
return {
|
|
@@ -1345,9 +1377,677 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1345
1377
|
};
|
|
1346
1378
|
};
|
|
1347
1379
|
|
|
1380
|
+
// src/quotes.ts
|
|
1381
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1382
|
+
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1383
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1384
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
1385
|
+
const toQuery = (params) => {
|
|
1386
|
+
const qs = new URLSearchParams();
|
|
1387
|
+
for (const [k, v] of Object.entries(params)) {
|
|
1388
|
+
if (v != null) qs.set(k, String(v));
|
|
1389
|
+
}
|
|
1390
|
+
const s = qs.toString();
|
|
1391
|
+
return s ? `?${s}` : "";
|
|
1392
|
+
};
|
|
1393
|
+
return {
|
|
1394
|
+
/** List quotes org-wide with optional filters and pagination. */
|
|
1395
|
+
async list(params = {}) {
|
|
1396
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes${toQuery(params)}`, { headers: headers() });
|
|
1397
|
+
return resp.json();
|
|
1398
|
+
},
|
|
1399
|
+
/** Get full details for a single quote. */
|
|
1400
|
+
async get(quoteId) {
|
|
1401
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}`, { headers: headers() });
|
|
1402
|
+
const data = await resp.json();
|
|
1403
|
+
return data.data || data;
|
|
1404
|
+
},
|
|
1405
|
+
/** Create a new quote from line items. */
|
|
1406
|
+
async create(quote) {
|
|
1407
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes`, {
|
|
1408
|
+
method: "POST",
|
|
1409
|
+
headers: headers(),
|
|
1410
|
+
body: JSON.stringify(quote)
|
|
1411
|
+
});
|
|
1412
|
+
const data = await resp.json();
|
|
1413
|
+
return data.data || data;
|
|
1414
|
+
},
|
|
1415
|
+
/** Update a draft quote (line items, expiry, notes). */
|
|
1416
|
+
async update(quoteId, fields) {
|
|
1417
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}`, {
|
|
1418
|
+
method: "PUT",
|
|
1419
|
+
headers: headers(),
|
|
1420
|
+
body: JSON.stringify(fields)
|
|
1421
|
+
});
|
|
1422
|
+
const data = await resp.json();
|
|
1423
|
+
return data.data || data;
|
|
1424
|
+
},
|
|
1425
|
+
/** Delete a draft quote (irreversible). */
|
|
1426
|
+
async delete(quoteId) {
|
|
1427
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}`, {
|
|
1428
|
+
method: "DELETE",
|
|
1429
|
+
headers: headers()
|
|
1430
|
+
});
|
|
1431
|
+
return resp.json();
|
|
1432
|
+
},
|
|
1433
|
+
/** Duplicate an existing quote (all line items copied into a new draft). */
|
|
1434
|
+
async duplicate(quoteId) {
|
|
1435
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}/duplicate`, {
|
|
1436
|
+
method: "POST",
|
|
1437
|
+
headers: headers(),
|
|
1438
|
+
body: JSON.stringify({})
|
|
1439
|
+
});
|
|
1440
|
+
const data = await resp.json();
|
|
1441
|
+
return data.data || data;
|
|
1442
|
+
},
|
|
1443
|
+
/** Convert a signed / sent quote back to editable draft state. */
|
|
1444
|
+
async editAsDraft(quoteId) {
|
|
1445
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}/edit-as-draft`, {
|
|
1446
|
+
method: "POST",
|
|
1447
|
+
headers: headers(),
|
|
1448
|
+
body: JSON.stringify({})
|
|
1449
|
+
});
|
|
1450
|
+
return resp.json();
|
|
1451
|
+
},
|
|
1452
|
+
/** Send a quote to its recipient via email (with signature + optional payment link). */
|
|
1453
|
+
async send(quoteId, params) {
|
|
1454
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotes/${quoteId}/send`, {
|
|
1455
|
+
method: "POST",
|
|
1456
|
+
headers: headers(),
|
|
1457
|
+
body: JSON.stringify(params)
|
|
1458
|
+
});
|
|
1459
|
+
const data = await resp.json();
|
|
1460
|
+
return data.data || data;
|
|
1461
|
+
},
|
|
1462
|
+
/** List products available for line items. */
|
|
1463
|
+
async products() {
|
|
1464
|
+
const resp = await fetch(`${baseUrl}/api/v1/quotable-products`, { headers: headers() });
|
|
1465
|
+
return resp.json();
|
|
1466
|
+
},
|
|
1467
|
+
/** Get org-level quote settings (currency, tax rate, payment providers, logo). */
|
|
1468
|
+
async settings() {
|
|
1469
|
+
const resp = await fetch(`${baseUrl}/api/v1/quote-settings`, { headers: headers() });
|
|
1470
|
+
const data = await resp.json();
|
|
1471
|
+
return data.data || data;
|
|
1472
|
+
},
|
|
1473
|
+
/** Get all quotes associated with a contact. */
|
|
1474
|
+
async forContact(contactId) {
|
|
1475
|
+
const resp = await fetch(`${baseUrl}/api/v1/contacts/${contactId}/quotes`, { headers: headers() });
|
|
1476
|
+
return resp.json();
|
|
1477
|
+
},
|
|
1478
|
+
/** Get all quotes associated with a company. */
|
|
1479
|
+
async forCompany(companyId) {
|
|
1480
|
+
const resp = await fetch(`${baseUrl}/api/v1/companies/${companyId}/quotes`, { headers: headers() });
|
|
1481
|
+
return resp.json();
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
// src/pipelines.ts
|
|
1487
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1488
|
+
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1489
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1490
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
1491
|
+
return {
|
|
1492
|
+
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1493
|
+
async list() {
|
|
1494
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines`, { headers: headers() });
|
|
1495
|
+
return resp.json();
|
|
1496
|
+
},
|
|
1497
|
+
/** Get a single pipeline by ID. */
|
|
1498
|
+
async get(pipelineId) {
|
|
1499
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}`, { headers: headers() });
|
|
1500
|
+
const data = await resp.json();
|
|
1501
|
+
return data.data || data;
|
|
1502
|
+
},
|
|
1503
|
+
/** Get the canonical evidence-key library (used when defining stages). */
|
|
1504
|
+
async evidenceLibrary() {
|
|
1505
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/evidence-library`, { headers: headers() });
|
|
1506
|
+
return resp.json();
|
|
1507
|
+
},
|
|
1508
|
+
/** Create a new pipeline. Defaults to a templated set of stages; pass blank=true for empty. */
|
|
1509
|
+
async create(params) {
|
|
1510
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines`, {
|
|
1511
|
+
method: "POST",
|
|
1512
|
+
headers: headers(),
|
|
1513
|
+
body: JSON.stringify(params)
|
|
1514
|
+
});
|
|
1515
|
+
const data = await resp.json();
|
|
1516
|
+
return data.data || data;
|
|
1517
|
+
},
|
|
1518
|
+
/** Update pipeline metadata (name, target). */
|
|
1519
|
+
async update(pipelineId, fields) {
|
|
1520
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}`, {
|
|
1521
|
+
method: "PUT",
|
|
1522
|
+
headers: headers(),
|
|
1523
|
+
body: JSON.stringify(fields)
|
|
1524
|
+
});
|
|
1525
|
+
const data = await resp.json();
|
|
1526
|
+
return data.data || data;
|
|
1527
|
+
},
|
|
1528
|
+
/** Delete a pipeline. Only allowed when no deals reference it. */
|
|
1529
|
+
async delete(pipelineId) {
|
|
1530
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}`, {
|
|
1531
|
+
method: "DELETE",
|
|
1532
|
+
headers: headers()
|
|
1533
|
+
});
|
|
1534
|
+
return resp.json();
|
|
1535
|
+
},
|
|
1536
|
+
/** Add a new stage to a pipeline. */
|
|
1537
|
+
async createStage(pipelineId, stage) {
|
|
1538
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages`, {
|
|
1539
|
+
method: "POST",
|
|
1540
|
+
headers: headers(),
|
|
1541
|
+
body: JSON.stringify(stage)
|
|
1542
|
+
});
|
|
1543
|
+
const data = await resp.json();
|
|
1544
|
+
return data.data || data;
|
|
1545
|
+
},
|
|
1546
|
+
/** Update a stage (evidence, scripts, position). */
|
|
1547
|
+
async updateStage(pipelineId, stageId, fields) {
|
|
1548
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages/${stageId}`, {
|
|
1549
|
+
method: "PUT",
|
|
1550
|
+
headers: headers(),
|
|
1551
|
+
body: JSON.stringify(fields)
|
|
1552
|
+
});
|
|
1553
|
+
const data = await resp.json();
|
|
1554
|
+
return data.data || data;
|
|
1555
|
+
},
|
|
1556
|
+
/** Reorder stages within a pipeline (pass full ordered list of stage IDs). */
|
|
1557
|
+
async reorderStages(pipelineId, stageIds) {
|
|
1558
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages/reorder`, {
|
|
1559
|
+
method: "PUT",
|
|
1560
|
+
headers: headers(),
|
|
1561
|
+
body: JSON.stringify({ stage_ids: stageIds })
|
|
1562
|
+
});
|
|
1563
|
+
return resp.json();
|
|
1564
|
+
},
|
|
1565
|
+
/** Delete a stage from a pipeline. */
|
|
1566
|
+
async deleteStage(pipelineId, stageId) {
|
|
1567
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/${pipelineId}/stages/${stageId}`, {
|
|
1568
|
+
method: "DELETE",
|
|
1569
|
+
headers: headers()
|
|
1570
|
+
});
|
|
1571
|
+
return resp.json();
|
|
1572
|
+
},
|
|
1573
|
+
/** Get an AI-suggested pipeline based on org context (brand, ICP, messaging). */
|
|
1574
|
+
async suggest() {
|
|
1575
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/suggest`, {
|
|
1576
|
+
method: "POST",
|
|
1577
|
+
headers: headers(),
|
|
1578
|
+
body: JSON.stringify({})
|
|
1579
|
+
});
|
|
1580
|
+
return resp.json();
|
|
1581
|
+
},
|
|
1582
|
+
/** Create a real pipeline from an AI suggestion (optionally with overrides). */
|
|
1583
|
+
async fromSuggestion(suggestionId, overrides) {
|
|
1584
|
+
const resp = await fetch(`${baseUrl}/api/v1/pipelines/from-suggestion`, {
|
|
1585
|
+
method: "POST",
|
|
1586
|
+
headers: headers(),
|
|
1587
|
+
body: JSON.stringify({ suggestion_id: suggestionId, ...overrides || {} })
|
|
1588
|
+
});
|
|
1589
|
+
const data = await resp.json();
|
|
1590
|
+
return data.data || data;
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
};
|
|
1594
|
+
|
|
1595
|
+
// src/workflows.ts
|
|
1596
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1597
|
+
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1598
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1599
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
1600
|
+
const toQuery = (params) => {
|
|
1601
|
+
const qs = new URLSearchParams();
|
|
1602
|
+
for (const [k, v] of Object.entries(params)) {
|
|
1603
|
+
if (v != null) qs.set(k, String(v));
|
|
1604
|
+
}
|
|
1605
|
+
const s = qs.toString();
|
|
1606
|
+
return s ? `?${s}` : "";
|
|
1607
|
+
};
|
|
1608
|
+
return {
|
|
1609
|
+
/** List workflows org-wide. */
|
|
1610
|
+
async list(params = {}) {
|
|
1611
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows${toQuery(params)}`, { headers: headers() });
|
|
1612
|
+
return resp.json();
|
|
1613
|
+
},
|
|
1614
|
+
/** Get full workflow definition (nodes, connections, trigger, execution state). */
|
|
1615
|
+
async get(workflowId) {
|
|
1616
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, { headers: headers() });
|
|
1617
|
+
const data = await resp.json();
|
|
1618
|
+
return data.data || data;
|
|
1619
|
+
},
|
|
1620
|
+
/** Create a new workflow. */
|
|
1621
|
+
async create(params) {
|
|
1622
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows`, {
|
|
1623
|
+
method: "POST",
|
|
1624
|
+
headers: headers(),
|
|
1625
|
+
body: JSON.stringify(params)
|
|
1626
|
+
});
|
|
1627
|
+
const data = await resp.json();
|
|
1628
|
+
return data.data || data;
|
|
1629
|
+
},
|
|
1630
|
+
/**
|
|
1631
|
+
* Update a workflow. Pass the full `config` (nodes + connections) to edit
|
|
1632
|
+
* the graph — node-level CRUD is performed client-side by mutating the
|
|
1633
|
+
* config and submitting the updated record.
|
|
1634
|
+
*/
|
|
1635
|
+
async update(workflowId, fields) {
|
|
1636
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, {
|
|
1637
|
+
method: "PUT",
|
|
1638
|
+
headers: headers(),
|
|
1639
|
+
body: JSON.stringify(fields)
|
|
1640
|
+
});
|
|
1641
|
+
const data = await resp.json();
|
|
1642
|
+
return data.data || data;
|
|
1643
|
+
},
|
|
1644
|
+
/** Delete a workflow. */
|
|
1645
|
+
async delete(workflowId) {
|
|
1646
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}`, {
|
|
1647
|
+
method: "DELETE",
|
|
1648
|
+
headers: headers()
|
|
1649
|
+
});
|
|
1650
|
+
return resp.json();
|
|
1651
|
+
},
|
|
1652
|
+
/** Validate a workflow definition (orphans, dangling connections, required fields). */
|
|
1653
|
+
async validate(workflow) {
|
|
1654
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/validate`, {
|
|
1655
|
+
method: "POST",
|
|
1656
|
+
headers: headers(),
|
|
1657
|
+
body: JSON.stringify(workflow)
|
|
1658
|
+
});
|
|
1659
|
+
return resp.json();
|
|
1660
|
+
},
|
|
1661
|
+
/** Execute a workflow immediately with a trigger payload. */
|
|
1662
|
+
async execute(workflowId, triggerPayload = {}) {
|
|
1663
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}/execute`, {
|
|
1664
|
+
method: "POST",
|
|
1665
|
+
headers: headers(),
|
|
1666
|
+
body: JSON.stringify({ trigger_payload: triggerPayload })
|
|
1667
|
+
});
|
|
1668
|
+
const data = await resp.json();
|
|
1669
|
+
return data.data || data;
|
|
1670
|
+
},
|
|
1671
|
+
/** Get the status + output of a workflow execution. */
|
|
1672
|
+
async getExecution(executionId) {
|
|
1673
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}`, { headers: headers() });
|
|
1674
|
+
const data = await resp.json();
|
|
1675
|
+
return data.data || data;
|
|
1676
|
+
},
|
|
1677
|
+
/** Pause an in-flight execution. */
|
|
1678
|
+
async pauseExecution(executionId) {
|
|
1679
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}/pause`, {
|
|
1680
|
+
method: "POST",
|
|
1681
|
+
headers: headers(),
|
|
1682
|
+
body: JSON.stringify({})
|
|
1683
|
+
});
|
|
1684
|
+
return resp.json();
|
|
1685
|
+
},
|
|
1686
|
+
/** Resume a paused execution. */
|
|
1687
|
+
async resumeExecution(executionId) {
|
|
1688
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}/resume`, {
|
|
1689
|
+
method: "POST",
|
|
1690
|
+
headers: headers(),
|
|
1691
|
+
body: JSON.stringify({})
|
|
1692
|
+
});
|
|
1693
|
+
return resp.json();
|
|
1694
|
+
},
|
|
1695
|
+
/** Stop an execution (terminal state — cannot resume). */
|
|
1696
|
+
async stopExecution(executionId) {
|
|
1697
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/executions/${executionId}/stop`, {
|
|
1698
|
+
method: "POST",
|
|
1699
|
+
headers: headers(),
|
|
1700
|
+
body: JSON.stringify({})
|
|
1701
|
+
});
|
|
1702
|
+
return resp.json();
|
|
1703
|
+
},
|
|
1704
|
+
/** Get the status of a workflow's external trigger (e.g. "waiting for webhook"). */
|
|
1705
|
+
async getTriggerStatus(workflowId) {
|
|
1706
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}/trigger-status`, { headers: headers() });
|
|
1707
|
+
return resp.json();
|
|
1708
|
+
},
|
|
1709
|
+
/** Reset the trigger cursor (e.g. for event-stream triggers — resume from beginning). */
|
|
1710
|
+
async resetTrigger(workflowId) {
|
|
1711
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/${workflowId}/trigger-reset`, {
|
|
1712
|
+
method: "POST",
|
|
1713
|
+
headers: headers(),
|
|
1714
|
+
body: JSON.stringify({})
|
|
1715
|
+
});
|
|
1716
|
+
return resp.json();
|
|
1717
|
+
},
|
|
1718
|
+
/**
|
|
1719
|
+
* List available node types with schemas. Pass a `type` param to fetch one type's full schema.
|
|
1720
|
+
*/
|
|
1721
|
+
async nodeTypes(params = {}) {
|
|
1722
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/node-types/schema${toQuery(params)}`, { headers: headers() });
|
|
1723
|
+
return resp.json();
|
|
1724
|
+
},
|
|
1725
|
+
/** Slack workspace users (for Slack action recipients). */
|
|
1726
|
+
async listSlackUsers() {
|
|
1727
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/slack/users`, { headers: headers() });
|
|
1728
|
+
return resp.json();
|
|
1729
|
+
},
|
|
1730
|
+
/** Slack channels. */
|
|
1731
|
+
async listSlackChannels() {
|
|
1732
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/slack/channels`, { headers: headers() });
|
|
1733
|
+
return resp.json();
|
|
1734
|
+
},
|
|
1735
|
+
/** Roam (Copilot chat) users. */
|
|
1736
|
+
async listRoamUsers() {
|
|
1737
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/roam/users`, { headers: headers() });
|
|
1738
|
+
return resp.json();
|
|
1739
|
+
},
|
|
1740
|
+
/** Roam (Copilot chat) groups. */
|
|
1741
|
+
async listRoamGroups() {
|
|
1742
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/integrations/roam/groups`, { headers: headers() });
|
|
1743
|
+
return resp.json();
|
|
1744
|
+
},
|
|
1745
|
+
/** Available MCP servers (for Agent-node integrations). */
|
|
1746
|
+
async listMcpServers() {
|
|
1747
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/mcp-servers`, { headers: headers() });
|
|
1748
|
+
return resp.json();
|
|
1749
|
+
},
|
|
1750
|
+
/** Available call dispositions (voice workflow nodes). */
|
|
1751
|
+
async listDispositions() {
|
|
1752
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/dispositions`, { headers: headers() });
|
|
1753
|
+
return resp.json();
|
|
1754
|
+
},
|
|
1755
|
+
/** Form field schema for form-trigger nodes. */
|
|
1756
|
+
async listFormFields(formId) {
|
|
1757
|
+
const resp = await fetch(`${baseUrl}/api/v1/workflows/forms/${formId}/fields`, { headers: headers() });
|
|
1758
|
+
return resp.json();
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1763
|
+
// src/skills.ts
|
|
1764
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1765
|
+
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1766
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1767
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
1768
|
+
const toQuery = (params) => {
|
|
1769
|
+
const qs = new URLSearchParams();
|
|
1770
|
+
for (const [k, v] of Object.entries(params)) {
|
|
1771
|
+
if (v != null) qs.set(k, String(v));
|
|
1772
|
+
}
|
|
1773
|
+
const s = qs.toString();
|
|
1774
|
+
return s ? `?${s}` : "";
|
|
1775
|
+
};
|
|
1776
|
+
return {
|
|
1777
|
+
/** List skills. */
|
|
1778
|
+
async list(params = {}) {
|
|
1779
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills${toQuery(params)}`, { headers: headers() });
|
|
1780
|
+
return resp.json();
|
|
1781
|
+
},
|
|
1782
|
+
/** Get a skill by ID. */
|
|
1783
|
+
async get(skillId) {
|
|
1784
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, { headers: headers() });
|
|
1785
|
+
const data = await resp.json();
|
|
1786
|
+
return data.data || data;
|
|
1787
|
+
},
|
|
1788
|
+
/** Get the variables required by a skill (extracted from prompt or body template). */
|
|
1789
|
+
async getVariables(skillId) {
|
|
1790
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}/variables`, { headers: headers() });
|
|
1791
|
+
return resp.json();
|
|
1792
|
+
},
|
|
1793
|
+
/** List available LLM models. */
|
|
1794
|
+
async listModels() {
|
|
1795
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/models`, { headers: headers() });
|
|
1796
|
+
return resp.json();
|
|
1797
|
+
},
|
|
1798
|
+
/** List skill templates. */
|
|
1799
|
+
async listTemplates(params = {}) {
|
|
1800
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/templates${toQuery(params)}`, { headers: headers() });
|
|
1801
|
+
return resp.json();
|
|
1802
|
+
},
|
|
1803
|
+
/** Create an LLM skill (prompt + model + schemas). */
|
|
1804
|
+
async createLLM(params) {
|
|
1805
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills`, {
|
|
1806
|
+
method: "POST",
|
|
1807
|
+
headers: headers(),
|
|
1808
|
+
body: JSON.stringify({ ...params, type: "llm" })
|
|
1809
|
+
});
|
|
1810
|
+
const data = await resp.json();
|
|
1811
|
+
return data.data || data;
|
|
1812
|
+
},
|
|
1813
|
+
/** Create an API skill (HTTP request wrapper). */
|
|
1814
|
+
async createAPI(params) {
|
|
1815
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills`, {
|
|
1816
|
+
method: "POST",
|
|
1817
|
+
headers: headers(),
|
|
1818
|
+
body: JSON.stringify({ ...params, type: "api" })
|
|
1819
|
+
});
|
|
1820
|
+
const data = await resp.json();
|
|
1821
|
+
return data.data || data;
|
|
1822
|
+
},
|
|
1823
|
+
/** Create a skill from a built-in template. */
|
|
1824
|
+
async createFromTemplate(params) {
|
|
1825
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/from-template`, {
|
|
1826
|
+
method: "POST",
|
|
1827
|
+
headers: headers(),
|
|
1828
|
+
body: JSON.stringify(params)
|
|
1829
|
+
});
|
|
1830
|
+
const data = await resp.json();
|
|
1831
|
+
return data.data || data;
|
|
1832
|
+
},
|
|
1833
|
+
/** Lift a workflow node into a reusable skill. */
|
|
1834
|
+
async createFromNode(params) {
|
|
1835
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/from-node`, {
|
|
1836
|
+
method: "POST",
|
|
1837
|
+
headers: headers(),
|
|
1838
|
+
body: JSON.stringify(params)
|
|
1839
|
+
});
|
|
1840
|
+
const data = await resp.json();
|
|
1841
|
+
return data.data || data;
|
|
1842
|
+
},
|
|
1843
|
+
/** Update an LLM skill. */
|
|
1844
|
+
async updateLLM(skillId, fields) {
|
|
1845
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, {
|
|
1846
|
+
method: "PUT",
|
|
1847
|
+
headers: headers(),
|
|
1848
|
+
body: JSON.stringify({ ...fields, type: "llm" })
|
|
1849
|
+
});
|
|
1850
|
+
const data = await resp.json();
|
|
1851
|
+
return data.data || data;
|
|
1852
|
+
},
|
|
1853
|
+
/** Update an API skill. */
|
|
1854
|
+
async updateAPI(skillId, fields) {
|
|
1855
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, {
|
|
1856
|
+
method: "PUT",
|
|
1857
|
+
headers: headers(),
|
|
1858
|
+
body: JSON.stringify({ ...fields, type: "api" })
|
|
1859
|
+
});
|
|
1860
|
+
const data = await resp.json();
|
|
1861
|
+
return data.data || data;
|
|
1862
|
+
},
|
|
1863
|
+
/** Delete a skill (irreversible if in-use workflows exist). */
|
|
1864
|
+
async delete(skillId) {
|
|
1865
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}`, {
|
|
1866
|
+
method: "DELETE",
|
|
1867
|
+
headers: headers()
|
|
1868
|
+
});
|
|
1869
|
+
return resp.json();
|
|
1870
|
+
},
|
|
1871
|
+
/** Validate a skill definition (without saving). */
|
|
1872
|
+
async validate(skill) {
|
|
1873
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/validate`, {
|
|
1874
|
+
method: "POST",
|
|
1875
|
+
headers: headers(),
|
|
1876
|
+
body: JSON.stringify(skill)
|
|
1877
|
+
});
|
|
1878
|
+
return resp.json();
|
|
1879
|
+
},
|
|
1880
|
+
/** Execute a skill immediately with an input payload (test / preview). */
|
|
1881
|
+
async execute(skillId, inputPayload) {
|
|
1882
|
+
const resp = await fetch(`${baseUrl}/api/v1/skills/${skillId}/execute`, {
|
|
1883
|
+
method: "POST",
|
|
1884
|
+
headers: headers(),
|
|
1885
|
+
body: JSON.stringify(inputPayload)
|
|
1886
|
+
});
|
|
1887
|
+
return resp.json();
|
|
1888
|
+
}
|
|
1889
|
+
};
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
// src/intent.ts
|
|
1893
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1894
|
+
var createIntentClient = (apiKey, apiUrl) => {
|
|
1895
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1896
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
1897
|
+
const get = async (path) => {
|
|
1898
|
+
const resp = await fetch(`${baseUrl}/api/v1${path}`, { headers: headers() });
|
|
1899
|
+
return resp.json();
|
|
1900
|
+
};
|
|
1901
|
+
const post = async (path, body = {}) => {
|
|
1902
|
+
const resp = await fetch(`${baseUrl}/api/v1${path}`, {
|
|
1903
|
+
method: "POST",
|
|
1904
|
+
headers: headers(),
|
|
1905
|
+
body: JSON.stringify(body)
|
|
1906
|
+
});
|
|
1907
|
+
return resp.json();
|
|
1908
|
+
};
|
|
1909
|
+
const del = async (path) => {
|
|
1910
|
+
const resp = await fetch(`${baseUrl}/api/v1${path}`, { method: "DELETE", headers: headers() });
|
|
1911
|
+
return resp.json();
|
|
1912
|
+
};
|
|
1913
|
+
return {
|
|
1914
|
+
/** Org-level intent stats (totals over the last 30 days). */
|
|
1915
|
+
async stats() {
|
|
1916
|
+
return get("/intent/stats");
|
|
1917
|
+
},
|
|
1918
|
+
/** List tracked keywords with optional pagination. */
|
|
1919
|
+
async listKeywords(params = {}) {
|
|
1920
|
+
return post("/intent/keywords/list", params);
|
|
1921
|
+
},
|
|
1922
|
+
/** Create a keyword group from a domain (auto-tracks all pages). */
|
|
1923
|
+
async createFromDomain(domain) {
|
|
1924
|
+
return post("/intent/keywords/create-from-domain", { domain });
|
|
1925
|
+
},
|
|
1926
|
+
/** Stop tracking a keyword (irreversible — historical data is retained). */
|
|
1927
|
+
async deleteKeyword(keywordId) {
|
|
1928
|
+
return del(`/intent/keywords/${keywordId}`);
|
|
1929
|
+
},
|
|
1930
|
+
/** Companies showing interest in a tracked keyword. */
|
|
1931
|
+
async keywordCompanies(keywordId, params = {}) {
|
|
1932
|
+
return post(`/intent/keywords/${keywordId}/companies`, params);
|
|
1933
|
+
},
|
|
1934
|
+
/** Contacts showing interest in a tracked keyword. */
|
|
1935
|
+
async keywordContacts(keywordId, params = {}) {
|
|
1936
|
+
return post(`/intent/keywords/${keywordId}/contacts`, params);
|
|
1937
|
+
},
|
|
1938
|
+
/** URLs associated with a keyword (pages visitors landed on while interested). */
|
|
1939
|
+
async keywordUrls(keywordId, params = {}) {
|
|
1940
|
+
return post(`/intent/keywords/${keywordId}/urls`, params);
|
|
1941
|
+
},
|
|
1942
|
+
/** Pages tracked on a specific domain. */
|
|
1943
|
+
async pagesByDomain(domain, params = {}) {
|
|
1944
|
+
return post("/intent/pages-by-domain", { domain, ...params });
|
|
1945
|
+
},
|
|
1946
|
+
/** Search tracked pages by URL fragment or keyword. */
|
|
1947
|
+
async searchPages(query, params = {}) {
|
|
1948
|
+
return post("/intent/pages/search", { query, ...params });
|
|
1949
|
+
},
|
|
1950
|
+
/** Get visitor records for a specific page URL. */
|
|
1951
|
+
async pageVisitors(pageUrl, params = {}) {
|
|
1952
|
+
return post("/intent/pages/visitors", { url: pageUrl, ...params });
|
|
1953
|
+
},
|
|
1954
|
+
/** Get contacts who visited a specific page URL. */
|
|
1955
|
+
async pageContacts(pageUrl, params = {}) {
|
|
1956
|
+
return post("/intent/pages/contacts", { url: pageUrl, ...params });
|
|
1957
|
+
},
|
|
1958
|
+
/** Visitor count aggregates by page (pass an array of URLs). */
|
|
1959
|
+
async pageVisitorCounts(urls) {
|
|
1960
|
+
return post("/intent/pages/visitor-counts", { urls });
|
|
1961
|
+
},
|
|
1962
|
+
/**
|
|
1963
|
+
* Find companies whose users visited a specific URL (intent search).
|
|
1964
|
+
*
|
|
1965
|
+
* Note: this endpoint lives at the bare host (no `/api/v1` prefix), unlike the rest
|
|
1966
|
+
* of the intent surface — we call it directly here instead of through the shared `post()` helper.
|
|
1967
|
+
*/
|
|
1968
|
+
async urlCompanies(url, params = {}) {
|
|
1969
|
+
const resp = await fetch(`${baseUrl}/intent-search/url-companies`, {
|
|
1970
|
+
method: "POST",
|
|
1971
|
+
headers: headers(),
|
|
1972
|
+
body: JSON.stringify({ url, ...params })
|
|
1973
|
+
});
|
|
1974
|
+
return resp.json();
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
// src/studio.ts
|
|
1980
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1981
|
+
var createStudioClient = (apiKey, apiUrl) => {
|
|
1982
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1983
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
1984
|
+
const toQuery = (params) => {
|
|
1985
|
+
const qs = new URLSearchParams();
|
|
1986
|
+
for (const [k, v] of Object.entries(params)) {
|
|
1987
|
+
if (v != null) qs.set(k, String(v));
|
|
1988
|
+
}
|
|
1989
|
+
const s = qs.toString();
|
|
1990
|
+
return s ? `?${s}` : "";
|
|
1991
|
+
};
|
|
1992
|
+
const get = async (path, params = {}) => {
|
|
1993
|
+
const resp = await fetch(`${baseUrl}/api/v1${path}${toQuery(params)}`, { headers: headers() });
|
|
1994
|
+
return resp.json();
|
|
1995
|
+
};
|
|
1996
|
+
return {
|
|
1997
|
+
/** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.). */
|
|
1998
|
+
async globalContext(params = {}) {
|
|
1999
|
+
return get("/global-context/documents", params);
|
|
2000
|
+
},
|
|
2001
|
+
/** ICP definitions. */
|
|
2002
|
+
async icps(params = {}) {
|
|
2003
|
+
return get("/icps", params);
|
|
2004
|
+
},
|
|
2005
|
+
/** Buyer persona definitions. */
|
|
2006
|
+
async personas(params = {}) {
|
|
2007
|
+
return get("/personas", params);
|
|
2008
|
+
},
|
|
2009
|
+
/** Intelligence data (website scrapes, enrichment, competitor research). */
|
|
2010
|
+
async intelligenceData(params = {}) {
|
|
2011
|
+
return get("/intelligence-data", params);
|
|
2012
|
+
},
|
|
2013
|
+
/** AI research reports (buyer psychology, competitive teardown, GTM channel, etc.). */
|
|
2014
|
+
async researchReports(params = {}) {
|
|
2015
|
+
return get("/research-reports", params);
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
};
|
|
2019
|
+
|
|
2020
|
+
// src/meetings.ts
|
|
2021
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
2022
|
+
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
2023
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
2024
|
+
const headers = () => ({ "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` });
|
|
2025
|
+
const toQuery = (params) => {
|
|
2026
|
+
const qs = new URLSearchParams();
|
|
2027
|
+
for (const [k, v] of Object.entries(params)) {
|
|
2028
|
+
if (v != null) qs.set(k, String(v));
|
|
2029
|
+
}
|
|
2030
|
+
const s = qs.toString();
|
|
2031
|
+
return s ? `?${s}` : "";
|
|
2032
|
+
};
|
|
2033
|
+
return {
|
|
2034
|
+
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
2035
|
+
async list(params = {}) {
|
|
2036
|
+
const resp = await fetch(`${baseUrl}/api/v1/inbox/meetings${toQuery(params)}`, { headers: headers() });
|
|
2037
|
+
return resp.json();
|
|
2038
|
+
},
|
|
2039
|
+
/** Get full meeting detail including transcript + AI analysis (transcript available 1-5 min after meeting ends). */
|
|
2040
|
+
async get(meetingId) {
|
|
2041
|
+
const resp = await fetch(`${baseUrl}/api/v1/inbox/meetings/${meetingId}`, { headers: headers() });
|
|
2042
|
+
const data = await resp.json();
|
|
2043
|
+
return data.data || data;
|
|
2044
|
+
}
|
|
2045
|
+
};
|
|
2046
|
+
};
|
|
2047
|
+
|
|
1348
2048
|
// src/core.ts
|
|
1349
2049
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
1350
|
-
var
|
|
2050
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
1351
2051
|
var G8 = class {
|
|
1352
2052
|
constructor() {
|
|
1353
2053
|
/** @internal */
|
|
@@ -1398,6 +2098,20 @@ var G8 = class {
|
|
|
1398
2098
|
this._deals = null;
|
|
1399
2099
|
/** @internal */
|
|
1400
2100
|
this._inbox = null;
|
|
2101
|
+
/** @internal */
|
|
2102
|
+
this._quotes = null;
|
|
2103
|
+
/** @internal */
|
|
2104
|
+
this._pipelines = null;
|
|
2105
|
+
/** @internal */
|
|
2106
|
+
this._workflows = null;
|
|
2107
|
+
/** @internal */
|
|
2108
|
+
this._skills = null;
|
|
2109
|
+
/** @internal */
|
|
2110
|
+
this._intent = null;
|
|
2111
|
+
/** @internal */
|
|
2112
|
+
this._studio = null;
|
|
2113
|
+
/** @internal */
|
|
2114
|
+
this._meetings = null;
|
|
1401
2115
|
}
|
|
1402
2116
|
/**
|
|
1403
2117
|
* Initialize the graph8 SDK. Must be called before any other method.
|
|
@@ -1412,7 +2126,7 @@ var G8 = class {
|
|
|
1412
2126
|
debug: config.debug
|
|
1413
2127
|
});
|
|
1414
2128
|
}
|
|
1415
|
-
const apiUrl = config.apiUrl ||
|
|
2129
|
+
const apiUrl = config.apiUrl || DEFAULT_API30;
|
|
1416
2130
|
const writeKey = config.writeKey || "";
|
|
1417
2131
|
const apiKey = config.apiKey || "";
|
|
1418
2132
|
if (writeKey) {
|
|
@@ -1440,6 +2154,13 @@ var G8 = class {
|
|
|
1440
2154
|
this._fields = createFieldsClient(apiKey, apiUrl);
|
|
1441
2155
|
this._deals = createDealsClient(apiKey, apiUrl);
|
|
1442
2156
|
this._inbox = createInboxClient(apiKey, apiUrl);
|
|
2157
|
+
this._quotes = createQuotesClient(apiKey, apiUrl);
|
|
2158
|
+
this._pipelines = createPipelinesClient(apiKey, apiUrl);
|
|
2159
|
+
this._workflows = createWorkflowsClient(apiKey, apiUrl);
|
|
2160
|
+
this._skills = createSkillsClient(apiKey, apiUrl);
|
|
2161
|
+
this._intent = createIntentClient(apiKey, apiUrl);
|
|
2162
|
+
this._studio = createStudioClient(apiKey, apiUrl);
|
|
2163
|
+
this._meetings = createMeetingsClient(apiKey, apiUrl);
|
|
1443
2164
|
this._signals = createSignalsClient(apiKey, true, apiUrl);
|
|
1444
2165
|
}
|
|
1445
2166
|
}
|
|
@@ -1571,6 +2292,41 @@ var G8 = class {
|
|
|
1571
2292
|
this._assertKey("inbox");
|
|
1572
2293
|
return this._inbox;
|
|
1573
2294
|
}
|
|
2295
|
+
/** Quote-to-cash: draft, send, sign, payment-link quotes (requires API key). */
|
|
2296
|
+
get quotes() {
|
|
2297
|
+
this._assertKey("quotes");
|
|
2298
|
+
return this._quotes;
|
|
2299
|
+
}
|
|
2300
|
+
/** Stage Checklist v2 pipelines: workflow stages with evidence + scripts (requires API key). */
|
|
2301
|
+
get pipelines() {
|
|
2302
|
+
this._assertKey("pipelines");
|
|
2303
|
+
return this._pipelines;
|
|
2304
|
+
}
|
|
2305
|
+
/** Workflow builder — multi-node automation graphs with execution lifecycle (requires API key). */
|
|
2306
|
+
get workflows() {
|
|
2307
|
+
this._assertKey("workflows");
|
|
2308
|
+
return this._workflows;
|
|
2309
|
+
}
|
|
2310
|
+
/** Skill authoring — LLM and API building blocks that workflows compose (requires API key). */
|
|
2311
|
+
get skills() {
|
|
2312
|
+
this._assertKey("skills");
|
|
2313
|
+
return this._skills;
|
|
2314
|
+
}
|
|
2315
|
+
/** Intent tracking — keyword groups, page visitors, account-level intent (requires API key). */
|
|
2316
|
+
get intent() {
|
|
2317
|
+
this._assertKey("intent");
|
|
2318
|
+
return this._intent;
|
|
2319
|
+
}
|
|
2320
|
+
/** Studio context — ICPs, personas, brand briefs, intelligence, AI research reports (requires API key). */
|
|
2321
|
+
get studio() {
|
|
2322
|
+
this._assertKey("studio");
|
|
2323
|
+
return this._studio;
|
|
2324
|
+
}
|
|
2325
|
+
/** Meetings — read scheduled, completed, cancelled meetings with transcripts + AI analysis (requires API key). */
|
|
2326
|
+
get meetings() {
|
|
2327
|
+
this._assertKey("meetings");
|
|
2328
|
+
return this._meetings;
|
|
2329
|
+
}
|
|
1574
2330
|
/** Whether the SDK has been initialized. */
|
|
1575
2331
|
get initialized() {
|
|
1576
2332
|
return this.config !== null;
|