@xberg-io/sdk 0.10.0 → 0.11.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/dist/index.d.ts +1633 -182
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -473,7 +473,7 @@ const SUCCESS_JOB_STATUSES = ["completed", "partial_success"];
|
|
|
473
473
|
* and defaults to `baseUrl`. The backend methods use that origin and an optional
|
|
474
474
|
* separate `controlPlaneToken`; existing Pro methods retain their data-plane routing.
|
|
475
475
|
*/
|
|
476
|
-
const USER_AGENT = `xberg-io-sdk-typescript/0.
|
|
476
|
+
const USER_AGENT = `xberg-io-sdk-typescript/0.11.0`;
|
|
477
477
|
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
478
478
|
const DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
479
479
|
const DEFAULT_WAIT_TIMEOUT_MS = 3e5;
|
|
@@ -955,7 +955,7 @@ var XbergClient = class {
|
|
|
955
955
|
const documentIds = prepareDocumentLineage(filenames, params.documentIds);
|
|
956
956
|
if (documentIds.size > 0) await this.requireTier("enterprise", "extract document lineage");
|
|
957
957
|
if (params.projectId !== void 0) await this.requireTier("pro", "projectId");
|
|
958
|
-
const projectHeader =
|
|
958
|
+
const projectHeader = this.projectHeaderName();
|
|
959
959
|
const form = new FormData();
|
|
960
960
|
for (const [filename, documentId] of documentIds) form.append(`document_id-${filename}`, documentId);
|
|
961
961
|
const parts = params.files.map(toBlob);
|
|
@@ -1390,6 +1390,42 @@ var XbergClient = class {
|
|
|
1390
1390
|
await this.requireTier("pro", "createProject");
|
|
1391
1391
|
return this.requestJson("POST", "/v1/projects", { json: body });
|
|
1392
1392
|
}
|
|
1393
|
+
/** Pro only: read a live project visible to the caller. */
|
|
1394
|
+
async proGetProject(projectId) {
|
|
1395
|
+
await this.requireTier("pro", "proGetProject");
|
|
1396
|
+
return this.requestJson("GET", this.projectPath(projectId));
|
|
1397
|
+
}
|
|
1398
|
+
/** Pro only: rename a project. */
|
|
1399
|
+
async proUpdateProject(projectId, body) {
|
|
1400
|
+
await this.requireTier("pro", "proUpdateProject");
|
|
1401
|
+
return this.requestJson("PATCH", this.projectPath(projectId), { json: body });
|
|
1402
|
+
}
|
|
1403
|
+
/** Pro only: soft-delete a project and revoke its API keys. */
|
|
1404
|
+
async proDeleteProject(projectId) {
|
|
1405
|
+
await this.requireTier("pro", "proDeleteProject");
|
|
1406
|
+
await this.requestJson("DELETE", this.projectPath(projectId));
|
|
1407
|
+
}
|
|
1408
|
+
/** Enterprise only: read the project's stored extraction defaults. */
|
|
1409
|
+
async getProjectExtractionConfig(projectId) {
|
|
1410
|
+
await this.requireTier("enterprise", "getProjectExtractionConfig");
|
|
1411
|
+
const projectHeader = this.projectHeaderName();
|
|
1412
|
+
return this.requestJson("GET", `${this.projectPath(projectId)}/extraction-config`, { headers: { [projectHeader]: projectId } });
|
|
1413
|
+
}
|
|
1414
|
+
/** Enterprise only: replace the project's stored extraction defaults. */
|
|
1415
|
+
async setProjectExtractionConfig(projectId, body) {
|
|
1416
|
+
await this.requireTier("enterprise", "setProjectExtractionConfig");
|
|
1417
|
+
const projectHeader = this.projectHeaderName();
|
|
1418
|
+
return this.requestJson("PUT", `${this.projectPath(projectId)}/extraction-config`, {
|
|
1419
|
+
headers: { [projectHeader]: projectId },
|
|
1420
|
+
json: body
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
/** Enterprise only: clear the project's stored extraction defaults. */
|
|
1424
|
+
async clearProjectExtractionConfig(projectId) {
|
|
1425
|
+
await this.requireTier("enterprise", "clearProjectExtractionConfig");
|
|
1426
|
+
const projectHeader = this.projectHeaderName();
|
|
1427
|
+
await this.requestJson("DELETE", `${this.projectPath(projectId)}/extraction-config`, { headers: { [projectHeader]: projectId } });
|
|
1428
|
+
}
|
|
1393
1429
|
/** Pro only: list a project's API keys (`GET /v1/projects/{projectId}/api-keys`). */
|
|
1394
1430
|
async listApiKeys(projectId, params = {}) {
|
|
1395
1431
|
await this.requireTier("pro", "listApiKeys");
|
|
@@ -1755,6 +1791,33 @@ var XbergClient = class {
|
|
|
1755
1791
|
await this.requireTier("enterprise", "transferRoomOwnership");
|
|
1756
1792
|
await this.requestJson("POST", `${this.roomPath(roomId)}/ownership`, { json: body });
|
|
1757
1793
|
}
|
|
1794
|
+
/** Enterprise only: list a data room's share links. */
|
|
1795
|
+
async listRoomLinks(roomId, params = {}) {
|
|
1796
|
+
await this.requireTier("enterprise", "listRoomLinks");
|
|
1797
|
+
return this.requestJson("GET", `${this.roomPath(roomId)}/links`, { params: {
|
|
1798
|
+
limit: params.limit,
|
|
1799
|
+
offset: params.offset
|
|
1800
|
+
} });
|
|
1801
|
+
}
|
|
1802
|
+
/** Enterprise only: create a share link for a data room. */
|
|
1803
|
+
async createRoomLink(roomId, body) {
|
|
1804
|
+
await this.requireTier("enterprise", "createRoomLink");
|
|
1805
|
+
return this.requestJson("POST", `${this.roomPath(roomId)}/links`, { json: body });
|
|
1806
|
+
}
|
|
1807
|
+
/** Enterprise only: revoke a data room share link and its grants. */
|
|
1808
|
+
async revokeRoomLink(roomId, linkId) {
|
|
1809
|
+
await this.requireTier("enterprise", "revokeRoomLink");
|
|
1810
|
+
await this.requestJson("DELETE", `${this.roomPath(roomId)}/links/${encodePathSegment(linkId)}`);
|
|
1811
|
+
}
|
|
1812
|
+
/** Enterprise only: accept a share link with a signed-in user's session. */
|
|
1813
|
+
async acceptRoomLink(body, options = {}) {
|
|
1814
|
+
const bearer = sessionBearer(options);
|
|
1815
|
+
await this.requireTier("enterprise", "acceptRoomLink");
|
|
1816
|
+
return this.requestJson("POST", "/v1/room-links/accept", {
|
|
1817
|
+
json: body,
|
|
1818
|
+
...bearer
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1758
1821
|
/**
|
|
1759
1822
|
* Enterprise only: list a room's invitations (`GET /v1/rooms/{id}/invitations`).
|
|
1760
1823
|
* The answer never carries an invitation token.
|
|
@@ -1885,6 +1948,9 @@ var XbergClient = class {
|
|
|
1885
1948
|
if (scope.projectId !== void 0) await this.requireTier("pro", "projectId");
|
|
1886
1949
|
return { project_id: scope.projectId };
|
|
1887
1950
|
}
|
|
1951
|
+
projectHeaderName() {
|
|
1952
|
+
return Object.keys(this.headers).find((name) => name.toLowerCase() === "x-project-id") ?? "X-Project-ID";
|
|
1953
|
+
}
|
|
1888
1954
|
/** Build `/v1/projects/{projectId}` with the id percent-encoded. */
|
|
1889
1955
|
projectPath(projectId) {
|
|
1890
1956
|
return `/v1/projects/${encodePathSegment(projectId)}`;
|