@arbidocs/sdk 0.4.141 → 0.4.143

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.cjs CHANGED
@@ -5426,6 +5426,76 @@ async function declineSignatureRequest(arbi, requestId, reason) {
5426
5426
  );
5427
5427
  }
5428
5428
 
5429
+ // src/operations/house-template.ts
5430
+ var house_template_exports = {};
5431
+ __export(house_template_exports, {
5432
+ getDeploymentHouseTemplate: () => getDeploymentHouseTemplate,
5433
+ isDeploymentAdmin: () => isDeploymentAdmin,
5434
+ listHouseTemplateCandidates: () => listHouseTemplateCandidates,
5435
+ setDeploymentHouseTemplate: () => setDeploymentHouseTemplate,
5436
+ setWorkspaceHouseTemplate: () => setWorkspaceHouseTemplate,
5437
+ supportsHouseTemplates: () => supportsHouseTemplates,
5438
+ workspaceHouseTemplateId: () => workspaceHouseTemplateId
5439
+ });
5440
+ function supportsHouseTemplates(workspace) {
5441
+ return !!workspace && "house_template_ext_id" in workspace;
5442
+ }
5443
+ function workspaceHouseTemplateId(workspace) {
5444
+ return workspace?.house_template_ext_id ?? null;
5445
+ }
5446
+ function isDeploymentAdmin(user) {
5447
+ return user?.is_deployment_admin === true;
5448
+ }
5449
+ function filenameOf(response) {
5450
+ const header = response.headers.get("Content-Disposition") ?? "";
5451
+ const star = /filename\*=UTF-8''([^;]+)/i.exec(header);
5452
+ if (star) return decodeURIComponent(star[1]);
5453
+ return /filename="?([^";]+)"?/i.exec(header)?.[1];
5454
+ }
5455
+ async function getDeploymentHouseTemplate(arbi) {
5456
+ const { data, error, response } = await arbi.fetch.GET("/v1/deployment/house-template", {
5457
+ parseAs: "arrayBuffer"
5458
+ });
5459
+ if (response.status === 404) return null;
5460
+ if (error || !data)
5461
+ throw new ArbiApiError("Could not read the deployment house template", error, response.status);
5462
+ return {
5463
+ bytes: new Uint8Array(data),
5464
+ name: filenameOf(response) ?? "House template.dotx"
5465
+ };
5466
+ }
5467
+ async function setDeploymentHouseTemplate(arbi, file) {
5468
+ if (!file) {
5469
+ requireOk(
5470
+ await arbi.fetch.DELETE("/v1/deployment/house-template"),
5471
+ "Could not clear the deployment house template"
5472
+ );
5473
+ return;
5474
+ }
5475
+ const form = new FormData();
5476
+ form.append("file", file);
5477
+ requireOk(
5478
+ await arbi.fetch.PUT("/v1/deployment/house-template", {
5479
+ // The schema types the multipart file as a string; the FormData is sent as is.
5480
+ body: form,
5481
+ bodySerializer: () => form
5482
+ }),
5483
+ "Could not set the deployment house template"
5484
+ );
5485
+ }
5486
+ async function setWorkspaceHouseTemplate(arbi, documentId) {
5487
+ requireData(
5488
+ await arbi.fetch.PATCH("/v1/workspace/", { body: { house_template_ext_id: documentId } }),
5489
+ "Could not set the house template"
5490
+ );
5491
+ }
5492
+ async function listHouseTemplateCandidates(arbi) {
5493
+ return requireData(
5494
+ await arbi.fetch.GET("/v1/workspace/house-template/candidates"),
5495
+ "Could not list the documents that can be the house template"
5496
+ );
5497
+ }
5498
+
5429
5499
  // src/operations/workspaces.ts
5430
5500
  var workspaces_exports = {};
5431
5501
  __export(workspaces_exports, {
@@ -9991,6 +10061,21 @@ var Arbi = class {
9991
10061
  void: (requestId) => voidSignatureRequest(this.requireClient(), requestId),
9992
10062
  decline: (requestId, reason) => declineSignatureRequest(this.requireClient(), requestId, reason)
9993
10063
  };
10064
+ // ── House templates ─────────────────────────────────────────────────
10065
+ /**
10066
+ * The Word house template: a workspace's own (one of its documents), else the deployment's
10067
+ * default. Only on servers that store them (`supportsHouseTemplates(workspace)`).
10068
+ */
10069
+ houseTemplates = {
10070
+ /** The deployment default, or null when none is set. */
10071
+ deployment: () => getDeploymentHouseTemplate(this.requireClient()),
10072
+ /** Set the deployment default (`null` clears it). Deployment admins only. */
10073
+ setDeployment: (file) => setDeploymentHouseTemplate(this.requireClient(), file),
10074
+ /** Make a document of the open workspace its house template (`null` clears it). Owners only. */
10075
+ setWorkspace: (documentId) => setWorkspaceHouseTemplate(this.requireClient(), documentId),
10076
+ /** The documents the open workspace may use as its house template. */
10077
+ candidates: () => listHouseTemplateCandidates(this.requireClient())
10078
+ };
9994
10079
  // ── Workspace facts ─────────────────────────────────────────────────
9995
10080
  facts = {
9996
10081
  create: (body) => createFact(this.requireClient(), body),
@@ -11177,6 +11262,7 @@ exports.getErrorMessage = getErrorMessage;
11177
11262
  exports.getPublicBookingPage = getPublicBookingPage;
11178
11263
  exports.getRawWorkspaceKey = getRawWorkspaceKey;
11179
11264
  exports.health = health_exports;
11265
+ exports.houseTemplates = house_template_exports;
11180
11266
  exports.identityErrorCode = identityErrorCode;
11181
11267
  exports.identityVerification = identity_exports;
11182
11268
  exports.isSharedSkill = isSharedSkill;