@graph8/sdk 0.13.1 → 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 +470 -18
- package/dist/index.d.ts +470 -18
- package/dist/index.js +434 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +431 -44
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +447 -12
- package/dist/react.d.ts +447 -12
- package/dist/react.js +426 -44
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +426 -44
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -865,6 +865,8 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
865
865
|
"engagement.email_bounced",
|
|
866
866
|
"engagement.email_skipped",
|
|
867
867
|
"engagement.call_dispatched",
|
|
868
|
+
"engagement.call_connected",
|
|
869
|
+
"engagement.call_graded",
|
|
868
870
|
"engagement.sms_sent",
|
|
869
871
|
"engagement.sms_replied",
|
|
870
872
|
"engagement.whatsapp_sent",
|
|
@@ -875,7 +877,12 @@ var KNOWN_WEBHOOK_EVENTS = [
|
|
|
875
877
|
"engagement.linkedin_connection_accepted",
|
|
876
878
|
"meeting.booked",
|
|
877
879
|
"meeting.cancelled",
|
|
878
|
-
"meeting.rescheduled"
|
|
880
|
+
"meeting.rescheduled",
|
|
881
|
+
"deal.won",
|
|
882
|
+
"crm.record.created",
|
|
883
|
+
"crm.record.updated",
|
|
884
|
+
"crm.record.archived",
|
|
885
|
+
"crm.record.restored"
|
|
879
886
|
];
|
|
880
887
|
var WebhookSignatureError = class extends Error {
|
|
881
888
|
constructor(message) {
|
|
@@ -1235,10 +1242,282 @@ var createAppsClient = (apiKey, apiUrl) => {
|
|
|
1235
1242
|
};
|
|
1236
1243
|
};
|
|
1237
1244
|
|
|
1238
|
-
// src/
|
|
1245
|
+
// src/appPlatform.ts
|
|
1239
1246
|
var DEFAULT_API18 = "https://be.graph8.com";
|
|
1240
|
-
var
|
|
1247
|
+
var createAppPlatformClient = (apiKey, apiUrl) => {
|
|
1241
1248
|
const baseUrl = apiUrl || DEFAULT_API18;
|
|
1249
|
+
const unwrap = (resp) => resp.data ?? resp;
|
|
1250
|
+
return {
|
|
1251
|
+
// ---- source binding -------------------------------------------------
|
|
1252
|
+
/**
|
|
1253
|
+
* Bind the repository an app builds from.
|
|
1254
|
+
*
|
|
1255
|
+
* `repo_url` must be fetchable -- `https://`, `ssh://` or `git@`, with no
|
|
1256
|
+
* whitespace. A `file://` or bare path is refused with 422, because a build
|
|
1257
|
+
* that can read the builder's filesystem is a build that can read ours.
|
|
1258
|
+
*
|
|
1259
|
+
* `credential_ref` is a POINTER into your secret manager, not a token.
|
|
1260
|
+
*/
|
|
1261
|
+
async setSource(appId, params) {
|
|
1262
|
+
const resp = await request(
|
|
1263
|
+
baseUrl,
|
|
1264
|
+
`/api/v1/apps/${appId}/source`,
|
|
1265
|
+
apiKey,
|
|
1266
|
+
{
|
|
1267
|
+
method: "PUT",
|
|
1268
|
+
body: {
|
|
1269
|
+
repo_url: params.repo_url,
|
|
1270
|
+
provider: params.provider,
|
|
1271
|
+
default_branch: params.default_branch ?? null,
|
|
1272
|
+
credential_ref: params.credential_ref ?? null
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
);
|
|
1276
|
+
return unwrap(resp);
|
|
1277
|
+
},
|
|
1278
|
+
/** Unbind the source. Returns the full app with every source field null. */
|
|
1279
|
+
async clearSource(appId) {
|
|
1280
|
+
const resp = await request(
|
|
1281
|
+
baseUrl,
|
|
1282
|
+
`/api/v1/apps/${appId}/source`,
|
|
1283
|
+
apiKey,
|
|
1284
|
+
{ method: "DELETE" }
|
|
1285
|
+
);
|
|
1286
|
+
return unwrap(resp);
|
|
1287
|
+
},
|
|
1288
|
+
// ---- deployments ----------------------------------------------------
|
|
1289
|
+
/** Every deployment for this app, newest first. Never 404s for an app with none. */
|
|
1290
|
+
async listDeployments(appId) {
|
|
1291
|
+
return request(baseUrl, `/api/v1/apps/${appId}/deployments`, apiKey);
|
|
1292
|
+
},
|
|
1293
|
+
/**
|
|
1294
|
+
* Queue a deployment. Returns `201` with `status: "queued"` -- nothing builds
|
|
1295
|
+
* as a side effect of this call; the build controller picks it up.
|
|
1296
|
+
*
|
|
1297
|
+
* NOT idempotent: two identical calls create two deployments.
|
|
1298
|
+
*/
|
|
1299
|
+
async deploy(appId, params) {
|
|
1300
|
+
const body = { source_ref: params.source_ref };
|
|
1301
|
+
if (params.schema_version_id) body.schema_version_id = params.schema_version_id;
|
|
1302
|
+
const resp = await request(
|
|
1303
|
+
baseUrl,
|
|
1304
|
+
`/api/v1/apps/${appId}/deployments`,
|
|
1305
|
+
apiKey,
|
|
1306
|
+
{ method: "POST", body }
|
|
1307
|
+
);
|
|
1308
|
+
return unwrap(resp);
|
|
1309
|
+
},
|
|
1310
|
+
/** Fetch one deployment. The polling endpoint for a build loop. */
|
|
1311
|
+
async getDeployment(appId, deploymentId) {
|
|
1312
|
+
const resp = await request(
|
|
1313
|
+
baseUrl,
|
|
1314
|
+
`/api/v1/apps/${appId}/deployments/${deploymentId}`,
|
|
1315
|
+
apiKey
|
|
1316
|
+
);
|
|
1317
|
+
return unwrap(resp);
|
|
1318
|
+
},
|
|
1319
|
+
/**
|
|
1320
|
+
* The deployment currently serving traffic, or `null`.
|
|
1321
|
+
*
|
|
1322
|
+
* `null` is a real answer with a 200, not a 404: "this app has never shipped"
|
|
1323
|
+
* is information, while a 404 would read as "no such app".
|
|
1324
|
+
*/
|
|
1325
|
+
async activeDeployment(appId) {
|
|
1326
|
+
const resp = await request(
|
|
1327
|
+
baseUrl,
|
|
1328
|
+
`/api/v1/apps/${appId}/deployments/active`,
|
|
1329
|
+
apiKey
|
|
1330
|
+
);
|
|
1331
|
+
return resp.data ?? null;
|
|
1332
|
+
},
|
|
1333
|
+
/**
|
|
1334
|
+
* Promote a built deployment to serve traffic. Anything it displaces moves to
|
|
1335
|
+
* `rolled_back` in the same transaction, so there is never a moment with two
|
|
1336
|
+
* live deployments.
|
|
1337
|
+
*
|
|
1338
|
+
* `409` when the state machine forbids it -- a deployment cannot become
|
|
1339
|
+
* `deployed` without having been built, and a `failed` one cannot be revived.
|
|
1340
|
+
* A retry is a new deployment, not a resurrection.
|
|
1341
|
+
*/
|
|
1342
|
+
async promote(appId, deploymentId, imageDigest) {
|
|
1343
|
+
const resp = await request(
|
|
1344
|
+
baseUrl,
|
|
1345
|
+
`/api/v1/apps/${appId}/deployments/${deploymentId}/promote`,
|
|
1346
|
+
apiKey,
|
|
1347
|
+
{ method: "POST", body: { image_digest: imageDigest } }
|
|
1348
|
+
);
|
|
1349
|
+
return unwrap(resp);
|
|
1350
|
+
},
|
|
1351
|
+
/** Roll back a deployment that is currently serving. Only a `deployed` one may be. */
|
|
1352
|
+
async rollback(appId, deploymentId) {
|
|
1353
|
+
const resp = await request(
|
|
1354
|
+
baseUrl,
|
|
1355
|
+
`/api/v1/apps/${appId}/deployments/${deploymentId}/rollback`,
|
|
1356
|
+
apiKey,
|
|
1357
|
+
{ method: "POST", body: {} }
|
|
1358
|
+
);
|
|
1359
|
+
return unwrap(resp);
|
|
1360
|
+
},
|
|
1361
|
+
// ---- logs -----------------------------------------------------------
|
|
1362
|
+
/**
|
|
1363
|
+
* Why a build failed. Returns every step of the build pod in the order
|
|
1364
|
+
* Kubernetes runs them; a step that has not started yet is omitted rather
|
|
1365
|
+
* than returned empty.
|
|
1366
|
+
*
|
|
1367
|
+
* An empty `containers` list is not an error -- build pods are reaped an hour
|
|
1368
|
+
* after they finish, so logs for an older deployment are genuinely gone.
|
|
1369
|
+
* `last_error_sanitized` on the deployment is what survives.
|
|
1370
|
+
*
|
|
1371
|
+
* `503` means graph8 could not reach the cluster, which is deliberately
|
|
1372
|
+
* different from an empty `200`: one means we could not look, the other means
|
|
1373
|
+
* your build produced no output.
|
|
1374
|
+
*/
|
|
1375
|
+
async deploymentLogs(appId, deploymentId, tailLines) {
|
|
1376
|
+
const resp = await request(
|
|
1377
|
+
baseUrl,
|
|
1378
|
+
`/api/v1/apps/${appId}/deployments/${deploymentId}/logs`,
|
|
1379
|
+
apiKey,
|
|
1380
|
+
{ query: tailLines === void 0 ? void 0 : { tail_lines: tailLines } }
|
|
1381
|
+
);
|
|
1382
|
+
return unwrap(resp);
|
|
1383
|
+
},
|
|
1384
|
+
/**
|
|
1385
|
+
* What the running app is printing. The app's own pods only -- the per-app
|
|
1386
|
+
* egress proxy shares the namespace and is deliberately excluded.
|
|
1387
|
+
*
|
|
1388
|
+
* Empty until a deployment reaches `deployed`.
|
|
1389
|
+
*/
|
|
1390
|
+
async logs(appId, tailLines) {
|
|
1391
|
+
const resp = await request(
|
|
1392
|
+
baseUrl,
|
|
1393
|
+
`/api/v1/apps/${appId}/logs`,
|
|
1394
|
+
apiKey,
|
|
1395
|
+
{ query: tailLines === void 0 ? void 0 : { tail_lines: tailLines } }
|
|
1396
|
+
);
|
|
1397
|
+
return unwrap(resp);
|
|
1398
|
+
},
|
|
1399
|
+
// ---- domains --------------------------------------------------------
|
|
1400
|
+
/** Every hostname claimed for this app, whatever its verification state. */
|
|
1401
|
+
async listDomains(appId) {
|
|
1402
|
+
return request(baseUrl, `/api/v1/apps/${appId}/domains`, apiKey);
|
|
1403
|
+
},
|
|
1404
|
+
/**
|
|
1405
|
+
* Claim a hostname and get the TXT record that proves you own it.
|
|
1406
|
+
*
|
|
1407
|
+
* Returns `201`, and the domain is NESTED at `data.domain` -- this is the one
|
|
1408
|
+
* route on the surface whose payload is not the record itself. Hostnames are
|
|
1409
|
+
* globally unique, so a host another app holds is refused.
|
|
1410
|
+
*/
|
|
1411
|
+
async claimDomain(appId, hostname) {
|
|
1412
|
+
const resp = await request(
|
|
1413
|
+
baseUrl,
|
|
1414
|
+
`/api/v1/apps/${appId}/domains`,
|
|
1415
|
+
apiKey,
|
|
1416
|
+
{ method: "POST", body: { hostname } }
|
|
1417
|
+
);
|
|
1418
|
+
return unwrap(resp);
|
|
1419
|
+
},
|
|
1420
|
+
/**
|
|
1421
|
+
* Check DNS for the TXT record and advance the domain to `verified`.
|
|
1422
|
+
*
|
|
1423
|
+
* Idempotent: verifying an already-verified domain re-checks and stays
|
|
1424
|
+
* verified, so it is safe to re-run after a DNS change. Send no body -- the
|
|
1425
|
+
* record in DNS is the payload.
|
|
1426
|
+
*/
|
|
1427
|
+
async verifyDomain(appId, hostname) {
|
|
1428
|
+
const resp = await request(
|
|
1429
|
+
baseUrl,
|
|
1430
|
+
`/api/v1/apps/${appId}/domains/${encodeURIComponent(hostname)}/verify`,
|
|
1431
|
+
apiKey,
|
|
1432
|
+
{ method: "POST", body: {} }
|
|
1433
|
+
);
|
|
1434
|
+
return unwrap(resp);
|
|
1435
|
+
},
|
|
1436
|
+
/**
|
|
1437
|
+
* Release a claimed hostname.
|
|
1438
|
+
*
|
|
1439
|
+
* A HARD delete. Hostnames are globally unique, so a row left behind in any
|
|
1440
|
+
* status keeps the host burned for every other builder. Releasing one you
|
|
1441
|
+
* already released is a `404`, because after the first call the claim
|
|
1442
|
+
* genuinely does not exist.
|
|
1443
|
+
*
|
|
1444
|
+
* Returns the NORMALIZED hostname, which may differ from what you passed.
|
|
1445
|
+
*/
|
|
1446
|
+
async releaseDomain(appId, hostname) {
|
|
1447
|
+
const resp = await request(
|
|
1448
|
+
baseUrl,
|
|
1449
|
+
`/api/v1/apps/${appId}/domains/${encodeURIComponent(hostname)}`,
|
|
1450
|
+
apiKey,
|
|
1451
|
+
{ method: "DELETE" }
|
|
1452
|
+
);
|
|
1453
|
+
return unwrap(resp);
|
|
1454
|
+
},
|
|
1455
|
+
// ---- secrets --------------------------------------------------------
|
|
1456
|
+
/**
|
|
1457
|
+
* Which secrets this app declares, and when each was last rotated.
|
|
1458
|
+
*
|
|
1459
|
+
* NEVER returns a value. graph8 stores a POINTER into your secret manager and
|
|
1460
|
+
* has no column for the secret itself.
|
|
1461
|
+
*/
|
|
1462
|
+
async listSecrets(appId) {
|
|
1463
|
+
return request(baseUrl, `/api/v1/apps/${appId}/secrets`, apiKey);
|
|
1464
|
+
},
|
|
1465
|
+
/**
|
|
1466
|
+
* Declare a secret, or rotate the pointer to it.
|
|
1467
|
+
*
|
|
1468
|
+
* `providerRef` is a REFERENCE, and the server rejects anything that looks
|
|
1469
|
+
* like a credential -- a value starting `bearer `, `sk-`, `ghp_`, `xox` and
|
|
1470
|
+
* friends is a 422. That refusal is the feature: it catches the mistake of
|
|
1471
|
+
* pasting the secret where its address belongs.
|
|
1472
|
+
*/
|
|
1473
|
+
async putSecret(appId, secretKey, providerRef) {
|
|
1474
|
+
const resp = await request(
|
|
1475
|
+
baseUrl,
|
|
1476
|
+
`/api/v1/apps/${appId}/secrets/${encodeURIComponent(secretKey)}`,
|
|
1477
|
+
apiKey,
|
|
1478
|
+
{ method: "PUT", body: { provider_ref: providerRef ?? null } }
|
|
1479
|
+
);
|
|
1480
|
+
return unwrap(resp);
|
|
1481
|
+
},
|
|
1482
|
+
/** Undeclare a secret. A key the app never declared is a 404, so a typo is
|
|
1483
|
+
* never reported as a successful removal. */
|
|
1484
|
+
async deleteSecret(appId, secretKey) {
|
|
1485
|
+
const resp = await request(
|
|
1486
|
+
baseUrl,
|
|
1487
|
+
`/api/v1/apps/${appId}/secrets/${encodeURIComponent(secretKey)}`,
|
|
1488
|
+
apiKey,
|
|
1489
|
+
{ method: "DELETE" }
|
|
1490
|
+
);
|
|
1491
|
+
return unwrap(resp);
|
|
1492
|
+
},
|
|
1493
|
+
// ---- schema versions ------------------------------------------------
|
|
1494
|
+
/**
|
|
1495
|
+
* Publish a custom-object schema version. Returns `201`.
|
|
1496
|
+
*
|
|
1497
|
+
* Takes only the `objects` list, not a whole `graph8.app.yaml`: the rest of
|
|
1498
|
+
* that file is app metadata the control plane already holds, and accepting it
|
|
1499
|
+
* here would create a second place for it to disagree.
|
|
1500
|
+
*/
|
|
1501
|
+
async publishSchemaVersion(appId, objects) {
|
|
1502
|
+
const resp = await request(
|
|
1503
|
+
baseUrl,
|
|
1504
|
+
`/api/v1/apps/${appId}/schema-versions`,
|
|
1505
|
+
apiKey,
|
|
1506
|
+
{ method: "POST", body: { objects } }
|
|
1507
|
+
);
|
|
1508
|
+
return unwrap(resp);
|
|
1509
|
+
},
|
|
1510
|
+
/** Every schema version this app has published. Empty array, never 404. */
|
|
1511
|
+
async listSchemaVersions(appId) {
|
|
1512
|
+
return request(baseUrl, `/api/v1/apps/${appId}/schema-versions`, apiKey);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
};
|
|
1516
|
+
|
|
1517
|
+
// src/fields.ts
|
|
1518
|
+
var DEFAULT_API19 = "https://be.graph8.com";
|
|
1519
|
+
var createFieldsClient = (apiKey, apiUrl) => {
|
|
1520
|
+
const baseUrl = apiUrl || DEFAULT_API19;
|
|
1242
1521
|
return {
|
|
1243
1522
|
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
1244
1523
|
async listContactFields(listId) {
|
|
@@ -1280,14 +1559,38 @@ var createFieldsClient = (apiKey, apiUrl) => {
|
|
|
1280
1559
|
};
|
|
1281
1560
|
|
|
1282
1561
|
// src/objects.ts
|
|
1283
|
-
var
|
|
1562
|
+
var DEFAULT_API20 = "https://be.graph8.com";
|
|
1284
1563
|
var createObjectsClient = (apiKey, apiUrl) => {
|
|
1285
|
-
const baseUrl = apiUrl ||
|
|
1564
|
+
const baseUrl = apiUrl || DEFAULT_API20;
|
|
1286
1565
|
const encode = (value) => encodeURIComponent(value);
|
|
1287
1566
|
return {
|
|
1288
1567
|
/** List the custom object types in your workspace. */
|
|
1289
|
-
async list() {
|
|
1290
|
-
|
|
1568
|
+
async list(params = {}) {
|
|
1569
|
+
const query = params.include_archived ? "?include_archived=true" : "";
|
|
1570
|
+
return request(baseUrl, `/api/v1/objects${query}`, apiKey);
|
|
1571
|
+
},
|
|
1572
|
+
/** Create a native custom object. Requires objects:manage and Admin access. */
|
|
1573
|
+
async create(input) {
|
|
1574
|
+
const resp = await request(baseUrl, "/api/v1/objects", apiKey, {
|
|
1575
|
+
method: "POST",
|
|
1576
|
+
body: input
|
|
1577
|
+
});
|
|
1578
|
+
return resp.data;
|
|
1579
|
+
},
|
|
1580
|
+
/** Rename, archive or restore an object while preserving its slug and data. */
|
|
1581
|
+
async update(objectSlug, input) {
|
|
1582
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
|
|
1583
|
+
method: "PATCH",
|
|
1584
|
+
body: input
|
|
1585
|
+
});
|
|
1586
|
+
return resp.data;
|
|
1587
|
+
},
|
|
1588
|
+
/** Archive the object without deleting records; restore with update({ is_archived: false }). */
|
|
1589
|
+
async archive(objectSlug) {
|
|
1590
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}`, apiKey, {
|
|
1591
|
+
method: "DELETE"
|
|
1592
|
+
});
|
|
1593
|
+
return resp.data;
|
|
1291
1594
|
},
|
|
1292
1595
|
/** Fetch one object type by slug. */
|
|
1293
1596
|
async get(objectSlug) {
|
|
@@ -1299,10 +1602,35 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1299
1602
|
return resp.data ?? resp;
|
|
1300
1603
|
},
|
|
1301
1604
|
/** The object's attributes — the schema its records must satisfy. */
|
|
1302
|
-
async listAttributes(objectSlug) {
|
|
1303
|
-
|
|
1605
|
+
async listAttributes(objectSlug, params = {}) {
|
|
1606
|
+
const query = params.include_archived ? "?include_archived=true" : "";
|
|
1607
|
+
return request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes${query}`, apiKey);
|
|
1608
|
+
},
|
|
1609
|
+
/** Create a field using the same schema rules as the customer UI. */
|
|
1610
|
+
async createAttribute(objectSlug, input) {
|
|
1611
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes`, apiKey, {
|
|
1612
|
+
method: "POST",
|
|
1613
|
+
body: input
|
|
1614
|
+
});
|
|
1615
|
+
return resp.data;
|
|
1304
1616
|
},
|
|
1305
|
-
/**
|
|
1617
|
+
/** Edit or restore a field; its type and slug are immutable. */
|
|
1618
|
+
async updateAttribute(objectSlug, attributeSlug, input) {
|
|
1619
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
|
|
1620
|
+
method: "PATCH",
|
|
1621
|
+
body: input
|
|
1622
|
+
});
|
|
1623
|
+
return resp.data;
|
|
1624
|
+
},
|
|
1625
|
+
/** Archive without deleting values; restore with updateAttribute({ is_archived: false }). */
|
|
1626
|
+
async archiveAttribute(objectSlug, attributeSlug) {
|
|
1627
|
+
const resp = await request(baseUrl, `/api/v1/objects/${encode(objectSlug)}/attributes/${encode(attributeSlug)}`, apiKey, {
|
|
1628
|
+
method: "DELETE"
|
|
1629
|
+
});
|
|
1630
|
+
return resp.data;
|
|
1631
|
+
},
|
|
1632
|
+
/** Paginated custom records or canonical deals with current values and revisions.
|
|
1633
|
+
* Deal totals and related references respect current record access. */
|
|
1306
1634
|
async listRecords(objectSlug, params = {}) {
|
|
1307
1635
|
const query = {};
|
|
1308
1636
|
if (params.page != null) query.page = params.page;
|
|
@@ -1326,7 +1654,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1326
1654
|
);
|
|
1327
1655
|
return resp.data ?? resp;
|
|
1328
1656
|
},
|
|
1329
|
-
/**
|
|
1657
|
+
/** Match a unique single-value key, creating or updating while preserving omitted fields. */
|
|
1658
|
+
async upsertRecord(objectSlug, matchingAttribute, values, options = {}) {
|
|
1659
|
+
const resp = await request(
|
|
1660
|
+
baseUrl,
|
|
1661
|
+
`/api/v1/objects/${encode(objectSlug)}/records/upsert`,
|
|
1662
|
+
apiKey,
|
|
1663
|
+
{ method: "POST", body: {
|
|
1664
|
+
matching_attribute: matchingAttribute,
|
|
1665
|
+
values,
|
|
1666
|
+
...options.expectedRevision !== void 0 ? { expected_revision: options.expectedRevision } : {}
|
|
1667
|
+
} }
|
|
1668
|
+
);
|
|
1669
|
+
return resp.data;
|
|
1670
|
+
},
|
|
1671
|
+
/** Fetch one custom record, canonical contact/company, or deal by its stable graph8 ID.
|
|
1672
|
+
* Deals retain their UUIDs and expose company, primary-contact and contact_ids references only
|
|
1673
|
+
* when permitted. Generic deal mutations are not yet supported.
|
|
1674
|
+
*/
|
|
1330
1675
|
async getRecord(objectSlug, recordId) {
|
|
1331
1676
|
const resp = await request(
|
|
1332
1677
|
baseUrl,
|
|
@@ -1340,15 +1685,24 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1340
1685
|
* required attributes you omit are left alone rather than reported missing.
|
|
1341
1686
|
* Sending an explicit `null` CLEARS that attribute.
|
|
1342
1687
|
*
|
|
1343
|
-
*
|
|
1344
|
-
*
|
|
1688
|
+
* Custom values retain generations through `history`. Canonical contacts and
|
|
1689
|
+
* companies require expectedRevision from a fresh read and expose recorded
|
|
1690
|
+
* mutations through `changes`. They do not yet support appendValues/removeValues.
|
|
1345
1691
|
*/
|
|
1346
1692
|
async updateRecord(objectSlug, recordId, values, options) {
|
|
1347
1693
|
const resp = await request(
|
|
1348
1694
|
baseUrl,
|
|
1349
1695
|
`/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}`,
|
|
1350
1696
|
apiKey,
|
|
1351
|
-
{
|
|
1697
|
+
{
|
|
1698
|
+
method: "PATCH",
|
|
1699
|
+
body: {
|
|
1700
|
+
values,
|
|
1701
|
+
...options?.expectedRevision === void 0 ? {} : { expected_revision: options.expectedRevision },
|
|
1702
|
+
...options?.appendValues === void 0 ? {} : { append_values: options.appendValues },
|
|
1703
|
+
...options?.removeValues === void 0 ? {} : { remove_values: options.removeValues }
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1352
1706
|
);
|
|
1353
1707
|
return resp.data ?? resp;
|
|
1354
1708
|
},
|
|
@@ -1387,14 +1741,27 @@ var createObjectsClient = (apiKey, apiUrl) => {
|
|
|
1387
1741
|
{ query: limit != null ? { limit } : void 0 }
|
|
1388
1742
|
);
|
|
1389
1743
|
return resp.data ?? resp;
|
|
1744
|
+
},
|
|
1745
|
+
/** Recorded custom-record or canonical contact/company mutations. Pass next_cursor to continue.
|
|
1746
|
+
* Canonical history respects current access/privacy; archived records and older
|
|
1747
|
+
* unrecorded writes are not reconstructed. Store unavailability returns 503.
|
|
1748
|
+
*/
|
|
1749
|
+
async changes(objectSlug, recordId, options = {}) {
|
|
1750
|
+
const resp = await request(
|
|
1751
|
+
baseUrl,
|
|
1752
|
+
`/api/v1/objects/${encode(objectSlug)}/records/${encode(recordId)}/changes`,
|
|
1753
|
+
apiKey,
|
|
1754
|
+
{ query: options }
|
|
1755
|
+
);
|
|
1756
|
+
return resp.data ?? resp;
|
|
1390
1757
|
}
|
|
1391
1758
|
};
|
|
1392
1759
|
};
|
|
1393
1760
|
|
|
1394
1761
|
// src/deals.ts
|
|
1395
|
-
var
|
|
1762
|
+
var DEFAULT_API21 = "https://be.graph8.com";
|
|
1396
1763
|
var createDealsClient = (apiKey, apiUrl) => {
|
|
1397
|
-
const baseUrl = apiUrl ||
|
|
1764
|
+
const baseUrl = apiUrl || DEFAULT_API21;
|
|
1398
1765
|
return {
|
|
1399
1766
|
/** List all deal pipelines and their stages. */
|
|
1400
1767
|
async pipelines() {
|
|
@@ -1438,9 +1805,9 @@ var createDealsClient = (apiKey, apiUrl) => {
|
|
|
1438
1805
|
};
|
|
1439
1806
|
|
|
1440
1807
|
// src/inbox.ts
|
|
1441
|
-
var
|
|
1808
|
+
var DEFAULT_API22 = "https://be.graph8.com";
|
|
1442
1809
|
var createInboxClient = (apiKey, apiUrl) => {
|
|
1443
|
-
const baseUrl = apiUrl ||
|
|
1810
|
+
const baseUrl = apiUrl || DEFAULT_API22;
|
|
1444
1811
|
return {
|
|
1445
1812
|
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
1446
1813
|
async list(params = {}) {
|
|
@@ -1493,9 +1860,9 @@ var createInboxClient = (apiKey, apiUrl) => {
|
|
|
1493
1860
|
};
|
|
1494
1861
|
|
|
1495
1862
|
// src/quotes.ts
|
|
1496
|
-
var
|
|
1863
|
+
var DEFAULT_API23 = "https://be.graph8.com";
|
|
1497
1864
|
var createQuotesClient = (apiKey, apiUrl) => {
|
|
1498
|
-
const baseUrl = apiUrl ||
|
|
1865
|
+
const baseUrl = apiUrl || DEFAULT_API23;
|
|
1499
1866
|
return {
|
|
1500
1867
|
/** List quotes org-wide with optional filters and pagination. */
|
|
1501
1868
|
async list(params = {}) {
|
|
@@ -1567,9 +1934,9 @@ var createQuotesClient = (apiKey, apiUrl) => {
|
|
|
1567
1934
|
};
|
|
1568
1935
|
|
|
1569
1936
|
// src/pipelines.ts
|
|
1570
|
-
var
|
|
1937
|
+
var DEFAULT_API24 = "https://be.graph8.com";
|
|
1571
1938
|
var createPipelinesClient = (apiKey, apiUrl) => {
|
|
1572
|
-
const baseUrl = apiUrl ||
|
|
1939
|
+
const baseUrl = apiUrl || DEFAULT_API24;
|
|
1573
1940
|
return {
|
|
1574
1941
|
/** List all stage-checklist pipelines with stages, evidence, scripts. */
|
|
1575
1942
|
async list() {
|
|
@@ -1651,9 +2018,9 @@ var createPipelinesClient = (apiKey, apiUrl) => {
|
|
|
1651
2018
|
};
|
|
1652
2019
|
|
|
1653
2020
|
// src/workflows.ts
|
|
1654
|
-
var
|
|
2021
|
+
var DEFAULT_API25 = "https://be.graph8.com";
|
|
1655
2022
|
var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
1656
|
-
const baseUrl = apiUrl ||
|
|
2023
|
+
const baseUrl = apiUrl || DEFAULT_API25;
|
|
1657
2024
|
return {
|
|
1658
2025
|
/** List workflows org-wide. */
|
|
1659
2026
|
async list(params = {}) {
|
|
@@ -1769,9 +2136,9 @@ var createWorkflowsClient = (apiKey, apiUrl) => {
|
|
|
1769
2136
|
};
|
|
1770
2137
|
|
|
1771
2138
|
// src/skills.ts
|
|
1772
|
-
var
|
|
2139
|
+
var DEFAULT_API26 = "https://be.graph8.com";
|
|
1773
2140
|
var createSkillsClient = (apiKey, apiUrl) => {
|
|
1774
|
-
const baseUrl = apiUrl ||
|
|
2141
|
+
const baseUrl = apiUrl || DEFAULT_API26;
|
|
1775
2142
|
return {
|
|
1776
2143
|
/** List skills. */
|
|
1777
2144
|
async list(params = {}) {
|
|
@@ -1858,9 +2225,9 @@ var createSkillsClient = (apiKey, apiUrl) => {
|
|
|
1858
2225
|
};
|
|
1859
2226
|
|
|
1860
2227
|
// src/intent.ts
|
|
1861
|
-
var
|
|
2228
|
+
var DEFAULT_API27 = "https://be.graph8.com";
|
|
1862
2229
|
var createIntentClient = (apiKey, apiUrl) => {
|
|
1863
|
-
const baseUrl = apiUrl ||
|
|
2230
|
+
const baseUrl = apiUrl || DEFAULT_API27;
|
|
1864
2231
|
const get = (path) => request(baseUrl, `/api/v1${path}`, apiKey);
|
|
1865
2232
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1866
2233
|
const del = (path) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "DELETE" });
|
|
@@ -1935,9 +2302,9 @@ var createIntentClient = (apiKey, apiUrl) => {
|
|
|
1935
2302
|
};
|
|
1936
2303
|
|
|
1937
2304
|
// src/studio.ts
|
|
1938
|
-
var
|
|
2305
|
+
var DEFAULT_API28 = "https://be.graph8.com";
|
|
1939
2306
|
var createStudioClient = (apiKey, apiUrl) => {
|
|
1940
|
-
const baseUrl = apiUrl ||
|
|
2307
|
+
const baseUrl = apiUrl || DEFAULT_API28;
|
|
1941
2308
|
const get = (path, params = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { query: params });
|
|
1942
2309
|
const post = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "POST", body });
|
|
1943
2310
|
const patch = (path, body = {}) => request(baseUrl, `/api/v1${path}`, apiKey, { method: "PATCH", body });
|
|
@@ -1992,9 +2359,9 @@ var createStudioClient = (apiKey, apiUrl) => {
|
|
|
1992
2359
|
};
|
|
1993
2360
|
|
|
1994
2361
|
// src/meetings.ts
|
|
1995
|
-
var
|
|
2362
|
+
var DEFAULT_API29 = "https://be.graph8.com";
|
|
1996
2363
|
var createMeetingsClient = (apiKey, apiUrl) => {
|
|
1997
|
-
const baseUrl = apiUrl ||
|
|
2364
|
+
const baseUrl = apiUrl || DEFAULT_API29;
|
|
1998
2365
|
return {
|
|
1999
2366
|
/** List meetings with optional filters. Returns summary rows without transcript / analysis. */
|
|
2000
2367
|
async list(params = {}) {
|
|
@@ -2009,9 +2376,9 @@ var createMeetingsClient = (apiKey, apiUrl) => {
|
|
|
2009
2376
|
};
|
|
2010
2377
|
|
|
2011
2378
|
// src/audiences.ts
|
|
2012
|
-
var
|
|
2379
|
+
var DEFAULT_API30 = "https://be.graph8.com";
|
|
2013
2380
|
var createAudiencesClient = (apiKey, apiUrl) => {
|
|
2014
|
-
const baseUrl = apiUrl ||
|
|
2381
|
+
const baseUrl = apiUrl || DEFAULT_API30;
|
|
2015
2382
|
const base = "/api/v1/audience-syncs";
|
|
2016
2383
|
return {
|
|
2017
2384
|
/** List all audience syncs for the organization. */
|
|
@@ -2059,9 +2426,9 @@ var createAudiencesClient = (apiKey, apiUrl) => {
|
|
|
2059
2426
|
};
|
|
2060
2427
|
|
|
2061
2428
|
// src/search.ts
|
|
2062
|
-
var
|
|
2429
|
+
var DEFAULT_API31 = "https://be.graph8.com";
|
|
2063
2430
|
var createSearchClient = (apiKey, apiUrl) => {
|
|
2064
|
-
const baseUrl = apiUrl ||
|
|
2431
|
+
const baseUrl = apiUrl || DEFAULT_API31;
|
|
2065
2432
|
const body = (p) => ({ filters: [], page: 1, limit: 25, ...p });
|
|
2066
2433
|
return {
|
|
2067
2434
|
/** Search open-data contacts by filter. */
|
|
@@ -2092,9 +2459,9 @@ var createSearchClient = (apiKey, apiUrl) => {
|
|
|
2092
2459
|
};
|
|
2093
2460
|
|
|
2094
2461
|
// src/agency.ts
|
|
2095
|
-
var
|
|
2462
|
+
var DEFAULT_API32 = "https://be.graph8.com";
|
|
2096
2463
|
var createAgencyClient = (apiKey, apiUrl) => {
|
|
2097
|
-
const baseUrl = apiUrl ||
|
|
2464
|
+
const baseUrl = apiUrl || DEFAULT_API32;
|
|
2098
2465
|
return {
|
|
2099
2466
|
/** Describe the agency credential: agency org + authorized client count. */
|
|
2100
2467
|
async me() {
|
|
@@ -2109,9 +2476,9 @@ var createAgencyClient = (apiKey, apiUrl) => {
|
|
|
2109
2476
|
};
|
|
2110
2477
|
|
|
2111
2478
|
// src/marketplace.ts
|
|
2112
|
-
var
|
|
2479
|
+
var DEFAULT_API33 = "https://be.graph8.com";
|
|
2113
2480
|
var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
2114
|
-
const baseUrl = apiUrl ||
|
|
2481
|
+
const baseUrl = apiUrl || DEFAULT_API33;
|
|
2115
2482
|
const base = "/api/v1/marketplace";
|
|
2116
2483
|
return {
|
|
2117
2484
|
/** Your own marketplace SDR profile. */
|
|
@@ -2161,9 +2528,9 @@ var createMarketplaceClient = (apiKey, apiUrl) => {
|
|
|
2161
2528
|
};
|
|
2162
2529
|
|
|
2163
2530
|
// src/snippet.ts
|
|
2164
|
-
var
|
|
2531
|
+
var DEFAULT_API34 = "https://be.graph8.com";
|
|
2165
2532
|
var createSnippetClient = (apiKey, apiUrl) => {
|
|
2166
|
-
const baseUrl = apiUrl ||
|
|
2533
|
+
const baseUrl = apiUrl || DEFAULT_API34;
|
|
2167
2534
|
return {
|
|
2168
2535
|
/** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
|
|
2169
2536
|
async get() {
|
|
@@ -2175,7 +2542,7 @@ var createSnippetClient = (apiKey, apiUrl) => {
|
|
|
2175
2542
|
|
|
2176
2543
|
// src/core.ts
|
|
2177
2544
|
var DEFAULT_HOST = "https://t.graph8.com";
|
|
2178
|
-
var
|
|
2545
|
+
var DEFAULT_API35 = "https://be.graph8.com";
|
|
2179
2546
|
var G8 = class {
|
|
2180
2547
|
constructor() {
|
|
2181
2548
|
/** @internal */
|
|
@@ -2219,6 +2586,8 @@ var G8 = class {
|
|
|
2219
2586
|
/** @internal */
|
|
2220
2587
|
this._apps = null;
|
|
2221
2588
|
/** @internal */
|
|
2589
|
+
this._appPlatform = null;
|
|
2590
|
+
/** @internal */
|
|
2222
2591
|
this._objects = null;
|
|
2223
2592
|
/** @internal */
|
|
2224
2593
|
this._deals = null;
|
|
@@ -2262,7 +2631,7 @@ var G8 = class {
|
|
|
2262
2631
|
debug: config.debug
|
|
2263
2632
|
});
|
|
2264
2633
|
}
|
|
2265
|
-
const apiUrl = config.apiUrl ||
|
|
2634
|
+
const apiUrl = config.apiUrl || DEFAULT_API35;
|
|
2266
2635
|
const writeKey = config.writeKey || "";
|
|
2267
2636
|
const apiKey = config.apiKey || "";
|
|
2268
2637
|
if (writeKey) {
|
|
@@ -2286,6 +2655,7 @@ var G8 = class {
|
|
|
2286
2655
|
this._tasks = createTasksClient(apiKey, apiUrl);
|
|
2287
2656
|
this._fields = createFieldsClient(apiKey, apiUrl);
|
|
2288
2657
|
this._apps = createAppsClient(apiKey, apiUrl);
|
|
2658
|
+
this._appPlatform = createAppPlatformClient(apiKey, apiUrl);
|
|
2289
2659
|
this._objects = createObjectsClient(apiKey, apiUrl);
|
|
2290
2660
|
this._deals = createDealsClient(apiKey, apiUrl);
|
|
2291
2661
|
this._inbox = createInboxClient(apiKey, apiUrl);
|
|
@@ -2412,6 +2782,18 @@ var G8 = class {
|
|
|
2412
2782
|
this._assertKey("apps");
|
|
2413
2783
|
return this._apps;
|
|
2414
2784
|
}
|
|
2785
|
+
/**
|
|
2786
|
+
* Ship a hosted app: bind a source, deploy, promote, attach a hostname, read
|
|
2787
|
+
* build logs (requires API key). PREVIEW.
|
|
2788
|
+
*
|
|
2789
|
+
* Separate from `apps` on purpose. `apps` is the app's IDENTITY -- create it,
|
|
2790
|
+
* see who installed it, what it cost. This is its LIFECYCLE, and the two have
|
|
2791
|
+
* different blast radii: a mistake here takes a customer's app down.
|
|
2792
|
+
*/
|
|
2793
|
+
get appPlatform() {
|
|
2794
|
+
this._assertKey("appPlatform");
|
|
2795
|
+
return this._appPlatform;
|
|
2796
|
+
}
|
|
2415
2797
|
/** Custom object types, their schema, and their records (requires API key). PREVIEW. */
|
|
2416
2798
|
get objects() {
|
|
2417
2799
|
this._assertKey("objects");
|