@graph8/sdk 0.14.0 → 0.15.0
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/README.md +127 -2
- package/dist/index.d.mts +144 -13
- package/dist/index.d.ts +144 -13
- package/dist/index.js +105 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -10
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +143 -12
- package/dist/react.d.ts +143 -12
- package/dist/react.js +105 -10
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +105 -10
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -841,6 +841,8 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
841
841
|
"engagement.email_bounced",
|
|
842
842
|
"engagement.email_skipped",
|
|
843
843
|
"engagement.call_dispatched",
|
|
844
|
+
"engagement.call_connected",
|
|
845
|
+
"engagement.call_graded",
|
|
844
846
|
"engagement.sms_sent",
|
|
845
847
|
"engagement.sms_replied",
|
|
846
848
|
"engagement.whatsapp_sent",
|
|
@@ -851,7 +853,12 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
851
853
|
"engagement.linkedin_connection_accepted",
|
|
852
854
|
"meeting.booked",
|
|
853
855
|
"meeting.cancelled",
|
|
854
|
-
"meeting.rescheduled"
|
|
856
|
+
"meeting.rescheduled",
|
|
857
|
+
"deal.won",
|
|
858
|
+
"crm.record.created",
|
|
859
|
+
"crm.record.updated",
|
|
860
|
+
"crm.record.archived",
|
|
861
|
+
"crm.record.restored"
|
|
855
862
|
];
|
|
856
863
|
var WebhookSignatureError = class extends Error {
|
|
857
864
|
constructor(message) {
|
|
@@ -1534,8 +1541,32 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1534
1541
|
const encode = (value) => encodeURIComponent(value);
|
|
1535
1542
|
return {
|
|
1536
1543
|
/** List the custom object types in your workspace. */
|
|
1537
|
-
async list() {
|
|
1538
|
-
|
|
1544
|
+
async list(params = {}) {
|
|
1545
|
+
const query = params.include_archived ? "?include_archived=true" : "";
|
|
1546
|
+
return request(baseUrl, `/api/v1/objects${query}`, apiKey);
|
|
1547
|
+
},
|
|
1548
|
+
/** Create a native custom object. Requires objects:manage and Admin access. */
|
|
1549
|
+
async create(input) {
|
|
1550
|
+
const resp = await request(baseUrl, "/api/v1/objects", apiKey, {
|
|
1551
|
+
method: "POST",
|
|
1552
|
+
body: input
|
|
1553
|
+
});
|
|
1554
|
+
return resp.data;
|
|
1555
|
+
},
|
|
1556
|
+
/** Rename, archive or restore an object while preserving its slug and data. */
|
|
1557
|
+
async update(objectSlug, input) {
|
|
1558
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
|
|
1559
|
+
method: "PATCH",
|
|
1560
|
+
body: input
|
|
1561
|
+
});
|
|
1562
|
+
return resp.data;
|
|
1563
|
+
},
|
|
1564
|
+
/** Archive the object without deleting records; restore with update({ is_archived: false }). */
|
|
1565
|
+
async archive(objectSlug) {
|
|
1566
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
|
|
1567
|
+
method: "DELETE"
|
|
1568
|
+
});
|
|
1569
|
+
return resp.data;
|
|
1539
1570
|
},
|
|
1540
1571
|
/** Fetch one object type by slug. */
|
|
1541
1572
|
async get(objectSlug) {
|
|
@@ -1547,10 +1578,35 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1547
1578
|
return resp.data ?? resp;
|
|
1548
1579
|
},
|
|
1549
1580
|
/** The object's attributes — the schema its records must satisfy. */
|
|
1550
|
-
async listAttributes(objectSlug) {
|
|
1551
|
-
|
|
1581
|
+
async listAttributes(objectSlug, params = {}) {
|
|
1582
|
+
const query = params.include_archived ? "?include_archived=true" : "";
|
|
1583
|
+
return request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes${query}`, apiKey);
|
|
1552
1584
|
},
|
|
1553
|
-
/**
|
|
1585
|
+
/** Create a field using the same schema rules as the customer UI. */
|
|
1586
|
+
async createAttribute(objectSlug, input) {
|
|
1587
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes`, apiKey, {
|
|
1588
|
+
method: "POST",
|
|
1589
|
+
body: input
|
|
1590
|
+
});
|
|
1591
|
+
return resp.data;
|
|
1592
|
+
},
|
|
1593
|
+
/** Edit or restore a field; its type and slug are immutable. */
|
|
1594
|
+
async updateAttribute(objectSlug, attributeSlug, input) {
|
|
1595
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
|
|
1596
|
+
method: "PATCH",
|
|
1597
|
+
body: input
|
|
1598
|
+
});
|
|
1599
|
+
return resp.data;
|
|
1600
|
+
},
|
|
1601
|
+
/** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
|
|
1602
|
+
async archiveAttribute(objectSlug, attributeSlug) {
|
|
1603
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
|
|
1604
|
+
method: "DELETE"
|
|
1605
|
+
});
|
|
1606
|
+
return resp.data;
|
|
1607
|
+
},
|
|
1608
|
+
/** Paginated custom records or canonical deals with current values and revisions.
|
|
1609
|
+
* Deal totals and related references respect current record access. */
|
|
1554
1610
|
async listRecords(objectSlug, params = {}) {
|
|
1555
1611
|
const query = {};
|
|
1556
1612
|
if (params.page != null) query.page = params.page;
|
|
@@ -1574,7 +1630,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1574
1630
|
);
|
|
1575
1631
|
return resp.data ?? resp;
|
|
1576
1632
|
},
|
|
1577
|
-
/**
|
|
1633
|
+
/** Match a unique single-value key, creating or updating while preserving omitted fields. */
|
|
1634
|
+
async upsertRecord(objectSlug, matchingAttribute, values, options = {}) {
|
|
1635
|
+
const resp = await request(
|
|
1636
|
+
baseUrl,
|
|
1637
|
+
`/api/v1/objects/${encode(objectSlug)}/records/upsert`,
|
|
1638
|
+
apiKey,
|
|
1639
|
+
{ method: "POST", body: {
|
|
1640
|
+
matching_attribute: matchingAttribute,
|
|
1641
|
+
values,
|
|
1642
|
+
...options.expectedRevision !== void 0 ? { expected_revision: options.expectedRevision } : {}
|
|
1643
|
+
} }
|
|
1644
|
+
);
|
|
1645
|
+
return resp.data;
|
|
1646
|
+
},
|
|
1647
|
+
/** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
|
|
1648
|
+
* Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
|
|
1649
|
+
* when permitted. Generic deal mutations are not yet supported.
|
|
1650
|
+
*/
|
|
1578
1651
|
async getRecord(objectSlug, recordId) {
|
|
1579
1652
|
const resp = await request(
|
|
1580
1653
|
baseUrl,
|
|
@@ -1588,15 +1661,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1588
1661
|
* required attributes you omit are left alone rather than reported missing.
|
|
1589
1662
|
* Sending an explicit `null` CLEARS that attribute.
|
|
1590
1663
|
*
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1664
|
+
* Custom values retain generations through `history`. Canonical contacts and
|
|
1665
|
+
* companies require expectedRevision from a fresh read and expose recorded
|
|
1666
|
+
* mutations through `changes`. They do not yet support appendValues/removeValues.
|
|
1593
1667
|
*/
|
|
1594
1668
|
async updateRecord(objectSlug, recordId, values, options) {
|
|
1595
1669
|
const resp = await request(
|
|
1596
1670
|
baseUrl,
|
|
1597
1671
|
`/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}`,
|
|
1598
1672
|
apiKey,
|
|
1599
|
-
{
|
|
1673
|
+
{
|
|
1674
|
+
method: "PATCH",
|
|
1675
|
+
body: {
|
|
1676
|
+
values,
|
|
1677
|
+
...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision },
|
|
1678
|
+
...options?.appendValues === void 0 ? {} : { append_values: options.appendValues },
|
|
1679
|
+
...options?.removeValues === void 0 ? {} : { remove_values: options.removeValues }
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1600
1682
|
);
|
|
1601
1683
|
return resp.data ?? resp;
|
|
1602
1684
|
},
|
|
@@ -1635,6 +1717,19 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1635
1717
|
{ query: limit != null ? { limit } : void 0 }
|
|
1636
1718
|
);
|
|
1637
1719
|
return resp.data ?? resp;
|
|
1720
|
+
},
|
|
1721
|
+
/** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
|
|
1722
|
+
* Canonical history respects current access/privacy; archived records and older
|
|
1723
|
+
* unrecorded writes are not reconstructed. Store unavailability returns 503.
|
|
1724
|
+
*/
|
|
1725
|
+
async changes(objectSlug, recordId, options = {}) {
|
|
1726
|
+
const resp = await request(
|
|
1727
|
+
baseUrl,
|
|
1728
|
+
`/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}/changes`,
|
|
1729
|
+
apiKey,
|
|
1730
|
+
{ query: options }
|
|
1731
|
+
);
|
|
1732
|
+
return resp.data ?? resp;
|
|
1638
1733
|
}
|
|
1639
1734
|
};
|
|
1640
1735
|
};
|