@arbidocs/sdk 0.5.52 → 0.5.54

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
@@ -5612,9 +5612,10 @@ async function getDeploymentHouseTemplate(arbi) {
5612
5612
  const { data, error, response } = await arbi.fetch.GET("/v1/deployment/house-template", {
5613
5613
  parseAs: "arrayBuffer"
5614
5614
  });
5615
- if (response.status === 204 || response.status === 404) return null;
5615
+ const status = response.status;
5616
+ if (status === 204 || status === 404) return null;
5616
5617
  if (error || !data)
5617
- throw new ArbiApiError("Could not read the deployment house template", error, response.status);
5618
+ throw new ArbiApiError("Could not read the deployment house template", error, status);
5618
5619
  return {
5619
5620
  bytes: new Uint8Array(data),
5620
5621
  name: filenameOf(response) ?? "House template.dotx"
@@ -6506,6 +6507,7 @@ async function listTags(arbi, query2 = {}) {
6506
6507
  if (query2.ids?.length) params.ids = query2.ids;
6507
6508
  if (query2.include?.length) params.include = query2.include;
6508
6509
  if (query2.linksLimit !== void 0) params.links_limit = query2.linksLimit;
6510
+ if (query2.workspaceId) params.workspace_ext_id = query2.workspaceId;
6509
6511
  return requireData(
6510
6512
  await arbi.fetch.GET(
6511
6513
  "/v1/tag/",
@@ -6517,6 +6519,7 @@ async function listTags(arbi, query2 = {}) {
6517
6519
  async function createTag(arbi, options) {
6518
6520
  return requireData(
6519
6521
  await arbi.fetch.POST("/v1/tag/", {
6522
+ ...options.workspaceId ? { params: { query: { workspace_ext_id: options.workspaceId } } } : {},
6520
6523
  body: {
6521
6524
  name: options.name,
6522
6525
  tag_type: options.tagType ?? { type: "checkbox", options: [] },
@@ -10884,6 +10887,14 @@ var Arbi = class {
10884
10887
  this.requireLogin();
10885
10888
  return this.requireClient().workspaceKeys.prime(workspaceId);
10886
10889
  }
10890
+ /**
10891
+ * Create a tag in `workspaceId`, named on the request: a switch while it is sent cannot move it to the workspace
10892
+ * opened next, and a workspace other than the current one is opened for this session first.
10893
+ */
10894
+ async createTagIn(workspaceId, options) {
10895
+ await this.targetWorkspace(workspaceId);
10896
+ return createTag(this.requireClient(), { ...options, workspaceId });
10897
+ }
10887
10898
  /** The workspace a call names, opened for this session; `undefined` for the current one. */
10888
10899
  async targetWorkspace(workspaceId) {
10889
10900
  if (!workspaceId || workspaceId === this.currentWorkspaceId) return void 0;
@@ -11802,11 +11813,12 @@ var Arbi = class {
11802
11813
  * each tag's documents, facts and threads: `list({ kind: 'issue', include: ['links'] })` is the
11803
11814
  * issue table's rows (its columns: `tagKinds.get('issue')`).
11804
11815
  */
11805
- list: (query2) => listTags(this.requireClient(), query2),
11806
- create: (options) => createTag(this.requireClient(), {
11807
- ...options,
11808
- workspaceId: options.workspaceId ?? this.requireWorkspace()
11809
- }),
11816
+ /** The open workspace's tags, or `query.workspaceId`'s (opened for this session, not switched to). */
11817
+ list: async (query2) => {
11818
+ await this.targetWorkspace(query2?.workspaceId);
11819
+ return listTags(this.requireClient(), query2);
11820
+ },
11821
+ create: (options) => this.createTagIn(options.workspaceId ?? this.requireWorkspace(), options),
11810
11822
  delete: (tagId) => deleteTag(this.requireClient(), tagId),
11811
11823
  update: (tagId, change) => updateTag(this.requireClient(), tagId, change),
11812
11824
  /** Merge-patch a tag's values for its kind's fields (`null` clears one). */