@xberg-io/sdk 0.11.0 → 0.12.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.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.11.0`;
476
+ const USER_AGENT = `xberg-io-sdk-typescript/0.12.0`;
477
477
  const DEFAULT_TIMEOUT_MS = 3e4;
478
478
  const DEFAULT_POLL_INTERVAL_MS = 1e3;
479
479
  const DEFAULT_WAIT_TIMEOUT_MS = 3e5;
@@ -672,6 +672,10 @@ var XbergClient = class {
672
672
  async backendCreateApiKey(projectId, body) {
673
673
  return await this.backendRequest("POST", `/v1/projects/${encodePathSegment(projectId)}/api-keys`, { json: body });
674
674
  }
675
+ /** Enterprise backend: issue an API key restricted to a custom project role. */
676
+ async backendCreateRoleBoundApiKey(projectId, body) {
677
+ return await this.backendRequest("POST", `${this.projectPath(projectId)}/api-keys/role-bound`, { json: body });
678
+ }
675
679
  /** Enterprise backend `DELETE /v1/projects/{id}/api-keys/{key_id}`. */
676
680
  async backendRevokeApiKey(projectId, apiKeyId) {
677
681
  return await this.backendRequest("DELETE", `/v1/projects/${encodePathSegment(projectId)}/api-keys/${encodePathSegment(apiKeyId)}`);
@@ -839,11 +843,23 @@ var XbergClient = class {
839
843
  }
840
844
  /** Enterprise backend `PUT /v1/projects/{project_id}/saml/providers/{provider_id}`. */
841
845
  async updateSamlProvider(projectId, providerId, body) {
842
- return await this.backendRequest("PUT", `/v1/projects/${encodePathSegment(projectId)}/saml/providers/${encodePathSegment(providerId)}`, { json: body });
846
+ return await this.backendRequest("PUT", this.samlProviderPath(projectId, providerId), { json: body });
847
+ }
848
+ /** Enterprise backend: replace a SAML provider's attribute mapping. */
849
+ async updateSamlAttributeMapping(projectId, providerId, body) {
850
+ return await this.backendRequest("PATCH", `${this.samlProviderPath(projectId, providerId)}/attribute-mapping`, { json: body });
851
+ }
852
+ /** Enterprise backend: start a SAML test and return its browser redirect. */
853
+ async startSamlConnectionTest(projectId, providerId) {
854
+ return await this.backendRequest("POST", `${this.samlProviderPath(projectId, providerId)}/test`);
855
+ }
856
+ /** Enterprise backend: check the status of a SAML connection test. */
857
+ async getSamlConnectionTestStatus(projectId, providerId, testId) {
858
+ return await this.backendRequest("GET", `${this.samlProviderPath(projectId, providerId)}/test/${encodePathSegment(testId)}`);
843
859
  }
844
860
  /** Enterprise backend `DELETE /v1/projects/{project_id}/saml/providers/{provider_id}`. */
845
861
  async deleteSamlProvider(projectId, providerId) {
846
- return await this.backendRequest("DELETE", `/v1/projects/${encodePathSegment(projectId)}/saml/providers/${encodePathSegment(providerId)}`);
862
+ return await this.backendRequest("DELETE", this.samlProviderPath(projectId, providerId));
847
863
  }
848
864
  /** Enterprise backend `POST /v1/projects/{id}/sandbox/extract`. */
849
865
  async sandboxExtract(projectId, params) {
@@ -869,6 +885,10 @@ var XbergClient = class {
869
885
  async rotateScimConnectionSecret(projectId, connectionId) {
870
886
  return await this.backendRequest("POST", `/v1/projects/${encodePathSegment(projectId)}/scim/connections/${encodePathSegment(connectionId)}/rotate`);
871
887
  }
888
+ /** Enterprise backend: revoke a SCIM connection. */
889
+ async revokeScimConnection(projectId, connectionId) {
890
+ return await this.backendRequest("POST", `${this.projectPath(projectId)}/scim/connections/${encodePathSegment(connectionId)}/revoke`);
891
+ }
872
892
  /** Enterprise backend `GET /v1/projects/{id}/usage`. */
873
893
  async getUsage(projectId, params) {
874
894
  return await this.backendRequest("GET", `/v1/projects/${encodePathSegment(projectId)}/usage`, { params: {
@@ -1112,6 +1132,18 @@ var XbergClient = class {
1112
1132
  async deleteRagCollection(name) {
1113
1133
  await this.requestJson("DELETE", `/v1/rag/collections/${encodePathSegment(name)}`);
1114
1134
  }
1135
+ /** List the documents in a RAG collection, using the returned cursor for the next page. */
1136
+ async listRagDocuments(name, params = {}) {
1137
+ const { limit, cursor, projectId } = params;
1138
+ if (projectId !== void 0) await this.requireTier("pro", "projectId");
1139
+ return await this.requestJson("GET", `/v1/rag/collections/${encodePathSegment(name)}/documents`, {
1140
+ params: {
1141
+ limit,
1142
+ cursor
1143
+ },
1144
+ ...projectId !== void 0 ? { headers: { [this.projectHeaderName()]: projectId } } : {}
1145
+ });
1146
+ }
1115
1147
  /** Add documents to a RAG collection (`POST /v1/rag/collections/{name}/documents`). */
1116
1148
  async addRagDocuments(name, body) {
1117
1149
  return await this.requestJson("POST", `/v1/rag/collections/${encodePathSegment(name)}/documents`, { json: body });
@@ -1275,6 +1307,11 @@ var XbergClient = class {
1275
1307
  const path = `${JOBS_PATH}/${encodePathSegment(jobId)}/pages/${encodePathSegment(String(pageNumber))}`;
1276
1308
  return await this.requestBytes("GET", path, { params: await this.jobScope(scope) });
1277
1309
  }
1310
+ /** Pro only: list the available rendered page numbers for an extraction job. */
1311
+ async getJobPageInventory(jobId, scope = {}) {
1312
+ await this.requireTier("pro", "getJobPageInventory");
1313
+ return await this.requestJson("GET", `${JOBS_PATH}/${encodePathSegment(jobId)}/pages`, { params: { project_id: scope.projectId } });
1314
+ }
1278
1315
  /** Submit text for enrichment (`POST /v1/enrich`). */
1279
1316
  async submitEnrich(body, scope = {}) {
1280
1317
  return await this.requestJson("POST", ENRICH_PATH, {
@@ -1472,6 +1509,11 @@ var XbergClient = class {
1472
1509
  await this.requireTier("pro", "setIntegrationSync");
1473
1510
  await this.requestJson("PUT", `${this.integrationPath(projectId, integrationId)}/sync`, { json: body });
1474
1511
  }
1512
+ /** Pro only: permanently bind an integration to a RAG collection in the same project. */
1513
+ async bindIntegrationRagTarget(projectId, integrationId, body) {
1514
+ await this.requireTier("pro", "bindIntegrationRagTarget");
1515
+ await this.requestJson("PUT", `${this.integrationPath(projectId, integrationId)}/sync/rag-target`, { json: body });
1516
+ }
1475
1517
  /** Pro only: delete an integration (`DELETE .../integrations/{integrationId}`). */
1476
1518
  async deleteIntegration(projectId, integrationId) {
1477
1519
  await this.requireTier("pro", "deleteIntegration");
@@ -1799,6 +1841,14 @@ var XbergClient = class {
1799
1841
  offset: params.offset
1800
1842
  } });
1801
1843
  }
1844
+ /** Enterprise only: update link access using the room's last observed version. */
1845
+ async setRoomLinkAccess(roomId, body, version) {
1846
+ await this.requireTier("enterprise", "setRoomLinkAccess");
1847
+ return this.requestJson("PUT", `${this.roomPath(roomId)}/links`, {
1848
+ json: body,
1849
+ headers: ifMatch(version)
1850
+ });
1851
+ }
1802
1852
  /** Enterprise only: create a share link for a data room. */
1803
1853
  async createRoomLink(roomId, body) {
1804
1854
  await this.requireTier("enterprise", "createRoomLink");
@@ -1959,6 +2009,9 @@ var XbergClient = class {
1959
2009
  integrationPath(projectId, integrationId) {
1960
2010
  return `${this.projectPath(projectId)}/integrations/${encodePathSegment(integrationId)}`;
1961
2011
  }
2012
+ samlProviderPath(projectId, providerId) {
2013
+ return `${this.projectPath(projectId)}/saml/providers/${encodePathSegment(providerId)}`;
2014
+ }
1962
2015
  /** Build `/v1/documents/{documentId}` with the id percent-encoded. */
1963
2016
  documentPath(documentId) {
1964
2017
  return `${DOCUMENTS_PATH}/${encodePathSegment(documentId)}`;